Commit graph

358 commits

Author SHA1 Message Date
Kjell Tore Guttormsen
5b6c1da8fc chore(privacy): fix factual mashups from phase 2 bulk replace
Phase 2 bulk replace produced a few factually wrong attributions where
real publicly known sector documents/datasets/personas were incorrectly
re-attributed to the fictional generic entity. Genericize those
references instead.

- ros-sector-checklists.md: V440 håndbok citation -> "sektorvise
  faglige håndbøker"; tilsynsmyndighet list -> generic phrasing
- master-data-management-ai.md: NVDB row -> generic "sektor-/fagregistre"
- ai-center-of-excellence-setup.md: NVDB integration line -> generic
  "sektorvise nasjonale registre"
- multimodal-prompt-engineering.md: system_message persona -> generic
  "fagingeniør i norsk offentleg sektor"

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-03 04:30:15 +02:00
Kjell Tore Guttormsen
9ea5a2e6c6 chore(privacy): scrub real-org references from plugin internals (phase 2)
Same bulk replacement applied to plugin-internal KB, examples, fixtures,
tests, and docs. Real organization names, persona names, internal system
identifiers, and domain-specific terms replaced with fictional generic
public-sector entity (DDT) and generic terminology.

Scope:
- okr/ — examples, governance, framework, integrations, sources
- ms-ai-architect/ — KB references (engineering, governance, security,
  infrastructure, advisor), tests/fixtures, agents, docs
- linkedin-thought-leadership/ — voice samples, network-builder,
  examples (genericized identifying headlines to "[your organization]")
- llm-security/ — research notes, scan report

Manual genericization beyond bulk replace:
- okr SKILL.md "Primary user / Domain" — generic Norwegian public sector
- linkedin-voice SKILL.md headline placeholder
- network-builder.md headline placeholder
- high-engagement-posts.md voice sample employer line + hashtag

Phase 3 (factual-attribution review) remains: a few KB files attribute
publicly known transport-sector docs/datasets (e.g. håndbok V440, NVDB)
to the fictional DDT after bulk replace. Needs manual semantic review
to either remove or restore correct citation without re-introducing
affiliation references.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-03 04:28:15 +02:00
Kjell Tore Guttormsen
339abc521e chore(ai-psychosis): release v1.2.0 2026-05-01 21:59:40 +02:00
Kjell Tore Guttormsen
0075fe089b test(ai-psychosis): perf budget validated at v1.2 pattern set 2026-05-01 21:56:14 +02:00
Kjell Tore Guttormsen
f70caf1150 test(ai-psychosis): privacy canary covers v1.2 detectors 2026-05-01 21:54:22 +02:00
Kjell Tore Guttormsen
6fe275825a feat(ai-psychosis): /interaction-report surfaces v1.2 fields 2026-05-01 21:53:41 +02:00
Kjell Tore Guttormsen
eb040cfccb docs(ai-psychosis): SKILL.md cites paper Score 5 + 11 guidance criteria 2026-05-01 21:51:21 +02:00
Kjell Tore Guttormsen
f88639ef41 feat(ai-psychosis): report-reader v1.2 schema + aggregations 2026-05-01 21:47:53 +02:00
Kjell Tore Guttormsen
c5e933b35d feat(ai-psychosis): domain-stakes weighting on alert thresholds 2026-05-01 21:46:29 +02:00
Kjell Tore Guttormsen
c5e8f280d9 feat(ai-psychosis): pushback alert with domain-aware re-contextualization 2026-05-01 21:42:55 +02:00
Kjell Tore Guttormsen
12e6d3b5e4 feat(ai-psychosis): validation-seeking domain-gated alert 2026-05-01 21:41:15 +02:00
Kjell Tore Guttormsen
61584f42d6 feat(ai-psychosis): tier-2 user-info isolation alert (cross-session) 2026-05-01 21:40:24 +02:00
Kjell Tore Guttormsen
4fd5e7b24a feat(ai-psychosis): tier-1 user-info isolation alert (per-session) 2026-05-01 21:38:51 +02:00
Kjell Tore Guttormsen
b88cd8a978 feat(ai-psychosis): add validation-seeking detector 2026-05-01 21:37:06 +02:00
Kjell Tore Guttormsen
ca6567b501 feat(ai-psychosis): add user-info detector (yes_people/yes_digital/no) 2026-05-01 21:34:52 +02:00
Kjell Tore Guttormsen
39ea46441c feat(ai-psychosis): add 8 paper-grounded domain patterns 2026-05-01 21:32:26 +02:00
Kjell Tore Guttormsen
a5bc53cb42 feat(ai-psychosis): promote domain_context to array for multi-domain support 2026-05-01 21:28:36 +02:00
Kjell Tore Guttormsen
011634583b test(ai-psychosis): contract test for v1.1.0 pushback count behavior 2026-05-01 21:25:35 +02:00
Kjell Tore Guttormsen
d8d8315e3e test(ai-psychosis): sync perf fixture to actual pattern count (41) 2026-05-01 21:24:42 +02:00
Kjell Tore Guttormsen
f0f3bc3294 feat(ai-psychosis): add readRecentEndRecords for cross-session reads 2026-05-01 21:23:57 +02:00
Kjell Tore Guttormsen
7b0afdb541 feat(ai-psychosis): add v1.2 thresholds and domain-stakes table 2026-05-01 21:22:51 +02:00
Kjell Tore Guttormsen
1dad53a1e4 docs(ultraplan-local): document /ultracontinue in README + CLAUDE
- README: version badge 3.2.0 → 3.3.0, "Six commands" intro, /ultracontinue row in command table, full /ultracontinue-local section with modes + schema v1 + /ultraplan-end-session helper + typical flow.
- CLAUDE.md: extend validators list (atomic-write util, session-state-validator), bump test count 109 → 185, "7 pipeline handovers" line, Continue paragraph in Architecture, .session-state.local.json + Continue stats in State, Session-state entry in Terminology.

