arcane-cli 0.39.0 → 1.0.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 (176) hide show
  1. package/README.md +1 -1
  2. package/dist/assets/.agents/skills/spell-address-review/SKILL.md +1 -1
  3. package/dist/assets/.agents/skills/spell-adopt-docs/SKILL.md +1 -1
  4. package/dist/assets/.agents/skills/spell-arcane-version/SKILL.md +1 -1
  5. package/dist/assets/.agents/skills/spell-architect/SKILL.md +1 -1
  6. package/dist/assets/.agents/skills/spell-brainstorm/SKILL.md +1 -1
  7. package/dist/assets/.agents/skills/spell-bug/SKILL.md +1 -1
  8. package/dist/assets/.agents/skills/spell-bump/SKILL.md +1 -1
  9. package/dist/assets/.agents/skills/spell-check-drift/SKILL.md +1 -1
  10. package/dist/assets/.agents/skills/spell-close-session/SKILL.md +1 -1
  11. package/dist/assets/.agents/skills/spell-commit-work/SKILL.md +1 -1
  12. package/dist/assets/.agents/skills/spell-compliance/SKILL.md +1 -1
  13. package/dist/assets/.agents/skills/spell-create-pull-request/SKILL.md +1 -1
  14. package/dist/assets/.agents/skills/spell-document/SKILL.md +1 -1
  15. package/dist/assets/.agents/skills/spell-dotnet-expert/SKILL.md +1 -1
  16. package/dist/assets/.agents/skills/spell-eas-store-deploy/SKILL.md +1 -1
  17. package/dist/assets/.agents/skills/spell-enchant/SKILL.md +1 -1
  18. package/dist/assets/.agents/skills/spell-explain-concept/SKILL.md +1 -1
  19. package/dist/assets/.agents/skills/spell-feedback/SKILL.md +1 -1
  20. package/dist/assets/.agents/skills/spell-full-cycle/SKILL.md +1 -1
  21. package/dist/assets/.agents/skills/spell-generate-bot-icons/SKILL.md +1 -1
  22. package/dist/assets/.agents/skills/spell-implement/SKILL.md +1 -1
  23. package/dist/assets/.agents/skills/spell-make-discoverable/SKILL.md +1 -1
  24. package/dist/assets/.agents/skills/spell-manifest/SKILL.md +1 -1
  25. package/dist/assets/.agents/skills/spell-open-session/SKILL.md +1 -1
  26. package/dist/assets/.agents/skills/spell-plan/SKILL.md +1 -1
  27. package/dist/assets/.agents/skills/spell-present-arcane/SKILL.md +1 -1
  28. package/dist/assets/.agents/skills/spell-product-review/SKILL.md +1 -1
  29. package/dist/assets/.agents/skills/spell-review/SKILL.md +1 -1
  30. package/dist/assets/.agents/skills/spell-review-batch/SKILL.md +1 -1
  31. package/dist/assets/.agents/skills/spell-save-idea/SKILL.md +1 -1
  32. package/dist/assets/.agents/skills/spell-scope/SKILL.md +1 -1
  33. package/dist/assets/.agents/skills/spell-scry/SKILL.md +1 -1
  34. package/dist/assets/.agents/skills/spell-security-review/SKILL.md +1 -1
  35. package/dist/assets/.agents/skills/spell-ship/SKILL.md +1 -1
  36. package/dist/assets/.agents/skills/spell-status/SKILL.md +1 -1
  37. package/dist/assets/.agents/skills/spell-suggest-feature/SKILL.md +1 -1
  38. package/dist/assets/.agents/skills/spell-summon-venture/SKILL.md +1 -1
  39. package/dist/assets/.agents/skills/spell-sync-pull-request/SKILL.md +1 -1
  40. package/dist/assets/.agents/skills/spell-test/SKILL.md +1 -1
  41. package/dist/assets/.agents/skills/spell-todo/SKILL.md +1 -1
  42. package/dist/assets/.agents/skills/spell-verification-ledger/SKILL.md +1 -1
  43. package/dist/assets/.arcane/governance/development-methodology.md +6 -6
  44. package/dist/assets/.arcane/governance/git-conventions.md +2 -2
  45. package/dist/assets/.arcane/governance/portable-bootstrap.md +1 -0
  46. package/dist/assets/.arcane/governance/product-excellence-standards.md +1 -1
  47. package/dist/assets/.arcane/governance/spell-authoring-standards.md +9 -1
  48. package/dist/assets/.arcane/governance/universal-agent-rules.md +5 -3
  49. package/dist/assets/.arcane/spells/spell-address-review.md +115 -0
  50. package/dist/assets/.arcane/spells/spell-adopt-docs.md +158 -0
  51. package/dist/assets/.arcane/spells/spell-arcane-version.md +87 -0
  52. package/dist/assets/.arcane/spells/spell-architect.md +117 -0
  53. package/dist/assets/.arcane/spells/spell-brainstorm.md +125 -0
  54. package/dist/assets/.arcane/spells/spell-bug.md +123 -0
  55. package/dist/assets/.arcane/spells/spell-bump.md +82 -0
  56. package/dist/assets/.arcane/spells/spell-check-drift.md +118 -0
  57. package/dist/assets/.arcane/spells/spell-close-session.md +266 -0
  58. package/dist/assets/.arcane/spells/spell-commit-work.md +279 -0
  59. package/dist/assets/.arcane/spells/spell-compliance.md +130 -0
  60. package/dist/assets/.arcane/spells/spell-create-pull-request.md +224 -0
  61. package/dist/assets/.arcane/spells/spell-document.md +84 -0
  62. package/dist/assets/.arcane/spells/spell-dotnet-expert.md +118 -0
  63. package/dist/assets/.arcane/spells/spell-eas-store-deploy.md +254 -0
  64. package/dist/assets/.arcane/spells/spell-enchant.md +386 -0
  65. package/dist/assets/.arcane/spells/spell-explain-concept.md +70 -0
  66. package/dist/assets/.arcane/spells/spell-feedback.md +138 -0
  67. package/dist/assets/.arcane/spells/spell-full-cycle.md +253 -0
  68. package/dist/assets/.arcane/spells/spell-generate-bot-icons.md +85 -0
  69. package/dist/assets/.arcane/spells/spell-implement.md +109 -0
  70. package/dist/assets/.arcane/spells/spell-make-discoverable.md +293 -0
  71. package/dist/assets/.arcane/spells/spell-manifest.md +148 -0
  72. package/dist/assets/.arcane/spells/spell-open-session.md +154 -0
  73. package/dist/assets/.arcane/spells/spell-plan.md +160 -0
  74. package/dist/assets/.arcane/spells/spell-present-arcane.md +189 -0
  75. package/dist/assets/.arcane/spells/spell-product-review.md +98 -0
  76. package/dist/assets/.arcane/spells/spell-review-batch.md +113 -0
  77. package/dist/assets/.arcane/spells/spell-review.md +142 -0
  78. package/dist/assets/.arcane/spells/spell-save-idea.md +117 -0
  79. package/dist/assets/.arcane/spells/spell-scope.md +266 -0
  80. package/dist/assets/.arcane/spells/spell-scry.md +124 -0
  81. package/dist/assets/.arcane/spells/spell-security-review.md +152 -0
  82. package/dist/assets/.arcane/spells/spell-ship.md +106 -0
  83. package/dist/assets/.arcane/spells/spell-status.md +86 -0
  84. package/dist/assets/.arcane/spells/spell-suggest-feature.md +122 -0
  85. package/dist/assets/.arcane/spells/spell-summon-venture.md +110 -0
  86. package/dist/assets/.arcane/spells/spell-sync-pull-request.md +161 -0
  87. package/dist/assets/.arcane/spells/spell-test.md +88 -0
  88. package/dist/assets/.arcane/spells/spell-todo.md +166 -0
  89. package/dist/assets/.arcane/spells/spell-verification-ledger.md +102 -0
  90. package/dist/assets/.claude/commands/spell-address-review.md +2 -2
  91. package/dist/assets/.claude/commands/spell-adopt-docs.md +2 -2
  92. package/dist/assets/.claude/commands/spell-arcane-version.md +2 -2
  93. package/dist/assets/.claude/commands/spell-architect.md +2 -2
  94. package/dist/assets/.claude/commands/spell-brainstorm.md +2 -2
  95. package/dist/assets/.claude/commands/spell-bug.md +2 -2
  96. package/dist/assets/.claude/commands/spell-bump.md +2 -2
  97. package/dist/assets/.claude/commands/spell-check-drift.md +2 -2
  98. package/dist/assets/.claude/commands/spell-close-session.md +2 -2
  99. package/dist/assets/.claude/commands/spell-commit-work.md +2 -2
  100. package/dist/assets/.claude/commands/spell-compliance.md +2 -2
  101. package/dist/assets/.claude/commands/spell-create-pull-request.md +2 -2
  102. package/dist/assets/.claude/commands/spell-document.md +2 -2
  103. package/dist/assets/.claude/commands/spell-dotnet-expert.md +2 -2
  104. package/dist/assets/.claude/commands/spell-eas-store-deploy.md +2 -2
  105. package/dist/assets/.claude/commands/spell-enchant.md +2 -2
  106. package/dist/assets/.claude/commands/spell-explain-concept.md +2 -2
  107. package/dist/assets/.claude/commands/spell-feedback.md +2 -2
  108. package/dist/assets/.claude/commands/spell-full-cycle.md +2 -2
  109. package/dist/assets/.claude/commands/spell-generate-bot-icons.md +2 -2
  110. package/dist/assets/.claude/commands/spell-implement.md +2 -2
  111. package/dist/assets/.claude/commands/spell-make-discoverable.md +2 -2
  112. package/dist/assets/.claude/commands/spell-manifest.md +2 -2
  113. package/dist/assets/.claude/commands/spell-open-session.md +2 -2
  114. package/dist/assets/.claude/commands/spell-plan.md +2 -2
  115. package/dist/assets/.claude/commands/spell-present-arcane.md +2 -2
  116. package/dist/assets/.claude/commands/spell-product-review.md +2 -2
  117. package/dist/assets/.claude/commands/spell-review-batch.md +2 -2
  118. package/dist/assets/.claude/commands/spell-review.md +2 -2
  119. package/dist/assets/.claude/commands/spell-save-idea.md +2 -2
  120. package/dist/assets/.claude/commands/spell-scope.md +2 -2
  121. package/dist/assets/.claude/commands/spell-scry.md +2 -2
  122. package/dist/assets/.claude/commands/spell-security-review.md +2 -2
  123. package/dist/assets/.claude/commands/spell-ship.md +2 -2
  124. package/dist/assets/.claude/commands/spell-status.md +2 -2
  125. package/dist/assets/.claude/commands/spell-suggest-feature.md +2 -2
  126. package/dist/assets/.claude/commands/spell-summon-venture.md +2 -2
  127. package/dist/assets/.claude/commands/spell-sync-pull-request.md +2 -2
  128. package/dist/assets/.claude/commands/spell-test.md +2 -2
  129. package/dist/assets/.claude/commands/spell-todo.md +2 -2
  130. package/dist/assets/.claude/commands/spell-verification-ledger.md +2 -2
  131. package/dist/assets/.github/instructions/agent-output.instructions.md +14 -13
  132. package/dist/assets/.github/prompts/spell-address-review.prompt.md +1 -107
  133. package/dist/assets/.github/prompts/spell-adopt-docs.prompt.md +1 -150
  134. package/dist/assets/.github/prompts/spell-arcane-version.prompt.md +1 -79
  135. package/dist/assets/.github/prompts/spell-architect.prompt.md +1 -109
  136. package/dist/assets/.github/prompts/spell-brainstorm.prompt.md +1 -117
  137. package/dist/assets/.github/prompts/spell-bug.prompt.md +1 -115
  138. package/dist/assets/.github/prompts/spell-bump.prompt.md +1 -74
  139. package/dist/assets/.github/prompts/spell-check-drift.prompt.md +1 -110
  140. package/dist/assets/.github/prompts/spell-close-session.prompt.md +1 -258
  141. package/dist/assets/.github/prompts/spell-commit-work.prompt.md +1 -270
  142. package/dist/assets/.github/prompts/spell-compliance.prompt.md +1 -122
  143. package/dist/assets/.github/prompts/spell-create-pull-request.prompt.md +1 -215
  144. package/dist/assets/.github/prompts/spell-document.prompt.md +1 -76
  145. package/dist/assets/.github/prompts/spell-dotnet-expert.prompt.md +1 -110
  146. package/dist/assets/.github/prompts/spell-eas-store-deploy.prompt.md +1 -246
  147. package/dist/assets/.github/prompts/spell-enchant.prompt.md +1 -378
  148. package/dist/assets/.github/prompts/spell-explain-concept.prompt.md +1 -62
  149. package/dist/assets/.github/prompts/spell-feedback.prompt.md +1 -130
  150. package/dist/assets/.github/prompts/spell-full-cycle.prompt.md +1 -245
  151. package/dist/assets/.github/prompts/spell-generate-bot-icons.prompt.md +1 -77
  152. package/dist/assets/.github/prompts/spell-implement.prompt.md +1 -101
  153. package/dist/assets/.github/prompts/spell-make-discoverable.prompt.md +1 -285
  154. package/dist/assets/.github/prompts/spell-manifest.prompt.md +1 -140
  155. package/dist/assets/.github/prompts/spell-open-session.prompt.md +1 -146
  156. package/dist/assets/.github/prompts/spell-plan.prompt.md +1 -152
  157. package/dist/assets/.github/prompts/spell-present-arcane.prompt.md +1 -181
  158. package/dist/assets/.github/prompts/spell-product-review.prompt.md +1 -90
  159. package/dist/assets/.github/prompts/spell-review-batch.prompt.md +1 -105
  160. package/dist/assets/.github/prompts/spell-review.prompt.md +1 -134
  161. package/dist/assets/.github/prompts/spell-save-idea.prompt.md +1 -109
  162. package/dist/assets/.github/prompts/spell-scope.prompt.md +1 -258
  163. package/dist/assets/.github/prompts/spell-scry.prompt.md +1 -116
  164. package/dist/assets/.github/prompts/spell-security-review.prompt.md +1 -144
  165. package/dist/assets/.github/prompts/spell-ship.prompt.md +1 -98
  166. package/dist/assets/.github/prompts/spell-status.prompt.md +1 -78
  167. package/dist/assets/.github/prompts/spell-suggest-feature.prompt.md +1 -114
  168. package/dist/assets/.github/prompts/spell-summon-venture.prompt.md +1 -102
  169. package/dist/assets/.github/prompts/spell-sync-pull-request.prompt.md +1 -152
  170. package/dist/assets/.github/prompts/spell-test.prompt.md +1 -80
  171. package/dist/assets/.github/prompts/spell-todo.prompt.md +1 -158
  172. package/dist/assets/.github/prompts/spell-verification-ledger.prompt.md +1 -94
  173. package/dist/index.js +143 -39
  174. package/dist/index.js.map +1 -1
  175. package/package.json +4 -4
  176. /package/dist/assets/{.github/prompts → .arcane/spells}/_fragments/tracking-mode-declaration.md +0 -0
