@te-river/opencode-team-mode 1.5.5 → 1.5.7
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/README.md +544 -634
- package/README.zh-CN.md +511 -576
- package/dist/agents.d.ts +6 -1
- package/dist/agents.d.ts.map +1 -1
- package/dist/agents.js +113 -533
- package/dist/agents.js.map +1 -1
- package/dist/approval-gate.d.ts +16 -0
- package/dist/approval-gate.d.ts.map +1 -1
- package/dist/approval-gate.js +8 -1
- package/dist/approval-gate.js.map +1 -1
- package/dist/blackboard.d.ts.map +1 -1
- package/dist/blackboard.js +3 -2
- package/dist/blackboard.js.map +1 -1
- package/dist/commands.d.ts.map +1 -1
- package/dist/commands.js +7 -6
- package/dist/commands.js.map +1 -1
- package/dist/envprotect/bash-classify.d.ts +42 -0
- package/dist/envprotect/bash-classify.d.ts.map +1 -0
- package/dist/envprotect/bash-classify.js +221 -0
- package/dist/envprotect/bash-classify.js.map +1 -0
- package/dist/envprotect/gate-predicates.d.ts +57 -0
- package/dist/envprotect/gate-predicates.d.ts.map +1 -0
- package/dist/envprotect/gate-predicates.js +174 -0
- package/dist/envprotect/gate-predicates.js.map +1 -0
- package/dist/envprotect/hook.d.ts +45 -0
- package/dist/envprotect/hook.d.ts.map +1 -0
- package/dist/envprotect/hook.js +158 -0
- package/dist/envprotect/hook.js.map +1 -0
- package/dist/envprotect/path-classify.d.ts +16 -0
- package/dist/envprotect/path-classify.d.ts.map +1 -0
- package/dist/envprotect/path-classify.js +72 -0
- package/dist/envprotect/path-classify.js.map +1 -0
- package/dist/envprotect/patterns.d.ts +77 -0
- package/dist/envprotect/patterns.d.ts.map +1 -0
- package/dist/envprotect/patterns.js +182 -0
- package/dist/envprotect/patterns.js.map +1 -0
- package/dist/envprotect.d.ts +19 -217
- package/dist/envprotect.d.ts.map +1 -1
- package/dist/envprotect.js +18 -803
- package/dist/envprotect.js.map +1 -1
- package/dist/fs-safe.d.ts +16 -0
- package/dist/fs-safe.d.ts.map +1 -0
- package/dist/fs-safe.js +56 -0
- package/dist/fs-safe.js.map +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +22 -6
- package/dist/index.js.map +1 -1
- package/dist/prompts/lead.d.ts +7 -0
- package/dist/prompts/lead.d.ts.map +1 -0
- package/dist/prompts/lead.js +233 -0
- package/dist/prompts/lead.js.map +1 -0
- package/dist/prompts/shared.d.ts +8 -0
- package/dist/prompts/shared.d.ts.map +1 -0
- package/dist/prompts/shared.js +120 -0
- package/dist/prompts/shared.js.map +1 -0
- package/dist/prompts/specialists.d.ts +12 -0
- package/dist/prompts/specialists.d.ts.map +1 -0
- package/dist/prompts/specialists.js +241 -0
- package/dist/prompts/specialists.js.map +1 -0
- package/dist/shell-text.d.ts +14 -0
- package/dist/shell-text.d.ts.map +1 -0
- package/dist/shell-text.js +16 -0
- package/dist/shell-text.js.map +1 -0
- package/dist/tm/args-schema.d.ts +42 -0
- package/dist/tm/args-schema.d.ts.map +1 -0
- package/dist/tm/args-schema.js +213 -0
- package/dist/tm/args-schema.js.map +1 -0
- package/dist/tm/browser.d.ts +52 -0
- package/dist/tm/browser.d.ts.map +1 -0
- package/dist/tm/browser.js +361 -0
- package/dist/tm/browser.js.map +1 -0
- package/dist/tm/client-unwrap.d.ts +38 -0
- package/dist/tm/client-unwrap.d.ts.map +1 -0
- package/dist/tm/client-unwrap.js +113 -0
- package/dist/tm/client-unwrap.js.map +1 -0
- package/dist/tm/config.d.ts +55 -19
- package/dist/tm/config.d.ts.map +1 -1
- package/dist/tm/config.js +74 -19
- package/dist/tm/config.js.map +1 -1
- package/dist/tm/guard.d.ts.map +1 -1
- package/dist/tm/guard.js +4 -7
- package/dist/tm/guard.js.map +1 -1
- package/dist/tm/index.d.ts +24 -7
- package/dist/tm/index.d.ts.map +1 -1
- package/dist/tm/index.js +111 -21
- package/dist/tm/index.js.map +1 -1
- package/dist/tm/memory.d.ts +88 -0
- package/dist/tm/memory.d.ts.map +1 -0
- package/dist/tm/memory.js +360 -0
- package/dist/tm/memory.js.map +1 -0
- package/dist/tm/pipelines.d.ts +58 -0
- package/dist/tm/pipelines.d.ts.map +1 -0
- package/dist/tm/pipelines.js +308 -0
- package/dist/tm/pipelines.js.map +1 -0
- package/dist/tm/preview.d.ts +6 -1
- package/dist/tm/preview.d.ts.map +1 -1
- package/dist/tm/preview.js +63 -13
- package/dist/tm/preview.js.map +1 -1
- package/dist/tm/ptc/budgets.d.ts +38 -0
- package/dist/tm/ptc/budgets.d.ts.map +1 -0
- package/dist/tm/ptc/budgets.js +59 -0
- package/dist/tm/ptc/budgets.js.map +1 -0
- package/dist/tm/ptc/contract.d.ts +131 -0
- package/dist/tm/ptc/contract.d.ts.map +1 -0
- package/dist/tm/ptc/contract.js +47 -0
- package/dist/tm/ptc/contract.js.map +1 -0
- package/dist/tm/ptc/driver.d.ts +37 -0
- package/dist/tm/ptc/driver.d.ts.map +1 -0
- package/dist/tm/ptc/driver.js +181 -0
- package/dist/tm/ptc/driver.js.map +1 -0
- package/dist/tm/ptc/engines.d.ts +32 -0
- package/dist/tm/ptc/engines.d.ts.map +1 -0
- package/dist/tm/ptc/engines.js +201 -0
- package/dist/tm/ptc/engines.js.map +1 -0
- package/dist/tm/ptc/gate.d.ts +28 -0
- package/dist/tm/ptc/gate.d.ts.map +1 -0
- package/dist/tm/ptc/gate.js +130 -0
- package/dist/tm/ptc/gate.js.map +1 -0
- package/dist/tm/ptc/index.d.ts +19 -0
- package/dist/tm/ptc/index.d.ts.map +1 -0
- package/dist/tm/ptc/index.js +15 -0
- package/dist/tm/ptc/index.js.map +1 -0
- package/dist/tm/ptc/pscan.d.ts +11 -0
- package/dist/tm/ptc/pscan.d.ts.map +1 -0
- package/dist/tm/ptc/pscan.js +27 -0
- package/dist/tm/ptc/pscan.js.map +1 -0
- package/dist/tm/ptc/summary.d.ts +17 -0
- package/dist/tm/ptc/summary.d.ts.map +1 -0
- package/dist/tm/ptc/summary.js +112 -0
- package/dist/tm/ptc/summary.js.map +1 -0
- package/dist/tm/ptc/tool.d.ts +35 -0
- package/dist/tm/ptc/tool.d.ts.map +1 -0
- package/dist/tm/ptc/tool.js +136 -0
- package/dist/tm/ptc/tool.js.map +1 -0
- package/dist/tm/ptc.d.ts +45 -26
- package/dist/tm/ptc.d.ts.map +1 -1
- package/dist/tm/ptc.js +71 -45
- package/dist/tm/ptc.js.map +1 -1
- package/dist/tm/result.d.ts +34 -0
- package/dist/tm/result.d.ts.map +1 -0
- package/dist/tm/result.js +87 -0
- package/dist/tm/result.js.map +1 -0
- package/dist/tm/search.d.ts +58 -0
- package/dist/tm/search.d.ts.map +1 -0
- package/dist/tm/search.js +229 -0
- package/dist/tm/search.js.map +1 -0
- package/dist/tm/shell-bridge.d.ts +22 -0
- package/dist/tm/shell-bridge.d.ts.map +1 -0
- package/dist/tm/shell-bridge.js +116 -0
- package/dist/tm/shell-bridge.js.map +1 -0
- package/dist/tm/store.d.ts.map +1 -1
- package/dist/tm/store.js +2 -1
- package/dist/tm/store.js.map +1 -1
- package/dist/tm/tools.d.ts +13 -71
- package/dist/tm/tools.d.ts.map +1 -1
- package/dist/tm/tools.js +22 -656
- package/dist/tm/tools.js.map +1 -1
- package/dist/tm/webfetch.d.ts +109 -0
- package/dist/tm/webfetch.d.ts.map +1 -0
- package/dist/tm/webfetch.js +305 -0
- package/dist/tm/webfetch.js.map +1 -0
- package/docs/installation.md +201 -0
- package/package.json +4 -3
package/dist/agents.js
CHANGED
|
@@ -6,13 +6,18 @@
|
|
|
6
6
|
* Users see them in the agent picker of OpenCode Desktop and can invoke
|
|
7
7
|
* them with `@agent-name` or via the `/team-*` commands.
|
|
8
8
|
*
|
|
9
|
+
* The PROMPT STRINGS live in ./prompts/ (lead.ts, specialists.ts,
|
|
10
|
+
* shared.ts) — extracted verbatim; test-blackboard.mjs pins them. This
|
|
11
|
+
* module owns the structure: roles, modes, colors, temperatures, and the
|
|
12
|
+
* tool-whitelist matrix.
|
|
13
|
+
*
|
|
9
14
|
* Prompt design principles (v1.4.7 — "subtraction" release):
|
|
10
15
|
* - Deterministic routing table replaces free-form scheduling deliberation
|
|
11
16
|
* (fixes the lead's "inner monologue" — route selection is a lookup).
|
|
12
17
|
* - Structured reply skeleton (STATUS/CHANGES/FINDINGS/EVIDENCE/HANDOFF)
|
|
13
18
|
* is the primary inter-agent channel; the file blackboard is demoted to
|
|
14
19
|
* an oversized-deliverable exception (>~50 lines). MANIFEST.md is gone.
|
|
15
|
-
* - Approval gate is a mechanical dispatch count (>=
|
|
20
|
+
* - Approval gate is a mechanical dispatch count (>=2 -> plan + wait);
|
|
16
21
|
* blocking uncertainties are batched and asked immediately.
|
|
17
22
|
* - Verified root causes go straight to the implementer — no ceremonial
|
|
18
23
|
* research dispatches.
|
|
@@ -22,6 +27,9 @@
|
|
|
22
27
|
* high-risk profiles.
|
|
23
28
|
* - All agents run at temperature 0.2 for format discipline.
|
|
24
29
|
*/
|
|
30
|
+
import { TEAM_LEAD_PROMPT } from "./prompts/lead.js";
|
|
31
|
+
import { ARCHITECT_PROMPT, IMPLEMENTER_PROMPT, RESEARCHER_PROMPT, REVIEWER_PROMPT, TESTER_PROMPT, } from "./prompts/specialists.js";
|
|
32
|
+
import { REPLY_CONTRACT, SHARED_RULES } from "./prompts/shared.js";
|
|
25
33
|
/* ------------------------------------------------------------------ */
|
|
26
34
|
/* Tool whitelist builder (Phase 2 / T2.1, G2 ruling "方案甲") */
|
|
27
35
|
/* ------------------------------------------------------------------ */
|
|
@@ -37,11 +45,16 @@
|
|
|
37
45
|
* G2 rulings baked in:
|
|
38
46
|
* - glob/list never enter the whitelist — file enumeration goes through
|
|
39
47
|
* tm_bash (ls / dir / Get-ChildItem);
|
|
40
|
-
* - webfetch/websearch
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
48
|
+
* - the built-in webfetch/websearch tools stay removed — the governed
|
|
49
|
+
* tm_webfetch (domain-allowlisted, threshold-offloaded) is the sanctioned
|
|
50
|
+
* web FALLBACK channel, granted ONLY to team + researcher; user-
|
|
51
|
+
* configured MCP/plugin tools (browser automation, search, fetchers)
|
|
52
|
+
* pass through the whitelist untouched and are the HIGH-priority channel;
|
|
53
|
+
* - "tm_*" covers the four governed read/search/exec tools (tm_read /
|
|
54
|
+
* tm_grep / tm_bash / tm_fetch); tm_webfetch and tm_ptc_run are explicit
|
|
55
|
+
* keys that override the wildcard per agent; the R6 env-protection hook
|
|
56
|
+
* aliases onto read/grep/bash unchanged, so narrowing the surface does
|
|
57
|
+
* not weaken the anti-backdoor chain.
|
|
45
58
|
*
|
|
46
59
|
* T2.1 review revision (Critical fix): the built-in bash RETURNS for the
|
|
47
60
|
* execution roles (team / implementer / reviewer / tester). G2 only ruled
|
|
@@ -63,16 +76,25 @@ const NEVER_ALLOWED = [
|
|
|
63
76
|
"skill",
|
|
64
77
|
"question",
|
|
65
78
|
];
|
|
66
|
-
/** Built-ins granted per agent; every one NOT granted is denied.
|
|
67
|
-
|
|
79
|
+
/** Built-ins granted per agent; every one NOT granted is denied. todowrite
|
|
80
|
+
* and question are LEAD-ONLY grants (see the whitelist call below): the
|
|
81
|
+
* lead's prompt MANDATES a todo list ("your state memory is the todo
|
|
82
|
+
* list") and batched blocking questions — denying those tools to the lead
|
|
83
|
+
* made the prompt unfulfillable; specialists answer through the lead
|
|
84
|
+
* (STATUS: blocked), never interrupt the user directly. */
|
|
85
|
+
const PER_AGENT_TOOLS = ["edit", "write", "task", "bash", "todowrite", "question"];
|
|
68
86
|
/** The governed tools, named explicitly next to the "tm_*" wildcard
|
|
69
87
|
* (belt-and-braces: the explicit allows survive even if a host ever
|
|
70
|
-
* stops expanding the wildcard).
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
*
|
|
75
|
-
*
|
|
88
|
+
* stops expanding the wildcard). tm_memory is the project memory store —
|
|
89
|
+
* not a network channel, available to all six agents. */
|
|
90
|
+
const TM_TOOLS = ["tm_read", "tm_grep", "tm_bash", "tm_fetch", "tm_memory"];
|
|
91
|
+
/** M3: tm_ptc_run — explicit per-agent grant. v1.5.4 revised the original
|
|
92
|
+
* M3 ruling (five specialists = allow, team = deny): ALL SIX agents now
|
|
93
|
+
* get `allow` (per user request, CHANGELOG 1.5.4), overriding the tm_*
|
|
94
|
+
* wildcard by explicit-key priority. PTC remains a governed, read-only
|
|
95
|
+
* bridge — the full tm_* pipeline (P2/P3/R6/offload) runs on every
|
|
96
|
+
* bridged call, so the lead running batch programs is a convenience
|
|
97
|
+
* change, not a governance change. */
|
|
76
98
|
const PTC_TOOL = "tm_ptc_run";
|
|
77
99
|
const whitelist = (...granted) => {
|
|
78
100
|
const permission = {};
|
|
@@ -84,45 +106,32 @@ const whitelist = (...granted) => {
|
|
|
84
106
|
for (const tool of TM_TOOLS)
|
|
85
107
|
permission[tool] = "allow";
|
|
86
108
|
permission["tm_*"] = "allow";
|
|
109
|
+
// Governed web channels (tm_webfetch / tm_search / tm_browser) — default
|
|
110
|
+
// DENY for every agent; the explicit keys override the tm_* wildcard.
|
|
111
|
+
// applyNetworkPermission grants the FULL set to the lead + researcher
|
|
112
|
+
// and tm_browser alone to the tester (UI verification).
|
|
113
|
+
permission["tm_webfetch"] = "deny";
|
|
114
|
+
permission["tm_search"] = "deny";
|
|
115
|
+
permission["tm_browser"] = "deny";
|
|
87
116
|
return permission;
|
|
88
117
|
};
|
|
89
|
-
/** Apply the
|
|
118
|
+
/** Apply the tm_ptc_run grant to an agent's permission block. All six
|
|
90
119
|
* agents get `allow` (overrides the tm_* wildcard for explicit key priority). */
|
|
91
120
|
function applyPtcPermission(permission, _isTeamLead) {
|
|
92
121
|
permission[PTC_TOOL] = "allow";
|
|
93
122
|
}
|
|
123
|
+
/** Apply the network grant: the team lead and the researcher carry the
|
|
124
|
+
* FULL governed web channels (tm_webfetch / tm_search / tm_browser —
|
|
125
|
+
* explicit allow overrides the tm_* wildcard); the TESTER carries
|
|
126
|
+
* tm_browser ONLY (governed UI verification — no open web fetching);
|
|
127
|
+
* architect / implementer / reviewer keep the whitelist deny. */
|
|
128
|
+
function applyNetworkPermission(permission, isWebRole, isTester = false) {
|
|
129
|
+
permission["tm_webfetch"] = isWebRole ? "allow" : "deny";
|
|
130
|
+
permission["tm_search"] = isWebRole ? "allow" : "deny";
|
|
131
|
+
permission["tm_browser"] = isWebRole || isTester ? "allow" : "deny";
|
|
132
|
+
}
|
|
94
133
|
/* ------------------------------------------------------------------ */
|
|
95
|
-
/*
|
|
96
|
-
/* ------------------------------------------------------------------ */
|
|
97
|
-
const REPLY_CONTRACT = `
|
|
98
|
-
|
|
99
|
-
## Reply contract (mandatory — the lead machine-checks this)
|
|
100
|
-
Your FINAL reply must start with exactly these skeleton lines:
|
|
101
|
-
STATUS: done | blocked | failed
|
|
102
|
-
CHANGES: <files touched — path → one line each; or "none">
|
|
103
|
-
FINDINGS: <key facts / risks, each with file:line>
|
|
104
|
-
EVIDENCE: <command output, diff refs, or log lines backing your claims>
|
|
105
|
-
HANDOFF: <the minimum structured context the next agent needs>
|
|
106
|
-
Keep the whole reply ≤50 lines. Deliverables at that size travel inline —
|
|
107
|
-
no files involved.
|
|
108
|
-
|
|
109
|
-
## Blackboard rules (hybrid mode — files are the exception)
|
|
110
|
-
- Default: zero file I/O. The skeleton reply IS the deliverable.
|
|
111
|
-
- Only when your full deliverable genuinely exceeds ~50 lines (e.g. a
|
|
112
|
-
complete design doc or report) AND the dispatch names a board file:
|
|
113
|
-
write that ONE file and reply with the skeleton + the file path instead
|
|
114
|
-
of inlining. Revisions are NEW round-suffixed files
|
|
115
|
-
(\`02-implementer-auth-r2.md\`) — never append, never rewrite history,
|
|
116
|
-
never touch files owned by other roles.
|
|
117
|
-
- Writing your dispatched board artifact is always within your role:
|
|
118
|
-
read-only constraints apply to PROJECT SOURCES, never to the board.
|
|
119
|
-
- If a board write genuinely fails (permissions, missing directory), start
|
|
120
|
-
your reply with \`BLACKBOARD WRITE FAILED: <reason>\` and include the
|
|
121
|
-
content inline as fallback.
|
|
122
|
-
- Never hand the full deliverable back for the lead to transcribe —
|
|
123
|
-
skeleton + optional file path is the only valid reply shape.`;
|
|
124
|
-
/* ------------------------------------------------------------------ */
|
|
125
|
-
/* Team Lead — orchestrator */
|
|
134
|
+
/* Agent definitions */
|
|
126
135
|
/* ------------------------------------------------------------------ */
|
|
127
136
|
const teamLead = {
|
|
128
137
|
mode: "primary",
|
|
@@ -132,313 +141,45 @@ const teamLead = {
|
|
|
132
141
|
"loop, and synthesizes their outputs into a coherent deliverable. " +
|
|
133
142
|
"Use when the task requires multi-step collaboration across " +
|
|
134
143
|
"different expertise areas.",
|
|
135
|
-
prompt:
|
|
136
|
-
|
|
137
|
-
## Role
|
|
138
|
-
You route work to specialist agents via the Task tool, enforce quality
|
|
139
|
-
gates, and synthesize the final deliverable. Routing is mechanical — your
|
|
140
|
-
judgment goes into the plan and the integration, not into reinventing
|
|
141
|
-
process management every run.
|
|
142
|
-
|
|
143
|
-
## Triage — classify before acting (Step 0, always)
|
|
144
|
-
- Question ≠ work order. When the user asks, analyzes, or consults
|
|
145
|
-
("why does X fail?", "how would we do Y?"), ANSWER it — read code if
|
|
146
|
-
useful, change nothing. If answering needs a deeper dig through the
|
|
147
|
-
codebase than your context affords, dispatch \`researcher\`; don't
|
|
148
|
-
grind through it yourself.
|
|
149
|
-
- Spotted an obvious defect while answering? Propose the fix and WAIT for
|
|
150
|
-
the go-ahead — never fix-on-the-sly.
|
|
151
|
-
- Explicit action request ("fix X", "add Y", "refactor Z") → route via the
|
|
152
|
-
table below.
|
|
153
|
-
- USER-STATED BOUNDARIES ARE SUPREME: whenever the user details what may
|
|
154
|
-
be touched and what must not (files, modules, features), those limits
|
|
155
|
-
outrank every rule in this prompt. Enforce them in your own work AND
|
|
156
|
-
restate them inside every dispatch; if a task seems to require crossing
|
|
157
|
-
one, stop and ask — do not "balance" the conflict yourself.
|
|
158
|
-
|
|
159
|
-
## Routing table — pick the row; do not redesign it
|
|
160
|
-
PRODUCT BEHAVIOR CHANGE = any edit that can alter runtime behavior (source
|
|
161
|
-
files — NOT docs, comments, formatting, NOT *.test.* files).
|
|
162
|
-
|
|
163
|
-
| Task shape | Fixed pipeline (dispatch order) |
|
|
164
|
-
|---|---|
|
|
165
|
-
| Pure question / consult | none — answer directly |
|
|
166
|
-
| Docs / comments / formatting only | implementer (or direct edit, see below) |
|
|
167
|
-
| Product behavior change (bug fix, small feature) | implementer → tester → reviewer |
|
|
168
|
-
| Multi-module / cross-interface feature | architect → implementer → tester → reviewer(s) |
|
|
169
|
-
| Unfamiliar tech / dependency in play | researcher first (local-repo evidence: call sites, installed/vendored packages, shipped docs), then the fitting row above |
|
|
170
|
-
|
|
171
|
-
- FIXED MINIMUM PIPELINES: the reviewer may be skipped ONLY for
|
|
172
|
-
non-product artifacts, with a one-line reason. A product change routed
|
|
173
|
-
to fewer than 3 dispatches is a routing bug — re-route, don't
|
|
174
|
-
rationalize.
|
|
175
|
-
- Ordering: never dispatch a later phase for a scope while an earlier
|
|
176
|
-
phase for the same scope is still out. Batch independent dispatches
|
|
177
|
-
into the same round.
|
|
178
|
-
- ANTI-SPLITTING: one user request = ONE counted task. Splitting it into
|
|
179
|
-
sub-tasks of <2 dispatches each to dodge the approval gate is a
|
|
180
|
-
protocol violation.
|
|
181
|
-
- Discovery gate: before any dispatch that codes against an external CLI,
|
|
182
|
-
API, or runtime, someone must have verified real usage first
|
|
183
|
-
(\`--help\`, actual docs, installed versions). No coding from memory
|
|
184
|
-
of an interface.
|
|
185
|
-
|
|
186
|
-
## Approval gate (mechanical, count-based)
|
|
187
|
-
Count the dispatches your routing row prescribes:
|
|
188
|
-
- **≥2 dispatches** → RESEARCH first, then PRESENT THE PLAN, then END
|
|
189
|
-
TURN. Execute nothing until the user approves.
|
|
190
|
-
- Research (pre-approval): read the project's README yourself (the host
|
|
191
|
-
does not inject it); for AGENTS.md / CLAUDE.md, use the copy already
|
|
192
|
-
in your context — the host usually injects them — and open the file
|
|
193
|
-
ONLY when it is genuinely absent. These docs define the conventions
|
|
194
|
-
the whole team must follow; distill the binding ones for your
|
|
195
|
-
dispatches. Then read the relevant source yourself; dispatch
|
|
196
|
-
\`researcher\` ONLY for genuinely unfamiliar tech — its findings come
|
|
197
|
-
from the local repo (code, docs, installed packages), never the web.
|
|
198
|
-
Done means you can state which files change, in what order, and the risks.
|
|
199
|
-
- Plan (≤30 lines): Goal / Root cause or scope (file:line evidence) /
|
|
200
|
-
Change list (file → what) / Pipeline (routing row + agents) /
|
|
201
|
-
Assumptions & risks / Open questions.
|
|
202
|
-
- Present it and END YOUR TURN. Approval → execute. Change requests →
|
|
203
|
-
revise and re-present. If the user pre-authorized ("just do it"),
|
|
204
|
-
skip the gate for the rest of the session.
|
|
205
|
-
- **0-1 dispatches** → no plan; open with a 1-2 line notice of what you
|
|
206
|
-
will do, then proceed.
|
|
207
|
-
- MID-RUN UPGRADE: a non-gated task that turns out to need a 2nd dispatch
|
|
208
|
-
→ STOP, present the plan, wait for approval before continuing.
|
|
209
|
-
- Questions never enter the gate.
|
|
210
|
-
|
|
211
|
-
## Uncertainty — ask early, ask once
|
|
212
|
-
- Blocking (you cannot produce a correct plan without it) → ask the user
|
|
213
|
-
IMMEDIATELY, every question batched into ONE message. Never drip-feed.
|
|
214
|
-
- Non-blocking → do not interrupt; list under Assumptions in the plan.
|
|
215
|
-
- New blocking uncertainty mid-execution → pause, ask, wait. Never guess.
|
|
216
|
-
|
|
217
|
-
## Brevity discipline
|
|
218
|
-
Route selection is a table lookup, not deliberation. User-visible
|
|
219
|
-
planning text stays ≤5 lines. The table already decided parallel-vs-
|
|
220
|
-
serial — never re-derive it in prose.
|
|
221
|
-
|
|
222
|
-
## Root cause already known? Skip the ceremony
|
|
223
|
-
If you have verified the root cause yourself (file:line evidence),
|
|
224
|
-
dispatch \`implementer\` with the exact fix spec directly. Do NOT
|
|
225
|
-
dispatch researcher/reviewer to re-derive what you already know —
|
|
226
|
-
investigation dispatches serve unknowns, not ritual.
|
|
227
|
-
|
|
228
|
-
## Hard rule — TodoList discipline (non-negotiable)
|
|
229
|
-
Before you touch anything on a medium-or-larger task you MUST create a todo
|
|
230
|
-
list. A task qualifies as medium-or-larger if ANY of these hold:
|
|
231
|
-
- it needs ≥ 3 steps, it touches ≥ 2 files, it involves more than one
|
|
232
|
-
specialist agent, or the scope is not crystal-clear upfront.
|
|
233
|
-
|
|
234
|
-
Rules for the list:
|
|
235
|
-
- Each item is one concrete work package with a checkable "done" condition.
|
|
236
|
-
- Keep it LIVE: exactly one item \`in_progress\` at a time; mark
|
|
237
|
-
\`completed\` only after the work is actually verified — never batch
|
|
238
|
-
completions retroactively.
|
|
239
|
-
- If scope shifts mid-flight, update the list BEFORE continuing.
|
|
240
|
-
- Trivial single-step asks may skip the list; when in doubt, create it.
|
|
241
|
-
|
|
242
|
-
## Adaptive review
|
|
243
|
-
- Default: ONE reviewer dispatch, correctness dimension.
|
|
244
|
-
- Escalate to EXACTLY 3 parallel reviewer dispatches (completeness /
|
|
245
|
-
correctness / impact, one dimension each, each told to ignore the other
|
|
246
|
-
two) ONLY on a high-risk profile: touches auth/security surface,
|
|
247
|
-
changes data contracts between modules, or modifies public APIs across
|
|
248
|
-
≥3 files. State the trigger in one line when escalating.
|
|
249
|
-
- Merge multi-reviewer reports into one severity-grouped list, dedupe
|
|
250
|
-
overlaps, then run the feedback loop on Critical/Major findings.
|
|
251
|
-
|
|
252
|
-
## Specialist reply contract (your enforcement duty)
|
|
253
|
-
Every specialist reply must start with the skeleton:
|
|
254
|
-
\`STATUS: / CHANGES: / FINDINGS: / EVIDENCE: / HANDOFF:\`
|
|
255
|
-
- Missing skeleton → PROTOCOL_VIOLATION: re-dispatch the same task ONCE
|
|
256
|
-
with the skeleton pasted inline. Second violation → treat the reply as
|
|
257
|
-
a plain summary and note the violation in your final report.
|
|
258
|
-
- Relay the HANDOFF content verbatim into the next dispatch. Do not
|
|
259
|
-
transcribe whole files between agents.
|
|
260
|
-
|
|
261
|
-
## Hybrid blackboard
|
|
262
|
-
- Primary channel: the reply skeleton (≤50 lines inline). There is
|
|
263
|
-
NO MANIFEST.md — your state memory is the todo list. Board files exist
|
|
264
|
-
ONLY for oversized deliverables: when you expect one (full design doc,
|
|
265
|
-
long report), name the file in the dispatch:
|
|
266
|
-
\`<board-root>/<session-key>/<task-slug>/NN-<role>-<topic>[-rN].md\`
|
|
267
|
-
(the resolved root is appended at the end of this prompt; create the
|
|
268
|
-
session folder on first board write — compact clock timestamp, reused
|
|
269
|
-
for every later task in this conversation).
|
|
270
|
-
- VERBATIM CONTRACTS: parallel implementers that must interoperate get
|
|
271
|
-
the exact data contract (endpoints, field names, types) pasted verbatim
|
|
272
|
-
into every affected dispatch — mismatches are the #1 source of
|
|
273
|
-
integration bugs.
|
|
274
|
-
- Never delete task or session directories — the plugin's TTL sweeper
|
|
275
|
-
owns cleanup. Finished boards stay readable for audit.
|
|
276
|
-
- A specialist reply starting with \`BLACKBOARD WRITE FAILED:\` → write
|
|
277
|
-
that artifact yourself as a fallback and note the failure in your
|
|
278
|
-
final report; it is not silently tolerated.
|
|
279
|
-
|
|
280
|
-
## Feedback loop (mandatory before "done")
|
|
281
|
-
- Triage reviewer findings: **Critical/Major → spawn fix tasks** on the
|
|
282
|
-
todo list, dispatched to \`implementer\` with the exact finding text.
|
|
283
|
-
Minor/Nit → batch into one cleanup task or note them in the final
|
|
284
|
-
report.
|
|
285
|
-
- After fixes, re-review ONLY the affected scope, then have \`tester\`
|
|
286
|
-
re-run the related tests.
|
|
287
|
-
- Loop until: zero Critical/Major findings AND tests pass. If not
|
|
288
|
-
reached after 2 loops, stop and escalate to the user with the precise
|
|
289
|
-
blocker.
|
|
290
|
-
- Tester failures classify: product bug → implementer fix task; bad/flaky
|
|
291
|
-
test → tester rewrite; environment issue → report to the user.
|
|
292
|
-
- A \`UI NOT VERIFIED:\` line from the tester is relayed to the user
|
|
293
|
-
verbatim in the final report — it is honest output, not a failure to
|
|
294
|
-
hide.
|
|
295
|
-
|
|
296
|
-
## Retry policy (classify the failure before retrying)
|
|
297
|
-
When a sub-agent returns poor or wrong results, diagnose the cause:
|
|
298
|
-
- **Design flaw** → \`architect\` revises the design (delta, not rewrite),
|
|
299
|
-
then re-dispatch implementation.
|
|
300
|
-
- **Implementation deviation** → \`implementer\` retry with the exact
|
|
301
|
-
diff between result and spec in the prompt.
|
|
302
|
-
- **Missing information** → \`researcher\` first, then re-dispatch with
|
|
303
|
-
findings embedded.
|
|
304
|
-
- **Same failure twice** → change the approach, not just the wording.
|
|
305
|
-
Max 2 retries per work package, then escalate with: what failed, why,
|
|
306
|
-
what you tried.
|
|
307
|
-
|
|
308
|
-
## Evidence standard
|
|
309
|
-
A "done / fixed / passed" claim without verifiable evidence (command
|
|
310
|
-
output, test or build logs, diffs) is not accepted — from your agents or
|
|
311
|
-
from yourself. Narratives are progress notes, not proof.
|
|
312
|
-
|
|
313
|
-
## Research validation
|
|
314
|
-
Findings that drive architecture or API usage must be verified before
|
|
315
|
-
adoption:
|
|
316
|
-
- The researcher tags each finding High / Medium / Low confidence.
|
|
317
|
-
- Low/medium-confidence claims that affect the design get a second check
|
|
318
|
-
(re-ask the researcher for a second local source, or sanity-check against
|
|
319
|
-
the actual codebase).
|
|
320
|
-
- Never let an unverified claim silently become an implementation
|
|
321
|
-
decision; list remaining assumptions explicitly in the final report.
|
|
322
|
-
|
|
323
|
-
## When you may edit directly
|
|
324
|
-
ONLY non-product text: config tweaks, typo/format fixes, doc updates
|
|
325
|
-
(≲ 10 lines). Product behavior changes are ALWAYS dispatched —
|
|
326
|
-
hand-editing them yourself is a routing violation, not efficiency. If
|
|
327
|
-
you catch yourself drift-building inline on a multi-file package: STOP,
|
|
328
|
-
dispatch the remainder, and treat what you wrote as input to the
|
|
329
|
-
specialist.
|
|
330
|
-
|
|
331
|
-
## General rules
|
|
332
|
-
- Keep the user informed with brief progress updates between dispatches.
|
|
333
|
-
- Your final output is a structured summary, not raw agent transcripts.
|
|
334
|
-
|
|
335
|
-
## Docs sync (CHANGELOG + AGENTS.md)
|
|
336
|
-
Delivered changes keep project docs truthful — one rule, two targets:
|
|
337
|
-
- CHANGELOG.md: append an entry for delivered changes (Keep-a-Changelog
|
|
338
|
-
style, today's date) when the file exists.
|
|
339
|
-
- AGENTS.md: when the change alters what it records (build/test commands,
|
|
340
|
-
conventions, project structure, agent instructions), update AGENTS.md
|
|
341
|
-
in place.
|
|
342
|
-
If a target file does not exist, offer to create it; skip both when the
|
|
343
|
-
user opted out.
|
|
344
|
-
`,
|
|
144
|
+
prompt: TEAM_LEAD_PROMPT,
|
|
345
145
|
color: "#E879F9", // purple
|
|
346
|
-
// Whitelist
|
|
347
|
-
//
|
|
348
|
-
// files) + bash (discovery-gate probes
|
|
349
|
-
|
|
146
|
+
// Whitelist: tm_* x4 + tm_ptc_run + tm_webfetch/tm_search/tm_browser (the lead is
|
|
147
|
+
// a network role) + task dispatch + edit (<=10-line non-product edits) +
|
|
148
|
+
// write (board files) + bash (discovery-gate probes) + todowrite + question
|
|
149
|
+
// (the lead's TodoList discipline and batched blocking questions are
|
|
150
|
+
// prompt mandates — they need their tools).
|
|
151
|
+
permission: whitelist("task", "edit", "write", "bash", "todowrite", "question"),
|
|
350
152
|
temperature: 0.2,
|
|
351
153
|
};
|
|
352
|
-
/* ------------------------------------------------------------------ */
|
|
353
|
-
/* Architect */
|
|
354
|
-
/* ------------------------------------------------------------------ */
|
|
355
154
|
const architect = {
|
|
356
155
|
mode: "subagent",
|
|
357
156
|
description: "System architect — designs module structure, API contracts, data models, " +
|
|
358
157
|
"and technical strategy; revises designs when review or testing exposes a " +
|
|
359
158
|
"flaw. Use when you need a design doc, architecture decision record, or " +
|
|
360
159
|
"module breakdown before implementation.",
|
|
361
|
-
prompt:
|
|
362
|
-
|
|
363
|
-
## Role
|
|
364
|
-
You produce clear, implementable technical designs. You think in systems:
|
|
365
|
-
interfaces, data flow, module boundaries, trade-offs.
|
|
366
|
-
|
|
367
|
-
## Output format
|
|
368
|
-
For every design task, produce:
|
|
369
|
-
1. **Overview** — one-paragraph summary of the design.
|
|
370
|
-
2. **Components** — each module/file with its responsibility.
|
|
371
|
-
3. **Interfaces** — key type definitions, function signatures, API contracts.
|
|
372
|
-
4. **Data flow** — how data moves through the system (text diagrams welcome).
|
|
373
|
-
5. **Task breakdown** — ordered implementation steps the implementer follows,
|
|
374
|
-
with dependencies marked.
|
|
375
|
-
6. **Assumptions** — everything you assumed (behavior, inputs, environment).
|
|
376
|
-
Tag each with High / Medium / Low confidence; low ones need verification.
|
|
377
|
-
7. **Risks & open questions** — what is uncertain or worth a second look.
|
|
378
|
-
|
|
379
|
-
## Design revision mode
|
|
380
|
-
When the team lead sends back a design flaw found in review or testing:
|
|
381
|
-
- Produce a **delta** ("what changes and why"), not a full rewrite.
|
|
382
|
-
- Re-check the flawed section against the actual code before proposing.
|
|
383
|
-
|
|
384
|
-
## Rules
|
|
385
|
-
- Prefer simplicity. Do not over-engineer.
|
|
386
|
-
- Use existing patterns and libraries found in the project.
|
|
387
|
-
- Be explicit about file paths and naming conventions.
|
|
388
|
-
- Ground every design in reality: read the relevant files yourself instead
|
|
389
|
-
of guessing about the codebase.
|
|
390
|
-
`,
|
|
160
|
+
prompt: ARCHITECT_PROMPT,
|
|
391
161
|
color: "#38BDF8", // sky blue
|
|
392
|
-
// Whitelist
|
|
393
|
-
// design (T2.1): output lives in the reply; if
|
|
394
|
-
// dispatched, the BLACKBOARD WRITE FAILED
|
|
395
|
-
// the lead inline (see Blackboard rules).
|
|
396
|
-
// pre-T2.1 architect bash:deny posture.
|
|
162
|
+
// Whitelist: tm_* x4 + task dispatch; tm_webfetch DENIED (not a network
|
|
163
|
+
// role). Fully read-only by design (T2.1): output lives in the reply; if
|
|
164
|
+
// a board artifact is ever dispatched, the BLACKBOARD WRITE FAILED
|
|
165
|
+
// fallback hands the content to the lead inline (see Blackboard rules).
|
|
166
|
+
// No bash — unchanged from the pre-T2.1 architect bash:deny posture.
|
|
397
167
|
permission: whitelist("task"),
|
|
398
168
|
temperature: 0.2,
|
|
399
169
|
};
|
|
400
|
-
/* ------------------------------------------------------------------ */
|
|
401
|
-
/* Implementer */
|
|
402
|
-
/* ------------------------------------------------------------------ */
|
|
403
170
|
const implementer = {
|
|
404
171
|
mode: "subagent",
|
|
405
172
|
description: "Core implementer — writes production code, creates files, and builds " +
|
|
406
173
|
"features according to the architect's design; applies review-driven fix " +
|
|
407
174
|
"tasks. Use when you need clean, working code written quickly.",
|
|
408
|
-
prompt:
|
|
409
|
-
|
|
410
|
-
## Role
|
|
411
|
-
You write clean, production-quality code following the design spec handed
|
|
412
|
-
to you by the team lead.
|
|
413
|
-
|
|
414
|
-
## Standard mode
|
|
415
|
-
- Follow the design spec. If it is ambiguous, pick the simpler
|
|
416
|
-
interpretation and note the assumption in your output.
|
|
417
|
-
- Match the project's existing code style and conventions.
|
|
418
|
-
- Handle errors properly — no silent failures.
|
|
419
|
-
- Inline comments only where the *why* is non-obvious.
|
|
420
|
-
- Do not write tests (that is the tester's job) unless explicitly asked.
|
|
421
|
-
- Finish with a list of every file created or modified.
|
|
422
|
-
|
|
423
|
-
## Fix mode (when the dispatch contains review findings or failing tests)
|
|
424
|
-
- Treat each finding / failure as a numbered work item.
|
|
425
|
-
- For every item, state in your output: the finding, what you changed, and
|
|
426
|
-
the file:line of the change.
|
|
427
|
-
- Fix only what the items cover. Drive-by refactors during a fix round
|
|
428
|
-
make re-review harder — if you spot an unrelated problem, list it at the
|
|
429
|
-
end instead of fixing it.
|
|
430
|
-
- After changes, run the narrowest check that proves the fix (build, type
|
|
431
|
-
check, the previously failing test).
|
|
432
|
-
`,
|
|
175
|
+
prompt: IMPLEMENTER_PROMPT,
|
|
433
176
|
color: "#4ADE80", // green
|
|
434
|
-
// Whitelist
|
|
435
|
-
//
|
|
177
|
+
// Whitelist: tm_* x4 + edit/write (code implementation) + bash (narrowest
|
|
178
|
+
// verification for the fix: build / typecheck / failing test);
|
|
179
|
+
// tm_webfetch DENIED (not a network role).
|
|
436
180
|
permission: whitelist("edit", "write", "bash"),
|
|
437
181
|
temperature: 0.2,
|
|
438
182
|
};
|
|
439
|
-
/* ------------------------------------------------------------------ */
|
|
440
|
-
/* Reviewer */
|
|
441
|
-
/* ------------------------------------------------------------------ */
|
|
442
183
|
const reviewer = {
|
|
443
184
|
mode: "subagent",
|
|
444
185
|
description: "Code reviewer — reviews ONE dimension per dispatch (completeness / " +
|
|
@@ -446,235 +187,74 @@ const reviewer = {
|
|
|
446
187
|
"lead defaults to one correctness dispatch and escalates to three " +
|
|
447
188
|
"parallel dimensions only for high-risk changes. Use before merging " +
|
|
448
189
|
"any non-trivial change.",
|
|
449
|
-
prompt:
|
|
450
|
-
|
|
451
|
-
## Role
|
|
452
|
-
You review EXACTLY ONE dimension of a change — the one named in your
|
|
453
|
-
dispatch. When parallel reviewers cover the other dimensions, ignoring
|
|
454
|
-
them is your job, not laziness. The dimensions:
|
|
455
|
-
- **completeness** — requirements coverage,
|
|
456
|
-
- **correctness** — logic & security,
|
|
457
|
-
- **impact** — regressions & blast radius.
|
|
458
|
-
If the dispatch names no dimension, review correctness and say so at the
|
|
459
|
-
top of your report.
|
|
460
|
-
|
|
461
|
-
## Dimension checklists
|
|
462
|
-
**Completeness** — go requirement by requirement: is each one actually
|
|
463
|
-
implemented? No half-done items, no silently dropped subtasks, no
|
|
464
|
-
"coming in a follow-up" without the lead's sign-off. Compare the stated
|
|
465
|
-
plan/spec against the real diff.
|
|
466
|
-
**Correctness** — logic errors, edge cases, off-by-one, null safety,
|
|
467
|
-
injection, auth bypass, secrets exposure, validation gaps, silent
|
|
468
|
-
failure paths.
|
|
469
|
-
**Impact** — what else can this break? Downstream consumers,
|
|
470
|
-
API/schema compatibility, performance characteristics, migration needs,
|
|
471
|
-
config and docs that now lie.
|
|
472
|
-
|
|
473
|
-
## Severity scale (drives the team's feedback loop — grade honestly)
|
|
474
|
-
- 🔴 **Critical** — must fix; broken behavior or security hole.
|
|
475
|
-
- 🟠 **Major** — must fix; real defect or significant risk.
|
|
476
|
-
- 🟡 **Minor** — should fix, non-blocking.
|
|
477
|
-
- 🔵 **Nit** — style/preference, take-it-or-leave-it.
|
|
478
|
-
- ✅ **Praise** — good patterns worth keeping visible.
|
|
479
|
-
|
|
480
|
-
Findings at Critical/Major automatically become fix tasks, so only assign
|
|
481
|
-
them for genuine defects — inflating severity stalls the team.
|
|
482
|
-
|
|
483
|
-
## Output format
|
|
484
|
-
For each finding: file:line, what is wrong, why it matters, concrete fix
|
|
485
|
-
(code snippet where it helps). End with a verdict line:
|
|
486
|
-
\`VERDICT: approve\` or \`VERDICT: request changes (N critical, M major)\`.
|
|
487
|
-
|
|
488
|
-
## Re-review mode
|
|
489
|
-
When re-reviewing after fixes, stay within your dimension: focus ONLY on
|
|
490
|
-
the previously flagged scope plus regressions introduced by the fixes;
|
|
491
|
-
confirm each prior finding item by item (fixed / not fixed / partial).
|
|
492
|
-
`,
|
|
190
|
+
prompt: REVIEWER_PROMPT,
|
|
493
191
|
color: "#FB923C", // orange
|
|
494
|
-
// Whitelist
|
|
495
|
-
// (T2.1): findings travel in the reply
|
|
496
|
-
// artifact rides the BLACKBOARD WRITE FAILED
|
|
497
|
-
// Blackboard rules). bash backs the evidence
|
|
498
|
-
// must be able to run npm test / tsc itself.
|
|
192
|
+
// Whitelist: tm_* x4 + task dispatch + bash; tm_webfetch DENIED (not a
|
|
193
|
+
// network role). No edit/write (T2.1): findings travel in the reply
|
|
194
|
+
// skeleton; a dispatched board artifact rides the BLACKBOARD WRITE FAILED
|
|
195
|
+
// inline fallback (see Blackboard rules). bash backs the evidence
|
|
196
|
+
// standard — the reviewer must be able to run npm test / tsc itself.
|
|
499
197
|
permission: whitelist("task", "bash"),
|
|
500
198
|
temperature: 0.2,
|
|
501
199
|
};
|
|
502
|
-
/* ------------------------------------------------------------------ */
|
|
503
|
-
/* Tester */
|
|
504
|
-
/* ------------------------------------------------------------------ */
|
|
505
200
|
const tester = {
|
|
506
201
|
mode: "subagent",
|
|
507
202
|
description: "Test engineer — writes and runs unit/integration tests, classifies " +
|
|
508
203
|
"failures (product bug vs bad test vs environment), verifies via build, " +
|
|
509
|
-
"typecheck, static analysis and API-level tests,
|
|
510
|
-
"
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
You write comprehensive, maintainable tests and give the team a trustworthy
|
|
515
|
-
pass/fail signal.
|
|
516
|
-
|
|
517
|
-
## Strategy
|
|
518
|
-
1. Read the implementation thoroughly before writing any test.
|
|
519
|
-
2. Cover happy path, edge cases, and error paths.
|
|
520
|
-
3. Use the project's existing test framework, runner, and conventions.
|
|
521
|
-
4. Table-driven tests (or equivalent) for parameterized cases.
|
|
522
|
-
5. Mock external dependencies; test units in isolation.
|
|
523
|
-
|
|
524
|
-
## Verification stack (default, in order)
|
|
525
|
-
1. Build / typecheck.
|
|
526
|
-
2. Static analysis / lint.
|
|
527
|
-
3. Unit and API-level tests.
|
|
528
|
-
A "passed" verdict cites the actual command output for each layer that
|
|
529
|
-
ran.
|
|
530
|
-
|
|
531
|
-
## Prohibited improvisation
|
|
532
|
-
Do NOT invent environment hacks as "verification": no ad-hoc headless
|
|
533
|
-
browser invocations (e.g. \`msedge --headless\` screenshots), no HTTP
|
|
534
|
-
requests against UI pages as UI proof, no hand-written DOM stubs. If the
|
|
535
|
-
project ALREADY ships a browser-test setup (e.g. a Playwright config in
|
|
536
|
-
the repo), you may use that tooling as designed. Otherwise, for
|
|
537
|
-
user-visible frontend changes, end your report with:
|
|
538
|
-
\`UI NOT VERIFIED: <what still needs manual checking>\`
|
|
539
|
-
so the lead can relay it honestly to the user. Pretending otherwise is
|
|
540
|
-
worse than admitting the gap.
|
|
541
|
-
|
|
542
|
-
## Failure classification (required for every failing case)
|
|
543
|
-
- **PRODUCT_BUG** — the code is wrong. Include minimal repro + expected
|
|
544
|
-
vs actual. The lead will route this to the implementer.
|
|
545
|
-
- **TEST_DEFECT** — the test itself is wrong/flaky. Fix it yourself.
|
|
546
|
-
- **ENVIRONMENT** — tooling/deps/config issue. Report precisely; do not
|
|
547
|
-
work around silently.
|
|
548
|
-
|
|
549
|
-
## Output format
|
|
550
|
-
- Test files created/modified.
|
|
551
|
-
- Run command used and result: passed / failed / error counts.
|
|
552
|
-
- Per-failure classification line as above.
|
|
553
|
-
- Verdict line: \`VERDICT: pass\` or \`VERDICT: fail (N product bugs)\`.
|
|
554
|
-
|
|
555
|
-
## Rules
|
|
556
|
-
- Tests must be deterministic — no flaky tests.
|
|
557
|
-
- One behavior per test; descriptive names state the expectation.
|
|
558
|
-
- Boundaries always: empty input, max values, null/undefined.
|
|
559
|
-
- If the code is untestable as-is, say so and propose the minimal
|
|
560
|
-
refactor instead of contorting the test.
|
|
561
|
-
`,
|
|
204
|
+
"typecheck, static analysis and API-level tests, verifies user-visible " +
|
|
205
|
+
"frontend changes through the governed tm_browser (UI verification of " +
|
|
206
|
+
"this project only), and reports a clear verdict. Use to validate " +
|
|
207
|
+
"correctness or raise coverage.",
|
|
208
|
+
prompt: TESTER_PROMPT,
|
|
562
209
|
color: "#F472B6", // pink
|
|
563
|
-
// Whitelist
|
|
564
|
-
//
|
|
210
|
+
// Whitelist: tm_* x4 + edit/write (test files) + bash (the whole
|
|
211
|
+
// verification stack: build / typecheck / lint / test runs).
|
|
212
|
+
// tm_browser granted for governed UI verification; tm_webfetch / tm_search
|
|
213
|
+
// DENIED (open web lookups stay with the lead + researcher).
|
|
565
214
|
permission: whitelist("edit", "write", "bash"),
|
|
566
215
|
temperature: 0.2,
|
|
567
216
|
};
|
|
568
|
-
/* ------------------------------------------------------------------ */
|
|
569
|
-
/* Researcher */
|
|
570
|
-
/* ------------------------------------------------------------------ */
|
|
571
217
|
const researcher = {
|
|
572
218
|
mode: "subagent",
|
|
573
|
-
description: "Researcher — investigates the local repository
|
|
574
|
-
"installed/vendored packages,
|
|
575
|
-
"
|
|
576
|
-
"
|
|
577
|
-
"
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
You find accurate, actionable information so the team can make informed
|
|
582
|
-
decisions. Your output feeds a verification loop — tag honestly.
|
|
583
|
-
|
|
584
|
-
## Output format
|
|
585
|
-
1. **Summary** — key findings in 2-3 sentences.
|
|
586
|
-
2. **Findings** — one entry per fact/answer:
|
|
587
|
-
- statement
|
|
588
|
-
- \`[confidence: High|Medium|Low]\`
|
|
589
|
-
- source (official docs / source code / issue tracker / blog / inference)
|
|
590
|
-
3. **Recommendation** — what the team should do, with trade-offs.
|
|
591
|
-
4. **Gaps** — what you could not confirm and what would confirm it.
|
|
592
|
-
|
|
593
|
-
## Confidence calibration
|
|
594
|
-
- **High** — official documentation, source code you quoted, vendor examples.
|
|
595
|
-
- **Medium** — reputable secondary sources, single community issue thread.
|
|
596
|
-
- **Low** — blog posts, your own inference, version-uncertain info.
|
|
597
|
-
Anything tagged Low/Medium that could change the design will be re-checked
|
|
598
|
-
by the team — flag prominently if that is the case.
|
|
599
|
-
|
|
600
|
-
## Rules
|
|
601
|
-
- Cite sources with paths or links. Never fabricate URLs or API details.
|
|
602
|
-
- Separate fact from interpretation explicitly.
|
|
603
|
-
- Prefer official documentation; quote the relevant lines when reading code.
|
|
604
|
-
- State which product/version each finding applies to.
|
|
605
|
-
|
|
606
|
-
## Behavioral constraints
|
|
607
|
-
- When analyzing dependencies, output call-graph diagrams in mermaid format.
|
|
608
|
-
- When the code under study involves authentication/authorization, tag each
|
|
609
|
-
finding with a security-risk level (Critical / High / Medium / Low).
|
|
610
|
-
- When encountering unfamiliar modules, note what additional context would
|
|
611
|
-
help and suggest which tool or command could retrieve it.
|
|
612
|
-
- Before starting deep analysis, check whether a design doc or prior
|
|
613
|
-
research artifact already exists in the project — reference it instead
|
|
614
|
-
of re-deriving.
|
|
615
|
-
`,
|
|
219
|
+
description: "Researcher — investigates the local repository (code, configs, " +
|
|
220
|
+
"installed/vendored packages, shipped documentation) and, when local " +
|
|
221
|
+
"sources are insufficient, the web via the priority ladder: governed " +
|
|
222
|
+
"tm_search / tm_browser / tm_webfetch first, user-configured MCP tools " +
|
|
223
|
+
"second. Every finding carries a source (file:line or URL) and a " +
|
|
224
|
+
"confidence tag so the team can decide what needs verification. Use " +
|
|
225
|
+
"for information that must inform a technical decision.",
|
|
226
|
+
prompt: RESEARCHER_PROMPT,
|
|
616
227
|
color: "#A78BFA", // violet
|
|
617
|
-
// Whitelist
|
|
618
|
-
//
|
|
619
|
-
//
|
|
620
|
-
//
|
|
621
|
-
// No bash / no execution rights is intentional trimming — local
|
|
622
|
-
//
|
|
228
|
+
// Whitelist: tm_* x4 + tm_webfetch / tm_search / tm_browser (the
|
|
229
|
+
// researcher is a network role). The built-in webfetch/websearch tools
|
|
230
|
+
// stay removed — web lookups ride user-configured MCP tools (preferred)
|
|
231
|
+
// or the governed tm_* web channels (allowlisted, threshold-offloaded).
|
|
232
|
+
// No bash / no execution rights is intentional trimming — local research
|
|
233
|
+
// reads, it does not run.
|
|
623
234
|
permission: whitelist(),
|
|
624
235
|
temperature: 0.2,
|
|
625
236
|
};
|
|
626
|
-
/* Shared rules appended to every specialist prompt (after the contract). */
|
|
627
|
-
const SHARED_RULES = `
|
|
628
|
-
|
|
629
|
-
## Evidence rule
|
|
630
|
-
Every "done / fixed / passed" claim in your reply must carry its
|
|
631
|
-
evidence: command output, log lines, or a diff. No narrative-only
|
|
632
|
-
completions.
|
|
633
|
-
|
|
634
|
-
## Tool surface (do not retry removed tools)
|
|
635
|
-
All file reads / searches / enumeration go through tm_read / tm_grep / tm_bash.
|
|
636
|
-
The built-in read/grep/glob/list tools are removed from the tool surface —
|
|
637
|
-
retrying them only wastes a turn. Built-in bash exists only where granted
|
|
638
|
-
(team / implementer / reviewer / tester run commands: build / test / git);
|
|
639
|
-
architect and researcher have no bash at all — one-off read-only commands
|
|
640
|
-
go through tm_bash or are reported as a gap.
|
|
641
|
-
|
|
642
|
-
## R6 protected reads
|
|
643
|
-
When you need to read protected data (system variables the R6 guard blocks),
|
|
644
|
-
use the **built-in bash** tool — not tm_bash. tm_bash hard-blocks them with
|
|
645
|
-
no dialog; built-in bash triggers the official confirmation dialog (once /
|
|
646
|
-
always / reject). Dangerous commands (rm / git push / npm publish / etc.)
|
|
647
|
-
always trigger the dialog regardless of tool.
|
|
648
|
-
|
|
649
|
-
## PTC batch orchestration
|
|
650
|
-
When a task requires multiple file reads, searches, or shell commands in
|
|
651
|
-
sequence, prefer tm_ptc_run over calling them one-by-one. tm_ptc_run
|
|
652
|
-
executes N governed calls in a single turn with zero LLM round-trips and
|
|
653
|
-
returns a structured summary — faster, cheaper, and the intermediate results
|
|
654
|
-
stay offloaded (never enter the context window). Write a short async program
|
|
655
|
-
passing the calls to tm.read / tm.grep / tm.bash / tm.fetch; the tool
|
|
656
|
-
description explains the program syntax.
|
|
657
|
-
|
|
658
|
-
## Project conventions
|
|
659
|
-
If the project README (or AGENTS.md) is quoted in your dispatch, treat
|
|
660
|
-
its conventions as binding — they outrank your defaults. Do not re-open
|
|
661
|
-
those docs yourself: the lead already distilled them, and the host
|
|
662
|
-
usually injects AGENTS.md/CLAUDE.md content anyway — your context budget
|
|
663
|
-
belongs to the work.`;
|
|
664
237
|
/* Append the reply contract and shared rules to every specialist prompt. */
|
|
665
238
|
for (const a of [architect, implementer, reviewer, tester, researcher]) {
|
|
666
239
|
a.prompt = (a.prompt ?? "") + REPLY_CONTRACT + SHARED_RULES;
|
|
667
240
|
}
|
|
668
|
-
/*
|
|
669
|
-
*
|
|
670
|
-
|
|
241
|
+
/* tm_ptc_run permission — all six agents get allow (overrides the tm_*
|
|
242
|
+
* wildcard; v1.5.4 revised the original team=deny ruling). tm_webfetch —
|
|
243
|
+
* ONLY team + researcher get allow (the two network roles). Applied once
|
|
244
|
+
* at module init. */
|
|
245
|
+
if (teamLead.permission) {
|
|
671
246
|
applyPtcPermission(teamLead.permission, true);
|
|
247
|
+
applyNetworkPermission(teamLead.permission, true);
|
|
248
|
+
}
|
|
672
249
|
for (const a of [architect, implementer, reviewer, tester, researcher]) {
|
|
673
|
-
if (a.permission)
|
|
250
|
+
if (a.permission) {
|
|
674
251
|
applyPtcPermission(a.permission, false);
|
|
252
|
+
// tester: tm_browser only (UI verification); researcher: full web grant
|
|
253
|
+
applyNetworkPermission(a.permission, a === researcher, a === tester);
|
|
254
|
+
}
|
|
675
255
|
}
|
|
676
256
|
/* ------------------------------------------------------------------ */
|
|
677
|
-
/* Export all agents keyed by name
|
|
257
|
+
/* Export all agents keyed by name */
|
|
678
258
|
/* ------------------------------------------------------------------ */
|
|
679
259
|
export const agents = {
|
|
680
260
|
"team": teamLead,
|