gsdd-cli 0.2.0 → 0.16.1

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 (43) hide show
  1. package/README.md +67 -34
  2. package/agents/DISTILLATION.md +15 -13
  3. package/agents/planner.md +2 -0
  4. package/bin/adapters/agents.mjs +1 -0
  5. package/bin/adapters/claude.mjs +12 -3
  6. package/bin/adapters/codex.mjs +4 -0
  7. package/bin/adapters/opencode.mjs +13 -4
  8. package/bin/gsdd.mjs +64 -39
  9. package/bin/lib/cli-utils.mjs +1 -1
  10. package/bin/lib/file-ops.mjs +161 -0
  11. package/bin/lib/health-truth.mjs +188 -0
  12. package/bin/lib/health.mjs +65 -12
  13. package/bin/lib/init-flow.mjs +267 -0
  14. package/bin/lib/init-prompts.mjs +247 -0
  15. package/bin/lib/init-runtime.mjs +226 -0
  16. package/bin/lib/init.mjs +19 -378
  17. package/bin/lib/models.mjs +19 -4
  18. package/bin/lib/phase.mjs +100 -14
  19. package/bin/lib/plan-constants.mjs +30 -0
  20. package/bin/lib/provenance.mjs +146 -0
  21. package/bin/lib/templates.mjs +17 -0
  22. package/distilled/DESIGN.md +625 -41
  23. package/distilled/EVIDENCE-INDEX.md +297 -0
  24. package/distilled/README.md +49 -21
  25. package/distilled/SKILL.md +89 -85
  26. package/distilled/templates/agents.block.md +13 -82
  27. package/distilled/templates/agents.md +0 -7
  28. package/distilled/templates/delegates/plan-checker.md +11 -4
  29. package/distilled/workflows/audit-milestone.md +7 -5
  30. package/distilled/workflows/complete-milestone.md +297 -0
  31. package/distilled/workflows/execute.md +188 -19
  32. package/distilled/workflows/map-codebase.md +14 -7
  33. package/distilled/workflows/new-milestone.md +249 -0
  34. package/distilled/workflows/new-project.md +28 -24
  35. package/distilled/workflows/pause.md +42 -6
  36. package/distilled/workflows/plan-milestone-gaps.md +183 -0
  37. package/distilled/workflows/plan.md +78 -13
  38. package/distilled/workflows/progress.md +42 -19
  39. package/distilled/workflows/quick.md +171 -8
  40. package/distilled/workflows/resume.md +121 -11
  41. package/distilled/workflows/verify-work.md +260 -0
  42. package/distilled/workflows/verify.md +124 -33
  43. package/package.json +9 -7
package/README.md CHANGED
@@ -1,20 +1,20 @@
1
1
  <div align="center">
2
2
 
3
- # GSD Distilled
3
+ # Northline
4
4
 
5
- **A portable, spec-driven development kernel for AI coding agents.**
5
+ **A repo-native workflow kernel for long-horizon AI software delivery.**
6
6
 
