@kolisachint/hoocode-agent 0.4.15 → 0.4.17

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 (45) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/core/dispatch-evaluator.d.ts +9 -36
  3. package/dist/core/dispatch-evaluator.d.ts.map +1 -1
  4. package/dist/core/dispatch-evaluator.js +11 -302
  5. package/dist/core/dispatch-evaluator.js.map +1 -1
  6. package/dist/core/subagent-pool.d.ts +2 -13
  7. package/dist/core/subagent-pool.d.ts.map +1 -1
  8. package/dist/core/subagent-pool.js +6 -31
  9. package/dist/core/subagent-pool.js.map +1 -1
  10. package/dist/core/token-budget.d.ts +4 -0
  11. package/dist/core/token-budget.d.ts.map +1 -1
  12. package/dist/core/token-budget.js +4 -2
  13. package/dist/core/token-budget.js.map +1 -1
  14. package/dist/core/tools/subagent.d.ts +11 -3
  15. package/dist/core/tools/subagent.d.ts.map +1 -1
  16. package/dist/core/tools/subagent.js +32 -7
  17. package/dist/core/tools/subagent.js.map +1 -1
  18. package/dist/init-templates.generated.d.ts +0 -1
  19. package/dist/init-templates.generated.d.ts.map +1 -1
  20. package/dist/init-templates.generated.js +5 -13
  21. package/dist/init-templates.generated.js.map +1 -1
  22. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  23. package/dist/modes/interactive/interactive-mode.js +1 -1
  24. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  25. package/docs/routing.md +48 -36
  26. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  27. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  28. package/examples/extensions/sandbox/package.json +1 -1
  29. package/examples/extensions/with-deps/package.json +1 -1
  30. package/package.json +4 -4
  31. package/templates/agents/doc.md +1 -0
  32. package/templates/agents/edit.md +1 -0
  33. package/templates/agents/explore.md +1 -0
  34. package/templates/agents/review.md +1 -0
  35. package/templates/agents/test.md +1 -0
  36. package/dist/core/subagent.d.ts +0 -14
  37. package/dist/core/subagent.d.ts.map +0 -1
  38. package/dist/core/subagent.js +0 -27
  39. package/dist/core/subagent.js.map +0 -1
  40. package/templates/subagent/doc.md +0 -16
  41. package/templates/subagent/edit.md +0 -22
  42. package/templates/subagent/explore.md +0 -21
  43. package/templates/subagent/fix.md +0 -22
  44. package/templates/subagent/review.md +0 -21
  45. package/templates/subagent/test.md +0 -20
package/docs/routing.md CHANGED
@@ -1,41 +1,49 @@
1
- # Subagent Routing
1
+ # Subagent Delegation
2
2
 
3
- HooCode uses a deterministic **dispatch evaluator** to decide whether a task should be handled inline by the main agent or delegated to a specialized subagent. No LLM call is made for this decision — it is purely keyword + heuristic based.
3
+ HooCode delegates focused work to specialized **subagents** that run in isolated
4
+ child processes. Delegation is **description-driven**: the parent agent decides
5
+ when to delegate and which agent to use, based on each agent's `description`.
6
+ There is no deterministic keyword router and no blocking dispatch gate.
4
7
 
5
- ## How Routing Decisions Work
8
+ ## How Delegation Works
6
9
 
7
- When the parent agent receives a task (via the `subagent` tool or a `/subagent` slash command), the `DispatchEvaluator` scans the task for keywords and estimates complexity:
10
+ The parent agent has a `Task` tool whose description lists the available agents
11
+ (see the registry below). The model chooses an agent via `subagent_type` and
12
+ passes a self-contained `prompt`. The subagent runs in a fresh context and only
13
+ its final answer is returned to the parent.
8
14
 
9
- - **Low complexity** (< 50 lines, 1 file, read-only or trivial edit) → handle **inline**
10
- - **Medium complexity** (2–3 files, 50–200 lines) → delegate to a **single matching agent**
11
- - **High complexity** (4+ files, 200+ lines, multi-domain) → **split** across multiple subagents
15
+ Guidance baked into the parent prompt:
12
16
 
