sequant 2.8.0 → 2.9.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 (68) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/README.md +9 -1
  4. package/dist/bin/cli.js +2 -1
  5. package/dist/marketplace/external_plugins/sequant/.claude-plugin/plugin.json +1 -1
  6. package/dist/marketplace/external_plugins/sequant/README.md +2 -0
  7. package/dist/marketplace/external_plugins/sequant/hooks/post-tool.sh +18 -3
  8. package/dist/marketplace/external_plugins/sequant/hooks/pre-tool.sh +330 -57
  9. package/dist/marketplace/external_plugins/sequant/skills/assess/SKILL.md +96 -15
  10. package/dist/marketplace/external_plugins/sequant/skills/assess/references/predicted-collision-detection.md +9 -6
  11. package/dist/marketplace/external_plugins/sequant/skills/fullsolve/SKILL.md +1 -1
  12. package/dist/marketplace/external_plugins/sequant/skills/reflect/SKILL.md +27 -13
  13. package/dist/marketplace/external_plugins/sequant/skills/reflect/references/documentation-tiers.md +80 -68
  14. package/dist/marketplace/external_plugins/sequant/skills/reflect/references/phase-reflection.md +31 -15
  15. package/dist/marketplace/external_plugins/sequant/skills/release/SKILL.md +10 -2
  16. package/dist/marketplace/external_plugins/sequant/skills/spec/references/verification-criteria.md +1 -1
  17. package/dist/src/commands/logs.js +6 -1
  18. package/dist/src/commands/run-display.d.ts +20 -0
  19. package/dist/src/commands/run-display.js +80 -1
  20. package/dist/src/commands/stats.js +47 -0
  21. package/dist/src/lib/assess-collision-detect.d.ts +19 -2
  22. package/dist/src/lib/assess-collision-detect.js +68 -4
  23. package/dist/src/lib/cli-ui/run-renderer.js +17 -9
  24. package/dist/src/lib/errors.d.ts +6 -0
  25. package/dist/src/lib/errors.js +9 -2
  26. package/dist/src/lib/manifest.js +1 -17
  27. package/dist/src/lib/version-check.js +1 -5
  28. package/dist/src/lib/workflow/batch-executor.d.ts +13 -0
  29. package/dist/src/lib/workflow/batch-executor.js +81 -18
  30. package/dist/src/lib/workflow/chain-preflight.d.ts +89 -0
  31. package/dist/src/lib/workflow/chain-preflight.js +199 -0
  32. package/dist/src/lib/workflow/chain-resume.d.ts +116 -0
  33. package/dist/src/lib/workflow/chain-resume.js +166 -0
  34. package/dist/src/lib/workflow/dependency-markers.d.ts +29 -0
  35. package/dist/src/lib/workflow/dependency-markers.js +79 -0
  36. package/dist/src/lib/workflow/drivers/claude-code.d.ts +7 -0
  37. package/dist/src/lib/workflow/drivers/claude-code.js +30 -6
  38. package/dist/src/lib/workflow/error-classifier.d.ts +9 -2
  39. package/dist/src/lib/workflow/error-classifier.js +14 -1
  40. package/dist/src/lib/workflow/log-writer.js +6 -8
  41. package/dist/src/lib/workflow/metrics-schema.d.ts +39 -0
  42. package/dist/src/lib/workflow/metrics-schema.js +16 -0
  43. package/dist/src/lib/workflow/metrics-writer.d.ts +2 -1
  44. package/dist/src/lib/workflow/phase-executor.d.ts +32 -0
  45. package/dist/src/lib/workflow/phase-executor.js +77 -5
  46. package/dist/src/lib/workflow/run-log-schema.d.ts +23 -0
  47. package/dist/src/lib/workflow/run-log-schema.js +45 -1
  48. package/dist/src/lib/workflow/run-orchestrator.d.ts +14 -0
  49. package/dist/src/lib/workflow/run-orchestrator.js +291 -30
  50. package/dist/src/lib/workflow/status-derivation.d.ts +30 -0
  51. package/dist/src/lib/workflow/status-derivation.js +27 -0
  52. package/dist/src/lib/workflow/types.d.ts +23 -0
  53. package/dist/src/lib/workflow/worktree-manager.d.ts +43 -1
  54. package/dist/src/lib/workflow/worktree-manager.js +103 -33
  55. package/dist/src/mcp/tools/run.d.ts +2 -0
  56. package/dist/src/mcp/tools/run.js +2 -0
  57. package/package.json +2 -4
  58. package/templates/hooks/post-tool.sh +18 -3
  59. package/templates/hooks/pre-tool.sh +330 -57
  60. package/templates/scripts/cleanup-worktree.sh +103 -14
  61. package/templates/skills/assess/SKILL.md +96 -15
  62. package/templates/skills/assess/references/predicted-collision-detection.md +9 -6
  63. package/templates/skills/fullsolve/SKILL.md +1 -1
  64. package/templates/skills/reflect/SKILL.md +27 -13
  65. package/templates/skills/reflect/references/documentation-tiers.md +80 -68
  66. package/templates/skills/reflect/references/phase-reflection.md +31 -15
  67. package/templates/skills/release/SKILL.md +10 -2
  68. package/templates/skills/spec/references/verification-criteria.md +1 -1