Step 11 of /ultracontinue v3.3.0.
2026-05-01 21:01:34 +02:00
Kjell Tore Guttormsen
d893a46e41 chore(ultraplan-local): bump v3.3.0 + changelog for /ultracontinue [skip-docs]
v3.3.0 ships /ultracontinue-local (zero-friction multi-session resumption),
/ultraplan-end-session-local helper, session-state-validator + atomic-write
util, and Handover 7 (.session-state.local.json contract). Non-breaking.
185 tests green (163 baseline + 22 new).

Step 10 of /ultracontinue v3.3.0. README/CLAUDE updates land in Step 11.
2026-05-01 20:59:23 +02:00
Kjell Tore Guttormsen
2690ab501f feat(ultraplan-local): add /ultraplan-end-session helper for informal multi-session flows [skip-docs]
Tiny helper command for ad-hoc multi-session flows that don't run through
/ultraexecute-local. Writes .session-state.local.json so /ultracontinue
can resume in a fresh chat. Required args (next-brief-path, next-label) —
no inline prompt, headless-safe. Validates via session-state-validator
and prints the same 3-line narration that /ultracontinue Phase 3 uses
(SC-8 cross-project consistency).

Step 9 of /ultracontinue v3.3.0. README/CLAUDE updates land in Step 11.
2026-05-01 20:58:46 +02:00
Kjell Tore Guttormsen
5688512898 docs(ultraplan-local): add Handover 7 + doc-consistency pins for /ultracontinue
Adds Handover 7 (.session-state.local.json) section to HANDOVER-CONTRACTS.md
documenting the multi-session-resume contract:
- Producers: ultraexecute Phase 8/2.55/4 + helper command + future
  graceful-handoff v2.2 + pre-compact-flush refresh
- Consumer: /ultracontinue (read-only)
- Schema v1: schema_version, project, next_session_brief_path,
  next_session_label, status (5-value enum), updated_at
- Forward-compat: unknown top-level keys silently tolerated (drift-WARN)
- Path: .claude/projects/<project>/.session-state.local.json (gitignored)
- Failure modes mapped to validator error codes

Also updates the validator → handover map and Versioning + Stability
tables to include Handover 7.

Extends tests/lib/doc-consistency.test.mjs with three new pins:
1. HANDOVER-CONTRACTS.md contains Handover 7 section
2. session-state-validator.mjs exposes the standard CLI shim
3. CLAUDE.md mentions /ultracontinue-local