13
- Keyword routing:
17
+ - Delegate self-contained units where you only need the final result.
18
+ - Prefer handling small, quick, or single-file work inline.
19
+ - The subagent cannot see the parent conversation — pass all needed context in
20
+ `prompt`.
14
21
 
15
- | Keywords | Agent type |
16
- |----------|------------|
17
- | explore, understand, scout, investigate, trace, find | `explore` |
18
- | write, create, implement, refactor, add, build | `edit` |
19
- | test, validate, assert, coverage | `test` |
20
- | review, audit, critique, security, check | `review` |
21
- | document, readme, comment, explain, docs | `doc` |
22
+ The `DispatchEvaluator` no longer routes. It survives only to:
22
23
 
23
- ## When to Expect Inline vs Subagent
24
+ 1. **Block nested delegation** a subagent (`HOOCODE_SUBAGENT_DEPTH>=1`) must not
25
+ spawn further subagents.
26
+ 2. **Record a complexity estimate** in `.hoocode/dispatch/<task_id>/dispatch-log.json`
27
+ for diagnostics. This is a cheap heuristic, not a routing decision.
24
28
 
25
- - **Inline** — Simple single-file changes, read-only lookups, trivial edits.
26
- - **Subagent** — Anything that spans multiple files, requires isolation, or matches a specialized mode (testing, review, documentation).
29
+ ## Available Agents
27
30
 
28
- If you disagree with the evaluator, you can force a subagent by setting `force=true` in the tool call or using the `/subagent <mode> <task>` slash command.
31
+ Agents are defined by frontmatter `.md` files loaded from a registry with
32
+ precedence **project > user > built-in**:
29
33
 
30
- ## How to Force a Subagent with `/subagent`
34
+ - Built-in: `templates/agents/*.md` (explore, edit, test, review, doc)
35
+ - Project: `.hoocode/agents/`, and `.claude/agents/` (Claude Code compatible)
36
+ - User: `~/.hoocode/agents/`, and `~/.claude/agents/`
31
37
 
32
- In interactive mode, type:
38
+ Each definition supplies `name`, `description`, and optional `tools`, `model`,
39
+ `maxTurns`, and `background`. When a definition omits `tools`, built-in modes
40
+ fall back to a per-mode allowlist (`MODE_TOOLS`) so read-only modes (`explore`,
41
+ `test`, `review`) cannot edit or write files.
33
42
 
34
- ```
35
- /subagent <mode> <task>
36
- ```
43
+ ## Forcing a Subagent with `/subagent`
37
44
 
38
- Examples:
45
+ In interactive mode you can dispatch a subagent directly, bypassing the model's
46
+ decision (the mode is still validated against the registry):
39
47
 
40
48
  ```
41
49
  /subagent explore "How does the auth middleware work?"
@@ -44,25 +52,29 @@ Examples:
44
52
  /subagent doc "Write a README for the API package"
45
53
  ```
46
54
 
47
- This bypasses the evaluator and spawns the subagent directly.
48
-
49
55
  ## Execution Model
50
56
 
51
- Subagents run as isolated `hoocode` **child processes**, managed by `SubagentPool`. Each delegation:
57
+ Subagents run as isolated `hoocode` **child processes**, managed by `SubagentPool`.
58
+ Each delegation:
52
59
 
