@jamie-tam/forge 6.0.0 → 6.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/README.md +77 -59
  2. package/agents/dreamer.md +10 -7
  3. package/agents/gotcha-hunter.md +1 -1
  4. package/agents/prototype-codifier.md +2 -2
  5. package/commands/{forge.md → discover.md} +13 -9
  6. package/commands/dream.md +71 -0
  7. package/commands/feature.md +57 -10
  8. package/commands/{evolve.md → forge-evolve.md} +3 -3
  9. package/commands/greenfield.md +5 -5
  10. package/commands/note.md +64 -0
  11. package/commands/{task-force.md → parallel.md} +15 -15
  12. package/commands/resume.md +2 -2
  13. package/commands/setup.md +18 -17
  14. package/commands/status.md +2 -2
  15. package/commands/wrap.md +130 -0
  16. package/dist/__tests__/hooks.test.js +334 -0
  17. package/dist/__tests__/init.test.js +110 -0
  18. package/dist/__tests__/work-manifest.test.js +48 -14
  19. package/dist/cli.js +0 -0
  20. package/dist/hooks.js +88 -6
  21. package/dist/init.js +39 -1
  22. package/dist/uninstall.js +11 -5
  23. package/dist/work-manifest.js +63 -24
  24. package/hooks/config/gate-requirements.json +1 -1
  25. package/hooks/hooks.json +14 -1
  26. package/hooks/scripts/gate-enforcer.sh +51 -6
  27. package/hooks/scripts/pre-compact.sh +120 -55
  28. package/hooks/scripts/session-start.sh +43 -4
  29. package/hooks/scripts/telemetry.sh +32 -2
  30. package/hooks/templates/CLAUDE.md.template +6 -3
  31. package/package.json +1 -1
  32. package/references/common/phases.md +8 -6
  33. package/references/common/skill-authoring.md +1 -1
  34. package/rules/common/forge-system.md +64 -6
  35. package/rules/common/quality-gates.md +2 -0
  36. package/skills/build-prototype/SKILL.md +4 -4
  37. package/skills/build-tdd/SKILL.md +14 -0
  38. package/skills/concept-slides/SKILL.md +11 -11
  39. package/skills/deliver-deploy/SKILL.md +10 -1
  40. package/skills/harden/SKILL.md +22 -8
  41. package/skills/iterate-prototype/SKILL.md +22 -0
  42. package/skills/quality-test-execution/SKILL.md +26 -1
  43. package/skills/quality-test-plan/SKILL.md +21 -1
  44. package/skills/support-debug/SKILL.md +1 -1
  45. package/skills/support-dream/SKILL.md +8 -7
  46. package/skills/support-gotcha/SKILL.md +3 -3
  47. package/skills/{support-task-force → support-parallel}/SKILL.md +22 -22
  48. package/skills/{support-task-force → support-parallel}/references/dispatch-pattern.md +10 -10
  49. package/skills/{support-task-force → support-parallel}/references/synthesis-template.md +10 -10
  50. package/skills/support-skill-validator/SKILL.md +5 -5
  51. package/skills/support-skill-validator/references/validation-checks.md +1 -1
  52. package/skills/support-system-guide/SKILL.md +4 -3
  53. package/skills/support-wiki-lint/scripts/lint.mjs +52 -0
  54. package/templates/README.md +1 -1
  55. package/templates/aiwiki/CLAUDE.md.template +48 -22
  56. package/templates/aiwiki/schemas/session.md +134 -49
  57. package/templates/manifests/bugfix.yaml +1 -1
  58. package/templates/manifests/feature.yaml +1 -1
  59. package/templates/manifests/greenfield.yaml +1 -1
  60. package/templates/manifests/hotfix.yaml +1 -1
  61. package/templates/manifests/refactor.yaml +1 -1
  62. package/templates/manifests/v5/SCHEMA.md +14 -17
  63. package/templates/manifests/v5/feature.yaml +1 -1
  64. package/templates/manifests/v6/SCHEMA.md +14 -10
  65. package/commands/abort.md +0 -25
  66. package/dist/__tests__/active-manifest.test.js +0 -272
  67. package/dist/__tests__/gate-check.test.js +0 -384
  68. package/dist/active-manifest.js +0 -229
  69. package/dist/gate-check.js +0 -326