Adds the /ultracontinue-local row to the plugin CLAUDE.md commands table —
minimum viable to keep the existing 'CLAUDE.md commands table mentions
every commands/*.md file' iteration test green. Step 11 (Session 2b) will
expand to full README + CLAUDE.md narrative documentation.

Test suite: 182 → 185 (3 new doc-consistency pins, zero regressions).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-01 20:53:47 +02:00
Kjell Tore Guttormsen
af67362c68 feat(ultraplan-local): pre-compact-flush refreshes session-state.local.json [skip-docs]
Extends the PreCompact hook with a sibling block that refreshes
.session-state.local.json's updated_at when status is in_progress or
partial. Per-project: runs after the existing progress.json mutation,
inside the same loop iteration.

Design:
- Only refreshes existing state files; creation is the writer's job
  (ultraexecute Phase 8 / 2.55 / 4 + future helper command).
- Monotonic guard: only updated_at is touched. project, status,
  next_session_brief_path, next_session_label remain owned by the writer.
- Skips status in {completed, failed, stopped} — the latter two are
  operator-action-required and silently bumping updated_at would mask
  alert state.
- Always exit 0; never blocks compaction.

[skip-docs] rationale: README + CLAUDE.md updates land in Step 11.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-01 20:51:42 +02:00
Kjell Tore Guttormsen
e4a11daa68 feat(ultraplan-local): write session-state from ultraexecute session-end paths [skip-docs]
Three insertions in commands/ultraexecute-local.md so every session-end
path produces or refreshes .session-state.local.json (Handover 7):

- Phase 2.55 (Check 1, line ~376): write status=stopped on dirty-tree
  pre-flight stop before parallel session-spawn
- Phase 4 (line ~773): write status=stopped when entry condition fails
- Phase 8 (line ~1151): canonical convergence — every completed/failed/
  stopped/partial run refreshes the state file using atomicWriteJson +
  validator verification

Phase 2.3 (validate exit) and Phase 5 (dry-run) intentionally skip the
write — neither path is resumable. Validator errors warn but never block
the run; progress.json remains authoritative.

[skip-docs] rationale: README + CLAUDE.md updates land in Step 11.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-01 20:50:28 +02:00
Kjell Tore Guttormsen
43cdc0b968 feat(ultraplan-local): add /ultracontinue command for multi-session resumption [skip-docs]
Reads .claude/projects/<project>/.session-state.local.json (Handover 7),
narrates a 3-line summary, and immediately begins executing the next
session — no interactive confirmation, headless-safe.

Phases:
- 0: --help (self-documenting per brief NFR)
- 1: resolve project dir (auto-discover via node -e enumeration)
- 2: validate via session-state-validator
- 3: narrate (project / next_session_label / brief path)
- 4: read brief and begin
- 5: stats

[skip-docs] rationale: README + CLAUDE.md updates land in Step 11 (Session
2b) per plan structure. Step 8 (docs:) updates HANDOVER-CONTRACTS.md and
the doc-consistency test pin in the same session.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-01 20:49:01 +02:00
Kjell Tore Guttormsen
28e381a711 release(config-audit): v5.1.0 — plain-language UX humanizer
Plain-language UX humanizer release. Default output of all 18 commands
now leads with prose; technical IDs surface at end-of-line as references
rather than headlines. Scanner internals are unchanged; humanization is
a pure output-time transform applied at the rendering layer.

Highlights:
- New scanner-lib modules: humanizer.mjs, humanizer-data.mjs (TRANSLATIONS
  for 13 scanner prefixes)
- New --raw flag threaded through every CLI for byte-stable v5.0.0
  verbatim output (--json unchanged from v5.0.0, also byte-stable)
- 5 user-impact categories, 5 action-language phrases, 3 relevance contexts
- Self-audit terminal output also humanized; --json path unchanged
- 21 command and agent templates updated for humanized rendering with
  --raw passthrough
- 635 → 792 tests (+157) including SC-3 forbidden-words lint, SC-4
  scenario read-test, SC-5/6/7 backwards-compat snapshots

Migration:
- Existing --json automation: zero changes required (envelope is
  byte-stable with v5.0.0; humanizer fields are bypassed)
- stderr-scraping tooling: review default mode (now uses prose); pass
  --raw for v5.0.0 verbatim
- No scanner-internal changes (IDs, severity ladders, scoring weights,
  area scorecards all unchanged)

Verification:
- 792/792 tests pass
- self-audit configGrade A (97), pluginGrade A (100), readmeCheck passed
- README badge: tests-635+ → tests-792+
2026-05-01 20:38:07 +02:00
Kjell Tore Guttormsen
fc8808d6e4 docs(humanizer): v5.1.0 release notes across plugin + marketplace docs
- Plugin README: add "What's New in v5.1.0" section with humanizer overview,
  before/after example, plain-language vocabulary table, --raw flag docs.
  Bump version badge 5.0.0 → 5.1.0. Add Version History row.
- Plugin CLAUDE.md: add humanizer.mjs + humanizer-data.mjs to Scanner Lib
  table. Add "Plain-Language Output (v5.1.0)" section documenting output
  modes, vocabularies, and Wave 5 lessons. Bump test count 635 → 792 across
  52 test files.
- Marketplace root README: bump config-audit entry 5.0.0 → 5.1.0, update
  one-line description to mention plain-language UX, add bullet for the
  v5.1.0 humanizer, bump test count 635+ → 792+.

Test-normalizer hardening (consequence of growing CLAUDE.md):
walkClaudeMdCascade walks upward from the marketplace-medium fixture into
this plugin's own CLAUDE.md, so any docs edit ripples into
`scanners[*].activeConfig.claudeMdEstimatedTokens`. The v5.0.0 byte-stability
contract is about scanner internals being unchanged, not ancestor input
content being frozen. Normalizers in json-backcompat, raw-backcompat,
posture-humanizer, scan-orchestrator-humanizer, and snapshot-default-output
now strip claudeMdEstimatedTokens to <ANCESTOR_DERIVED>. The
default-output snapshot for scan-orchestrator was re-seeded via
UPDATE_SNAPSHOT=1 (intent: Wave 6 docs additions; humanizer prose
unchanged).

Verify:
- grep -E "5\.1\.0|v5\.1\.0" README.md CLAUDE.md ../../README.md | wc -l = 12
- node --test 'tests/**/*.test.mjs' = 792/792 pass
- self-audit configGrade A (97), pluginGrade A (100), readmeCheck.passed true
2026-05-01 20:35:24 +02:00
Kjell Tore Guttormsen
819fd47ce0 feat(ultraplan-local): add session-state-validator + tests for /ultracontinue
Validator at lib/validators/session-state-validator.mjs:
- validateSessionStateObject(parsed, opts) — pure object validation
- validateSessionStateContent(jsonText, opts) — wraps JSON parse + validation
- validateSessionState(filePath, opts) — file-mode with existsSync guard
- CLI shim with --json output (errors→stderr, result→stdout, exit 0/1/2)
- Schema v1: schema_version, project, next_session_brief_path,
  next_session_label, status, updated_at
