@gajae-code/coding-agent 0.7.8 → 0.7.10

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 (92) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/README.md +8 -0
  3. package/dist/types/config/keybindings.d.ts +1 -1
  4. package/dist/types/config/model-profile-activation.d.ts +19 -2
  5. package/dist/types/config/model-profiles.d.ts +1 -0
  6. package/dist/types/config/model-registry.d.ts +4 -0
  7. package/dist/types/config/settings-schema.d.ts +12 -3
  8. package/dist/types/extensibility/extensions/types.d.ts +11 -0
  9. package/dist/types/gjc-runtime/launch-tmux.d.ts +19 -3
  10. package/dist/types/gjc-runtime/ultragoal-guard.d.ts +7 -1
  11. package/dist/types/gjc-runtime/ultragoal-runtime.d.ts +0 -4
  12. package/dist/types/modes/components/hook-input.d.ts +1 -0
  13. package/dist/types/modes/components/hook-selector.d.ts +5 -0
  14. package/dist/types/modes/components/model-selector.d.ts +9 -0
  15. package/dist/types/modes/components/status-line.d.ts +3 -0
  16. package/dist/types/modes/controllers/extension-ui-controller.d.ts +3 -1
  17. package/dist/types/modes/interactive-mode.d.ts +3 -1
  18. package/dist/types/modes/shared/agent-wire/deep-interview-gate.d.ts +41 -7
  19. package/dist/types/modes/types.d.ts +3 -1
  20. package/dist/types/notifications/daemon-paths.d.ts +9 -0
  21. package/dist/types/notifications/html-format.d.ts +2 -0
  22. package/dist/types/notifications/recent-activity.d.ts +5 -1
  23. package/dist/types/notifications/telegram-daemon-cli.d.ts +8 -2
  24. package/dist/types/notifications/telegram-daemon-control.d.ts +8 -0
  25. package/dist/types/notifications/telegram-daemon.d.ts +1 -10
  26. package/dist/types/notifications/telegram-reference.d.ts +4 -0
  27. package/dist/types/notifications/threaded-render.d.ts +1 -0
  28. package/dist/types/tools/ask.d.ts +26 -0
  29. package/dist/types/tools/ultragoal-ask-guard.d.ts +9 -2
  30. package/dist/types/utils/cmux-workspace.d.ts +23 -0
  31. package/dist/types/web/search/index.d.ts +1 -1
  32. package/dist/types/web/search/provider.d.ts +5 -0
  33. package/dist/types/web/search/render.d.ts +1 -0
  34. package/package.json +7 -7
  35. package/src/cli/notify-cli.ts +1 -1
  36. package/src/cli/web-search-cli.ts +3 -2
  37. package/src/cli.ts +1 -0
  38. package/src/config/keybindings.ts +1 -1
  39. package/src/config/model-profile-activation.ts +92 -11
  40. package/src/config/model-profiles.ts +15 -2
  41. package/src/config/model-registry.ts +81 -5
  42. package/src/config/settings-schema.ts +14 -3
  43. package/src/coordinator-mcp/server.ts +4 -2
  44. package/src/deep-interview/render-middleware.ts +1 -0
  45. package/src/defaults/gjc/skills/deep-interview/SKILL.md +40 -8
  46. package/src/defaults/gjc/skills/ralplan/SKILL.md +14 -7
  47. package/src/defaults/gjc/skills/ultragoal/SKILL.md +37 -112
  48. package/src/extensibility/extensions/types.ts +11 -0
  49. package/src/gjc-runtime/deep-interview-runtime.ts +1 -1
  50. package/src/gjc-runtime/launch-tmux.ts +366 -48
  51. package/src/gjc-runtime/team-runtime.ts +69 -4
  52. package/src/gjc-runtime/ultragoal-guard.ts +150 -24
  53. package/src/gjc-runtime/ultragoal-runtime.ts +16 -124
  54. package/src/gjc-runtime/workflow-manifest.generated.json +0 -8
  55. package/src/gjc-runtime/workflow-manifest.ts +0 -1
  56. package/src/hooks/skill-state.ts +33 -73
  57. package/src/internal-urls/docs-index.generated.ts +8 -7
  58. package/src/modes/components/custom-model-preset-wizard.ts +2 -4
  59. package/src/modes/components/hook-editor.ts +7 -4
  60. package/src/modes/components/hook-input.ts +4 -0
  61. package/src/modes/components/hook-selector.ts +21 -3
  62. package/src/modes/components/model-selector.ts +84 -13
  63. package/src/modes/components/settings-selector.ts +83 -24
  64. package/src/modes/components/status-line/presets.ts +11 -0
  65. package/src/modes/components/status-line/segments.ts +10 -2
  66. package/src/modes/components/status-line.ts +1 -0
  67. package/src/modes/controllers/extension-ui-controller.ts +20 -2
  68. package/src/modes/controllers/selector-controller.ts +130 -7
  69. package/src/modes/interactive-mode.ts +7 -2
  70. package/src/modes/shared/agent-wire/deep-interview-gate.ts +64 -13
  71. package/src/modes/types.ts +6 -1
  72. package/src/notifications/daemon-paths.ts +22 -0
  73. package/src/notifications/html-format.ts +75 -1
  74. package/src/notifications/index.ts +12 -1
  75. package/src/notifications/recent-activity.ts +32 -8
  76. package/src/notifications/telegram-daemon-cli.ts +13 -4
  77. package/src/notifications/telegram-daemon-control.ts +9 -0
  78. package/src/notifications/telegram-daemon.ts +69 -45
  79. package/src/notifications/telegram-reference.ts +36 -14
  80. package/src/notifications/threaded-render.ts +14 -6
  81. package/src/prompts/system/system-prompt.md +10 -1
  82. package/src/sdk.ts +13 -6
  83. package/src/session/agent-session.ts +10 -1
  84. package/src/tools/ask.ts +147 -17
  85. package/src/tools/eval.ts +2 -2
  86. package/src/tools/render-utils.ts +2 -0
  87. package/src/tools/ultragoal-ask-guard.ts +39 -5
  88. package/src/utils/cmux-workspace.ts +106 -0
  89. package/src/utils/title-generator.ts +2 -0
  90. package/src/web/search/index.ts +22 -10
  91. package/src/web/search/provider.ts +15 -0
  92. package/src/web/search/render.ts +3 -0