@@ -196,11 +196,10 @@ Triggers (any one):
196
196
  - Issue body or comments mention `"depends on #N"`, `"blocked by #N"`, or `"after #N"`
197
197
  - One issue's described output is another issue's input (e.g., A changes a function signature that B consumes)
198
198
 
199
- Format: `Chain: <CMD_PREFIX> run <N1> <N2> --chain --qa-gate -Q <phases> # alternative — <one-line reason>` (`<CMD_PREFIX>` resolved in Step 1)
199
+ Format: `Chain: <CMD_PREFIX> run <N1> <N2> --chain -Q <phases> # alternative — <one-line reason>` (`<CMD_PREFIX>` resolved in Step 1)
200
200
 
201
201
  Flag references:
202
202
  - `--chain` chains issues (each branches from previous; implies `--sequential`)
203
- - `--qa-gate` pauses chain on QA failure (requires `--chain`)
204
203
  - `--base <branch>` — issue references a feature branch
205
204
 
206
205
  ### Step 5: Conflict Detection
@@ -255,7 +254,7 @@ Order: <N> → <N> (<dependency reason>)
255
254
  ⚠ #<N> <warning>
256
255
  ⚠ #<N> <warning>
257
256
 
258
- Chain: <CMD_PREFIX> run <N1> <N2> --chain --qa-gate -Q <phases> # alternative — <reason>
257
+ Chain: <CMD_PREFIX> run <N1> <N2> --chain -Q <phases> # alternative — <reason>
259
258
 
260
259
  Flags:
261
260
  <flag> <one-line reason>
@@ -318,7 +317,7 @@ Emit annotations in this order between the separators that follow `Commands:`:
318
317
  - `⚠ #412 bug + auth labels — domain label (auth) takes priority over bug`
319
318
 
320
319
  - **`Chain:`** — Only when 2+ PROCEED issues have a detected dependency (see "Chain detection" in Step 4). Suggests an alternative execution topology. Does not replace the default per-issue commands. Format:
321
- `Chain: <CMD_PREFIX> run <N1> <N2> --chain --qa-gate -Q <phases> # alternative — <one-line reason>` (`<CMD_PREFIX>` resolved in Step 1)
320
+ `Chain: <CMD_PREFIX> run <N1> <N2> --chain -Q <phases> # alternative — <one-line reason>` (`<CMD_PREFIX>` resolved in Step 1)
322
321
 
323
322
  - **`Flags:`** — Only when non-default flags appear in the commands and the reason isn't obvious. One line per **distinct** flag used across all commands. Omit entire section when `-Q` is the only non-default flag AND its reason is obvious (e.g., all issues are enhancements). Format:
324
323
  ```
@@ -402,7 +401,7 @@ Order: 185 → 186 (185 changes fetchApi error format that 186 consumes)
402
401
  ⚠ #185 Domain errors already exist in repository layer — scope may be smaller than expected
403
402
  ⚠ #186 @tanstack/react-query not installed; large scope (9 hooks + optimistic updates)
404
403
 
405
- Chain: npx sequant run 185 186 --chain --qa-gate -Q --testgen
404
+ Chain: npx sequant run 185 186 --chain -Q --testgen
406
405
  # alternative — use if 186 should branch from 185's work
407
406
 
408
407
  Flags:
@@ -669,16 +668,97 @@ Every separator and section is conditional. If there are no warnings, no chain,
669
668
 
670
669
  After displaying output, prompt the user to save using `AskUserQuestion` with options "Yes (Recommended)" and "No".
671
670
 
672
- If confirmed, post a structured comment to each issue via `gh issue comment`. Each posted comment should include:
673
- - **Supersession header** (when priors exist): If `findAllAssessComments` returned ≥1 prior, prepend `buildSupersessionHeader(priors)` immediately above the `→ ACTION — reason` line. When `detectChurn(...).isChurn === true`, also emit a `⚠ Re-assessed N times since <firstDate> without execution — possible blocker or low priority` warning in the dashboard. When `shouldPromptOnConflict(prior, new) === true`, confirm with the user via `AskUserQuestion` before posting. See "Prior Assessment Detection" in Step 1 for full protocol.
674
- - The action headline (`→ ACTION — reason`)
675
- - The workflow (for PROCEED/REWRITE)
676
- - Standard HTML markers on separate lines:
677
- ```
678
- <!-- assess:action=PROCEED -->
679
- <!-- assess:phases=spec,exec,qa -->
680
- <!-- assess:quality-loop=true -->
681
- ```
671
+ If confirmed, post a structured comment to each issue via `gh issue comment`. **Each posted comment is rendered with the single-mode template that matches that issue's verdict** — the same `#### PROCEED / CLOSE / CLARIFY / PARK / MERGE / REWRITE` templates defined under [Single Mode (1 issue)](#single-mode-1-issue) above. There is no separate, thinner shape for posted comments: the batch **dashboard** in chat and the **posted comment** on each issue are the only two formats, and the posted comment always reuses the single-mode template for its verdict. (Note: this is *not* a reversal of #453 — the single-mode templates are themselves the streamlined, scan-friendly format.)
672
+
673
+ Render each comment as follows:
674
+
675
+ 1. **Pick the template by verdict.** For issue `#N`'s action, use the matching single-mode template (`#### PROCEED`, `#### REWRITE`, etc.) and fill it exactly as single mode would, including — where that template defines them:
676
+ - the `#<N> — <Title>` / `<State> · <labels>` header,
677
+ - the section separators the template defines,
678
+ - the `Commands:` block with the **resolved `CMD_PREFIX`** (Step-1 probe — `sequant` when a global is on PATH, else `npx sequant`) and the **real current flags** for that issue. When the dashboard batched several issues onto one `run` line (e.g. `run 461 460 458 443 -Q`), restate just `#N`'s own single-issue invocation (`run 458 -Q`): the shared flags that applied to `#N`, plus any per-issue flags the dashboard listed separately for it (e.g. `#412`'s `--security-review`, `#411`'s `--phases exec,qa`),
679
+ - the `<phases> · <N> ACs` line,
680
+ - for **CLOSE**, the `Cleanup:` block populated with just `#N`'s cleanup commands, de-aggregated from the dashboard's combined `Cleanup:` block.
681
+
682
+ Reference these templates rather than re-copying their bodies here — they are the single source of truth (avoids drift). Verdicts whose template omits a field (CLOSE / CLARIFY / PARK / MERGE have no `Commands:` or `<phases> · <N> ACs` line) simply omit it, exactly as the template shows.
683
+
684
+ 2. **Carry per-issue warnings.** Any `⚠` line from the batch dashboard that concerns `#N` (collision/conflict, churn, staleness, dual-concern, partial-AC) is carried into that issue's comment, with the leading `#N` dropped (the comment is already scoped to that issue). Placement depends on whether the verdict's template defines a warning slot:
685
+ - **PROCEED / REWRITE** — the template already defines a `⚠ ...` region between its two trailing separators; place the warning there.
686
+ - **CLOSE / CLARIFY / PARK / MERGE** — these templates have no `⚠` region (just a single trailing separator before the markers). Add the warning as its own separator-delimited block immediately above the marker block, so the tail reads: `<trailing separator>` → `⚠ ...` → `<separator>` → `<!-- assess:action=... -->`. This is the sole case where a posted comment extends a slot-less template; every other field still follows Step 1's "omit what the template omits." When an issue has no `⚠`, the template is emitted unchanged.
687
+
688
+ 3. **Supersession header** (when priors exist): If `findAllAssessComments` returned ≥1 prior, prepend `buildSupersessionHeader(priors)` immediately above the `→ ACTION — reason` line. When `detectChurn(...).isChurn === true`, also emit the `⚠ Re-assessed N times since <firstDate> without execution — possible blocker or low priority` warning in the warning slot (per step 2). When `shouldPromptOnConflict(prior, new) === true`, confirm with the user via `AskUserQuestion` before posting. See "Prior Assessment Detection" in Step 1 for full protocol.
689
+
690
+ 4. **Machine markers.** The posted comment keeps the single-mode **3-line** marker block — one directive per line, and only those directives the verdict defines:
691
+ ```
692
+ <!-- assess:action=PROCEED -->
693
+ <!-- assess:phases=spec,exec,qa -->
694
+ <!-- assess:quality-loop=true -->
695
+ ```
696
+ Do **not** use the batch dashboard's compact one-line marker (`<!-- #N assess:action=… assess:phases=… -->`) in a posted comment — that form is for the chat dashboard only.
697
+
698
+ The chat batch dashboard is unchanged — this step governs only what lands on each issue.
699
+
700
+ ### Batch: dashboard vs posted comment
701
+
702
+ A batch run shows one scannable dashboard in chat, then posts one single-mode comment per issue. The two are distinct by design: the dashboard is a triage table across all issues; each comment is the full single-mode assessment for that one issue.
703
+
704
+ Dashboard (chat) — excerpt for #458:
705
+
706
+ ```
707
+ # Action Reason Run
708
+ 458 PROCEED Parallel UX + race condition spec → exec → qa
709
+ ────────────────────────────────────────────────────────────────
710
+ Commands:
711
+ npx sequant run 458 -Q
712
+ ────────────────────────────────────────────────────────────────
713
+ ⚠ #458 Dual concern (UX + race) across 4 files
714
+
715
+ Flags:
716
+ -Q dual concern across 4 files
717
+ ────────────────────────────────────────────────────────────────
718
+
719
+ <!-- #458 assess:action=PROCEED assess:phases=spec,exec,qa assess:quality-loop=true -->
720
+ ```
721
+
722
+ Posted comment on issue #458 (single-mode PROCEED template — `#N` dropped from the warning, 3-line markers):
723
+
724
+ ```
725
+ #458 — Parallel run UX freeze + reconcileState race condition
726
+ Open · bug, enhancement, cli
727
+ ────────────────────────────────────────────────────────────────
728
+
729
+ → PROCEED — Both root causes confirmed in codebase
730
+
731
+ Commands:
732
+ npx sequant run 458 -Q
733
+
734
+ spec → exec → qa · 8 ACs
735
+
736
+ Flags:
737
+ -Q dual concern across 4 files
738
+ ────────────────────────────────────────────────────────────────
739
+ ⚠ Dual concern (UX + race) across 4 files
740
+ ────────────────────────────────────────────────────────────────
741
+
742
+ <!-- assess:action=PROCEED -->
743
+ <!-- assess:phases=spec,exec,qa -->
744
+ <!-- assess:quality-loop=true -->
745
+ ```
746
+
747
+ For a verdict whose template has no `⚠` slot, the carried warning becomes its own separator-delimited block above the markers (Step 2). Posted comment on a **PARK** issue the churn detector flagged:
748
+
749
+ ```
750
+ #530 — Measure real-world assess latency across 20 repos
751
+ Open · task, needs-data
752
+ ────────────────────────────────────────────────────────────────
753
+
754
+ → PARK — Blocked on manual measurement not yet scheduled
755
+ Resume after: latency sampling run completes
756
+ ────────────────────────────────────────────────────────────────
757
+ ⚠ Re-assessed 3 times since 2026-06-30 without execution — possible blocker or low priority
758
+ ────────────────────────────────────────────────────────────────
759
+
760
+ <!-- assess:action=PARK -->
761
+ ```
682
762
 