@@ -0,0 +1,64 @@
1
+ ---
2
+ name: note
3
+ description: "Append a one-off research note, brainstorm, or insight to aiwiki/raw/{date}.md with a timestamp. Zero schema, zero friction — capture first, dream consolidates later. Use during Phase 1-2 research, ad-hoc exploration, or any thought worth remembering that doesn't yet fit a typed page (decision/gotcha/convention)."
4
+ ---
5
+
6
+ # /note — Capture to aiwiki/raw
7
+
8
+ Append the user-supplied text to `aiwiki/raw/{YYYY-MM-DD}.md` under a timestamped header. No schema, no judgment — just capture. The wiki-lint hook fires automatically on save (no-op for raw/ since raw has no schema). `support-dream` consolidates raw entries at phase-close and PreCompact (~85% context), promoting anything that matches a typed schema to `aiwiki/proposed/{dream_id}/` for review.
9
+
10
+ ## Steps
11
+
12
+ 1. **Note text** = everything after `/note ` in the user's invocation. If the argument is empty, ask the user what they'd like to capture and wait for the reply.
13
+ 2. **Today's date** = `$(date +%Y-%m-%d)`.
14
+ 3. **Target file** = `aiwiki/raw/{date}.md`. Create the directory if needed: `mkdir -p aiwiki/raw`.
15
+ 4. **If the file doesn't exist**, start it with: `# Raw notes — {date}` followed by a blank line.
16
+ 5. **Append a section**:
17
+ - Header: `## {HH:MM} — {first ~60 chars of the note, no trailing punctuation}`
18
+ - Blank line
19
+ - The full note body
20
+ - Blank line
21
+ 6. **Confirm to the user**: "Captured to `aiwiki/raw/{date}.md`."
22
+
23
+ ## Example
24
+
25
+ User: `/note Considering Tailwind v4 — oxide engine fast but plugin ecosystem still broken in 2026; revisit in Q3`
26
+
27
+ Resulting `aiwiki/raw/2026-05-15.md`:
28
+
29
+ ```markdown
30
+ # Raw notes — 2026-05-15
31
+
32
+ ## 14:23 — Considering Tailwind v4 — oxide engine fast but plugin ecosystem
33
+
34
+ Considering Tailwind v4 — oxide engine fast but plugin ecosystem still broken in 2026; revisit in Q3
35
+ ```
36
+
37
+ ## When to use
38
+
39
+ - During **Phase 1 (concept)** or **Phase 2 (wireframe)** when research or brainstorm yields an insight worth remembering — neither phase auto-captures to aiwiki, so `/note` is the manual hook.
40
+ - During any phase when a thought doesn't yet fit a typed page (it's not yet a decision, not yet a confirmed gotcha, not yet an established convention).
41
+ - When deferring a decision: "considered X, need more info before committing."
42
+
43
+ ## When NOT to use
44
+
45
+ - The content is a **decision** → write to `aiwiki/decisions/` directly using the decision schema. Future agents read that folder for ADRs; raw notes there won't be retrieved predictably.
46
+ - The content is a **confirmed gotcha** (with reproducible failure mode) → write to `aiwiki/gotchas/` directly so gotcha-hunter can find it.
47
+ - The content is an **established convention** → write to `aiwiki/conventions/` so harden and code-reviewer can enforce it.
48
+
49
+ `/note` is for the in-between — research, hypotheses, half-formed thoughts that haven't earned a typed page yet. Dream consolidation will promote anything that matures into a typed shape.
50
+
51
+ ## I/O Contract
52
+
53
+ | Field | Value |
54
+ |---|---|
55
+ | **Requires** | `aiwiki/` directory (scaffolded by `/setup`) |
56
+ | **Produces** | New or appended `aiwiki/raw/{YYYY-MM-DD}.md` |
57
+ | **Triggers** | `wiki-lint` PostToolUse hook (no-op for raw/) |
58
+ | **Feeds into** | `support-dream` at phase-close and PreCompact — raw entries that match typed schemas get promoted to `aiwiki/proposed/{dream_id}/` for user review |
59
+
60
+ ## Do NOT
61
+
62
+ - Do NOT edit prior entries. The point is append-only history. If a note turned out wrong, append a correction with the new timestamp.
63
+ - Do NOT structure the note. Plain prose. Schema-fitting is dream's job, not yours.
64
+ - Do NOT use `/note` for things that already fit a typed schema — write the typed page directly instead.
@@ -1,12 +1,12 @@
1
1
  ---