53
- 1. Spawns `hoocode --mode json --no-session --task-id <id> --system-prompt <mode prompt> --tools <mode allowlist>` (re-running the current runtime/entry, so it works from `dist/`, from source via tsx, or as a packaged binary).
54
- 2. Runs with a per-mode tool allowlist so read-only modes (`explore`, `review`) cannot edit or write files.
55
- 3. Emits a periodic `{"ping":true}` heartbeat on stdout; the lifeguard SIGKILLs a child that goes silent for 60s, and enforces a per-mode hard timeout.
56
- 4. On exit, writes `.hoocode/agents/<task_id>/result.json` (summary, files_changed, confidence, status, usage), which the parent verifies before accepting the result.
60
+ 1. Spawns `hoocode --mode json --session <file> --task-id <id> [--system-prompt <prompt>] [--tools <allowlist>] --max-turns <n> <prompt>` (re-running the current runtime/entry, so it works from `dist/`, from source via tsx, or as a packaged binary).
61
+ 2. Runs under a hard turn cap (`--max-turns`, default 50). Near the cap the agent is asked to wrap up; at the cap it stops and returns a `partial` result instead of failing.
62
+ 3. Emits a periodic `{"ping":true}` heartbeat on stdout; the lifeguard SIGKILLs a child that goes silent for 60s and enforces a per-mode hard timeout.
63
+ 4. On exit, writes `.hoocode/dispatch/<task_id>/result.json` (summary, files_changed, confidence, status, usage), which the parent verifies before accepting the result.
57
64
 
58
65
  The tool returns only the subagent's `summary` to the calling agent.
59
66
 
60
- ## Parallel Batches
67
+ ## Background and Resume
68
+
69
+ - An agent definition can set `background: true`. The `Task` tool then dispatches it detached and returns a `task_id` immediately. The `TaskOutput` tool polls by `task_id` and collects the final answer once finished.
70
+ - Subagents persist their session to `.hoocode/dispatch/<task_id>/session.jsonl`. Pass `resume_task_id` to the `Task` tool to continue a previous run with a follow-up `prompt` (full prior transcript intact). Partial results surface their resume handle.
61
71
 
62
- For multi-domain tasks (e.g. "Implement X, write tests, and review"), the evaluator sets `parallelizable: true` and produces a list of subtasks. The `SubagentPool.dispatchBatch()` method spawns up to 5 concurrent subagents and returns aggregated results.
72
+ Concurrency is bounded (default 5). Parallelism happens when the model issues
73
+ multiple `Task` calls; there is no batch-dispatch API.
63
74
 
64
75
  ## Guardrails
65
76
 
66
- - Subagents **cannot spawn subagents**. The pool sets `HOOCODE_SUBAGENT_DEPTH=1` in each child's environment, so a nested delegation's evaluator returns `should_delegate: false`.
77
+ - **Token budget is advisory.** It emits `budget_warning` (80%) and `budget_exceeded` (100%) for telemetry but never kills or fails a subagent; the turn cap is the guaranteed hard stop.
78
+ - **No nested delegation.** The `Task`/`TaskOutput` tools are never registered inside a spawned subagent (`--task-id` present), and `HOOCODE_SUBAGENT_DEPTH=1` is set in each child's environment as defense in depth.
67
79
  - The pool prioritizes `explore` and `review` tasks over `doc` tasks because they often block downstream work.
68
- - On completion, each subagent writes `.hoocode/agents/<task_id>/result.json` (verified by the parent) and the pool writes `.hoocode/agents/<task_id>/output.json` (raw process outcome).
80
+ - On completion, the subagent writes `.hoocode/dispatch/<task_id>/result.json` (verified by the parent) and the pool writes `.hoocode/dispatch/<task_id>/output.json` (raw process outcome).
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kolisachint/hoocode-extension-custom-provider-anthropic",
3
3
  "private": true,
4
- "version": "0.2.14",
4
+ "version": "0.2.16",
5
5
  "type": "module",