- Error codes: SESSION_STATE_PARSE_ERROR, SESSION_STATE_NOT_FOUND,
  SESSION_STATE_MISSING_FIELD, SESSION_STATE_INVALID_STATUS,
  SESSION_STATE_NOT_RESUMABLE (warning), SESSION_STATE_SCHEMA_MISMATCH,
  SESSION_STATE_INVALID_TIMESTAMP, SESSION_STATE_INVALID_PATH
- Forward-compat hard requirement: unknown top-level keys ignored —
  protects future graceful-handoff v2.2 dual-writes

Tests at tests/validators/session-state-validator.test.mjs — 15 subtests:
- happy path + 5 missing-field tests
- invalid status, completed warns NOT_RESUMABLE, schema mismatch, bad
  timestamp, malformed JSON, missing file
- fixture load (SC-1) + malformed fixture (SC-3)
- forward-compat: unknown keys ignored silently

167 → 182 tests, 0 fail.

Step 4 of /ultracontinue v3.3.0. Closes Session 1 of the execution
strategy (foundation: gitignore + util + fixtures + validator+tests).
2026-05-01 20:23:09 +02:00
Kjell Tore Guttormsen
b99773ec27 chore(humanizer): README test-count badge + self-audit terminal humanization
- Bump README test-count badge: 635 → 792 (matches filesystem after Wave 0–5)
- Wire formatSelfAudit() through humanizeEnvelope + humanizeFindings so the
  terminal-output path renders humanized finding titles. The --json path is
  unchanged — only the prose terminal render is humanized.
- readmeCheck.passed now returns true; configGrade A (97), pluginGrade A (100)
2026-05-01 20:22:09 +02:00
Kjell Tore Guttormsen
12eae8c678 test(ultraplan-local): add session-state fixtures
Two fixtures for session-state-validator (Step 4):
- valid-in-progress.json — well-formed schema-v1 object
- malformed.json — truncated JSON for negative tests

Step 3 of /ultracontinue v3.3.0.
2026-05-01 20:21:50 +02:00
Kjell Tore Guttormsen
655c8d46f8 refactor(ultraplan-local): extract atomicWriteJson to lib/util
Three changes in one commit:

1. NEW lib/util/atomic-write.mjs — exports atomicWriteJson(path, obj),
   the canonical tmp+rename pattern. Reused by pre-compact-flush.mjs and
   (in subsequent steps) by the new session-state writer.

2. NEW tests/lib/atomic-write.test.mjs — 4 unit tests covering
   round-trip, no-orphan-tmp, overwrite-atomic, pretty-print formatting.

3. REFACTOR hooks/scripts/pre-compact-flush.mjs — replace the inline
   atomicWrite() with the imported atomicWriteJson(). Also fixes a
   pre-existing syntax error (leading whitespace + stray --resume token
   outside the comment block) that silently broke the hook from v3.1.0
   onward — PreCompact runtime is fail-open and swallowed the error.
   File reformatted with standard zero-indent JS.

