claude-code-pilot 2.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 (257) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +151 -0
  3. package/bin/install.js +431 -0
  4. package/docs/agent-guides/architecture.md +107 -0
  5. package/ecc/agents/architect.md +211 -0
  6. package/ecc/agents/code-reviewer.md +237 -0
  7. package/ecc/agents/doc-updater.md +107 -0
  8. package/ecc/agents/e2e-runner.md +107 -0
  9. package/ecc/agents/security-reviewer.md +108 -0
  10. package/ecc/agents/tdd-guide.md +91 -0
  11. package/ecc/commands/checkpoint.md +74 -0
  12. package/ecc/commands/evolve.md +178 -0
  13. package/ecc/commands/learn.md +70 -0
  14. package/ecc/commands/model-route.md +26 -0
  15. package/ecc/commands/quality-gate.md +29 -0
  16. package/ecc/commands/resume-session.md +155 -0
  17. package/ecc/commands/save-session.md +275 -0
  18. package/ecc/commands/sessions.md +305 -0
  19. package/ecc/commands/verify.md +59 -0
  20. package/ecc/contexts/dev.md +20 -0
  21. package/ecc/contexts/research.md +26 -0
  22. package/ecc/contexts/review.md +22 -0
  23. package/ecc/examples/CLAUDE.md +100 -0
  24. package/ecc/examples/django-api-CLAUDE.md +308 -0
  25. package/ecc/examples/go-microservice-CLAUDE.md +267 -0
  26. package/ecc/examples/rust-api-CLAUDE.md +285 -0
  27. package/ecc/examples/saas-nextjs-CLAUDE.md +166 -0
  28. package/ecc/examples/user-CLAUDE.md +109 -0
  29. package/ecc/rules/common/agents.md +49 -0
  30. package/ecc/rules/common/coding-style.md +48 -0
  31. package/ecc/rules/common/development-workflow.md +37 -0
  32. package/ecc/rules/common/git-workflow.md +24 -0
  33. package/ecc/rules/common/hooks.md +30 -0
  34. package/ecc/rules/common/patterns.md +31 -0
  35. package/ecc/rules/common/performance.md +55 -0
  36. package/ecc/rules/common/security.md +29 -0
  37. package/ecc/rules/common/testing.md +29 -0
  38. package/ecc/rules/golang/coding-style.md +32 -0
  39. package/ecc/rules/golang/hooks.md +17 -0
  40. package/ecc/rules/golang/patterns.md +45 -0
  41. package/ecc/rules/golang/security.md +34 -0
  42. package/ecc/rules/golang/testing.md +31 -0
  43. package/ecc/rules/kotlin/coding-style.md +86 -0
  44. package/ecc/rules/kotlin/patterns.md +146 -0
  45. package/ecc/rules/kotlin/security.md +82 -0
  46. package/ecc/rules/kotlin/testing.md +128 -0
  47. package/ecc/rules/perl/coding-style.md +46 -0
  48. package/ecc/rules/perl/hooks.md +22 -0
  49. package/ecc/rules/perl/patterns.md +76 -0
  50. package/ecc/rules/perl/security.md +69 -0
  51. package/ecc/rules/perl/testing.md +54 -0
  52. package/ecc/rules/php/coding-style.md +35 -0
  53. package/ecc/rules/php/hooks.md +24 -0
  54. package/ecc/rules/php/patterns.md +32 -0
  55. package/ecc/rules/php/security.md +33 -0
  56. package/ecc/rules/php/testing.md +34 -0
  57. package/ecc/rules/python/coding-style.md +42 -0
  58. package/ecc/rules/python/hooks.md +19 -0
  59. package/ecc/rules/python/patterns.md +39 -0
  60. package/ecc/rules/python/security.md +30 -0
  61. package/ecc/rules/python/testing.md +38 -0
  62. package/ecc/rules/swift/coding-style.md +47 -0
  63. package/ecc/rules/swift/hooks.md +20 -0
  64. package/ecc/rules/swift/patterns.md +66 -0
  65. package/ecc/rules/swift/security.md +33 -0
  66. package/ecc/rules/swift/testing.md +45 -0
  67. package/ecc/rules/typescript/coding-style.md +199 -0
  68. package/ecc/rules/typescript/hooks.md +22 -0
  69. package/ecc/rules/typescript/patterns.md +52 -0
  70. package/ecc/rules/typescript/security.md +28 -0
  71. package/ecc/rules/typescript/testing.md +18 -0
  72. package/ecc/scripts/hooks/check-hook-enabled.js +12 -0
  73. package/ecc/scripts/hooks/evaluate-session.js +100 -0
  74. package/ecc/scripts/hooks/pre-compact.js +48 -0
  75. package/ecc/scripts/hooks/run-with-flags-shell.sh +32 -0
  76. package/ecc/scripts/hooks/run-with-flags.js +120 -0
  77. package/ecc/scripts/hooks/session-end-marker.js +15 -0
  78. package/ecc/scripts/hooks/session-end.js +258 -0
  79. package/ecc/scripts/hooks/session-start.js +97 -0
  80. package/ecc/scripts/hooks/suggest-compact.js +80 -0
  81. package/ecc/scripts/lib/hook-flags.js +74 -0
  82. package/ecc/scripts/lib/package-manager.d.ts +119 -0
  83. package/ecc/scripts/lib/package-manager.js +431 -0
  84. package/ecc/scripts/lib/project-detect.js +428 -0
  85. package/ecc/scripts/lib/resolve-formatter.js +185 -0
  86. package/ecc/scripts/lib/session-aliases.d.ts +136 -0
  87. package/ecc/scripts/lib/session-aliases.js +481 -0
  88. package/ecc/scripts/lib/session-manager.d.ts +131 -0
  89. package/ecc/scripts/lib/session-manager.js +444 -0
  90. package/ecc/scripts/lib/shell-split.js +86 -0
  91. package/ecc/scripts/lib/utils.d.ts +183 -0
  92. package/ecc/scripts/lib/utils.js +543 -0
  93. package/ecc/skills/continuous-learning-v2/SKILL.md +365 -0
  94. package/ecc/skills/continuous-learning-v2/agents/observer-loop.sh +144 -0
  95. package/ecc/skills/continuous-learning-v2/agents/observer.md +198 -0
  96. package/ecc/skills/continuous-learning-v2/agents/start-observer.sh +194 -0
  97. package/ecc/skills/continuous-learning-v2/config.json +8 -0
  98. package/ecc/skills/continuous-learning-v2/hooks/observe.sh +246 -0
  99. package/ecc/skills/continuous-learning-v2/scripts/detect-project.sh +218 -0
  100. package/ecc/skills/continuous-learning-v2/scripts/instinct-cli.py +1148 -0
  101. package/ecc/skills/continuous-learning-v2/scripts/test_parse_instinct.py +984 -0
  102. package/ecc/skills/strategic-compact/SKILL.md +103 -0
  103. package/ecc/skills/strategic-compact/suggest-compact.sh +54 -0
  104. package/ecc/skills/verification-loop-SKILL.md +126 -0
  105. package/gsd/LICENSE +21 -0
  106. package/gsd/agents/gsd-codebase-mapper.md +772 -0
  107. package/gsd/agents/gsd-debugger.md +1257 -0
  108. package/gsd/agents/gsd-executor.md +489 -0
  109. package/gsd/agents/gsd-integration-checker.md +445 -0
  110. package/gsd/agents/gsd-nyquist-auditor.md +178 -0
  111. package/gsd/agents/gsd-phase-researcher.md +555 -0
  112. package/gsd/agents/gsd-plan-checker.md +708 -0
  113. package/gsd/agents/gsd-planner.md +1309 -0
  114. package/gsd/agents/gsd-project-researcher.md +631 -0
  115. package/gsd/agents/gsd-research-synthesizer.md +249 -0
  116. package/gsd/agents/gsd-roadmapper.md +652 -0
  117. package/gsd/agents/gsd-verifier.md +581 -0
  118. package/gsd/commands-gsd/add-phase.md +43 -0
  119. package/gsd/commands-gsd/add-tests.md +41 -0
  120. package/gsd/commands-gsd/add-todo.md +47 -0
  121. package/gsd/commands-gsd/audit-milestone.md +36 -0
  122. package/gsd/commands-gsd/check-todos.md +45 -0
  123. package/gsd/commands-gsd/cleanup.md +18 -0
  124. package/gsd/commands-gsd/complete-milestone.md +136 -0
  125. package/gsd/commands-gsd/debug.md +168 -0
  126. package/gsd/commands-gsd/discuss-phase.md +90 -0
  127. package/gsd/commands-gsd/execute-phase.md +41 -0
  128. package/gsd/commands-gsd/health.md +22 -0
  129. package/gsd/commands-gsd/help.md +22 -0
  130. package/gsd/commands-gsd/insert-phase.md +32 -0
  131. package/gsd/commands-gsd/join-discord.md +18 -0
  132. package/gsd/commands-gsd/list-phase-assumptions.md +46 -0
  133. package/gsd/commands-gsd/map-codebase.md +71 -0
  134. package/gsd/commands-gsd/new-milestone.md +44 -0
  135. package/gsd/commands-gsd/new-project.md +42 -0
  136. package/gsd/commands-gsd/pause-work.md +38 -0
  137. package/gsd/commands-gsd/plan-milestone-gaps.md +34 -0
  138. package/gsd/commands-gsd/plan-phase.md +45 -0
  139. package/gsd/commands-gsd/progress.md +24 -0
  140. package/gsd/commands-gsd/quick.md +45 -0
  141. package/gsd/commands-gsd/reapply-patches.md +123 -0
  142. package/gsd/commands-gsd/remove-phase.md +31 -0
  143. package/gsd/commands-gsd/research-phase.md +190 -0
  144. package/gsd/commands-gsd/resume-work.md +40 -0
  145. package/gsd/commands-gsd/set-profile.md +34 -0
  146. package/gsd/commands-gsd/settings.md +36 -0
  147. package/gsd/commands-gsd/update.md +37 -0
  148. package/gsd/commands-gsd/validate-phase.md +35 -0
  149. package/gsd/commands-gsd/verify-work.md +38 -0
  150. package/gsd/get-shit-done/bin/gsd-tools.cjs +592 -0
  151. package/gsd/get-shit-done/bin/lib/commands.cjs +548 -0
  152. package/gsd/get-shit-done/bin/lib/config.cjs +169 -0
  153. package/gsd/get-shit-done/bin/lib/core.cjs +492 -0
  154. package/gsd/get-shit-done/bin/lib/frontmatter.cjs +299 -0
  155. package/gsd/get-shit-done/bin/lib/init.cjs +710 -0
  156. package/gsd/get-shit-done/bin/lib/milestone.cjs +241 -0
  157. package/gsd/get-shit-done/bin/lib/phase.cjs +901 -0
  158. package/gsd/get-shit-done/bin/lib/roadmap.cjs +298 -0
  159. package/gsd/get-shit-done/bin/lib/state.cjs +721 -0
  160. package/gsd/get-shit-done/bin/lib/template.cjs +222 -0
  161. package/gsd/get-shit-done/bin/lib/verify.cjs +820 -0
  162. package/gsd/get-shit-done/references/checkpoints.md +776 -0
  163. package/gsd/get-shit-done/references/continuation-format.md +249 -0
  164. package/gsd/get-shit-done/references/decimal-phase-calculation.md +65 -0
  165. package/gsd/get-shit-done/references/git-integration.md +248 -0
  166. package/gsd/get-shit-done/references/git-planning-commit.md +38 -0
  167. package/gsd/get-shit-done/references/model-profile-resolution.md +34 -0
  168. package/gsd/get-shit-done/references/model-profiles.md +93 -0
  169. package/gsd/get-shit-done/references/phase-argument-parsing.md +61 -0
  170. package/gsd/get-shit-done/references/planning-config.md +200 -0
  171. package/gsd/get-shit-done/references/questioning.md +162 -0
  172. package/gsd/get-shit-done/references/tdd.md +263 -0
  173. package/gsd/get-shit-done/references/ui-brand.md +160 -0
  174. package/gsd/get-shit-done/references/verification-patterns.md +612 -0
  175. package/gsd/get-shit-done/templates/DEBUG.md +164 -0
  176. package/gsd/get-shit-done/templates/UAT.md +247 -0
  177. package/gsd/get-shit-done/templates/VALIDATION.md +76 -0
  178. package/gsd/get-shit-done/templates/codebase/architecture.md +255 -0
  179. package/gsd/get-shit-done/templates/codebase/concerns.md +310 -0
  180. package/gsd/get-shit-done/templates/codebase/conventions.md +307 -0
  181. package/gsd/get-shit-done/templates/codebase/integrations.md +280 -0
  182. package/gsd/get-shit-done/templates/codebase/stack.md +186 -0
  183. package/gsd/get-shit-done/templates/codebase/structure.md +285 -0
  184. package/gsd/get-shit-done/templates/codebase/testing.md +480 -0
  185. package/gsd/get-shit-done/templates/config.json +37 -0
  186. package/gsd/get-shit-done/templates/context.md +297 -0
  187. package/gsd/get-shit-done/templates/continue-here.md +78 -0
  188. package/gsd/get-shit-done/templates/debug-subagent-prompt.md +91 -0
  189. package/gsd/get-shit-done/templates/discovery.md +146 -0
  190. package/gsd/get-shit-done/templates/milestone-archive.md +123 -0
  191. package/gsd/get-shit-done/templates/milestone.md +115 -0
  192. package/gsd/get-shit-done/templates/phase-prompt.md +569 -0
  193. package/gsd/get-shit-done/templates/planner-subagent-prompt.md +117 -0
  194. package/gsd/get-shit-done/templates/project.md +184 -0
  195. package/gsd/get-shit-done/templates/requirements.md +231 -0
  196. package/gsd/get-shit-done/templates/research-project/ARCHITECTURE.md +204 -0
  197. package/gsd/get-shit-done/templates/research-project/FEATURES.md +147 -0
  198. package/gsd/get-shit-done/templates/research-project/PITFALLS.md +200 -0
  199. package/gsd/get-shit-done/templates/research-project/STACK.md +120 -0
  200. package/gsd/get-shit-done/templates/research-project/SUMMARY.md +170 -0
  201. package/gsd/get-shit-done/templates/research.md +552 -0
  202. package/gsd/get-shit-done/templates/retrospective.md +54 -0
  203. package/gsd/get-shit-done/templates/roadmap.md +202 -0
  204. package/gsd/get-shit-done/templates/state.md +176 -0
  205. package/gsd/get-shit-done/templates/summary-complex.md +59 -0
  206. package/gsd/get-shit-done/templates/summary-minimal.md +41 -0
  207. package/gsd/get-shit-done/templates/summary-standard.md +48 -0
  208. package/gsd/get-shit-done/templates/summary.md +248 -0
  209. package/gsd/get-shit-done/templates/user-setup.md +311 -0
  210. package/gsd/get-shit-done/templates/verification-report.md +322 -0
  211. package/gsd/get-shit-done/workflows/add-phase.md +112 -0
  212. package/gsd/get-shit-done/workflows/add-tests.md +351 -0
  213. package/gsd/get-shit-done/workflows/add-todo.md +158 -0
  214. package/gsd/get-shit-done/workflows/audit-milestone.md +332 -0
  215. package/gsd/get-shit-done/workflows/check-todos.md +177 -0
  216. package/gsd/get-shit-done/workflows/cleanup.md +152 -0
  217. package/gsd/get-shit-done/workflows/complete-milestone.md +764 -0
  218. package/gsd/get-shit-done/workflows/diagnose-issues.md +219 -0
  219. package/gsd/get-shit-done/workflows/discovery-phase.md +289 -0
  220. package/gsd/get-shit-done/workflows/discuss-phase.md +676 -0
  221. package/gsd/get-shit-done/workflows/execute-phase.md +459 -0
  222. package/gsd/get-shit-done/workflows/execute-plan.md +449 -0
  223. package/gsd/get-shit-done/workflows/health.md +159 -0
  224. package/gsd/get-shit-done/workflows/help.md +489 -0
  225. package/gsd/get-shit-done/workflows/insert-phase.md +130 -0
  226. package/gsd/get-shit-done/workflows/list-phase-assumptions.md +178 -0
  227. package/gsd/get-shit-done/workflows/map-codebase.md +316 -0
  228. package/gsd/get-shit-done/workflows/new-milestone.md +384 -0
  229. package/gsd/get-shit-done/workflows/new-project.md +1111 -0
  230. package/gsd/get-shit-done/workflows/pause-work.md +122 -0
  231. package/gsd/get-shit-done/workflows/plan-milestone-gaps.md +274 -0
  232. package/gsd/get-shit-done/workflows/plan-phase.md +560 -0
  233. package/gsd/get-shit-done/workflows/progress.md +382 -0
  234. package/gsd/get-shit-done/workflows/quick.md +601 -0
  235. package/gsd/get-shit-done/workflows/remove-phase.md +155 -0
  236. package/gsd/get-shit-done/workflows/research-phase.md +74 -0
  237. package/gsd/get-shit-done/workflows/resume-project.md +307 -0
  238. package/gsd/get-shit-done/workflows/set-profile.md +81 -0
  239. package/gsd/get-shit-done/workflows/settings.md +214 -0
  240. package/gsd/get-shit-done/workflows/transition.md +544 -0
  241. package/gsd/get-shit-done/workflows/update.md +240 -0
  242. package/gsd/get-shit-done/workflows/validate-phase.md +167 -0
  243. package/gsd/get-shit-done/workflows/verify-phase.md +243 -0
  244. package/gsd/get-shit-done/workflows/verify-work.md +583 -0
  245. package/gsd/hooks/gsd-check-update.js +81 -0
  246. package/gsd/hooks/gsd-context-monitor.js +141 -0
  247. package/gsd/hooks/gsd-statusline.js +115 -0
  248. package/kit/CLAUDE.md +43 -0
  249. package/kit/commands/kit/update.md +46 -0
  250. package/kit/commands/setup-refresh.md +50 -0
  251. package/kit/commands/setup.md +579 -0
  252. package/kit/commands/tool-guide.md +44 -0
  253. package/kit/hooks/kit-check-update.js +54 -0
  254. package/kit/mcp.json +10 -0
  255. package/kit/rules/code-style.md +24 -0
  256. package/manifest.json +30 -0
  257. package/package.json +36 -0
