@psnext/s-subagents 0.1.20260523-1 → 0.1.20260523-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/.slingshot/agentHooks.json +24 -0
- package/.slingshot/prompts/sample.prompt.md +118 -0
- package/.slingshot/prompts_cache.json +1 -0
- package/.slingshot/skills_cache.json +1 -0
- package/.vscode/settings.json +3 -0
- package/README.md +5 -5
- package/agents/researcher.md +26 -31
- package/agents/scout.md +22 -36
- package/agents/worker.md +58 -42
- package/index.ts +932 -0
- package/package.json +5 -60
- package/scripts/postinstall.js +1 -0
- package/tools/safe-bash.ts +60 -0
- package/agents/context-builder.md +0 -46
- package/agents/delegate.md +0 -12
- package/agents/oracle.md +0 -73
- package/agents/planner.md +0 -55
- package/agents/reviewer.md +0 -79
- package/install.mjs +0 -92
- package/prompts/gather-context-and-clarify.md +0 -13
- package/prompts/parallel-cleanup.md +0 -59
- package/prompts/parallel-context-build.md +0 -53
- package/prompts/parallel-handoff-plan.md +0 -59
- package/prompts/parallel-research.md +0 -50
- package/prompts/parallel-review.md +0 -54
- package/prompts/review-loop.md +0 -41
- package/skills/s-subagents/SKILL.md +0 -813
- package/src/agents/agent-management.ts +0 -648
- package/src/agents/agent-scope.ts +0 -6
- package/src/agents/agent-selection.ts +0 -23
- package/src/agents/agent-serializer.ts +0 -86
- package/src/agents/agents.ts +0 -832
- package/src/agents/chain-serializer.ts +0 -137
- package/src/agents/frontmatter.ts +0 -29
- package/src/agents/identity.ts +0 -30
- package/src/agents/skills.ts +0 -632
- package/src/extension/config.ts +0 -16
- package/src/extension/control-notices.ts +0 -92
- package/src/extension/doctor.ts +0 -199
- package/src/extension/fanout-child.ts +0 -170
- package/src/extension/index.ts +0 -573
- package/src/extension/schemas.ts +0 -168
- package/src/intercom/intercom-bridge.ts +0 -379
- package/src/intercom/result-intercom.ts +0 -377
- package/src/runs/background/async-execution.ts +0 -712
- package/src/runs/background/async-job-tracker.ts +0 -310
- package/src/runs/background/async-resume.ts +0 -345
- package/src/runs/background/async-status.ts +0 -325
- package/src/runs/background/completion-dedupe.ts +0 -63
- package/src/runs/background/notify.ts +0 -108
- package/src/runs/background/parallel-groups.ts +0 -45
- package/src/runs/background/result-watcher.ts +0 -307
- package/src/runs/background/run-id-resolver.ts +0 -83
- package/src/runs/background/run-status.ts +0 -269
- package/src/runs/background/stale-run-reconciler.ts +0 -336
- package/src/runs/background/subagent-runner.ts +0 -1808
- package/src/runs/background/top-level-async.ts +0 -13
- package/src/runs/foreground/chain-clarify.ts +0 -1333
- package/src/runs/foreground/chain-execution.ts +0 -938
- package/src/runs/foreground/execution.ts +0 -918
- package/src/runs/foreground/subagent-executor.ts +0 -2527
- package/src/runs/shared/completion-guard.ts +0 -147
- package/src/runs/shared/long-running-guard.ts +0 -175
- package/src/runs/shared/mcp-direct-tool-allowlist.ts +0 -365
- package/src/runs/shared/model-fallback.ts +0 -103
- package/src/runs/shared/nested-events.ts +0 -819
- package/src/runs/shared/nested-path.ts +0 -52
- package/src/runs/shared/nested-render.ts +0 -115
- package/src/runs/shared/parallel-utils.ts +0 -109
- package/src/runs/shared/pi-args.ts +0 -220
- package/src/runs/shared/pi-spawn.ts +0 -115
- package/src/runs/shared/run-history.ts +0 -60
- package/src/runs/shared/single-output.ts +0 -164
- package/src/runs/shared/subagent-control.ts +0 -226
- package/src/runs/shared/subagent-prompt-runtime.ts +0 -170
- package/src/runs/shared/worktree.ts +0 -577
- package/src/shared/artifacts.ts +0 -98
- package/src/shared/atomic-json.ts +0 -16
- package/src/shared/file-coalescer.ts +0 -40
- package/src/shared/fork-context.ts +0 -76
- package/src/shared/formatters.ts +0 -133
- package/src/shared/jsonl-writer.ts +0 -81
- package/src/shared/model-info.ts +0 -78
- package/src/shared/post-exit-stdio-guard.ts +0 -85
- package/src/shared/session-identity.ts +0 -10
- package/src/shared/session-tokens.ts +0 -44
- package/src/shared/settings.ts +0 -397
- package/src/shared/status-format.ts +0 -49
- package/src/shared/types.ts +0 -822
- package/src/shared/utils.ts +0 -450
- package/src/slash/prompt-template-bridge.ts +0 -397
- package/src/slash/slash-bridge.ts +0 -174
- package/src/slash/slash-commands.ts +0 -528
- package/src/slash/slash-live-state.ts +0 -292
- package/src/tui/render-helpers.ts +0 -80
- package/src/tui/render.ts +0 -1358
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"id": "hook-1779537187645-746",
|
|
4
|
+
"name": "Code review",
|
|
5
|
+
"description": "Review the code for all coding standard",
|
|
6
|
+
"triggerType": "file_saved",
|
|
7
|
+
"filePaths": "src/*.js",
|
|
8
|
+
"prompt": "Analyze the recently saved file and provide a comprehensive code review with actionable feedback. Focus on:\n\n**Code Quality & Standards:**\n- Adherence to language-specific coding conventions and style guidelines\n- Proper naming conventions for variables, functions, and classes\n- Code structure, readability, and maintainability\n- Consistent formatting and indentation\n\n**Best Practices:**\n- Error handling and edge case management\n- Performance considerations and potential optimizations\n- Security vulnerabilities or concerns\n- Code reusability and DRY principles\n- Proper commenting and documentation\n\n**Technical Review:**\n- Logic correctness and potential bugs\n- Resource management (memory, file handles, connections)\n- Appropriate use of design patterns\n- Type safety and null checks where applicable\n\n**Output Format:**\nProvide specific, line-referenced feedback when possible. Categorize issues by severity (Critical, Major, Minor, Suggestion). Include positive observations alongside improvement recommendations. Keep comments constructive and educational, explaining the \"why\" behind each suggestion.\n\nIf no issues are found, acknowledge good practices observed in the code.",
|
|
9
|
+
"agentId": "coding-agent",
|
|
10
|
+
"parameters": {
|
|
11
|
+
"task": "Analyze the recently saved file and provide a comprehensive code review with actionable feedback. Focus on:\n\n**Code Quality & Standards:**\n- Adherence to language-specific coding conventions and style guidelines\n- Proper naming conventions for variables, functions, and classes\n- Code structure, readability, and maintainability\n- Consistent formatting and indentation\n\n**Best Practices:**\n- Error handling and edge case management\n- Performance considerations and potential optimizations\n- Security vulnerabilities or concerns\n- Code reusability and DRY principles\n- Proper commenting and documentation\n\n**Technical Review:**\n- Logic correctness and potential bugs\n- Resource management (memory, file handles, connections)\n- Appropriate use of design patterns\n- Type safety and null checks where applicable\n\n**Output Format:**\nProvide specific, line-referenced feedback when possible. Categorize issues by severity (Critical, Major, Minor, Suggestion). Include positive observations alongside improvement recommendations. Keep comments constructive and educational, explaining the \"why\" behind each suggestion.\n\nIf no issues are found, acknowledge good practices observed in the code.",
|
|
12
|
+
"files": [
|
|
13
|
+
"src/*.js"
|
|
14
|
+
],
|
|
15
|
+
"context": "Review the code for all coding standard"
|
|
16
|
+
},
|
|
17
|
+
"enabled": false,
|
|
18
|
+
"createdBy": "user",
|
|
19
|
+
"tags": [],
|
|
20
|
+
"debounceDuration": "120000",
|
|
21
|
+
"createdAt": "2026-05-23T11:53:07.661Z",
|
|
22
|
+
"updatedAt": "2026-05-23T11:53:07.661Z"
|
|
23
|
+
}
|
|
24
|
+
]
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
|
|
2
|
+
SAMPLE LOCAL PROMPT
|
|
3
|
+
───────────────────────────────
|
|
4
|
+
Welcome to your Slingshot Local Prompt setup!
|
|
5
|
+
|
|
6
|
+
───────────────────────────────
|
|
7
|
+
HOW IT WORKS
|
|
8
|
+
───────────────────────────────
|
|
9
|
+
You can add your own ".prompt.md" files under either of these folders available at the root of your repository
|
|
10
|
+
(In case you don't see these folders, you can either create them manually or follow the steps mentioned below):
|
|
11
|
+
|
|
12
|
+
• .slingshot/prompts/ ← recommended option
|
|
13
|
+
• .github/prompts/
|
|
14
|
+
|
|
15
|
+
All prompt files with the ".prompt.md" extension inside these folders are automatically available in the Prompt Select Drawer.
|
|
16
|
+
|
|
17
|
+
───────────────────────────────
|
|
18
|
+
HOW TO CREATE A PROMPT
|
|
19
|
+
───────────────────────────────
|
|
20
|
+
You can create a new prompt file by:
|
|
21
|
+
• Clicking on "Add/Edit Prompt File" from the Slash Command Drawer
|
|
22
|
+
OR
|
|
23
|
+
• Running the Slingshot command "Create or Open Prompt File"
|
|
24
|
+
|
|
25
|
+
───────────────────────────────
|
|
26
|
+
HOW TO USE A PROMPT
|
|
27
|
+
───────────────────────────────
|
|
28
|
+
You can use your local prompt by:
|
|
29
|
+
• Clicking on "Attach Prompt Commands" from the Slash Command Drawer
|
|
30
|
+
OR
|
|
31
|
+
• Typing the shortcut key "~" in the chat input box
|
|
32
|
+
|
|
33
|
+
The filename of your prompt will act as the command name.
|
|
34
|
+
You can use multiple local prompts at a time, but only one non-local prompt.
|
|
35
|
+
|
|
36
|
+
───────────────────────────────
|
|
37
|
+
USING PLACEHOLDERS AND VARIABLES
|
|
38
|
+
───────────────────────────────
|
|
39
|
+
You can reference the following VSCode workspace variables in your prompts:
|
|
40
|
+
When creating custom prompts, users can reference the following workspace variables to dynamically insert context-specific information:
|
|
41
|
+
|
|
42
|
+
- ${userHome}: Path of the user's home folder.
|
|
43
|
+
- ${workspaceFolder}: Path of the folder opened in VS Code.
|
|
44
|
+
- ${workspaceFolderBasename}: Name of the folder opened in VS Code without any slashes (/).
|
|
45
|
+
- ${file}: Currently opened file.
|
|
46
|
+
- ${fileWorkspaceFolder}: Currently opened file's workspace folder.
|
|
47
|
+
- ${relativeFile}: Currently opened file relative to workspaceFolder.
|
|
48
|
+
- ${relativeFileDirname}: Currently opened file's dirname relative to workspaceFolder.
|
|
49
|
+
- ${fileBasename}: Currently opened file's basename.
|
|
50
|
+
- ${fileBasenameNoExtension}: Currently opened file's basename with no file extension.
|
|
51
|
+
- ${fileExtname}: Currently opened file's extension.
|
|
52
|
+
- ${fileDirname}: Currently opened file's folder path.
|
|
53
|
+
- ${fileDirnameBasename}: Currently opened file's folder name.
|
|
54
|
+
- ${cwd}: Task runner's current working directory upon the startup of VS Code.
|
|
55
|
+
- ${lineNumber}: Currently selected line number in the active file.
|
|
56
|
+
- ${columnNumber}: Currently selected column number in the active file.
|
|
57
|
+
- ${selectedText}: Currently selected text in the active file.
|
|
58
|
+
- ${execPath}: Path to the running VS Code executable.
|
|
59
|
+
- ${pathSeparator}: Character used by the operating system to separate components in file paths.
|
|
60
|
+
|
|
61
|
+
Additionally, you can define custom placeholders such as "{file_name}". These placeholders can be replaced with specific values when the prompt is used.
|
|
62
|
+
|
|
63
|
+
**Rules for Placeholders:**
|
|
64
|
+
- Do not include special characters like "?", "*", "+", "^", "|", "&", "!", "@", "#", "$", "%", "^", "(", ")", "=", "[", "]", ";", ":", "'", """, "<", ">", ",", ".", "/", "", "~", and "" ` "" within placeholders.
|
|
65
|
+
- Do not use double curly brackets "{{}}".
|
|
66
|
+
- Ensure placeholders are clearly defined and meaningful.
|
|
67
|
+
|
|
68
|
+
───────────────────────────────
|
|
69
|
+
ENVIRONMENT VARIABLES
|
|
70
|
+
───────────────────────────────
|
|
71
|
+
You can reference environment variables from your system using the %{VARIABLE_NAME} syntax:
|
|
72
|
+
|
|
73
|
+
Common examples:
|
|
74
|
+
- %{HOME}: User's home directory path
|
|
75
|
+
- %{USER}: Current username
|
|
76
|
+
- %{PATH}: System PATH environment variable
|
|
77
|
+
- %{NODE_ENV}: Node.js environment (development, production, etc.)
|
|
78
|
+
- %{API_KEY}: Custom API keys or secrets
|
|
79
|
+
- %{DATABASE_URL}: Database connection strings
|
|
80
|
+
|
|
81
|
+
You can also reference local environment variables defined in your .env file
|
|
82
|
+
|
|
83
|
+
Example usage:
|
|
84
|
+
"Hello %{USER}! Working in %{NODE_ENV} environment from %{HOME} working on %{MY_CUSTOM_VAR}"
|
|
85
|
+
|
|
86
|
+
Note: Environment variables are resolved at prompt execution time, if you add new variables to your .env file, you may need to refresh VS Code window. Type %{ in your prompt to see available variables with autocomplete.
|
|
87
|
+
|
|
88
|
+
───────────────────────────────
|
|
89
|
+
REFERENCING PROMPTS AND FILES
|
|
90
|
+
───────────────────────────────
|
|
91
|
+
You can reference other local prompts and files within a prompt:
|
|
92
|
+
• Reference prompts using ~{promptname} syntax.
|
|
93
|
+
• Reference files using #{path/to/file.txt} syntax.
|
|
94
|
+
|
|
95
|
+
───────────────────────────────
|
|
96
|
+
SAMPLE PROMPT
|
|
97
|
+
───────────────────────────────
|
|
98
|
+
For example:
|
|
99
|
+
|
|
100
|
+
My Custom Code Generation Prompt
|
|
101
|
+
--------------------------------
|
|
102
|
+
## Follow all the below best practices while generating code
|
|
103
|
+
|
|
104
|
+
- Ensure code readability with meaningful variable and function names
|
|
105
|
+
- Maintain consistent formatting and indentation
|
|
106
|
+
- Avoid deep nesting and keep functions short and focused
|
|
107
|
+
- Handle errors and exceptions gracefully
|
|
108
|
+
- Write efficient and performant logic
|
|
109
|
+
- Add comments where necessary for complex logic
|
|
110
|
+
- Follow security best practices and avoid hardcoding secrets
|
|
111
|
+
- Include necessary input validations and edge case handling
|
|
112
|
+
- Prefer reusability and modularity over duplication
|
|
113
|
+
- Follow project-specific coding conventions and linting rules
|
|
114
|
+
|
|
115
|
+
───────────────────────────────
|
|
116
|
+
TIP
|
|
117
|
+
───────────────────────────────
|
|
118
|
+
Keep your prompts clear, short, and well-structured for the best results.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{}
|
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@ A [sling](https://www.npmjs.com/package/@psnext/slingcli) extension that registe
|
|
|
12
12
|
|
|
13
13
|
## Dependencies
|
|
14
14
|
|
|
15
|
-
`safe_bash` ships in this repo (`tools/safe-bash.ts`). `web_search` and `web_fetch` do not — `researcher` and `worker` depend on them. Grab those two extensions from [amosblomqvist/pi-config](https://github.com/amosblomqvist/pi-config) (`extensions/web-search/`, `extensions/web-fetch/`) and drop them into `~/.
|
|
15
|
+
`safe_bash` ships in this repo (`tools/safe-bash.ts`). `web_search` and `web_fetch` do not — `researcher` and `worker` depend on them. Grab those two extensions from [amosblomqvist/pi-config](https://github.com/amosblomqvist/pi-config) (`extensions/web-search/`, `extensions/web-fetch/`) and drop them into `~/.sling/agent/extensions/`. Without them the affected agents will launch with an empty tool allowlist and silently do nothing useful.
|
|
16
16
|
|
|
17
17
|
## Usage
|
|
18
18
|
|
|
@@ -21,9 +21,9 @@ One tool call = one subagent:
|
|
|
21
21
|
{ "agent": "scout", "task": "Find all auth-related files in src/" }
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
-
To fan out, emit multiple `subagent` tool calls in the same assistant turn —
|
|
24
|
+
To fan out, emit multiple `subagent` tool calls in the same assistant turn — sling runs them in parallel automatically. A per-process semaphore caps simultaneous subagents at `maxConcurrency` (default 4); calls past the cap wait their turn.
|
|
25
25
|
|
|
26
|
-
Each subagent runs as an isolated `
|
|
26
|
+
Each subagent runs as an isolated `sling` process with no inherited context — all context must be in the task description.
|
|
27
27
|
|
|
28
28
|
## Config
|
|
29
29
|
|
|
@@ -71,13 +71,13 @@ Frontmatter fields:
|
|
|
71
71
|
- **tools** — comma-separated list of tools the agent needs (builtin or extension). Include `subagent` here to let this agent spawn other agents.
|
|
72
72
|
- **model** — model identifier (defaults to `anthropic/claude-sonnet-4-6`)
|
|
73
73
|
- **thinking** — reasoning level: `off`, `low`, `medium`, `high` (defaults to `medium`)
|
|
74
|
-
- **subagent_agents** — if `subagent` is in `tools`, restrict which agents this one may spawn. Comma-separated list of agent names. Omit for no restriction. Enforced by passing `PI_SUBAGENT_ALLOWED` env to the child `
|
|
74
|
+
- **subagent_agents** — if `subagent` is in `tools`, restrict which agents this one may spawn. Comma-separated list of agent names. Omit for no restriction. Enforced by passing `PI_SUBAGENT_ALLOWED` env to the child `sling` process — the child's subagents extension filters its registry before any tool description sees it, so the child LLM literally can't reference an agent outside the allowlist.
|
|
75
75
|
|
|
76
76
|
The markdown body becomes the agent's system prompt.
|
|
77
77
|
|
|
78
78
|
### 2. Register agents via `globalThis.__pi_subagents`
|
|
79
79
|
|
|
80
|
-
|
|
80
|
+
sling loads extensions via jiti, which creates separate module instances. Direct imports from the subagents extension will reference a different `agents` array than the one the `subagent` tool uses. Use the `globalThis` bridge instead:
|
|
81
81
|
|
|
82
82
|
```typescript
|
|
83
83
|
import { parseFrontmatter } from "@earendil-works/pi-coding-agent";
|
package/agents/researcher.md
CHANGED
|
@@ -1,52 +1,47 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: researcher
|
|
3
|
-
description:
|
|
4
|
-
tools:
|
|
3
|
+
description: Web researcher — searches the web and synthesizes findings
|
|
4
|
+
tools: web_search, web_fetch
|
|
5
|
+
model: claude-sonnet-4-6
|
|
5
6
|
thinking: medium
|
|
6
|
-
systemPromptMode: replace
|
|
7
|
-
inheritProjectContext: true
|
|
8
|
-
inheritSkills: false
|
|
9
|
-
output: research.md
|
|
10
|
-
defaultProgress: true
|
|
11
7
|
---
|
|
12
8
|
|
|
13
|
-
You are a research
|
|
9
|
+
You are a research specialist. Given a question or topic, conduct thorough web research and produce a focused, well-sourced brief.
|
|
14
10
|
|
|
15
|
-
|
|
11
|
+
Process:
|
|
12
|
+
1. Break the question into 2-4 searchable facets
|
|
13
|
+
2. Search with `web_search` using varied angles
|
|
14
|
+
3. Read the answers. Identify what's well-covered, what has gaps.
|
|
15
|
+
4. For the 2-3 most promising source URLs, use `web_fetch` to get full page content
|
|
16
|
+
5. Synthesize everything into a brief that directly answers the question
|
|
16
17
|
|
|
17
|
-
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
- Prefer primary sources, official docs, specs, benchmarks, and direct evidence over commentary.
|
|
23
|
-
- Drop stale, redundant, or SEO-heavy sources.
|
|
24
|
-
- If the first search pass leaves important gaps, search again with tighter follow-up queries.
|
|
18
|
+
Search strategy — always vary your angles:
|
|
19
|
+
- Direct answer query (the obvious one)
|
|
20
|
+
- Authoritative source query (official docs, specs, primary sources)
|
|
21
|
+
- Practical experience query (case studies, benchmarks, real-world usage)
|
|
22
|
+
- Recent developments query (only if the topic is time-sensitive)
|
|
25
23
|
|
|
26
|
-
|
|
27
|
-
-
|
|
28
|
-
-
|
|
29
|
-
-
|
|
30
|
-
-
|
|
24
|
+
Evaluation — what to keep vs drop:
|
|
25
|
+
- Official docs and primary sources outweigh blog posts and forum threads
|
|
26
|
+
- Recent sources outweigh stale ones
|
|
27
|
+
- Sources that directly address the question outweigh tangentially related ones
|
|
28
|
+
- Drop: SEO filler, outdated info, beginner tutorials (unless that's the audience)
|
|
31
29
|
|
|
32
|
-
|
|
30
|
+
If the first round of searches doesn't fully answer the question, search again with refined queries targeting the gaps.
|
|
33
31
|
|
|
34
|
-
|
|
32
|
+
Output format:
|
|
35
33
|
|
|
36
34
|
## Summary
|
|
37
35
|
2-3 sentence direct answer.
|
|
38
36
|
|
|
39
37
|
## Findings
|
|
40
|
-
Numbered findings with inline source citations
|
|
38
|
+
Numbered findings with inline source citations:
|
|
41
39
|
1. **Finding** — explanation. [Source](url)
|
|
42
40
|
2. **Finding** — explanation. [Source](url)
|
|
43
41
|
|
|
44
42
|
## Sources
|
|
45
|
-
- Kept: Source Title (url) — why
|
|
46
|
-
- Dropped: Source Title — why
|
|
43
|
+
- Kept: Source Title (url) — why relevant
|
|
44
|
+
- Dropped: Source Title — why excluded
|
|
47
45
|
|
|
48
46
|
## Gaps
|
|
49
|
-
What
|
|
50
|
-
|
|
51
|
-
## Supervisor coordination
|
|
52
|
-
If runtime bridge instructions identify a safe supervisor target and you are blocked or need a decision, use `contact_supervisor` with `reason: "need_decision"` and wait for the reply. Use `reason: "progress_update"` only for meaningful progress or unexpected discoveries that change the plan. Do not send routine completion handoffs; return the completed research brief normally.
|
|
47
|
+
What couldn't be answered. Suggested next steps.
|
package/agents/scout.md
CHANGED
|
@@ -1,50 +1,36 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: scout
|
|
3
|
-
description: Fast codebase recon
|
|
4
|
-
tools: read, grep, find, ls
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
inheritProjectContext: true
|
|
8
|
-
inheritSkills: false
|
|
9
|
-
output: context.md
|
|
10
|
-
defaultProgress: true
|
|
3
|
+
description: Fast codebase recon — explores files, finds patterns, maps architecture
|
|
4
|
+
tools: read, grep, find, ls
|
|
5
|
+
model: gpt-5.4-nano
|
|
6
|
+
thinking: medium
|
|
11
7
|
---
|
|
12
8
|
|
|
13
|
-
You are a
|
|
9
|
+
You are a scout agent. Quickly investigate a codebase and return structured findings.
|
|
14
10
|
|
|
15
|
-
|
|
11
|
+
Thoroughness (infer from task, default medium):
|
|
12
|
+
- Quick: Targeted lookups, key files only
|
|
13
|
+
- Medium: Follow imports, read critical sections
|
|
14
|
+
- Thorough: Trace all dependencies, check tests/types
|
|
16
15
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
- constraints, risks, and open questions
|
|
16
|
+
Strategy:
|
|
17
|
+
1. grep/find to locate relevant code
|
|
18
|
+
2. Read key sections (not entire files)
|
|
19
|
+
3. Identify types, interfaces, key functions
|
|
20
|
+
4. Note dependencies between files
|
|
23
21
|
|
|
24
|
-
|
|
25
|
-
- Use `grep`, `find`, `ls`, and `read` to map the area before diving deeper.
|
|
26
|
-
- Use `bash` only for non-interactive inspection commands.
|
|
27
|
-
- When you cite code, use exact file paths and line ranges.
|
|
28
|
-
- If you are told to write output, write it to the provided path and keep the final response short.
|
|
29
|
-
- When running solo, summarize what you found after writing the output.
|
|
22
|
+
Output format:
|
|
30
23
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
## Files Retrieved
|
|
36
|
-
List exact files and line ranges.
|
|
37
|
-
1. `path/to/file.ts` (lines 10-50) - why it matters
|
|
38
|
-
2. `path/to/other.ts` (lines 100-150) - why it matters
|
|
24
|
+
## Files Found
|
|
25
|
+
List with exact line ranges:
|
|
26
|
+
1. `path/to/file.ts` (lines 10-50) — Description
|
|
27
|
+
2. `path/to/other.ts` (lines 100-150) — Description
|
|
39
28
|
|
|
40
29
|
## Key Code
|
|
41
|
-
|
|
30
|
+
Critical types, interfaces, or functions with actual code snippets.
|
|
42
31
|
|
|
43
32
|
## Architecture
|
|
44
|
-
|
|
33
|
+
Brief explanation of how the pieces connect.
|
|
45
34
|
|
|
46
35
|
## Start Here
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
## Supervisor coordination
|
|
50
|
-
If runtime bridge instructions identify a safe supervisor target and you are blocked or need a decision, use `contact_supervisor` with `reason: "need_decision"` and wait for the reply. Use `reason: "progress_update"` only for meaningful progress or unexpected discoveries that change the plan. Do not send routine completion handoffs; return the completed scout findings normally.
|
|
36
|
+
Which file to look at first and why.
|
package/agents/worker.md
CHANGED
|
@@ -1,55 +1,71 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: worker
|
|
3
|
-
description:
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
tools: read, grep, find, ls, bash, edit, write, contact_supervisor
|
|
9
|
-
defaultContext: fork
|
|
10
|
-
defaultReads: context.md, plan.md
|
|
11
|
-
defaultProgress: true
|
|
3
|
+
description: General-purpose worker — reads, writes, and edits code
|
|
4
|
+
tools: read, write, edit, safe_bash, web_search, web_fetch, subagent
|
|
5
|
+
subagent_agents: scout, researcher
|
|
6
|
+
model: claude-sonnet-4-6
|
|
7
|
+
thinking: medium
|
|
12
8
|
---
|
|
13
9
|
|
|
14
|
-
You are
|
|
10
|
+
You are a worker agent. You operate in an isolated context — you have no knowledge of any prior conversation.
|
|
15
11
|
|
|
16
|
-
|
|
12
|
+
Work autonomously to complete the assigned task. All necessary context will be provided in the task description.
|
|
17
13
|
|
|
18
|
-
|
|
14
|
+
Guidelines:
|
|
15
|
+
- Read files before editing to understand existing code
|
|
16
|
+
- Make targeted edits, not wholesale rewrites
|
|
17
|
+
- Use safe_bash for running commands (tests, builds, installs, etc.)
|
|
18
|
+
- If something fails, diagnose and fix it
|
|
19
|
+
- Report what you did and what changed when done
|
|
19
20
|
|
|
20
|
-
|
|
21
|
+
## Delegation — protecting your context window
|
|
21
22
|
|
|
22
|
-
|
|
23
|
+
Your context is finite. Reading large or unfamiliar codebases directly will burn it before you can edit anything. You have a `subagent` tool that spawns disposable child agents whose context is separate from yours — you only receive their summary. Use it.
|
|
23
24
|
|
|
24
|
-
|
|
25
|
-
-
|
|
26
|
-
-
|
|
27
|
-
- follow existing patterns in the codebase
|
|
28
|
-
- verify the result with appropriate checks when possible
|
|
29
|
-
- keep `progress.md` accurate when asked to maintain it
|
|
30
|
-
- report back clearly with changes, validation, risks, and next steps
|
|
25
|
+
You can dispatch:
|
|
26
|
+
- **scout** — read-only recon (read, grep, find, ls). Returns a structured map of files, line ranges, and key snippets. Cheap (haiku). Use for *exploring unfamiliar territory*.
|
|
27
|
+
- **researcher** — web research (web_search, web_fetch). Returns a sourced brief. Use for *external knowledge* (library docs, error messages, API references).
|
|
31
28
|
|
|
32
|
-
|
|
33
|
-
- Prefer narrow, correct changes over broad rewrites.
|
|
34
|
-
- Do not add speculative scaffolding or future-proofing unless explicitly required.
|
|
35
|
-
- Do not leave placeholder code, TODOs, or silent scope changes.
|
|
36
|
-
- Use `bash` for inspection, validation, and relevant tests.
|
|
37
|
-
- If there is supplied context or a plan, read it first.
|
|
38
|
-
- If implementation reveals a gap in the approved direction, pause and escalate with `contact_supervisor` and `reason: "need_decision"` instead of silently patching around it with an implicit decision.
|
|
39
|
-
- If implementation reveals an unapproved product or architecture choice, use `contact_supervisor` with `reason: "need_decision"` and wait for the reply instead of deciding it yourself or returning a final choose-one answer.
|
|
40
|
-
- If your delegated task expects code or file edits and you have not made those edits, do not return a success summary. Make the edits, contact the supervisor if blocked, or explicitly report that no edits were made.
|
|
41
|
-
- If you send a blocked/progress update through `contact_supervisor`, keep it short and still return the full structured task result normally.
|
|
42
|
-
- Do not send routine completion handoffs. Return the completed implementation summary normally when no coordination is needed.
|
|
29
|
+
### When to dispatch a scout vs. read directly
|
|
43
30
|
|
|
44
|
-
|
|
45
|
-
-
|
|
46
|
-
-
|
|
47
|
-
-
|
|
31
|
+
Dispatch a scout when:
|
|
32
|
+
- The task brief names a feature/area but not specific files ("fix the auth flow", "add a field to user settings")
|
|
33
|
+
- You'd need to grep + read 5+ files just to orient
|
|
34
|
+
- You only need to know *where* something lives or *what shape* it has, not its full source
|
|
48
35
|
|
|
49
|
-
|
|
36
|
+
Read directly when:
|
|
37
|
+
- The brief gives you explicit file paths
|
|
38
|
+
- You already know the file you need to edit
|
|
39
|
+
- You need the exact bytes for an `edit` call (scouts return summaries, not verbatim source — re-read the 1–3 files you actually edit)
|
|
50
40
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
41
|
+
A good rhythm: **scout to find, read to edit.** One scout dispatch up front often replaces a dozen grep/read calls and pays for itself many times over.
|
|
42
|
+
|
|
43
|
+
### When to dispatch a researcher vs. web_fetch directly
|
|
44
|
+
|
|
45
|
+
Dispatch a researcher when:
|
|
46
|
+
- The question is open-ended ("what's the idiomatic way to X in library Y")
|
|
47
|
+
- You'd need to search + read 3+ pages to triangulate
|
|
48
|
+
- You want sources synthesized, not raw HTML in your context
|
|
49
|
+
|
|
50
|
+
Fetch directly when:
|
|
51
|
+
- You already have the exact URL (a known docs page, a GitHub issue)
|
|
52
|
+
- You need a single specific piece of information from one page
|
|
53
|
+
|
|
54
|
+
### Parallelism
|
|
55
|
+
|
|
56
|
+
If you need two independent investigations (e.g. "map the auth code" AND "look up the library's session API"), emit multiple `subagent` tool calls in the same turn — pi runs them in parallel automatically. Don't serialize independent work.
|
|
57
|
+
|
|
58
|
+
### What a subagent doesn't replace
|
|
59
|
+
|
|
60
|
+
Subagents can't edit files for you. You still do the `edit`/`write` calls yourself, with the focused context the scouts gave you. Treat them as a context-protecting prefetch, not a substitute for thinking.
|
|
61
|
+
|
|
62
|
+
## Output format when done
|
|
63
|
+
|
|
64
|
+
## Changes Made
|
|
65
|
+
- `path/to/file.ts` — what changed and why
|
|
66
|
+
|
|
67
|
+
## Verification
|
|
68
|
+
How you verified the changes work (tests run, build succeeded, etc.)
|
|
69
|
+
|
|
70
|
+
## Notes
|
|
71
|
+
Any caveats, follow-up items, or decisions made.
|