gsd-antigravity-kit 1.22.2 → 1.22.5

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 (76) hide show
  1. package/.agent/skills/gsd/SKILL.md +5 -2
  2. package/.agent/skills/gsd/assets/templates/config.json +2 -2
  3. package/.agent/skills/gsd/assets/templates/roadmap.md +1 -1
  4. package/.agent/skills/gsd/bin/gsd-tools.cjs +39 -5
  5. package/.agent/skills/gsd/bin/help-manifest.json +237 -0
  6. package/.agent/skills/gsd/bin/hooks/gsd-check-update.js +22 -3
  7. package/.agent/skills/gsd/bin/hooks/gsd-context-monitor.js +28 -9
  8. package/.agent/skills/gsd/bin/hooks/gsd-statusline.js +19 -12
  9. package/.agent/skills/gsd/bin/lib/commands.cjs +3 -3
  10. package/.agent/skills/gsd/bin/lib/config.cjs +8 -1
  11. package/.agent/skills/gsd/bin/lib/core.cjs +63 -3
  12. package/.agent/skills/gsd/bin/lib/milestone.cjs +18 -44
  13. package/.agent/skills/gsd/bin/lib/phase.cjs +27 -4
  14. package/.agent/skills/gsd/bin/lib/state.cjs +100 -59
  15. package/.agent/skills/gsd/bin/lib/template.cjs +3 -3
  16. package/.agent/skills/gsd/bin/lib/verify.cjs +47 -0
  17. package/.agent/skills/gsd/references/agents/gsd-codebase-mapper.md +9 -1
  18. package/.agent/skills/gsd/references/agents/gsd-debugger.md +11 -0
  19. package/.agent/skills/gsd/references/agents/gsd-executor.md +12 -2
  20. package/.agent/skills/gsd/references/agents/gsd-integration-checker.md +2 -0
  21. package/.agent/skills/gsd/references/agents/gsd-nyquist-auditor.md +178 -0
  22. package/.agent/skills/gsd/references/agents/gsd-phase-researcher.md +13 -4
  23. package/.agent/skills/gsd/references/agents/gsd-plan-checker.md +18 -2
  24. package/.agent/skills/gsd/references/agents/gsd-planner.md +24 -10
  25. package/.agent/skills/gsd/references/agents/gsd-project-researcher.md +10 -0
  26. package/.agent/skills/gsd/references/agents/gsd-research-synthesizer.md +10 -0
  27. package/.agent/skills/gsd/references/agents/gsd-roadmapper.md +23 -13
  28. package/.agent/skills/gsd/references/agents/gsd-verifier.md +8 -0
  29. package/.agent/skills/gsd/references/commands/debug.md +1 -0
  30. package/.agent/skills/gsd/references/commands/gsd-tools.md +2 -1
  31. package/.agent/skills/gsd/references/commands/quick.md +6 -2
  32. package/.agent/skills/gsd/references/commands/reapply-patches.md +17 -4
  33. package/.agent/skills/gsd/references/commands/research-phase.md +5 -4
  34. package/.agent/skills/gsd/references/commands/validate-phase.md +35 -0
  35. package/.agent/skills/gsd/references/docs/checkpoints.md +1 -1
  36. package/.agent/skills/gsd/references/docs/model-profiles.md +1 -0
  37. package/.agent/skills/gsd/references/docs/planning-config.md +4 -0
  38. package/.agent/skills/gsd/references/docs/questioning.md +17 -0
  39. package/.agent/skills/gsd/references/mapping.md +32 -0
  40. package/.agent/skills/gsd/references/workflows/add-phase.md +1 -0
  41. package/.agent/skills/gsd/references/workflows/add-tests.md +1 -0
  42. package/.agent/skills/gsd/references/workflows/add-todo.md +1 -0
  43. package/.agent/skills/gsd/references/workflows/audit-milestone.md +35 -0
  44. package/.agent/skills/gsd/references/workflows/check-todos.md +1 -0
  45. package/.agent/skills/gsd/references/workflows/complete-milestone.md +1 -0
  46. package/.agent/skills/gsd/references/workflows/diagnose-issues.md +1 -1
  47. package/.agent/skills/gsd/references/workflows/discuss-phase.md +21 -39
  48. package/.agent/skills/gsd/references/workflows/execute-phase.md +14 -4
  49. package/.agent/skills/gsd/references/workflows/execute-plan.md +1 -0
  50. package/.agent/skills/gsd/references/workflows/health.md +3 -0
  51. package/.agent/skills/gsd/references/workflows/insert-phase.md +1 -0
  52. package/.agent/skills/gsd/references/workflows/map-codebase.md +1 -0
  53. package/.agent/skills/gsd/references/workflows/new-milestone.md +4 -2
  54. package/.agent/skills/gsd/references/workflows/new-project.md +29 -34
  55. package/.agent/skills/gsd/references/workflows/plan-phase.md +46 -55
  56. package/.agent/skills/gsd/references/workflows/progress.md +1 -0
  57. package/.agent/skills/gsd/references/workflows/quick.md +154 -6
  58. package/.agent/skills/gsd/references/workflows/remove-phase.md +1 -0
  59. package/.agent/skills/gsd/references/workflows/research-phase.md +1 -0
  60. package/.agent/skills/gsd/references/workflows/resume-project.md +1 -0
  61. package/.agent/skills/gsd/references/workflows/set-profile.md +1 -0
  62. package/.agent/skills/gsd/references/workflows/settings.md +3 -2
  63. package/.agent/skills/gsd/references/workflows/transition.md +2 -2
  64. package/.agent/skills/gsd/references/workflows/update.md +35 -10
  65. package/.agent/skills/gsd/references/workflows/validate-phase.md +167 -0
  66. package/.agent/skills/gsd/references/workflows/verify-phase.md +1 -0
  67. package/.agent/skills/gsd/references/workflows/verify-work.md +14 -0
  68. package/.agent/skills/gsd-converter/assets/gsd-tools.md +1 -0
  69. package/.agent/skills/gsd-converter/assets/gsd_skill_template.md +1 -0
  70. package/.agent/skills/gsd-converter/scripts/convert.py +190 -6
  71. package/.agent/skills/gsd-converter/scripts/optimize-gsd-tools.cjs +71 -2
  72. package/.agent/skills/release-manager/references/update_kb_from_fixes.md +1 -0
  73. package/CHANGELOG.md +16 -0
  74. package/README.md +1 -1
  75. package/docs/DEV_KNOWLEDGEBASE.md +27 -0
  76. package/package.json +19 -19
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: gsd
3
- version: 1.22.1
3
+ version: 1.22.4
4
4
  description: "Antigravity GSD (Get Stuff Done) - A spec-driven hierarchical planning and execution system. Triggers on project planning, phase management, and GSD slash commands."