2
- name: task-force
3
- description: "Dispatch a parallel task-force per item in a user-provided punch list. Phase-aware sizing (light teams in prototype phases, full crew in production). Routes command-shaped items (features, bugfixes, refactors) to their owning commands. Include !max (or --full-power) in your prompt to force full-crew production teams regardless of detected phase."
2
+ name: parallel
3
+ description: "Dispatch parallel agents per item in a user-provided punch list. Phase-aware sizing (light teams in prototype phases, full crew in production). Routes command-shaped items (features, bugfixes, refactors) to their owning commands. Include !max (or --full-power) in your prompt to force full-crew production teams regardless of detected phase."
4
4
  argument-hint: "task1; task2; task3 (or numbered/bulleted list); append !max to force full crew"
5
5
  ---
6
6
 
7
- # /task-force
7
+ # /parallel
8
8
 
9
- Run a parallel ad-hoc task-force dispatcher over a punch list of independent tasks.
9
+ Run a parallel ad-hoc dispatcher over a punch list of independent tasks.
10
10
 
11
11
  ## When to use
12
12
 
@@ -25,26 +25,26 @@ Run a parallel ad-hoc task-force dispatcher over a punch list of independent tas
25
25
 
26
26
  ## Process
27
27
 
28
- REQUIRED SUB-SKILL: Use **support-task-force** to:
28
+ REQUIRED SUB-SKILL: Use **support-parallel** to:
29
29
  1. Run Codex consent (one-time per run, per `protocols/codex.md`)
30
30
  2. Detect repo phase (prototype vs production) from active manifest or repo state
31
31
  3. Parse the task list (numbered, bulleted, or semicolon-separated argument)
32
32
  4. Classify each task by type (dev / research / debug / docs / review / security / quick / complex / command-shaped)
33
- 5. Route command-shaped items to their owning commands (do NOT dispatch task-forces for them)
33
+ 5. Route command-shaped items to their owning commands (do NOT dispatch parallel runs for them)
34
34
  6. Assemble a team per task, sized by task type AND phase mode
35
- 7. Dispatch all task-forces in parallel (background subagents)
35
+ 7. Dispatch all per-task teams in parallel (background subagents)
36
36
  8. Aggregate per-task verdicts with Claude+Codex consensus check
37
37
  9. Surface a run-summary with conflicts highlighted
38
38
 
39
39
  ## Arguments
40
40
 
41
41
  Either:
42
- - Pass the list directly: `/task-force update README; explore caching options; add test for parser`
43
- - Or pass a numbered/bulleted list in the next prompt after invoking `/task-force` bare
42
+ - Pass the list directly: `/parallel update README; explore caching options; add test for parser`
43
+ - Or pass a numbered/bulleted list in the next prompt after invoking `/parallel` bare
44
44
 
45
45
  ## Output
46
46
 
47
- `.forge/task-force/{run-id}/` containing:
47
+ `.forge/parallel/{run-id}/` containing:
48
48
  - `codex.yaml` — Codex consent choice
49
49
  - `tasks.yaml` — task classifications
50
50
  - `task-{n}/{role}.md` — per-agent output
@@ -63,7 +63,7 @@ Either:
63
63
  ### Standard (phase-aware sizing)
64
64
 
65
65
  ```
66
- /task-force
66
+ /parallel
67
67
  1. Update README with new install steps
68
68
  2. Explore options for adding a /status command
69
69
  3. Add unit test for parser edge cases
@@ -84,7 +84,7 @@ In prototype phase, the same list dispatches ~5 agents (light templates, no Code
84
84
  ### Force full power (`!max` override)
85
85
 
86
86
  ```
87
- /task-force !max
87
+ /parallel !max
88
88
  1. Update README with new install steps
89
89
  2. Add helper function for date parsing
90
90
  3. Investigate why CI is flaky on test 17
@@ -100,11 +100,11 @@ Use `!max` (short form) or `--full-power` (canonical form) when prototype code i
100
100
 