@@ -21,13 +21,14 @@ Deep Interview implements Ouroboros-inspired Socratic questioning with mathemati
21
21
  - User wants to avoid "that's not what I meant" outcomes from autonomous execution
22
22
  - Task is complex enough that jumping to code would waste cycles on scope discovery
23
23
  - User wants mathematically-validated clarity before committing to execution
24
+ - User explicitly requests deep-interview even after being told the request is already clear, bounded, and low-risk
24
25
  </Use_When>
25
26
 
26
27
  <Do_Not_Use_When>
27
28
  - User has a detailed, specific request with file paths, function names, or acceptance criteria -- execute directly
28
29
  - User wants to explore options or brainstorm -- use `ralplan` skill instead
29
- - User wants a quick fix or single change -- delegate to executor or execution
30
- - User says "just do it" or "skip the questions" without an explicit execution path -- respect their intent by ending interview and writing a `pending approval` spec, not by mutating files or delegating execution
30
+ - User wants a quick fix or single change -- use direct execution, not deep-interview or role-agent delegation
31
+ - User says "just do it" or "skip the questions" without an explicit execution path -- respect their intent by exiting deep-interview, not by writing a `pending approval` spec
31
32
  - User already has a PRD or plan file and explicitly asks to execute it -- use the requested execution skill with that plan
32
33
  </Do_Not_Use_When>
33
34
 
