Skip to content
Open
4 changes: 4 additions & 0 deletions docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,10 @@ flowchart TB
([ADR 0158](ADRs/0158-overlays-may-grant-runtime-fetch-within-the-config-allowlist.md)).
Decided, not yet implemented.
- Plugins are runtime-scoped harness resources: a harness declares `plugins:` as one list of directories in its own repository (same trust and fetch path as skills), and each entry's format decides which runtime loads it — a `plugin.json` bundle is Claude Code's, a directory pi's `-e` loader resolves is uploaded and loaded after a tree-hash preflight computed from the host copy. Each runtime names and skips the entries in the other format, so the list survives a runtime switch. Because `--no-extensions` plus explicit `-e` closes the set of code that can register tools, no per-tool declaration is needed ([ADR 0094](ADRs/0094-pi-extensions-are-harness-resources.md)).
- Pi agents select native extension tools by exact registered name from vetted
harness extensions. Missing or ambiguous selections fail before inference;
empty selections exclude all extension tools. Child runs retain the parent's
permission intersection. See [Pi tool selection](runtimes/pi.md#extension-tools-and-tools).
- The runner-owned native Codex child policy covers collaboration V1 and V2.
Bootstrap requires the `Agent` tool, harness security and a direct-route
parent selecting V1 or V2 in the bundled model catalog (absent means V1);
Expand Down
7 changes: 7 additions & 0 deletions docs/cli/run.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,13 @@ See [Harness Field Reference § `input_source`](../reference/harness-reference.m

The runtime for a run is resolved once, in this order: `--runtime` flag, `FULLSEND_RUNTIME`, `runtime:` on the agent's `agents:` entry in `config.yaml` / `.fullsend/config.yaml`, the repo-wide `runtime:` there, then the built-in `claude`. The same order applies to the model (`--model`, `FULLSEND_MODEL`, `model:` on the agent's `agents:` entry, harness `model:`, agent frontmatter; `FULLSEND_PI_MODEL` on pi and `FULLSEND_CODEX_MODEL` on codex are lower-precedence aliases, each read only when that runtime is the one selected) and to effort (`--effort`, `FULLSEND_EFFORT`, `effort:` on the agent's `agents:` entry, harness `effort:`). `<agent>` is the name given to `fullsend run` (`triage`, `code`, …); see [Runtimes — per-agent settings](../runtimes.md#per-agent-runtime-model-and-effort). `FULLSEND_FALLBACK_MODELS=a,b` becomes Claude Code's `--fallback-model`; pi uses it for aliased models on the top-level run when Vertex does not serve the model (two specific 404/403 messages, same provider only; sub-agent children get none); codex ignores it with a warning.

With `--runtime pi`, native extension tools in agent `tools:` frontmatter must
resolve to exact names from vetted harness extensions before inference. Unknown
names are no longer silently dropped. An explicit empty list excludes built-in
and extension tools; the runner may still add `read` for skills. See
[Pi tool selection and migration](../runtimes/pi.md#extension-tools-and-tools).


A `model` or `effort` set in the `harness:` block of the agent's `agents:`
entry is a harness value. It ranks where harness `model:` and `effort:` do in
the order above, and `override_source` reports the model as `harness`. Setting
Expand Down
81 changes: 52 additions & 29 deletions docs/contributing/runtime-implementation.md

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions docs/guides/user/bring-your-own-agent.md
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,14 @@ The agent definition is Markdown with YAML frontmatter:
| `skills` | [Skill](../../glossary.md#skill) names to load, as uploaded under `skills/`: a skill's declared `SKILL.md` `name:`, or its directory basename when none is declared |
| `disallowedTools` | Bash patterns the agent is forbidden from running, e.g. `Bash(git push *), Bash(gh issue edit *)` |

On pi, select a vetted harness extension's native tool with its exact registered
name, for example `tools: [inspect_record]`. Missing or ambiguous tools fail
before inference. An explicit `tools: []` exposes no tools unless the runner
adds `read` for skills. When migrating, remove previously ignored Claude-only
names or provide the extension that implements them. See
[Pi extension tool selection](../../runtimes/pi.md#extension-tools-and-tools).


When writing the agent body:
- **The agent writes JSON, scripts do actions.** The agent's only output is a
structured JSON file matching the [output schema](#output-schema). All side
Expand Down
74 changes: 55 additions & 19 deletions docs/runtimes/pi.md
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ What a local pi run needs, beyond the guide:
| `MultiEdit` | `edit` | pi has one edit tool |
| `Glob` | `find` | `find` takes a **glob pattern**, not a bare directory. A model that means "list this directory" and sends `{"path": "docs/"}` gets a validation error and has to retry |
| `LS` | `ls` | The tool to grant for directory listing. Claude Code itself dropped `LS`, so the entry does nothing on that runtime, and codex lists through the shell — it is pi where it counts |
| anything else | — | A persona naming a Claude-only tool (`WebFetch`, `TodoWrite`, ...) fails rather than silently losing it; see [Sub-agents troubleshooting](#troubleshooting-sub-agents) |
| Exact native extension name | unchanged | Must resolve to one tool supplied by a vetted harness extension before inference; for example `inspect_record` |

So an agent that browses the tree wants `Glob` **and** `LS`: `Glob` to match a pattern, `LS` to see
what is in a directory. With `Glob` alone the model tends to reach for a listing it cannot make.
Expand Down Expand Up @@ -383,18 +383,47 @@ runtime, an interpreter, a proxy or a credential are refused; the deny-list is i

### Extension tools and `tools:`

An agent that declares `tools:` keeps its strict `--tools` allowlist and pi hides extension tools
under it — that is what a declared `tools:` means. An agent whose `tools:` maps to nothing pi
provides gets `--no-builtin-tools`, and its extensions still load: `-e` is independent of `--tools`.
An agent without `tools:` gets pi's default set plus whatever its extensions register.
An agent that declares `tools:` gets an explicit selection across built-in and
Comment thread
eshulman2 marked this conversation as resolved.
Resolved
extension tools. Select a native tool by its exact registered name, for example
`tools: [inspect_record]`. Native names begin with an ASCII letter or underscore
and contain only ASCII letters, digits, underscores and hyphens; wildcards are
reserved for supported MCP selectors. The tool must come from the declared,
vetted harness extensions. Missing, hidden, ambiguous or non-vetted native
selections fail before inference. Selecting one tool exposes neither its
siblings nor built-in shell or editing tools.

An explicit `tools: []` exposes no built-in or extension tools. An agent without
`tools:` retains pi's default tools plus its extensions. Skills still require
`read`, which the runner adds when the harness includes skills or the agent
selects `Skill`.

Exact extension names in agent `tools:` are Pi-specific. Use a separate agent
definition for runtimes that do not load the extension. Adding `Bash` to a
shared declaration also grants the Pi agent access to its shell tool. Persona
`tools:` supports mapped tools and MCP selectors. Exact extension names in
persona declarations prevent registration. Setup fails if the repo config
references that persona.

An explicit agent tool list or a child tool selector requires `Bootstrap` and
`Run` in the same process so the selector can verify the manifest digest. This
includes default-mode parents with sub-agent dispatch enabled. See the [tool selection requirements](https://github.com/fullsend-ai/fullsend/issues/9254).

**Migration:** previously ignored unknown names now request exact native tools.
Pi treats an unmapped exact name such as `WebFetch` as an extension request
and checks the registry for a matching tool from a vetted extension.
Remove stale Claude-only names such as `WebFetch` unless a vetted extension
registers them. Correct typos and declare the extension that supplies each
requested tool. Invalid native patterns now fail setup instead of being dropped.
Tool selection does not grant shell, network or publication authority; sandbox
policy and hooks continue to apply, using each native tool's unchanged name.

MCP tool names such as `mcp__docs__search` and patterns such as
`mcp__docs__*` pass through the pi tool mapping. A bare server selector
`mcp__docs` expands to `mcp__docs__*` in both parent and persona lists; exact
tool names and existing patterns are unchanged. Selectors must start with
`mcp__` and contain only ASCII letters, digits, underscores, hyphens and `*`,
with a nonempty suffix. Invalid selectors (including commas and whitespace)
are reported as unsupported rather than passed to pi's comma-delimited CLI.
fail setup rather than being passed to pi's comma-delimited CLI.
Names must match what the declared harness extension registers. Fullsend does
not normalize server or tool names: Claude-style hyphenated names are preserved.
Pi's built-in MCP naming rules do not apply automatically, because fullsend
Expand All @@ -418,28 +447,28 @@ is `codemode` or `deferred`. Pi permits nested calls to those tools even when
inactive. Inactive direct tools (including `defaultActive: false` direct tools)
and other inactive registrations are not added. Explicit parent selections
and persona patterns still restrict this union; registration alone is not a grant.
The child registration allowlist retains the callable union, but a child-only
loadout guard restores the inherited active subset before the first model
request and again at agent/turn boundaries after MCP startup handlers. Inherited
names not yet registered may remain pending; any active name outside the
inherited subset terminates the child, as do parse, validation or setter
failures. A thrown extension error alone would let pi continue. Inactive
codemode/deferred tools remain nested-call permissions rather than becoming
directly available to the model. The guard script is digest-checked before
dispatch. An empty child allowlist hides both built-in and extension tools. Explicit
The child registration allowlist retains the callable union. The dispatcher
loads `-e /sandbox/pi-config/fullsend-tools.js --fullsend-selected-tools` with
the resolved callable and active tool lists. The selector verifies the manifest
digest, restores the active subset at session start, and reapplies it at agent
and turn boundaries. An unregistered non-MCP selection or invalid activation
exits 99 before inference. MCP tools may register late. Inactive codemode and
deferred tools keep their nested-call permissions without becoming directly
available to the model. The dispatcher checks the selector digest before launch. An empty child allowlist hides both built-in and extension tools. Explicit
nonempty parent and child selections without `mcp__` entries also get
`--exclude-tools`: `mcp__*` plus each unselected MCP resource tool
(`list_mcp_resources`, `list_mcp_resource_templates`, `read_mcp_resource`).
Selected resource names/patterns remain available. Pi otherwise retains these
registrations, which can leave tools callable through codemode or deferred
exposure even when inactive. Parents without `tools:` keep their defaults.
Parents whose tools map to an empty list still use `--no-builtin-tools`, but
cannot dispatch children: they have no `Agent` or `Task` tool.
Parents whose tools map to an empty list use `--tools ''`, which filters out
both built-in and extension tools, including `Agent` and `Task`.
Direct-exposure MCP tools can reach the model through these tool lists.
`codemode` and `deferred` tools need a separately reachable executor for nested
calls. Fullsend uses `--no-extensions`, so pi's built-in MCP, codemode, and
search extensions do not load automatically. The tool mapper does not accept
`codemode` or `tool_search` in explicit frontmatter. The nested-call fixtures
search extensions do not load automatically. Explicit frontmatter uses Claude spellings such as
`Read` and `Bash` for mapped built-ins. The reserved Pi names `powershell`,
`codemode`, and `tool_search` are rejected during Bootstrap. The nested-call fixtures
exercise pi's execution API; they are not examples of supported frontmatter.

Parent and child resource exclusions originate from `mcp-resource-tools.json`.
Expand Down Expand Up @@ -926,6 +955,13 @@ pi; the plan block's `Runtime:` line and stderr's `runtime: selected ...` show w
**`--debug "..."` fails with `accepts 1 arg(s)`.** `--debug` takes an optional value: write
`--debug='*'` (with `=`).

**`pi strict tool selection failed or selector changed` (exit 99).** Read the
`[fullsend-tools]` error in the Pi output for the invalid selection or manifest
failure. The shell guard emits `fullsend: pi tool selector missing or modified; refusing to run`
if the selector file fails its digest check. Check that selected non-MCP tools
are registered by the runtime or a vetted extension, and rerun Bootstrap if
the selector file is missing or changed.

**`fullsend: pi edit-repair extension missing or modified; refusing to run` (exit 93).** The
runner-owned `/sandbox/pi-config/fullsend-edit-repair.js` is not the copy bootstrap wrote. Treat it
as tampering, like the hook adapter's guard: something inside the sandbox rewrote runner config.
Expand Down
1 change: 1 addition & 0 deletions internal/pluginformat/pi.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ var PiReservedExtensionNames = []string{"fullsend-hooks", "fullsend-agent", "ful
// such option (fullsend's own CLI does), so an extension may register it.
var piReservedOptions = map[string]bool{
"--fullsend-child-active-tools": true,
"--fullsend-selected-tools": true,
"--extension": true, "--no-extensions": true, "--approve": true, "--no-approve": true,
"--tools": true, "--no-tools": true, "--no-builtin-tools": true, "--exclude-tools": true,
"--model": true, "--models": true, "--provider": true, "--thinking": true, "--api-key": true,
Expand Down
2 changes: 2 additions & 0 deletions internal/pluginformat/pi_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,8 @@ func TestPiArgsProblem(t *testing.T) {
{"value starts with at", []string{"--a=@/etc/passwd"}, `args[0] "--a=@/etc/passwd": the value after "=" must not start with '-' or '@'`},
{"child loadout separate", []string{"--fullsend-child-active-tools", "[]"}, `args[0] "--fullsend-child-active-tools" is one of pi's own options`},
{"child loadout equals", []string{"--fullsend-child-active-tools=[]"}, `args[0] "--fullsend-child-active-tools" is one of pi's own options`},
{"child selector separate", []string{"--fullsend-selected-tools", "{}"}, `args[0] "--fullsend-selected-tools" is one of pi's own options`},
{"child selector equals", []string{"--fullsend-selected-tools={}"}, `args[0] "--fullsend-selected-tools" is one of pi's own options`},
{"pi use-theme", []string{"--use-theme", "dark"}, `args[0] "--use-theme" is one of pi's own options`},
{"pi tui-mode", []string{"--tui-mode=fullscreen"}, `args[0] "--tui-mode" is one of pi's own options`},
}
Expand Down
3 changes: 2 additions & 1 deletion internal/runtime/openai_seeder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ func TestOpenAIChildren(t *testing.T) {
// their model must not create a provider.
unregistrable := t.TempDir()
writePersonaFile(t, unregistrable, "bashy", "---\nname: bashy\nmodel: openai/gpt-5.6-luna\ntools: Bash(git)\n---\nRun git.\n")
writePersonaFile(t, unregistrable, "webby", "---\nname: webby\nmodel: openai/gpt-5.6-luna\ntools: WebSearch\n---\nSearch.\n")
writePersonaFile(t, unregistrable, "webby", "---\nname: webby\nmodel: openai/gpt-5.6-luna\ntools: WebSearch*\n---\nSearch.\n")
Comment thread
eshulman2 marked this conversation as resolved.
Resolved
writePersonaFile(t, unregistrable, "native", "---\nname: native\nmodel: openai/gpt-5.6-luna\ntools: WebSearch\n---\nSearch.\n")
writePersonaFile(t, unregistrable, "empty", "---\nname: empty\nmodel: openai/gpt-5.6-luna\ntools: []\n---\nNothing.\n")
writePersonaFile(t, unregistrable, "multiline", "---\nname: multiline\nmodel: |\n openai/gpt-5\n ::warning::injected\n---\nInject.\n")
writePersonaFile(t, unregistrable, "dispatcher", "---\nname: dispatcher\nmodel: openai/gpt-5.6-luna\ntools: Agent, Task\n---\nDispatch.\n")
Expand Down
45 changes: 40 additions & 5 deletions internal/runtime/pi_agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,9 @@ func parseClaudeToolSpecs(specs []string) (tools, bashAllowlist []string) {
// read, bash, edit, write, grep, find, ls — every non-Windows built-in; pi
// also has powershell — all activated via settings.json defaultTools, since
// pi alone starts with only the first four). Claude tools without a pi
// counterpart are reported as unsupported; Skill maps to no tool (pi's
// skills are prompt-driven), and Bootstrap adds read for it, since pi only
// emits the skills section of the system prompt when read is active.
// counterpart resolve as exact vetted extension tool names. Skill maps to
// no tool (pi's skills are prompt-driven), and Bootstrap adds read for it:
// pi emits the skills section of the system prompt only when read is active.
var piToolForClaude = map[string]string{
"Bash": "bash",
"Read": "read",
Expand Down Expand Up @@ -311,8 +311,11 @@ func piToolsFor(claudeTools []string) (tools, unsupported []string) {
}
pt, ok := piToolForClaude[ct]
if !ok {
unsupported = append(unsupported, ct)
continue
if !piNativeToolName(ct) {
unsupported = append(unsupported, ct)
continue
}
pt = ct
Comment thread
qodo-code-review[bot] marked this conversation as resolved.
Resolved
}
if !seen[pt] {
seen[pt] = true
Expand All @@ -321,3 +324,35 @@ func piToolsFor(claudeTools []string) (tools, unsupported []string) {
}
return tools, unsupported
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LOW (architect): The native versus MCP classification now lives in two places: this regex plus piMCPResourcePattern in Go, and mcpSelector in fullsend-tools.js (startsWith('mcp__') or /^(list|read)_mcp_/). The JS predicate accepts any list_mcp_* and mcp__ with an empty suffix; Go checks the closed resource list. Bootstrap fails closed early, so the divergence is masked today. Would a shared fixture or cross-check keep the two selectors from drifting when the syntax evolves?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

b3834d667 adds Go-side rejection coverage for bare mcp__ and an unknown list_mcp_ name. The proposed shared Go/JS fixture is still open.


// Exact native names cannot contain wildcards or CLI list separators.
var piExactNativeTool = regexp.MustCompile(`^[A-Za-z_][A-Za-z0-9_-]*$`)

func piNativeToolsFor(specs []string) []string {
var out []string
for _, name := range specs {
if _, builtin := piToolForClaude[name]; builtin || name == "Skill" || name == piAgentToolName || name == piAgentToolAlias || name == "ListMcpResourcesTool" || name == "ReadMcpResourceTool" || piMCPSelectorPattern.MatchString(name) || piMCPResourcePattern(name) {
continue
}
if piNativeToolName(name) && !hasTool(out, name) {
out = append(out, name)
}
}
return out
}

func piReservedUnmappedToolName(name string) bool {
switch name {
case "powershell", "codemode", "tool_search":
return true
default:
return false
}
}

func piNativeToolName(name string) bool {
Comment thread
eshulman2 marked this conversation as resolved.
Resolved
if _, builtin := claudeToolForPi[name]; builtin || piReservedUnmappedToolName(name) {
return false
}
return piExactNativeTool.MatchString(name) && !strings.HasPrefix(name, "mcp__") && !strings.HasPrefix(name, "list_mcp_") && !strings.HasPrefix(name, "read_mcp_")
}
4 changes: 2 additions & 2 deletions internal/runtime/pi_agent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ func TestPiToolsFor(t *testing.T) {
assert.Nil(t, unsupported)

tools, unsupported = piToolsFor([]string{"Read", "Edit", "MultiEdit", "Glob", "WebFetch", "Task", "LS"})
assert.Equal(t, []string{"read", "edit", "find", "Agent", "Task", "ls"}, tools, "Task is the legacy alias of Agent; both pi tool names are activated, in place")
assert.Equal(t, []string{"WebFetch"}, unsupported)
assert.Equal(t, []string{"read", "edit", "find", "WebFetch", "Agent", "Task", "ls"}, tools, "Task is the legacy alias of Agent; both pi tool names are activated, in place")
assert.Empty(t, unsupported)

tools, unsupported = piToolsFor([]string{"Agent", "Task", "Bash"})
assert.Equal(t, []string{"Agent", "Task", "bash"}, tools, "Agent and Task activate the same pair once")
Expand Down
Loading
Loading