101
101
  ## Manifest
102
102
 
103
- This command does NOT create a `.forge/work/{type}/{name}/` manifest — task-force runs are not phase-gated. State lives in `.forge/task-force/{run-id}/` only.
103
+ This command does NOT create a `.forge/work/{type}/{name}/` manifest — `/parallel` runs are not phase-gated. State lives in `.forge/parallel/{run-id}/` only.
104
104
 
105
- If an active feature/bugfix manifest exists, the task-force run-id is appended to its current phase as `task-force-runs: [...]` for audit.
105
+ If an active feature/bugfix manifest exists, the parallel run-id is appended to its current phase as `parallel-runs: [...]` for audit.
106
106
 
107
107
  ## See also
108
108
 
109
- - `skills/support-task-force/SKILL.md` — full process documentation
109
+ - `skills/support-parallel/SKILL.md` — full process documentation
110
110
  - `/feature`, `/bugfix`, `/refactor` — for command-shaped work that this skill refuses to swallow
@@ -10,7 +10,7 @@ Resume a paused work item without restarting completed phases.
10
10
 
11
11
  ## Scope
12
12
 
13
- Resumes an existing in-flight work item by reading its manifest and re-entering its owning command (`/feature`, `/greenfield`, `/bugfix`, `/hotfix`, `/refactor`) at the first unfinished phase. Does NOT create new work items, modify gate state, re-run already-passed gates, or abort/escalate work. Invoke after a session break, after a manifest update, or whenever the user wants to continue paused work.
13
+ Resumes an existing in-flight work item by reading its manifest and re-entering its owning command (`/feature`, `/greenfield`, `/bugfix`, `/hotfix`, `/refactor`) at the first unfinished phase. Does NOT create new work items, modify gate state, re-run already-passed gates, or escalate work. Invoke after a session break, after a manifest update, or whenever the user wants to continue paused work.
14
14
 
15
15
  ## Input
16
16
 
@@ -19,7 +19,7 @@ Accept `type/name` when provided, such as `feature/add-payments`. If omitted, ru
19
19
  ## Steps
20
20
 
21
21
  1. Read `.forge/work/{type}/{name}/manifest.yaml`.
22
- 2. If `status` is `completed`, `abandoned`, or `escalated`, do not resume. Surface the status and any `successor_path`.
22
+ 2. If `status` is `completed` or `escalated`, do not resume. Surface the status and any `successor_path`.
23
23
  3. Identify the last completed phase and the first incomplete phase using the same gate-skip rules as the owning command.
24
24
  4. Invoke the owning command (`/feature`, `/greenfield`, `/bugfix`, `/hotfix`, or `/refactor`) with the work item name and instruct it to resume from the manifest.
25
25
  5. Do not recreate manifests, delete files, or rerun phases whose gates already passed.
package/commands/setup.md CHANGED
@@ -96,34 +96,35 @@ After confirmation, fill both project docs. Show the filled content for review b
96
96
  STOP. Present the filled CLAUDE.md and AGENTS.md content to the user for review before writing. Do NOT write files without user confirmation.
97
97
  </GATE>
98
98
 
99
- ## Step 2a: Configure Gate Enforcement Mode
99
+ ## Step 2a: Apply Gate Enforcement Mode
100
100
 
101
101
  `npx @jamie-tam/forge init` installs PreToolUse hooks that block manifest `gate-passed: true` edits unless telemetry shows the matching skill was invoked via the Skill tool. Useful for production-grade work; high-friction for prototype iteration where most phases are explicitly skipped.
102
102
 
