From 5a43ff59bc0cd3c753467ac250594606c89ab91e Mon Sep 17 00:00:00 2001 From: Drake Stapleton Date: Sun, 4 Oct 2026 16:19:30 -0500 Subject: [PATCH 1/2] docs(report): Odysseus #6474 upstream PR draft and verification Co-Authored-By: Claude Fable 5.1 --- docs/upstream/odysseus-6474-pr.md | 41 +++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 docs/upstream/odysseus-6474-pr.md diff --git a/docs/upstream/odysseus-6474-pr.md b/docs/upstream/odysseus-6474-pr.md new file mode 100644 index 0000000..50eb36e --- /dev/null +++ b/docs/upstream/odysseus-6474-pr.md @@ -0,0 +1,41 @@ +# Upstream PR draft: odysseus-dev/odysseus#6474 (human submits) + +Prepared by INTERPLANE 0.2 lane L1. Nothing here was opened or pushed upstream. + +## Verified state (2026-10-04) +- origin/dev HEAD: `2992bf6d368a11472323e47d3bfed91e79cefc6b` (2026-10-01). +- Branch `fix/cookbook-llamacpp-hf-file` on fork `aien-dev/odysseus`: one commit `80f025d7a864f54a6bd767e4c78b338fb7242edb`, parent is origin/dev HEAD (no rebase needed). +- Issue #6474: OPEN. No upstream PR references 6474 (`gh pr list --search 6474`: none). `--search hf-file` returned only unrelated cookbook PRs (#6369, #6416, #6482, ...). +- origin/dev `src/tools/cookbook.py:465` still emits `-hfr {siblings[0]}`: not yet fixed. +- Diff is only `src/tools/cookbook.py` (+2/-2) and new `tests/test_cookbook_default_launch_cmd.py` (+25). Nothing INTERPLANE-related. +- Clean cherry-pick onto origin/dev in a scratch worktree (removed afterwards). Regression test: 2 passed with the fix; with the old cookbook.py the main test fails (1 failed, 1 passed), so it is a real regression guard. Run with the Odysseus venv (`~/workspace/odysseus/.venv`), `ODYSSEUS_DATA_DIR` pointed at a temp dir. + +## Title +fix(cookbook): pass the GGUF filename to llama-server with --hf-file (#6474) + +## Body +**Problem.** `_cookbook_default_launch_cmd` builds `llama-server -hf -hfr ...`. On current llama.cpp `-hfr` is an alias of `-hf` (the repo flag), so the filename is parsed as a second repo and llama-server exits with "invalid HF repo format". Serving a GGUF repo from the cookbook fails. (Reported in #6474.) + +**Fix.** Use the file flag, `--hf-file`, for the GGUF filename. The no-GGUF-sibling path is unchanged. + +**Test.** New `tests/test_cookbook_default_launch_cmd.py`: (1) with a GGUF sibling the command contains `-hf ` and `--hf-file .gguf` and no `-hfr`; (2) with no GGUF sibling no file flag is emitted. + +**How to verify.** +`python -m pytest tests/test_cookbook_default_launch_cmd.py -q`. Reverting `src/tools/cookbook.py` makes the first test fail. Manually: `llama-server -hf unsloth/Qwen3.5-4B-GGUF --hf-file Qwen3.5-4B-Q4_K_M.gguf` starts, whereas `-hfr ` is rejected. (Manual llama-server run not performed by us: UNVERIFIED.) + +**Scope.** This PR addresses only the `-hfr` flag half of #6474. The issue's second symptom (reasoning models return empty content) is not touched; so use "Refs #6474", not "Fixes", unless the maintainer prefers otherwise. + +Follows CONTRIBUTING: one fix per PR, targets `dev`. + +## Commands a human runs (from `~/workspace/odysseus`) +``` +git fetch origin && git checkout fix/cookbook-llamacpp-hf-file +git push fork fix/cookbook-llamacpp-hf-file # already on the fork; only if updated +gh pr create -R odysseus-dev/odysseus --base dev --head aien-dev:fix/cookbook-llamacpp-hf-file \ + --title "fix(cookbook): pass the GGUF filename to llama-server with --hf-file (#6474)" \ + --body "Refs #6474. Problem, fix, test and verification steps as in docs/upstream/odysseus-6474-pr.md (Body section)." +``` +Paste the Body section above into the PR description instead of the short `--body` if preferred. + +## Other narrow Odysseus observations (not fixed) +- The 0.1 note that `tail_serve_output` is missing from `TOOL_TAGS` is STILL TRUE at 2992bf6: `'tail_serve_output' in src.agent_tools.TOOL_TAGS` is False (the cookbook block in `src/agent_tools/__init__.py` lists the other cookbook tools but not this one), while it is in the schema/tool lists (`src/tool_capabilities.py:122`, `src/tool_index.py:130`, `src/agent_loop.py:532` and `:763`, dispatched at `src/tool_execution.py:1205`). Native calls to it are rejected as unknown. Likely a one-line fix in its own PR. I found no open upstream PR for it (UNVERIFIED: only searched for 6474/hf-file). From 273d3a1aeb9396be1fef5dbfa62935db3000c753 Mon Sep 17 00:00:00 2001 From: Drake Stapleton Date: Sun, 4 Oct 2026 16:21:15 -0500 Subject: [PATCH 2/2] docs(audit): AIEN authority re-audit at origin/main 2026-10-04 Co-Authored-By: Claude Fable 5.1 --- CURRENT_STATE.md | 22 ++-- .../aien-authority-reaudit-2026-10-04.md | 120 ++++++++++++++++++ 2 files changed, 131 insertions(+), 11 deletions(-) create mode 100644 docs/audits/aien-authority-reaudit-2026-10-04.md diff --git a/CURRENT_STATE.md b/CURRENT_STATE.md index 209a61a..5cd5806 100644 --- a/CURRENT_STATE.md +++ b/CURRENT_STATE.md @@ -10,10 +10,10 @@ Pinned sources: | Project | Repo | Commit | Default branch | License | |---|---|---|---|---| | Odysseus | odysseus-dev/odysseus | 2992bf6 (2026-10-01) | dev | AGPL-3.0 | -| AIEN sovereign core | aien-dev/aien-sovereign-core | 7580039 | main | AGPL-3.0-or-later | -| AIEN aegis-runtime | aien-dev/aegis-runtime | f4e8709 | main | AGPL-3.0-or-later | -| AIEN protocols | aien-dev/aien-protocols | 3a4cdbe | main | AGPL-3.0-or-later | -| AIEN architecture | aien-dev/aien-architecture | 6c95697 | main | AGPL-3.0-or-later | +| AIEN sovereign core | aien-dev/aien-sovereign-core | 7580039 (2026-10-04 re-audit: origin/main 0bcd558, 3 attention/ABI commits, no authority change) | main | AGPL-3.0-or-later | +| AIEN aegis-runtime | aien-dev/aegis-runtime | f4e8709 (2026-10-04 re-audit: still origin/main) | main | AGPL-3.0-or-later | +| AIEN protocols | aien-dev/aien-protocols | 3a4cdbe (2026-10-04 re-audit: still origin/main) | main | AGPL-3.0-or-later | +| AIEN architecture | aien-dev/aien-architecture | 6c95697 (2026-10-04 re-audit: still origin/main) | main | AGPL-3.0-or-later | | Qwen3.5 chat template | Qwen/Qwen3.5-9B `chat_template.jinja` | sha256 a4aee8af... (153 lines) | main | Apache-2.0 | Classification key: implemented / partially implemented / merged but unused / experimental / @@ -51,23 +51,23 @@ There are **two unconnected agent stacks** and **three unconnected policy mechan | Concern | State | Where | |---|---|---| -| Agent loop A | implemented | `aegis-runtime/src/agent.rs:95-240` `AgentEngine::execute_task`; `tools = skills.to_openai_tools()` (`:103`, `skills.rs:87-108`); request body `tools` (`inference.rs:246`); native `tool_calls` read (`inference.rs:68,258`); `max_turns` loop (`:130`), gateway default 8 (`gateway.rs:147`); reinjection: assistant `tool_calls` + `role:"tool"` message (`agent.rs:168-205`) | -| Agent loop B | implemented | `aien-sovereign-core/crates/aien-cli/src/main.rs` REPL (`max_tool_steps = 10`), subagents (`subagents.rs:148`, depth 3); tools described as prose in the system prompt (`client.rs:100-160`); parser `extract_tool_calls` regex `(?s)\s*(.*?)\s*(?:|$)` (`client.rs:383`) plus fenced-JSON fallback and brace/quote repair (`:350-380`); reinjection as a **user-role** `` message (`main.rs:327-330`) | +| Agent loop A | implemented | `aegis-runtime/src/agent.rs:95-240` `AgentEngine::execute_task`; `tools = skills.to_openai_tools()` (`:103`, `skills.rs:87-108`); request body `tools` (`inference.rs:246`); native `tool_calls` read (`inference.rs:68,258`); `max_turns` loop (`:130`), gateway default 8 (`gateway.rs:147`); reinjection: assistant `tool_calls` + `role:"tool"` message (`agent.rs:168-205`)
**2026-10-04 re-audit:** architecture migration plan `:146` and ADR 0016 `:1485-1493` declare it legacy orchestration, oracle then retire (R16); not canonical. | +| Agent loop B | implemented | `aien-sovereign-core/crates/aien-cli/src/main.rs` REPL (`max_tool_steps = 10`), subagents (`subagents.rs:148`, depth 3); tools described as prose in the system prompt (`client.rs:100-160`); parser `extract_tool_calls` regex `(?s)\s*(.*?)\s*(?:|$)` (`client.rs:383`) plus fenced-JSON fallback and brace/quote repair (`:350-380`); reinjection as a **user-role** `` message (`main.rs:327-330`)
**2026-10-04 re-audit:** no ADR or plan declares it canonical or retired (undeclared). | | Text parser A | implemented | `parse_structured_tool_calls` (`aegis-runtime/src/inference.rs:670-742`): ```` ```json ```` block, `` tags, standalone `{...}`; accepts `name|tool`, `arguments|params`; mints `call_` ids | | OpenAI-compatible serving | implemented, not tool-aware | `aegis-runtime/src/gateway.rs:672` `POST /v1/chat/completions`; `OpenAiChatRequest` has no `tools` field (`:173-179`) | | OpenAI-compatible consuming | implemented | `HttpInferenceBackend` default `http://127.0.0.1:18006/v1/chat/completions` (`inference.rs:152`) | | Tool definitions A | implemented | `SkillDefinition{name, description, parameters_schema, advertised}` (`skills.rs`); builtins `bash_eval{command,cwd}` (allowlisted commands only), `read_file{path}`, `write_file`, `list_dir`, `git_status`; allowlist `ALLOWED_SKILLS` (`enforcement.rs:14-24`) | | Capability descriptor | merged but unused | `aien-capability`: `ToolDescriptor{name, effects: ToolEffects, schema_digest}` (`tool.rs:7-11`, **verified**); `ToolEffects` u32 bitset PURE, READ_FILESYSTEM, READ_NETWORK, SPAWN_PROCESS, WORLD_MUTATION, LOCAL_EPHEMERAL, EXTERNAL_WRITE, EXTERNAL_IRREVERSIBLE, SECRET_BEARING (`effects.rs:5-14`, **verified**); `EffectClass` enum; **no crate depends on it** | -| aien-mcp | merged but unused | rmcp 3.4 client+server, generic transport; `McpBroker::admit`, `SpeculativeLane` refuses non-speculation-safe tools, `stage_effect_intent`, `EffectLane::execute_effect` requires `AuthorizedEffect`, which has **no production constructor** (`effect.rs:35-39`, test-only mint `:76-93`); no crate depends on it | -| Authority A (live) | implemented | `SkillRegistry::execute_gated` -> `enforcement::probe_gate` -> `ProbePolicyGuard::gate_skill` -> `pre_dispatch_check(skill_name, &Value) -> Result<(), String>` (`enforcement.rs:31`, **verified**; allowlist, JSON-object args, `admit_local_command` for bash) + `aien-probe` safety threshold 0.5; **no approval-required state reachable** | -| Authority A (typed, unproduced) | merged but unused | `DoctrineDecision{Allow, AllowRestricted(Vec), RequireApproval, Deny(String), Contain(ContainmentLevel)}` (`defense/decision.rs:14-22`, **verified**, serde tag `status`/`details`); `ExecutionAuthority` trait has no implementer; `ApprovalStatus{Pending,Approved,Rejected,Expired}` + `approvals` table exist | -| Authority B (live) | implemented | `SafetyEngine::evaluate(tool, &Value) -> SafetyDecision{Allow, AskUser(String), Deny(String)}` (`aien-cli/src/safety.rs:8-12,76`, **verified**); `AskUser` prompts at the terminal (`tools.rs:85-92`) | +| aien-mcp | merged but unused | rmcp 3.4 client+server, generic transport; `McpBroker::admit`, `SpeculativeLane` refuses non-speculation-safe tools, `stage_effect_intent`, `EffectLane::execute_effect` requires `AuthorizedEffect`, which has **no production constructor** (`effect.rs:35-39`, test-only mint `:76-93`); no crate depends on it
**2026-10-04 re-audit:** unchanged at origin/main 0bcd558 (effect.rs:40-47, 76-93); still no crate depends on it; adapter builds and tests (10 pass) against it. | +| Authority A (live) | implemented | `SkillRegistry::execute_gated` -> `enforcement::probe_gate` -> `ProbePolicyGuard::gate_skill` -> `pre_dispatch_check(skill_name, &Value) -> Result<(), String>` (`enforcement.rs:31`, **verified**; allowlist, JSON-object args, `admit_local_command` for bash) + `aien-probe` safety threshold 0.5; **no approval-required state reachable**
**2026-10-04 re-audit:** architecture migration plan `:147` marks it 'Not authority', Replace by capability root + Effect Broker (ADR 0005/0016). | +| Authority A (typed, unproduced) | merged but unused | `DoctrineDecision{Allow, AllowRestricted(Vec), RequireApproval, Deny(String), Contain(ContainmentLevel)}` (`defense/decision.rs:14-22`, **verified**, serde tag `status`/`details`); `ExecutionAuthority` trait has no implementer; `ApprovalStatus{Pending,Approved,Rejected,Expired}` + `approvals` table exist
**2026-10-04 re-audit:** `ExecutionAuthority` still has zero implementers (`execution/broker.rs:16-17`); its `ActionRequest` is aegis-local, not the aien-protocols one. | +| Authority B (live) | implemented | `SafetyEngine::evaluate(tool, &Value) -> SafetyDecision{Allow, AskUser(String), Deny(String)}` (`aien-cli/src/safety.rs:8-12,76`, **verified**); `AskUser` prompts at the terminal (`tools.rs:85-92`)
**2026-10-04 re-audit:** still private: `mod safety;` at aien-cli `main.rs:14`, `lib.rs` empty. Also a fourth in-repo `ProbePolicyGuard` copy in `spark-mail-rs/src/effect.rs:116`. | | spark-aegis / aien-security | implemented, not a capability authorizer | containment, scanning, audit; `enforce_network_purpose` only forbids Telemetry | | Effects boundary | experimental, journal only | `aien-runtime/src/world.rs:9-26` `EffectIntent{WriteFile, ExecuteCommand, SendMessage, PublishGit}` recorded into `WorldManifest.effect_log`; no executor | | Cortex | implemented, off the agent path | `cortex-rs` HTTP routes; CLI reaches it over HTTP; aegis-runtime skills `cortex.search` report "Unavailable" | | Tracing / provenance | partially implemented | per-request `request_id` uuid (`aegis-runtime/src/inference.rs:375`); `ActionReceipt{receipt_id, action_id, success, output, error, execution_digest, completed_at}` (`aien-protocols/crates/aien-action-protocol/src/lib.rs:51-59`); `ControlEnvelope{protocol_version, request_id, operation_id, operator_session}` (`aien-runtime/src/control.rs:65-71`); SHA-256 digests in aien-capability, BLAKE3 in spark-aegis and aien-proof | | aien-protocols schemas | implemented as serde types, no JSON Schema files | `CapabilityGrant`, `ContainmentState`, `ActionRequest`, `ActionAuthorization`, `ActionReceipt` (aien-action-protocol); `EventEnvelope` (aien-event-protocol); `InferenceRequest/Response` (aien-inference-protocol); no intent/decision/tool-call message type; `VERSIONING.md`: semver, major 0 may change wire formats | -| ADRs | accepted | 0003 tools vs skills; 0004 MCP is a compatibility layer (canonical at `aien-mcp`); 0005/0007 irreversible effects only as EffectIntents until a world wins; 0016 resident reaction architecture (AEGIS contributes capability policy, only AIENOS root mints grants); 0017 ARGUS never authorizes. None mention a model adapter protocol or Ajax | +| ADRs | accepted | 0003 tools vs skills; 0004 MCP is a compatibility layer (canonical at `aien-mcp`); 0005/0007 irreversible effects only as EffectIntents until a world wins; 0016 resident reaction architecture (AEGIS contributes capability policy, only AIENOS root mints grants); 0017 ARGUS never authorizes. None mention a model adapter protocol or Ajax
**2026-10-04 re-audit:** ADR 0016 (`:54,:359,:1504`): the authority root is the native AIENOS capability authority; AEGIS decides no policy. See docs/audits/aien-authority-reaudit-2026-10-04.md. | | Ajax | absent (**verified**) | only tokenizer vocabulary entries | | Real captured model fixtures | absent | hand-written strings only, e.g. `aegis-runtime/src/inference.rs:821` `{"name": "bash_eval", "arguments": {"command": "ls"}}` | diff --git a/docs/audits/aien-authority-reaudit-2026-10-04.md b/docs/audits/aien-authority-reaudit-2026-10-04.md new file mode 100644 index 0000000..e48d57b --- /dev/null +++ b/docs/audits/aien-authority-reaudit-2026-10-04.md @@ -0,0 +1,120 @@ +# AIEN authority re-audit, 2026-10-04 (INTERPLANE 0.2 lane L2) + +Read-only audit. No AIEN code changed. Every claim is from `git show origin/main:` or a +command run on 2026-10-04. + +## Commits audited (origin/main, fetched 2026-10-04) + +| Repo | 0.1 pin | origin/main now | Commit date | Moved? | +|---|---|---|---|---| +| aien-sovereign-core | 7580039 | **0bcd558ed9adc3aafcc59526fba6417a86fe804b** | 2026-10-04 15:44 -05:00 | yes, 3 commits (#200 AttentionGeometry ABI, #201 attention wiring tests, #202 omega-gpu pin). `git diff 7580039 origin/main -- crates/aien-mcp crates/aien-capability crates/aien-cli/src/safety.rs` is empty: no authority-relevant change | +| aegis-runtime | f4e8709 | **f4e8709** (2026-10-04 13:21 -05:00) | | no | +| aien-protocols | 3a4cdbe | **3a4cdbe** (2026-10-04 13:22 -05:00) | | no | +| aien-architecture | 6c95697 | **6c95697** (2026-10-04 14:22 -05:00) | | no | + +Note: the 0.1 pins for aegis-runtime, aien-protocols and aien-architecture are still current main. +Only sovereign-core moved, and not in anything this audit is about. Local `~/workspace` checkouts +were stale or ahead (sovereign-core c83eb5b, aegis-runtime e8eed5a, protocols 1554330); they were +not used as evidence. + +## The nine answers + +1. **Canonical loop: declared, and it is neither a keeper.** aien-architecture + `docs/plans/CURRENT_CODE_TO_R0_R16_MIGRATION.md:34,146` calls aegis-runtime `agent.rs:130` + "LLM agent loop ... Legacy orchestration; never on the reaction path; Oracle -> retire (R16)". + ADR 0016 scope note (`docs/adr/0016-resident-reaction-architecture.md:1485-1493`): the + `aegis-runtime` program "is legacy orchestration ... becomes the reference oracle ... R8 does + not build on it"; line 1588: do not create independent `aegis-runtime/` schedulers. + Loop B (aien-cli REPL) has no ADR or plan row naming it canonical or retired (only its + `goals.rs` and `commands.rs:1536` are marked Replace, lines 138-139). `CONTEXT.md:14` merely + lists "native chat, the AEGIS agent loop, and subagents" as inference clients. Verdict: loop A + is declared legacy/oracle; loop B is **undeclared**; the intended canonical loop is the + resident reaction runtime (ADR 0016), which is not Rust and not yet built in these repos. +2. **Canonical authority: none of the three.** Migration doc line 147 says aegis-runtime + `enforcement.rs:31` + `policy_guard.rs` are "Not authority. Effect admission belongs to + capability root + effect broker (ADR 0005)", decision **Replace** (R7/R8). ADR 0016 + `:54,:359,:1504`: the capability mint and validator live in the trusted root, natively the + AIENOS kernel capability authority (aienos `native/capability/`, C); "only the AIENOS root + mints the grant"; AEGIS "decides no policy" (`:56`). `docs/04-capabilities-skills-tools-mcp.md: + 109-122`: `EffectIntent -> policy evaluation -> AuthorizedEffect`, "production authority + must be minted only by the policy path", no unrestricted production constructor. So the + intended canon is capability root + Effect Broker (ADR 0005); `SafetyEngine`, + `pre_dispatch_check` and `ExecutionAuthority` are interim. `DoctrineDecision` is not named + canonical anywhere I found. +3. **Yes, still private.** `aien-sovereign-core` `crates/aien-cli/src/main.rs:14` `mod safety;` + (not `pub`); `crates/aien-cli/src/lib.rs` is two comment lines (no modules); the crate is a bin. + `SafetyEngine` is `pub struct` only inside a private module (`safety.rs:40`), used at + `tools.rs:76`. +4. **No implementer.** `git grep ExecutionAuthority origin/main` in all three repos: only + aegis-runtime `src/execution/broker.rs:16-17`, re-exported `src/lib.rs:21`. Signature: + `#[async_trait] pub trait ExecutionAuthority: Send + Sync { async fn authorize(&self, request: + &ActionRequest) -> Result; }` where `ActionRequest` is the local + `{session_id, run_id, capability, intent, target, params: Value}` (`broker.rs:6-13`), a + different type from aien-protocols' `ActionRequest`. No `impl`, no caller. +5. **Still no production constructor.** `aien-mcp/src/effect.rs:40-47` `pub struct + AuthorizedEffect` with six **private** fields (intent, world_id, winning_jnode, + policy_digest, capability_digest, idempotency_key); read-only getters `:50-72`; sole + constructor `authorize_for_test` `:76-93`, `#[cfg(test)] pub(crate)`. Docstring `:35-38` still + says "no production constructor. The next policy change is the only path that may mint one". + `EffectIntent` (`:6-11`): `pub` struct, **pub fields** `{provider: ProviderId, tool_name: + String, arguments: Value, capability_digest: Digest32}`, so anyone can build an intent (fine; + it carries no authority). `broker.rs:181` `SpeculativeLane::stage_effect_intent(&self, &ProviderId, + &str, Value) -> Result` (refuses speculation-safe tools, `:197`). + `broker.rs:227` `EffectLane::execute_effect(&self, effect: AuthorizedEffect) -> + Result` (idempotency ledger, stale-digest check `:249-253`). + `broker.rs:53` `McpBroker::admit(&self, ProviderId, Arc) -> Result<(), Error>` + (calls `list_tools`, builds session at epoch 1). `SpeculativeLane` `:103`, `EffectLane` `:218`. + Unchanged since 0.1 (diff empty). +6. **No.** `git grep` for `aien-mcp|aien_mcp|aien-capability|aien_capability` in `*.toml`/`*.rs` + at origin/main: aien-sovereign-core hits only the workspace member list (`Cargo.toml:5,7`) and + the two crates themselves; aegis-runtime and aien-protocols: zero. No crate enrolls a + catalog or depends on either. The only external consumer is INTERPLANE's adapter. +7. **Yes.** aegis-runtime `Cargo.toml:33-38` six path deps `../aien-protocols/crates/*` + (protocol-types, action-protocol, probe, agent-state-abi, inference-protocol, + inference-client). Still not consumable as a git dependency. +8. **Approval types** (all inert): aegis-runtime `src/defense/approval.rs:6-11` + `ApprovalStatus{Pending,Approved,Rejected,Expired}`, `:36` `Approval{id, action_id, run_id, + session_id, prompt, status, requested_at, decided_at, decided_by}`; SQLite table `approvals` + `src/persistence/sqlite/approvals.rs:27,52,92,113`; `DoctrineDecision::RequireApproval` + `src/defense/decision.rs:19`. aien-protocols `crates/aien-action-protocol/src/lib.rs:5` + `CapabilityGrant{capability, scope, granted_at, expires_at}`, `:42` `ActionAuthorization{ + authorization_id, action_id, approved_by, granted_capabilities, timestamp}`, `:32` + `ActionRequest`, `:51` `ActionReceipt`. Nothing in any live path creates an `Approval` or + `ActionAuthorization`. aien-cli `SafetyDecision::AskUser` (`safety.rs:8-12`) is the only + approval that actually happens (terminal prompt). +9. **Yes, compiles and passes.** In `adapters/aien` with the existing layout + (`~/workspace/interplane-audit/aegis-runtime` @ f4e8709, `aien-protocols` @ 3a4cdbe, which equal + origin/main): `cargo build --tests` finished clean. Then with the sovereign-core rev temporarily + changed to 0bcd558 (edit reverted, Cargo.toml/Cargo.lock restored): `cargo build --tests` + clean and `cargo test` 10 passed, 0 failed. No checkout was moved. Bump of the rev pin is + therefore safe but not required (the crates did not change). + +## Extra finding: a fourth copy of the guard + +`aien-sovereign-core/crates/spark-mail-rs/src/effect.rs:114-116,:263,:449,:461` carries an +in-repo `ProbePolicyGuard` ("Same questions as aegis-runtime `ProbePolicyGuard`", same floor as +`pre_dispatch_check`) and checks it before `mail.send`. This is the only irreversible effect that +asks a policy question today, and it does not use `aien-mcp`. architecture +`docs/02-implementation-status.md` says the same: "There is still no single broker that every +irreversible effect must pass through". Policy mechanisms in tree: A (`pre_dispatch_check`), +B (`SafetyEngine`), mail's copy, and the unproduced `DoctrineDecision`/`ExecutionAuthority`. + +## Proposed smallest AIEN-owned seam (not implemented; no fourth policy system) + +1. Host: a new `authority.rs` in **aien-mcp** (it owns `AuthorizedEffect`, so the minting code can + stay crate-private; aien-mcp cannot depend on aegis-runtime because of finding 7). +2. Move (do not copy) the 5-variant `DoctrineDecision` and the `ExecutionAuthority`-shaped trait + over `EffectIntent` into aien-capability/aien-mcp and have aegis-runtime re-export them; this is + a relocation of existing types, not a new policy language (feasibility UNVERIFIED, med). +3. Mint is a crate-private `fn mint(intent, verdict_proof)`; the only public entry is + `EffectAuthority::authorize(&self, EffectIntent, WorldId, JNodeId) -> Result` which calls an injected authority and mints only on `Allow`/`AllowRestricted`. +4. Mapping: Allow and AllowRestricted -> mint (restrictions recorded in `policy_digest`); + RequireApproval -> `Err(Pending)` that produces a persisted `Approval`, no mint until approved; + Deny -> `Err(Denied)`; Contain -> `Err(Contained)`, no mint. Fail closed on authority `Err`. +5. Negative control: a `trybuild` compile-fail test (struct literal and `EffectLane::execute_effect( + EffectIntent)` both rejected, field privacy) plus a unit test that `stage_effect_intent` output + passed to the authority with a Deny/RequireApproval/Contain stub yields no `AuthorizedEffect` + and the lane's ledger stays empty. Caveat: ADR 0016 says the real mint authority is the native + AIENOS root, so the Rust authority must be a thin adapter that asks that root and never + decides policy itself.