sequant 2.7.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 (106) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/README.md +18 -2
  4. package/dist/bin/cli.d.ts +1 -1
  5. package/dist/bin/cli.js +12 -2
  6. package/dist/bin/preflight.d.ts +21 -0
  7. package/dist/bin/preflight.js +45 -0
  8. package/dist/marketplace/external_plugins/sequant/.claude-plugin/plugin.json +1 -1
  9. package/dist/marketplace/external_plugins/sequant/README.md +2 -0
  10. package/dist/marketplace/external_plugins/sequant/hooks/post-tool.sh +18 -3
  11. package/dist/marketplace/external_plugins/sequant/hooks/pre-tool.sh +330 -57
  12. package/dist/marketplace/external_plugins/sequant/skills/_shared/references/force-push.md +34 -0
  13. package/dist/marketplace/external_plugins/sequant/skills/assess/SKILL.md +117 -19
  14. package/dist/marketplace/external_plugins/sequant/skills/assess/references/predicted-collision-detection.md +9 -6
  15. package/dist/marketplace/external_plugins/sequant/skills/exec/SKILL.md +29 -0
  16. package/dist/marketplace/external_plugins/sequant/skills/fullsolve/SKILL.md +1 -1
  17. package/dist/marketplace/external_plugins/sequant/skills/loop/SKILL.md +100 -2
  18. package/dist/marketplace/external_plugins/sequant/skills/qa/SKILL.md +24 -0
  19. package/dist/marketplace/external_plugins/sequant/skills/qa/references/anti-pattern-detection.md +285 -0
  20. package/dist/marketplace/external_plugins/sequant/skills/qa/references/call-site-review.md +202 -0
  21. package/dist/marketplace/external_plugins/sequant/skills/qa/references/quality-gates.md +287 -0
  22. package/dist/marketplace/external_plugins/sequant/skills/qa/references/test-quality-checklist.md +272 -0
  23. package/dist/marketplace/external_plugins/sequant/skills/qa/references/testing-requirements.md +40 -0
  24. package/dist/marketplace/external_plugins/sequant/skills/qa/scripts/quality-checks.sh +95 -11
  25. package/dist/marketplace/external_plugins/sequant/skills/references/shared/framework-gotchas.md +186 -0
  26. package/dist/marketplace/external_plugins/sequant/skills/reflect/SKILL.md +27 -13
  27. package/dist/marketplace/external_plugins/sequant/skills/reflect/references/documentation-tiers.md +80 -68
  28. package/dist/marketplace/external_plugins/sequant/skills/reflect/references/phase-reflection.md +31 -15
  29. package/dist/marketplace/external_plugins/sequant/skills/release/SKILL.md +669 -0
  30. package/dist/marketplace/external_plugins/sequant/skills/spec/references/verification-criteria.md +1 -1
  31. package/dist/marketplace/external_plugins/sequant/skills/test/references/browser-testing-patterns.md +423 -0
  32. package/dist/marketplace/external_plugins/sequant/skills/upstream/SKILL.md +419 -0
  33. package/dist/src/commands/logs.js +6 -1
  34. package/dist/src/commands/run-display.d.ts +20 -0
  35. package/dist/src/commands/run-display.js +80 -1
  36. package/dist/src/commands/stats.js +47 -0
  37. package/dist/src/lib/assess-collision-detect.d.ts +19 -2
  38. package/dist/src/lib/assess-collision-detect.js +68 -4
  39. package/dist/src/lib/cli-ui/run-renderer.js +17 -9
  40. package/dist/src/lib/errors.d.ts +91 -0
  41. package/dist/src/lib/errors.js +118 -0
  42. package/dist/src/lib/manifest.js +1 -17
  43. package/dist/src/lib/version-check.d.ts +19 -0
  44. package/dist/src/lib/version-check.js +45 -5
  45. package/dist/src/lib/workflow/batch-executor.d.ts +13 -0
  46. package/dist/src/lib/workflow/batch-executor.js +142 -24
  47. package/dist/src/lib/workflow/chain-preflight.d.ts +89 -0
  48. package/dist/src/lib/workflow/chain-preflight.js +199 -0
  49. package/dist/src/lib/workflow/chain-resume.d.ts +116 -0
  50. package/dist/src/lib/workflow/chain-resume.js +166 -0
  51. package/dist/src/lib/workflow/dependency-markers.d.ts +29 -0
  52. package/dist/src/lib/workflow/dependency-markers.js +79 -0
  53. package/dist/src/lib/workflow/drivers/agent-driver.d.ts +17 -0
  54. package/dist/src/lib/workflow/drivers/claude-code.d.ts +29 -0
  55. package/dist/src/lib/workflow/drivers/claude-code.js +136 -8
  56. package/dist/src/lib/workflow/error-classifier.d.ts +9 -2
  57. package/dist/src/lib/workflow/error-classifier.js +14 -1
  58. package/dist/src/lib/workflow/log-writer.d.ts +1 -1
  59. package/dist/src/lib/workflow/log-writer.js +6 -8
  60. package/dist/src/lib/workflow/metrics-schema.d.ts +39 -0
  61. package/dist/src/lib/workflow/metrics-schema.js +16 -0
  62. package/dist/src/lib/workflow/metrics-writer.d.ts +2 -1
  63. package/dist/src/lib/workflow/phase-executor.d.ts +50 -0
  64. package/dist/src/lib/workflow/phase-executor.js +151 -17
  65. package/dist/src/lib/workflow/run-log-schema.d.ts +26 -0
  66. package/dist/src/lib/workflow/run-log-schema.js +52 -1
  67. package/dist/src/lib/workflow/run-orchestrator.d.ts +14 -0
  68. package/dist/src/lib/workflow/run-orchestrator.js +291 -30
  69. package/dist/src/lib/workflow/state-manager.d.ts +1 -0
  70. package/dist/src/lib/workflow/state-manager.js +6 -0
  71. package/dist/src/lib/workflow/state-schema.d.ts +3 -0
  72. package/dist/src/lib/workflow/state-schema.js +7 -0
  73. package/dist/src/lib/workflow/status-derivation.d.ts +30 -0
  74. package/dist/src/lib/workflow/status-derivation.js +27 -0
  75. package/dist/src/lib/workflow/types.d.ts +40 -0
  76. package/dist/src/lib/workflow/worktree-manager.d.ts +43 -1
  77. package/dist/src/lib/workflow/worktree-manager.js +103 -33
  78. package/dist/src/mcp/tools/run.d.ts +2 -0
  79. package/dist/src/mcp/tools/run.js +2 -0
  80. package/dist/src/ui/tui/theme.d.ts +18 -4
  81. package/dist/src/ui/tui/theme.js +18 -4
  82. package/package.json +5 -6
  83. package/templates/hooks/post-tool.sh +18 -3
  84. package/templates/hooks/pre-tool.sh +330 -57
  85. package/templates/scripts/cleanup-worktree.sh +103 -14
  86. package/templates/skills/_shared/references/force-push.md +34 -0
  87. package/templates/skills/assess/SKILL.md +117 -19
  88. package/templates/skills/assess/references/predicted-collision-detection.md +9 -6
  89. package/templates/skills/exec/SKILL.md +29 -0
  90. package/templates/skills/fullsolve/SKILL.md +1 -1
  91. package/templates/skills/loop/SKILL.md +100 -2
  92. package/templates/skills/qa/SKILL.md +24 -0
  93. package/templates/skills/qa/references/anti-pattern-detection.md +285 -0
  94. package/templates/skills/qa/references/call-site-review.md +202 -0
  95. package/templates/skills/qa/references/quality-gates.md +287 -0
  96. package/templates/skills/qa/references/test-quality-checklist.md +272 -0
  97. package/templates/skills/qa/references/testing-requirements.md +40 -0
  98. package/templates/skills/qa/scripts/quality-checks.sh +95 -11
  99. package/templates/skills/references/shared/framework-gotchas.md +186 -0
  100. package/templates/skills/reflect/SKILL.md +27 -13
  101. package/templates/skills/reflect/references/documentation-tiers.md +80 -68
  102. package/templates/skills/reflect/references/phase-reflection.md +31 -15
  103. package/templates/skills/release/SKILL.md +669 -0
  104. package/templates/skills/spec/references/verification-criteria.md +1 -1
  105. package/templates/skills/test/references/browser-testing-patterns.md +423 -0
  106. package/templates/skills/upstream/SKILL.md +419 -0