7
- Extracted from [Get Shit Done](https://github.com/gsd-build/get-shit-done). Same long-horizon delivery spine fewer moving parts.
7
+ Northline gives long-horizon AI-assisted software work one repo-native planning, execution, verification, and handoff spine so progress survives runtime switching and session loss. The package and CLI remain `gsdd-cli` / `gsdd`.
8
8
 
9
9
  [![npm version](https://img.shields.io/npm/v/gsdd-cli?style=for-the-badge&logo=npm&logoColor=white&color=CB3837)](https://www.npmjs.com/package/gsdd-cli)
10
10
  [![License](https://img.shields.io/badge/license-MIT-blue?style=for-the-badge)](LICENSE)
11
- [![Tests](https://img.shields.io/badge/assertions-862_passing-brightgreen?style=for-the-badge)](tests/)
12
11
 
13
12
  ```bash
14
13
  npx gsdd-cli init
15
14
  ```
16
15
 
17
- **Works with Claude Code, OpenCode, Codex CLI, Cursor, Copilot, and Gemini CLI.**
16
+ **Directly validated today:** Claude Code, Codex CLI, and OpenCode.
17
+ **Qualified support:** Cursor, Copilot, and Gemini CLI use the same portable skill surfaces, but this launch does not present them as parity-validated runtimes.
18
18
 
19
19
  </div>
20
20
 
@@ -22,7 +22,11 @@ npx gsdd-cli init
22
22
 
23
23
  ## What This Is
24
24
 
25
- GSDD is a distilled fork of GSD. It preserves the high-leverage parts of long-horizon AI-assisted development:
25
+ Northline gives serious AI-assisted software work one repo-native planning, execution, verification, and handoff spine so progress survives long horizons, runtime switching, and session loss without turning into a dashboard or orchestration control plane.
26
+
27
+ The current package and CLI stay `gsdd-cli` and `gsdd`. Northline is the public product brand layered on top of that stable install surface.
28
+
29
+ It preserves the high-leverage parts of long-horizon AI-assisted development:
26
30
 
27
31
  - **Persistent artifacts** — SPEC.md, ROADMAP.md, and config.json as the durable workspace
28
32
  - **Codebase mapping** — 4 parallel mappers produce STACK, ARCHITECTURE, CONVENTIONS, CONCERNS
@@ -32,9 +36,9 @@ GSDD is a distilled fork of GSD. It preserves the high-leverage parts of long-ho
32
36
  - **Milestone audit** — cross-phase integration, requirements coverage, E2E flows
33
37
  - **Session management** — pause work with checkpoint, resume with context restoration and routing
34
38
 
35
- What it strips: GSD's broader operator surface (32 workflows, 11 agents, discovery modes, sprint ceremony, a settings flow, and additional operator ergonomics). GSDD has 10 workflows and 10 roles.
39
+ What it strips: GSD's broader operator surface (32 workflows, 11 agents, discovery modes, sprint ceremony, a settings flow, and additional operator ergonomics). Northline keeps 14 workflows and 10 roles.
36
40
 
37
- **Target user:** Developer or small team that wants a spec-driven long-horizon kernel, not full operator comfort.
41
+ **Target user:** Developer or small team that wants a repo-native, spec-driven workflow kernel with durable proof and handoff, not a dashboard or orchestration control plane.
38
42
 
39
43
  ---
40
44
 
@@ -48,17 +52,32 @@ This creates:
48
52
 
49
53
  1. `.planning/` — durable workspace with templates, role contracts, and config
50
54
  2. `.agents/skills/gsdd-*` — portable workflow entrypoints
51
- 3. Tool-specific adapters if detected (Claude skills/commands/agents, OpenCode commands/agents, Codex agents)
55
+ 3. Tool-specific adapters you choose in the install wizard (Claude skills/commands/agents, OpenCode commands/agents, Codex agents, optional governance)
52
56
 
53
57
  Then run the new-project workflow to produce `.planning/SPEC.md` and `.planning/ROADMAP.md`.
54
58
 
59
+ In a terminal, `gsdd init` now opens a guided install wizard:
60
+
61
+ - Step 1: select the runtimes/vendors you want to support
62
+ - Step 2: decide separately whether repo-wide `AGENTS.md` governance is worth installing
63
+ - Step 3: configure planning defaults in the same guided flow
64
+
65
+ Portable `.agents/skills/gsdd-*` skills are always generated. The wizard controls extra native adapters and optional governance, not the portable baseline.
66
+
67
+ ### Launch Proof Status
68
+
69
+ - **Directly validated in this repo:** Claude Code, Codex CLI, and OpenCode have recorded `plan -> execute -> verify` evidence for the core lifecycle.
70
+ - **Qualified support:** Cursor, Copilot, and Gemini CLI use the shared `.agents/skills/` surface plus optional governance, but this launch does not describe them as equally proven native runtimes.
71
+
55
72
  ### Quickstart (after init)
56
73
 
57
74
  Your tool determines how you invoke workflows:
58
75
 
59
- - **Claude Code / OpenCode:** Use slash commands directly — `/gsdd-new-project`, `/gsdd-plan`, etc.
76
+ - **Claude Code / OpenCode / Cursor / Copilot / Gemini:** Use slash commands directly — `/gsdd-new-project`, `/gsdd-plan`, etc.
60
77
  - **Codex CLI:** Use skill references — `$gsdd-new-project`, `$gsdd-plan`, etc.
61
- - **Cursor / Copilot / Gemini / Others:** Open `.agents/skills/gsdd-<workflow>/SKILL.md` and follow the instructions. The root `AGENTS.md` governance block keeps the agent on track.
78
+ - **Other AI tools:** Open `.agents/skills/gsdd-<workflow>/SKILL.md` and follow the instructions.
79
+
80
+ If you generate the root `AGENTS.md` block, it adds GSDD behavioral governance. For Cursor, Copilot, and Gemini, that governance is optional discipline on top of native skill discovery — not the mechanism that makes workflows discoverable.
62
81
 
63
82
  First workflow to run: **new-project** — it asks about your goals, audits the codebase (if brownfield), and produces `.planning/SPEC.md` + `.planning/ROADMAP.md`.
64
83
 
@@ -67,21 +86,23 @@ First workflow to run: **new-project** — it asks about your goals, audits the
67
86
  GSDD generates adapters for whichever tools you use:
68
87
 
69
88
  ```bash
70
- npx gsdd-cli init # Auto-detect installed tools
89
+ npx gsdd-cli init # Guided install wizard (detected runtimes preselected)
71
90
  npx gsdd-cli init --tools claude # Claude Code: .claude/skills + commands + agents
72
91
  npx gsdd-cli init --tools opencode # OpenCode: .opencode/commands + agents
73
92
  npx gsdd-cli init --tools codex # Codex CLI: portable gsdd-plan skill + .codex/agents checker
74
93
  npx gsdd-cli init --tools agents # Root AGENTS.md fallback
94
+ npx gsdd-cli init --tools cursor # Backward-compatible AGENTS.md governance alias
75
95
  npx gsdd-cli init --tools all # All of the above
76
96
  ```
77
97
 
78
- | Platform | Tier | What's generated |
79
- |----------|------|-----------------|
80
- | **All** (default) | Open standard | `.agents/skills/gsdd-*/SKILL.md` — portable workflow entrypoints (always generated) |
81
- | **Claude Code** | Native | `.claude/skills/`, `.claude/commands/`, `.claude/agents/` — slash commands work immediately |
82
- | **OpenCode** | Native | `.opencode/commands/`, `.opencode/agents/` — slash commands work immediately |
83
- | **Codex CLI** | Native | `.codex/agents/gsdd-plan-checker.toml` — skill reference `$gsdd-plan` works immediately |
84
- | **Cursor / Copilot / Gemini** | Governance | Root `AGENTS.md` block governs agent behavior; invoke workflows by opening `.agents/skills/gsdd-*/SKILL.md` directly |
98
+ | Platform | Public claim | What's generated |
99
+ |----------|--------------|-----------------|
100
+ | **All** (default) | Shared portable surface | `.agents/skills/gsdd-*/SKILL.md` — portable workflow entrypoints (always generated) |
101
+ | **Claude Code** | Directly validated | `.claude/skills/`, `.claude/commands/`, `.claude/agents/` — native workflow surfaces |
102
+ | **OpenCode** | Directly validated | `.opencode/commands/`, `.opencode/agents/` — native workflow surfaces |
103
+ | **Codex CLI** | Directly validated | Portable skill entry plus `.codex/agents/gsdd-plan-checker.toml` |
104
+ | **Cursor / Copilot / Gemini** | Qualified support | Skills-native discovery from `.agents/skills/`; optional root `AGENTS.md` block adds behavioral governance |
105
+ | **Other AI tools** | Fallback only | Open `.agents/skills/gsdd-*/SKILL.md` directly |
85
106
 
86
107
  ### Updating
87
108
 
@@ -102,10 +123,13 @@ npx gsdd-cli init --auto --tools claude --brief path/to/PRD.md
102
123
 
103
124
  `--auto` skips interactive prompts, uses smart defaults (`autoAdvance: true` in config). `--brief` copies a project document to `.planning/PROJECT_BRIEF.md` for `new-project` to consume.
104
125
 
126
+ If you already know exactly what to generate, `--tools ...` remains the manual path. The wizard is the primary onboarding UX; flags remain the advanced/headless contract.
127
+
105
128
  ### Team Use
106
129
 
107
130
  - **Shared state:** Set `commitDocs: true` (default) — `.planning/` is tracked in git. Everyone sees the same spec, roadmap, and phase plans.
108
131
  - **Onboarding:** After cloning, run `npx gsdd-cli init` to generate tool-specific adapters. `.planning/` is already tracked — no re-initialization needed.
132
+ - **Governance is explicit:** The wizard asks separately whether to install repo-wide `AGENTS.md` rules, and explains why you may care before writing to the repo root.
109
133
  - **Session handoff:** Use `gsdd-pause` / `gsdd-resume` to hand off work. The checkpoint (`.planning/.continue-here.md`) captures context for the next person.
110
134
  - **Adapter isolation:** Each developer runs `gsdd init --tools <their-tool>`. Adapter files don't conflict across tools.
111
135
 
@@ -192,7 +216,8 @@ When all phases are done, run `gsdd-audit-milestone` to verify:
192
216
 
193
217
  - `Claude Code / OpenCode`: `/gsdd-quick`
194
218
  - `Codex CLI`: `$gsdd-quick`
195
- - `Cursor / Copilot / Gemini / Others`: open `.agents/skills/gsdd-quick/SKILL.md`
219
+ - `Cursor / Copilot / Gemini`: `/gsdd-quick`
220
+ - `Other AI tools`: open `.agents/skills/gsdd-quick/SKILL.md`
196
221
 
197
222
  For sub-hour tasks that don't need the full phase cycle:
198
223
 
@@ -209,7 +234,7 @@ Use for: bug fixes, small features, config changes, one-off tasks.
209
234
 
210
235
  ## Workflows
211
236
 
212
- GSDD has 10 workflows, run via generated skills or adapters:
237
+ GSDD has 14 workflows, run via generated skills or adapters:
213
238
 
214
239
  | Workflow | What it does |
215
240
  |----------|--------------|
@@ -218,7 +243,11 @@ GSDD has 10 workflows, run via generated skills or adapters:
218
243
  | `gsdd-plan` | Research + plan + check for a phase |
219
244
  | `gsdd-execute` | Execute phase plan: implement tasks, verify changes |
220
245
  | `gsdd-verify` | Verify completed phase: 3-level checks, anti-pattern scan |
246
+ | `gsdd-verify-work` | Conversational UAT testing: validate user-facing behavior with structured gap tracking |
221
247
  | `gsdd-audit-milestone` | Audit milestone: cross-phase integration, requirements coverage, E2E flows |
248
+ | `gsdd-complete-milestone` | Archive shipped milestone, evolve spec, collapse roadmap |
249
+ | `gsdd-new-milestone` | Start next milestone: gather goals, define requirements, create roadmap phases |
250
+ | `gsdd-plan-milestone-gaps` | Create gap-closure phases from audit results |
222
251
  | `gsdd-quick` | Quick task: plan and execute sub-hour work outside the phase cycle |
223
252
  | `gsdd-pause` | Pause work: save session context to checkpoint for seamless resumption |
224
253
  | `gsdd-resume` | Resume work: restore context from artifacts and route to next action |
@@ -231,7 +260,8 @@ Workflows are agent skills or commands, not plain shell utilities. How you invok
231
260
  | Claude Code | `/gsdd-plan` (slash command, works immediately after init) |
232
261
  | OpenCode | `/gsdd-plan` (slash command, works immediately after init) |
233
262
  | Codex CLI | `$gsdd-plan` (skill reference, works immediately after init) |
234
- | Cursor / Copilot / Gemini | Open `.agents/skills/gsdd-plan/SKILL.md` and paste or reference its content. The `AGENTS.md` governance block steers agent behavior. |
263
+ | Cursor / Copilot / Gemini | `/gsdd-plan` (skills-native slash command). If the root `AGENTS.md` block is present, it adds governance, not workflow discovery. |
264
+ | Other AI tools | Open `.agents/skills/gsdd-plan/SKILL.md` and paste or reference its content. |
235
265
 
236
266
  ## CLI Commands
237
267
 
@@ -240,7 +270,9 @@ Workflows are agent skills or commands, not plain shell utilities. How you invok
240
270
  | `gsdd init [--tools <platform>]` | Set up `.planning/`, generate adapters |
241
271
  | `gsdd update [--tools <platform>] [--templates]` | Regenerate adapters; `--templates` refreshes `.planning/templates/` and role contracts |
242
272
  | `gsdd health [--json]` | Check workspace integrity (healthy/degraded/broken) |
273
+ | `gsdd file-op <copy\|delete\|regex-sub>` | Run deterministic workspace-confined file copy, delete, and regex substitution |
243
274
  | `gsdd find-phase [N]` | Show phase info as JSON (for agent consumption) |
275
+ | `gsdd phase-status <N> <status>` | Update a single ROADMAP phase status through the status-aware helper |
244
276
  | `gsdd verify <N>` | Run artifact checks for phase N |
245
277
  | `gsdd scaffold phase <N> [name]` | Create a new phase plan file |
246
278
  | `gsdd models [show\|profile\|set\|...]` | Inspect and manage model profile propagation |
@@ -277,16 +309,17 @@ GSDD consolidates GSD's agent surface into 10 roles with durable contracts:
277
309
 
278
310
  GSDD generates vendor-specific files from vendor-agnostic markdown — it does not convert from one vendor format to another. This means every adapter gets first-class output shaped to its platform's native capabilities.
279
311
 
280
- | Adapter | Kind | Strategy |
281
- |---------|------|----------|
282
- | **Claude Code** | `native_capable` | Skill-primary plan surface (stays in main context to spawn checker subagent), thin command alias, native `gsdd-plan-checker` agent |
283
- | **OpenCode** | `native_capable` | Specialized `/gsdd-plan` command (`subtask: false`), hidden `gsdd-plan-checker` subagent (`mode: subagent`) |
284
- | **Codex CLI** | `native_capable` | Portable skill as entry surface, `.codex/agents/gsdd-plan-checker.toml` (read-only, high reasoning effort) |
285
- | **Cursor / Copilot / Gemini** | `governance_only` | Root `AGENTS.md` block governs agent behavior; invoke workflows by opening `.agents/skills/gsdd-*/SKILL.md` directly |
312
+ | Adapter | Evidence posture | Strategy |
313
+ |---------|------------------|----------|
314
+ | **Claude Code** | Directly validated | Skill-primary plan surface, thin command alias, native `gsdd-plan-checker` agent |
315
+ | **OpenCode** | Directly validated | Specialized `/gsdd-plan` command (`subtask: false`), hidden `gsdd-plan-checker` subagent (`mode: subagent`) |
316
+ | **Codex CLI** | Directly validated | Portable skill as entry surface, `.codex/agents/gsdd-plan-checker.toml` (read-only, high reasoning effort) |
317
+ | **Cursor / Copilot / Gemini** | Qualified support | Runtime discovers `.agents/skills/` natively; optional root `AGENTS.md` block adds behavioral governance only |
318
+ | **agents** (`--tools agents`) | Governance-only helper | Root `AGENTS.md` block for tools that benefit from governance or need open-standard fallback guidance |
286
319
 
287
320
  All adapters render the plan-checker from a single source (`distilled/templates/delegates/plan-checker.md`). Each adapter shapes the output to its platform's native mechanics, and the portable skill remains the shared workflow source.
288
321
 
289
- Cursor, Copilot, and Gemini CLI generate the same root `AGENTS.md` governance block as `--tools agents`. They do not have native adapter surfaces invoke workflows by opening `.agents/skills/gsdd-*/SKILL.md` directly.
322
+ Cursor, Copilot, and Gemini CLI generate the same root `AGENTS.md` governance block as `--tools agents`, but that file is governance only. Those runtimes already discover `.agents/skills/` natively and surface the workflows as slash commands.
290
323
 
291
324
  Model IDs pass through a two-layer injection guard: a regex whitelist (`/^[a-zA-Z0-9._\/:@-]+$/`) at the CLI boundary, plus format-specific escaping (TOML string escaping, triple-quote break prevention) at the adapter layer.
292
325
 
@@ -410,7 +443,7 @@ For detailed troubleshooting and recovery procedures, see the [User Guide](docs/
410
443
 
411
444
  ## Design Decisions
412
445
 
413
- GSDD makes 29 documented design decisions relative to GSD, each with evidence from source files and external research. See [`distilled/DESIGN.md`](distilled/DESIGN.md) for the full rationale.
446
+ GSDD makes 39 documented design decisions relative to GSD, each with evidence from source files and external research. See [`distilled/DESIGN.md`](distilled/DESIGN.md) for the full rationale.
414
447
 
415
448
  Key choices:
416
449
  - **4-file codebase standard** — drop state that rots (STRUCTURE, INTEGRATIONS, TESTING), keep rules that don't
@@ -428,7 +461,7 @@ Key choices:
428
461
 
429
462
  ## Testing
430
463
 
431
- GSDD has 862 structural assertions across 9 test files — 41 named suites that guard properties PRs repeatedly fixed manually. These are not unit tests for application code; they are invariant checks on the specification itself.
464
+ GSDD has 1228 structural assertions across 10 test files — named suites that guard properties PRs repeatedly fixed manually. These are not unit tests for application code; they are invariant checks on the specification itself.
432
465
 
433
466
  ### Invariant Suites (I-series)
434
467
 
@@ -440,7 +473,7 @@ Structural contracts that prevent drift between roles, delegates, workflows, and
440
473
  | **I2** | Role section structure — 10 roles have role def, scope, output format, success criteria |
441
474
  | **I3** | Delegate thinness — no leaked role-contract sections in delegates |
442
475
  | **I3-gate** | New-project approval gates — required human checkpoints present |
443
- | **I4** | Workflow references — 10 workflows, all delegate/role refs resolve |
476
+ | **I4** | Workflow references — 14 workflows, all delegate/role refs resolve |
444
477
  | **I5** | Session management — no vendor APIs, no STATE.md, checkpoint contract |
445
478
  | **I5b** | Session workflow scope boundaries |
446
479
  | **I6** | Artifact schema definitions |
@@ -500,7 +533,7 @@ Golden-path eval tests that verify artifact-chain contracts across end-to-end wo
500
533
  | Health | Pre-init guard, all check categories, verdict logic, JSON/human output |
501
534
 
502
535
  ```bash
503
- npm run test:gsdd
536
+ npm test
504
537
  ```
505
538
 
506
539
  ---
@@ -511,7 +544,7 @@ GSDD is a distilled fork of [Get Shit Done](https://github.com/gsd-build/get-shi
511
544
 
512
545
  **What GSDD preserves** (~76% of core method): the long-horizon delivery spine — persistent artifacts, codebase mapping, scoped planning, execution, verification, and milestone auditing.
513
546
 
514
- **What GSDD does not cover** (~44% of full upstream surface): GSD currently exposes 32 workflow files and 11 agent files including discovery modes, a settings flow, extra operator ergonomics, and broader session-management/control-plane surface area. GSDD intentionally does not recreate this full surface.
547
+ **What GSDD does not cover** (~44% of full upstream surface): GSD currently exposes 32 workflow files and 11 agent files including discovery modes, a settings flow, extra operator ergonomics, and broader session-management surface area. GSDD intentionally does not recreate this full surface.
515
548
 
516
549
  **The trade-off:** Fewer moving parts for the human operator. Cleaner role contracts and a simpler artifact model. But reduced operator comfort and limited control-plane features (no telemetry, no artifact linting). Health diagnostics are available via `gsdd health`.
517
550
 
@@ -356,21 +356,23 @@ Do not add speculative content. Every entry must reference actual source files a
356
356
 
357
357
  Cross-source best practices applied to GSDD role contracts, audited against 6 external resources. These principles govern how role contracts should be written and revised. Ranked by impact.
358
358
 
359
+ > **Source note:** "Anthropic CE" in this section refers to Anthropic's "Building effective agents" (Dec 2024) for orchestration and sub-agent patterns, and LangChain's "Context Engineering for Agents" (2025) for Write/Select/Compress/Isolate context management patterns. They are cited separately where attribution is precise.
360
+
359
361
  ### Architecture-Level (highest leverage)
360
362
 
361
363
  | Principle | What It Means | Source | GSDD Implementation |
362
364
  |-----------|--------------|--------|---------------------|
363
- | **Context isolation** | Research and heavy reads go in subagents; only compressed summaries enter the main context | Anthropic CE: "sub-agents perform deep technical work, returning condensed summaries" | Approach explorer research subagents return ~1000-token summaries; plan-checker runs in fresh context |
364
- | **JIT context loading** | Never say "read everything." Specify what to extract from each file | Anthropic CE: "maintain lightweight identifiers and use these references to dynamically load data into context at runtime" | `<input_contract>` with extraction guidance: "From SPEC.md read ONLY locked decisions" |
365
- | **Intermediate persistence** | For long interactions, write confirmed state to disk incrementally | Anthropic CE: "Agent regularly writes notes persisted to memory outside of the context window" | Approach explorer writes decisions to disk as they're confirmed during conversation |
366
- | **Progressive disclosure** | Don't front-load all context; let agents discover incrementally | Anthropic CE: "agents can assemble understanding layer by layer" | Gray areas presented individually; research loaded per area on demand |
365
+ | **Context isolation** | Research and heavy reads go in subagents; only compressed summaries enter the main context | Anthropic "Building effective agents" (Dec 2024): orchestrator-worker pattern — sub-agents do deep technical work and return condensed summaries | Approach explorer research subagents return ~1000-token summaries; plan-checker runs in fresh context |
366
+ | **JIT context loading** | Never say "read everything." Specify what to extract from each file | LangChain "Context Engineering for Agents" (2025): Select step of Write/Select/Compress/Isolate load only the specific content needed, not full files | `<input_contract>` with extraction guidance: "From SPEC.md read ONLY locked decisions" |
367
+ | **Intermediate persistence** | For long interactions, write confirmed state to disk incrementally | Anthropic BEA: agent memory outside context window. LangChain CE: Write pattern confirmed state persisted to disk | Approach explorer writes decisions to disk as they're confirmed during conversation |
368
+ | **Progressive disclosure** | Don't front-load all context; let agents discover incrementally | LangChain CE: Compress/Isolate patterns — agents assemble understanding incrementally rather than loading everything upfront | Gray areas presented individually; research loaded per area on demand |
367
369
 
368
370
  ### Prompt Structure (medium leverage)
369
371
 
370
372
  | Principle | What It Means | Source | GSDD Implementation |
371
373
  |-----------|--------------|--------|---------------------|
372
374
  | **XML semantic structure** | Use XML tags to separate role, instructions, examples, inputs, outputs, anti-patterns | Anthropic Claude: "XML tags help Claude parse complex prompts unambiguously" | All roles use `<role>`, most use `<quality_guarantees>`, `<anti_patterns>`. Approach-explorer adds `<algorithm>`, `<examples>`, `<scope_guardrail>` |
373
- | **Anti-patterns early** | Place "don't do this" instructions near the top, after role definition | Anthropic CE: critical information at the beginning gets more attention. NeoLab: early placement for high attention weight | `<anti_patterns>` placed immediately after `<role>` in all roles that have them |
375
+ | **Anti-patterns early** | Place "don't do this" instructions near the top, after role definition | Anthropic Claude prompting docs: critical information at the beginning receives more attention (primacy effect in long-context prompts) | `<anti_patterns>` placed immediately after `<role>` in all roles that have them |
374
376
  | **Few-shot examples** | Show the pattern of interaction, not just output format | Anthropic Claude: "3-5 examples for best results." Examples in `<example>` tags | Approach-explorer: 3 examples. Other roles use inline format examples within algorithm sections |
375
377
  | **Self-check before output** | Run an explicit checklist before producing the final artifact | OpenAI: "verification loops." Anthropic Claude: "Ask Claude to self-check" | Approach-explorer step 7; planner `<plan_self_check>`; executor completion verification |
376
378
  | **Scope boundaries with heuristics** | Don't just list in/out of scope — give the agent a judgment rule | Novel, validated in approach-explorer | "Does this clarify implementation within the phase, or does it add a capability that could be its own phase?" |
@@ -379,7 +381,7 @@ Cross-source best practices applied to GSDD role contracts, audited against 6 ex
379
381
 
380
382
  | Principle | What It Means | Source | GSDD Implementation |
381
383
  |-----------|--------------|--------|---------------------|
382
- | **Authority language: intentional leverage** | Anthropic Claude 4.6 warns "CRITICAL:" can overtrigger on newer models. NeoLab persuasion research found imperative language doubled compliance (33%→72%). GSDD decision: **keep CRITICAL: for mandatory initial-read** — this is a genuine compliance-critical instruction where skipping it causes cascading failures. Use normal language for non-critical instructions. | Anthropic Claude 4.6 vs. NeoLab persuasion research (direct conflict). GSDD sides with NeoLab for this specific use case | `CRITICAL: Mandatory initial read` kept in all 7 roles. `NEVER` kept for security (mapper secret protection). Normal language used for algorithm steps, scope guidance, and quality rules |
384
+ | **Authority language: intentional leverage** | Anthropic Claude warns "CRITICAL:" can overtrigger on newer models. GSDD decision: **keep CRITICAL: for mandatory initial-read** — a genuine compliance-critical instruction where skipping causes cascading failures. Emphasis markers work when rare and specific (signal-to-noise principle: one CRITICAL: in a role contract is a load-bearing gate; ten would be noise). Use normal language for algorithm steps, scope guidance, and quality rules. | Anthropic Claude prompting docs (overtriggering caution) + technical writing signal-to-noise principle. GSDD applies the caution selectively: only compliance-critical context gates use CRITICAL: | `CRITICAL: Mandatory initial read` kept in all 7 roles. `NEVER` kept for security (mapper secret protection). Normal language used for algorithm steps, scope guidance, and quality rules |
383
385
  | **Tell what to do, not just what not to do** | Anti-patterns alone are insufficient; pair with positive instructions | Anthropic Claude: "Tell Claude what to do instead of what not to do" | Every role has both `<anti_patterns>` AND positive algorithm/process sections |
384
386
  | **Context for instructions** | Explain WHY a rule exists so the agent can generalize | Anthropic Claude: "Providing context or motivation behind your instructions helps Claude better understand your goals" | Research quality rules explain WHY: "Training data is a hypothesis. Verify before asserting." |
385
387
 
@@ -394,17 +396,17 @@ These patterns emerged from GSDD's specific needs and were validated through imp
394
396
  | **5-dimension assumption surfacing** | Forces transparency about inferences vs. confirmed facts, with confidence levels | Approach-explorer step 6 |
395
397
  | **Agent's Discretion delegation** | User can explicitly say "you decide" — reduces fatigue on low-stakes choices | Approach-explorer step 4, planner `<approach_decisions>` |
396
398
  | **Domain classification table** | SEE/CALL/RUN/READ/ORGANIZED determines gray area focus per phase type | Approach-explorer step 2 |
397
- | **Degrees of freedom mapping** | Taste=high freedom, technical=low freedom (research-constrained). Maps to NeoLab's concept | Approach-explorer classification system |
399
+ | **Degrees of freedom mapping** | Taste=high freedom, technical=low freedom (research-constrained). GSDD-originated: applies statistical degrees-of-freedom concept to prompt design scope | Approach-explorer classification system |
398
400
 
399
401
  ### Source Ranking
400
402
 
401
403
  Sources are ranked by soundness for agent prompt design. Higher-ranked sources take precedence when sources disagree.
402
404
 
403
- 1. **Anthropic — Effective Context Engineering for AI Agents** — Architecture-level patterns with real production evidence (Claude Code, Pokémon). Most authoritative for context window management, sub-agent design, and information flow.
404
- 2. **AnthropicClaude Prompting Best Practices (Claude 4.6)** — Model-specific, up-to-date. Critical for behavioral warnings (overtriggering, subagent overuse). Supersedes general guidance for Claude-targeted agents.
405
- 3. **OpenAIPrompt Guidance (GPT-5.4)** — Deepest general-purpose reference. Novel concepts: completeness contracts, verification loops, tool persistence rules, empty result recovery. Model-specific but patterns transfer.
406
- 4. **NeoLab Context Engineering Kit** — Good synthesis. "Degrees of Freedom" concept is useful. Persuasion research contradicts Anthropic on authority language (trust Anthropic for Claude).
407
- 5. **OpenAI Cookbook — Meta-Prompting** — Narrow scope: LLM-as-judge evaluation, iterative prompt refinement. Useful technique, not a framework.
405
+ 1. **Anthropic — "Building effective agents" (Dec 2024)** — Agent architecture patterns with production evidence (Claude Code). Most authoritative for orchestrator-worker design, sub-agent fresh context, and task decomposition.
406
+ 2. **LangChain"Context Engineering for Agents" (2025)** — Write/Select/Compress/Isolate framework. Most authoritative for context window management, JIT loading, and information flow patterns.
407
+ 3. **AnthropicClaude Prompting Best Practices (Claude 4.6)** — Model-specific, up-to-date. Critical for behavioral warnings (overtriggering, subagent overuse). Supersedes general guidance for Claude-targeted agents.
408
+ 4. **OpenAI Prompt Guidance (GPT-5.4)** — Deepest general-purpose reference. Novel concepts: completeness contracts, verification loops, tool persistence rules, empty result recovery. Model-specific but patterns transfer.
409
+ 5. **OpenAI Cookbook — Meta-Prompting** — Narrow scope: LLM-as-judge evaluation, iterative prompt refinement. Useful technique, not a framework. See also: Suzgun & Kalai "Meta-Prompting" (2024, arXiv 2401.12954).
408
410
  6. **JBurlison/MetaPrompts** — Structural skeleton (agent/skill/prompt/instruction hierarchy). Minimal actual guidance on prompt quality.
409
411
 
410
412
  ### Key Discrepancy Resolution
@@ -413,7 +415,7 @@ When sources conflict, these resolutions apply:
413
415
 
414
416
  | Conflict | Resolution | Why |
415
417
  |----------|------------|-----|
416
- | Authority language ("YOU MUST" vs. normal) | Keep CRITICAL: for mandatory initial-read (compliance-critical). Use normal language elsewhere | NeoLab's doubled-compliance research applies to instructions where skipping causes cascading failures. Anthropic's overtriggering concern applies to general guidance, not load-bearing context gates |
418
+ | Authority language ("YOU MUST" vs. normal) | Keep CRITICAL: for mandatory initial-read (compliance-critical). Use normal language elsewhere | Emphasis markers work when rare and specific (signal-to-noise). Anthropic's overtriggering concern applies to general guidance; a single CRITICAL: for a mandatory context gate is a load-bearing instruction, not noise |
417
419
  | Example count (2 vs. 3-5) | Target 3+ for conversational agents; inline format examples are sufficient for structured output agents | Anthropic's 3-5 recommendation is general; interactive roles benefit more than output-only roles |
418
420
  | Subagent return size (200 vs. 1000-2000 tokens) | Use 300-500 tokens | Anthropic's 1000-2000 is upper bound; 200 was too tight for structured approach summaries with trade-offs |
419
421
  | "Don't invent alternatives" vs. "try fallback strategies" | Keep "don't invent" for approach research; use fallbacks for information retrieval | These solve different problems: manufacturing fake options is worse than acknowledging one viable path |
package/agents/planner.md CHANGED
@@ -238,6 +238,8 @@ Before returning, self-check against the checker dimensions:
238
238
  5. scope sanity
239
239
  6. must-have quality
240
240
  7. context compliance
241
+ 8. goal achievement
242
+ 9. approach alignment (when APPROACH.md exists)
241
243
 
242
244
  Task completeness rules:
243
245
  - every task has files, action, verify, and done
@@ -6,6 +6,7 @@ function createRootAgentsAdapter({ cwd, renderAgentsBoundedBlock, renderAgentsFi
6
6
  id: 'agents',
7
7
  name,
8
8
  kind: 'governance_only',
9
+ subagentFiles: [],
9
10
  detect() {
10
11
  return false;
11
12
  },
@@ -1,5 +1,10 @@
1
1
  import { existsSync, mkdirSync, writeFileSync } from 'fs';
2
2
  import { join } from 'path';
3
+ import {
4
+ PLAN_CHECK_DIMENSIONS,
5
+ MAX_CHECKER_CYCLES,
6
+ CHECKER_STATUSES,
7
+ } from '../lib/plan-constants.mjs';
3
8
 
4
9
  const CLAUDE_MODEL_PROFILES = {
5
10
  quality: 'opus',
@@ -75,7 +80,7 @@ Execution flow:
75
80
  "summary": "One sentence overall assessment",
76
81
  "issues": [
77
82
  {
78
- "dimension": "requirement_coverage | task_completeness | dependency_correctness | key_link_completeness | scope_sanity | must_have_quality | context_compliance | approach_alignment",
83
+ "dimension": "${PLAN_CHECK_DIMENSIONS.join(' | ')}",
79
84
  "severity": "blocker | warning",
80
85
  "description": "What is wrong",
81
86
  "plan": "01-PLAN",
@@ -84,10 +89,10 @@ Execution flow:
84
89
  }
85
90
  ]
86
91
  }
87
- Status must be either "passed" or "issues_found".
92
+ Status must be either "${CHECKER_STATUSES[0]}" or "${CHECKER_STATUSES[1]}".
88
93
  9. If the checker returns \`passed\`, finish and summarize.
89
94
  10. If the checker returns \`issues_found\`, revise the existing plan files only where needed, then run the checker again.
90
- 11. Maximum 3 checker cycles total. If blockers remain after cycle 3, stop and escalate to the user instead of pretending the plan is ready.
95
+ 11. Maximum ${MAX_CHECKER_CYCLES} checker cycles total. If blockers remain after cycle ${MAX_CHECKER_CYCLES}, stop and escalate to the user instead of pretending the plan is ready.
91
96
 
92
97
  Return a concise orchestration summary:
93
98
  - target phase
@@ -125,6 +130,10 @@ function createClaudeAdapter({ cwd, workflows, renderSkillContent, getDelegateCo
125
130
  id: 'claude',
126
131
  name: 'claude',
127
132
  kind: 'native_capable',
133
+ subagentFiles: [
134
+ '.claude/agents/gsdd-plan-checker.md',
135
+ '.claude/agents/gsdd-approach-explorer.md',
136
+ ],
128
137
  detect() {
129
138
  return existsSync(join(cwd, 'CLAUDE.md')) || existsSync(join(cwd, '.claude'));
130
139
  },
@@ -44,6 +44,10 @@ function createCodexAdapter({
44
44
  id: 'codex',
45
45
  name: 'codex',
46
46
  kind: 'native_capable',
47
+ subagentFiles: [
48
+ '.codex/agents/gsdd-plan-checker.toml',
49
+ '.codex/agents/gsdd-approach-explorer.toml',
50
+ ],
47
51
  detect() {
48
52
  return existsSync(join(cwd, '.codex'));
49
53
  },
@@ -1,6 +1,11 @@
1
1
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'fs';
2
2
  import os from 'os';
3
3
  import { join } from 'path';
4
+ import {
5
+ PLAN_CHECK_DIMENSIONS,
6
+ MAX_CHECKER_CYCLES,
7
+ CHECKER_STATUSES,
8
+ } from '../lib/plan-constants.mjs';
4
9
 
5
10
  function expandHome(filePath) {
6
11
  if (!filePath) return filePath;
@@ -115,7 +120,7 @@ function renderOpenCodeApproachExplorer(delegateContent, modelId = null) {
115
120
  const modelLine = modelId ? `model: ${modelId}\n` : '';
116
121
  return `---
117
122
  description: Explores implementation approaches for a phase and aligns with the user through structured questioning before planning begins.
118
- mode: agent
123
+ mode: subagent
119
124
  ${modelLine}tools:
120
125
  bash: false
121
126
  ---
@@ -183,7 +188,7 @@ Execution flow:
183
188
  "summary": "One sentence overall assessment",
184
189
  "issues": [
185
190
  {
186
- "dimension": "requirement_coverage | task_completeness | dependency_correctness | key_link_completeness | scope_sanity | must_have_quality | context_compliance | approach_alignment",
191
+ "dimension": "${PLAN_CHECK_DIMENSIONS.join(' | ')}",
187
192
  "severity": "blocker | warning",
188
193
  "description": "What is wrong",
189
194
  "plan": "01-PLAN",
@@ -192,10 +197,10 @@ Execution flow:
192
197
  }
193
198
  ]
194
199
  }
195
- Status must be either "passed" or "issues_found".
200
+ Status must be either "${CHECKER_STATUSES[0]}" or "${CHECKER_STATUSES[1]}".
196
201
  9. If the checker returns \`passed\`, finish and summarize.
197
202
  10. If the checker returns \`issues_found\`, revise the existing plan files only where needed, then run the checker again.
198
- 11. Maximum 3 checker cycles total. If blockers remain after cycle 3, stop and escalate to the user instead of pretending the plan is ready.
203
+ 11. Maximum ${MAX_CHECKER_CYCLES} checker cycles total. If blockers remain after cycle ${MAX_CHECKER_CYCLES}, stop and escalate to the user instead of pretending the plan is ready.
199
204
 
200
205
  Return a concise orchestration summary:
201
206
  - target phase
@@ -223,6 +228,10 @@ function createOpenCodeAdapter({
223
228
  id: 'opencode',
224
229
  name: 'opencode',
225
230
  kind: 'native_capable',
231
+ subagentFiles: [
232
+ '.opencode/agents/gsdd-plan-checker.md',
233
+ '.opencode/agents/gsdd-approach-explorer.md',
234
+ ],
226
235
  detect() {
227
236
  return existsSync(join(cwd, '.opencode'));
228
237
  },
package/bin/gsdd.mjs CHANGED
@@ -16,7 +16,8 @@ import {
16
16
  } from './lib/rendering.mjs';
17
17
  import { loadProjectModelConfig, getRuntimeModelOverride, resolveRuntimeAgentModel, cmdModels } from './lib/models.mjs';
18
18
  import { createCmdInit, createCmdUpdate, cmdHelp } from './lib/init.mjs';
19
- import { cmdFindPhase, cmdVerify, cmdScaffold } from './lib/phase.mjs';
19
+ import { cmdFindPhase, cmdVerify, cmdScaffold, cmdPhaseStatus } from './lib/phase.mjs';
20
+ import { cmdFileOp } from './lib/file-ops.mjs';
20
21
  import { createCmdHealth } from './lib/health.mjs';
21
22
 
22
23
  const __filename = fileURLToPath(import.meta.url);
@@ -24,51 +25,65 @@ const __dirname = dirname(__filename);
24
25
  const DISTILLED_DIR = join(__dirname, '..', 'distilled');
25
26
  const AGENTS_DIR = join(__dirname, '..', 'agents');
26
27
  const CWD = process.cwd();
27
- const PLANNING_DIR = join(CWD, '.planning');
28
28
  const IS_MAIN = process.argv[1]
29
29
  ? realpathSync(process.argv[1]) === realpathSync(__filename)
30
30
  : false;
31
31
 
32
32
  const [,, command, ...args] = process.argv;
33
33
 
34
+ function defineWorkflow({ mutatesArtifacts = true, ...workflow }) {
35
+ return {
36
+ ...workflow,
37
+ mutatesArtifacts,
38
+ agent: mutatesArtifacts ? 'Code' : 'Plan',
39
+ opencodeType: mutatesArtifacts ? 'edit' : 'plan',
40
+ };
41
+ }
42
+
34
43
  const WORKFLOWS = [
35
- { name: 'gsdd-new-project', workflow: 'new-project.md', description: 'New project - questioning, codebase audit, research, spec, roadmap', agent: 'Plan', opencodeType: 'plan' },
36
- { name: 'gsdd-map-codebase', workflow: 'map-codebase.md', description: 'Map or refresh codebase - 4 parallel mappers, staleness check, secrets scan', agent: 'Plan', opencodeType: 'plan' },
37
- { name: 'gsdd-plan', workflow: 'plan.md', description: 'Plan a phase - research check, backward planning, task creation', agent: 'Plan', opencodeType: 'plan' },
38
- { name: 'gsdd-execute', workflow: 'execute.md', description: 'Execute a phase plan - implement tasks, verify changes, follow repo git conventions', agent: 'Code', opencodeType: 'edit' },
39
- { name: 'gsdd-verify', workflow: 'verify.md', description: 'Verify a completed phase - 3-level checks, anti-pattern scan', agent: 'Plan', opencodeType: 'plan' },
40
- { name: 'gsdd-audit-milestone', workflow: 'audit-milestone.md', description: 'Audit a completed milestone - cross-phase integration, requirements coverage, E2E flows', agent: 'Plan', opencodeType: 'plan' },
41
- { name: 'gsdd-quick', workflow: 'quick.md', description: 'Quick task - plan and execute a sub-hour task outside the phase cycle', agent: 'Code', opencodeType: 'edit' },
42
- { name: 'gsdd-pause', workflow: 'pause.md', description: 'Pause work - save session context for seamless resumption', agent: 'Plan', opencodeType: 'plan' },
43
- { name: 'gsdd-resume', workflow: 'resume.md', description: 'Resume work - restore context and route to next action', agent: 'Plan', opencodeType: 'plan' },
44
- { name: 'gsdd-progress', workflow: 'progress.md', description: 'Check progress - show project status and route to next action', agent: 'Plan', opencodeType: 'plan' },
44
+ defineWorkflow({ name: 'gsdd-new-project', workflow: 'new-project.md', description: 'New project - questioning, codebase audit, research, spec, roadmap' }),
45
+ defineWorkflow({ name: 'gsdd-map-codebase', workflow: 'map-codebase.md', description: 'Map or refresh codebase - 4 parallel mappers, staleness check, secrets scan' }),
46
+ defineWorkflow({ name: 'gsdd-plan', workflow: 'plan.md', description: 'Plan a phase - research check, backward planning, task creation' }),
47
+ defineWorkflow({ name: 'gsdd-execute', workflow: 'execute.md', description: 'Execute a phase plan - implement tasks, verify changes, follow repo git conventions' }),
48
+ defineWorkflow({ name: 'gsdd-verify', workflow: 'verify.md', description: 'Verify a completed phase - 3-level checks, anti-pattern scan' }),
49
+ defineWorkflow({ name: 'gsdd-verify-work', workflow: 'verify-work.md', description: 'Conversational UAT testing - validate user-facing behavior with structured gap tracking' }),
50
+ defineWorkflow({ name: 'gsdd-audit-milestone', workflow: 'audit-milestone.md', description: 'Audit a completed milestone - cross-phase integration, requirements coverage, E2E flows' }),
51
+ defineWorkflow({ name: 'gsdd-complete-milestone', workflow: 'complete-milestone.md', description: 'Complete milestone - archive, evolve spec, collapse roadmap' }),
52
+ defineWorkflow({ name: 'gsdd-new-milestone', workflow: 'new-milestone.md', description: 'New milestone - gather goals, define requirements, create roadmap phases' }),
53
+ defineWorkflow({ name: 'gsdd-plan-milestone-gaps', workflow: 'plan-milestone-gaps.md', description: 'Plan gap closure phases from audit results' }),
54
+ defineWorkflow({ name: 'gsdd-quick', workflow: 'quick.md', description: 'Quick task - plan and execute a sub-hour task outside the phase cycle' }),
55
+ defineWorkflow({ name: 'gsdd-pause', workflow: 'pause.md', description: 'Pause work - save session context for seamless resumption' }),
56
+ defineWorkflow({ name: 'gsdd-resume', workflow: 'resume.md', description: 'Resume work - restore context and route to next action' }),
57
+ defineWorkflow({ name: 'gsdd-progress', workflow: 'progress.md', description: 'Check progress - show project status and route to next action', mutatesArtifacts: false }),
45
58
  ];
46
59
 
47
- const FRAMEWORK_VERSION = 'v1.2';
60
+ const FRAMEWORK_VERSION = 'v1.3';
48
61
 
49
- const ADAPTERS = createAdapterRegistry({
50
- cwd: CWD,
51
- workflows: WORKFLOWS,
52
- renderAgentsBoundedBlock,
53
- renderAgentsFileContent,
54
- renderOpenCodeCommandContent,
55
- renderSkillContent,
56
- upsertBoundedBlock,
57
- getDelegateContent,
58
- loadProjectModelConfig,
59
- getRuntimeModelOverride,
60
- resolveRuntimeAgentModel,
61
- });
62
-
63
- const INIT_CONTEXT = {
64
- cwd: CWD,
65
- planningDir: PLANNING_DIR,
66
- distilledDir: DISTILLED_DIR,
67
- agentsDir: AGENTS_DIR,
68
- workflows: WORKFLOWS,
69
- frameworkVersion: FRAMEWORK_VERSION,
70
- adapters: ADAPTERS,
71
- };
62
+ function createCliContext(cwd = process.cwd()) {
63
+ return {
64
+ cwd,
65
+ planningDir: join(cwd, '.planning'),
66
+ distilledDir: DISTILLED_DIR,
67
+ agentsDir: AGENTS_DIR,
68
+ workflows: WORKFLOWS,
69
+ frameworkVersion: FRAMEWORK_VERSION,
70
+ adapters: createAdapterRegistry({
71
+ cwd,
72
+ workflows: WORKFLOWS,
73
+ renderAgentsBoundedBlock,
74
+ renderAgentsFileContent,
75
+ renderOpenCodeCommandContent,
76
+ renderSkillContent,
77
+ upsertBoundedBlock,
78
+ getDelegateContent,
79
+ loadProjectModelConfig,
80
+ getRuntimeModelOverride,
81
+ resolveRuntimeAgentModel,
82
+ }),
83
+ };
84
+ }
85
+
86
+ const INIT_CONTEXT = createCliContext(CWD);
72
87
 
73
88
  const cmdInit = createCmdInit(INIT_CONTEXT);
74
89
  const cmdUpdate = createCmdUpdate(INIT_CONTEXT);
@@ -79,24 +94,34 @@ const COMMANDS = {
79
94
  update: cmdUpdate,
80
95
  models: cmdModels,
81
96
  health: cmdHealth,
97
+ 'file-op': cmdFileOp,
82
98
  'find-phase': cmdFindPhase,
99
+ 'phase-status': cmdPhaseStatus,
83
100
  verify: cmdVerify,
84
101
  scaffold: cmdScaffold,
85
102
  help: cmdHelp,
86
103
  };
87
104
 
88
- async function runCli(cliCommand = command, cliArgs = args) {
105
+ async function runCli(cliCommand = command, ...cliArgs) {
106
+ const normalizedArgs = cliArgs.length === 0
107
+ ? args
108
+ : cliArgs.length === 1 && Array.isArray(cliArgs[0])
109
+ ? cliArgs[0]
110
+ : cliArgs;
111
+
112
+ process.exitCode = 0;
113
+
89
114
  if (!cliCommand || !COMMANDS[cliCommand]) {
90
115
  cmdHelp();
91
116
  if (cliCommand) process.exitCode = 1;
92
117
  return;
93
118
  }
94
119
 
95
- await COMMANDS[cliCommand](...cliArgs);
120
+ await COMMANDS[cliCommand](...normalizedArgs);
96
121
  }
97
122
 
98
123
  if (IS_MAIN) {
99
124
  await runCli();
100
125
  }
101
126
 
102
- export { cmdHelp, cmdInit, cmdUpdate, cmdModels, cmdHealth, cmdFindPhase, cmdVerify, cmdScaffold, runCli, FRAMEWORK_VERSION };
127
+ export { cmdHelp, cmdInit, cmdUpdate, cmdModels, cmdHealth, cmdFileOp, cmdFindPhase, cmdPhaseStatus, cmdVerify, cmdScaffold, runCli, FRAMEWORK_VERSION, createCliContext };