Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions extensions/subagents/src/agent-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ export const BUILT_IN_AGENT_TYPES: readonly AgentType[] = [
name: "explorer",
planningCompatible: true,
description:
"Read-only codebase exploration. Usually use moderate reasoning, increasing it for harder tasks.",
body: "Explore the codebase read-only. Trace the real flow, inspect related callers, and report concise evidence with file paths and line references.",
"Codebase exploration. Usually use moderate reasoning, increasing it for harder tasks.",
body: "Explore the codebase. Trace the real flow, inspect related callers, and report concise evidence with file paths and line references.",
source: "built-in:explorer",
},
{
Expand All @@ -140,16 +140,16 @@ export const BUILT_IN_AGENT_TYPES: readonly AgentType[] = [
name: "reviewer",
planningCompatible: true,
description:
"Read-only review for correctness, safety, and regressions. Usually use high reasoning, adjusted for task difficulty.",
body: "Review the requested code or change read-only. Identify concrete correctness, security, and regression risks with evidence; do not modify files.",
"Review for correctness, safety, and regressions. Usually use high reasoning, adjusted for task difficulty.",
body: "Review the requested code or change. Identify concrete correctness, security, and regression risks with evidence.",
source: "built-in:reviewer",
},
{
name: "advisor",
planningCompatible: true,
description:
"Deep read-only analysis and technical advice. Usually use high reasoning, adjusted for task difficulty.",
body: "Analyze the problem deeply without modifying files. Explain the relevant tradeoffs, risks, and recommended next step using repository evidence.",
"Deep technical analysis and advice. Usually use high reasoning, adjusted for task difficulty.",
body: "Analyze the problem deeply. Explain the relevant tradeoffs, risks, and recommended next step using repository evidence.",
source: "built-in:advisor",
},
];
Expand Down
8 changes: 4 additions & 4 deletions skills/subagents/REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,15 @@ file with the same name.

| Role | Tools | Relative effort guidance | Purpose |
| ------------- | ------------------------------------------------------------------- | ------------------------ | ------------------------------------------------------ |
| `explorer` | Active parent child-eligible tools | Moderate | Read-only codebase tracing; increase for harder tasks. |
| `explorer` | Active parent child-eligible tools | Moderate | Codebase tracing; increase for harder tasks. |
| `implementer` | Active parent child-eligible tools | Medium-high | Focused implementation; adjust for scope and risk. |
| `reviewer` | Active parent child-eligible tools | High | Read-only correctness, safety, and regression review. |
| `advisor` | Active parent child-eligible tools | High | Deep read-only analysis and technical advice. |
| `reviewer` | Active parent child-eligible tools | High | Correctness, safety, and regression review. |
| `advisor` | Active parent child-eligible tools | High | Deep technical analysis and advice. |

These are relative selection hints, not fixed Pi thinking levels. Built-ins set
no model or reasoning-effort default. An explicit user requirement takes
priority; otherwise the parent model chooses from levels supported by the
resolved child model according to the role and task difficulty. Custom role allowlists intersect with active parent tools, Plan Mode, and the child denylist. Built-in read-only task guidance is a role instruction, not a filesystem sandbox. Existing custom role files are never widened automatically.
resolved child model according to the role and task difficulty. Custom role allowlists intersect with active parent tools, Plan Mode, and the child denylist. Built-in role names guide task selection; explicit tool lists and Plan Mode create the applicable child-tool boundary. Existing custom role files are never widened automatically.

## Discovery

Expand Down
50 changes: 50 additions & 0 deletions tests/extensions/subagents/prompt.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,13 @@ import {
import {
AGENT_TYPE_LIMITS,
BUILT_IN_AGENT_TYPES,
READ_ONLY_AGENT_TOOLS,
type AgentType,
} from "../../../extensions/subagents/src/agent-types.ts";
import {
effectiveChildToolAllowlist,
inheritedChildToolAllowlist,
} from "../../../extensions/shared/child-session.ts";

function spawnSurfaceBytes(agentTypes: readonly AgentType[]) {
const surface = createSubagentSpawnToolSurface(agentTypes);
Expand Down Expand Up @@ -105,6 +110,51 @@ test("reasoning guidance prioritizes the user and task difficulty without fixing
);
});

test("investigator roles describe the same inherited capability that spawn reports", () => {
const parentTools = ["read", "bash", "edit", "write", "rg", "subagent_spawn"];
const expectedTools = ["read", "bash", "edit", "write", "rg"];

for (const name of ["explorer", "reviewer", "advisor"]) {
const role = BUILT_IN_AGENT_TYPES.find(
(candidate) => candidate.name === name,
);
assert.ok(role);
assert.equal(role.tools, undefined);
assert.doesNotMatch(role.body ?? "", /read-only|do not modify/i, name);

// Inspect each public roster entry independently: a later role's label
// must not satisfy this role's assertion.
const description = buildAgentTypeParameterDescription([role]);
assert.match(description, /\[inherited-tools\]/);
assert.doesNotMatch(description, /read-only/i, name);

const inherited = inheritedChildToolAllowlist(parentTools, role.tools);
assert.deepEqual(inherited, expectedTools);
assert.deepEqual(effectiveChildToolAllowlist(parentTools), expectedTools);
const result = buildSubagentSpawnResult({
id: "sa-1",
title: name,
harness: "pi",
modelLabel: "fixture",
cwd: "/repo",
agentTypeName: name,
tools: inherited,
});
assert.match(result, /It can only use: read, bash, edit, write, rg\./);
assert.doesNotMatch(result, /subagent_spawn/);
}

const restricted = buildAgentTypeParameterDescription([
{
name: "bounded-investigator",
description: "Investigation with a declared read-only boundary.",
tools: READ_ONLY_AGENT_TOOLS,
source: "test",
},
]);
assert.match(restricted, /bounded-investigator[^\n]*\[read-only\]/);
});

test("an explicit user-selected reasoning level remains available", () => {
const schema =
createSubagentSpawnToolSurface(BUILT_IN_AGENT_TYPES).parameters;
Expand Down
Loading