@@ -0,0 +1,82 @@
1
+ ---
2
+ name: Spell — Bump Version
3
+ description: Determine the correct semver bump type for the current change and apply it to package.json
4
+ claude_description: Use PROACTIVELY before shipping any change that touches distributable content, to determine and apply the correct version bump.
5
+ argument-hint: Optional context about the change (e.g., "new component", "bug fix", "breaking API change")
6
+ agent: agent
7
+ ---
8
+
9
+ ## Executive Summary
10
+
11
+ - This spell determines whether a version bump is required and applies the correct semver type.
12
+ - Use it whenever you've changed `src/assets/`, `registry.ts`, or `profiles.ts` in the arcane repo.
13
+ - It enforces the rule from `project.md` → Constraints → Self-hosting: "Anything touching
14
+ `src/assets/` requires a version bump." (Corrected 2026-08-31, BC-06 — this previously cited
15
+ CLAUDE.md, which now carries only the working protocol; the rule's live prose home moved to
16
+ `project.md ("requires a version bump"):56-58`.)
17
+
18
+ ---
19
+
20
+ Determine the correct semver bump and apply it.
21
+
22
+ ## Step 1 — Check whether a bump is needed
23
+
24
+ Run the version check gate in **staged mode** (LH-06a) — this spell runs before the commit that
25
+ will actually contain the change, so the default `merge-base..HEAD` diff can't see it yet; staged
26
+ mode unions that diff with `git diff --cached --name-only` so today's not-yet-committed work is
27
+ checked too, not just history:
28
+
29
+ ```
30
+ npm run check:version-bump -- --staged
31
+ ```
32
+
33
+ - If it **passes** → no bump needed. Stop here and report "No version bump required."
34
+ - If it **fails** → proceed to Step 2.
35
+ - If the changed content isn't staged yet (working-tree edits only), use `-- --working-tree`
36
+ instead, which additionally unions plain `git diff --name-only`.
37
+
38
+ ## Step 2 — Determine semver type
39
+
40
+ Inspect the changed files in `src/assets/`, `registry.ts`, and `profiles.ts`:
41
+
42
+ | Change type | Bump |
43
+ |---|---|
44
+ | New component added to registry (new file in `src/assets/`) | `minor` |
45
+ | Existing asset file updated (content change, no new component) | `patch` |
46
+ | Component removed from registry | `minor` |
47
+ | Breaking change to CLI API or registry schema | `major` |
48
+ | Bug fix in CLI source (`src/modules/`, `src/commands/`) | `patch` |
49
+ | New CLI command or flag | `minor` |
50
+
51
+ When in doubt: new distributable content = `minor`, content update = `patch`.
52
+
53
+ ## Step 3 — Apply the bump
54
+
55
+ Run the appropriate command (do **not** use `--git-tag-version` — tagging happens at publish time):
56
+
57
+ ```
58
+ npm version patch --no-git-tag-version
59
+ # or
60
+ npm version minor --no-git-tag-version
61
+ # or
62
+ npm version major --no-git-tag-version
63
+ ```
64
+
65
+ ## Step 4 — Verify and stage
66
+
67
+ ```
68
+ node -e "const p = require('./package.json'); console.log(p.version)"
69
+ git add package.json package-lock.json
70
+ ```
71
+
72
+ ## Step 5 — Commit
73
+
74
+ Use `spell-commit-work` to commit the version bump as a separate commit:
75
+
76
+ ```
77
+ chore(release): bump version to X.Y.Z
78
+ ```
79
+
80
+ Include in the commit body:
81
+ - What distributable change triggered the bump
82
+ - Which components were added/changed
@@ -0,0 +1,118 @@
1
+ ---
2
+ name: Spell — Check Doc Drift
3
+ description: Detect contradictions and stale statements across core Arcane docs and report severity-graded findings (report-only by default; opt-in --fix applies safe mechanical fixes).
4
+ claude_description: Use PROACTIVELY to detect contradictions and stale statements across core docs, periodically or after major changes.
5
+ argument-hint: Optional scope selector --scope all|journal|todos|decisions|git (default all); free-text hints also accepted. Add --fix to apply safe mechanical fixes.
6
+ agent: agent
7
+ ---
8
+
9
+ ## Executive Summary
10
+
11
+ - This prompt identifies documentation contradictions, stale dates, and inconsistencies across the repo.
12
+ - It cross-references core docs to find drift between ADRs, journals, configuration files, and operational guides.
13
+ - Use this periodically (weekly/monthly) or after major changes to maintain documentation accuracy.
14
+ - **Report-only by default** (non-destructive): output is severity-graded findings with exact fix recommendations. Pass `--fix` to also apply safe, mechanical, unambiguous fixes.
15
+
16
+ **Related spells:** `spell-open-session` consumes this as an early drift-check pre-step (feeds-into); this spell also runs standalone. Related to `spell-close-session`, which flags drift at session close.
17
+
18
+ ---
19
+
20
+ Detect documentation drift in this repository.
21
+
22
+ Use these files first:
23
+
24
+ - [README.md](../../README.md)
25
+ - [project.md](../../project.md)
26
+ - [TODO.md](../../TODO.md)
27
+ - [DECISIONS.md](../../DECISIONS.md)
28
+ - [ai-context/system-prompt-context.md](../../ai-context/system-prompt-context.md)
29
+ - [agents/agent-policies.md](../../.arcane/governance/agent-policies.md)
30
+ - Most recent journal file(s) in [journal/](../../journal/)
31
+ - Relevant business overviews under `{BUSINESS_ROOT}/` (resolve from `.arcane.json`'s `business_root` field, default `ventures/` if unset)
32
+ - `{BUSINESS_ROOT}/registry.json`, if present (hub-role and registry-consistency detectors)
33
+
34
+ Scope selection (`--scope <value>`, default `all`):
35
+
36
+ - `all` — run every detector below (default).
37
+ - `journal` — Journal chronology only.
38
+ - `todos` — Done vs. carry-forward consistency only.
39
+ - `decisions` — Decision-ID existence only.
40
+ - `git` — Decision-ID existence plus the general contradiction/stale-date checks against tracked docs (git-tracked doc state); does not run journal-ordering or carry-forward detectors.
41
+
42
+ A free-text scope hint (e.g., "security docs", "business docs") is still accepted and narrows the file set; `--scope` selects which detector catalog runs. When both are given, `--scope` governs the detector set and the free-text hint narrows the files.
43
+
44
+ Concrete detectors to run (in addition to general contradiction/stale-date checks):
45
+
46
+ - **Journal chronology** — journal entries and their dates must be in sane order. Flag out-of-order entries, duplicate session numbers, and any future or otherwise contradictory dates.
47
+ - **Done vs. carry-forward consistency** — items marked done must not still appear as open or carry-forward items, and items listed as open/carry-forward must not also be marked done elsewhere.
48
+ - **Decision-ID existence** — decision IDs referenced in TODO, journal, or other docs must exist in `DECISIONS.md`, and the IDs in the decisions log must be sequential and unique (no gaps that imply a missing entry, no duplicates).
49
+ - **Shipped-state staleness** (LH-08; only when this repo has its own `scripts/check-stale-claims.ts` — Arcane's own repo, or one that adopted the same convention; skip gracefully otherwise) — run `npm run check:stale-claims -- --report` and triage its Class B output (occurrences of "not yet built"/"not yet supported"/"tracked as future work" and similar phrases in shipped or living content): each hit is a prompt to verify the claim against the real tree, not proof of staleness by itself. Class A (`ARC-NNN (Status)` claims vs. `DECISIONS.md`) is already a separate, mechanically-enforced CI gate — do not re-litigate its findings here, only Class B needs this judgment pass.
50
+ - **Canonical vs. installed-copy parity** — for every managed root file that has a canonical counterpart under `src/assets/`, compare bytes first. If bytes differ, normalize `CRLF` and lone `CR` to `LF` in both files and compare again:
51
+ - If normalized content differs, report **real content drift** with normal severity grading.
52
+ - If normalized content matches, report **line-ending-only drift** separately. Do not count these paths as real content findings and do not include them in severity totals or the Go / No-Go decision.
53
+ - Report exact path counts for both classes. Never summarize all byte-different files as content drift.
54
+ - **Hub-artifact leak (non-hub repos)** — if `.arcane.json` does not have `role: "hub"`, the existence of any `{BUSINESS_ROOT}/*/IDEAS.md`, `{BUSINESS_ROOT}/*/TODO.md`, or `{BUSINESS_ROOT}/registry.json` (resolve `{BUSINESS_ROOT}` the same way as above -- a consumer repo can still have a configured `business_root` left over from a prior role change, so this must not skip resolution just because the repo isn't currently a hub) is **Critical**: hub-only artifacts (potentially including sibling-venture and portfolio data) do not belong in a repo that isn't a declared hub. This check is deliberately structural (file existence only) — a non-hub repo cannot safely hold the sibling-name list a content-level check would need, so that asymmetry is by design, not a gap.
55
+ - **Hub role/registry consistency (hub repos only)** — when `.arcane.json` has `role: "hub"`:
56
+ - `role: "hub"` with no `{BUSINESS_ROOT}` directory (default `ventures/`) present — **High**: the manifest claims a role the repo can't actually fulfill.
57
+ - `{BUSINESS_ROOT}/registry.json` slugs that don't match an existing `{BUSINESS_ROOT}/<slug>/` folder, or venture folders with no registry entry — **Medium**, both directions.
58
+ - Malformed `status: promoted → …` / `status: dropped …` markers in any book (unparseable destination, missing date) — **Low**.
59
+ - A `{BUSINESS_ROOT}/<slug>/` folder with a `role`-shaped `.arcane.json`-like marker of its own (i.e., it looks like it's trying to be a hub itself) — **Medium**: flag for operator review; nested hubs are unsupported.
60
+
61
+ For each drift finding include:
62
+
63
+ - Severity (`Critical`, `High`, `Medium`, or `Low`)
64
+ - Severity rationale (one line: why this severity — e.g. work-integrity/duplicate-work risk → HIGH; confidence/correctness gap → MEDIUM; cosmetic → LOW)
65
+ - Drift statement
66
+ - Canonical source file (cite by stable locator — a heading anchor or a unique quoted phrase, e.g. `path#anchor` or `path ("unique phrase")` — never a bare line number, since findings routinely get promoted into TODO.md or another living doc afterward, where a line number drifts the moment the file is next edited)
67
+ - Affected file (same stable-locator citation)
68
+ - Exact recommended fix
69
+
70
+ Every finding that points to a specific location MUST be pinpointable: cite by stable locator (a heading anchor or a unique quoted phrase, e.g. `path#anchor` or `path ("a unique phrase from the target")`). A bare line number may accompany a stable locator as a convenience (this report is read once, in the current tree), but never replace one — a citation promoted into a living doc later must survive on its own. If no precise anchor or phrase exists, cite the nearest available locator (heading, section, or list item) instead of omitting it.
71
+
72
+ Behavior:
73
+
74
+ - **Default mode is report-only and non-destructive — do not edit any files.** Only detect, grade, and report drift with recommended fixes.
75
+ - **Only when invoked with `--fix`**: apply fixes that are mechanical and unambiguous, then report each edit applied. Still never apply ambiguous fixes — list those under Needs Confirmation instead.
76
+ - If drift is ambiguous, do not edit (in either mode); ask a targeted clarification question.
77
+
78
+ Output format:
79
+
80
+ ## Drift Report
81
+
82
+ - **Scope:** the `--scope` value (`all`/`journal`/`todos`/`decisions`/`git`), any free-text hint, and mode (`report-only` or `--fix`).
83
+ - **Date:** ISO date of this run.
84
+ - **Real content findings:** total count, broken down per severity.
85
+ - **Line-ending-only drift:** path count, reported separately and excluded from severity totals.
86
+
87
+ ## Real Content Drift Findings
88
+
89
+ - One line per finding with stable-locator references (heading anchor or unique quoted phrase — nearest locator if neither applies) and its severity rationale.
90
+
91
+ ## Line-Ending-Only Drift
92
+
93
+ - List byte-different paths whose contents match after line-ending normalization, or `None`.
94
+ - Keep this list separate from real content findings even when it is long; a count plus path list is sufficient.
95
+
96
+ ## Fixes Applied
97
+
98
+ - List edits applied (only possible in `--fix` mode), or `None`.
99
+
100
+ ## Needs Confirmation
101
+
102
+ - Open questions that block safe edits, or `None`.
103
+
104
+ ## Suggested Next Updates
105
+
106
+ - Short, prioritized follow-up edits.
107
+
108
+ ## Go / No-Go
109
+
110
+ - A final roll-up verdict: **GO** if the workspace is clean enough to proceed (no unresolved Critical/High findings), or **NO-GO** if drift must be fixed first. State the single most important blocker and what must happen before proceeding.
111
+
112
+ Rules:
113
+
114
+ - Prefer ADR decisions and latest journal facts when conflicts exist.
115
+ - Do not rewrite historical journal content.
116
+ - Treat `src/assets/` as canonical when comparing a managed root dogfood copy with its distributable source counterpart.
117
+ - A line-ending-only difference is review noise, not evidence of contradictory content; never let it create a Critical/High finding or a `NO-GO` verdict by itself.
118
+ - Keep changes minimal and traceable.
@@ -0,0 +1,266 @@
1
+ ---
2
+ name: Spell — Close Session
3
+ description: End a work session by logging outcomes in today's journal and pruning completed TODO items with verifiable evidence.
4
+ claude_description: Use PROACTIVELY at the end of any significant work session, even if the user just says 'wrap up' or 'done for now'.
5
+ argument-hint: Optional session focus (e.g., a config change, a fix, infrastructure setup)
6
+ agent: agent
7
+ ---
8
+
9
+ ## Executive Summary
10
+
11
+ - This prompt formally closes a session by capturing work done, decisions made, and lessons learned in the journal.
12
+ - It updates TODO.md, DECISIONS.md, and ai-context/system-prompt-context.md to reflect current state.
13
+ - Use this at the end of every significant work session to preserve continuity and maintain documentation hygiene.
14
+ - The structured workflow ensures nothing is lost between sessions and handoff state is clean.
15
+
16
+ ---
17
+
18
+ Close the current Arcane session and leave docs in a clean handoff state.
19
+
20
+ Use these files first:
21
+
22
+ - [TODO.md](../../TODO.md)
23
+ - [DECISIONS.md](../../DECISIONS.md)
24
+ - [ai-context/system-prompt-context.md](../../ai-context/system-prompt-context.md)
25
+ - Most recent journal file(s) in [journal/](../../journal/)
26
+ - Any files changed during this session
27
+
28
+ Workflow:
29
+
30
+ 1. **Reconstruct the full session** from conversation context, terminal history, and changed files. Identify:
31
+ - Actions completed (config changes, installs, fixes).
32
+ - Decisions made (even implicit ones like naming choices, tool preferences, or workflow patterns).
33
+ - Problems encountered and how they were resolved (troubleshooting).
34
+ - Lessons learned (anything that cost time, surprised the user, or should prevent future mistakes).
35
+ - **Capture tie-in tip:** If this session produced durable analysis worth formalizing (a design, an investigation, a research finding, a reusable explanation), suggest running `spell-document` before closing so it lands in the right doc — a research finding defaults to `docs/research/<topic-slug>.md` per `portable-bootstrap.md`'s Research Reports convention. For quick ideas worth keeping but not yet actionable, suggest `spell-save-idea`. If this session had a real verification event worth a structured record — especially a confidently stated claim that a check later contradicted — suggest `spell-verification-ledger` separately; it is not part of this close-session flow itself.
36
+
37
+ 1b. **Verify in-flight async work before writing any output artifact (EF-21). Enforcement: structured spell gate (ARC-023) — this workflow requires the observable state of every dispatched item before proceeding to step 2.** "I started it" is not "it worked." Before the journal, TODO.md, or the handoff are written, enumerate every piece of asynchronous work dispatched during this session that could still be running or could have failed after being kicked off — CI/CD runs, deployments, package publishes, long-running background tasks, PR checks. For each, **actively check** its current status through whatever means is available (CI provider API/CLI, deployment dashboard, `gh run view`, `az pipelines runs show`, etc.) — attempt the check before reaching for `unverifiable`; that state exists for genuine access limits (no CLI/API access, no credentials, provider outage), not for skipping a check that was merely inconvenient to run. Then classify into exactly one state:
38
+
39
+ - **succeeded** — confirmed complete and correct. Only this state may be described as "done," "completed," or "shipped" anywhere in the journal, TODO.md, or the handoff.
40
+ - **failed** — confirmed to have failed. Record as a blocker or carry-forward item, never as done.
41
+ - **pending** — still running at last check. Record as in-flight; do not describe as complete.
42
+ - **dispatched** — kicked off, but no result has been observed at all (the letter was handed to the post office — you know it was sent, not whether it arrived).
43
+ - **unverifiable** — only after genuinely attempting the check above and finding this environment cannot query the target system. State the exact command, URL, or action the operator must run to check it themselves — a bare "unverifiable" with no next step is barely better than silence, and reaching for this state without attempting the check first defeats the purpose of this step as surely as skipping it entirely.
44
+
45
+ A commit succeeding, code being pushed, or a build being triggered are all **dispatched**, not **succeeded** — do not write any of them as complete until independently confirmed. Carry every non-succeeded item into the handoff's `Pending Verification` field (step 5b), and into `Last completed step` worded as not-yet-complete (also step 5b).
46
+
47
+ Step 10's existing PR-merge check ("Verify through the detected provider that the PR is merged before changing branches") is this same requirement applied to one specific, already-shipped case — the close-session's own PR. Running step 10 does not substitute for step 1b's sweep of everything else dispatched this session, and step 1b does not substitute for step 10's specific merge check; both apply.
48
+
49
+ 2. **Update today's journal file** at `journal/YYYY-MM-DD-topic-slug.md`.
50
+ - If it exists and already has a session section from this chat, **update that section in place** (do not create a duplicate).
51
+ - If it exists but has no section for this session, **append** a new `## Session: <title>` section.
52
+ - If it does not exist, **create** it using the existing journal frontmatter style.
53
+ - Journal entries must include:
54
+ - `### Prompt Context` — original prompt text or a faithful paraphrase of the multi-turn request when the session began from a substantive user ask. Include follow-up scope inputs if they materially changed the direction of the work.
55
+ - `### What Got Done` — numbered list of concrete outcomes with file/ADR references. Only list an outcome here if step 1b classified it `succeeded` (or it never involved async work at all, e.g. a local file edit). A `pending`/`dispatched`/`unverifiable` item belongs in Open Items Carried Forward, not here — do not let this section imply completion step 1b couldn't confirm.
56
+ - `### Decisions Made` — table of ADR number, decision, and rationale. If no decisions were made, omit this section.
57
+ - `### Lessons Learned` — one heading per lesson with enough context to prevent the mistake again. Use narrative, not bullet fragments.
58
+ - `### Open Items Carried Forward` — items that remain undone from this session, including every `pending`/`dispatched`/`failed`/`unverifiable` item from step 1b.
59
+
60
+ 3. **Update [DECISIONS.md](../../DECISIONS.md).**
61
+ - Add ADRs for any decisions made during the session (naming choices, tool preferences, workflow standards, security policies, etc.).
62
+ - Use the next sequential ADR number.
63
+ - Follow the existing format: Date, Status, Context, Decision, Reasoning, Rejected alternatives.
64
+
65
+ 4. **Update [TODO.md](../../TODO.md).**
66
+ - Mark an item done with date only if step 1b classified its outcome `succeeded` (or it required no async verification at all). A `pending`, `dispatched`, `failed`, or `unverifiable` item stays open, regardless of how confident the session felt about it.
67
+ - Keep unresolved items open.
68
+ - Remove completed checklist items only when completion is documented in the correct source-of-truth file.
69
+
70
+ 4b. **Register unfinished, task-bearing work on a durable surface (session handoff durability, ARC-040) before the handoff is written.** Enumerate: an incomplete `Active task`, the `Next concrete action`, and any content that would otherwise live only in `Notes` because it has no other durable home. For each, resolve the sink from `tracking_mode` (per ARC-032): `internal` → the appropriate `TODO.md` (root or venture book); `external` → a work item via the configured `external_provider`, falling back to `TODO.md` when tracker tooling is unavailable this session. Write or update the entry, then carry its location into step 5b so the handoff fields below can name it. Skip this step entirely when nothing is unfinished — a fully clean close has nothing to register.
71
+
72
+ 4c. **Follow-up promotion sweep (LH-09; only when this repo has its own `scripts/check-followups.ts` — Arcane's own repo, or one that adopted the same convention; skip gracefully otherwise).** Run `npm run check:followups` (or the closest journal-scoped equivalent) and check whether this session's own journal entry or closure notes contain a deferral phrase ("filed as a separate", "follow-up", "out of scope", "not fixed here", "left open", "deferred", "revisit", "future work") with no tracker token nearby (`TODO`, `IDEAS`, `Q-NNN`, `ARC-NNN`, `EF-NN`, `RCA-NNN`, a PR URL) and no explicit `(untracked: <reason>)` opt-out. Promote each real hit to `TODO.md`/`IDEAS.md` before writing the handoff, or add the opt-out inline. Report-only tool — a hit is a prompt to check, not proof of an untracked gap; skip anything that's already tracked elsewhere in the same document.
73
+
74
+ 4d. **Record the epic's reader-facing line (only when this session shipped an epic of a tracked program — one with a `docs/plans/<slug>/PLAN.md`; skip entirely otherwise).** Copy the `## For the record` sentence from the epic's own PR description verbatim into that epic's `PLAN.md` entry as its `**Report:**` line, in the format `**Report:** <sentence> · category: <spell|feature|governance|decision|fix|process|docs|platform>`, alongside the PR number the epic ticked with. Authored at PR time (see `spell-create-pull-request` Step 4) and copied here — never re-invented at close, and never substituted with the commit subject, which describes the change to an engineer rather than to the program's reader. **If the PR carried no such section**, leave the line absent rather than writing one from memory: the generator renders a missing description visibly as `unwritten`, and a visible gap someone can fill later is worth more than a plausible sentence nobody verified. Where a completion report is generated (`npm run check:report` / `spell report`), regenerate it after this edit so the committed artifact matches its sources.
75
+
76
+ 5. **Update [ai-context/system-prompt-context.md](../../ai-context/system-prompt-context.md).**
77
+ - If priorities, environment state, or agent rules changed during the session, update the file to reflect current reality.
78
+ - If no changes are needed, skip this step.
79
+
80
+ 5b. **Write the Next Session Handoff block.**
81
+
82
+ In `ai-context/system-prompt-context.md`, replace the existing `## Next Session Handoff` section (or append it if the section is absent) with a freshly generated block. Populate every field from conversation context and current git state:
83
+
84
+ ```markdown
85
+ ## Next Session Handoff
86
+
87
+ > Auto-generated by spell-close-session. Consumed by spell-open-session. Do not edit manually.
88
+ > Generated: YYYY-MM-DD
89
+
90
+ - **Active task:** One-line description of the task that was in progress when this session closed. If incomplete, name where step 4b registered it (e.g. `path ("the item's own quoted title")` — a stable locator naming the actual file and its bold title, never a bare line number that drifts the moment that file is next edited).
91
+ - **Last completed step:** The final concrete action taken — include file path or command text. If that action was async work step 1b classified as anything other than `succeeded`, do not describe it as done here — name the action in `dispatched`/in-progress terms (e.g. "Pushed the fix and opened PR #NN" is fine; "Merged PR #NN" is not, unless step 1b confirmed the merge) and let `Pending Verification` carry the actual state.
92
+ - **Next concrete action:** The exact first thing to do at next session start. Be specific: file, command, or decision. Never write "continue work." Name where step 4b registered it (e.g. `path ("the item's own quoted title")` — a stable locator naming the actual file and its bold title, never a bare line number that drifts the moment that file is next edited).
93
+ - **Active files:** Files with uncommitted changes or the focus of the last edit (comma-separated).
94
+ - **Branch:** Output of `git branch --show-current`.
95
+ - **Blockers:** Known unresolved blockers or dependencies. Write "None" if clear.
96
+ - **Pending Verification:** One line per non-`succeeded` item from step 1b: `<what> — <state> — <verification action>`. States: `dispatched`, `pending`, `failed`, `unverifiable` (never list a `succeeded` item here — it belongs in `Last completed step` / TODO.md / the journal instead, worded per the gating above). The verification action is required for `dispatched`, `pending`, and `unverifiable` — "N/A" is only valid for `failed`, where the state is already resolved and there is nothing left to check. Write "None" only if step 1b found every dispatched item resolved to `succeeded` or `failed` before this handoff was written.
97
+ - **Notes:** Anything time-sensitive, fragile, or contextual that would be lost if not stated explicitly. Never the sole carrier of durable content (session handoff durability) — if it names unfinished work, that work must also be registered per step 4b; name its location here.
98
+ ```
99
+
100
+ Rules:
101
+
102
+ - Do not omit any field. Write "N/A" if not applicable.
103
+ - The block header must include the generation date.
104
+ - This section is ephemeral — it will be overwritten by the next close-session and consumed by the next open-session.
105
+
106
+ 6. **Update troubleshooting sections** in affected operational docs.
107
+ - If problems were encountered and resolved during the session, add troubleshooting entries to the relevant runbook (e.g., `agents/installation.md`, `security/hardening-checklist.md`).
108
+ - Use the standard format: **Symptom**, **Cause**, **Fix**, **Verify**, **Prevention**.
109
+ - If screenshots were provided during the session, reference them in troubleshooting or journal entries.
110
+
111
+ 7. **Process screenshots** (if provided during the session).
112
+ - **First check `content_sensitivity` in `.arcane.json`.** If it is
113
+ `"sensitive"`, retain no screenshots of repository contents and transcribe
114
+ nothing from them into the journal — record the document path instead. See
115
+ universal-agent-rules.md, "Sensitive Repositories".
116
+ - Screenshots should already be saved to `assets/screenshots/YYYY-MM-DD/` — agents must save them immediately when the user pastes them (see global screenshot rule in `copilot-instructions.md`).
117
+ - At close-session time, review all screenshots saved during the session.
118
+ - Keep only screenshots that provide durable evidence for journal/runbook documentation.
119
+ - Delete duplicates, low-signal images, and any screenshot containing sensitive data (secrets, tokens, PII).
120
+ - Ensure every kept screenshot is referenced in at least one doc (journal entry or troubleshooting section).
121
+ - For journal files under `journal/`, reference via: `![description](../assets/screenshots/YYYY-MM-DD/filename.png)`.
122
+ - Reference in troubleshooting docs with context captions.
123
+
124
+ 8. **Flag documentation drift** discovered while closing the session — stale dates, outdated priorities, contradictions between docs.
125
+
126
+ 9. **Stage and commit session-close docs.**
127
+
128
+ **Remote-capability check:** classify the state created by `spell-open-session` before branching, staging, push, or PR operations. Check for **not a repository at all** first — every other classification assumes a `.git` directory exists.
129
+ - **Not a Git repository (EF-05):** `git rev-parse --is-inside-work-tree` fails. Do not attempt any git operation (branch, add, commit, push). Fail closed with: `No Git repository detected. Run \`git init -b main\` first (explicit -b avoids landing on "master" on systems where that's the init.defaultBranch default), then re-run spell-close-session.` This mirrors `spell init`'s own next-steps guidance for the same state.
130
+ - **Usable supported remote/merge path:** requires an authenticated supported provider (`github.com`, `dev.azure.com`, or `visualstudio.com`). Keep the current compliant session/PR/worktree branch, resolve the actual remote name and integration branch, and use the provider-neutral PR path below.
131
+ - **No usable remote/merge path:** remain on the current trunk. Do not create a dead session branch, push, pull, or open a PR. Apply the EF-28 interactive commit approval gate, commit locally on trunk after approval, report `Local-only close: committed on <trunk>; no remote PR/pull performed`, and skip steps 9a, 9c, and 10's remote operations.
132
+ - **Read-only session:** if no repository mutation occurred, do not create a branch or commit.
133
+
134
+ a. **Branch check — create a topic branch before any staging:**
135
+ This remote branch path applies only when the remote-capability check found a usable merge path.
136
+ Run `git branch --show-current`. If you are on the resolved integration branch `<trunk>`, create a topic branch **now** before any `git add`:
137
+
138
+ ```powershell
139
+ git checkout -b docs/session-close-YYYY-MM-DD
140
+ ```
141
+
142
+ Never commit directly to a remotely protected integration branch — the branch policy rejects direct pushes. If a session branch already exists (created by `spell-open-session`), stay on it.
143
+
144
+ b. **Stage and apply the interactive commit gate from `spell-commit-work`:**
145
+ - Run `git add -A && git diff --stat --cached` to show what changed.
146
+ - Auto-generate a conventional commit message summarizing the session closure (e.g., `docs(journal): close session — <topic>`).
147
+ - Treat session close as `interaction_context: interactive` unless independently dispatched with validated autonomous authority.
148
+ - Bind structured operator approval to the exact staged diff and proposed message fingerprint. Recompute before commit; any change invalidates approval.
149
+ - Timeout, cancellation, fallback, or delegated response is not approval. Print the visible authorization downgrade and halt without committing.
150
+
151
+ c. **Push and open a PR through `spell-commit-work` step 9, including its separate merge gate:**
152
+ - Commit approval is not merge approval.
153
+ - Never invoke merge, auto-complete, or `--status completed` below loader-validated Magus authority.
154
+ - Missing/invalid authority visibly downgrades to PR creation only and requires human completion.
155
+ - Interactive Magus+ completion still requires separate authenticated approval tied to the exact PR ID and head SHA.
156
+
157
+ 10. **Synchronize the configured integration branch after the PR merges (remote path only):**
158
+ - Skip this entire step for local-only and read-only sessions.
159
+ - Resolve `<remote>` and `<trunk>` from observed Git/provider state: use the usable authenticated remote selected in step 9 and the merged PR's target branch (falling back to that remote's default branch). Never assume `origin` or `main`.
160
+ - Verify through the detected provider that the PR is merged before changing branches.
161
+ - **Determine the isolation primitive first (ARC-028 R8).** Run both of these and compare:
162
+ ```bash
163
+ git rev-parse --path-format=absolute --git-common-dir
164
+ git rev-parse --path-format=absolute --git-dir
165
+ ```
166
+ Equal → **primary checkout**. Different → **linked worktree**, and the two paths below diverge. `spell-open-session` should already have named the primitive; re-derive it here rather than trusting the handoff, because the session may have moved.
167
+
168
+ **`--path-format=absolute` is required, not decorative.** Without it, `--git-dir` returns an absolute path while `--git-common-dir` stays relative whenever the current directory is *below* the repository root — so a plain comparison reports the primary checkout as a linked worktree from any subdirectory, which is most of the time. If your git predates `--path-format` (2.31), use `git rev-parse --git-dir` and test whether the result contains `/worktrees/` instead.
169
+
170
+ **Primary checkout (the default path):**
171
+ - Run `git switch <trunk>` followed by `git pull --ff-only <remote> <trunk>`. Do not end a remote-backed session on a topic branch.
172
+ - Delete the local topic branch: `git branch -d <branch>` — if the repository or its linked worktrees might be reached through more than one filesystem view, run the same-vantage-point check first (EF-33 / ARC-028 R7, [governance/git-conventions.md](../../.arcane/governance/git-conventions.md) Same-Vantage-Point Check section).
173
+ - Verify `git log --oneline -3` shows the merged change at HEAD.
174
+
175
+ **Linked worktree:**
176
+ - First establish whether any working tree currently holds `<trunk>`: run `git worktree list` and look for `[<trunk>]`. That, not the mere fact of being in a worktree, is what determines the two rules below — a **bare** repository with worktrees attached (a common agent-fleet layout: one bare clone, one worktree per agent) usually has no checkout holding `<trunk>` at all, and there `git switch <trunk>` and `git branch -d` both succeed normally. Verified: they do.
177
+ - **If a working tree holds `<trunk>`, do not run `git switch <trunk>`.** It will fail — Git refuses to check out one branch in two worktrees (`fatal: '<trunk>' is already used by worktree at '<path>'`). Ending on the session branch is correct here, not a lapse; the branch is already merged and the worktree is about to be removed.
178
+ - **Do not run `git branch -d <branch>` while this worktree is attached to it.** It will fail (`error: cannot delete branch '<branch>' used by worktree at '<path>'`), from inside the worktree and from the primary alike. Both refusals are the guardrail ARC-028 R3/R7 leans on, not an obstacle to work around — never reach for `-D`, `--force`, or manual deletion of `.git/worktrees/<name>` to get past them. (`-D` does not bypass this either; the refusal is about attachment, not about merge state.)
179
+ - Report the worktree path and the branch name, and name **where** removal must happen: `git worktree remove <path>` then `git fetch --prune <remote>`, run after the same-vantage-point check from a checkout that is not this one. A worktree cannot safely remove itself. If `git worktree list` shows a working tree holding `<trunk>`, that is the vantage point; if the repository is **bare**, run it from the bare repository itself (`git -C <bare> worktree remove <path>`) — do not report the work as belonging to a "primary checkout" that does not exist.
180
+ - If this worktree was created with `--detach` there is no branch to name; report the path and the detached HEAD sha instead.
181
+ - Verify the merge landed with `git log --oneline -3 <remote>/<trunk>` (the remote-tracking ref), since local `<trunk>` is not checked out here to fast-forward.
182
+
183
+ - **Common to both: run the idempotent, content-verified branch sweep** (TODO.md's merged-branch-cleanup finding) — not merely a list-and-suggest step. For every local branch except `<trunk>` and any branch attached to another worktree, apply [Content-Verified Branch Deletion](../../.arcane/governance/git-conventions.md#content-verified-branch-deletion-todomd-merged-branch-cleanup-finding) (git-conventions.md): fetch first, prefer a confirmed PR-merged status when one exists, otherwise verify by `git cherry` patch-id equivalence *and* a resulting-content check for `+`-flagged commits (a squash or independently re-authored commit can carry already-landed content under a different patch-id). Actually delete (`-D`, never `-d`) every branch that verifies as fully landed, local and remote. Report — do not delete — any branch with genuine unmerged content; a one-line summary of what it holds is enough for a human to decide land vs. abandon. Apply the Same-Vantage-Point Check (EF-33) before any deletion if the repository or its linked worktrees might be reached through more than one filesystem view. Safe to run every session: an already-clean branch list is simply a no-op.
184
+ - See [governance/git-conventions.md](../../.arcane/governance/git-conventions.md) Post-Merge Cleanup section.
185
+
186
+ 11. **Return a concise closure report.**
187
+
188
+ Output format:
189
+
190
+ ## Session Closure
191
+
192
+ - Summary of what was completed.
193
+ - **Session commit graph** — per the generated state diagrams convention (rule 8, ARC-036), built only
194
+ from commits this session actually made (`git log <trunk>..HEAD --format="%h %s" --reverse`, or
195
+ `<remote>/<trunk>..HEAD` once pushed) plus step 1b's succeeded/pending/failed classification per
196
+ commit. Skip entirely (the applicability guard) for a read-only session or a single-commit session —
197
+ one point has nothing to sequence. Deliberately `gitGraph`, the same already-verified diagram type
198
+ R1–R9 use, not Mermaid's `timeline` diagram — that type is marked experimental in Mermaid's own docs,
199
+ a real compatibility risk across GitHub/VS Code/Obsidian this convention explicitly commits to
200
+ supporting; a session's own commit sequence is exactly what `gitGraph` already represents:
201
+
202
+ ```mermaid
203
+ gitGraph
204
+ commit id: "<short-sha 1> succeeded"
205
+ commit id: "<short-sha 2> pending"
206
+ ```
207
+
208
+ One commit per session commit, in order, `id` carrying its short SHA and step 1b's classification —
209
+ never claim `succeeded` for anything step 1b did not confirm as such.
210
+
211
+ ## Journal Updates
212
+
213
+ - Exact file updates made.
214
+
215
+ ## Decision Updates
216
+
217
+ - ADRs added or note that none were needed.
218
+
219
+ ## TODO Updates
220
+
221
+ - Exact checklist changes made.
222
+
223
+ ## Drift and Fixes
224
+
225
+ - Documentation drift found and corrected, or "None."
226
+
227
+ ## Screenshots
228
+
229
+ - Screenshots saved to `assets/screenshots/YYYY-MM-DD/` with references added to journal/docs, or "None provided."
230
+
231
+ ## PR Readiness
232
+
233
+ Enumerate the current end state and the prescribed next action. Use this table to classify where the session landed within the provider-neutral lifecycle above:
234
+
235
+ | End state | Next action |
236
+ | --- | --- |
237
+ | Local-only trunk, changes committed | Session is integrated locally; no branch or PR cleanup required. |
238
+ | Read-only session, no changes | No branch or commit required. |
239
+ | Open PR exists | Docs/changes reach `main` when it merges — show the PR URL. |
240
+ | No PR + docs-only on a branch | Run `spell-create-pull-request --docs-only`. |
241
+ | No PR + mixed code+docs on a branch | Run `spell-create-pull-request` once the feature is complete. |
242
+ | Docs-only commit on remote-backed `<trunk>` | Create a `chore/docs` branch, then run `spell-create-pull-request --docs-only`. |
243
+ | Nothing ahead of `<remote>/<trunk>` | Branch is fully merged — clean up local/remote branches. |
244
+
245
+ ## Carry Forward
246
+
247
+ - 3 to 5 concrete next actions.
248
+
249
+ ## What's Next?
250
+
251
+ Route the user to the right next spell based on the end state:
252
+
253
+ - **Docs-only commit on remote-backed `<trunk>`** — create a docs branch, then run `spell-create-pull-request --docs-only`.
254
+ - **On a feature branch, ready for review** — run `spell-create-pull-request`.
255
+ - **On a feature branch, still in progress** — next session, run `spell-open-session` to resume.
256
+ - **PR already open** — run `spell-address-review` after reviewers comment.
257
+
258
+ Rules:
259
+
260
+ - Do not invent completions — only mark items done if verifiable from context. "Verifiable" means classified `succeeded` under step 1b's five-state vocabulary (`dispatched`/`pending`/`succeeded`/`failed`/`unverifiable`), not merely "I can see it was started" (EF-21).
261
+ - `Notes` is a pointer, never the sole carrier of durable content (session handoff durability) — if something needs to survive to next session, it must also live wherever step 4b registers it, not only in prose here.
262
+ - Keep frontmatter date values in `YYYY-MM-DD`.
263
+ - Preserve existing checklist and journal style.
264
+ - Keep edits minimal and factual.
265
+ - Never include secrets, API keys, or tokens in any document.
266
+ - If a journal entry for this session already exists (same date, same topic), update it rather than creating a duplicate.