163 → 167 tests, 0 fail.

Step 2 of /ultracontinue v3.3.0 (project 2026-05-01-ultracontinue).
2026-05-01 20:21:15 +02:00
Kjell Tore Guttormsen
bdddf52873 chore(ultraplan-local): gitignore *.local.json for session-state files
Brief assumed *.local.* covered .session-state.local.json — only *.local.md
existed. Adding *.local.json before any state file can be created.

Step 1 of /ultracontinue v3.3.0 (project 2026-05-01-ultracontinue).
2026-05-01 20:18:22 +02:00
Kjell Tore Guttormsen
ec4ac3e6d1 feat(humanizer): update agent system prompts [skip-docs]
Wave 5 Step 16 — final wave step. Threads humanizer-aware rendering
rules through the three agent prompts that produce user-facing output,
and adds a shape test that locks the structure.

- agents/analyzer-agent.md: documents the humanizer envelope shape
  (userImpactCategory, userActionLanguage, relevanceContext) in the
  Input section; new "Humanizer-aware rendering rules" subsection
  instructs the agent to: render humanized title/description/
  recommendation verbatim, group findings by userImpactCategory, lead
  each line with userActionLanguage, surface relevanceContext when
  not affects-everyone, and skip jargon-translation subroutines.
  --raw fallback documented (v5.0.0 verbatim severity prefiks).
- agents/planner-agent.md: documents the same vocabulary; instructs
  the planner to consume humanized fields from the analysis report,
  preserve titles verbatim, and order actions by both dependencies
  AND userActionLanguage urgency. Translation duties explicitly
  removed from the plan.
- agents/feature-gap-agent.md: replaces the inline t1/t2/t3/t4
  tier-to-prose section ladder with userActionLanguage-driven
  groupings ("Fix soon" → High Impact, "Fix when convenient" →
  Worth Considering, "Optional cleanup"/"FYI" → Explore When Ready);
  instructs skipping findings whose relevanceContext is
  test-fixture-no-impact; --raw fallback documented.

tests/agents/agent-prompt-shape.test.mjs (new, +6 tests, 786 → 792):
  - structural: humanized field reference + frontmatter preserved
  - per-agent anchors: analyzer groups by userImpactCategory; planner
    orders by userActionLanguage; feature-gap references
    test-fixture-no-impact
  - global: no "explain what {jargon} means" / "translate jargon" /
    "jargon-translation duty" prose anywhere

Self-audit: Grade A unchanged (config 97/100, plugin 100/100).
2026-05-01 19:53:59 +02:00
Kjell Tore Guttormsen
347d4a2c4c feat(humanizer): update action command templates [skip-docs]
Wave 5 Step 15. Threads --raw plumbing through all seven action
command templates and adds a shape test covering structural plumbing
plus help.md's plain-language vocabulary.

- commands/fix.md: --raw flag parsed; fix-plan rendering groups by
  userActionLanguage; humanized title/description/recommendation are
  rendered verbatim from the cross-referenced scan envelope.
- commands/rollback.md: terminology pass — "manifest" → "list of
  changes" in user-facing copy; the file name manifest.yaml is kept
  as the machine contract; --raw threaded through.
- commands/plan.md: --raw forwarded to the planner-agent's prompt;
  agent now instructed to group actions by userImpactCategory and
  lead with userActionLanguage; bash block added for flag parsing.
- commands/implement.md: --raw forwarded to the implementer-agent's
  prompt; progress-log lines now reference the humanized titles
  already present in the action plan.
- commands/cleanup.md: --raw accepted as no-op (cleanup is
  file-management only, no findings prose); bash block added.
- commands/help.md: full plain-language pass — "PreToolUse" and
  "frontmatter" jargon removed from user-facing copy; new
  vocabulary table surfaces the humanized userImpactCategory and
  userActionLanguage labels ("Configuration mistake", "Conflict",
  "Wasted tokens", "Missed opportunity", "Dead config" / "Fix this
  now", "Fix soon", "Fix when convenient", "Optional cleanup",
  "FYI"); --raw documented as global pass-through flag.
- commands/interview.md: --raw accepted as no-op; "unused hooks"
  question phrased as "unused automation that runs at specific
  events" in user-facing copy.

tests/commands/action-commands-shape.test.mjs (new, +6 tests, 780 → 786):
  - structural: bash block + Read tool + --raw/$ARGUMENTS plumbing
    across all 7 files
  - help.md vocabulary: ≥3 userImpactCategory labels and ≥3
    userActionLanguage phrases present
  - help.md jargon: no bare "PreToolUse" or "frontmatter" in copy