5
5
  ---
6
6
 
@@ -52,6 +52,7 @@ This skill should be used when:
52
52
  - `gsd:set-profile`
53
53
  - `gsd:settings`
54
54
  - `gsd:update`
55
+ - `gsd:validate-phase`
55
56
  - `gsd:verify-work`
56
57
 
57
58
  ## System Overview
@@ -96,6 +97,7 @@ The following slash commands are available in this skill. Use them to drive the
96
97
  - **[`gsd:set-profile`](references/commands/set-profile.md)**: Switch model profile for GSD agents (quality/balanced/budget)
97
98
  - **[`gsd:settings`](references/commands/settings.md)**: Configure GSD workflow toggles and model profile
98
99
  - **[`gsd:update`](references/commands/update.md)**: Update GSD to latest version with changelog display
100
+ - **[`gsd:validate-phase`](references/commands/validate-phase.md)**: Retroactively audit and fill Nyquist validation gaps for a completed phase
99
101
  - **[`gsd:verify-work`](references/commands/verify-work.md)**: Validate built features through conversational UAT
100
102
 
101
103
  ### 3. Directory Structure
@@ -128,6 +130,7 @@ General documentation on the GSD philosophy, usage patterns, and configuration.
128
130
  2. **Use Templates**: Leverage `assets/templates/` for consistent file structures.
129
131
  3. **Update State**: Keep the project state synchronized using `/gsd:progress`.
130
132
  4. **One Context**: Keep separate contexts (channels/threads) for Planning vs Execution to avoid contamination.
133
+ 5. **CLI Invocation**: `gsd-tools` is **NOT** a global command. Always invoke it with the full node path: `node .agent/skills/gsd/bin/gsd-tools.cjs <command> [args]`. Never run `gsd-tools` bare.
131
134
 
132
135
  ---
133
- *Generated by gsd-converter on 2026-03-03*
136
+ *Generated by gsd-converter on 2026-03-09*
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "mode": "interactive",
3
- "depth": "standard",
3
+ "granularity": "standard",
4
4
  "workflow": {
5
5
  "research": true,
6
6
  "plan_check": true,
7
7
  "verifier": true,
8
8
  "auto_advance": false,
9
- "nyquist_validation": false
9
+ "nyquist_validation": true
10
10
  },