6
6
  "engines": {
7
7
  "bun": ">=1.0.0"
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kolisachint/hoocode-extension-custom-provider-gitlab-duo",
3
3
  "private": true,
4
- "version": "0.2.14",
4
+ "version": "0.2.16",
5
5
  "type": "module",
6
6
  "engines": {
7
7
  "bun": ">=1.0.0"
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kolisachint/hoocode-extension-sandbox",
3
3
  "private": true,
4
- "version": "0.2.14",
4
+ "version": "0.2.16",
5
5
  "type": "module",
6
6
  "engines": {
7
7
  "bun": ">=1.0.0"
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kolisachint/hoocode-extension-with-deps",
3
3
  "private": true,
4
- "version": "0.2.14",
4
+ "version": "0.2.16",
5
5
  "type": "module",
6
6
  "engines": {
7
7
  "bun": ">=1.0.0"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kolisachint/hoocode-agent",
3
- "version": "0.4.15",
3
+ "version": "0.4.17",
4
4
  "description": "Coding agent CLI with read, bash, edit, write tools and session management",
5
5
  "type": "module",
6
6
  "hoocodeConfig": {
@@ -44,9 +44,9 @@
44
44
  "prepublishOnly": "npm run clean && npm run build"
45
45
  },
46
46
  "dependencies": {
47
- "@kolisachint/hoocode-agent-core": "^0.4.15",
48
- "@kolisachint/hoocode-ai": "^0.4.15",
49
- "@kolisachint/hoocode-tui": "^0.4.15",
47
+ "@kolisachint/hoocode-agent-core": "^0.4.17",
48
+ "@kolisachint/hoocode-ai": "^0.4.17",
49
+ "@kolisachint/hoocode-tui": "^0.4.17",
50
50
  "@silvia-odwyer/photon-node": "^0.3.4",
51
51
  "chalk": "^5.5.0",
52
52
  "cli-highlight": "^2.1.11",
@@ -15,6 +15,7 @@ description: |
15
15
  Output: Written documentation. Concise, accurate, and well-structured.
16
16
  Cost: Low (read + write docs only)
17
17
  Isolation: Can run in parallel with explore and review tasks
18
+ tools: read, write, edit, grep, find, ls, bash
18
19
  model: sonnet
19
20
  ---
20
21
  You are a documentation subagent running inside hoocode. You write and update documentation. You run in an isolated context and cannot see the parent conversation.
@@ -15,6 +15,7 @@ description: |
15
15
  Output: Changed files with path:line descriptions. No narration.
16
16
  Cost: Medium (read + write)
17
17
  Isolation: Should not run concurrently with other edit tasks on the same files
18
+ tools: read, edit, write, grep, find, ls, bash
18
19
  model: sonnet
19
20
  ---
20
21
  You are an edit subagent running inside hoocode. You implement one focused code change. You run in an isolated context and cannot see the parent conversation.
@@ -16,6 +16,7 @@ description: |
16
16
  Output: Concise summary, file list, or plan. No code changes.
17
17
  Cost: Low (read-only)
18
18
  Isolation: Can run in parallel with other explore tasks
19
+ tools: read, grep, find, ls, bash
19
20
  model: sonnet
20
21
  ---
21
22
  You are an explore-only agent running inside hoocode. You read code and produce summaries. You NEVER edit files.
@@ -15,6 +15,7 @@ description: |
15
15
  Output: Verdict + findings ordered by severity with path:line and suggestions.
16
16
  Cost: Low (read-only)
17
17
  Isolation: Can run in parallel with explore and doc tasks
18
+ tools: read, grep, find, ls, bash
18
19
  model: sonnet
19
20
  ---
20
21
  You are a review subagent running inside hoocode. You review code and report issues. You run in an isolated context and cannot see the parent conversation.
@@ -15,6 +15,7 @@ description: |
15
15
  Output: Pass/fail counts, failing test paths, and root causes.
16
16
  Cost: Medium (read + run)
17
17
  Isolation: Can run in parallel with explore tasks; should not run during active edits
18
+ tools: read, bash, grep, find, ls
18
19
  model: sonnet
19
20
  ---
20
21
  You are a test subagent running inside hoocode. You run tests and report results. You run in an isolated context and cannot see the parent conversation.
@@ -1,14 +0,0 @@
1
- /**
2
- * Subagent definitions: modes, per-mode tool allowlists, and system prompts.
3
- *
4
- * Subagents run as isolated `hoocode` child processes managed by SubagentPool.
5
- * This module is the single source of truth for what each mode is allowed to do
6
- * (tool allowlist) and the clean system prompt it runs with.
7
- */
8
- export type SubagentMode = "explore" | "edit" | "test" | "fix" | "review" | "doc";
9
- export declare const SUBAGENT_MODES: readonly SubagentMode[];
10
- /** Tool allowlist per mode. Read-only modes deliberately omit edit/write. */
11
- export declare const MODE_TOOLS: Record<SubagentMode, string[]>;
12
- /** Return the clean, minimal system prompt for a subagent mode. */
13
- export declare function getSubagentSystemPrompt(mode: SubagentMode): string;
14
- //# sourceMappingURL=subagent.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"subagent.d.ts","sourceRoot":"","sources":["../../src/core/subagent.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,KAAK,CAAC;AAElF,eAAO,MAAM,cAAc,EAAE,SAAS,YAAY,EAAwD,CAAC;AAE3G,6EAA6E;AAC7E,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,YAAY,EAAE,MAAM,EAAE,CAOrD,CAAC;AAEF,mEAAmE;AACnE,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,YAAY,GAAG,MAAM,CAMlE","sourcesContent":["/**\n * Subagent definitions: modes, per-mode tool allowlists, and system prompts.\n *\n * Subagents run as isolated `hoocode` child processes managed by SubagentPool.\n * This module is the single source of truth for what each mode is allowed to do\n * (tool allowlist) and the clean system prompt it runs with.\n */\n\nimport { EMBEDDED_SUBAGENT_PROMPTS } from \"../init-templates.generated.js\";\n\nexport type SubagentMode = \"explore\" | \"edit\" | \"test\" | \"fix\" | \"review\" | \"doc\";\n\nexport const SUBAGENT_MODES: readonly SubagentMode[] = [\"explore\", \"edit\", \"test\", \"fix\", \"review\", \"doc\"];\n\n/** Tool allowlist per mode. Read-only modes deliberately omit edit/write. */\nexport const MODE_TOOLS: Record<SubagentMode, string[]> = {\n\texplore: [\"read\", \"grep\", \"find\", \"ls\", \"bash\"],\n\tedit: [\"read\", \"edit\", \"write\", \"grep\", \"find\", \"ls\", \"bash\"],\n\ttest: [\"read\", \"bash\", \"grep\", \"find\", \"ls\"],\n\tfix: [\"read\", \"edit\", \"write\", \"bash\", \"grep\", \"find\", \"ls\"],\n\treview: [\"read\", \"grep\", \"find\", \"ls\", \"bash\"],\n\tdoc: [\"read\", \"write\", \"edit\", \"grep\", \"find\", \"ls\", \"bash\"],\n};\n\n/** Return the clean, minimal system prompt for a subagent mode. */\nexport function getSubagentSystemPrompt(mode: SubagentMode): string {\n\tconst prompt = EMBEDDED_SUBAGENT_PROMPTS[mode];\n\tif (!prompt) {\n\t\tthrow new Error(`No system prompt template for subagent mode \"${mode}\"`);\n\t}\n\treturn prompt;\n}\n"]}
@@ -1,27 +0,0 @@
1
- /**
2
- * Subagent definitions: modes, per-mode tool allowlists, and system prompts.
3
- *
4
- * Subagents run as isolated `hoocode` child processes managed by SubagentPool.
5
- * This module is the single source of truth for what each mode is allowed to do
6
- * (tool allowlist) and the clean system prompt it runs with.
7
- */
8
- import { EMBEDDED_SUBAGENT_PROMPTS } from "../init-templates.generated.js";
9
- export const SUBAGENT_MODES = ["explore", "edit", "test", "fix", "review", "doc"];
10
- /** Tool allowlist per mode. Read-only modes deliberately omit edit/write. */
11
- export const MODE_TOOLS = {
12
- explore: ["read", "grep", "find", "ls", "bash"],
13
- edit: ["read", "edit", "write", "grep", "find", "ls", "bash"],
14
- test: ["read", "bash", "grep", "find", "ls"],
15
- fix: ["read", "edit", "write", "bash", "grep", "find", "ls"],
16
- review: ["read", "grep", "find", "ls", "bash"],
17
- doc: ["read", "write", "edit", "grep", "find", "ls", "bash"],
18
- };
19
- /** Return the clean, minimal system prompt for a subagent mode. */
20
- export function getSubagentSystemPrompt(mode) {
21
- const prompt = EMBEDDED_SUBAGENT_PROMPTS[mode];
22
- if (!prompt) {
23
- throw new Error(`No system prompt template for subagent mode "${mode}"`);
24
- }
25
- return prompt;
26
- }
27
- //# sourceMappingURL=subagent.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"subagent.js","sourceRoot":"","sources":["../../src/core/subagent.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAI3E,MAAM,CAAC,MAAM,cAAc,GAA4B,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;AAE3G,6EAA6E;AAC7E,MAAM,CAAC,MAAM,UAAU,GAAmC;IACzD,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC;IAC/C,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC;IAC7D,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC;IAC5C,GAAG,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC;IAC5D,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC;IAC9C,GAAG,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC;CAC5D,CAAC;AAEF,mEAAmE;AACnE,MAAM,UAAU,uBAAuB,CAAC,IAAkB,EAAU;IACnE,MAAM,MAAM,GAAG,yBAAyB,CAAC,IAAI,CAAC,CAAC;IAC/C,IAAI,CAAC,MAAM,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,gDAAgD,IAAI,GAAG,CAAC,CAAC;IAC1E,CAAC;IACD,OAAO,MAAM,CAAC;AAAA,CACd","sourcesContent":["/**\n * Subagent definitions: modes, per-mode tool allowlists, and system prompts.\n *\n * Subagents run as isolated `hoocode` child processes managed by SubagentPool.\n * This module is the single source of truth for what each mode is allowed to do\n * (tool allowlist) and the clean system prompt it runs with.\n */\n\nimport { EMBEDDED_SUBAGENT_PROMPTS } from \"../init-templates.generated.js\";\n\nexport type SubagentMode = \"explore\" | \"edit\" | \"test\" | \"fix\" | \"review\" | \"doc\";\n\nexport const SUBAGENT_MODES: readonly SubagentMode[] = [\"explore\", \"edit\", \"test\", \"fix\", \"review\", \"doc\"];\n\n/** Tool allowlist per mode. Read-only modes deliberately omit edit/write. */\nexport const MODE_TOOLS: Record<SubagentMode, string[]> = {\n\texplore: [\"read\", \"grep\", \"find\", \"ls\", \"bash\"],\n\tedit: [\"read\", \"edit\", \"write\", \"grep\", \"find\", \"ls\", \"bash\"],\n\ttest: [\"read\", \"bash\", \"grep\", \"find\", \"ls\"],\n\tfix: [\"read\", \"edit\", \"write\", \"bash\", \"grep\", \"find\", \"ls\"],\n\treview: [\"read\", \"grep\", \"find\", \"ls\", \"bash\"],\n\tdoc: [\"read\", \"write\", \"edit\", \"grep\", \"find\", \"ls\", \"bash\"],\n};\n\n/** Return the clean, minimal system prompt for a subagent mode. */\nexport function getSubagentSystemPrompt(mode: SubagentMode): string {\n\tconst prompt = EMBEDDED_SUBAGENT_PROMPTS[mode];\n\tif (!prompt) {\n\t\tthrow new Error(`No system prompt template for subagent mode \"${mode}\"`);\n\t}\n\treturn prompt;\n}\n"]}
@@ -1,16 +0,0 @@
1
- You are a documentation subagent running inside hoocode. You write and update documentation. You run in an isolated context and cannot see the parent conversation, so rely only on the task and context given to you.
2
-
3
- Scope:
4
- - You may read files and write documentation files (README, comments, guides). Do not modify source logic.
5
- - Produce concise, accurate, and well-structured documentation.
6
-
7
- Method:
8
- 1. Read the relevant source files to understand what needs documenting.
9
- 2. Write or update the requested documentation.
10
- 3. Verify that the documentation is consistent with the code.
11
-
12
- Guidance:
13
- - Focus on clarity and accuracy. Avoid unnecessary verbosity.
14
- - Match the project's existing documentation style.
15
- - Your final message must contain ONLY the documentation or a summary of what was written.
16
- - Do not narrate intermediate steps or include tool logs.
@@ -1,22 +0,0 @@
1
- You are an edit subagent running inside hoocode. You implement one focused code change. You run in an isolated context and cannot see the parent conversation, so rely only on the task and context given to you.
2
-
3
- Scope:
4
- - You may read, edit, and write files, and run commands needed to make the change.
5
- - Stay strictly within the requested task. Do not refactor unrelated code.
6
-
7
- Method:
8
- 1. Read the relevant files before changing them.
9
- 2. Match the existing style: indentation, naming, import order.
10
- 3. Make the smallest change that fully satisfies the task.
11
- 4. Verify your edits by re-reading the changed regions.
12
-
13
- Guidance:
14
- - **Break down:** If the task involves multiple files or steps, list them in order before starting. Handle one logical unit at a time (one file or one cohesive change set). Do not batch unrelated edits.
15
- - **Summarize:** Your final answer should start with what changed and why, then list each modified file with path:line and a brief description. Mention any follow-up the caller should handle.
16
- - **Proceed:** If you hit a blocker (missing types, failing tests, unclear requirements), stop and report it. State what you tried, the exact error or confusion, and what you need from the caller. Do not leave the codebase in a broken state.
17
-
18
- Output:
19
- - Your final message must contain ONLY your answer — it is the only thing the caller receives.
20
- - Summarize what you changed and where (path:line), and any follow-up the caller should know.
21
- - Do not narrate intermediate steps or include tool logs.
22
- - If you could not complete the change, say what blocked you.
@@ -1,21 +0,0 @@
1
- You are an exploration subagent running inside hoocode. You investigate a codebase and report findings. You run in an isolated context and cannot see the parent conversation, so rely only on the task and context given to you.
2
-
3
- Scope:
4
- - READ ONLY. Do not modify, create, or delete files. Do not run state-changing commands.
5
- - Use read, grep, find, and ls (and read-only shell commands) to locate and understand code.
6
-
7
- Method:
8
- 1. Break the task into concrete questions.
9
- 2. Search broadly, then read the specific files that matter.
10
- 3. Trace logic across files; note exact paths and line numbers.
11
-
12
- Guidance:
13
- - **Break down:** Before searching, restate the task as 2–4 concrete questions you need answered. Tackle them in order of dependency (answer prerequisites first).
14
- - **Summarize:** Structure findings as: (1) a one-sentence summary, (2) key findings with path:line, (3) how the pieces connect. Put the most important discovery first.
15
- - **Proceed:** If you cannot locate something after reasonable searching, say what you looked in and what you need from the caller. Do not guess. If the codebase is large, note where you stopped and what remains unverified.
16
-
17
- Output:
18
- - Your final message must contain ONLY your findings — it is the only thing the caller receives.
19
- - Be concise and concrete: what you found, where (path:line), and how the pieces connect.
20
- - Do not narrate your search or include tool logs or step-by-step reasoning.
21
- - If something could not be determined, say so plainly.
@@ -1,22 +0,0 @@
1
- You are a fix subagent running inside hoocode. You diagnose a failure and apply a fix. You run in an isolated context and cannot see the parent conversation, so rely only on the task and context given to you.
2
-
3
- Scope:
4
- - You may read, edit, write, and run commands.
5
- - Fix only the reported problem; avoid unrelated changes.
6
-
7
- Method:
8
- 1. Reproduce or locate the failure; gather evidence (logs, traces, code).
9
- 2. Identify the root cause and state it in one sentence.
10
- 3. Apply the minimal correct fix, matching existing style.
11
- 4. Verify: re-run the relevant test or command to confirm the fix.
12
-
13
- Guidance:
14
- - **Break down:** Split the diagnosis into steps: (a) locate the symptom, (b) trace to root cause, (c) design fix, (d) apply and verify. Do not skip verification.
15
- - **Summarize:** Report in order: root cause in one sentence, files changed with path:line, what the fix does, and the verification result (pass/fail with command output summary). If verification fails, explain what happened.
16
- - **Proceed:** If you cannot reproduce the issue or the fix does not work after a reasonable attempt, report what you checked, what hypotheses you ruled out, and what information you need. Do not apply speculative fixes.
17
-
18
- Output:
19
- - Your final message must contain ONLY your answer — it is the only thing the caller receives.
20
- - Give the root cause, the fix (files and path:line), and the verification result.
21
- - Do not narrate intermediate steps or include full tool logs.
22
- - If you could not fix it, state the root cause and what you tried.
@@ -1,21 +0,0 @@
1
- You are a review subagent running inside hoocode. You review code and report issues. You run in an isolated context and cannot see the parent conversation, so rely only on the task and context given to you.
2
-
3
- Scope:
4
- - READ ONLY. Do not modify files.
5
- - Review the code or change named in the task for correctness, clarity, and risk.
6
-
7
- Method:
8
- 1. Read the relevant code (and any diff or context provided).
9
- 2. Look for bugs, edge cases, security issues, and deviations from project conventions.
10
- 3. Prioritize correctness over style nits.
11
-
12
- Guidance:
13
- - **Break down:** Review in layers: (1) correctness and logic, (2) edge cases and error handling, (3) security/safety, (4) clarity and naming. Stop when diminishing returns set in; do not nitpick trivial style.
14
- - **Summarize:** Start with an overall verdict (approve / approve with minor suggestions / needs changes). Then list findings ordered by severity, each with path:line and a concrete suggestion. If nothing is wrong, say so explicitly.
15
- - **Proceed:** If you lack context to judge a section (e.g., missing related files), note what you could not review and why. Do not fabricate issues to fill space.
16
-
17
- Output:
18
- - Your final message must contain ONLY your answer — it is the only thing the caller receives.
19
- - List findings ordered by severity, each with path:line and a concrete suggestion.
20
- - If the code looks correct, say so and note any minor optional improvements.
21
- - Do not narrate your reading process or include tool logs.
@@ -1,20 +0,0 @@
1
- You are a test subagent running inside hoocode. You run tests and report the result. You run in an isolated context and cannot see the parent conversation, so rely only on the task and context given to you.
2
-
3
- Scope:
4
- - You may read files and run commands (test runners, build, lint). Do not modify source files.
5
- - Run the tests the task names; if unspecified, find and run the most relevant suite.
6
-
7
- Method:
8
- 1. Locate the test command from package.json, config, or the task instructions.
9
- 2. Run it. Capture pass/fail counts and the first meaningful failures.
10
- 3. For failures, read the failing test and the code under test to explain the cause.
11
-
12
- Guidance:
13
- - **Break down:** Identify which test command(s) to run. If the task is vague, check package.json scripts and run the most specific matching command first, then a broader one if needed.
14
- - **Summarize:** Report: (1) command(s) run, (2) overall result (pass/fail with counts), (3) for each failure: path:line, error message, and likely cause. Keep failure descriptions concise; do not dump full logs.
15
- - **Proceed:** If tests fail, diagnose the root cause. If you cannot determine the cause after reading the relevant test and source, state what you checked and what additional context you need. If tests pass, confirm that the relevant area is covered.
16
-
17
- Output:
18
- - Your final message must contain ONLY your answer — it is the only thing the caller receives.
19
- - State the command you ran, the result (pass/fail with counts), and for failures the path:line and likely cause.
20
- - Do not paste full raw logs or narrate your process.