@gajae-code/coding-agent 0.4.0 → 0.4.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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [0.4.1] - 2026-06-07
6
+
7
+ ### Changed
8
+
9
+ - Hardened the default system prompt with a `<skill-discipline>` block (never ignore skill text, keep read-only/interview skills from mutating, recommend and invoke the matching `/skill` on approval) and tightened `<communication>` to ban permission-begging/deferral phrasing and never announce remaining work instead of doing it (#392).
10
+ - Cleaned up the bundled GJC workflow skill docs and defaulted execution handoff to ultragoal while prioritizing ralplan refinement (#395, #396).
11
+
5
12
  ## [0.4.0] - 2026-06-06
6
13
 
7
14
  ### Added
@@ -8,7 +8,7 @@ import type { CompactionResult } from "@gajae-code/agent-core/compaction";
8
8
  import type { ImageContent, Model } from "@gajae-code/ai";
9
9
  import type { BashResult } from "../../exec/bash-executor";
10
10
  import type { SessionStats } from "../../session/agent-session";
11
- import type { RpcHandoffResult, RpcHostToolDefinition, RpcSessionState, RpcWorkflowGate, RpcWorkflowGateResolution } from "./rpc-types";
11
+ import type { RpcExtensionUIRequest, RpcHandoffResult, RpcHostToolDefinition, RpcSessionState, RpcUnattendedAccepted, RpcUnattendedDeclaration, RpcWorkflowGate, RpcWorkflowGateResolution } from "./rpc-types";
12
12
  export interface RpcClientOptions {
13
13
  /** Path to the CLI entry point (default: searches for dist/cli.js) */
14
14
  cliPath?: string;
@@ -68,6 +68,16 @@ export declare class RpcClient {
68
68
  * Answer a workflow lifecycle gate and wait for the server resolution envelope.
69
69
  */
70
70
  respondGate(gateId: string, answer: unknown, idempotencyKey?: string): Promise<RpcWorkflowGateResolution>;
71
+ /**
72
+ * Subscribe to extension UI requests emitted by the server (e.g. select /
73
+ * input / editor / confirm). Returns an unsubscribe function.
74
+ */
75
+ onExtensionUiRequest(listener: (req: RpcExtensionUIRequest) => void): () => void;
76
+ /**
77
+ * Enter unattended mode by declaring budget + scopes + action allowlist.
78
+ * Returns the accepted declaration, or rejects (fail-closed) on refusal.
79
+ */
80
+ negotiateUnattended(declaration: RpcUnattendedDeclaration): Promise<RpcUnattendedAccepted>;
71
81
  /**
72
82
  * Get collected stderr output (useful for debugging).
73
83
  */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@gajae-code/coding-agent",
4
- "version": "0.4.0",
4
+ "version": "0.4.1",
5
5
  "description": "Gajae Code CLI with read, bash, edit, write tools and session management",
6
6
  "homepage": "https://gaebal-gajae.dev",
7
7
  "author": "Yeachan-Heo",
@@ -50,12 +50,12 @@
50
50
  "@agentclientprotocol/sdk": "0.21.0",
51
51
  "@babel/parser": "^7.29.3",
52
52
  "@mozilla/readability": "^0.6.0",
53
- "@gajae-code/stats": "0.4.0",
54
- "@gajae-code/agent-core": "0.4.0",
55
- "@gajae-code/ai": "0.4.0",
56
- "@gajae-code/natives": "0.4.0",
57
- "@gajae-code/tui": "0.4.0",
58
- "@gajae-code/utils": "0.4.0",
53
+ "@gajae-code/stats": "0.4.1",
54
+ "@gajae-code/agent-core": "0.4.1",
55
+ "@gajae-code/ai": "0.4.1",
56
+ "@gajae-code/natives": "0.4.1",
57
+ "@gajae-code/tui": "0.4.1",
58
+ "@gajae-code/utils": "0.4.1",
59
59
  "@puppeteer/browsers": "^2.13.0",
60
60
  "@types/turndown": "5.0.6",
61
61
  "@xterm/headless": "^6.0.0",
@@ -530,28 +530,24 @@ After the spec is written, mark it `pending approval` and present execution opti
530
530
 
531
531
  **Options:**
532
532
 
533
- 1. **Refine with ralplan consensus (Recommended)**
534
- - Description: "Consensus-refine this spec with Planner/Architect/Critic, then stop for explicit execution approval. Maximum quality."
535
- - Action: Only after the user selects this option, invoke `/skill:ralplan --consensus --direct` with the spec file path as context. The `--direct` flag skips the ralplan skill's interview phase (the deep interview already gathered requirements), while `--consensus` triggers the Planner/Architect/Critic loop. When consensus completes and produces a plan in `.gjc/plans/`, stop with that plan marked `pending approval`; do not automatically invoke execution or any other execution skill.
536
- - Pipeline: `deep-interview spec → explicit approval to refine → ralplan --consensus --direct → pending approval → separate execution approval`
533
+ 1. **Refine with ralplan consensus (Recommended — default for almost all specs)**
534
+ - Description: "Consensus-refine this spec with Planner/Architect/Critic, then stop for explicit execution approval. Maximum quality. Prefer this unless the spec is already implementation-ready and trivially simple."
535
+ - Action: Only after the user selects this option, invoke `/skill:ralplan` with the spec file path as context. Ralplan is already the Planner Architect Critic consensus workflow, so no extra slash-skill flags are required or supported. When consensus completes and produces a plan in `.gjc/plans/`, stop with that plan marked `pending approval`; do not automatically invoke execution or any other execution skill.
536
+ - Pipeline: `deep-interview spec → explicit approval to refine → ralplan → pending approval → separate execution approval`
537
537
 
538
- 2. **Execute with team**
539
- - Description: "Full autonomous pipelineplanning, parallel implementation, QA, validation. Faster but without consensus refinement."
540
- - Action: Invoke `/skill:team` with the spec file path as context only after the user explicitly selects this execution option. The spec replaces team planning input.
538
+ 2. **Execute with ultragoal (only when spec is already implementation-ready and really simple)**
539
+ - Description: "Goal-tracked autonomous executiondrives the spec to completion with verification. Skip ralplan refinement only when the spec is concrete, low-risk, and trivially small."
540
+ - Action: Invoke `/skill:ultragoal` with the spec file path as context only after the user explicitly selects this execution option. The spec replaces ultragoal planning input. Recommend this only when the spec needs no further planning; otherwise route through ralplan refinement first.
541
541
 
542
- 3. **Execute with team**
543
- - Description: "Persistence loop with architect verificationkeeps working until all acceptance criteria pass"
544
- - Action: Invoke `/skill:team` with the spec file path as the task definition.
542
+ 3. **Execute with team (only when implementation-ready, simple, AND tmux parallelization is required)**
543
+ - Description: "N coordinated parallel agents in tmux only when the spec is already implementation-ready and genuinely needs tmux-based interactive worker parallelization."
544
+ - Action: Invoke `/skill:team` with the spec file path as the shared plan only after the user explicitly selects this option. Reserve this for the narrow case where the spec is simple/ready and tmux interactive parallel workers are actually needed; otherwise prefer ralplan refinement, then ultragoal.
545
545
 
546
- 4. **Execute with team**
547
- - Description: "N coordinated parallel agents — fastest execution for large specs"
548
- - Action: Invoke `/skill:team` with the spec file path as the shared plan.
549
-
550
- 5. **Refine further**
546
+ 4. **Refine further**
551
547
  - Description: "Continue interviewing to improve clarity (current: {score}%)"
552
548
  - Action: Return to Phase 2 interview loop.
553
549
 
554
- **IMPORTANT:** On explicit execution selection, **MUST** use the chosen bundled GJC workflow skill entrypoint (`/skill:ralplan` or `/skill:team`) inside the agent session. `gjc ralplan` is a native CLI that accepts the documented skill flags and seeds local `.gjc/state` receipts; agent sessions should still drive the consensus loop through `/skill:ralplan`. `gjc team` is a native tmux runtime command and may be used only when the Team workflow explicitly requires the CLI runtime. Do NOT implement directly. The deep-interview agent is a requirements agent, not an execution agent. If oversized initial context was summarized, pass the spec and prompt-safe summary forward, not the raw oversized source material. Without explicit execution selection, stop with the spec marked `pending approval`.
550
+ **IMPORTANT:** On explicit execution selection, **MUST** use the chosen bundled GJC workflow skill entrypoint (`/skill:ralplan`, `/skill:ultragoal`, or `/skill:team`) inside the agent session. `gjc ralplan` is a native CLI that accepts the documented skill flags and seeds local `.gjc/state` receipts; agent sessions should still drive the consensus loop through `/skill:ralplan`. Implementation handoff defaults to `/skill:ultragoal`; `/skill:team` is reserved for when tmux-based interactive worker parallelization is genuinely required, and `gjc team` is a native tmux runtime command used only when the Team workflow explicitly requires the CLI runtime. Do NOT implement directly. The deep-interview agent is a requirements agent, not an execution agent. If oversized initial context was summarized, pass the spec and prompt-safe summary forward, not the raw oversized source material. Without explicit execution selection, stop with the spec marked `pending approval`.
555
551
 
556
552
  ### Phase 5b: Handoff before chain
557
553
 
@@ -577,7 +573,7 @@ Stage 1: Deep Interview Stage 2: ralplan consensus Stage 3: Separ
577
573
  ┌─────────────────────┐ ┌───────────────────────────┐ ┌──────────────────────┐
578
574
  │ Socratic Q&A │ │ Planner creates plan │ │ User chooses if/how │
579
575
  │ Ambiguity scoring │───>│ Architect reviews │───>│ execution proceeds │
580
- │ Challenge agents │ │ Critic validates │ │ via team or ultragoal
576
+ │ Challenge agents │ │ Critic validates │ │ via ultragoal (default)
581
577
  │ Spec crystallization│ │ Loop until consensus │ │ no auto-handoff │
582
578
  │ Gate: ≤<resolvedThresholdPercent> ambiguity│ │ ADR + RALPLAN-DR summary │ │ │
583
579
  └─────────────────────┘ └───────────────────────────┘ └──────────────────────┘
@@ -604,7 +600,7 @@ Skipping any stage is possible but reduces quality assurance:
604
600
  - Round 0 topology confirmation happens before ambiguity scoring; Phase 2 scoring must honor locked topology and rotate targeting across active components when more than one is present
605
601
  - Use `gjc state write` / `gjc state read` for interview state persistence; the initial and subsequent deep-interview state payloads must include `threshold_source` alongside `threshold`; do not edit `.gjc/state` directly without force override.
606
602
  - Use the GJC workflow CLI to save the final spec at `.gjc/specs/deep-interview-{slug}.md` exactly; do not use `write`, `edit`, or `ast_edit` directly on `.gjc/` paths without force override.
607
- - Use public GJC workflow entrypoints to bridge to ralplan/team only after explicit execution approval — never implement directly
603
+ - Use public GJC workflow entrypoints to bridge to ralplan, ultragoal, or team only after explicit execution approval — never implement directly. Implementation handoff defaults to ultragoal; reserve team for when tmux-based interactive worker parallelization is genuinely required.
608
604
  - Challenge agent modes are prompt injections, not separate agent spawns
609
605
  - Use internal fragment auto-modes only at their documented hooks: `auto-research-greenfield.md` between Step 2a and 2b for greenfield `research: true` questions, and `auto-answer-uncertain.md` as Step 2b′ after `ask` resolves and before scoring.
610
606
  - Fragment auto-modes are loaded on demand as `kind: "skill-fragment"`; they are not public workflow skills, not slash-command/discoverable, and not `skill://` registrations.
@@ -734,7 +730,7 @@ Why bad: 45% ambiguity means nearly half the requirements are unclear. The mathe
734
730
  - [ ] Spec includes: topology, goal, constraints, acceptance criteria, clarity breakdown, transcript
735
731
  - [ ] Execution bridge presented via the `ask` tool
736
732
  - [ ] Selected execution mode invoked via public GJC workflow entrypoint only after explicit execution approval (never direct implementation)
737
- - [ ] If 3-stage pipeline selected: ralplan --consensus --direct invoked, then stopped with the consensus plan marked `pending approval` until the user explicitly approves execution
733
+ - [ ] If 3-stage pipeline selected: `/skill:ralplan` invoked with the spec as context, then stopped with the consensus plan marked `pending approval` until the user explicitly approves execution
738
734
  - [ ] State cleaned up after approved workflow handoff
739
735
  - [ ] Brownfield confirmation questions cite repo evidence (file/path/pattern) before asking the user to decide
740
736
  - [ ] Scope-fuzzy tasks can trigger ontology-style questioning to stabilize the core entity before feature elaboration
@@ -783,7 +779,7 @@ Team routing: "Your request is quite open-ended. Would you like to run a deep in
783
779
  [Yes, interview first] [No, expand directly]
784
780
  ```
785
781
 
786
- If the user chooses interview, team routing invokes `/skill:deep-interview`. When the interview completes and the user selects "Execute with team", the spec becomes Phase 0 output and team proceeds from the approved spec.
782
+ If the user chooses interview, team routing invokes `/skill:deep-interview`. When the interview completes and the user selects an execution path (ultragoal by default, or team when tmux-based interactive parallelization is required), the spec becomes Phase 0 output and the chosen workflow proceeds from the approved spec.
787
783
 
788
784
  ## Approval-Gated Pipeline: deep-interview → ralplan → pending approval
789
785
 
@@ -794,17 +790,17 @@ The recommended refinement path chains clarity and feasibility gates, then stops
794
790
  → Socratic Q&A until ambiguity ≤ <resolvedThresholdPercent>
795
791
  → Spec written to .gjc/specs/deep-interview-{slug}.md
796
792
  → User explicitly selects "Refine with ralplan consensus"
797
- → /skill:ralplan --consensus --direct (spec as input, skip interview)
793
+ → /skill:ralplan (spec as input)
798
794
  → Planner creates implementation plan from spec
799
795
  → Architect reviews for architectural soundness
800
796
  → Critic validates quality and testability
801
797
  → Loop until consensus (max 5 iterations)
802
798
  → Consensus plan written to .gjc/plans/
803
799
  → Stop with the consensus plan marked pending approval
804
- → Only a separate explicit execution approval may invoke team or ultragoal
800
+ → Only a separate explicit execution approval may invoke execution (ultragoal by default; team only when tmux-based interactive worker parallelization is required)
805
801
  ```
806
802
 
807
- **The ralplan skill receives the spec with `--consensus --direct` flags** because the deep interview already did the requirements gathering. The `--direct` flag (supported by the ralplan skill, which ralplan aliases) skips the interview phase and goes straight to Planner → Architect → Critic consensus. The consensus plan includes:
803
+ **The ralplan skill receives the spec as context through `/skill:ralplan`** because ralplan is already the GJC Planner → Architect → Critic consensus workflow. The consensus plan includes:
808
804
  - RALPLAN-DR summary (Principles, Decision Drivers, Options)
809
805
  - ADR (Decision, Drivers, Alternatives, Why chosen, Consequences)
810
806
  - Testable acceptance criteria (inherited from deep-interview spec)
@@ -61,7 +61,7 @@ The consensus workflow:
61
61
  - Viable Options (>=2) with bounded pros/cons
62
62
  - If only one viable option remains, explicit invalidation rationale for alternatives
63
63
  - Deliberate mode only: pre-mortem (3 scenarios) + expanded test plan (unit/integration/e2e/observability)
64
- 2. **User feedback** *(--interactive only)*: If `--interactive` is set, use `AskUserQuestion` to present the draft plan **plus the Principles / Drivers / Options summary** before review (Proceed to review / Request changes / Skip review). Otherwise, automatically proceed to review.
64
+ 2. **User feedback** *(--interactive only)*: If `--interactive` is set, use the `ask` tool to present the draft plan **plus the Principles / Drivers / Options summary** before review (Proceed to review / Request changes / Skip review). Otherwise, automatically proceed to review.
65
65
  3. **Architect** reviews for architectural soundness and must provide the strongest steelman antithesis, at least one real tradeoff tension, and (when possible) synthesis — **await completion before step 4**. In deliberate mode, Architect should explicitly flag principle violations.
66
66
  - The Architect agent/subagent must persist its review with `gjc ralplan --write --stage architect --stage_n <N> --artifact "..." --json`, then return the receipt/path plus compact verdict/status (`CLEAR`/`WATCH`/`BLOCK`, `APPROVE`/`COMMENT`/`REQUEST CHANGES`) instead of pasting the full review body.
67
67
  4. **Critic** evaluates against quality criteria — run only after step 3 completes. Critic must enforce principle-option consistency, fair alternatives, risk mitigation clarity, testable acceptance criteria, and concrete verification steps. In deliberate mode, Critic must reject missing/weak pre-mortem or expanded test plan.
@@ -74,9 +74,9 @@ The consensus workflow:
74
74
  d. Return to Critic evaluation
75
75
  e. Repeat this loop until Critic returns `APPROVE` or 5 iterations are reached
76
76
  f. If 5 iterations are reached without `APPROVE`, present the best version to the user
77
- 6. On Critic approval, 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/plans`. *(--interactive only)* If `--interactive` is set, use `AskUserQuestion` to present the plan with approval options (Approve execution via team (Recommended) / Compact then return for execution approval / Request changes / Reject). Final plan must include ADR (Decision, Drivers, Alternatives considered, Why chosen, Consequences, Follow-ups). Otherwise, output the final plan and stop before any mutation or delegation.
78
- 7. *(--interactive only)* User chooses: Approve team execution, Request changes, or Reject
79
- 8. *(--interactive only)* On approval: invoke `/skill:team` for execution -- never implement directly
77
+ 6. On Critic approval, 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/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). Otherwise, output the final plan and stop before any mutation or delegation.
78
+ 7. *(--interactive only)* User chooses: Approve ultragoal execution (recommended), Approve team execution (tmux parallelization only), Request changes, or Reject
79
+ 8. *(--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
80
80
 
81
81
  Before invoking `/skill:team` or `/skill:ultragoal`, mark ralplan ready for handoff so the skill tool's chain guard permits the transition:
82
82
 
@@ -121,7 +121,7 @@ Set `--planner-resumable true` only when the parent session is provably persiste
121
121
 
122
122
  ### Why the Gate Exists
123
123
 
124
- Execution modes (team, team, team, team, team) spin up heavy multi-agent orchestration. When launched on a vague request like "team improve the app", agents have no clear target — they waste cycles on scope discovery that should happen during planning, often delivering partial or misaligned work that requires rework.
124
+ Execution skills (`ultragoal` and `team`) drive implementation rather than scope discovery. When launched on a vague request like "team improve the app", agents have no clear target — they waste cycles on scope discovery that should happen during planning, often delivering partial or misaligned work that requires rework.
125
125
 
126
126
  The ralplan-first gate intercepts underspecified execution requests and redirects them through the ralplan consensus planning workflow. This ensures:
127
127
  - **Explicit scope**: A PRD defines exactly what will be built
@@ -177,8 +177,8 @@ The gate auto-passes when it detects **any** concrete signal. You do not need al
177
177
  - **Architect** reviews for soundness
178
178
  - **Critic** validates quality and testability
179
179
  5. On consensus approval, user chooses execution path:
180
- - **team**: parallel coordinated agents (recommended)
181
- - **team**: sequential execution with verification
180
+ - **ultragoal**: goal-tracked autonomous execution with verification (recommended default)
181
+ - **team**: N coordinated parallel agents in tmux — only when tmux-based interactive worker parallelization is required
182
182
  6. Execution begins with a clear, bounded plan
183
183
 
184
184
  ### Troubleshooting
@@ -20,6 +20,8 @@ import type {
20
20
  RpcHostToolUpdate,
21
21
  RpcResponse,
22
22
  RpcSessionState,
23
+ RpcUnattendedAccepted,
24
+ RpcUnattendedDeclaration,
23
25
  RpcWorkflowGate,
24
26
  RpcWorkflowGateResolution,
25
27
  RpcWorkflowGateResponse,
@@ -341,6 +343,26 @@ export class RpcClient {
341
343
  return this.#getData(response);
342
344
  }
343
345
 
346
+ /**
347
+ * Subscribe to extension UI requests emitted by the server (e.g. select /
348
+ * input / editor / confirm). Returns an unsubscribe function.
349
+ */
350
+ onExtensionUiRequest(listener: (req: RpcExtensionUIRequest) => void): () => void {
351
+ this.#extensionUiListeners.add(listener);
352
+ return () => {
353
+ this.#extensionUiListeners.delete(listener);
354
+ };
355
+ }
356
+
357
+ /**
358
+ * Enter unattended mode by declaring budget + scopes + action allowlist.
359
+ * Returns the accepted declaration, or rejects (fail-closed) on refusal.
360
+ */
361
+ async negotiateUnattended(declaration: RpcUnattendedDeclaration): Promise<RpcUnattendedAccepted> {
362
+ const response = await this.#send({ type: "negotiate_unattended", declaration });
363
+ return this.#getData(response);
364
+ }
365
+
344
366
  /**
345
367
  * Get collected stderr output (useful for debugging).
346
368
  */
@@ -69,6 +69,13 @@ Use for read-only plan critique. It approves only when execution can proceed wit
69
69
  - Before explicit execution approval, planning workflows NEVER edit product source, run mutation-oriented shell commands, commit, push, open PRs, or delegate implementation tasks.
70
70
  </routing>
71
71
 
72
+ <skill-discipline>
73
+ - Never ignore a skill invocation or any skill text. When a skill is active, read it in full and follow its instructions exactly. Do not assume, paraphrase, reorder, or substitute steps.
74
+ - Read-only and interview-style skills (e.g. `deep-interview`, `planner`, `architect`, `critic`) MUST NOT implement, edit product source, commit, or run mutating commands. Honor each skill's read-only or pending-approval boundary even when the fix looks obvious.
75
+ - When a task fits a bundled skill, recommend invoking the corresponding `/skill:<name>`; on user approval, invoke it. Never silently bypass an applicable skill.
76
+ - When no skill is active, or the active skill explicitly permits the action, and the action is non-destructive and clearly correct, perform it directly instead of asking.
77
+ </skill-discipline>
78
+
72
79
  <runtime-state>
73
80
  - Runtime state, specs, plans, and workflow ledgers belong under `.gjc/`.
74
81
  - Default workflow skills are bundled from `packages/coding-agent/src/defaults/gjc/skills/`. Runtime user/project `.gjc` discovery remains supported, but committed repo-visible `.gjc` defaults are not the source of truth.
@@ -82,6 +89,8 @@ Use for read-only plan critique. It approves only when execution can proceed wit
82
89
  - Do not narrate progress, ceremony, timing, scope inflation, or session limits.
83
90
  - If the user's intent is clear, act without asking. Ask only when the next step is destructive or requires a missing choice that materially changes the outcome.
84
91
  - When the user proposes something wrong, say what breaks and what to do instead once; then defer to their call.
92
+ - Never use permission-begging or deferral phrasing ("if you want", "if you'd like", "shall I", "I will now", "next I plan to"). For a destructive next step, state the recommended action and stop for approval. For a non-destructive, clearly correct next step, do it directly in the same turn.
93
+ - Do not defer actionable work. Underpromise and overdeliver: report only what is done or in progress, never announce remaining work instead of doing it.
85
94
  </communication>
86
95
 
87
96
  <completion-contract>