@@ -51,6 +52,10 @@ Inspired by the [Ouroboros project](https://github.com/Q00/ouroboros) which demo
51
52
  - Keep prompt payloads budgeted: summarize or trim oversized initial context/history before composing question, scoring, spec, or handoff prompts
52
53
  - If the user's initial context is oversized, create a concise prompt-safe summary first and wait for that summary before ambiguity scoring, question generation, or downstream execution handoff
53
54
  - Do not proceed to execution until ambiguity ≤ the resolved threshold for this run and the user explicitly approves a scoped execution path
55
+ - Treat user wording such as `implementation`, "implementation plan", Korean `구현`, or "구현 계획" as describing the eventual target, not permission to implement now.
56
+ - While still in deep-interview, do not implement, edit/write code, launch implementation workers, or start task/skill/ultragoal implementation; continue interviewing for scope, risks, acceptance criteria, and unknowns.
57
+ - When the user wants interview output for eventual implementation, say: "I can interview for an implementation plan, but I won't implement during deep-interview." Then continue clarifying scope, risks, acceptance criteria, and unknowns.
58
+ - Implementation requires an explicit phase transition/approval after the interview: deep-interview must first produce its spec/handoff, the workflow phase must explicitly transition out of deep-interview, and execution approval must be captured by a downstream execution path.
54
59
  - Allow early exit with a clear warning if ambiguity is still high
55
60
  - Persist interview state for resume across session interruptions
56
61
  - A multi-persona lateral-review panel convenes at ambiguity-milestone transitions (and before synthesizing any agent-supplied answer) to expose blind spots from independent perspectives
@@ -74,7 +79,7 @@ Inspired by the [Ouroboros project](https://github.com/Q00/ouroboros) which demo
74
79
 
75
80
  ## Native Plugin Invocation Guard (Issue #3030)
76
81
 
77
- If this raw bundled skill is loaded by GJC's native skill loader through `/skill:deep-interview`, do not treat that path as permission to skip rendered GJC setup. The user-facing invocation is `/skill:deep-interview`; do not recommend or advertise CLI bridge commands as the deep-interview entrypoint. Regardless of invocation path, Phase 0 below remains blocking and must resolve `gjc.deepInterview.ambiguityThreshold` from settings before any announcement, state write, question, or ambiguity score.
82
+ If this raw bundled skill is loaded by GJC's native skill loader through `/skill:deep-interview`, do not treat that path as permission to skip rendered GJC setup. The user-facing invocation is `/skill:deep-interview`; do not recommend or advertise CLI bridge commands as the deep-interview entrypoint. Regardless of invocation path, Phase 0 below remains blocking and must resolve `gjc.deepInterview.ambiguityThreshold` from pre-resolved native state or settings before any announcement, state write, question, or ambiguity score.
78
83
 
79
84
  ## Corrupt current-session state recovery
80
85
 
@@ -84,25 +89,50 @@ When deep-interview detects its own current-session state is corrupt, tampered,
84
89
 
85
90
  Complete this phase before Phase 1, before brownfield exploration, before GJC state persistence, before Round 0, and before any ambiguity scoring. Do not continue if the resolved threshold and source are unknown.
86
91
 
87
- 1. **Read threshold settings in precedence order**:
92
+ 1. **Prefer pre-resolved native state**:
93
+ - First inspect active deep-interview state with `gjc state deep-interview read --json`.
94
+ - If state contains a finite numeric `threshold` and a non-empty `threshold_source`, use those values, set `<resolvedThreshold>`, `<resolvedThresholdPercent>`, and `<resolvedThresholdSource>`, and skip optional settings-file reads. This is the normal `/skill:deep-interview` path because the native hook already resolved settings quietly before loading the skill.
95
+ 2. **Only if native state lacks a resolved threshold, read threshold settings in precedence order**:
88
96
  - User settings: `[$GJC_CONFIG_DIR|~/.gjc]/settings.json`
89
97
  - Project settings: `./.gjc/settings.json` (overrides user settings)
90
- 2. **Resolve threshold and source**:
91
- - Read `gjc.deepInterview.ambiguityThreshold` from both files when present.
98
+ - Read `gjc.deepInterview.ambiguityThreshold` only from files that are known to exist; optional settings-file absence is expected and must not be surfaced as failed `Read` calls.
99
+ - Do not probe arbitrary ancestor candidates such as `../../.gjc/settings.json`; use the current project `.gjc/settings.json` and user settings only.
100
+ 3. **Resolve threshold and source**:
92
101
  - Use the project value when valid; otherwise use the user value when valid; otherwise use the default `0.05`.
93
102
  - Set these run variables exactly: `<resolvedThreshold>`, `<resolvedThresholdPercent>`, and `<resolvedThresholdSource>` (for example `./.gjc/settings.json`, `[$GJC_CONFIG_DIR|~/.gjc]/settings.json`, or `default`).
94
- 3. **Emit the required first line to the user before any other interview announcement**:
103
+ 4. **Emit the required first line to the user before any other interview announcement**:
95
104
 
96
105
  ```
97
106
  Deep Interview threshold: <resolvedThresholdPercent> (source: <resolvedThresholdSource>)
98
107
  ```
99
108
 
100
- 4. **Carry threshold source forward mechanically**:
109
+ 5. **Carry threshold source forward mechanically**:
101
110
  - Substitute `<resolvedThreshold>`, `<resolvedThresholdPercent>`, and `<resolvedThresholdSource>` throughout the remaining instructions before continuing.
102
111
  - Include `threshold_source` in the first `gjc state write` payload and preserve it on later state updates; do not edit `.gjc/_session-{sessionid}/state` files directly unless an explicit force override is active.
103
112
  - Include both threshold and source in the final spec metadata.
104
113
  - Read any `language` object from active deep-interview state and carry `language.instruction` forward mechanically. If absent, default to English unless `{{ARGUMENTS}}` makes another user/session language obvious or the user explicitly requests another language. Do not add language-specific special cases.
105
114
 
115
+ ## Phase 0.5: Suitability Gate
116
+
117
+ Run this gate after the Phase 0 threshold marker and before Phase 1, brownfield exploration, `gjc state write`, Round 0, ambiguity scoring, or spec writing.
118
+
119
+ If `{{ARGUMENTS}}` is already clear, bounded, low-risk, and asks for a quick fix, single change, known file/symbol edit, explicit command, or direct answer:
120
+
121
+ 1. **Stop deep-interview immediately**:
122
+ - First inspect current-session state with `gjc state read --mode deep-interview --json` (include `--session-id <current-session-id>` when available).
123
+ - Clear through `gjc state clear --force --mode deep-interview --json` only when the state is a newly seeded empty interview: no recorded `rounds`, no `spec_path`, no `handoff_from`, no final/pending spec, and no user-confirmed topology.
124
+ - If state already contains rounds, a spec path, handoff metadata, pending approval, or confirmed topology, do not clear it. Preserve the active interview and ask the user whether to continue, cancel, or explicitly clear the workflow.
125
+ - Do not initialize deep-interview state.
126
+ - Do not run Round 0.
127
+ - Do not write a pending-approval spec.
128
+ - Do not hand off to `ralplan`, `ultragoal`, `team`, or a role agent.
129
+ 2. **Return the request to direct implementation**:
130
+ - Say briefly that deep-interview is unnecessary because the request is already clear and small.
131
+ - State the direct implementation path the normal coding agent should take.
132
+ - If the user explicitly insists on deep-interview anyway, continue to Phase 1.
133
+
134
+ This gate exists to prevent deep-interview from making easy problems harder. A small verification need does not make a request interview-worthy.
135
+
106
136
  ## Phase 1: Initialize
107
137
 
108
138
  1. **Parse the user's idea** from `{{ARGUMENTS}}`
@@ -306,6 +336,8 @@ After applying `language.instruction` to the visible question, options, and gene
306
336
 
307
337
  When calling `ask`, SHOULD include optional structured metadata so the runtime can record the round without manual state writes: `deepInterview.round_id?`, `deepInterview.round`, `deepInterview.component`, `deepInterview.dimension`, and `deepInterview.ambiguity`. Keep this metadata aligned with the visible Round/Component/Targeting/Ambiguity line; if metadata cannot be supplied, the legacy formatted question text remains the fallback.
308
338
 
339
+ If the `ask` tool returns `clarificationQuestion`, treat it as a non-answer about the displayed choices. Answer the clarification briefly from the current interview context, then call `ask` again with the exact original question, options, and `deepInterview.*` metadata. A clarification bypasses Step 2b′ auto-answer, Step 2b″ free-text refine, Step 2c ambiguity scoring, Step 2d progress reporting, and Step 2e state updates; it must not be recorded as a round answer. This does not violate the one-question-per-round rule because the round remains unresolved until the user submits a real listed option or `Other` answer.
340
+
309
341
  ### Step 2b′: Auto-Answer Opted-Out Questions
310
342
 
311
343
  After the `ask` tool resolves and before ambiguity scoring, if the user opts out of answering the current question or explicitly asks the agent to decide, load `auto-answer-uncertain.md` as an internal `kind: "skill-fragment"` prompt for a fork-context architect. Pass the opted-out question, prompt-safe transcript summary, locked topology, current scores/gaps, and any auto-research candidates used for the round. The architect must return exactly one decisive answer with rationale, confidence, and explicit uncertainty. Validate the response shape before using it; if valid, record it as the tentative answer for scoring, append the round number to `auto_answered_rounds`, and mark the transcript answer as architect-assisted.
@@ -19,7 +19,7 @@ Ralplan is the consensus planning workflow. It triggers iterative planning with
19
19
 
20
20
  ## Flags
21
21
 
22
- - `--interactive`: Enables user prompts at key decision points (draft review in step 2 and final approval in step 6). Without this flag the workflow runs fully automated — Planner → Architect → Critic loop — marks the final plan `pending approval`, outputs it, and stops without asking for confirmation or executing changes.
22
+ - `--interactive`: Enables extra mid-loop user prompts (draft review in step 2 and one-at-a-time reconciliation in step 6c). Regardless of this flag, the workflow always finishes the post-interview gate with an `ask`-tool prompt offering Refine further / Approve ultragoal / Approve team / Stop here, and never auto-executes — execution always requires explicit approval through that prompt.
23
23
  - `--deliberate`: Forces deliberate mode for high-risk work. Adds pre-mortem (3 scenarios) and expanded test planning (unit/integration/e2e/observability). Without this flag, deliberate mode can still auto-enable when the request explicitly signals high risk (auth/security, migrations, destructive changes, production incidents, compliance/PII, public API breakage).
24
24
  - `--architect openai-code`: Use OpenAI code for the Architect pass when OpenAI code CLI is available. Otherwise, briefly note the fallback and keep the default GJC Architect review.
25
25
  - `--critic openai-code`: Use OpenAI code for the Critic pass when OpenAI code CLI is available. Otherwise, briefly note the fallback and keep the default GJC Critic review.
@@ -83,13 +83,20 @@ The consensus workflow:
83
83
  6. **Post-ralplan interview** (intent reconciliation gate): After Critic returns `APPROVE` and before the plan is finalized, reconcile the consensus plan against the user's actual intent. The goal is to make sure ralplan did not silently bake in assumptions that conflict with what the user wants.
84
84
  a. **Collect open items** from the run: every assumption the Planner/Architect/Critic resolved by assumption rather than by stated fact, every ambiguity flagged during review, and every decision the loop made without explicit user input. Source these from the persisted `planner`/`architect`/`critic`/`revision` stage artifacts, not from memory.
85
85
  b. **Cross-check prior context for conflicts**: glob `.gjc/_session-{sessionid}/specs/deep-interview-*.md` and other prior specs/plans/context relevant by topic. For each, list points where the consensus plan contradicts, weakens, or expands beyond a previously crystallized decision, constraint, or non-goal. Cite the conflicting artifact and line/section.
86
- c. **Reconcile with the user**:
87
- - *(--interactive only)* Use the `ask` tool to confirm the open assumptions and conflicts **one at a time**, weakest/highest-impact first, polishing intent. If any confirmation reveals that the plan diverges from user intent, route the consolidated correction back into the re-review loop (step 5b Planner revision) and re-run Architect + Critic before returning here. Cap at the same 5-iteration ceiling.
88
- - *(automated mode)* Do not ask. Embed every unconfirmed assumption and every detected prior-context conflict into the final plan under an **## Intent Reconciliation** section as explicit open confirmations the user must review at the `pending approval` gate, so nothing is silently assumed.
86
+ c. **Reconcile with the user via the `ask` tool (always, regardless of `--interactive`)**: Never stop idle with plain-text prose after the consensus loop. Every reconciliation question MUST go through the `ask` tool with contextual options plus free-text.
87
+ - If open items exist, confirm the open assumptions and conflicts **one at a time** with the `ask` tool, weakest/highest-impact first, polishing intent. If any confirmation reveals that the plan diverges from user intent, route the consolidated correction back into the re-review loop (step 5b Planner revision) and re-run Architect + Critic before returning here. Cap at the same 5-iteration ceiling.
88
+ - If the plan is crystal clear (no open assumptions or prior-context conflicts), skip straight to the step 8 final-options `ask` instead of inventing filler questions.
89
+ - For every confirmed open item, embed the resolved outcome into the final plan under an **## Intent Reconciliation** section so the `pending approval` artifact records each decision; record any item the user explicitly defers as an open confirmation under that same section.
89
90
  d. Persist the reconciliation with `gjc ralplan --write --stage post-interview --stage_n <N> --artifact "..." --json`, then return the receipt/path plus a compact status (reconciled-clean / reconciled-with-revision / open-confirmations-pending) instead of pasting the full body.
90
- 7. On reconciliation completion, mark the plan `pending approval` unless explicit execution approval has already been captured, persist the ADR/final plan via `gjc ralplan --write --stage final --stage_n <N> --artifact "..."`, and do not directly edit `.gjc/_session-{sessionid}/plans`. *(--interactive only)* If `--interactive` is set, use the `ask` tool to present the plan with approval options (Approve execution via ultragoal (Recommended) / Approve execution via team (only when tmux-based interactive worker parallelization is required) / Compact then return for execution approval / Request changes / Reject). Final plan must include ADR (Decision, Drivers, Alternatives considered, Why chosen, Consequences, Follow-ups) and, when present, the **## Intent Reconciliation** section. Otherwise, output the final plan and stop before any mutation or delegation.
91
- 8. *(--interactive only)* User chooses: Approve ultragoal execution (recommended), Approve team execution (tmux parallelization only), Request changes, or Reject
92
- 9. *(--interactive only)* On approval: invoke `/skill:ultragoal` for execution by default; invoke `/skill:team` only when the user explicitly needs tmux-based interactive worker parallelization -- never implement directly
91
+ 7. On reconciliation completion, mark the plan `pending approval` unless explicit execution approval has already been captured, persist the ADR/final plan via `gjc ralplan --write --stage final --stage_n <N> --artifact "..."`, and do not directly edit `.gjc/_session-{sessionid}/plans`. Final plan must include ADR (Decision, Drivers, Alternatives considered, Why chosen, Consequences, Follow-ups) and, when present, the **## Intent Reconciliation** section.
92
+ 8. **Always** present the finalized plan via the `ask` tool (regardless of `--interactive`) with `workflowGate: { stage: "ralplan", kind: "approval" }` on the final question so RPC/headless clients receive a `ralplan`/`approval` workflow gate, not a deep-interview question gate. Use these options:
93
+ - **Refine further** — re-run the consensus loop / request changes, then return here
94
+ - **Approve execution via ultragoal (Recommended)** — goal-tracked autonomous execution
95
+ - **Approve execution via team** — only when tmux-based interactive worker parallelization is required
96
+ - **Stop here** — keep the plan as `pending approval` and make no further changes
97
+
98
+ Always include a free-text option. Do not stop with plain text and no `ask`; the post-interview gate's terminal action is this `ask`.
99
+ 9. On approval: invoke `/skill:ultragoal` for execution by default; invoke `/skill:team` only when the user explicitly needs tmux-based interactive worker parallelization. On **Refine further**, return to the step 5 re-review loop. On **Stop here**, leave the `pending approval` artifact and stop. Never implement directly.
93
100
 
94
101
  Before invoking `/skill:team` or `/skill:ultragoal`, mark ralplan ready for handoff so the skill tool's chain guard permits the transition:
95
102
 
@@ -11,7 +11,7 @@ Use when the user asks for `ultragoal`, `create-goals`, `complete-goals`, durabl
11
11
 
12
12
  ## Purpose
13
13
 
14
- `ultragoal` turns a brief into repo-native artifacts and then drives a GJC goal safely through the unified `goal` tool. New plans default to a stable pointer-style aggregate GJC goal for the whole durable plan in `.gjc/_session-{sessionid}/ultragoal/goals.json`, including later accepted/appended stories under the original brief constraints, while GJC tracks G001/G002 story progress in the ledger. Ultragoal does not require any `/goal` slash-command between runs. For back-to-back ultragoal runs in one session/thread, call `goal({"op":"drop"})` only when `goal({"op":"get"})` still reports an active aggregate; then call `goal({"op":"create"})`. The goal tool stays armed across drop so the next create works in-session, and no slash-command cleanup exists or is required.
14
+ `ultragoal` turns a brief into repo-native durable artifacts and then drives execution through the unified `goal` tool as a UX bridge only. `goals.json` is the canonical source of goal identity and state; `ledger.jsonl` is the canonical proof stream for checkpoints, receipts, blockers, steering, and reviews. The inline `goal` tool and goal-mode-request create-bridge exist only to keep the agent's interactive loop focused on the current aggregate or story objective. Completion is verified purely from durable `goals.json` plus fresh `ledger.jsonl` receipts, never from inline goal state. The agent, not the CLI or hooks, calls `goal({"op":"complete"})` or `goal({"op":"drop"})` after durable run completion or cleanup; CLI commands and hooks never mutate goal state.
15
15
 
16
16
  - `.gjc/_session-{sessionid}/ultragoal/brief.md`
17
17
  - `.gjc/_session-{sessionid}/ultragoal/goals.json`
@@ -36,7 +36,7 @@ gjc ultragoal complete-goals
36
36
  gjc ultragoal complete-goals --retry-failed
37
37
  gjc ultragoal checkpoint --goal-id <id> --status complete --evidence "<evidence>" --quality-gate-json <quality-gate-json-or-path>
38
38
  gjc ultragoal checkpoint --goal-id <id> --status failed --evidence "<blocker/evidence>"
39
- gjc ultragoal record-review-blockers --goal-id <id> --title "Resolve final review blockers" --objective "<blocker-resolution objective>" --evidence "<review findings>" --gjc-goal-json <active-goal-get-json-or-path>
39
+ gjc ultragoal record-review-blockers --goal-id <id> --title "Resolve final review blockers" --objective "<blocker-resolution objective>" --evidence "<review findings>"
40
40
  ```
41
41
 
42
42
  Use these exact goal-tool calls for the inline goal state:
@@ -50,7 +50,7 @@ goal({"op":"resume"})
50
50
  ```
51
51
  `drop` clears the active goal without exiting goal mode; `resume` reactivates a paused goal.
52
52
 
53
- Complete checkpoints source the active GJC goal snapshot from the current session when `--gjc-goal-json` is omitted. Use an explicit `--gjc-goal-json` only as an override; supplied values are still strictly validated and must be active goal-mode snapshots, not `.gjc/ultragoal/goals.json` records.
53
+ Durable completion is single-source: `goals.json` defines which goals exist and their required state, while `ledger.jsonl` provides the receipt proof used to verify completion. Inline goal state is UX-only and is reconciled by the agent after durable completion, not by CLI checkpoints or hooks.
54
54
 
55
55
  ## Create goals
56
56
 
@@ -98,13 +98,13 @@ Loop until `gjc ultragoal status` reports all goals complete:
98
98
  5. Complete the current GJC story only.
99
99
  6. Run a completion audit against the story objective and real artifacts/tests.
100
100
  7. Before any `--status complete` checkpoint, run the mandatory final cleanup/review gate below. In aggregate mode, do **not** call `goal({"op":"complete"})` for intermediate stories; checkpoint each story while the aggregate objective is still `active`. On the final story, create the final aggregate receipt first; only after that receipt exists may `goal({"op":"complete"})` run.
101
- 8. Checkpoint the durable ledger. Complete checkpoints require `--quality-gate-json`; the runtime sources the active GJC goal snapshot from current session state when `--gjc-goal-json` is omitted, and rejects any explicitly supplied bad snapshot:
101
+ 8. Checkpoint the durable ledger. Complete checkpoints require `--quality-gate-json` only:
102
102
  `gjc ultragoal checkpoint --goal-id <id> --status complete --evidence "<evidence>" --quality-gate-json <quality-gate-json-or-path>`
103
103
  A successful complete checkpoint is story completion, not automatic run completion. Read the checkpoint output: when it prints `Next ultragoal goal: <id>`, continue that active story under the same aggregate GJC goal; when it prints `All ultragoal goals are complete`, the durable run is terminal. `gjc ultragoal complete-goals` remains the supported manual next-story command if continuation output was missed.
104
104
  9. If blocked or failed, checkpoint failure:
105
105
  `gjc ultragoal checkpoint --goal-id <id> --status failed --evidence "<blocker/evidence>"`
106
106
  10. For legacy per-story completed-goal blockers, preserve the non-terminal blocker with:
107
- `gjc ultragoal checkpoint --goal-id <id> --status blocked --evidence "<completed legacy GJC goal blocks goal create in this thread>" --gjc-goal-json <goal-get-json-or-path>`
107
+ `gjc ultragoal checkpoint --goal-id <id> --status blocked --evidence "<completed legacy GJC goal blocks goal create in this thread>"`
108
108
  11. Resume failed goals with `gjc ultragoal complete-goals --retry-failed`.
109
109
 
110
110
  ## Blocker triage and pause discipline
@@ -167,19 +167,36 @@ Ultragoal execution should use GJC's bundled role-agent roster when a durable st
167
167
  - Use `architect` for read-only architecture and code-review lanes, including `CLEAR` / `WATCH` / `BLOCK` status.
168
168
  - Use `critic` for read-only plan or handoff critique before execution proceeds.
169
169
 
170
+ ### Mandatory implementation delegation on big scope
171
+
172
+ When a story's implementation scope is **big enough**, the Ultragoal leader MUST delegate the implementation to one or more `executor` subagents instead of writing the code inline itself. This is a hard requirement, not a preference: solo inline implementation of a big-scope story is a gate violation, and the completion cleanup/review gate must treat missing delegation on a big-scope story as a blocker.
173
+
174
+ A story's implementation scope is **big enough** to force delegation when any of the following hold:
175
+
176
+ - It spans **3+ files** or **2+ cleanly separable surfaces/modules** that can be implemented against bounded, independent acceptance criteria.
177
+ - It is estimated at **~200+ lines of net implementation change**, or is otherwise large enough that a single inline pass would crowd out the leader's checkpoint/verification duties.
178
+ - It decomposes into **independent slices** that can proceed in parallel without shared-file contention.
179
+ - The leader has already made **2+ inline edit passes** on the same story and implementation is still materially incomplete.
180
+
181
+ Forced-delegation rules:
182
+
183
+ - Split the story into cleanly separable slices, give each `executor` bounded targets and explicit acceptance criteria, and keep checkpoint/goal-state ownership in the leader.
184
+ - Prefer **parallel** `executor` subagents for independent slices; sequence only slices with a real dependency.
185
+ - If a big-scope story cannot be cleanly split, record the reason as a durable ledger note and delegate the whole implementation to a single `executor` rather than doing it inline; the leader still owns verification.
186
+ - Small, atomic, single-file changes below these thresholds stay with the leader — do not over-delegate trivial work.
187
+ - After integrating delegated slices, run `architect` / `critic` review lanes; worker agents never mutate `.gjc/_session-{sessionid}/ultragoal` or call goal tools.
188
+
170
189
  When delegating with native subagents, an await timeout only limits the leader's wait. It is not subagent failure evidence and must not be used as a cancellation reason; inspect or continue independent work, and cancel only when the subagent has actually failed, gone off-track, or become unrecoverably wrong.
171
190
 
172
191
  If an Ultragoal request has no approved plan or consensus artifact, run `ralplan` first and preserve its PRD, test spec, role roster, and verification guidance in the Ultragoal ledger. Do not silently substitute ad-hoc execution for missing planning.
173
192
 
174
193
  The Ultragoal leader owns `.gjc/_session-{sessionid}/ultragoal/goals.json` and `.gjc/_session-{sessionid}/ultragoal/ledger.jsonl`. Role agents return implementation/review evidence; they do not checkpoint Ultragoal or mutate goal state.
175
194
 
176
- For large subgoals with independent slices, the Ultragoal leader must spawn parallel `executor` subagents instead of doing serial solo work. Split only cleanly separable files/surfaces, give each executor bounded targets and acceptance criteria, and keep checkpoint ownership in the leader. Use `architect` / `critic` review lanes after integration; do not let worker agents mutate `.gjc/_session-{sessionid}/ultragoal` or call goal tools.
177
-
178
195
  ## Use Ultragoal and Team together
179
196
 
180
197
  Use ultragoal and team together for a durable Ultragoal story that benefits from one visible tmux worker session. Ultragoal remains leader-owned: `.gjc/_session-{sessionid}/ultragoal/goals.json` stores the story plan and `.gjc/_session-{sessionid}/ultragoal/ledger.jsonl` stores checkpoints. Team is the single-worker tmux execution engine and returns task/evidence status to the leader.
181
198
 
182
- The leader checkpoints Ultragoal from Team evidence; the runtime uses the active current-session GJC goal snapshot unless an explicit `--gjc-goal-json` override is supplied:
199
+ The leader checkpoints Ultragoal from Team evidence plus the current-session GJC goal snapshot; durable state remains leader-owned in `goals.json` and `ledger.jsonl`:
183
200
 
184
201
  ```sh
185
202
  gjc ultragoal checkpoint --goal-id <id> --status complete --evidence "<team evidence mentioning .gjc/_session-{sessionid}/ultragoal and <id>>" --quality-gate-json <quality-gate-json-or-path>
@@ -219,10 +236,10 @@ An ultragoal story cannot be checkpointed `complete` until the active agent has
219
236
  8. Run a final code review pass and fold it into the strict quality gate. Clean means `architectReview.architectureStatus`, `architectReview.productStatus`, and `architectReview.codeStatus` are all `"CLEAR"`, `architectReview.recommendation` is `"APPROVE"`, executor QA statuses are `"passed"`, iteration is `"passed"` with `fullRerun: true`, every evidence field is non-empty, every required matrix row is present, and every blockers array is empty. `COMMENT`, `WATCH`, `REQUEST CHANGES`, `BLOCK`, missing evidence, missing or shallow matrix rows, plan/code mismatches, or non-empty blockers are non-clean.
220
237
  9. If any lane finds an issue, do **not** checkpoint `complete` and do **not** call `goal({"op":"complete"})`. Record durable blocker work instead:
221
238
  ```sh
222
- gjc ultragoal record-review-blockers --goal-id <id> --title "Resolve verification blockers" --objective "<blocker-resolution objective>" --evidence "<architect/executor findings>" --gjc-goal-json <active-goal-get-json-or-path>
239
+ gjc ultragoal record-review-blockers --goal-id <id> --title "Resolve verification blockers" --objective "<blocker-resolution objective>" --evidence "<architect/executor findings>"
223
240
  ```
224
241
  10. Complete or steer through the blocker story, then rerun the full blocking verification loop. Repeat until all verifier lanes are clean.
225
- 11. Only after the loop is clean, checkpoint the story as complete with a structured quality gate and current-session active goal snapshot. The checkpoint creates a receipt; `goals.json.status` alone is not proof. In aggregate mode, the final aggregate receipt must exist before `goal({"op":"complete"})` is allowed.
242
+ 11. Only after the loop is clean, checkpoint the story as complete with a structured quality gate. The checkpoint creates a receipt in `ledger.jsonl`; `goals.json.status` alone is not proof. In aggregate mode, the final aggregate receipt must exist before the agent calls `goal({"op":"complete"})` to reconcile the inline UX goal state.
226
243
 
227
244
  While an Ultragoal run is active, the `ask` tool is blocked for all agents. Record unresolved review decisions as durable blockers with `gjc ultragoal record-review-blockers` instead of prompting interactively.
228
245
 
@@ -235,7 +252,7 @@ The native `checkpoint --status complete` command rejects missing or shallow gat
235
252
  "productStatus": "CLEAR",
236
253
  "codeStatus": "CLEAR",
237
254
  "recommendation": "APPROVE",
238
- "evidence": "architect review synthesis with architecture/product/code coverage",
255
+ "evidence": "architect review synthesis across architecture/product/code",
239
256
  "commands": ["architect review command or agent evidence id"],
240
257
  "blockers": []
241
258
  },
@@ -247,116 +264,22 @@ The native `checkpoint --status complete` command rejects missing or shallow gat
247
264
  "e2eCommands": ["bun test:e2e"],
248
265
  "redTeamCommands": ["bun test:red-team"],
249
266
  "artifactRefs": [
250
- {
251
- "id": "browser-run",
252
- "kind": "browser-automation",
253
- "path": "artifacts/browser-run.json",
254
- "description": "valid automation transcript with actions, monotonic timestamps, and selectors"
255
- },
256
- {
257
- "id": "gui-screenshot",
258
- "kind": "screenshot",
259
- "path": "artifacts/gui-screenshot.png",
260
- "description": "non-uniform screenshot evidence for the GUI/web result"
261
- },
262
- {
263
- "id": "cli-replay",
264
- "kind": "command-replay",
265
- "path": "artifacts/cli-replay.json",
266
- "description": "artifact file containing argv-only CLI replay JSON: schemaVersion 1, kind cli-replay, replaySafe true, allowlisted command such as bun/node --version or deterministic bun/node -e console.log(...), recordedStdout"
267
- },
268
- {
269
- "id": "adversarial-report",
270
- "kind": "failure-mode-test",
271
- "path": "artifacts/adversarial-report.txt",
272
- "description": "boundary, property, adversarial, or failure-mode result"
273
- },
274
- {
275
- "id": "api-package-report",
276
- "kind": "api-package-test-report",
277
- "path": "artifacts/api-package-report.txt",
278
- "description": "API/package consumer or endpoint verification output"
279
- },
280
- {
281
- "id": "algorithm-report",
282
- "kind": "property-test-report",
283
- "path": "artifacts/algorithm-report.txt",
284
- "description": "Algorithm/math property, boundary, or invariant verification output"
285
- }
267
+ { "id": "<ref-id>", "kind": "<surface-appropriate kind; see step 6>", "path": "artifacts/<file>", "description": "live-surface evidence" }
286
268
  ],
287
269
  "contractCoverage": [
288
- {
289
- "id": "contract-goal",
290
- "contractRef": "approved plan/spec/acceptance criterion or user-facing contract id",
291
- "obligation": "required behavior from the approved contract",
292
- "status": "covered",
293
- "surfaceEvidenceRefs": ["surface-gui"],
294
- "adversarialCaseRefs": ["case-invalid-input"]
295
- },
296
- {
297
- "id": "contract-out-of-scope",
298
- "contractRef": "contract intentionally outside this story",
299
- "obligation": "explicitly omitted approved-contract surface",
300
- "status": "not_applicable",
301
- "reason": "why this contract does not apply to the current story"
302
- }
270
+ { "id": "<id>", "contractRef": "<approved contract id>", "obligation": "<required behavior>", "status": "covered", "surfaceEvidenceRefs": ["<surface-id>"], "adversarialCaseRefs": ["<case-id>"] }
303
271
  ],
304
272
  "surfaceEvidence": [
305
- {
306
- "id": "surface-gui",
307
- "contractRef": "user-facing surface or public interface under test",
308
- "surface": "gui|web|cli|api|package|algorithm|math|native|desktop|tui",
309
- "invocation": "real browser action, CLI command, API/package consumer call, or algorithm/property check",
310
- "verdict": "passed",
311
- "artifactRefs": ["browser-run", "gui-screenshot"]
312
- },
313
- {
314
- "id": "surface-cli",
315
- "contractRef": "CLI or command-line interface under test",
316
- "surface": "cli",
317
- "invocation": "argv replay executed by the Ultragoal runtime",
318
- "verdict": "passed",
319
- "artifactRefs": ["cli-replay"]
320
- },
321
- {
322
- "id": "surface-api",
323
- "contractRef": "API/package public interface under test",
324
- "surface": "api/package",
325
- "invocation": "real endpoint call, package consumer call, or schema contract check",
326
- "verdict": "passed",
327
- "artifactRefs": ["api-package-report"]
328
- },
329
- {
330
- "id": "surface-algorithm",
331
- "contractRef": "algorithm/math invariant under test",
332
- "surface": "algorithm/math",
333
- "invocation": "property, boundary, or invariant test run",
334
- "verdict": "passed",
335
- "artifactRefs": ["algorithm-report"]
336
- },
337
- {
338
- "id": "surface-out-of-scope",
339
- "contractRef": "surface intentionally outside this story",
340
- "surface": "gui|web|cli|api|package|algorithm|math|native|desktop|tui",
341
- "status": "not_applicable",
342
- "reason": "why this surface does not apply to the current story"
343
- }
273
+ { "id": "<surface-id>", "contractRef": "<surface under test>", "surface": "gui|web|cli|api|package|algorithm|math|native|desktop|tui", "invocation": "<real invocation>", "verdict": "passed", "artifactRefs": ["<ref-id>"] }
344
274
  ],
345
275
  "adversarialCases": [
346
- {
347
- "id": "case-invalid-input",
348
- "contractRef": "approved plan/spec/acceptance criterion or user-facing contract id",
349
- "scenario": "boundary/property/adversarial/failure-mode input or user action",
350
- "expectedBehavior": "contract-required rejection, handling, or invariant preservation",
351
- "verdict": "passed",
352
- "artifactRefs": ["adversarial-report"]
353
- }
276
+ { "id": "<case-id>", "contractRef": "<approved contract id>", "scenario": "<boundary/adversarial input>", "expectedBehavior": "<required handling>", "verdict": "passed", "artifactRefs": ["<ref-id>"] }
354
277
  ],
355
278
  "blockers": []
356
279
  },
357
280
  "iteration": {
358
281
  "status": "passed",
359
- "evidence": "blockers were absent or resolved and the full verification loop was rerun cleanly",
282
+ "evidence": "blockers absent or resolved and the full loop was rerun cleanly",
360
283
  "fullRerun": true,
361
284
  "rerunCommands": ["bun test:e2e", "bun test:red-team"],
362
285
  "blockers": []
@@ -364,6 +287,8 @@ The native `checkpoint --status complete` command rejects missing or shallow gat
364
287
  }
365
288
  ```
366
289
 
290
+ Provide one `artifactRefs` entry per live surface actually exercised, using the surface-appropriate `kind` and evidence rules from steps 6–7 above; the CLI rejects missing or shallow gates. `status: "not_applicable"` rows are allowed only in `contractCoverage` and `surfaceEvidence` and each requires `contractRef` plus `reason`.
291
+
367
292
  For CLI replay artifacts, the JSON at `path` must be an object like `{"schemaVersion":1,"kind":"cli-replay","replaySafe":true,"command":["bun","-e","console.log(\"ultragoal-cli-ok\")"],"recordedStdout":"ultragoal-cli-ok\n"}`. Use `replayExempt` only for audited unsafe/non-deterministic invocations, with exact fields `reasonCode`, `reason`, `approvedBy`, and `fallbackArtifactRefs`. `reason` must be substantive and audited, `approvedBy` must identify the verifier, and `fallbackArtifactRefs` must reference same-surface structurally valid fallback artifacts. Allowed `reasonCode` values are exactly `unsafe_side_effect`, `requires_credentials`, `requires_network`, `non_deterministic_external`, `destructive`, `interactive_only`, and `platform_unavailable`.
368
293
 
369
294
  ## Review mode
@@ -392,6 +317,6 @@ The skill tool then dispatches `/skill:ralplan` or `/skill:deep-interview` same-
392
317
  - For back-to-back ultragoal runs in the same session/thread, when `goal({"op":"get"})` still reports an active aggregate, call `goal({"op":"drop"})` before `goal({"op":"create"})`; when no active goal exists or the prior aggregate is already complete or dropped, call `goal({"op":"create"})` directly. The goal tool remains callable across drop; no slash-command cleanup exists or is required.
393
318
  - Never call `goal({"op":"create"})` when `goal({"op":"get"})` reports a different active goal.
394
319
  - Never call `goal({"op":"complete"})` unless the aggregate run or legacy per-story goal is actually complete.
395
- - In aggregate mode, intermediate and final story checkpoints require a matching `active` GJC goal snapshot; omitted complete-checkpoint `--gjc-goal-json` reads that snapshot from current session state, and the final story checkpoint creates the final aggregate receipt before `goal({"op":"complete"})` may reconcile the inline goal state.
396
- - Completion checkpoints require read-only goal snapshot reconciliation: omit `--gjc-goal-json` to use current session state, or pass an explicit JSON/path override that remains strictly validated; shell commands and hooks must not mutate goal state.
320
+ - In aggregate mode, intermediate and final story checkpoints update durable `goals.json` state and append receipt proof to `ledger.jsonl`; the final story checkpoint creates the final aggregate receipt before the agent may call `goal({"op":"complete"})`.
321
+ - Completion checkpoints require `--quality-gate-json` only. Shell commands and hooks must not mutate goal state; the agent reconciles inline goal-tool state after durable completion.
397
322
  - Treat `ledger.jsonl` as the durable audit trail; checkpoint after every success or failure.
@@ -136,6 +136,17 @@ export interface ExtensionUIDialogOptions {
136
136
  optionLabel: string;
137
137
  onSubmit: (text: string) => void;
138
138
  };
139
+ /**
140
+ * Inline free-text input for a non-answer clarification action. It is
141
+ * separate from `customInput` so callers can distinguish "ask about these
142
+ * choices" from "provide my own answer". Empty/whitespace-only submissions
143
+ * may be rejected by the selector when `allowEmpty` is false.
144
+ */
145
+ clarificationInput?: {
146
+ optionLabel: string;
147
+ onSubmit: (text: string) => void;
148
+ allowEmpty?: boolean;
149
+ };
139
150
  }
140
151
 
141
152
  /** Raw terminal input listener for extensions. */
@@ -100,7 +100,7 @@ async function resolveSpecContent(rawSpec: string, cwd: string): Promise<string>
100
100
  if (stat.isFile()) return await fs.readFile(candidate, "utf-8");
101
101
  } catch (error) {
102
102
  const err = error as NodeJS.ErrnoException;
103
- if (err.code !== "ENOENT" && err.code !== "ENOTDIR") {
103
+ if (err.code !== "ENOENT" && err.code !== "ENOTDIR" && err.code !== "ENAMETOOLONG") {
104
104
  throw new DeepInterviewCommandError(2, `failed to read --spec ${candidate}: ${err.message}`);
105
105
  }
106
106
  }