683
763
  ## Notes
684
764
 
@@ -709,4 +789,5 @@ If confirmed, post a structured comment to each issue via `gh issue comment`. Ea
709
789
  - [ ] Supersession header prepended when prior assess comments exist (`buildSupersessionHeader`)
710
790
  - [ ] Churn warning included in dashboard when `detectChurn(...).isChurn === true`
711
791
  - [ ] Batch mode: table is the primary output, no per-issue detail sections
792
+ - [ ] Persist step: each posted comment uses the single-mode verdict template (not the dashboard shape or a thinner form), with per-issue `⚠` carried into the warning slot and the 3-line marker block
712
793
  - [ ] Single mode: focused summary with separators between sections
@@ -15,9 +15,12 @@ The detector runs automatically during Step 5 whenever ≥2 PROCEED issues are p
15
15
 
16
16
  For each issue body, paths are extracted in this order:
17
17
 
18
- ### 1. Strip code blocks and HTML comments
18
+ ### 1. Strip code blocks, HTML comments, and background sections
19
19
 
20
- Fenced code blocks (```` ``` … ``` ````) and HTML comments (`<!-- … -->`) are removed before any path matching. This is the **AC-5 false-positive guard**: paths quoted as code in prose count, paths inside a code block don't.
20
+ Two pre-extraction strips run before any path matching:
21
+
22
+ - **Code blocks and HTML comments.** Fenced code blocks (```` ``` … ``` ````) and HTML comments (`<!-- … -->`) are removed. This is the **AC-5 false-positive guard**: paths quoted as code in prose count, paths inside a code block don't.
23
+ - **Background/citation sections (#769).** Content under any H1/H2 heading whose text prefix-matches `BACKGROUND_SECTIONS` — `References`, `Context`, `Motivation`, `Additional context`, `See also` (case-insensitive) — is removed, up to the next H1/H2 heading. A path named *only* under such a section is a citation of existing code, not a file the issue will modify, so it no longer contributes to the path set. A path named in an AC bullet (or any other foreground section) survives even when it is *also* cited under `## References`.
21
24
 
22
25
  ### 2. Backtick-quoted source paths (PATH_REGEX)
23
26
 
@@ -85,9 +88,9 @@ These paths are stripped from every issue's path set before pairwise intersectio
85
88
 
86
89
  `EXCLUDED_PATHS` in `src/lib/assess-collision-detect.ts` is the canonical list. To add or remove an entry, edit that constant; this document and the skill prose pick up the change automatically.
87
90
 
88
- ### Code block / HTML comment stripping
91
+ ### Code block / HTML comment / background-section stripping
89
92
 
90
- Step 1 of the extraction (above) removes all fenced code blocks and HTML comments before path matching. A path mentioned **only** inside one of those will not contribute to the issue's path set.
93
+ Step 1 of the extraction (above) removes all fenced code blocks, HTML comments, and background/citation sections (`## References`, `## Context`, `## Motivation`, `## Additional context`, `## See also`) before path matching. A path mentioned **only** inside one of those will not contribute to the issue's path set. This is what stops sibling issues that all cite the same background doc under `## References` from being reported as a phantom collision (#769).
91
94
 
92
95
  ### Path-shape constraints
93
96
 
@@ -95,7 +98,7 @@ The PATH_REGEX requires a directory prefix (one of the six tracked roots) and a
95
98
 
96
99
  ## Tuning notes
97
100
 
98
- - **Proximity weighting** is not implemented. The original feature design proposed weighting paths inside `- [ ] **AC-N:**` bullets higher than paths in "Motivation" or "Additional context". Adding it is a follow-up if the false-positive rate becomes a problem in practice; leave it out until evidence demands it.
101
+ - **Background-section exclusion is implemented (#769); proximity *scoring* is not.** The original design (#556) proposed weighting paths by proximity to `- [ ] **AC-N:**` bullets. #769 shipped the cheap version of that mitigation instead — strip whole background sections (`BACKGROUND_SECTIONS`: `References`, `Context`, `Motivation`, `Additional context`, `See also`) before extraction, so a path cited *only* as background drops out while AC-bullet paths survive. The fuller per-path scoring model remains a follow-up if wholesale section exclusion proves too blunt (e.g. a real target named only under `## Context` becomes a false negative); leave it out until evidence demands it.
99
102
  - **Cost.** For 13 issues (the realistic batch ceiling), pairwise comparison is 78 pairs — cheap, no real performance concern. Don't optimize prematurely.
100
103
 
101
104
  ## Output rules
@@ -104,6 +107,6 @@ The detector returns `CollisionResult[]` from `detectFileCollisions`. The format
104
107
 
105
108
  - `Order: A → B (path)` per pair (or `Order: A → B → C (path)` for 3+ on the same file). `path` is the canonical bare form (e.g. `qa/SKILL.md`).
106
109
  - `⚠ #N Modifies <path> (overlaps #M); land sequentially` per affected issue.
107
- - `Chain: npx sequant run A B C --chain --qa-gate -Q # alternative — N issues modify <path> (chain length≥3 historically 1/6 = 17%; see docs/reference/chain-mode-analysis-2026-05.md)` only when ≥3 issues collide on the same file (suggest-only). The historical-rate annotation comes from the #604 forensic write-up; users see the suggestion alongside the parallel default and can weigh the trade-off.
110
+ - `Chain: npx sequant run A B C --chain -Q # alternative — N issues modify <path> (chain length≥3 historically 1/6 = 17%, predates the #748/#749 fixes; see docs/reference/chain-mode-analysis-2026-05.md)` only when ≥3 issues collide on the same file (suggest-only). The historical-rate annotation comes from the #604 forensic write-up; users see the suggestion alongside the parallel default and can weigh the trade-off.
108
111
 
109
112
  The bare-filename `Order:` exception (defined in the skill's "Annotation Rules") applies here — predicted collisions are file-collision reasons by definition, so the filename in parentheses is the reason verbatim.
@@ -855,7 +855,7 @@ export CLAUDE_HOOKS_SMART_TESTS=true
855
855
  When enabled, smart tests will:
856
856
  - Auto-run related tests after each file edit during Phase 2 (EXEC)
857
857
  - Catch regressions immediately instead of waiting for explicit `npm test`
858
- - Log results to `/tmp/claude-tests.log` for debugging
858
+ - Log results to `claude-tests.log` for debugging (`/logs/`, else `/.sequant/logs/`)
859
859
 
860
860
  **Benefits:**
861
861
  - Faster feedback loop during implementation
@@ -120,21 +120,35 @@ For each proposal, specify:
120
120
 
121
121
  ### **Documentation Health Check**
122
122
 
123
- Review CLAUDE.md size and relevance:
124
- - Current line count (target: 700-800)
125
- - Sections that feel bloated
126
- - Sections that are missing
127
- - Redundancy check
128
- - Extract candidates (sections >50 lines)
129
- - Recommendation: [Prune | Expand | Restructure | Extract | Good as-is]
123
+ **CLAUDE.md is an index, not a knowledge store.** Durable knowledge belongs in
124
+ auto-memory, `docs/`, or the relevant skill; CLAUDE.md holds only what must be
125
+ loaded into *every* session (commit rules, hook gotchas, skill-invocation
126
+ rules). A short CLAUDE.md is a sign the other tiers are doing their job — do
127
+ **not** recommend padding it toward some line count. There is no target length.
128
+
129
+ Review CLAUDE.md relevance:
130
+ - Does every line still apply, and is it still accurate?
131
+ - Anything that only matters in one workflow → move to that skill or `docs/`
132
+ - Anything that is durable session-to-session context → auto-memory
133
+ - Redundancy check (same rule stated here and in a skill)
134
+ - Extract candidates (sections >50 lines — CLAUDE.md should rarely have any)
135
+ - Recommendation: [Prune | Restructure | Extract | Good as-is]
136
+
137
+ Also check the **memory** tier, which carries most of this repo's knowledge:
138
+ - Entries citing script flags, CLI behavior, or `file:line` **rot silently** —
139
+ spot-check any entry you relied on this session against current code and fix
140
+ it. A wrong memory is worse than a missing one.
141
+ - Index (`MEMORY.md`) one-liners still accurate?
130
142
 
131
143
  ### **Action Items**
132
144
 
133
- Generate a checklist:
134
- - [ ] Add section to CLAUDE.md: [topic]
135
- - [ ] Update slash command: [command name]
136
- - [ ] Move to docs/archive/: [file name]
137
- - [ ] Create new command: [command name]
145
+ Generate a checklist. Prefer concrete targets — a file, a memory entry, a
146
+ command over intentions:
147
+ - [ ] Correct/remove a stale memory entry: [name] (verify against current code first)
148
+ - [ ] Add a memory entry for: [durable lesson]
149
+ - [ ] Update skill: [name] — remember all three skill dirs
150
+ - [ ] Update docs: [path] (check main README + marketplace README + docs/)
151
+ - [ ] Add a pointer to CLAUDE.md: [one line + link] — only if needed most sessions
138
152
  - [ ] Remove outdated content: [location]
139
153
 
140
154
  ## Workflow Analytics
@@ -172,7 +186,7 @@ At the end of reflection, ask:
172
186
  - [ ] **Session Summary** - What was accomplished, what went well, friction points
173
187
  - [ ] **Effectiveness Analysis** - Token efficiency, context gathering, pattern reuse
174
188
  - [ ] **Proposed Changes** - Specific changes with target files and rationale
175
- - [ ] **Documentation Health** - Line count, bloat assessment, recommendations
189
+ - [ ] **Documentation Health** - CLAUDE.md relevance/accuracy (not length) + memory-tier rot check
176
190
  - [ ] **Action Items** - Checklist of concrete next steps
177
191
 
178
192
  **DO NOT respond until all items are verified.**
@@ -1,70 +1,82 @@
1
1
  # Documentation Tiers
2
2
 
3
- Organize information by access frequency:
4
-
5
- ## Tier 1: Hot Path (CLAUDE.md)
6
-
7
- - Used in 50%+ of sessions
8
- - Core architecture decisions
9
- - Most common commands and patterns
10
- - **Target: 700-800 lines** (check with `wc -l CLAUDE.md`)
11
- - Quick summaries with links to detailed docs
12
- - Review monthly
13
-
14
- **Keep in CLAUDE.md:**
15
- - ✅ Core architecture patterns (database, routing, components)
16
- - ✅ Most common commands (development, discovery, enrichment)
17
- - ✅ Critical patterns (validation, audit logging, state management)
18
- - ✅ Quick reference information needed in 50%+ of sessions
19
-
20
- ## Tier 2: Reference (docs/ folder)
21
-
22
- - Used in 10-50% of sessions
23
- - Detailed specs, schemas, guides
24
- - Can be 1000+ lines per doc
25
- - Review quarterly
26
-
27
- **Current specialized docs:**
28
- - `ARCHITECTURE.md` - System architecture overview
29
- - `DATA_PIPELINE.md` - Data processing workflows
30
- - `TESTING.md` - Testing patterns and strategies
31
- - `ADMIN_CMS_ARCHITECTURE.md` - Full CMS architecture
32
-
33
- ## Tier 3: Archive (docs/archive/)
34
-
35
- - Used in <10% of sessions
36
- - Historical context, deprecated patterns
37
- - Move here after 6 months of non-use
38
- - Keep for searchability, not active use
39
-
40
- ## Tier 4: Code Comments
41
-
42
- - Implementation-specific details
43
- - Edge case handling
44
- - Why certain approaches were chosen
45
- - Lives with the code, not in docs
46
-
47
- ## When to Extract to Separate Docs
48
-
49
- Move from CLAUDE.md to docs/ when:
50
- - Section exceeds 50 lines
51
- - ✅ Contains detailed workflow steps (>3 steps)
52
- - Has extensive examples or command variations
53
- - Used occasionally but not in every session
54
- - Could evolve independently
55
-
56
- ## Documentation Health Metrics
57
-
58
- **CLAUDE.md Health Check:**
59
- - Current line count vs target (700-800)
60
- - Lines added in last month
61
- - Sections that feel bloated
62
- - Sections that are missing
63
- - Redundancy between CLAUDE.md and docs/
64
-
65
- **Recommendations:**
66
- - **Prune:** >900 lines, multiple bloated sections
67
- - **Expand:** <600 lines, missing critical patterns
68
- - **Restructure:** Hard to find information
69
- - **Extract:** Multiple sections >50 lines
70
- - **Good as-is:** 700-800 lines, balanced content
3
+ Where knowledge lives in this repo, by how often it's needed and how long it stays true.
4
+
5
+ **There are no line-count targets.** Judge a tier by whether the right reader
6
+ finds the right thing, not by size. A short CLAUDE.md means the other tiers are
7
+ working, not that it needs filling.
8
+
9
+ ## Tier 1: CLAUDE.md the always-loaded index
10
+
11
+ Loaded into **every** session, so everything here is a tax on every session.
12
+
13
+ **Keep only:**
14
+ - ✅ Rules with no natural home in a skill or doc (commit conventions, hook gotchas)
15
+ - ✅ Pointers a one-line "here's the trap, here's the link"
16
+ - ✅ Things that are wrong to learn late (e.g. skill-invocation namespacing)
17
+
18
+ **Move out:**
19
+ - ❌ Anything that matters in one workflow → that skill
20
+ - Anything explanatory or >~10 lines → `docs/` and link to it
21
+ - ❌ Session-to-session context about *this developer's* work → auto-memory
22
+
23
+ ## Tier 2: Auto-memory the main knowledge store
24
+
25
+ `~/.claude/projects/<project>/memory/`, indexed by `MEMORY.md`. This is where
26
+ most of this repo's hard-won knowledge actually lives (100+ entries): pitfalls,
27
+ feedback, architecture decisions, roadmap state.
28
+
29
+ - One fact per file; `MEMORY.md` carries a one-line pointer.
30
+ - Best tier for "I learned this the hard way and would re-learn it otherwise".
31
+
32
+ **Its failure mode is rot, not bloat.** Entries citing script flags, CLI
33
+ behavior, or `file:line` go stale silently, and a *wrong* memory is worse than a
34
+ missing one — it gets trusted. Verify before asserting; fix on sight.
35
+
36
+ ## Tier 3: docs/ — reference for humans
37
+
38
+ Real structure: `concepts/`, `features/`, `guides/`, `reference/`,
39
+ `getting-started/`, `examples/`, `internal/`, `incidents/`, `investigations/`.
40
+
41
+ - Detailed specs, architecture, runbooks. Length is fine here.
42
+ - User-facing behavior changes must land here, and often in **more than one
43
+ place** check the main README, the marketplace README, and `docs/`.
44
+ - Review when the behavior it describes changes, not on a calendar.
45
+
46
+ ## Tier 4: Skills — workflow instructions
47
+
48
+ `skills/`, `templates/skills/`, `.claude/skills/` — **three real copies**;
49
+ fix all three or `sequant init`/`update` regenerates the bug (CI enforces this
50
+ via `npm run lint:skill-sync`).
51
+
52
+ - Procedure a skill must follow belongs in its `SKILL.md`.
53
+ - Detail a skill needs only sometimes its `references/`, linked from `SKILL.md`.
54
+ - **When editing a SKILL.md, grep its `references/` for the same claim.** Prose
55
+ specs of a rule drift out of sync with the rule itself.
56
+
57
+ ## Tier 5: Code comments
58
+
59
+ Constraints the code can't show why this approach, what breaks otherwise.
60
+ Not what the next line does, and not where it came from.
61
+
62
+ ## When to extract from CLAUDE.md
63
+
64
+ - ✅ It's explanatory rather than a pointer
65
+ - ✅ It only applies to one workflow or one command
66
+ - It has examples, steps, or rationale
67
+ - It could evolve independently of the rest
68
+
69
+ ## Health check
70
+
71
+ **CLAUDE.md:** is every line still true, still needed in *most* sessions, and
72
+ not duplicated in a skill? Recommend `Prune | Restructure | Extract | Good as-is`
73
+ — never "Expand".
74
+
75
+ **Memory:** spot-check entries relied on this session against current code.
76
+ Are `MEMORY.md` one-liners still accurate? Any entry superseded by shipped work?
77
+
78
+ **docs/:** does anything contradict what shipped? Behavior changes are the usual
79
+ source of drift.
80
+
81
+ **Skills:** are the three copies in sync, and does each `SKILL.md` agree with its
82
+ own `references/`?
@@ -70,26 +70,42 @@ Focus on QA/review effectiveness after `/qa`:
70
70
 
71
71
  ## Good Reflection Examples
72
72
 
73
- ### Documentation Improvement
73
+ Note what these have in common: each names a **specific file and a specific
74
+ wrong line**, and each was *verified* before being proposed. A reflection that
75
+ proposes fixing something you have not opened is a guess.
74
76
 
75
- > **Friction Point:** Spent 10 minutes searching for how neighborhood extraction works across multiple files.
77
+ ### Correcting a stale memory
78
+
79
+ > **Friction Point:** Followed a memory that prescribed `echo y | cleanup-worktree.sh`; the script had since grown a real `--yes` flag and a merge gate (#750).
76
80
  >
77
- > **Root Cause:** Process is documented in docs/AUTO_NEIGHBORHOOD_ENRICHMENT.md (tier 2) but not referenced in CLAUDE.md's discovery pipeline section (tier 1).
81
+ > **Root Cause:** Memory entries citing script flags rot silently when the script ships a change. The entry read as authoritative and was 67 days old.
78
82
  >
79
83
  > **Proposal:**
80
- > - **Type:** Add
81
- > - **Target:** CLAUDE.md, line 230 (Discovery Methods section)
82
- > - **Content:** Add one-line reference: "Neighborhoods auto-extracted via ZIP mapping (see docs/AUTO_NEIGHBORHOOD_ENRICHMENT.md)"
83
- > - **Priority:** Medium
84
- > - **Risk:** Low (just adding a signpost)
84
+ > - **Type:** Update
85
+ > - **Target:** `feedback_cleanup_worktree_after_gh_merge`
86
+ > - **Content:** Replace the `echo y |` workaround with the shipped flags; add the `--delete-branch`-fails-when-a-worktree-holds-the-branch trap.
87
+ > - **Priority:** High (a wrong memory is worse than a missing one — it gets trusted)
88
+ > - **Risk:** Low (verified against the script's `--help` first)
89
+
90
+ ### Retiring guidance that a skill already implements
91
+
92
+ > **Friction Point:** Was about to propose adding a diff-size threshold to `/qa` so small diffs skip sub-agents.
93
+ >
94
+ > **Root Cause:** The proposal was based on the skill text actually executed, which came from a **stale plugin cache** (1.20.3) rather than the repo (2.8.0). The repo's `/qa` already has the size gate. Invoking `sequant:qa` resolves to the installed plugin; bare `qa` resolves to `.claude/skills/`.
95
+ >
96
+ > **Proposal:**
97
+ > - **Type:** Withdraw + document the routing trap
98
+ > - **Target:** the proposal itself; memory entry for the skew
99
+ > - **Priority:** High (the finding was an artifact, and acting on it would have duplicated shipped work)
100
+ > - **Risk:** None — verification *removed* work rather than adding it
85
101
 
86
- ### Documentation Pruning
102
+ ### Pruning content inherited from another project
87
103
 
88
- > **Bloat:** CLAUDE.md has 150 lines on Mapbox troubleshooting that solved a one-time issue 6 months ago.
104
+ > **Bloat:** `references/documentation-tiers.md` prescribed a 700–800 line CLAUDE.md target and named `ARCHITECTURE.md`, `DATA_PIPELINE.md`, `ADMIN_CMS_ARCHITECTURE.md` as "current docs". None exist here; CLAUDE.md is 13 lines by design. Its "**Expand:** <600 lines" rule would have demanded ~590 lines of invented content.
89
105
  >
90
106
  > **Proposal:**
91
- > - **Type:** Remove + Archive
92
- > - **Target:** CLAUDE.md lines 450-600
93
- > - **Action:** Move to docs/archive/mapbox-troubleshooting-2024.md with note "Archived: Issue resolved in react-map-gl v7.1.0"
94
- > - **Priority:** High (saves 150 lines in hot path)
95
- > - **Risk:** Low (still searchable if issue recurs)
107
+ > - **Type:** Restructure
108
+ > - **Target:** `references/documentation-tiers.md` (×3 skill dirs)
109
+ > - **Action:** Rewrite around this repo's real tiers (CLAUDE.md index auto-memory `docs/` skills → code comments); drop all line targets.
110
+ > - **Priority:** Medium
111
+ > - **Risk:** Low (verified every named doc was absent before rewriting)
@@ -512,8 +512,11 @@ Release v{version} Complete
512
512
  npx sequant@{new}
513
513
 
514
514
  Install (plugin):
515
- /plugin marketplace update sequant-io/sequant
516
- /plugin install sequant
515
+ /plugin marketplace update sequant-io/sequant # refreshes the marketplace LISTING only
516
+ /plugin install sequant # new installs
517
+
518
+ Update an existing plugin install:
519
+ claude plugin update sequant@sequant # then restart Claude Code
517
520
 
518
521
  Verification:
519
522
  [x] npm view shows correct version
@@ -527,6 +530,11 @@ Next steps:
527
530
  - Announce release (if major/minor)
528
531
  - Update dependent projects
529
532
  - Monitor for issues
533
+ - Installed plugins do NOT pick up this release automatically: Claude Code
534
+ pins each install at its installed version, and `/plugin marketplace
535
+ update` refreshes only the marketplace listing. Each existing install
536
+ updates only via `claude plugin update sequant@sequant` + restart
537
+ (the pre-tool hook nags stale installs once a day — #784)
530
538
  ```
531
539
 
532
540
  ## Dry Run Mode
@@ -43,7 +43,7 @@ AC-1: Timing logs capture start/end of each tool call
43
43
  **Test Scenario:**
44
44
  - Given: Claude Code session with hooks enabled
45
45
  - When: Any tool is invoked (e.g., Edit, Read)
46
- - Then: /tmp/claude-timing.log contains START and END with tool name and timestamp
46
+ - Then: claude-timing.log contains START (from pre-tool.sh) and END (from post-tool.sh) with tool name and timestamp, both in the SAME file — /logs/ for plugin users, else /.sequant/logs/
47
47
 
48
48
  **Integration Points:**
49
49
  - Claude Code hook system (stdin JSON input)
@@ -81,6 +81,9 @@ function formatTime(isoString) {
81
81
  function displayLogSummary(log, filename, options) {
82
82
  const passed = log.summary.passed;
83
83
  const failed = log.summary.failed;
84
+ // #766: `partial` gets its own bucket so an all-partial run isn't rendered as
85
+ // `0 passed, 0 failed` (older logs predate the field → default to 0).
86
+ const partial = log.summary.partial ?? 0;
84
87
  const total = log.summary.totalIssues;
85
88
  const status = failed > 0
86
89
  ? chalk.red("FAILED")
@@ -91,7 +94,9 @@ function displayLogSummary(log, filename, options) {
91
94
  console.log(chalk.gray(` File: ${filename}`));
92
95
  console.log(chalk.gray(` Time: ${formatTime(log.startTime)}`));
93
96
  console.log(chalk.gray(` Duration: ${formatDuration(log.summary.totalDurationSeconds)}`));
94
- console.log(chalk.gray(` Status: ${status} (${passed}/${total} passed, ${failed} failed)`));
97
+ console.log(chalk.gray(` Status: ${status} (${passed}/${total} passed, ${failed} failed` +
98
+ (partial > 0 ? `, ${partial} partial` : "") +
99
+ `)`));
95
100
  console.log(chalk.gray(` Phases: ${log.config.phases.join(" → ")}`));
96
101
  // Show issues
97
102
  for (const issue of log.issues) {
@@ -9,6 +9,7 @@
9
9
  */
10
10
  import type { RunRenderer } from "../lib/cli-ui/run-renderer-types.js";
11
11
  import type { ResolvedRun, RunResult } from "../lib/workflow/run-orchestrator.js";
12
+ import type { IssueResult } from "../lib/workflow/types.js";
12
13
  /**
13
14
  * Print pre-run config block.
14
15
  *
@@ -16,6 +17,25 @@ import type { ResolvedRun, RunResult } from "../lib/workflow/run-orchestrator.js
16
17
  * appear when non-default, matching the pre-#503 format.
17
18
  */
18
19
  export declare function displayConfig(r: ResolvedRun): void;
20
+ /**
21
+ * Detect a chain halted by a rate-limit/billing failure and build the summary
22
+ * notice for it (#761 AC-5). Returns null when the run wasn't a chain, no
23
+ * issue failed, or the halting failure wasn't rate-limit-classified.
24
+ *
25
+ * Extracted from `displaySummary` so the halt-and-print decision is testable
26
+ * standalone — the same treatment #760 gave `planChainResumeFromState` when it
27
+ * hit the executeSequential testability wall.
28
+ *
29
+ * The failing phase is found with the same reverse non-loop scan as
30
+ * `toIssueSummary` (#766): the classification must describe the LAST attempt,
31
+ * not a stale first-iteration failure.
32
+ *
33
+ * @internal Exported for testing
34
+ */
35
+ export declare function buildRateLimitHaltNotice(results: IssueResult[], chainEnabled: boolean): {
36
+ issueNumber: number;
37
+ label: string;
38
+ } | null;
19
39
  /**
20
40
  * Print post-run summary: per-issue grid, log path, reflection, tips.
21
41
  *