diff --git a/docs/ADRs/0165-recover-work-through-repository-owned-operation-journals.md b/docs/ADRs/0165-recover-work-through-repository-owned-operation-journals.md new file mode 100644 index 0000000000..d29c3e4161 --- /dev/null +++ b/docs/ADRs/0165-recover-work-through-repository-owned-operation-journals.md @@ -0,0 +1,102 @@ +--- +title: "165. Recover work through repository-owned operation journals" +status: Accepted +relates_to: + - durable-work-recovery + - agent-architecture + - agent-infrastructure +topics: + - coordination + - recovery +--- + +# 165. Recover work through repository-owned operation journals + +Date: 2026-11-10 + +## Status + +Accepted + +## Context + +Per-subject serialization ([ADR 0106](0106-serialize-agent-runs-and-coalesce-subsequent-events.md)) +and occurrence-aware poll state +([ADR 0132](0132-occurrence-aware-shared-poller-state.md)) reduce duplicate +dispatch. They do not reserve an operation across scheduling, worker failure +and external publication. Runtime workflow packaging in +[#8225](https://github.com/fullsend-ai/fullsend/pull/8225) addresses another +boundary: delivering a sequence to an agent runtime. + +[Durable work recovery](../problems/durable-work-recovery.md) describes the +failure cases. This ADR aims to keep admitted work recoverable across hosts +without making a model or a central daemon the coordination authority. + +## Options + +Integration-owned databases offer flexibility but repeat the same recovery +controls. A mandatory workflow service adds an operated dependency. A +repository-owned journal reuses forge state and existing schedulers, at the +cost of conditional writes and explicit reconciliation. + +## Decision + +Fullsend adopts repository-owned operation journals to recover work across +dispatch, execution and publication. + +The trusted host records work before dispatch in repository-scoped forge +storage with integrity checks and compare-and-swap updates. An admitted plan +uses the execution boundary in +[ADR 0167](0167-execute-authorized-multi-target-plans.md) for target dispatch +and collection. The journal retains stable operation identities and persistent +work bounds. Attempts retain their own identity, source/input revisions and +scheduler/run identifiers. Scheduling acceptance, worker completion and each +publication effect have separate receipts. Loss of an acknowledgement leaves +recoverable pending work rather than advancing a completion checkpoint. + +Short-lived reconcilers use leases and monotonically increasing ownership +generations. Every result acceptance, state transition and publication +admission checks the current generation and plan. A timed-out or superseded +worker cannot authorize a new effect. A publication admitted before ownership +loss remains an in-flight effect to reconcile; expiry cannot revoke a request +already accepted by an external service. Remote writes remain in trusted host +adapters, outside worker sandboxes. + +Publication adapters persist intent before writing, use a stable external +operation marker, and reconcile ambiguous outcomes before retrying. An +eventually consistent search returning no match is not proof a create failed. +If the adapter cannot establish the outcome, it holds publication for operator +resolution. It can retry publication from retained validated evidence without +rerunning inference, subject to current authorization, source and policy. +Missing, exhausted or unresolved required children remain visible and cannot +imply completion. A configured domain adapter may request investigation after +failure, but cannot turn that request into a successful worker assessment. + +This is a deterministic host capability. It adds neither a coordinator agent +nor authority from journal contents. Existing actor, entity, disclosure and +repository gates still apply. Domain mapping, assessment semantics and ticket +rendering remain adapters. Journal records contain bounded identities, digests +and receipts, not raw private prompts or credentials. Artifact publication +policy still applies. Journal integrity failure stops scheduling and +publication; it does not silently reset state and repeat work. + +## Forge scope + +The contract applies to GitHub, GitLab and Forgejo target repositories. +Each backend must demonstrate conditional updates and the same recovery +tests before enablement. Initial implementation may enable GitHub alone; +GitLab and Forgejo remain disabled until their adapters conform. Jira may be +a source or publication destination; its unconditional issue-property writes +do not satisfy the journal's compare-and-swap requirement. + +## Consequences + +- Recovery can resume scheduling or publication without keeping a host or + model session alive. +- Existing forge storage and CI schedules remain the coordination substrate. +- Backend integrity, ownership and ambiguous-write tests become enablement + gates; delivery is not claimed to be exactly once. +- Adopters must define target identity and completion rules while Fullsend + enforces the shared recovery boundary. +- Journal layout, credentials, retention and adapter implementation require + follow-up work before this capability is available. diff --git a/docs/ADRs/0166-select-pi-extension-tools-without-widening-access.md b/docs/ADRs/0166-select-pi-extension-tools-without-widening-access.md new file mode 100644 index 0000000000..c84ccae480 --- /dev/null +++ b/docs/ADRs/0166-select-pi-extension-tools-without-widening-access.md @@ -0,0 +1,74 @@ +--- +title: "166. Select Pi extension tools without widening access" +status: Accepted +relates_to: + - security-threat-model + - agent-architecture +topics: + - runtime + - tools + - security +--- + +# 166. Select Pi extension tools without widening access + +Date: 2026-11-10 + +## Status + +Accepted + +## Context + +[ADR 0094](0094-pi-extensions-are-harness-resources.md) admits extension code +through trusted harness resources. The Pi runner translates built-in agent +tool names, but drops other declared names. An extension can therefore load +while its tool cannot be selected by a strict agent allowlist. +[#9179](https://github.com/fullsend-ai/fullsend/pull/9179) addresses MCP tool +patterns and child permissions; ordinary extension tools need the same +least-privilege property without acquiring an MCP identity. + +The [threat model](../problems/security-threat-model.md) requires tool access +to remain bounded. This ADR aims to let an agent select an exact tool supplied +by a vetted Pi extension without enabling unrelated tools. + +## Options + +Removing the strict tool list exposes default tools and unrelated extension +tools. Hardcoding every plugin's name into the built-in translation table +couples independently versioned resources to runner releases. Resolving exact +declared names against the loaded extension registry preserves that boundary. + +## Decision + +Fullsend resolves exact declared Pi extension tool names against vetted +extensions to preserve strict tool selection. + +Keep existing built-in translations. Treat an otherwise unmapped exact name +as a requested native extension tool, and resolve it only after loading the +runner-vetted extension set. A missing or ambiguous requested tool fails the +run before inference. It never falls back to all extension tools, Pi defaults +or a broader built-in tool. This decision does not add wildcard matching for +native extension tools or change MCP pattern semantics. + +The effective tool set is explicit, including when empty. Hook authorization +uses the same canonical native name. Child runs, if supported, load the vetted +code that supplies a requested tool and receive only the intersection of +parent and child permissions. A runtime path that cannot enforce this refuses +the selection. Repository discovery cannot supply tools or alter identity; +extension integrity checks continue before launch and retry. Selecting a tool +does not grant shell, filesystem, network or publication authority. + +## Forge scope + +This runtime contract applies equally to GitHub, GitLab and Forgejo runs. +It introduces no forge-specific provider or authorization exception. + +## Consequences + +- A read-only agent can expose one extension tool while excluding builtin + shell, editing and compatibility tools. +- Tool typos and missing extensions become explicit setup failures. +- Hook checks and child permission tests must use the same resolved names. +- Runner implementation and real-Pi denial tests are required before native + extension selections are supported. diff --git a/docs/ADRs/0167-execute-authorized-multi-target-plans.md b/docs/ADRs/0167-execute-authorized-multi-target-plans.md new file mode 100644 index 0000000000..db45c551a9 --- /dev/null +++ b/docs/ADRs/0167-execute-authorized-multi-target-plans.md @@ -0,0 +1,105 @@ +--- +title: "167. Execute authorized multi-target plans" +status: Accepted +relates_to: + - durable-work-recovery + - agent-architecture + - agent-infrastructure +topics: + - dispatch + - coordination + - authorization +--- + +# 167. Execute authorized multi-target plans + +Date: 2026-11-10 + +## Status + +Accepted + +## Context + +[ADR 0061](0061-harness-cel-dispatch.md) dispatches matching harnesses and +supports matrix output. These mechanisms can launch several jobs, but do not +define the complete authorized target set for one request, independent target +contexts or collection of every required result. Per-subject serialization +([ADR 0106](0106-serialize-agent-runs-and-coalesce-subsequent-events.md)) also +needs to distinguish target work that shares one originating event. + +[ADR 0165](0165-recover-work-through-repository-owned-operation-journals.md) +defines recovery across attempts and external effects. Target expansion and +collection need their own boundary; see +[durable work recovery](../problems/durable-work-recovery.md). This ADR aims to +execute a bounded, authorized target set without losing isolation or mistaking +partial results for complete coverage. + +## Options + +A handwritten CI matrix can launch jobs but leaves target identity and +collection rules to each workflow. A model-led coordinator can choose branches +and retries but cannot supply execution authority. A host-admitted execution +plan makes these boundaries explicit while reusing existing schedulers. + +## Decision + +Fullsend executes host-admitted, immutable multi-target plans to enforce +independent target execution and complete result accounting. + +A trusted adapter proposes the target set from reviewed domain data. Before +dispatch, the host freezes a versioned plan containing stable target/action +identities, required targets, repository and branch/component scope, immutable +source revisions, input and policy revisions, pinned worker definitions and +finite concurrency, target-count, attempt and execution-time bounds. Source +selection is separate from the trusted revision supplying harnesses and +plugins. Discovery and model output cannot expand execution permissions. + +The host checks the admitted actor's current access and each target action +under existing authorization and disclosure rules. A blocked target stays +visible and undispatched; it is not silently removed from required coverage. +Before launch, the host verifies the checkout against the admitted repository +and source revision. Every child receives a separate checkout, scoped context, +case store and +artifact namespace, bound to its plan, target, action and attempt. Scheduling +and concurrency keys include the target operation identity, so distinct targets +sharing an event or tracker do not cancel or coalesce one another. Retries of +the same operation use the recovery boundary in ADR 0165. + +Existing dispatch and CI execution mechanisms launch the children under those +bounds. The host validates each result against its exact attempt and frozen +inputs before collecting it. Missing, invalid, failed, blocked and uncertain +results remain explicit. Collection is accounted for only when every required +target has a retained result or explicit terminal disposition; accounting is +distinct from successful assessment, publication and domain completion. A +failed or uncertain check may request investigation through an authorized +adapter without becoming an affected verdict or remediation permission. + +Changed source, mapping, policy or required targets produce a superseding plan +revision. The host stops new work under the old revision and rejects its stale +results and new publication admissions. Adding a required target reopens +collection. Reuse of prior evidence requires explicit revalidation under the +new plan; supersession never silently resets consumed work bounds. Domain +adapters define discovery, result meaning and completion policy. This decision +does not prescribe a new CLI, queue service or agent coordinator. + +## Forge scope + +The plan contract applies to GitHub, GitLab and Forgejo targets. Each enabled +dispatch backend must preserve target identity, authorization, isolation and +result binding; unsupported combinations are blocked explicitly. Cross-forge +plans require conformance from every participating backend. Jira may identify +the originating request without becoming execution authorization. + +## Consequences + +- One request can assess multiple branches independently while retaining the + exact source and scope used for each result. +- Existing matrix execution remains reusable, but rows and concurrency groups + must preserve admitted target identities. +- Partial collection stays visible and cannot imply complete coverage or + successful remediation. +- Domain adapters retain branch-discovery and assessment semantics while + Fullsend enforces execution boundaries. +- Implementation must define the versioned plan/result interface and prove + isolation, bounds and supersession before enabling multi-target execution. diff --git a/docs/architecture.md b/docs/architecture.md index b23239a26e..7a969bcdea 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -342,6 +342,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)). +- Decided, not yet implemented: exact Pi extension tool selections resolve + against runner-vetted extensions and keep an explicit effective tool set, + including empty sets; unsupported selections fail before inference + ([ADR 0166](ADRs/0166-select-pi-extension-tools-without-widening-access.md)). - Decided, not yet implemented: extend the runner-owned native Codex child policy to V2 alongside the 0.166.0 bump. Bootstrap requires the `Agent` tool, harness security and a direct-route parent selecting V1 or V2 in the bundled @@ -618,6 +622,17 @@ The existing design principle is that [the repo is the coordinator](problems/age [#8418](https://github.com/fullsend-ai/fullsend/issues/8418) and [#8421](https://github.com/fullsend-ai/fullsend/issues/8421). +- Decided, not yet implemented: host-admitted multi-target plans freeze target + scope, source revisions and finite execution bounds. Child scheduling keys + include the target operation identity, and collection accounts for every + required target independently of domain success + ([ADR 0167](ADRs/0167-execute-authorized-multi-target-plans.md)). +- Decided, not yet implemented: repository-owned operation journals retain + separate dispatch, execution and publication receipts. Conditional state + updates and ownership generations support cross-host recovery while domain + adapters retain target and completion semantics + ([ADR 0165](ADRs/0165-recover-work-through-repository-owned-operation-journals.md)). + **Open questions:** - What provider query plans can support entity-first evaluation over the @@ -632,7 +647,8 @@ The existing design principle is that [the repo is the coordinator](problems/age - Is GitHub's event system sufficient for forge-native duplicate protection, or do we need additional coordination beyond label/state conventions and agent idempotency? (Jira polling per ADR 0063 uses entity-property locks and runner - lock refresh; ADR 0098 does not resolve this question.) + lock refresh; ADR 0165 chooses an operation journal for recoverable effects, + while adapter implementation and external-system guarantees remain open.) - How does work assignment interact with the backlog/priority agent described in [agent-architecture.md](problems/agent-architecture.md)? - How should explicit cancellation, retry, and reassignment interact with the automatic event-coalescing policy in diff --git a/docs/problems/agent-architecture.md b/docs/problems/agent-architecture.md index 80d7f4d206..1b0a25db63 100644 --- a/docs/problems/agent-architecture.md +++ b/docs/problems/agent-architecture.md @@ -178,6 +178,14 @@ This principle aligns with what Yegge's Gas City project calls "Zero Framework C [OpenAI Symphony](../landscape.md#openai-symphony) is the other useful contrast: a long-running central daemon that owns scheduling state, candidate selection, and retry. Where Gas City puts a controller on the path but forbids it from containing judgment, Symphony's orchestrator visibly contains it (priority sort, blocker rules, reconciliation). Fullsend can borrow Symphony's workspace safety invariants and continuation-turn semantics without adopting the daemon. +Cross-host scheduling and partial external writes need deterministic recovery +without adding a coordinator agent; see +[durable work recovery](durable-work-recovery.md). +[ADR 0165](../ADRs/0165-recover-work-through-repository-owned-operation-journals.md) +chooses repository-owned operation journals. +[ADR 0167](../ADRs/0167-execute-authorized-multi-target-plans.md) supplies the +separate target-plan and collection boundary; implementation remains open. + ### How agents communicate Agents interact through GitHub's existing mechanisms: @@ -227,6 +235,10 @@ The multi-agent framework space is expanding rapidly, with new entries appearing **Observable delegation, still a single coordinator ([Kiro Crew](../landscape.md#kiro-crew)).** Kiro Crew lets a parent conversation delegate to sub-agents that "return their results to the parent conversation," with every step — planning, sub-agent spawning, tool selection, approvals — observable live via the Agent Client Protocol. The observability is worth borrowing: making agent reasoning and tool calls inspectable in real time, rather than only after the fact in a transcript, is a good default regardless of coordination model. But the coordination model itself is the same star topology as MetaGPT and CrewAI — the parent conversation is the coordinator, and it consumes a sub-agent's returned result without the zero-trust composition fullsend's independent review sub-agents apply to each other's findings. It is a session-scoped pattern (one developer's crew, running on their own machine or a remote host they control) rather than a repo-scoped one, so it does not need to answer the question this document is built around: what authorizes a decision when no single human or agent is watching. +Exact Pi extension tool permissions are decided in +[ADR 0166](../ADRs/0166-select-pi-extension-tools-without-widening-access.md); +the runtime must enforce them without widening access to default tools. + ## Open questions - Should agents be stateless (fresh context per task) or stateful (accumulated knowledge of the codebase)? Stateless is safer (no poisoned state persists) but less efficient. diff --git a/docs/problems/agent-infrastructure.md b/docs/problems/agent-infrastructure.md index ef5cfc305d..756ee13d54 100644 --- a/docs/problems/agent-infrastructure.md +++ b/docs/problems/agent-infrastructure.md @@ -120,6 +120,14 @@ Many fullsend scenarios skew toward **ephemeral, task-scoped** execution (triage - **Governance** — Policy may be applied at runtime by agents reading from a policy repo; infrastructure determines where that runtime runs and how it accesses policy. - **Repo readiness** — Repos need reliable CI and signals; agent infrastructure may consume or depend on the same CI (e.g. for “run tests” or “run linters”) and should not conflict with it. Headless runtimes amplify **feedback latency** and **workspace handoff** costs when CI is the only execution path. +Restarting workers also needs durable ownership and reconciliation of external +effects; see [durable work recovery](durable-work-recovery.md). +[ADR 0165](../ADRs/0165-recover-work-through-repository-owned-operation-journals.md) +chooses repository-owned journals and short-lived reconcilers. +[ADR 0167](../ADRs/0167-execute-authorized-multi-target-plans.md) bounds and +isolates target execution while reusing existing scheduling mechanisms. Backend +implementation and operational acceptance remain open. + ## Open questions - What is the right level of isolation per agent (process, container, microVM, separate cluster)? diff --git a/docs/problems/cross-run-memory.md b/docs/problems/cross-run-memory.md index b3bbb803ce..fca00bda6d 100644 --- a/docs/problems/cross-run-memory.md +++ b/docs/problems/cross-run-memory.md @@ -86,6 +86,11 @@ These splits suggest that "memory" may not be one feature. It may be several fee Cross-run memory is one piece of a broader question: what happens when an agent fails? The memory problem asks how agents learn from prior failures. The recovery problem asks what the system does immediately after a failure, before any learning occurs. +Recovering scheduling ownership and ambiguous external writes is a separate +mechanical problem; see [durable work recovery](durable-work-recovery.md). +Its operation journal retains attempts and work bounds without deciding +whether another model approach is likely to succeed. + ### Retry vs. escalate When a run fails (CI failure, merge conflict, model refusal, timeout), the system must decide: retry the same approach, try a different approach, or escalate to a human. Execution limits bound how much work can occur, but reaching a limit does not establish whether another attempt is likely to produce a different outcome. diff --git a/docs/problems/durable-work-recovery.md b/docs/problems/durable-work-recovery.md new file mode 100644 index 0000000000..d54e04fed1 --- /dev/null +++ b/docs/problems/durable-work-recovery.md @@ -0,0 +1,109 @@ +--- +title: Durable work recovery +--- + +# Durable work recovery + +A job can disappear after discovery, finish after its caller stops, or publish +an external change before its acknowledgement is saved. A successful model +invocation does not answer whether the requested work was scheduled, which +attempt owns it, or whether publication must be retried. + +The [repository coordination model](agent-architecture.md#interaction-model-the-repo-as-coordinator) +keeps authority in repository-visible controls. Recovery must preserve that +boundary. It needs deterministic bookkeeping, rather than an agent deciding +which other agents should run. The +[infrastructure discussion](agent-infrastructure.md) also separates execution +capacity from waiting for people or external systems. + +## Failure boundaries + +- A dispatcher stops after a remote scheduler accepts a request but before it + records the scheduler's run identifier. +- Two hosts discover the same operation while neither has reserved it. +- A worker's lease expires; its replacement starts while the old worker is + still running. +- A worker saves valid evidence, but its publication request times out after + the external system creates the issue or comment. +- One required child never returns while other children succeed. +- Source, authorization or a target plan changes while work is queued. + +Serialization for a harness and subject reduces overlap. It does not make +dispatch, execution and external writes one transaction. A source checkpoint +or the absence of a running CI job cannot prove completion. Operators need to +distinguish these conditions from ordinary agent failures; see +[operational observability](operational-observability.md#what-just-happened). + +Persistent attempt bounds supply recovery mechanics, while +[cross-run escalation](cross-run-memory.md#error-recovery-and-retry-mechanics) +also needs failure interpretation and policy. A journal does not decide whether +a different model strategy is likely to succeed. + +## Options and trade-offs + +### Let each integration own its recovery + +An adapter can maintain a database and reconcile its own jobs and external +effects. This is flexible and avoids a new platform contract. Each adapter +must also implement authorization rechecks, duplicate prevention, restart +handling and publication recovery. Guarantees can differ across workflows. + +### Extend repository-owned state + +A repository-scoped journal can use conditional forge writes and short-lived +reconcilers. Existing schedulers still run individual workers. This fits the +repository coordination model and avoids a required central service. It needs +explicit trust, retention, conflict, lease and external-effect protocols; +eventual-consistency searches cannot establish that an ambiguous write failed. + +### Delegate to a durable workflow service + +A service can supply timers, retries and ownership. It introduces another +operated component and trust boundary. Its scheduler guarantees still do not +make a remote issue creation atomic or authorize a retry after scope changes. + +## Dispatching a complete target set + +Multiple CI jobs are an execution mechanism, not a definition of coverage. +When one request maps to several maintained branches, each branch needs a +separate source binding and work identity. A concurrency key based only on +the originating issue can incorrectly serialize or coalesce distinct targets. +A successful child does not account for another child that never started. + +A handwritten matrix keeps these rules local to its workflow. A generic +host-admitted plan can reuse existing matrix execution while enforcing target +scope, finite bounds and result correlation. A model choosing the target set +cannot grant authority to execute it. + +[ADR 0167](../ADRs/0167-execute-authorized-multi-target-plans.md) chooses the +plan boundary. ADR 0165 supplies its recovery mechanics. Domain adapters +still discover maintained targets and decide what their results mean. +Acceptance must include distinct branches sharing one event, a wrong-target +result, an exhausted target, a missing child, and a new plan that adds a +required branch while an old worker is still running. Accounted failure is +visible failure, not successful assessment or publication. + +## Decision and acceptance + +[ADR 0165](../ADRs/0165-recover-work-through-repository-owned-operation-journals.md) +chooses a repository-owned journal. Its implementation remains separate from +the decision. A local database test is not distributed acceptance. + +Fault tests must stop both sides of each handoff, overlap reconcilers, expire +ownership while a worker is still alive, and supersede a plan before +publication. A remote write that succeeded before its acknowledgement was +lost must be reconciled without rerunning inference or blindly repeating the +write. Every required target remains accounted for, including exhausted or +missing attempts. A domain adapter may publish an investigation request when +analysis fails; that request is not an assessment or permission to remediate. + +## Open questions + +- Which journal layout, signing rules, retention and compaction bounds meet + the conditional-write and integrity requirements on each forge? +- Which existing scheduler APIs can reconcile accepted-but-unacknowledged + requests by stable operation identity? +- Which publication adapters can safely prove a write absent, and which must + retain an ambiguous operation for human reconciliation? +- How should an operator repair corrupted or inaccessible state without + discarding accepted work or permitting stale workers to publish? diff --git a/docs/problems/operational-observability.md b/docs/problems/operational-observability.md index 20f61bd7df..9afb906e1c 100644 --- a/docs/problems/operational-observability.md +++ b/docs/problems/operational-observability.md @@ -47,6 +47,11 @@ When something goes wrong — a bad merge, a missed vulnerability, an unexpected This is the debugging use case. It requires structured traces of individual agent runs that can be correlated into end-to-end workflows. The trace is the unit of debugging — when something goes wrong, you pull the trace and read it. +A trace alone cannot establish whether an external write succeeded after its +acknowledgement was lost. [Durable work recovery](durable-work-recovery.md) +separates scheduling, execution and publication receipts so an operator can +identify which effect still needs reconciliation. + ### Is the system getting better or worse? Beyond individual incidents, operators need trend-level visibility: diff --git a/docs/problems/security-threat-model.md b/docs/problems/security-threat-model.md index 686af0ac5d..aeb2d9644e 100644 --- a/docs/problems/security-threat-model.md +++ b/docs/problems/security-threat-model.md @@ -55,6 +55,12 @@ The attack surface is the same as for visible prompt injection — PR descriptio ### Defense considerations +A vetted extension may expose several tools. Selecting one must not grant its +siblings or the runtime defaults. +[ADR 0166](../ADRs/0166-select-pi-extension-tools-without-widening-access.md) +requires exact native tool selection and consistent hook and child permissions +for Pi extensions. + - **Edge and proxy guardrails** — Some organizations filter or moderate **outbound** model traffic (prompts or completions) or tool invocations at a **gateway** in front of providers and MCP servers — for example policy-as-code, rate limits, or vendor moderation hooks. That can add defense in depth and consistent telemetry, but it does not remove the need for **in-agent** separation of trusted instructions from untrusted forge content; see [landscape.md](../landscape.md#agent-gateway). A compromised gateway policy is a concentrated risk, so gateway configuration should be governed like other agent infrastructure. - **Input sanitization** — strip or flag non-rendering Unicode characters before content reaches agents. Specific character classes to target: Tag characters (U+E0000–U+E007F), zero-width characters (U+200B, U+200C, U+200D, U+FEFF), bidirectional overrides (U+202A–U+202E, U+2066–U+2069), and variation selectors. This is more tractable than general prompt injection detection because the characters themselves are the signal — their mere presence in a PR description or code comment is suspicious, regardless of what they encode. However, some of these characters have legitimate uses in internationalized text, so stripping must be context-aware or at minimum flag rather than silently remove.