11
11
  "planning": {
12
12
  "commit_docs": true,
@@ -105,7 +105,7 @@ Phases execute in numeric order: 2 → 2.1 → 2.2 → 3 → 3.1 → 4
105
105
 
106
106
  <guidelines>
107
107
  **Initial planning (v1.0):**
108
- - Phase count depends on depth setting (quick: 3-5, standard: 5-8, comprehensive: 8-12)
108
+ - Phase count depends on granularity setting (coarse: 3-5, standard: 5-8, fine: 8-12)
109
109
  - Each phase delivers something coherent
110
110
  - Phases can have 1+ plans (split if >3 tasks or multiple subsystems)
111
111
  - Plans use naming: {phase}-{plan}-PLAN.md (e.g., 01-02-PLAN.md)
@@ -1,8 +1,26 @@
1
1
  #!/usr/bin/env node
2
+ const HELP_MANIFEST = require('./help-manifest.json');
3
+
4
+ function showHelp(cmd, sub) {
5
+ const info = HELP_MANIFEST.commands[cmd];
6
+ if (!info) {
7
+ console.log(`\n${HELP_MANIFEST.tools_usage}`);
8
+ console.log('\nAvailable Commands: ' + Object.keys(HELP_MANIFEST.commands).join(', '));
9
+ return;
10
+ }
11
+ console.log(`\nCommand: ${cmd}\nDescription: ${info.description}`);
12
+ if (sub && info.subcommands?.[sub]) {
13
+ console.log(`Subcommand: ${sub}\nUsage: ${info.subcommands[sub]}`);
14
+ } else if (info.subcommands) {
15
+ console.log('\nAvailable subcommands:');
16
+ Object.entries(info.subcommands).forEach(([s, d]) => console.log(` - ${s.padEnd(15)} : ${d}`));
17
+ }
18
+ }
19
+
2
20
 
3
21
  /**
4
22
  * GSD Tools — CLI utility for GSD workflow operations
5
- * Usage: node gsd-tools.cjs <command> [args] [--raw] [--include field1,field2]
23
+ * Usage: node .agent/skills/gsd/bin/gsd-tools.cjs <command> [args] [--raw] [--include field1,field2]
6
24
  *
7
25
  * Commands: state, resolve-model, find-phase, commit, verify-summary, generate-slug,
8
26
  * current-timestamp, list-todos, verify-path-exists, config-ensure-section, config-set,
@@ -10,7 +28,7 @@
10
28
  * validate, progress, todo, scaffold, phase-plan-index, state-snapshot, summary-extract,
11
29
  * websearch, frontmatter, verify, template, init
12
30
  *
13
- * Run with --help for detailed usage of each command.
31
+ * Run with gsd:help command args for detailed usage of each command.
14
32
  */
15
33
 
16
34
  const fs = require('fs');
@@ -54,12 +72,24 @@ async function main() {
54
72
 
55
73
  const rawIndex = args.indexOf('--raw');
56
74
  const raw = rawIndex !== -1;
75
+
76
+ if (args.includes('--help') || args.includes('-h')) {
77
+ const cmd = args[0];
78
+ const sub = args[1];
79
+ if (raw) {
80
+ const { output } = require('./lib/core.cjs');
81
+ output(HELP_MANIFEST, true);
82
+ } else {
83
+ showHelp(cmd, sub);
84
+ }
85
+ process.exit(0);
86
+ }
57
87
  if (rawIndex !== -1) args.splice(rawIndex, 1);
58
88
 
59
89
  const command = args[0];
60
90
 
61
91
  if (!command) {
62
- error('Usage: gsd-tools <command> [args] [--raw] [--cwd <path>]\nCommands: state, resolve-model, find-phase, commit, verify-summary, verify, frontmatter, template, generate-slug, current-timestamp, list-todos, verify-path-exists, config-ensure-section, init');
92
+ error('Usage: node .agent/skills/gsd/bin/gsd-tools.cjs <command> [args] [--raw] [--cwd <path>]\nCommands: state, resolve-model, find-phase, commit, verify-summary, verify, frontmatter, template, generate-slug, current-timestamp, list-todos, verify-path-exists, config-ensure-section, init');
63
93
  }
64
94
 
65
95
  switch (command) {
@@ -146,9 +176,13 @@ async function main() {
146
176
 
147
177
  case 'commit': {
148
178
  const amend = args.includes('--amend');
149
- const message = args[1];
150
- // Parse --files flag (collect args after --files, stopping at other flags)
151
179
  const filesIndex = args.indexOf('--files');
180
+ // Collect all positional args between command name and first flag,
181
+ // then join them — handles both quoted ("multi word msg") and
182
+ // unquoted (multi word msg) invocations from different shells
183
+ const endIndex = filesIndex !== -1 ? filesIndex : args.length;
184
+ const messageArgs = args.slice(1, endIndex).filter(a => !a.startsWith('--'));
185
+ const message = messageArgs.join(' ') || undefined;
152
186
  const files = filesIndex !== -1 ? args.slice(filesIndex + 1).filter(a => !a.startsWith('--')) : [];
153
187
  commands.cmdCommit(cwd, message, files, raw, amend);
154
188
  break;
@@ -0,0 +1,237 @@
1
+ {
2
+ "version": "1.22.4",
3
+ "commands": {
4
+ "add-phase": {
5
+ "description": "Add phase to end of current milestone in roadmap"
6
+ },
7
+ "add-tests": {
8
+ "description": "Generate tests for a completed phase based on UAT criteria and implementation"
9
+ },
10
+ "add-todo": {
11
+ "description": "Capture idea or task as todo from current conversation context"
12
+ },
13
+ "audit-milestone": {
14
+ "description": "Audit milestone completion against original intent before archiving"
15
+ },
16
+ "check-todos": {
17
+ "description": "List pending todos and select one to work on"
18
+ },
19
+ "cleanup": {
20
+ "description": "Archive accumulated phase directories from completed milestones"
21
+ },
22
+ "complete-milestone": {
23
+ "description": "Archive completed milestone and prepare for next version"
24
+ },
25
+ "debug": {
26
+ "description": "Systematic debugging with persistent state across context resets"
27
+ },
28
+ "discuss-phase": {
29
+ "description": "Gather phase context through adaptive questioning before planning"
30
+ },
31
+ "execute-phase": {
32
+ "description": "Execute all plans in a phase with wave-based parallelization"
33
+ },
34
+ "health": {
35
+ "description": "Diagnose planning directory health and optionally repair issues"
36
+ },
37
+ "help": {
38
+ "description": "Show available GSD commands and usage guide"
39
+ },
40
+ "insert-phase": {
41
+ "description": "Insert urgent work as decimal phase (e.g., 72.1) between existing phases"
42
+ },
43
+ "join-discord": {
44
+ "description": "Join the GSD Discord community"
45
+ },
46
+ "list-phase-assumptions": {
47
+ "description": "Surface Antigravity's assumptions about a phase approach before planning"
48
+ },
49
+ "map-codebase": {
50
+ "description": "Analyze codebase with parallel mapper agents to produce .planning/codebase/ documents"
51
+ },
52
+ "new-milestone": {
53
+ "description": "Start a new milestone cycle \u2014 update PROJECT.md and route to requirements"
54
+ },
55
+ "new-project": {
56
+ "description": "Initialize a new project with deep context gathering and PROJECT.md"
57
+ },
58
+ "pause-work": {
59
+ "description": "Create context handoff when pausing work mid-phase"
60
+ },
61
+ "plan-milestone-gaps": {
62
+ "description": "Create phases to close all gaps identified by milestone audit"
63
+ },
64
+ "plan-phase": {
65
+ "description": "Create detailed phase plan (PLAN.md) with verification loop"
66
+ },
67
+ "progress": {
68
+ "description": "Calculate and render project completion percentage.",
69
+ "subcommands": {
70
+ "json": "Output progress as raw JSON.",
71
+ "render": "Output a pretty-formatted progress bar (default)."
72
+ }
73
+ },
74
+ "quick": {
75
+ "description": "Execute a quick task with GSD guarantees (atomic commits, state tracking) but skip optional agents"
76
+ },
77
+ "reapply-patches": {
78
+ "description": "Reapply local modifications after a GSD update"
79
+ },
80
+ "remove-phase": {
81
+ "description": "Remove a future phase from roadmap and renumber subsequent phases"
82
+ },
83
+ "research-phase": {
84
+ "description": "Research how to implement a phase (standalone - usually use /gsd:plan-phase instead)"
85
+ },
86
+ "resume-work": {
87
+ "description": "Resume work from previous session with full context restoration"
88
+ },
89
+ "set-profile": {
90
+ "description": "Switch model profile for GSD agents (quality/balanced/budget)"
91
+ },
92
+ "settings": {
93
+ "description": "Configure GSD workflow toggles and model profile"
94
+ },
95
+ "update": {
96
+ "description": "Update GSD to latest version with changelog display"
97
+ },
98
+ "validate-phase": {
99
+ "description": "Retroactively audit and fill Nyquist validation gaps for a completed phase"
100
+ },
101
+ "verify-work": {
102
+ "description": "Validate built features through conversational UAT"
103
+ },
104
+ "state": {
105
+ "description": "Manage and query project state memory.",
106
+ "subcommands": {
107
+ "json": "Output full state as raw JSON.",
108
+ "update": "Update a state key. usage: state update <key> <value>",
109
+ "get": "Retrieve a specific state value. usage: state get <key>",
110
+ "patch": "Apply multiple state changes via flags.",
111
+ "advance-plan": "Advance to the next plan in the current phase.",
112
+ "record-metric": "Record execution metrics (duration, files, tasks).",
113
+ "update-progress": "Sync STATE.md progress with ROADMAP.md status.",
114
+ "add-decision": "Record a design decision with rationale.",
115
+ "add-blocker": "Record a new blocking issue.",
116
+ "resolve-blocker": "Mark a blocker as resolved.",
117
+ "record-session": "Record session continuity metadata."
118
+ }
119
+ },
120
+ "roadmap": {
121
+ "description": "Manage and analyze project roadmap and phases.",
122
+ "subcommands": {
123
+ "get-phase": "Retrieve details for a specific phase number.",
124
+ "analyze": "Analyze roadmap completion and next steps.",
125
+ "update-plan-progress": "Update completion status for a plan in ROADMAP.md."
126
+ }
127
+ },
128
+ "find-phase": {
129
+ "description": "Search for a phase directory by number or name. usage: find-phase <query>"
130
+ },
131
+ "resolve-model": {
132
+ "description": "Resolve the optimal AI model for a specific agent type. usage: resolve-model <agent-type>"
133
+ },
134
+ "commit": {
135
+ "description": "Create a standardized GSD commit. usage: commit [message] --files [file1...]",
136
+ "subcommands": {
137
+ "--amend": "Amend the last commit instead of creating a new one."
138
+ }
139
+ },
140
+ "verify-summary": {
141
+ "description": "Verify that a SUMMARY.md matches the corresponding PLAN.md. usage: verify-summary <path>"
142
+ },
143
+ "generate-slug": {
144
+ "description": "Convert a string into a URL-friendly slug. usage: generate-slug <text>"
145
+ },
146
+ "current-timestamp": {
147
+ "description": "Output the current timestamp in various formats. usage: current-timestamp [format]"
148
+ },
149
+ "list-todos": {
150
+ "description": "List all pending todos in the project. usage: list-todos [area]"
151
+ },
152
+ "verify-path-exists": {
153
+ "description": "Check if a specific path exists within the project. usage: verify-path-exists <path>"
154
+ },
155
+ "history-digest": {
156
+ "description": "Generate a concise digest of recent project activity."
157
+ },
158
+ "todo": {
159
+ "description": "Atomic operations on a single todo file.",
160
+ "subcommands": {
161
+ "complete": "Mark a todo as done. usage: todo complete <path>"
162
+ }
163
+ },
164
+ "scaffold": {
165
+ "description": "Scaffold new project structures or phase directories. usage: scaffold <type> --name <name>",
166
+ "subcommands": {
167
+ "phase": "Initialize a new phase structure."
168
+ }
169
+ },
170
+ "phase-plan-index": {
171
+ "description": "Sync and re-index plans within a phase directory."
172
+ },
173
+ "state-snapshot": {
174
+ "description": "Create a persistent snapshot of the current project state."
175
+ },
176
+ "summary-extract": {
177
+ "description": "Extract specific fields from a SUMMARY.md file. usage: summary-extract <path> --fields <f1,f2>"
178
+ },
179
+ "websearch": {
180
+ "description": "Perform a low-latency web search for technical info. usage: websearch <query>"
181
+ },
182
+ "phase": {
183
+ "description": "Atomic phase operations in the roadmap.",
184
+ "subcommands": {
185
+ "next-decimal": "Calculate the next available decimal phase for insertion.",
186
+ "add": "Add a new phase at the end of the milestone.",
187
+ "insert": "Insert a new decimal phase at a specific position.",
188
+ "remove": "Remove a phase and re-number subsequent phases.",
189
+ "complete": "Mark a phase as 100% complete in ROADMAP.md."
190
+ }
191
+ },
192
+ "verify": {
193
+ "description": "Run verification and consistency checks.",
194
+ "subcommands": {
195
+ "plan-structure": "Validate PLAN.md formatting and required sections.",
196
+ "phase-completeness": "Verify that all plans in a phase have summaries.",
197
+ "references": "Check for broken internal or artifact references.",
198
+ "commits": "Verify that git commits match planned work.",
199
+ "artifacts": "Confirm existence of required phase artifacts.",
200
+ "key-links": "Validate critical links and external references.",
201
+ "consistency": "Ensure ROADMAP.md, STATE.md and REQUIREMENTS.md are in sync.",
202
+ "health": "Check directory structure and general project health."
203
+ }
204
+ },
205
+ "template": {
206
+ "description": "Manage and fill GSD artifact templates.",
207
+ "subcommands": {
208
+ "select": "Suggest the best template for a specific task.",
209
+ "fill": "Generate artifact content from a template with variables."
210
+ }
211
+ },
212
+ "frontmatter": {
213
+ "description": "Query or modify Markdown frontmatter.",
214
+ "subcommands": {
215
+ "get": "Retrieve a value from frontmatter. usage: frontmatter get <file> --field <key>",
216
+ "set": "Update a frontmatter field. usage: frontmatter set <file> --field <key> --value <val>",
217
+ "merge": "Merge a JSON object into file frontmatter.",
218
+ "validate": "Validate frontmatter against a specific schema."
219
+ }
220
+ },
221
+ "init": {
222
+ "description": "Initialize specialized GSD workflows.",
223
+ "subcommands": {
224
+ "execute-phase": "Init execution state for a phase.",
225
+ "plan-phase": "Init planning state for a phase.",
226
+ "new-project": "Init a fresh project structure.",
227
+ "new-milestone": "Init a new milestone cycle.",
228
+ "quick": "Init a quick-task context.",
229
+ "resume": "Restore context from a paused session.",
230
+ "verify-work": "Init UAT/verification workflow.",
231
+ "map-codebase": "Init parallel codebase mapping.",
232
+ "progress": "Calculate current project progress metrics."
233
+ }
234
+ }
235
+ },
236
+ "tools_usage": "Commands: state, resolve-model, find-phase, commit, verify-summary, generate-slug,\ncurrent-timestamp, list-todos, verify-path-exists, config-ensure-section, config-set,\nconfig-get, history-digest, phases, roadmap, requirements, phase, milestone,\nvalidate, progress, todo, scaffold, phase-plan-index, state-snapshot, summary-extract,\nwebsearch, frontmatter, verify, template, init\nRun with gsd:help command args for detailed usage of each command."
237
+ }
@@ -9,12 +9,31 @@ const { spawn } = require('child_process');
9
9
 
10
10
  const homeDir = os.homedir();
11
11
  const cwd = process.cwd();
12
- const cacheDir = path.join(homeDir, '.gemini', 'antigravity', 'cache');
12
+
13
+ // Detect runtime config directory (supports Antigravity, OpenCode, Gemini)
14
+ // Respects CLAUDE_CONFIG_DIR for custom config directory setups
15
+ function detectConfigDir(baseDir) {
16
+ // Check env override first (supports multi-account setups)
17
+ const envDir = process.env.CLAUDE_CONFIG_DIR;
18
+ if (envDir && fs.existsSync(path.join(envDir, 'get-shit-done', 'VERSION'))) {
19
+ return envDir;
20
+ }
21
+ for (const dir of ['.config/opencode', '.opencode', '.gemini', '.antigravity']) {
22
+ if (fs.existsSync(path.join(baseDir, dir, 'get-shit-done', 'VERSION'))) {
23
+ return path.join(baseDir, dir);
24
+ }
25
+ }
26
+ return envDir || path.join(baseDir, '.antigravity');
27
+ }
28
+
29
+ const globalConfigDir = detectConfigDir(homeDir);
30
+ const projectConfigDir = detectConfigDir(cwd);
31
+ const cacheDir = path.join(globalConfigDir, 'cache');
13
32
  const cacheFile = path.join(cacheDir, 'gsd-update-check.json');
14
33
 
15
34
  // VERSION file locations (check project first, then global)
16
- const projectVersionFile = path.join(cwd, '.agent', 'skills', 'gsd', 'VERSION');
17
- const globalVersionFile = path.join(homeDir, '.gemini', 'antigravity', 'skills', 'gsd', 'VERSION');
35
+ const projectVersionFile = path.join(projectConfigDir, 'get-shit-done', 'VERSION');
36
+ const globalVersionFile = path.join(globalConfigDir, 'get-shit-done', 'VERSION');
18
37
 
19
38
  // Ensure cache directory exists
20
39
  if (!fs.existsSync(cacheDir)) {
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- // Context Monitor - PostToolUse hook
2
+ // Context Monitor - PostToolUse/AfterTool hook (Gemini uses AfterTool)
3
3
  // Reads context metrics from the statusline bridge file and injects
4
4
  // warnings when context usage is high. This makes the AGENT aware of
5
5
  // context limits (the statusline only shows the user).
@@ -27,9 +27,14 @@ const STALE_SECONDS = 60; // ignore metrics older than 60s
27
27
  const DEBOUNCE_CALLS = 5; // min tool uses between warnings
28
28
 
29
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 Antigravity
32
+ // kills the process and reports "hook error". See #775.
33
+ const stdinTimeout = setTimeout(() => process.exit(0), 3000);
30
34
  process.stdin.setEncoding('utf8');
31
35
  process.stdin.on('data', chunk => input += chunk);
32
36
  process.stdin.on('end', () => {
37
+ clearTimeout(stdinTimeout);
33
38
  try {
34
39
  const data = JSON.parse(input);
35
40
  const sessionId = data.session_id;
@@ -95,21 +100,35 @@ process.stdin.on('end', () => {
95
100
  warnData.lastLevel = currentLevel;
96
101
  fs.writeFileSync(warnPath, JSON.stringify(warnData));
97
102
 
98
- // Build warning message
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)
99
109
  let message;
100
110
  if (isCritical) {
101
- message = `CONTEXT MONITOR CRITICAL: Usage at ${usedPct}%. Remaining: ${remaining}%. ` +
102
- 'STOP new work immediately. Save state NOW and inform the user that context is nearly exhausted. ' +
103
- 'If using GSD, run /gsd:pause-work to save execution state.';
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.';
104
119
  } else {
105
- message = `CONTEXT MONITOR WARNING: Usage at ${usedPct}%. Remaining: ${remaining}%. ` +
106
- 'Begin wrapping up current task. Do not start new complex work. ' +
107
- 'If using GSD, consider /gsd:pause-work to save state.';
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.';
108
127
  }
109
128
 
110
129
  const output = {
111
130
  hookSpecificOutput: {
112
- hookEventName: "PostToolUse",
131
+ hookEventName: process.env.GEMINI_API_KEY ? "AfterTool" : "PostToolUse",
113
132
  additionalContext: message
114
133
  }
115
134
  };
@@ -8,9 +8,13 @@ const os = require('os');
8
8
 
9
9
  // Read JSON from stdin
10
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);
11
14
  process.stdin.setEncoding('utf8');
12
15
  process.stdin.on('data', chunk => input += chunk);
13
16
  process.stdin.on('end', () => {
17
+ clearTimeout(stdinTimeout);
14
18
  try {
15
19
  const data = JSON.parse(input);
16
20
  const model = data.model?.display_name || 'Antigravity';
@@ -18,14 +22,15 @@ process.stdin.on('end', () => {
18
22
  const session = data.session_id || '';
19
23
  const remaining = data.context_window?.remaining_percentage;
20
24
 
21
- // Context window display (shows USED percentage scaled to 80% limit)
22
- // Antigravity enforces an 80% context limit, so we scale to show 100% at that point
25
+ // Context window display (shows USED percentage scaled to usable context)
26
+ // Antigravity 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;
23
29
  let ctx = '';
24
30
  if (remaining != null) {
25
- const rem = Math.round(remaining);
26
- const rawUsed = Math.max(0, Math.min(100, 100 - rem));
27
- // Scale: 80% real usage = 100% displayed
28
- const used = Math.min(100, Math.round((rawUsed / 80) * 100));
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)));
29
34
 
30
35
  // Write context metrics to bridge file for the context-monitor PostToolUse hook.
31
36
  // The monitor reads this file to inject agent-facing warnings when context is low.
@@ -48,12 +53,12 @@ process.stdin.on('end', () => {
48
53
  const filled = Math.floor(used / 10);
49
54
  const bar = '█'.repeat(filled) + '░'.repeat(10 - filled);
50
55
 
51
- // Color based on scaled usage (thresholds adjusted for new scale)
52
- if (used < 63) { // ~50% real
56
+ // Color based on usable context thresholds
57
+ if (used < 50) {
53
58
  ctx = ` \x1b[32m${bar} ${used}%\x1b[0m`;
54
- } else if (used < 81) { // ~65% real
59
+ } else if (used < 65) {
55
60
  ctx = ` \x1b[33m${bar} ${used}%\x1b[0m`;
56
- } else if (used < 95) { // ~76% real
61
+ } else if (used < 80) {
57
62
  ctx = ` \x1b[38;5;208m${bar} ${used}%\x1b[0m`;
58
63
  } else {
59
64
  ctx = ` \x1b[5;31m💀 ${bar} ${used}%\x1b[0m`;
@@ -63,7 +68,9 @@ process.stdin.on('end', () => {
63
68
  // Current task from todos
64
69
  let task = '';
65
70
  const homeDir = os.homedir();
66
- const todosDir = path.join(homeDir, '.gemini', 'antigravity', 'todos');
71
+ // Respect CLAUDE_CONFIG_DIR for custom config directory setups (#870)
72
+ const claudeDir = process.env.CLAUDE_CONFIG_DIR || path.join(homeDir, '.antigravity');
73
+ const todosDir = path.join(claudeDir, 'todos');
67
74
  if (session && fs.existsSync(todosDir)) {
68
75
  try {
69
76
  const files = fs.readdirSync(todosDir)
@@ -85,7 +92,7 @@ process.stdin.on('end', () => {
85
92
 
86
93
  // GSD update available?
87
94
  let gsdUpdate = '';
88
- const cacheFile = path.join(homeDir, '.gemini', 'antigravity', 'cache', 'gsd-update-check.json');
95
+ const cacheFile = path.join(claudeDir, 'cache', 'gsd-update-check.json');
89
96
  if (fs.existsSync(cacheFile)) {
90
97
  try {
91
98
  const cache = JSON.parse(fs.readFileSync(cacheFile, 'utf8'));
@@ -4,7 +4,7 @@
4
4
  const fs = require('fs');
5
5
  const path = require('path');
6
6
  const { execSync } = require('child_process');
7
- const { safeReadFile, loadConfig, isGitIgnored, execGit, normalizePhaseName, comparePhaseNum, getArchivedPhaseDirs, generateSlugInternal, getMilestoneInfo, resolveModelInternal, MODEL_PROFILES, output, error, findPhaseInternal } = require('./core.cjs');
7
+ const { safeReadFile, loadConfig, isGitIgnored, execGit, normalizePhaseName, comparePhaseNum, getArchivedPhaseDirs, generateSlugInternal, getMilestoneInfo, resolveModelInternal, MODEL_PROFILES, toPosixPath, output, error, findPhaseInternal } = require('./core.cjs');
8
8
  const { extractFrontmatter } = require('./frontmatter.cjs');
9
9
 
10
10
  function cmdGenerateSlug(text, raw) {
@@ -68,7 +68,7 @@ function cmdListTodos(cwd, area, raw) {
68
68
  created: createdMatch ? createdMatch[1].trim() : 'unknown',
69
69
  title: titleMatch ? titleMatch[1].trim() : 'Untitled',
70
70
  area: todoArea,
71
- path: path.join('.planning', 'todos', 'pending', file),
71
+ path: toPosixPath(path.join('.planning', 'todos', 'pending', file)),
72
72
  });
73
73
  } catch {}
74
74
  }
@@ -528,7 +528,7 @@ function cmdScaffold(cwd, type, options, raw) {
528
528
  }
529
529
 
530
530
  fs.writeFileSync(filePath, content, 'utf-8');
531
- const relPath = path.relative(cwd, filePath);
531
+ const relPath = toPosixPath(path.relative(cwd, filePath));
532
532
  output({ created: true, path: relPath }, raw, relPath);
533
533
  }
534
534
 
@@ -37,6 +37,13 @@ function cmdConfigEnsureSection(cwd, raw) {
37
37
  try {
38
38
  if (fs.existsSync(globalDefaultsPath)) {
39
39
  userDefaults = JSON.parse(fs.readFileSync(globalDefaultsPath, 'utf-8'));
40
+ // Migrate deprecated "depth" key to "granularity"
41
+ if ('depth' in userDefaults && !('granularity' in userDefaults)) {
42
+ const depthToGranularity = { quick: 'coarse', standard: 'standard', comprehensive: 'fine' };
43
+ userDefaults.granularity = depthToGranularity[userDefaults.depth] || userDefaults.depth;
44
+ delete userDefaults.depth;
45
+ try { fs.writeFileSync(globalDefaultsPath, JSON.stringify(userDefaults, null, 2), 'utf-8'); } catch {}
46
+ }
40
47
  }
41
48
  } catch (err) {
42
49
  // Ignore malformed global defaults, fall back to hardcoded
@@ -54,7 +61,7 @@ function cmdConfigEnsureSection(cwd, raw) {
54
61
  research: true,
55
62
  plan_check: true,
56
63
  verifier: true,
57
- nyquist_validation: false,
64
+ nyquist_validation: true,
58
65
  },
59
66
  parallelization: true,
60
67
  brave_search: hasBraveSearch,