@@ -127,6 +127,9 @@ echo ""
127
127
  # Track cache hits/misses for final report
128
128
  declare -A CACHE_STATUS
129
129
 
130
+ # Track blocking issues
131
+ TAUTOLOGY_BLOCKING=false
132
+
130
133
  # =============================================================================
131
134
  # 1. Type safety check - detect 'any' type usage
132
135
  # =============================================================================
@@ -355,7 +358,76 @@ else
355
358
  fi
356
359
 
357
360
  # =============================================================================
358
- # 10. Shell Script Semantic Checks (unused functions, integration)
361
+ # 10. Test Tautology Detection (AC-1 through AC-5)
362
+ # =============================================================================
363
+ echo ""
364
+ echo "🔬 Running test tautology detection..."
365
+
366
+ # Check for test files in the diff
367
+ test_files_in_diff=$(git diff main...HEAD --name-only | grep -E '\.(test|spec)\.[jt]sx?$' || true)
368
+
369
+ if [[ -z "$test_files_in_diff" ]]; then
370
+ CACHE_STATUS["test-quality"]="SKIP"
371
+ echo " ⏭️ No test files in diff, skipping tautology check"
372
+ else
373
+ if cache_check "test-quality"; then
374
+ CACHE_STATUS["test-quality"]="HIT"
375
+ cached_result=$(cache_get "test-quality")
376
+ tautology_passed=$(echo "$cached_result" | grep -o '"passed":\s*[^,}]*' | cut -d: -f2 | tr -d ' ')
377
+ tautology_message=$(echo "$cached_result" | grep -o '"message":\s*"[^"]*"' | cut -d'"' -f4)
378
+
379
+ if [[ "$tautology_passed" == "true" ]]; then
380
+ echo " ✅ Test tautology: $tautology_message (cached)"
381
+ else
382
+ echo " ⚠️ Test tautology: $tautology_message (cached)"
383
+ fi
384
+ else
385
+ CACHE_STATUS["test-quality"]="MISS"
386
+
387
+ # Check if tautology detector script exists
388
+ TAUTOLOGY_CLI=""
389
+ if [[ -f "$SCRIPT_DIR/../../../scripts/qa/tautology-detector-cli.ts" ]]; then
390
+ TAUTOLOGY_CLI="$SCRIPT_DIR/../../../scripts/qa/tautology-detector-cli.ts"
391
+ elif [[ -f "scripts/qa/tautology-detector-cli.ts" ]]; then
392
+ TAUTOLOGY_CLI="scripts/qa/tautology-detector-cli.ts"
393
+ fi
394
+
395
+ if [[ -n "$TAUTOLOGY_CLI" ]] && command -v npx &> /dev/null; then
396
+ tautology_output=$(npx tsx "$TAUTOLOGY_CLI" --json 2>&1) || tautology_exit=$?
397
+
398
+ if [[ -z "$tautology_exit" ]]; then
399
+ tautology_exit=0
400
+ fi
401
+
402
+ # Parse JSON output
403
+ tautology_status=$(echo "$tautology_output" | grep -o '"status":"[^"]*"' | cut -d'"' -f4 || echo "none")
404
+ total_tests=$(echo "$tautology_output" | grep -o '"totalTests":[0-9]*' | cut -d: -f2 || echo "0")
405
+ total_tautological=$(echo "$tautology_output" | grep -o '"totalTautological":[0-9]*' | cut -d: -f2 || echo "0")
406
+
407
+ if [[ "$tautology_status" == "skip" ]]; then
408
+ echo " ⏭️ No test blocks found in changed files"
409
+ cache_set "test-quality" true "No test blocks found" "{\"totalTests\":0,\"tautological\":0}"
410
+ elif [[ "$tautology_status" == "blocking" ]]; then
411
+ echo " ❌ BLOCKER: $total_tautological/$total_tests test blocks are tautological (>50%)"
412
+ echo " Tautological tests don't call production code and provide zero regression protection."
413
+ cache_set "test-quality" false "$total_tautological/$total_tests tests tautological (>50%)" "{\"totalTests\":$total_tests,\"tautological\":$total_tautological}"
414
+ TAUTOLOGY_BLOCKING=true
415
+ elif [[ "$tautology_status" == "warning" ]]; then
416
+ echo " ⚠️ WARNING: $total_tautological/$total_tests test blocks are tautological"
417
+ cache_set "test-quality" true "$total_tautological/$total_tests tests tautological" "{\"totalTests\":$total_tests,\"tautological\":$total_tautological}"
418
+ else
419
+ echo " ✅ Test tautology: All tests call production code"
420
+ cache_set "test-quality" true "All tests call production code" "{\"totalTests\":$total_tests,\"tautological\":0}"
421
+ fi
422
+ else
423
+ echo " ⚠️ Test tautology detector not available, skipping..."
424
+ CACHE_STATUS["test-quality"]="SKIP"
425
+ fi
426
+ fi
427
+ fi
428
+
429
+ # =============================================================================
430
+ # 11. Shell Script Semantic Checks (unused functions, integration)
359
431
  # =============================================================================