2026-05-01 19:50:47 +02:00
Kjell Tore Guttormsen
6f38a6340e feat(humanizer): update audit/analysis command templates group B [skip-docs]
Wave 5 Step 14. Threads the humanizer vocabulary through the remaining
six audit/analysis command templates and adds a shape test that locks
the structure plus a pair of anchor must-contains.

- commands/drift.md: --raw pass-through; new/resolved/changed-finding
  rendering instructions reference userActionLanguage and
  relevanceContext rather than raw severity.
- commands/plugin-health.md: --raw pass-through; finding rendering
  groups by userImpactCategory and leads with userActionLanguage.
- commands/config-audit.md (router): replaces the 25-line A/B/C/D/F
  prose ladder with a humanized stderr-scorecard reference + three
  userActionLanguage-grouped "What you can do next" branches; --raw
  threaded through both scan-orchestrator and posture invocations.
- commands/discover.md: --raw pass-through; finding-summary rendering
  groups by userImpactCategory.
- commands/analyze.md: --raw pass-through; analyzer-agent prompt now
  instructs grouping by userImpactCategory and leading with
  userActionLanguage; humanized title/description/recommendation
  strings rendered verbatim, no paraphrasing.
- commands/status.md: phase-label humanization table — current_phase
  machine field name preserved, user-facing labels translated
  ("Looking at your config files", "Working out what to recommend",
  "Asking what you'd like to focus on", "Putting together your action
  plan", "Making the changes", "Double-checking everything worked");
  --raw preserves verbatim machine field values.

tests/commands/group-b-shape.test.mjs (new, +8 tests, 772 → 780):
  - structural: bash block + Read tool + --raw/$ARGUMENTS plumbing
    across all 6 files
  - findings-renderers: humanized field reference + no grade-prose
  - anchor must-contains per plan: config-audit.md ⊇
    userImpactCategory|userActionLanguage; drift.md ⊇ --raw|humanized
  - status.md: current_phase preserved + ≥3 humanized phase labels
2026-05-01 19:45:55 +02:00
Kjell Tore Guttormsen
79b6e29073 feat(humanizer): update audit/analysis command templates group A [skip-docs]
Wave 5 Step 13. Threads the humanizer vocabulary through five audit/
analysis command templates and adds a shape test that locks the
structure in place.

- commands/posture.md, tokens.md, feature-gap.md (findings-renderers):
  reference userImpactCategory/userActionLanguage/relevanceContext;
  remove hardcoded A/B/C/D/F-to-prose tables (humanizer owns the
  grade-context vocabulary now via the stderr scorecard headline).
- commands/manifest.md, whats-active.md (inventory CLIs): add --raw
  pass-through for CLI-surface consistency. --raw is a no-op in these
  CLIs, but the flag is threaded through so users get uniform behaviour.
- All five files: --raw flag parsed from $ARGUMENTS and passed verbatim
  to the underlying scanner CLI when present.

tests/commands/group-a-shape.test.mjs (new, +5 tests, 767 → 772):
  - structural: every file has a bash invocation block, Read tool
    reference, and --raw/$ARGUMENTS plumbing
  - findings-renderers only: at least one humanized field referenced;
    no hardcoded "[grade] grade is..." prose tables
2026-05-01 19:41:08 +02:00
Kjell Tore Guttormsen
07629e9dae test(humanizer): default-output snapshot test (SC-5) [skip-docs]
Step 12 of v5.1.0 humanizer Wave 4. Adds tests/snapshot-default-output
.test.mjs and seeds three snapshots in tests/snapshots/default-output/
that capture humanized default-mode output for representative CLIs.

Coverage:

- scan-orchestrator: stdout JSON envelope (humanized findings); time
  fields normalized.
- token-hotspots-cli: stdout JSON envelope (humanized payload.findings);
  duration_ms normalized.
- posture: stderr humanized scorecard; (Xms) durations normalized.

Snapshot envelope is uniform on disk: { kind: 'json', payload: ... }
for JSON streams and { kind: 'text', payload: '...' } for stderr text.
This keeps the snapshot files self-describing and easy to read.

Re-seeding requires UPDATE_SNAPSHOT=1 — drift fails the test by design,
so any humanizer prose change is intentional and re-approved.

Tests: 764 to 767 (+3 SC-5 cases). Full suite passes.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-01 18:21:31 +02:00
Kjell Tore Guttormsen
20b867adc1 test(humanizer): --raw backwards-compatibility test (SC-7) [skip-docs]
Step 11 of v5.1.0 humanizer Wave 4. Adds tests/raw-backcompat.test.mjs
mirroring the SC-6 contract for the --raw flag — the explicit "v5.0.0
verbatim" escape hatch.

- 4 fixture-deterministic CLIs (scan-orchestrator, posture,
  token-hotspots-cli, fix-cli) get strict byte-equal against
  tests/snapshots/v5.0.0/<cli>.json with time fields normalized.
- drift-cli is checked under the same contract guarded by
  ensureDriftBaseline.
- 3 environment-aware CLIs (plugin-health, manifest, whats-active) are
  checked for mode-equivalence (--raw equals --json).
- Posture additionally asserts its --raw stderr scorecard reproduces
  tests/snapshots/v5.0.0-stderr/posture.txt verbatim, modulo (Xms)
  duration markers normalized to (0ms).
- Cross-cutting suite asserts --raw findings carry no humanizer fields
  on any CLI.

Tests: 751 to 764 (+13 SC-7 cases). Full suite passes.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-01 18:20:04 +02:00
Kjell Tore Guttormsen
12af13a703 test(humanizer): JSON backwards-compatibility test (SC-6) [skip-docs]
Step 10 of v5.1.0 humanizer Wave 4. Adds tests/json-backcompat.test.mjs
asserting that --json output of every CLI remains backwards-compatible
with the v5.0.0 contract.

Coverage strategy mirrors Wave 3 cli-humanizer test discovery:

- 4 fixture-deterministic CLIs (scan-orchestrator, posture,
  token-hotspots-cli, fix-cli) get strict byte-equal byte-equal --json
  vs frozen tests/snapshots/v5.0.0/ snapshot, with time-varying fields
  (timestamp, target path, duration_ms, generatedAt, durationMs)
  normalized.
- drift-cli is checked with the same byte-equal contract guarded by an
  ensureDriftBaseline precondition; the test silently skips when the
  baseline cannot be created.
- 3 environment-aware CLIs (plugin-health-scanner, manifest,
  whats-active) read live config-cascade state, so frozen snapshots
  drift as the marketplace evolves. They are verified by mode-
  equivalence (--json equals --raw) instead — the same approach
  established in Wave 3 cli-humanizer.test.mjs.

A cross-cutting suite asserts --json output of the 4 deterministic
CLIs never carries humanizer fields (userImpactCategory,
userActionLanguage, relevanceContext) on any finding, walking both
top-level findings arrays and scanners[].findings paths.

Tests: 739 to 751 (+12 SC-6 cases). Full suite passes.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-01 18:18:29 +02:00
Kjell Tore Guttormsen
8b146bf489 feat(humanizer): scenario read-test corpus + runner (SC-4) [skip-docs]
Step 9 of v5.1.0 humanizer Wave 4. Adds tests/scenario-read-test.mjs
runner, tests/scenario-read-test.test.mjs wrapper, and 5 scenario
fixtures in tests/scenarios/ that feed deterministic raw findings
through humanizeFinding and assert the humanized
title/description/recommendation match brief-owner-approved regex
patterns encoding the ground-truth what/why/whatNext answers.

Corpus selection (per brief criteria):

- 01-tok-cascade.json - TOK/CPS category (token efficiency)
- 02-cps-volatile.json - TOK/CPS category (cache prefix stability)
- 03-cnf-conflict.json - CNF category (conflicts)
- 04-gap-no-claude-md.json - GAP category (feature gap)
- 05-set-invalid-json.json - SET category, AND its v5.0.0 title +
  description carry tier1 'invalid' (the brief criterion 'one finding
  whose v5.0.0 description uses a forbidden word').

Runner mechanics:

- Loads scenarios matching ^\\d{2}-[a-z0-9-]+\\.json$ in sorted order.
- Calls humanizeFinding(scannerInput) and matches each humanized field
  against its declared pattern (case-insensitive regex).
- Verifies humanizer-added structural fields (userImpactCategory,
  userActionLanguage, relevanceContext) are non-empty strings.
- Per session decision (1a) acceptance is deterministic regex matching
  without a runtime human approval gate.

Wrapper adds 3 tests: scenario-match (binds runner to node --test),
category-coverage (TOK/CPS, CNF, GAP, SET all present), and
tier1-presence (at least one v5.0.0 title or description contains a
tier1 forbidden word).

Tests: 736 to 739 (+3 SC-4 tests). Full suite passes.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-01 18:16:23 +02:00
Kjell Tore Guttormsen
c5c937e94e feat(humanizer): forbidden-words lint runner + test wrapper (SC-3) [skip-docs]
Step 8 of v5.1.0 humanizer Wave 4. Adds tests/lint-default-output.mjs
runner and tests/scanners/lint-default-output.test.mjs wrapper that
exercise SC-3 against the 6 prose CLIs (scan-orchestrator, posture,
token-hotspots-cli, plugin-health-scanner, drift-cli, fix-cli) running
in default (humanized) mode against tests/fixtures/marketplace-medium.

Lint scope is stderr only — JSON envelope keys ("scanner", "severity")
are structural, not prose. Humanized prose fields embedded inside JSON
are already covered by tests/lib/humanizer-data.test.mjs tier1/tier3
checks. Code references inside backticks pass the lint
(stripBacktickSpans) so technical identifiers can appear when wrapped.

Default-mode prose fixes to land lint at zero violations:

- scan-orchestrator: top banner switches to "Config-Audit v2.2.0" and
  per-scanner progress wraps "[XXX] Label" in backticks. --raw and
  --json paths preserve the v5.0.0 verbatim banner via new
  opts.humanizedProgress flag on runAllScanners.
- plugin-health-scanner: top banner switches to "Plugin Health v2.1.0"
  in default mode; --raw/--json keep "Plugin Health Scanner v2.1.0".
- scoring.mjs generateHealthScorecard humanized branch: area names
  (CLAUDE.md, Hooks, MCP, Settings, Rules, Imports, Conflicts, Token
  Efficiency, Plugin Hygiene) are wrapped in backticks; dot-padding
  compensates so column alignment matches v5.0.0 layout.
- posture / drift-cli / fix-cli: thread humanizedProgress flag through
  their runAllScanners calls so default mode emits humanized progress
  and --raw/--json preserve the v5.0.0 stderr snapshot.

Test infrastructure only — user-facing docs land in Wave 5/6 once
commands and agents consume the humanized payload.

Tests: 735 to 736 (+1 SC-3 wrapper). Full suite passes.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-01 18:11:15 +02:00
Kjell Tore Guttormsen
4d338d973e docs(ai-psychosis): README + CLAUDE.md cover v1.1.0; ROADMAP.md tracks v1.2
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-01 18:09:58 +02:00
Kjell Tore Guttormsen
0392f1062e chore(ai-psychosis): bump version 1.0.0 → 1.1.0
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-01 18:07:51 +02:00
Kjell Tore Guttormsen
767bc06c51 test(ai-psychosis): extend privacy canary to pattern-phrase leak 2026-05-01 17:56:31 +02:00
Kjell Tore Guttormsen
146cf8ba35 test(ai-psychosis): perf.test.mjs enforces hook timing budget 2026-05-01 17:56:03 +02:00
Kjell Tore Guttormsen
5eecb968d8 feat(humanizer): wire humanizer into 6 remaining CLIs with --raw
Adds --raw flag to all 6 remaining CLIs and wires humanization into the
default rendering path. --json and --raw both bypass humanization for
v5.0.0 byte-equal output; default mode humanizes findings/diff/prose.

  token-hotspots-cli: humanizes payload.findings before stdout JSON write.
  plugin-health-scanner: humanizes finding titles in stderr brief summary;
    --json/--raw write byte-identical v5.0.0-shape result to stdout.
  drift-cli: humanizes diff.{newFindings,resolvedFindings,unchangedFindings,
    movedFindings} before formatDiffReport; --raw applies to save and list
    modes too. Baselines remain raw v5.0.0 on disk.
  fix-cli: humanizes manual-finding titles in stderr fix-plan prose; both
    --json and --raw produce identical machine-readable JSON to stdout.
  manifest, whats-active: --raw is a no-op (no findings, inventory only)
    but parsed for CLI surface consistency.

Decision on missing --output-file flag for drift-cli/fix-cli/plugin-health:
deferred. SC-6/SC-7 tests in Wave 4 will use stdout-redirect (the simpler
Alt B path) since these CLIs already write JSON to stdout in machine modes.

Test cli-humanizer.test.mjs covers all 6 CLIs. Three CLIs that read
environment state (plugin-health, manifest, whats-active) verify
mode-equivalence (--json == --raw) instead of frozen-snapshot byte-equal,
because their output reflects current marketplace state which drifts as
plugins are added since the Wave 0 capture.

Wave 3 / Step 7 of v5.1.0 humanizer.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-01 17:47:09 +02:00
Kjell Tore Guttormsen
3041c90115 feat(ai-psychosis): /interaction-report adds pushback metrics + reader script 2026-05-01 17:41:30 +02:00