Skip to content

Commit ca64ae7

Browse files
vlgalibCommandCodeBot
andcommitted
feat: align delegation prompts with target schema — 6 fixes
- Bob: DELEGATE→MUST DELEGATE, added MANDATORY COMPLETION GATE (Critic + Vision-for-UI) - Bob: "delegate to Manager" → "MUST delegate to Manager" (hard rule, no self-orchestration) - Plan config: block write/edit/apply_patch (was only bash/grep/glob/webfetch) - Plan prompt: write scope = .bob/plans/*.md + .bob/drafts/*.md (was .bob/*.md) - Manager: added Wave Concurrency Limits (max 7, drop to 4) + background_output pattern - Critic: added Mandatory Escalation Gate section Co-authored-by: CommandCodeBot <noreply@commandcode.ai>
1 parent 4132412 commit ca64ae7

6 files changed

Lines changed: 16 additions & 7 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@hiai-gg/hiai-opencode",
3-
"version": "0.4.2",
3+
"version": "0.4.3",
44
"description": "HiAi OpenCode Plugin — multi-agent orchestration for OpenCode with 10 agents, LSP tools, browser automation, Memory, Session management, and Caveman protocol",
55
"type": "module",
66
"main": "dist/index.js",

src/agents/bob.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ Classify EVERY message before acting:
6565
- 2x+ effort difference or missing critical info → MUST ask
6666
6767
### Step 3: Delegation
68-
**Default: DELEGATE.**
68+
**Default: MUST DELEGATE.**
6969
> **Multi-point task (≳3 points / multi-file / open-ended)? → plan FIRST** (Key Rule 3):
7070
> Use \`task({subagent_type: "plan", description: "...", prompt: "..."})\` for a phased parallel plan, THEN dispatch its waves
7171
> (via Manager when 5+ steps or 3+ parallel). Only trivial 1-2 point work goes straight to a build/general.
@@ -121,6 +121,7 @@ When delegating via task(), use the appropriate category:
121121
- You NEVER execute write, edit, bash, or any mutation tool yourself.
122122
- Always delegate implementation to build/general.
123123
- Always verify with Critic before reporting completion.
124+
- **MANDATORY COMPLETION GATE**: After EVERY specialist completes, you MUST call task({subagent_type: "critic", ...}). If ANY UI/UX work was done, you MUST also call task({subagent_type: "vision", ...}) via agent-browser. NEVER escalate to user until Critic + Vision-for-UI have passed.
124125
- Fix only your own issues. Do NOT fix pre-existing.
125126
126127
## Subagent Handoff Protocol (CRITICAL — replaces Receiving Results)
@@ -177,7 +178,7 @@ Phase 2 (<name>): serial steps: [2.1/build then 2.2/build] — deps: Phase 1 —
177178
\`\`\`
178179
179180
### Step 2 — Decide dispatch mode
180-
- **5+ steps OR 3+ parallel steps** → delegate to Manager:
181+
- **5+ steps OR 3+ parallel steps** → MUST delegate to Manager:
181182
\`task({subagent_type: "manager", description: "Execute plan: <title>", prompt: "<THE FULL PLAN TEXT + Execution Graph Extract>"})\`
182183
Include BOTH the raw plan text (from deliverable body) AND the Execution Graph Extract in the Manager prompt.
183184
Manager inherits the plan text so it can dispatch each phase independently.

src/agents/critic.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ export const CRITIC_PROMPT = `You are Critic, a review gate agent.
66
## Identity
77
Quality Guardian. You verify code quality, correctness, and adherence to standards. Your verdict is final.
88
9+
## Mandatory Escalation Gate
10+
Critic review is MANDATORY before any results are escalated to the user. No agent may report completion without passing this gate. Your APPROVED verdict is the single unlock for user-facing delivery.
11+
912
## Role
1013
- Review code changes for correctness, security, and quality
1114
- Verify that implementations match requirements

src/agents/manager.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ Manager receives TWO things from Bob in the prompt:
2525
2626
Manager's job is to dispatch phases in order, respecting the annotations — NOT to re-derive parallelism.
2727
28+
## Wave Concurrency Limits (HARD CAP)
29+
Max 7 tasks per wave. When overloaded (>7 independent tasks), drop to 4 per wave and serialize overflow into a follow-on sub-wave. Never exceed 7 concurrent task() calls in a single dispatch cycle.
30+
2831
## Available MCP Tools
2932
3033
**Library/API docs:** use the \`context7\` skill (CLI/HTTP) on demand — not an MCP tool.
@@ -68,7 +71,8 @@ NEVER ask 'should I continue' between steps. Just delegate next task.
6871
2. **Parse Phases** — Extract ordered phases from the plan text or extract. Identify parallel vs serial steps per phase.
6972
3. **Dispatch Phase** — For the current phase:
7073
- Fire ALL \`parallel: yes\` steps concurrently via \`task()\` to their \`owner\` subagent type.
71-
- Collect ALL results before proceeding. If any step fails, decide: retry, escalate, or mark partial.
74+
- Use \`background_output(task_id, block=true)\` to collect results from dispatched agents.
75+
- If any step fails, decide: retry, escalate, or mark partial.
7276
- For \`parallel: no\` steps: dispatch in dependency order (step N must finish before step N+1 starts).
7377
4. **Advance** — Once all steps in phase N complete, move to phase N+1.
7478
5. **Verify** — After all phases, collect evidence and report complete/partial summary.

src/agents/plan.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ When user says 'do X' → ALWAYS interpret as 'create a plan for X'.
1111
NEVER write code. NEVER edit files (except .md plans).
1212
1313
## Identity
14-
Principal Architect. You plan, you do not implement. You write ONLY .bob/*.md files and plan documents.
14+
Principal Architect. You plan, you do not implement. You write ONLY .bob/plans/*.md and .bob/drafts/*.md files and plan documents.
1515
1616
## Role
1717
- Analyze requirements and codebase architecture
@@ -73,7 +73,8 @@ task → ALWAYS fan out first.
7373
7474
## Constraints
7575
- You are READ-ONLY for code files. No write, edit, bash.
76-
- You may write plan documents to .bob/plans/*.md
76+
- You may write plan documents to .bob/plans/*.md and .bob/drafts/*.md
77+
- .bob/drafts/ is for work-in-progress plans; move to .bob/plans/ when ready for dispatch
7778
- You delegate research to explore (grep/glob blocked for you); do not self-explore the codebase
7879
- You never implement — only plan
7980

src/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ export const DEFAULT_CONFIG: BobConfig = {
139139
lsp_prepare_rename: false,
140140
lsp_rename: false,
141141
},
142-
plan: { bash: false, grep: false, glob: false, webfetch: false },
142+
plan: { write: false, edit: false, apply_patch: false, bash: false, grep: false, glob: false, webfetch: false },
143143
critic: {
144144
write: false,
145145
edit: false,

0 commit comments

Comments
 (0)