@kolisachint/hoocode-agent 0.3.1 → 0.4.2
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 +6 -0
- package/dist/cli/args.d.ts +1 -0
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +5 -0
- package/dist/cli/args.js.map +1 -1
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +9 -1
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +12 -2
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/settings-manager.d.ts +3 -0
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +8 -0
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/subagent.d.ts +46 -0
- package/dist/core/subagent.d.ts.map +1 -0
- package/dist/core/subagent.js +139 -0
- package/dist/core/subagent.js.map +1 -0
- package/dist/core/task-store.d.ts +37 -0
- package/dist/core/task-store.d.ts.map +1 -0
- package/dist/core/task-store.js +57 -0
- package/dist/core/task-store.js.map +1 -0
- package/dist/core/tools/subagent.d.ts +18 -0
- package/dist/core/tools/subagent.d.ts.map +1 -0
- package/dist/core/tools/subagent.js +99 -0
- package/dist/core/tools/subagent.js.map +1 -0
- package/dist/init-templates.generated.d.ts +1 -0
- package/dist/init-templates.generated.d.ts.map +1 -1
- package/dist/init-templates.generated.js +12 -5
- package/dist/init-templates.generated.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +6 -0
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.js +41 -0
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +1 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +8 -0
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/examples/README.md +1 -1
- package/examples/extensions/README.md +0 -1
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/with-deps/package.json +1 -1
- package/package.json +6 -5
- package/templates/subagent/edit.md +17 -0
- package/templates/subagent/explore.md +16 -0
- package/templates/subagent/fix.md +17 -0
- package/templates/subagent/review.md +16 -0
- package/templates/subagent/test.md +15 -0
- package/examples/extensions/subagent/README.md +0 -172
- package/examples/extensions/subagent/agents/planner.md +0 -37
- package/examples/extensions/subagent/agents/reviewer.md +0 -35
- package/examples/extensions/subagent/agents/scout.md +0 -50
- package/examples/extensions/subagent/agents/worker.md +0 -24
- package/examples/extensions/subagent/agents.ts +0 -126
- package/examples/extensions/subagent/index.ts +0 -987
- package/examples/extensions/subagent/prompts/implement-and-review.md +0 -10
- package/examples/extensions/subagent/prompts/implement.md +0 -10
- package/examples/extensions/subagent/prompts/scout-and-plan.md +0 -9
package/examples/README.md
CHANGED
|
@@ -10,7 +10,7 @@ Programmatic usage via `createAgentSession()`. Shows how to customize models, pr
|
|
|
10
10
|
### [extensions/](extensions/)
|
|
11
11
|
Example extensions demonstrating:
|
|
12
12
|
- Lifecycle event handlers (tool interception, safety gates, context modifications)
|
|
13
|
-
- Custom tools (todo lists, questions,
|
|
13
|
+
- Custom tools (todo lists, questions, output truncation)
|
|
14
14
|
- Commands and keyboard shortcuts
|
|
15
15
|
- Custom UI (footers, headers, editors, overlays)
|
|
16
16
|
- Git integration (checkpoints, auto-commit)
|
|
@@ -39,7 +39,6 @@ cp permission-gate.ts ~/.hoocode/agent/extensions/
|
|
|
39
39
|
| `minimal-mode.ts` | Override built-in tool rendering for minimal display (only tool calls, no output in collapsed mode) |
|
|
40
40
|
| `truncated-tool.ts` | Wraps ripgrep with proper output truncation (50KB/2000 lines) |
|
|
41
41
|
| `ssh.ts` | Delegate all tools to a remote machine via SSH using pluggable operations |
|
|
42
|
-
| `subagent/` | Delegate tasks to specialized subagents with isolated context windows |
|
|
43
42
|
|
|
44
43
|
### Commands & UI
|
|
45
44
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kolisachint/hoocode-agent",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.2",
|
|
4
4
|
"description": "Coding agent CLI with read, bash, edit, write tools and session management",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"hoocodeConfig": {
|
|
@@ -35,7 +35,8 @@
|
|
|
35
35
|
"clean": "shx rm -rf dist",
|
|
36
36
|
"dev": "node scripts/embed-templates.mjs && tsgo -p tsconfig.build.json --watch --preserveWatchOutput",
|
|
37
37
|
"embed-templates": "node scripts/embed-templates.mjs",
|
|
38
|
-
"build": "
|
|
38
|
+
"build": "tsgo -p tsconfig.build.json && shx chmod +x dist/cli.js && shx chmod +x bin/hoocode.js && npm run copy-assets",
|
|
39
|
+
"build:full": "npm run embed-templates && npm run build",
|
|
39
40
|
"build:binary": "npm --prefix ../tui run build && npm --prefix ../ai run build && npm --prefix ../agent run build && npm run build && npm run copy-binary-assets && pkg . --entry bin/hoocode.js",
|
|
40
41
|
"copy-assets": "shx mkdir -p dist/modes/interactive/theme && shx cp src/modes/interactive/theme/*.json dist/modes/interactive/theme/ && shx mkdir -p dist/core/export-html/vendor && shx cp src/core/export-html/template.html src/core/export-html/template.css src/core/export-html/template.js dist/core/export-html/ && shx cp src/core/export-html/vendor/*.js dist/core/export-html/vendor/",
|
|
41
42
|
"copy-binary-assets": "shx cp package.json dist/ && shx cp README.md dist/ && shx cp CHANGELOG.md dist/ && shx mkdir -p dist/theme && shx cp src/modes/interactive/theme/*.json dist/theme/ && shx mkdir -p dist/export-html/vendor && shx cp src/core/export-html/template.html dist/export-html/ && shx cp src/core/export-html/vendor/*.js dist/export-html/vendor/ && shx cp -r docs dist/ && shx cp -r examples dist/ && shx cp ../../node_modules/@silvia-odwyer/photon-node/photon_rs_bg.wasm dist/",
|
|
@@ -43,9 +44,9 @@
|
|
|
43
44
|
"prepublishOnly": "npm run clean && npm run build"
|
|
44
45
|
},
|
|
45
46
|
"dependencies": {
|
|
46
|
-
"@kolisachint/hoocode-agent-core": "^0.
|
|
47
|
-
"@kolisachint/hoocode-ai": "^0.
|
|
48
|
-
"@kolisachint/hoocode-tui": "^0.
|
|
47
|
+
"@kolisachint/hoocode-agent-core": "^0.4.2",
|
|
48
|
+
"@kolisachint/hoocode-ai": "^0.4.2",
|
|
49
|
+
"@kolisachint/hoocode-tui": "^0.4.2",
|
|
49
50
|
"@silvia-odwyer/photon-node": "^0.3.4",
|
|
50
51
|
"chalk": "^5.5.0",
|
|
51
52
|
"cli-highlight": "^2.1.11",
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
Output:
|
|
14
|
+
- Your final message must contain ONLY your answer — it is the only thing the caller receives.
|
|
15
|
+
- Summarize what you changed and where (path:line), and any follow-up the caller should know.
|
|
16
|
+
- Do not narrate intermediate steps or include tool logs.
|
|
17
|
+
- If you could not complete the change, say what blocked you.
|
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
Output:
|
|
13
|
+
- Your final message must contain ONLY your findings — it is the only thing the caller receives.
|
|
14
|
+
- Be concise and concrete: what you found, where (path:line), and how the pieces connect.
|
|
15
|
+
- Do not narrate your search or include tool logs or step-by-step reasoning.
|
|
16
|
+
- If something could not be determined, say so plainly.
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
Output:
|
|
14
|
+
- Your final message must contain ONLY your answer — it is the only thing the caller receives.
|
|
15
|
+
- Give the root cause, the fix (files and path:line), and the verification result.
|
|
16
|
+
- Do not narrate intermediate steps or include full tool logs.
|
|
17
|
+
- If you could not fix it, state the root cause and what you tried.
|
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
Output:
|
|
13
|
+
- Your final message must contain ONLY your answer — it is the only thing the caller receives.
|
|
14
|
+
- List findings ordered by severity, each with path:line and a concrete suggestion.
|
|
15
|
+
- If the code looks correct, say so and note any minor optional improvements.
|
|
16
|
+
- Do not narrate your reading process or include tool logs.
|
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
Output:
|
|
13
|
+
- Your final message must contain ONLY your answer — it is the only thing the caller receives.
|
|
14
|
+
- State the command you ran, the result (pass/fail with counts), and for failures the path:line and likely cause.
|
|
15
|
+
- Do not paste full raw logs or narrate your process.
|
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
# Subagent Example
|
|
2
|
-
|
|
3
|
-
Delegate tasks to specialized subagents with isolated context windows.
|
|
4
|
-
|
|
5
|
-
## Features
|
|
6
|
-
|
|
7
|
-
- **Isolated context**: Each subagent runs in a separate `hoocode` process
|
|
8
|
-
- **Streaming output**: See tool calls and progress as they happen
|
|
9
|
-
- **Parallel streaming**: All parallel tasks stream updates simultaneously
|
|
10
|
-
- **Markdown rendering**: Final output rendered with proper formatting (expanded view)
|
|
11
|
-
- **Usage tracking**: Shows turns, tokens, cost, and context usage per agent
|
|
12
|
-
- **Abort support**: Ctrl+C propagates to kill subagent processes
|
|
13
|
-
|
|
14
|
-
## Structure
|
|
15
|
-
|
|
16
|
-
```
|
|
17
|
-
subagent/
|
|
18
|
-
├── README.md # This file
|
|
19
|
-
├── index.ts # The extension (entry point)
|
|
20
|
-
├── agents.ts # Agent discovery logic
|
|
21
|
-
├── agents/ # Sample agent definitions
|
|
22
|
-
│ ├── scout.md # Fast recon, returns compressed context
|
|
23
|
-
│ ├── planner.md # Creates implementation plans
|
|
24
|
-
│ ├── reviewer.md # Code review
|
|
25
|
-
│ └── worker.md # General-purpose (full capabilities)
|
|
26
|
-
└── prompts/ # Workflow presets (prompt templates)
|
|
27
|
-
├── implement.md # scout -> planner -> worker
|
|
28
|
-
├── scout-and-plan.md # scout -> planner (no implementation)
|
|
29
|
-
└── implement-and-review.md # worker -> reviewer -> worker
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
## Installation
|
|
33
|
-
|
|
34
|
-
From the repository root, symlink the files:
|
|
35
|
-
|
|
36
|
-
```bash
|
|
37
|
-
# Symlink the extension (must be in a subdirectory with index.ts)
|
|
38
|
-
mkdir -p ~/.hoocode/agent/extensions/subagent
|
|
39
|
-
ln -sf "$(pwd)/packages/coding-agent/examples/extensions/subagent/index.ts" ~/.hoocode/agent/extensions/subagent/index.ts
|
|
40
|
-
ln -sf "$(pwd)/packages/coding-agent/examples/extensions/subagent/agents.ts" ~/.hoocode/agent/extensions/subagent/agents.ts
|
|
41
|
-
|
|
42
|
-
# Symlink agents
|
|
43
|
-
mkdir -p ~/.hoocode/agent/agents
|
|
44
|
-
for f in packages/coding-agent/examples/extensions/subagent/agents/*.md; do
|
|
45
|
-
ln -sf "$(pwd)/$f" ~/.hoocode/agent/agents/$(basename "$f")
|
|
46
|
-
done
|
|
47
|
-
|
|
48
|
-
# Symlink workflow prompts
|
|
49
|
-
mkdir -p ~/.hoocode/agent/prompts
|
|
50
|
-
for f in packages/coding-agent/examples/extensions/subagent/prompts/*.md; do
|
|
51
|
-
ln -sf "$(pwd)/$f" ~/.hoocode/agent/prompts/$(basename "$f")
|
|
52
|
-
done
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
## Security Model
|
|
56
|
-
|
|
57
|
-
This tool executes a separate `hoocode` subprocess with a delegated system prompt and tool/model configuration.
|
|
58
|
-
|
|
59
|
-
**Project-local agents** (`.hoocode/agents/*.md`) are repo-controlled prompts that can instruct the model to read files, run bash commands, etc.
|
|
60
|
-
|
|
61
|
-
**Default behavior:** Only loads **user-level agents** from `~/.hoocode/agent/agents`.
|
|
62
|
-
|
|
63
|
-
To enable project-local agents, pass `agentScope: "both"` (or `"project"`). Only do this for repositories you trust.
|
|
64
|
-
|
|
65
|
-
When running interactively, the tool prompts for confirmation before running project-local agents. Set `confirmProjectAgents: false` to disable.
|
|
66
|
-
|
|
67
|
-
## Usage
|
|
68
|
-
|
|
69
|
-
### Single agent
|
|
70
|
-
```
|
|
71
|
-
Use scout to find all authentication code
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
### Parallel execution
|
|
75
|
-
```
|
|
76
|
-
Run 2 scouts in parallel: one to find models, one to find providers
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
### Chained workflow
|
|
80
|
-
```
|
|
81
|
-
Use a chain: first have scout find the read tool, then have planner suggest improvements
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
### Workflow prompts
|
|
85
|
-
```
|
|
86
|
-
/implement add Redis caching to the session store
|
|
87
|
-
/scout-and-plan refactor auth to support OAuth
|
|
88
|
-
/implement-and-review add input validation to API endpoints
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
## Tool Modes
|
|
92
|
-
|
|
93
|
-
| Mode | Parameter | Description |
|
|
94
|
-
|------|-----------|-------------|
|
|
95
|
-
| Single | `{ agent, task }` | One agent, one task |
|
|
96
|
-
| Parallel | `{ tasks: [...] }` | Multiple agents run concurrently (max 8, 4 concurrent) |
|
|
97
|
-
| Chain | `{ chain: [...] }` | Sequential with `{previous}` placeholder |
|
|
98
|
-
|
|
99
|
-
## Output Display
|
|
100
|
-
|
|
101
|
-
**Collapsed view** (default):
|
|
102
|
-
- Status icon (✓/✗/⏳) and agent name
|
|
103
|
-
- Last 5-10 items (tool calls and text)
|
|
104
|
-
- Usage stats: `3 turns ↑input ↓output RcacheRead WcacheWrite $cost ctx:contextTokens model`
|
|
105
|
-
|
|
106
|
-
**Expanded view** (Ctrl+O):
|
|
107
|
-
- Full task text
|
|
108
|
-
- All tool calls with formatted arguments
|
|
109
|
-
- Final output rendered as Markdown
|
|
110
|
-
- Per-task usage (for chain/parallel)
|
|
111
|
-
|
|
112
|
-
**Parallel mode streaming**:
|
|
113
|
-
- Shows all tasks with live status (⏳ running, ✓ done, ✗ failed)
|
|
114
|
-
- Updates as each task makes progress
|
|
115
|
-
- Shows "2/3 done, 1 running" status
|
|
116
|
-
|
|
117
|
-
**Tool call formatting** (mimics built-in tools):
|
|
118
|
-
- `$ command` for bash
|
|
119
|
-
- `read ~/path:1-10` for read
|
|
120
|
-
- `grep /pattern/ in ~/path` for grep
|
|
121
|
-
- etc.
|
|
122
|
-
|
|
123
|
-
## Agent Definitions
|
|
124
|
-
|
|
125
|
-
Agents are markdown files with YAML frontmatter:
|
|
126
|
-
|
|
127
|
-
```markdown
|
|
128
|
-
---
|
|
129
|
-
name: my-agent
|
|
130
|
-
description: What this agent does
|
|
131
|
-
tools: read, grep, find, ls
|
|
132
|
-
model: claude-haiku-4-5
|
|
133
|
-
---
|
|
134
|
-
|
|
135
|
-
System prompt for the agent goes here.
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
**Locations:**
|
|
139
|
-
- `~/.hoocode/agent/agents/*.md` - User-level (always loaded)
|
|
140
|
-
- `.hoocode/agents/*.md` - Project-level (only with `agentScope: "project"` or `"both"`)
|
|
141
|
-
|
|
142
|
-
Project agents override user agents with the same name when `agentScope: "both"`.
|
|
143
|
-
|
|
144
|
-
## Sample Agents
|
|
145
|
-
|
|
146
|
-
| Agent | Purpose | Model | Tools |
|
|
147
|
-
|-------|---------|-------|-------|
|
|
148
|
-
| `scout` | Fast codebase recon | Haiku | read, grep, find, ls, bash |
|
|
149
|
-
| `planner` | Implementation plans | Sonnet | read, grep, find, ls |
|
|
150
|
-
| `reviewer` | Code review | Sonnet | read, grep, find, ls, bash |
|
|
151
|
-
| `worker` | General-purpose | Sonnet | (all default) |
|
|
152
|
-
|
|
153
|
-
## Workflow Prompts
|
|
154
|
-
|
|
155
|
-
| Prompt | Flow |
|
|
156
|
-
|--------|------|
|
|
157
|
-
| `/implement <query>` | scout → planner → worker |
|
|
158
|
-
| `/scout-and-plan <query>` | scout → planner |
|
|
159
|
-
| `/implement-and-review <query>` | worker → reviewer → worker |
|
|
160
|
-
|
|
161
|
-
## Error Handling
|
|
162
|
-
|
|
163
|
-
- **Exit code != 0**: Tool returns error with stderr/output
|
|
164
|
-
- **stopReason "error"**: LLM error propagated with error message
|
|
165
|
-
- **stopReason "aborted"**: User abort (Ctrl+C) kills subprocess, throws error
|
|
166
|
-
- **Chain mode**: Stops at first failing step, reports which step failed
|
|
167
|
-
|
|
168
|
-
## Limitations
|
|
169
|
-
|
|
170
|
-
- Output truncated to last 10 items in collapsed view (expand to see all)
|
|
171
|
-
- Agents discovered fresh on each invocation (allows editing mid-session)
|
|
172
|
-
- Parallel mode limited to 8 tasks, 4 concurrent
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: planner
|
|
3
|
-
description: Creates implementation plans from context and requirements
|
|
4
|
-
tools: read, grep, find, ls
|
|
5
|
-
model: claude-sonnet-4-5
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
You are a planning specialist. You receive context (from a scout) and requirements, then produce a clear implementation plan.
|
|
9
|
-
|
|
10
|
-
You must NOT make any changes. Only read, analyze, and plan.
|
|
11
|
-
|
|
12
|
-
Input format you'll receive:
|
|
13
|
-
- Context/findings from a scout agent
|
|
14
|
-
- Original query or requirements
|
|
15
|
-
|
|
16
|
-
Output format:
|
|
17
|
-
|
|
18
|
-
## Goal
|
|
19
|
-
One sentence summary of what needs to be done.
|
|
20
|
-
|
|
21
|
-
## Plan
|
|
22
|
-
Numbered steps, each small and actionable:
|
|
23
|
-
1. Step one - specific file/function to modify
|
|
24
|
-
2. Step two - what to add/change
|
|
25
|
-
3. ...
|
|
26
|
-
|
|
27
|
-
## Files to Modify
|
|
28
|
-
- `path/to/file.ts` - what changes
|
|
29
|
-
- `path/to/other.ts` - what changes
|
|
30
|
-
|
|
31
|
-
## New Files (if any)
|
|
32
|
-
- `path/to/new.ts` - purpose
|
|
33
|
-
|
|
34
|
-
## Risks
|
|
35
|
-
Anything to watch out for.
|
|
36
|
-
|
|
37
|
-
Keep the plan concrete. The worker agent will execute it verbatim.
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: reviewer
|
|
3
|
-
description: Code review specialist for quality and security analysis
|
|
4
|
-
tools: read, grep, find, ls, bash
|
|
5
|
-
model: claude-sonnet-4-5
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
You are a senior code reviewer. Analyze code for quality, security, and maintainability.
|
|
9
|
-
|
|
10
|
-
Bash is for read-only commands only: `git diff`, `git log`, `git show`. Do NOT modify files or run builds.
|
|
11
|
-
Assume tool permissions are not perfectly enforceable; keep all bash usage strictly read-only.
|
|
12
|
-
|
|
13
|
-
Strategy:
|
|
14
|
-
1. Run `git diff` to see recent changes (if applicable)
|
|
15
|
-
2. Read the modified files
|
|
16
|
-
3. Check for bugs, security issues, code smells
|
|
17
|
-
|
|
18
|
-
Output format:
|
|
19
|
-
|
|
20
|
-
## Files Reviewed
|
|
21
|
-
- `path/to/file.ts` (lines X-Y)
|
|
22
|
-
|
|
23
|
-
## Critical (must fix)
|
|
24
|
-
- `file.ts:42` - Issue description
|
|
25
|
-
|
|
26
|
-
## Warnings (should fix)
|
|
27
|
-
- `file.ts:100` - Issue description
|
|
28
|
-
|
|
29
|
-
## Suggestions (consider)
|
|
30
|
-
- `file.ts:150` - Improvement idea
|
|
31
|
-
|
|
32
|
-
## Summary
|
|
33
|
-
Overall assessment in 2-3 sentences.
|
|
34
|
-
|
|
35
|
-
Be specific with file paths and line numbers.
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: scout
|
|
3
|
-
description: Fast codebase recon that returns compressed context for handoff to other agents
|
|
4
|
-
tools: read, grep, find, ls, bash
|
|
5
|
-
model: claude-haiku-4-5
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
You are a scout. Quickly investigate a codebase and return structured findings that another agent can use without re-reading everything.
|
|
9
|
-
|
|
10
|
-
Your output will be passed to an agent who has NOT seen the files you explored.
|
|
11
|
-
|
|
12
|
-
Thoroughness (infer from task, default medium):
|
|
13
|
-
- Quick: Targeted lookups, key files only
|
|
14
|
-
- Medium: Follow imports, read critical sections
|
|
15
|
-
- Thorough: Trace all dependencies, check tests/types
|
|
16
|
-
|
|
17
|
-
Strategy:
|
|
18
|
-
1. grep/find to locate relevant code
|
|
19
|
-
2. Read key sections (not entire files)
|
|
20
|
-
3. Identify types, interfaces, key functions
|
|
21
|
-
4. Note dependencies between files
|
|
22
|
-
|
|
23
|
-
Output format:
|
|
24
|
-
|
|
25
|
-
## Files Retrieved
|
|
26
|
-
List with exact line ranges:
|
|
27
|
-
1. `path/to/file.ts` (lines 10-50) - Description of what's here
|
|
28
|
-
2. `path/to/other.ts` (lines 100-150) - Description
|
|
29
|
-
3. ...
|
|
30
|
-
|
|
31
|
-
## Key Code
|
|
32
|
-
Critical types, interfaces, or functions:
|
|
33
|
-
|
|
34
|
-
```typescript
|
|
35
|
-
interface Example {
|
|
36
|
-
// actual code from the files
|
|
37
|
-
}
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
```typescript
|
|
41
|
-
function keyFunction() {
|
|
42
|
-
// actual implementation
|
|
43
|
-
}
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
## Architecture
|
|
47
|
-
Brief explanation of how the pieces connect.
|
|
48
|
-
|
|
49
|
-
## Start Here
|
|
50
|
-
Which file to look at first and why.
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: worker
|
|
3
|
-
description: General-purpose subagent with full capabilities, isolated context
|
|
4
|
-
model: claude-sonnet-4-5
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
You are a worker agent with full capabilities. You operate in an isolated context window to handle delegated tasks without polluting the main conversation.
|
|
8
|
-
|
|
9
|
-
Work autonomously to complete the assigned task. Use all available tools as needed.
|
|
10
|
-
|
|
11
|
-
Output format when finished:
|
|
12
|
-
|
|
13
|
-
## Completed
|
|
14
|
-
What was done.
|
|
15
|
-
|
|
16
|
-
## Files Changed
|
|
17
|
-
- `path/to/file.ts` - what changed
|
|
18
|
-
|
|
19
|
-
## Notes (if any)
|
|
20
|
-
Anything the main agent should know.
|
|
21
|
-
|
|
22
|
-
If handing off to another agent (e.g. reviewer), include:
|
|
23
|
-
- Exact file paths changed
|
|
24
|
-
- Key functions/types touched (short list)
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Agent discovery and configuration
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import * as fs from "node:fs";
|
|
6
|
-
import * as path from "node:path";
|
|
7
|
-
import { getAgentDir, parseFrontmatter } from "@kolisachint/hoocode-agent";
|
|
8
|
-
|
|
9
|
-
export type AgentScope = "user" | "project" | "both";
|
|
10
|
-
|
|
11
|
-
export interface AgentConfig {
|
|
12
|
-
name: string;
|
|
13
|
-
description: string;
|
|
14
|
-
tools?: string[];
|
|
15
|
-
model?: string;
|
|
16
|
-
systemPrompt: string;
|
|
17
|
-
source: "user" | "project";
|
|
18
|
-
filePath: string;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export interface AgentDiscoveryResult {
|
|
22
|
-
agents: AgentConfig[];
|
|
23
|
-
projectAgentsDir: string | null;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
function loadAgentsFromDir(dir: string, source: "user" | "project"): AgentConfig[] {
|
|
27
|
-
const agents: AgentConfig[] = [];
|
|
28
|
-
|
|
29
|
-
if (!fs.existsSync(dir)) {
|
|
30
|
-
return agents;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
let entries: fs.Dirent[];
|
|
34
|
-
try {
|
|
35
|
-
entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
36
|
-
} catch {
|
|
37
|
-
return agents;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
for (const entry of entries) {
|
|
41
|
-
if (!entry.name.endsWith(".md")) continue;
|
|
42
|
-
if (!entry.isFile() && !entry.isSymbolicLink()) continue;
|
|
43
|
-
|
|
44
|
-
const filePath = path.join(dir, entry.name);
|
|
45
|
-
let content: string;
|
|
46
|
-
try {
|
|
47
|
-
content = fs.readFileSync(filePath, "utf-8");
|
|
48
|
-
} catch {
|
|
49
|
-
continue;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
const { frontmatter, body } = parseFrontmatter<Record<string, string>>(content);
|
|
53
|
-
|
|
54
|
-
if (!frontmatter.name || !frontmatter.description) {
|
|
55
|
-
continue;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
const tools = frontmatter.tools
|
|
59
|
-
?.split(",")
|
|
60
|
-
.map((t: string) => t.trim())
|
|
61
|
-
.filter(Boolean);
|
|
62
|
-
|
|
63
|
-
agents.push({
|
|
64
|
-
name: frontmatter.name,
|
|
65
|
-
description: frontmatter.description,
|
|
66
|
-
tools: tools && tools.length > 0 ? tools : undefined,
|
|
67
|
-
model: frontmatter.model,
|
|
68
|
-
systemPrompt: body,
|
|
69
|
-
source,
|
|
70
|
-
filePath,
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
return agents;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
function isDirectory(p: string): boolean {
|
|
78
|
-
try {
|
|
79
|
-
return fs.statSync(p).isDirectory();
|
|
80
|
-
} catch {
|
|
81
|
-
return false;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
function findNearestProjectAgentsDir(cwd: string): string | null {
|
|
86
|
-
let currentDir = cwd;
|
|
87
|
-
while (true) {
|
|
88
|
-
const candidate = path.join(currentDir, ".hoocode", "agents");
|
|
89
|
-
if (isDirectory(candidate)) return candidate;
|
|
90
|
-
|
|
91
|
-
const parentDir = path.dirname(currentDir);
|
|
92
|
-
if (parentDir === currentDir) return null;
|
|
93
|
-
currentDir = parentDir;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
export function discoverAgents(cwd: string, scope: AgentScope): AgentDiscoveryResult {
|
|
98
|
-
const userDir = path.join(getAgentDir(), "agents");
|
|
99
|
-
const projectAgentsDir = findNearestProjectAgentsDir(cwd);
|
|
100
|
-
|
|
101
|
-
const userAgents = scope === "project" ? [] : loadAgentsFromDir(userDir, "user");
|
|
102
|
-
const projectAgents = scope === "user" || !projectAgentsDir ? [] : loadAgentsFromDir(projectAgentsDir, "project");
|
|
103
|
-
|
|
104
|
-
const agentMap = new Map<string, AgentConfig>();
|
|
105
|
-
|
|
106
|
-
if (scope === "both") {
|
|
107
|
-
for (const agent of userAgents) agentMap.set(agent.name, agent);
|
|
108
|
-
for (const agent of projectAgents) agentMap.set(agent.name, agent);
|
|
109
|
-
} else if (scope === "user") {
|
|
110
|
-
for (const agent of userAgents) agentMap.set(agent.name, agent);
|
|
111
|
-
} else {
|
|
112
|
-
for (const agent of projectAgents) agentMap.set(agent.name, agent);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
return { agents: Array.from(agentMap.values()), projectAgentsDir };
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
export function formatAgentList(agents: AgentConfig[], maxItems: number): { text: string; remaining: number } {
|
|
119
|
-
if (agents.length === 0) return { text: "none", remaining: 0 };
|
|
120
|
-
const listed = agents.slice(0, maxItems);
|
|
121
|
-
const remaining = agents.length - listed.length;
|
|
122
|
-
return {
|
|
123
|
-
text: listed.map((a) => `${a.name} (${a.source}): ${a.description}`).join("; "),
|
|
124
|
-
remaining,
|
|
125
|
-
};
|
|
126
|
-
}
|