@@ -0,0 +1,141 @@
1
+ #!/usr/bin/env node
2
+ // Context Monitor - PostToolUse/AfterTool hook (Gemini uses AfterTool)
3
+ // Reads context metrics from the statusline bridge file and injects
4
+ // warnings when context usage is high. This makes the AGENT aware of
5
+ // context limits (the statusline only shows the user).
6
+ //
7
+ // How it works:
8
+ // 1. The statusline hook writes metrics to /tmp/claude-ctx-{session_id}.json
9
+ // 2. This hook reads those metrics after each tool use
10
+ // 3. When remaining context drops below thresholds, it injects a warning
11
+ // as additionalContext, which the agent sees in its conversation
12
+ //
13
+ // Thresholds:
14
+ // WARNING (remaining <= 35%): Agent should wrap up current task
15
+ // CRITICAL (remaining <= 25%): Agent should stop immediately and save state
16
+ //
17
+ // Debounce: 5 tool uses between warnings to avoid spam
18
+ // Severity escalation bypasses debounce (WARNING -> CRITICAL fires immediately)
19
+
20
+ const fs = require('fs');
21
+ const os = require('os');
22
+ const path = require('path');
23
+
24
+ const WARNING_THRESHOLD = 35; // remaining_percentage <= 35%
25
+ const CRITICAL_THRESHOLD = 25; // remaining_percentage <= 25%
26
+ const STALE_SECONDS = 60; // ignore metrics older than 60s
27
+ const DEBOUNCE_CALLS = 5; // min tool uses between warnings
28
+
29
+ let input = '';
30
+ // Timeout guard: if stdin doesn't close within 3s (e.g. pipe issues on
31
+ // Windows/Git Bash), exit silently instead of hanging until Claude Code
32
+ // kills the process and reports "hook error". See #775.
33
+ const stdinTimeout = setTimeout(() => process.exit(0), 3000);
34
+ process.stdin.setEncoding('utf8');
35
+ process.stdin.on('data', chunk => input += chunk);
36
+ process.stdin.on('end', () => {
37
+ clearTimeout(stdinTimeout);
38
+ try {
39
+ const data = JSON.parse(input);
40
+ const sessionId = data.session_id;
41
+
42
+ if (!sessionId) {
43
+ process.exit(0);
44
+ }
45
+
46
+ const tmpDir = os.tmpdir();
47
+ const metricsPath = path.join(tmpDir, `claude-ctx-${sessionId}.json`);
48
+
49
+ // If no metrics file, this is a subagent or fresh session -- exit silently
50
+ if (!fs.existsSync(metricsPath)) {
51
+ process.exit(0);
52
+ }
53
+
54
+ const metrics = JSON.parse(fs.readFileSync(metricsPath, 'utf8'));
55
+ const now = Math.floor(Date.now() / 1000);
56
+
57
+ // Ignore stale metrics
58
+ if (metrics.timestamp && (now - metrics.timestamp) > STALE_SECONDS) {
59
+ process.exit(0);
60
+ }
61
+
62
+ const remaining = metrics.remaining_percentage;
63
+ const usedPct = metrics.used_pct;
64
+
65
+ // No warning needed
66
+ if (remaining > WARNING_THRESHOLD) {
67
+ process.exit(0);
68
+ }
69
+
70
+ // Debounce: check if we warned recently
71
+ const warnPath = path.join(tmpDir, `claude-ctx-${sessionId}-warned.json`);
72
+ let warnData = { callsSinceWarn: 0, lastLevel: null };
73
+ let firstWarn = true;
74
+
75
+ if (fs.existsSync(warnPath)) {
76
+ try {
77
+ warnData = JSON.parse(fs.readFileSync(warnPath, 'utf8'));
78
+ firstWarn = false;
79
+ } catch (e) {
80
+ // Corrupted file, reset
81
+ }
82
+ }
83
+
84
+ warnData.callsSinceWarn = (warnData.callsSinceWarn || 0) + 1;
85
+
86
+ const isCritical = remaining <= CRITICAL_THRESHOLD;
87
+ const currentLevel = isCritical ? 'critical' : 'warning';
88
+
89
+ // Emit immediately on first warning, then debounce subsequent ones
90
+ // Severity escalation (WARNING -> CRITICAL) bypasses debounce
91
+ const severityEscalated = currentLevel === 'critical' && warnData.lastLevel === 'warning';
92
+ if (!firstWarn && warnData.callsSinceWarn < DEBOUNCE_CALLS && !severityEscalated) {
93
+ // Update counter and exit without warning
94
+ fs.writeFileSync(warnPath, JSON.stringify(warnData));
95
+ process.exit(0);
96
+ }
97
+
98
+ // Reset debounce counter
99
+ warnData.callsSinceWarn = 0;
100
+ warnData.lastLevel = currentLevel;
101
+ fs.writeFileSync(warnPath, JSON.stringify(warnData));
102
+
103
+ // Detect if GSD is active (has .planning/STATE.md in working directory)
104
+ const cwd = data.cwd || process.cwd();
105
+ const isGsdActive = fs.existsSync(path.join(cwd, '.planning', 'STATE.md'));
106
+
107
+ // Build advisory warning message (never use imperative commands that
108
+ // override user preferences — see #884)
109
+ let message;
110
+ if (isCritical) {
111
+ message = isGsdActive
112
+ ? `CONTEXT CRITICAL: Usage at ${usedPct}%. Remaining: ${remaining}%. ` +
113
+ 'Context is nearly exhausted. Do NOT start new complex work or write handoff files — ' +
114
+ 'GSD state is already tracked in STATE.md. Inform the user so they can run ' +
115
+ '/gsd:pause-work at the next natural stopping point.'
116
+ : `CONTEXT CRITICAL: Usage at ${usedPct}%. Remaining: ${remaining}%. ` +
117
+ 'Context is nearly exhausted. Inform the user that context is low and ask how they ' +
118
+ 'want to proceed. Do NOT autonomously save state or write handoff files unless the user asks.';
119
+ } else {
120
+ message = isGsdActive
121
+ ? `CONTEXT WARNING: Usage at ${usedPct}%. Remaining: ${remaining}%. ` +
122
+ 'Context is getting limited. Avoid starting new complex work. If not between ' +
123
+ 'defined plan steps, inform the user so they can prepare to pause.'
124
+ : `CONTEXT WARNING: Usage at ${usedPct}%. Remaining: ${remaining}%. ` +
125
+ 'Be aware that context is getting limited. Avoid unnecessary exploration or ' +
126
+ 'starting new complex work.';
127
+ }
128
+
129
+ const output = {
130
+ hookSpecificOutput: {
131
+ hookEventName: process.env.GEMINI_API_KEY ? "AfterTool" : "PostToolUse",
132
+ additionalContext: message
133
+ }
134
+ };
135
+
136
+ process.stdout.write(JSON.stringify(output));
137
+ } catch (e) {
138
+ // Silent fail -- never block tool execution
139
+ process.exit(0);
140
+ }
141
+ });
@@ -0,0 +1,115 @@
1
+ #!/usr/bin/env node
2
+ // Claude Code Statusline - GSD Edition
3
+ // Shows: model | current task | directory | context usage
4
+
5
+ const fs = require('fs');
6
+ const path = require('path');
7
+ const os = require('os');
8
+
9
+ // Read JSON from stdin
10
+ let input = '';
11
+ // Timeout guard: if stdin doesn't close within 3s (e.g. pipe issues on
12
+ // Windows/Git Bash), exit silently instead of hanging. See #775.
13
+ const stdinTimeout = setTimeout(() => process.exit(0), 3000);
14
+ process.stdin.setEncoding('utf8');
15
+ process.stdin.on('data', chunk => input += chunk);
16
+ process.stdin.on('end', () => {
17
+ clearTimeout(stdinTimeout);
18
+ try {
19
+ const data = JSON.parse(input);
20
+ const model = data.model?.display_name || 'Claude';
21
+ const dir = data.workspace?.current_dir || process.cwd();
22
+ const session = data.session_id || '';
23
+ const remaining = data.context_window?.remaining_percentage;
24
+
25
+ // Context window display (shows USED percentage scaled to usable context)
26
+ // Claude Code reserves ~16.5% for autocompact buffer, so usable context
27
+ // is 83.5% of the total window. We normalize to show 100% at that point.
28
+ const AUTO_COMPACT_BUFFER_PCT = 16.5;
29
+ let ctx = '';
30
+ if (remaining != null) {
31
+ // Normalize: subtract buffer from remaining, scale to usable range
32
+ const usableRemaining = Math.max(0, ((remaining - AUTO_COMPACT_BUFFER_PCT) / (100 - AUTO_COMPACT_BUFFER_PCT)) * 100);
33
+ const used = Math.max(0, Math.min(100, Math.round(100 - usableRemaining)));
34
+
35
+ // Write context metrics to bridge file for the context-monitor PostToolUse hook.
36
+ // The monitor reads this file to inject agent-facing warnings when context is low.
37
+ if (session) {
38
+ try {
39
+ const bridgePath = path.join(os.tmpdir(), `claude-ctx-${session}.json`);
40
+ const bridgeData = JSON.stringify({
41
+ session_id: session,
42
+ remaining_percentage: remaining,
43
+ used_pct: used,
44
+ timestamp: Math.floor(Date.now() / 1000)
45
+ });
46
+ fs.writeFileSync(bridgePath, bridgeData);
47
+ } catch (e) {
48
+ // Silent fail -- bridge is best-effort, don't break statusline
49
+ }
50
+ }
51
+
52
+ // Build progress bar (10 segments)
53
+ const filled = Math.floor(used / 10);
54
+ const bar = '█'.repeat(filled) + '░'.repeat(10 - filled);
55
+
56
+ // Color based on usable context thresholds
57
+ if (used < 50) {
58
+ ctx = ` \x1b[32m${bar} ${used}%\x1b[0m`;
59
+ } else if (used < 65) {
60
+ ctx = ` \x1b[33m${bar} ${used}%\x1b[0m`;
61
+ } else if (used < 80) {
62
+ ctx = ` \x1b[38;5;208m${bar} ${used}%\x1b[0m`;
63
+ } else {
64
+ ctx = ` \x1b[5;31m💀 ${bar} ${used}%\x1b[0m`;
65
+ }
66
+ }
67
+
68
+ // Current task from todos
69
+ let task = '';
70
+ const homeDir = os.homedir();
71
+ // Respect CLAUDE_CONFIG_DIR for custom config directory setups (#870)
72
+ const claudeDir = process.env.CLAUDE_CONFIG_DIR || path.join(homeDir, '.claude');
73
+ const todosDir = path.join(claudeDir, 'todos');
74
+ if (session && fs.existsSync(todosDir)) {
75
+ try {
76
+ const files = fs.readdirSync(todosDir)
77
+ .filter(f => f.startsWith(session) && f.includes('-agent-') && f.endsWith('.json'))
78
+ .map(f => ({ name: f, mtime: fs.statSync(path.join(todosDir, f)).mtime }))
79
+ .sort((a, b) => b.mtime - a.mtime);
80
+
81
+ if (files.length > 0) {
82
+ try {
83
+ const todos = JSON.parse(fs.readFileSync(path.join(todosDir, files[0].name), 'utf8'));
84
+ const inProgress = todos.find(t => t.status === 'in_progress');
85
+ if (inProgress) task = inProgress.activeForm || '';
86
+ } catch (e) {}
87
+ }
88
+ } catch (e) {
89
+ // Silently fail on file system errors - don't break statusline
90
+ }
91
+ }
92
+
93
+ // GSD update available?
94
+ let gsdUpdate = '';
95
+ const cacheFile = path.join(claudeDir, 'cache', 'gsd-update-check.json');
96
+ if (fs.existsSync(cacheFile)) {
97
+ try {
98
+ const cache = JSON.parse(fs.readFileSync(cacheFile, 'utf8'));
99
+ if (cache.update_available) {
100
+ gsdUpdate = '\x1b[33m⬆ /gsd:update\x1b[0m │ ';
101
+ }
102
+ } catch (e) {}
103
+ }
104
+
105
+ // Output
106
+ const dirname = path.basename(dir);
107
+ if (task) {
108
+ process.stdout.write(`${gsdUpdate}\x1b[2m${model}\x1b[0m │ \x1b[1m${task}\x1b[0m │ \x1b[2m${dirname}\x1b[0m${ctx}`);
109
+ } else {
110
+ process.stdout.write(`${gsdUpdate}\x1b[2m${model}\x1b[0m │ \x1b[2m${dirname}\x1b[0m${ctx}`);
111
+ }
112
+ } catch (e) {
113
+ // Silent fail - don't break statusline on parse errors
114
+ }
115
+ });
package/kit/CLAUDE.md ADDED
@@ -0,0 +1,43 @@
1
+ # Project Agent Guide
2
+
3
+ > **First time?** Run `/setup` to auto-configure this project.
4
+ > **Update kit?** Run `/kit:update` to get the latest version.
5
+
6
+ This file will be generated by `/setup` with project-specific details.
7
+
8
+ ## Methodology — GSD (Get Shit Done)
9
+
10
+ Spec-driven development with fresh 200k contexts per task:
11
+
12
+ - `/gsd:new-project` → Initialize with roadmap and milestones
13
+ - `/gsd:discuss-phase N` → Capture requirements
14
+ - `/gsd:plan-phase N` → Atomic plans
15
+ - `/gsd:execute-phase N` → Build with fresh contexts, atomic commits
16
+ - `/gsd:verify-work N` → Goal-backward verification ("does it match the spec?")
17
+ - `/gsd:quick "task"` → Lightweight mode
18
+ - `/gsd:help` → All 32 GSD commands
19
+
20
+ ## Toolbox — ECC (Everything Claude Code)
21
+
22
+ Quality gates, learning, and session management:
23
+
24
+ - `/verify` → Multi-phase verification (build → types → lint → tests → security)
25
+ - `/checkpoint create "name"` → Git-backed snapshots with before/after comparison
26
+ - `/save-session` → Persist session state (what worked, what didn't, next step)
27
+ - `/resume-session` → Load previous session context
28
+ - `/learn` → Extract reusable patterns from current session
29
+ - `/evolve` → Promote learned instincts into skills/commands/agents
30
+ - `/quality-gate` → On-demand quality pipeline
31
+ - `/model-route` → Recommend model tier for current task
32
+
33
+ ## Before ANY Work
34
+
35
+ ```bash
36
+ npx skills find <keywords> # Discover ecosystem skills
37
+ ```
38
+
39
+ ## Reference Docs & MCP
40
+
41
+ - `docs/agent-guides/*.md` — Detailed guides (loaded on demand)
42
+ - `.claude/contexts/` — dev.md, research.md, review.md (mode switching)
43
+ - MCP: **github.com/mcp** (official) or **mcp.so** (8000+ servers)
@@ -0,0 +1,46 @@
1
+ ---
2
+ description: "Update the Claude Code Pilot and all bundled dependencies (GSD, ECC)"
3
+ ---
4
+
5
+ # Update Pilot
6
+
7
+ ## Step 1 — Check Versions
8
+
9
+ ```bash
10
+ cat .claude/kit-version/VERSION # Kit version
11
+ cat .claude/kit-version/manifest.json # Bundled dependency versions
12
+ cat .claude/get-shit-done/VERSION # GSD version
13
+ ```
14
+
15
+ Check npm:
16
+ ```bash
17
+ npm view claude-code-pilot version # Latest kit
18
+ npm view get-shit-done-cc version # Latest GSD
19
+ npm view ecc-universal version # Latest ECC
20
+ ```
21
+
22
+ Present:
23
+ ```
24
+ 📦 Pilot: [installed] → [latest]
25
+ 📦 GSD: [installed] → [latest]
26
+ 📦 ECC: [installed] → [latest]
27
+ ```
28
+
29
+ ## Step 2 — Update
30
+
31
+ If updates available:
32
+ ```bash
33
+ npx claude-code-pilot@latest --local --update
34
+ ```
35
+
36
+ Preserves: CLAUDE.md (if customized), architecture docs, settings customizations.
37
+ Updates: GSD commands/agents/workflows, ECC commands/skills/hooks/rules, kit hooks.
38
+
39
+ ## Step 3 — Report
40
+
41
+ ```
42
+ ✅ Updated!
43
+ Kit: [old] → [new]
44
+ GSD: [old] → [new]
45
+ ECC: [old] → [new]
46
+ ```
@@ -0,0 +1,50 @@
1
+ ---
2
+ description: "Re-scan codebase and update CLAUDE.md, rules, directory CLAUDE.md files, and architecture docs after major changes"
3
+ ---
4
+
5
+ # Refresh Project Configuration
6
+
7
+ Re-scan and update after the project has evolved.
8
+
9
+ ## Step 1 — Diff Check
10
+
11
+ 1. Read current `CLAUDE.md`
12
+ 2. Scan for dependency/directory/command changes
13
+ 3. Check if detected languages changed (may need new rules from available-rules/)
14
+
15
+ Present differences.
16
+
17
+ ## Step 2 — Update
18
+
19
+ 1. Update CLAUDE.md (keep under 100 lines)
20
+ 2. Activate/deactivate language rules if stack changed
21
+ 3. Update docs/agent-guides/architecture.md if structural changes
22
+ 4. Regenerate directory-scoped CLAUDE.md files:
23
+ - Scan for recognized directories: `src/`, `test/`, `tests/`, `lib/`, `app/`, `api/`, `scripts/`, `docs/`
24
+ - For each existing recognized directory with a CLAUDE.md file:
25
+ - Read the file's first line
26
+ - If it contains `<!-- Generated by /setup -- customize freely, /setup:refresh will regenerate if this comment is present -->`: regenerate using the same stack-aware templates from /setup Stage 4
27
+ - If the marker is absent: skip (print: "Skipping {dir}/CLAUDE.md -- customized by user")
28
+ - For each recognized directory WITHOUT a CLAUDE.md file:
29
+ - Generate a new one using the same stack-aware templates from /setup Stage 4
30
+ - Show summary of changes:
31
+ ```
32
+ Directory CLAUDE.md refresh:
33
+ [REGENERATED] src/CLAUDE.md (Next.js conventions)
34
+ [SKIPPED] test/CLAUDE.md (customized by user)
35
+ [CREATED] api/CLAUDE.md (REST conventions)
36
+
37
+ Regenerated: 1, Skipped: 1, Created: 1
38
+ ```
39
+ 5. Search for new skills: `npx skills find [new-tech]`
40
+
41
+ Show diff before writing.
42
+
43
+ Note: MCP detection is NOT re-run during refresh. Binaries rarely change. Re-run `/setup` to re-detect MCP tools.
44
+
45
+ ## Step 3 — Commit
46
+
47
+ ```bash
48
+ git add CLAUDE.md */CLAUDE.md .claude/rules/ docs/
49
+ git commit -m "chore: refresh Claude Code configuration"
50
+ ```