360
432
  echo ""
361
433
  echo "🔍 Checking shell script semantics..."
@@ -385,8 +457,7 @@ else
385
457
  fi
386
458
 
387
459
  # =============================================================================
388
- # =============================================================================
389
- # 11.5. Skill Sync Check (when skill files modified)
460
+ # 12. Skill Sync Check (when skill files modified)
390
461
  # =============================================================================
391
462
  echo ""
392
463
  skill_files_changed=$(git diff main...HEAD --name-only | grep -E '^\.(claude/skills|skills|templates/skills)/' || true)
@@ -431,7 +502,7 @@ else
431
502
  fi
432
503
 
433
504
  # =============================================================================
434
- # 12. Build Verification (cacheable - expensive operation)
505
+ # 13. Build Verification (cacheable - expensive operation)
435
506
  # =============================================================================
436
507
 
437
508
  verify_build_against_main() {
@@ -613,7 +684,7 @@ echo "=========================================="
613
684
  echo ""
614
685
  echo "| Check | Cache Status |"
615
686
  echo "|-------|--------------|"
616
- for check in "type-safety" "deleted-tests" "scope" "size" "security" "semgrep" "build"; do
687
+ for check in "type-safety" "deleted-tests" "scope" "size" "security" "semgrep" "test-quality" "build"; do
617
688
  status="${CACHE_STATUS[$check]:-MISS}"
618
689
  if [[ "$status" == "HIT" ]]; then
619
690
  echo "| $check | ✅ HIT |"
@@ -629,7 +700,7 @@ echo ""
629
700
  hit_count=0
630
701
  miss_count=0
631
702
  skip_count=0
632
- for check in "type-safety" "deleted-tests" "scope" "size" "security" "semgrep" "build"; do
703
+ for check in "type-safety" "deleted-tests" "scope" "size" "security" "semgrep" "test-quality" "build"; do
633
704
  status="${CACHE_STATUS[$check]:-MISS}"
634
705
  if [[ "$status" == "HIT" ]]; then
635
706
  ((hit_count++))
@@ -646,15 +717,17 @@ if [[ $hit_count -gt 0 ]]; then
646
717
  fi
647
718
  echo ""
648
719
 
649
- # Write structured cache metrics JSON for sequant observability (AC-7)
650
- # This file is read by run.ts to populate PhaseLog.cacheMetrics
720
+ # Write structured cache metrics JSON for sequant observability (#278/AC-7)
721
+ # This file is read by worktree-manager.ts to populate PhaseLog.cacheMetrics
722
+ # (surfaced via `sequant logs`). Written before the blocking exit logic below so
723
+ # metrics are always emitted, even when a check blocks.
651
724
  CACHE_METRICS_DIR=".sequant/.cache/qa"
652
725
  mkdir -p "$CACHE_METRICS_DIR"
653
726
 
654
727
  # Build JSON with per-check status
655
728
  CACHE_JSON="{\"hits\":$hit_count,\"misses\":$miss_count,\"skipped\":$skip_count,\"checks\":{"
656
729
  first=true
657
- for check in "type-safety" "deleted-tests" "scope" "size" "security" "semgrep" "build"; do
730
+ for check in "type-safety" "deleted-tests" "scope" "size" "security" "semgrep" "test-quality" "build"; do
658
731
  $first || CACHE_JSON+=","
659
732
  CACHE_JSON+="\"$check\":\"${CACHE_STATUS[$check]:-MISS}\""
660
733
  first=false
@@ -664,5 +737,16 @@ echo "$CACHE_JSON" > "$CACHE_METRICS_DIR/cache-metrics.json"
664
737
 
665
738
  echo "✅ Quality checks complete"
666
739
 
667
- # Exit with build verification result if it indicates a problem
668
- exit $build_verification_result
740
+ # Exit with appropriate code based on blocking issues
741
+ # Priority: build verification > tautology blocking
742
+ if [[ $build_verification_result -ne 0 ]]; then
743
+ exit $build_verification_result
744
+ fi
745
+
746
+ if [[ "$TAUTOLOGY_BLOCKING" == "true" ]]; then
747
+ echo ""
748
+ echo "❌ BLOCKED: >50% of test blocks are tautological (AC-4 violation)"
749
+ exit 1
750
+ fi
751
+
752
+ exit 0
@@ -0,0 +1,186 @@
1
+ # Framework Gotchas
2
+
3
+ Common framework-specific issues encountered in this project. Check this reference when encountering unexpected runtime errors or build failures.
4
+
5
+ ## AG Grid (v35+)
6
+
7
+ ### Module Registration Required
8
+
9
+ AG Grid v35 changed to explicit module registration. If you see errors like "Module not registered" or grid features not working:
10
+
11
+ ```typescript
12
+ import { ModuleRegistry } from 'ag-grid-community';
13
+ import { ClientSideRowModelModule } from 'ag-grid-community';
14
+
15
+ // Register before using AG Grid components
16
+ ModuleRegistry.registerModules([ClientSideRowModelModule]);
17
+ ```
18
+
19
+ **Common modules to register:**
20
+ - `ClientSideRowModelModule` - Basic row model
21
+ - `CsvExportModule` - CSV export functionality
22
+ - `InfiniteRowModelModule` - Infinite scrolling
23
+
24
+ **Docs:** [AG Grid v35 Migration Guide](https://www.ag-grid.com/javascript-data-grid/modules/)
25
+
26
+ ### CSS Import Changes
27
+
28
+ Styles are now in a separate package. Update imports:
29
+
30
+ ```typescript
31
+ // Before v35
32
+ import 'ag-grid-community/styles/ag-grid.css';
33
+ import 'ag-grid-community/styles/ag-theme-alpine.css';
34
+
35
+ // v35+
36
+ import 'ag-grid-community/styles/ag-grid.css';
37
+ import 'ag-grid-community/styles/ag-theme-quartz.css'; // New default theme
38
+ ```
39
+
40
+ ---
41
+
42
+ ## React 19
43
+
44
+ ### use() Hook
45
+
46
+ React 19 introduces the `use()` hook for reading resources (Promises, Context) during render:
47
+
48
+ ```typescript
49
+ // Reading context with use()
50
+ function Component() {
51
+ const theme = use(ThemeContext); // Can be called conditionally
52
+ return <div className={theme} />;
53
+ }
54
+
55
+ // Reading promises with use()
56
+ function UserProfile({ userPromise }) {
57
+ const user = use(userPromise); // Suspends until resolved
58
+ return <div>{user.name}</div>;
59
+ }
60
+ ```
61
+
62
+ **Gotcha:** `use()` can be called inside loops and conditionals (unlike other hooks).
63
+
64
+ **Docs:** [React 19 Release Notes](https://react.dev/blog/2024/12/05/react-19)
65
+
66
+ ### Concurrent Features On by Default
67
+
68
+ Concurrent rendering is now the default. Watch for:
69
+ - State updates during render (can cause infinite loops)
70
+ - External store subscriptions (use `useSyncExternalStore`)
71
+ - Mutable refs during render
72
+
73
+ ---
74
+
75
+ ## Next.js 15
76
+
77
+ ### Changed Caching Defaults
78
+
79
+ Next.js 15 no longer caches `fetch()` requests by default:
80
+
81
+ ```typescript
82
+ // Before Next.js 15 - cached by default
83
+ const data = await fetch('/api/data');
84
+
85
+ // Next.js 15 - NOT cached by default
86
+ const data = await fetch('/api/data'); // Always fresh
87
+
88
+ // To cache, explicitly opt-in:
89
+ const data = await fetch('/api/data', { cache: 'force-cache' });
90
+
91
+ // Or use next.revalidate:
92
+ const data = await fetch('/api/data', { next: { revalidate: 3600 } });
93
+ ```
94
+
95
+ **Docs:** [Next.js 15 Caching](https://nextjs.org/docs/app/building-your-application/caching)
96
+
97
+ ### Async Request APIs
98
+
99
+ Dynamic APIs are now async. Update your code:
100
+
101
+ ```typescript
102
+ // Before Next.js 15
103
+ export default function Page({ params }) {
104
+ const { id } = params;
105
+ // ...
106
+ }
107
+
108
+ // Next.js 15+
109
+ export default async function Page({ params }) {
110
+ const { id } = await params;
111
+ // ...
112
+ }
113
+
114
+ // Same for cookies, headers, searchParams
115
+ import { cookies, headers } from 'next/headers';
116
+
117
+ // Before
118
+ const cookieStore = cookies();
119
+
120
+ // After
121
+ const cookieStore = await cookies();
122
+ ```
123
+
124
+ ---
125
+
126
+ ## Tailwind v4
127
+
128
+ ### CSS-First Configuration
129
+
130
+ Tailwind v4 uses CSS for configuration instead of `tailwind.config.js`:
131
+
132
+ ```css
133
+ /* tailwind.css */
134
+ @import "tailwindcss";
135
+
136
+ @theme {
137
+ --color-primary: #3b82f6;
138
+ --font-sans: "Inter", sans-serif;
139
+ }
140
+ ```
141
+
142
+ **Gotcha:** The `@config` directive is removed. Use `@theme` in CSS.
143
+
144
+ **Docs:** [Tailwind v4 Migration](https://tailwindcss.com/docs/v4-beta)
145
+
146
+ ### Class Syntax Changes
147
+
148
+ Some utility classes have been renamed or changed:
149
+
150
+ ```html
151
+ <!-- v3 -->
152
+ <div class="bg-opacity-50">
153
+
154
+ <!-- v4 - use color modifiers -->
155
+ <div class="bg-blue-500/50">
156
+ ```
157
+
158
+ ---
159
+
160
+ ## Adding New Gotchas
161
+
162
+ When you encounter a framework-specific issue that cost debugging time, add it here following this template:
163
+
164
+ ```markdown
165
+ ## [Framework Name] (v[X]+)
166
+
167
+ ### [Issue Title]
168
+
169
+ [Brief description of the problem and when it occurs]
170
+
171
+ \`\`\`typescript
172
+ // Code example showing the fix or correct approach
173
+ \`\`\`
174
+
175
+ **Gotcha:** [Key insight or common mistake]
176
+
177
+ **Docs:** [Link to official documentation or changelog]
178
+ ```
179
+
180
+ ### Guidelines for Adding Entries
181
+
182
+ 1. **Version-specific:** Always include the version where the behavior changed
183
+ 2. **Code examples:** Show both "before" and "after" when applicable
184
+ 3. **Link to docs:** Include official documentation or migration guide links
185
+ 4. **Keep it brief:** Focus on the fix, not the full explanation
186
+ 5. **Update existing entries:** Prefer updating existing sections over creating duplicates
@@ -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)