103
- **Default suggestion** (computed from Step 2 profile):
104
- - If signals match **prototype mode** (path under `pocs/`, `package.json` `"private": true` with no CI, no `aiwiki/architecture/`): suggest **disable**
105
- - If signals match **production mode** (CI configured, tests present, codified architecture exists or imminent): suggest **keep enabled**
103
+ **Apply automatically based on detected mode** (no prompt the user has not yet seen a gate fire and can't reasonably decide upfront; setup chooses the mode-appropriate default and tells the user how to change it later).
106
104
 
107
- Ask the user:
105
+ Detect from the Step 2 profile:
108
106
 
109
- ```
110
- Gate enforcement (PreToolUse hooks that block manifest gate-passed edits without skill-invocation telemetry):
111
-
112
- Suggested for this project: <KEEP ENABLED | DISABLE>
113
-
114
- • Keep enabled — production-grade discipline; manifests cannot lie about gate state
115
- • Disable — prototype iteration; faster loop, telemetry still recorded for retrospective audit
116
-
117
- Choice? [Y]es (keep enabled) / [d]isable / [k]eep enabled regardless of suggestion
118
- ```
107
+ | Mode signal | Decision |
108
+ |---|---|
109
+ | Working under `pocs/`, OR `package.json` has `"private": true` with no CI configured, OR `aiwiki/architecture/` is empty/missing | **Disable** — prototype iteration; faster loop |
110
+ | CI configured, tests present, codified architecture exists or imminent | **Keep enabled** — production discipline; manifests cannot lie about gate state |
119
111
 
120
112
  **On "disable"**: remove the two gate-enforcer matcher entries from `.claude/settings.local.json` (the entries with `matcher: Edit` or `matcher: Write` whose command invokes `.claude/hooks/scripts/gate-enforcer.sh`). The file is gitignored so this is a local-only change. Keep the PostToolUse telemetry hook — telemetry is still recorded for retrospective audit; only the blocking is removed.
121
113
 
122
114
  **On "keep enabled"**: leave settings.local.json as installed.
123
115
 
124
- Tell the user: "Gate enforcement <enabled / disabled>. To toggle later, edit `.claude/settings.local.json` — see `hooks/hooks.json` in the forge repo for the canonical entries."
116
+ **Then tell the user, plainly:**
117
+
118
+ ```
119
+ Gate enforcement: <enabled | disabled>
120
+ Reason: <mode signal that triggered it>
121
+ To change: remove or restore the two gate-enforcer PreToolUse entries in
122
+ .claude/settings.local.json (canonical entries in hooks/hooks.json).
123
+ First time you hit a real gate-passed edit and want to opt in (or out),
124
+ surface the toggle then — no upfront commitment.
125
+ ```
125
126
 
126
- Note in the manifest or session memo what was chosen, so future sessions don't have to re-detect.
127
+ Note in the manifest or session memo what was applied, so future sessions don't have to re-detect.
127
128
 
128
129
  ## Step 3: Create .forge Directory
129
130
 
@@ -9,12 +9,12 @@ List active work items from `.forge/work/` without modifying files.
9
9
 
10
10
  ## Scope
11
11
 
12
- Reports in-flight `.forge/work/` items and their current phase. Read-only — does not modify manifests, files, or wiki. Does NOT resume work, route between commands, or judge whether a stalled item should be aborted. Invoke when the user asks "what's in flight?", before `/resume` (to pick a target), or before `/abort` (to confirm which item).
12
+ Reports in-flight `.forge/work/` items and their current phase. Read-only — does not modify manifests, files, or wiki. Does NOT resume work or route between commands. Invoke when the user asks "what's in flight?" or before `/resume` (to pick a target).
13
13
 
14
14
  ## Steps
15
15
 
16
16
  1. Find manifests at `.forge/work/*/*/manifest.yaml`.
17
- 2. Exclude items whose `status` is `completed`, `abandoned`, or `escalated`.
17
+ 2. Exclude items whose `status` is `completed` or `escalated`.
18
18
  3. For each remaining item, infer the current phase from the first phase or gate that is not complete, locked, skipped, or not-applicable. Prefer explicit fields such as `build.current_phase` when present.
19
19
  4. Print a table:
20
20
 
@@ -0,0 +1,130 @@
1
+ ---
2
+ name: wrap
3
+ description: "Capture and finalize the current Claude session. Writes ## Files touched / ## Decisions made / ## Gotchas surfaced / ## Open questions / ## Next steps into aiwiki/sessions/{date}-{session_id_short}.md, then sets status: done. Use at the natural end of a working session so the next session-start hook can surface a meaningful handoff. Optional argument: a one-line focus statement (otherwise inferred from the active manifest)."
4
+ ---
5
+
6
+ # /wrap — Capture and finalize the current session
7
+
8
+ Finalize this Claude session's handoff artifact. Writes the index sections (Files touched / Decisions / Gotchas / Open questions / Next steps) into `aiwiki/sessions/{date}-{session_id_short}.md` so the next session-start hook can surface a meaningful handoff.
9
+
10
+ **Distinct from `/dream`:** `/wrap` captures *this session's* knowledge (what was worked on, what was decided). `/dream` consolidates *the whole aiwiki* (merges duplicates, promotes raw → typed). The two can be run sequentially at session end (`/wrap` first, then `/dream`) but they answer different questions.
11
+
12
+ ## Steps
13
+
14
+ 1. **Determine session file path.**
15
+ - Read `session_id` from the most recent SessionStart context (Claude Code provides this in the hook payload; if running standalone, ask the user or read from `aiwiki/sessions/*.md` mtime).
16
+ - Path: `aiwiki/sessions/{ISO-date}-{session_id_short7}.md` (the same path pre-compact would have used). If the file already exists (created by pre-compact), append to it. If not, create it lazily here.
17
+
18
+ 2. **Determine focus.**
19
+ - If `/wrap <focus statement>` was supplied, use that.
20
+ - Else: read the active work item from `.forge/work/*/*/manifest.yaml` where `status: in-progress`. Focus = `{type}/{name}` (e.g. `feature/wire-dream`).
21
+ - Else: ask the user "What was this session about?" — one-line answer.
22
+
23
+ 3. **Read the session file** (if it already has content from pre-compact).
24
+ - The `## Checkpoints` section stays as-is — that's event log, not user-facing summary.
25
+ - The index sections (`## Files touched`, etc.) are what you fill.
26
+
27
+ 4. **Capture `## Files touched`.**
28
+ - Run `git diff --name-only $(git merge-base HEAD main)..HEAD` (or `HEAD~10..HEAD` for non-branch work) to find files changed during the session.
29
+ - For each: cite as `[path](path:line)` if a specific line range was the focus; else `[path](path)`.
30
+ - LINT will auto-fill `@<sha7>` on save.
31
+ - Skip generated files, dependency lockfiles, build artifacts.
32
+
33
+ 5. **Capture `## Decisions made`.**
34
+ - List ADRs in `aiwiki/decisions/` written or modified during this session.
35
+ - Format: `- [decision-NNNN: short title](aiwiki/decisions/NNNN-slug.md)`.
36
+ - If none were written but a decision-worthy choice was made conversationally, note: "DEFERRED: {one-line description} — should become an ADR but wasn't written this session."
37
+
38
+ 6. **Capture `## Gotchas surfaced`.**
39
+ - List gotchas in `aiwiki/gotchas/` created or updated this session.
40
+ - Same link format.
41
+ - If a gotcha was hit but not captured, note it as DEFERRED.
42
+
43
+ 7. **Capture `## Open questions`.**
44
+ - List raw notes in `aiwiki/raw/{today}.md` that represent unresolved questions (entries starting with "TBD", "open", "?", or that were /note'd as questions).
45
+ - Format: `- [HH:MM question title](aiwiki/raw/{date}.md#anchor)`.
46
+ - If no /note questions were captured but threads are open, list them as bare bullets.
47
+
48
+ 8. **Capture `## Next steps`.**
49
+ - 2-5 bullets: what the next session should do.
50
+ - Each bullet should reference a file/manifest/issue. No vague "continue working on X."
51
+ - Examples:
52
+ - "Resume `feature/wire-dream` at Phase 6 (slice graph in manifest) — first slice: `wire-pre-compact-hook`."
53
+ - "Review pending dream `aiwiki/proposed/2026-05-18-1742-manual/` before next phase."
54
+ - "Address open question on token rotation policy — see `aiwiki/raw/2026-05-18.md#14-23`."
55
+
56
+ 9. **Update frontmatter.**
57
+ - Set `focus: {focus}` (from Step 2).
58
+ - Set `status: done`.
59
+ - Set `date_end: {today ISO date}`.
60
+ - Set `last_commit: {git rev-parse --short HEAD}` if in a git repo with commits.
61
+
62
+ 10. **Confirm with the user.**
63
+ - Surface the drafted session file content.
64
+ - Ask: "Save this as your session handoff?" — yes / edit / skip.
65
+ - If edit: take inline edits, re-render, ask again.
66
+ - If skip: leave the file's `status: active` (next session-start will surface it as unfinalized).
67
+
68
+ 11. **Save and lint.**
69
+ - Write the file.
70
+ - `wiki-lint` runs automatically on save (PostToolUse hook).
71
+ - If lint surfaces warnings (missing citations, stale `@<sha7>`, etc.), address before considering /wrap complete.
72
+
73
+ 12. **Suggest follow-ups.**
74
+ - If `aiwiki/raw/{today}.md` has unconsolidated entries, suggest: "You have N raw notes from this session — consider `/dream raw` to consolidate before next session."
75
+ - If a pending dream proposal exists in `aiwiki/proposed/`, surface: "N pending dream proposals — review via `forge wiki ui` before next session."
76
+
77
+ ## Example
78
+
79
+ ```
80
+ User: /wrap
81
+
82
+ Agent: Session 2026-05-18-7e8a3f2 (focus: feature/wire-dream).
83
+ Drafted handoff with:
84
+ - 11 files touched (skills/, hooks/, commands/, templates/)
85
+ - 1 decision (consolidate notepad → sessions/)
86
+ - 0 new gotchas this session
87
+ - 2 open questions
88
+ - 4 next-step bullets
89
+
90
+ [Renders the proposed file content]
91
+
92
+ Save?
93
+
94
+ User: yes
95
+
96
+ Agent: Saved aiwiki/sessions/2026-05-18-7e8a3f2.md (status: done).
97
+ Suggestion: 3 raw notes from /note today — consider /dream raw to
98
+ consolidate before next session.
99
+ ```
100
+
101
+ ## When to use
102
+
103
+ - **At the natural end of a working session** before exiting Claude Code. Even a 30-second wrap-up preserves the handoff signal.
104
+ - **Before a long break** (overnight, end of day). The next session-start surfaces this file so you don't lose context.
105
+ - **Before a major context shift** (switching to a different feature mid-day). Wrap the current focus, then start fresh.
106
+ - **After a phase locks** if the natural pause is also a session end. (Phase-close already triggers a dream — `/wrap` is the complementary capture for what *you* did, while dream consolidates the *wiki state*.)
107
+
108
+ ## When NOT to use
109
+
110
+ - **Trivial sessions** (a single read, a one-line edit). No handoff signal — skip /wrap and let the next session-start surface "no recent session" (silence is fine).
111
+ - **Mid-task interruptions** where you'll be right back. /wrap is for genuine session boundaries.
112
+ - **As a substitute for typed-page writes.** Decisions belong in `aiwiki/decisions/` directly; gotchas in `aiwiki/gotchas/`. /wrap is the *index* of what was written elsewhere — it doesn't replace writing the artifacts themselves.
113
+ - **As a substitute for `/dream`.** /wrap captures this session's work; /dream consolidates the whole aiwiki. Use both at the right times.
114
+
115
+ ## I/O Contract
116
+
117
+ | Field | Value |
118
+ |---|---|
119
+ | **Requires** | `aiwiki/sessions/` (scaffolded by `/setup`), Claude Code's hook context for `session_id` (or interactive fallback) |
120
+ | **Produces** | `aiwiki/sessions/{date}-{session_id_short}.md` with index sections filled and `status: done` |
121
+ | **Triggers** | `wiki-lint` PostToolUse hook on save |
122
+ | **Feeds into** | `session-start.sh` (next session reads it), `support-dream` (refines on next dream cycle) |
123
+
124
+ ## Do NOT
125
+
126
+ - Do NOT auto-fire `/dream` from inside `/wrap`. The two are separate concerns; user decides which to run. /wrap can SUGGEST /dream when raw notes accumulated, but does not invoke it.
127
+ - Do NOT overwrite the `## Checkpoints` section if pre-compact wrote to it during the session — that's append-only event log, preserved as-is.
128
+ - Do NOT write vague prose. Index of links, not narrative. Future sessions follow the links to actual artifacts.
129
+ - Do NOT capture every file diff. Skip dependency lockfiles, build artifacts, anything ≤2 lines of cosmetic change. Index the meaningful work.
130
+ - Do NOT set `status: done` if the user said "skip" at Step 10 — leave `status: active` so the next session-start surfaces it.