Wire model tool calls to typed MCP intents

This commit is contained in:
Meta Vens 2026-05-28 00:24:10 +01:00
commit c0218dba32
10 changed files with 827 additions and 96 deletions

View file

@ -16,6 +16,7 @@ epiphany-core = { path = "../epiphany-core" }
epiphany-model-adapter = { path = "../epiphany-model-adapter" }
epiphany-openai-adapter = { path = "../epiphany-openai-adapter" }
epiphany-openai-codex-spine = { path = "../epiphany-openai-codex-spine" }
epiphany-tool-adapter = { path = "../epiphany-tool-adapter" }
rmp-serde = "1"
serde = { version = "1", features = ["derive"] }
serde_json = "1"

View file

@ -127,12 +127,24 @@ async fn main() -> Result<()> {
let mut receipt = EpiphanyOpenAiModelReceipt::new(&request.request_id, &request.model);
receipt.response_id = Some("smoke-response".to_string());
receipt.transport = Some("smoke_no_network".to_string());
let events = vec![EpiphanyOpenAiStreamEvent {
schema_id: epiphany_openai_adapter::OPENAI_ADAPTER_EVENT_SCHEMA_ID.to_string(),
request_id: request.request_id.clone(),
sequence: 0,
payload: EpiphanyOpenAiStreamPayload::Completed { receipt },
}];
let events = vec![
EpiphanyOpenAiStreamEvent {
schema_id: epiphany_openai_adapter::OPENAI_ADAPTER_EVENT_SCHEMA_ID.to_string(),
request_id: request.request_id.clone(),
sequence: 0,
payload: EpiphanyOpenAiStreamPayload::ToolCall {
call_id: "smoke-tool-call".to_string(),
name: "mcp__smoke_server__smoke_tool".to_string(),
arguments: "{}".to_string(),
},
},
EpiphanyOpenAiStreamEvent {
schema_id: epiphany_openai_adapter::OPENAI_ADAPTER_EVENT_SCHEMA_ID.to_string(),
request_id: request.request_id.clone(),
sequence: 1,
payload: EpiphanyOpenAiStreamPayload::Completed { receipt },
},
];
let summary = record_openai_events(
&runtime_options.store_path,
&runtime_options,

View file

@ -37,6 +37,9 @@ use epiphany_openai_codex_spine::EpiphanyCodexOpenAiTransport;
use epiphany_openai_codex_spine::auth_manager;
pub use epiphany_openai_codex_spine::default_codex_home;
use epiphany_openai_codex_spine::status_from_auth_manager;
use epiphany_tool_adapter::CODEX_MCP_TOOL_ADAPTER_ID;
use epiphany_tool_adapter::EpiphanyToolInvocationIntent;
use epiphany_tool_adapter::tool_invocation_intent_key;
use serde::de::DeserializeOwned;
pub const OPENAI_RUNTIME_ROLE: &str = "openai-model-adapter";
@ -65,6 +68,7 @@ pub struct EpiphanyOpenAiRuntimeRunSummary {
pub verdict: String,
pub result_id: String,
pub receipt_id: Option<String>,
pub tool_intent_ids: Vec<String>,
}
#[derive(Debug, Clone, PartialEq, Eq)]
@ -236,6 +240,9 @@ pub fn record_openai_events(
cache.put(model_request_key(&model_request.request_id), &model_request)?;
for event in events {
let model_event = model_event_from_openai_event(DEFAULT_MODEL_PROVIDER, event);
if let Some(intent) = tool_invocation_intent_from_model_event(&model_event) {
cache.put(tool_invocation_intent_key(&intent.intent_id), &intent)?;
}
cache.put(
model_event_key(&model_event.request_id, model_event.sequence),
&model_event,
@ -323,6 +330,10 @@ pub fn record_openai_events(
verdict: verdict.to_string(),
result_id,
receipt_id: receipt.map(|item| openai_receipt_key(&item.request_id)),
tool_intent_ids: tool_invocation_intents_from_openai_events(DEFAULT_MODEL_PROVIDER, events)
.into_iter()
.map(|intent| intent.intent_id)
.collect(),
})
}
@ -771,6 +782,78 @@ pub fn model_receipt_from_openai_receipt(
}
}
pub fn tool_invocation_intents_from_openai_events(
provider: &str,
events: &[EpiphanyOpenAiStreamEvent],
) -> Vec<EpiphanyToolInvocationIntent> {
events
.iter()
.filter_map(|event| {
let model_event = model_event_from_openai_event(provider, event);
tool_invocation_intent_from_model_event(&model_event)
})
.collect()
}
pub fn tool_invocation_intent_from_model_event(
event: &EpiphanyModelStreamEvent,
) -> Option<EpiphanyToolInvocationIntent> {
let EpiphanyModelStreamPayload::ToolCall {
call_id,
name,
arguments,
} = &event.payload
else {
return None;
};
let (server, tool_name) = split_mcp_tool_name(name)?;
if !arguments_are_invocation_ready(arguments) {
return None;
}
Some(EpiphanyToolInvocationIntent::new(
format!(
"model-{}-{}-{}",
sanitize_request_id(&event.request_id),
event.sequence,
sanitize_request_id(call_id)
),
CODEX_MCP_TOOL_ADAPTER_ID,
server,
tool_name,
arguments.clone(),
format!("model-runtime:{}", event.provider),
format!(
"Model request {} emitted MCP tool call {}.",
event.request_id, call_id
),
now(),
))
}
fn split_mcp_tool_name(name: &str) -> Option<(String, String)> {
let mut parts = name.split("__");
if parts.next()? != "mcp" {
return None;
}
let server = parts.next()?.trim();
let tool = parts.collect::<Vec<_>>().join("__");
if server.is_empty() || tool.trim().is_empty() {
return None;
}
Some((server.to_string(), tool))
}
fn arguments_are_invocation_ready(arguments: &str) -> bool {
let trimmed = arguments.trim();
if trimmed.is_empty() || trimmed == "null" {
return true;
}
matches!(
serde_json::from_str::<serde_json::Value>(trimmed),
Ok(serde_json::Value::Object(_))
)
}
fn require_openai_provider(provider: &str) -> Result<()> {
if matches!(provider, "openai-codex" | "openai") {
return Ok(());
@ -1196,6 +1279,7 @@ mod tests {
verdict: "pass".to_string(),
result_id: "result-openai-worker-worker-job-1".to_string(),
receipt_id: Some(model_request.request_id.clone()),
tool_intent_ids: Vec::new(),
};
let result = complete_worker_job_from_assistant_text(
&store,
@ -1231,4 +1315,55 @@ mod tests {
);
Ok(())
}
#[test]
fn mcp_model_tool_call_becomes_typed_invocation_intent() -> Result<()> {
let event = EpiphanyModelStreamEvent {
schema_id: epiphany_model_adapter::MODEL_ADAPTER_EVENT_SCHEMA_ID.to_string(),
request_id: "request-1".to_string(),
provider: DEFAULT_MODEL_PROVIDER.to_string(),
sequence: 7,
payload: EpiphanyModelStreamPayload::ToolCall {
call_id: "call/1".to_string(),
name: "mcp__calendar_server__list_events".to_string(),
arguments: r#"{"limit":3}"#.to_string(),
},
};
let intent = tool_invocation_intent_from_model_event(&event)
.expect("MCP-shaped tool call should produce an intent");
assert_eq!(
intent.adapter,
epiphany_tool_adapter::CODEX_MCP_TOOL_ADAPTER_ID
);
assert_eq!(intent.server, "calendar_server");
assert_eq!(intent.tool_name, "list_events");
assert_eq!(intent.arguments_json, r#"{"limit":3}"#);
assert_eq!(intent.intent_id, "model-request-1-7-call-1");
Ok(())
}
#[test]
fn incomplete_or_non_mcp_tool_calls_do_not_create_invocation_intents() {
let base = EpiphanyModelStreamEvent {
schema_id: epiphany_model_adapter::MODEL_ADAPTER_EVENT_SCHEMA_ID.to_string(),
request_id: "request-1".to_string(),
provider: DEFAULT_MODEL_PROVIDER.to_string(),
sequence: 7,
payload: EpiphanyModelStreamPayload::ToolCall {
call_id: "call".to_string(),
name: "shell".to_string(),
arguments: "{}".to_string(),
},
};
assert!(tool_invocation_intent_from_model_event(&base).is_none());
let mut incomplete = base.clone();
incomplete.payload = EpiphanyModelStreamPayload::ToolCall {
call_id: "call".to_string(),
name: "mcp__server__tool".to_string(),
arguments: "{".to_string(),
};
assert!(tool_invocation_intent_from_model_event(&incomplete).is_none());
}
}

View file

@ -3,6 +3,15 @@ use cultcache_rs::DatabaseEntry;
pub const TOOL_ADAPTER_CAPABILITY_SCHEMA_ID: &str = "epiphany.tool_capability.v0";
pub const TOOL_ADAPTER_INVOCATION_INTENT_SCHEMA_ID: &str = "epiphany.tool_invocation_intent.v0";
pub const TOOL_ADAPTER_INVOCATION_RECEIPT_SCHEMA_ID: &str = "epiphany.tool_invocation_receipt.v0";
pub const CODEX_MCP_TOOL_ADAPTER_ID: &str = "codex-mcp";
pub fn tool_invocation_intent_key(intent_id: &str) -> String {
format!("intent:{intent_id}")
}
pub fn tool_invocation_receipt_key(intent_id: &str) -> String {
format!("receipt:{intent_id}")
}
#[derive(Debug, Clone, PartialEq, Eq, DatabaseEntry)]
#[cultcache(

File diff suppressed because it is too large Load diff

View file

@ -14,6 +14,7 @@ codex-exec-server = { path = "../vendor/codex/codex-rs/exec-server" }
codex-mcp = { path = "../vendor/codex/codex-rs/codex-mcp" }
codex-protocol = { path = "../vendor/codex/codex-rs/protocol" }
cultcache-rs = { path = "../vendor/cultcache-rs" }
epiphany-core = { path = "../epiphany-core" }
epiphany-tool-adapter = { path = "../epiphany-tool-adapter" }
serde = { version = "1", features = ["derive"] }
serde_json = "1"

View file

@ -2,8 +2,8 @@ use anyhow::Context;
use anyhow::Result;
use anyhow::anyhow;
use async_channel::unbounded;
use codex_config::Constrained;
use codex_config::CONFIG_TOML_FILE;
use codex_config::Constrained;
use codex_config::config_toml::ConfigToml;
use codex_config::load_global_mcp_servers;
use codex_config::types::OAuthCredentialsStoreMode;
@ -15,14 +15,11 @@ use codex_mcp::compute_auth_statuses;
use codex_mcp::effective_mcp_servers;
use codex_protocol::protocol::AskForApproval;
use codex_protocol::protocol::SandboxPolicy;
use cultcache_rs::CultCache;
use cultcache_rs::SingleFileMessagePackBackingStore;
use epiphany_tool_adapter::EpiphanyToolCapability;
use epiphany_tool_adapter::CODEX_MCP_TOOL_ADAPTER_ID;
use epiphany_tool_adapter::EpiphanyToolInvocationIntent;
use epiphany_tool_adapter::EpiphanyToolInvocationReceipt;
use epiphany_tool_adapter::TOOL_ADAPTER_CAPABILITY_SCHEMA_ID;
use epiphany_tool_adapter::TOOL_ADAPTER_INVOCATION_INTENT_SCHEMA_ID;
use epiphany_tool_adapter::TOOL_ADAPTER_INVOCATION_RECEIPT_SCHEMA_ID;
use epiphany_tool_adapter::tool_invocation_intent_key;
use epiphany_tool_adapter::tool_invocation_receipt_key;
use serde::Serialize;
use serde_json::Value;
use std::collections::BTreeMap;
@ -34,7 +31,7 @@ use std::sync::Arc;
use std::time::SystemTime;
use std::time::UNIX_EPOCH;
const ADAPTER_ID: &str = "codex-mcp";
const ADAPTER_ID: &str = CODEX_MCP_TOOL_ADAPTER_ID;
#[tokio::main]
async fn main() -> Result<()> {
@ -92,9 +89,7 @@ impl Command {
.cloned()
.unwrap_or_else(|| "codex-mcp-spine-smoke".to_string()),
})),
other => Err(anyhow!(
"unknown command {other:?}; expected run or smoke"
)),
other => Err(anyhow!("unknown command {other:?}; expected run or smoke")),
}
}
}
@ -129,12 +124,8 @@ fn optional_path(values: &BTreeMap<String, String>, name: &str) -> Result<Option
Ok(values.get(name).map(PathBuf::from))
}
fn open_store(path: &Path) -> Result<CultCache> {
let mut cache = CultCache::new();
cache.register_entry_type::<EpiphanyToolCapability>()?;
cache.register_entry_type::<EpiphanyToolInvocationIntent>()?;
cache.register_entry_type::<EpiphanyToolInvocationReceipt>()?;
cache.add_generic_backing_store(SingleFileMessagePackBackingStore::new(path));
fn open_store(path: &Path) -> Result<cultcache_rs::CultCache> {
let mut cache = epiphany_core::runtime_spine_cache(path)?;
cache.pull_all_backing_stores()?;
Ok(cache)
}
@ -142,8 +133,15 @@ fn open_store(path: &Path) -> Result<CultCache> {
async fn run_invocation(options: RunOptions) -> Result<RunSummary> {
let mut cache = open_store(&options.store)?;
let intent = cache
.get_required::<EpiphanyToolInvocationIntent>(&intent_key(&options.intent_id))
.with_context(|| format!("failed to load tool invocation intent {}", options.intent_id))?;
.get_required::<EpiphanyToolInvocationIntent>(&tool_invocation_intent_key(
&options.intent_id,
))
.with_context(|| {
format!(
"failed to load tool invocation intent {}",
options.intent_id
)
})?;
validate_intent(&intent)?;
let completed_at = now_utc_string();
@ -155,7 +153,11 @@ async fn run_invocation(options: RunOptions) -> Result<RunSummary> {
intent.adapter.clone(),
intent.server.clone(),
intent.tool_name.clone(),
if result.is_ok() { "completed" } else { "failed" },
if result.is_ok() {
"completed"
} else {
"failed"
},
completed_at,
);
@ -168,7 +170,7 @@ async fn run_invocation(options: RunOptions) -> Result<RunSummary> {
}
}
cache.put(receipt_key(&receipt.intent_id), &receipt)?;
cache.put(tool_invocation_receipt_key(&receipt.intent_id), &receipt)?;
Ok(RunSummary {
adapter: ADAPTER_ID.to_string(),
store: options.store.display().to_string(),
@ -235,14 +237,12 @@ async fn execute_codex_mcp(
async fn load_mcp_config(codex_home: &Path) -> Result<McpConfig> {
let config_toml = read_codex_config_toml(codex_home)?;
let mcp_servers = load_global_mcp_servers(codex_home)
.await
.with_context(|| {
format!(
"failed to load Codex MCP servers from {}",
codex_home.join(CONFIG_TOML_FILE).display()
)
})?;
let mcp_servers = load_global_mcp_servers(codex_home).await.with_context(|| {
format!(
"failed to load Codex MCP servers from {}",
codex_home.join(CONFIG_TOML_FILE).display()
)
})?;
Ok(McpConfig {
chatgpt_base_url: config_toml
.as_ref()
@ -313,12 +313,12 @@ fn parse_arguments(arguments_json: &str) -> Result<Option<Value>> {
}
fn validate_intent(intent: &EpiphanyToolInvocationIntent) -> Result<()> {
if intent.schema_id != TOOL_ADAPTER_INVOCATION_INTENT_SCHEMA_ID {
if intent.schema_id != epiphany_tool_adapter::TOOL_ADAPTER_INVOCATION_INTENT_SCHEMA_ID {
return Err(anyhow!(
"intent {} has schema_id {:?}, expected {:?}",
intent.intent_id,
intent.schema_id,
TOOL_ADAPTER_INVOCATION_INTENT_SCHEMA_ID
epiphany_tool_adapter::TOOL_ADAPTER_INVOCATION_INTENT_SCHEMA_ID
));
}
if intent.adapter != ADAPTER_ID {
@ -333,7 +333,10 @@ fn validate_intent(intent: &EpiphanyToolInvocationIntent) -> Result<()> {
return Err(anyhow!("intent {} has empty MCP server", intent.intent_id));
}
if intent.tool_name.trim().is_empty() {
return Err(anyhow!("intent {} has empty MCP tool name", intent.intent_id));
return Err(anyhow!(
"intent {} has empty MCP tool name",
intent.intent_id
));
}
Ok(())
}
@ -359,8 +362,8 @@ fn smoke(options: SmokeOptions) -> Result<SmokeSummary> {
"smoke",
now_utc_string(),
);
cache.put(intent_key(&intent.intent_id), &intent)?;
cache.put(receipt_key(&intent.intent_id), &receipt)?;
cache.put(tool_invocation_intent_key(&intent.intent_id), &intent)?;
cache.put(tool_invocation_receipt_key(&intent.intent_id), &receipt)?;
Ok(SmokeSummary {
adapter: ADAPTER_ID.to_string(),
store: options.store.display().to_string(),
@ -370,14 +373,6 @@ fn smoke(options: SmokeOptions) -> Result<SmokeSummary> {
})
}
fn intent_key(intent_id: &str) -> String {
format!("intent:{intent_id}")
}
fn receipt_key(intent_id: &str) -> String {
format!("receipt:{intent_id}")
}
fn receipt_id(intent_id: &str) -> String {
format!("receipt-{intent_id}-{}", unix_millis())
}
@ -408,15 +403,15 @@ fn schema_map() -> BTreeMap<String, String> {
BTreeMap::from([
(
"capability".to_string(),
TOOL_ADAPTER_CAPABILITY_SCHEMA_ID.to_string(),
epiphany_tool_adapter::TOOL_ADAPTER_CAPABILITY_SCHEMA_ID.to_string(),
),
(
"intent".to_string(),
TOOL_ADAPTER_INVOCATION_INTENT_SCHEMA_ID.to_string(),
epiphany_tool_adapter::TOOL_ADAPTER_INVOCATION_INTENT_SCHEMA_ID.to_string(),
),
(
"receipt".to_string(),
TOOL_ADAPTER_INVOCATION_RECEIPT_SCHEMA_ID.to_string(),
epiphany_tool_adapter::TOOL_ADAPTER_INVOCATION_RECEIPT_SCHEMA_ID.to_string(),
),
])
}

View file

@ -39,7 +39,7 @@ remembers doctrine; the branch remembers the blade.
- `epiphany-mvp-status --source native` is the current provider-neutral status boundary. It projects scene, pressure, jobs, roles, planning, reorient, CRRC, and coordinator status from native core surfaces and returns provider/runtime worker results as `backendMissing` placeholders instead of asking Codex for model-worker state. Keep future pluggable model-provider work behind launch/result/runtime documents; do not let provider choice leak into status, prompt authority, scheduler policy, or durable `EpiphanyThreadState`.
- `epiphany-model-runtime` is the current provider-neutral executable boundary. It is built by the `epiphany-openai-runtime` crate for now and accepts `--provider openai-codex`; the old `epiphany-openai-runtime` binary, `--openai-runtime-bin`, and `openai-runtime` executor name survive only as compatibility aliases. Coordinator run mode, local wrapper run mode, and repo birth runner should call `--model-runtime-bin` plus `--model-provider`. The typed request/event/receipt contract is now provider-neutral in `epiphany-model-adapter` as `epiphany.model_request.v0`, `epiphany.model_stream_event.v0`, `epiphany.model_receipt.v0`, and `epiphany.model_adapter_status.v0`; OpenAI/Codex documents are adapter evidence behind that boundary, not scheduler/status/state authority.
- Coordinator plan/run passes now emit `epiphany.coordinator_run_receipt.v0` into runtime-spine. `coordinator-summary.json` and `coordinator-steps.jsonl` remain useful operator artifacts, but the durable receipt of what the coordinator decided is typed CultCache/CultNet state.
- The first tool/MCP contract surface exists in `epiphany-tool-adapter`: `epiphany.tool_capability.v0`, `epiphany.tool_invocation_intent.v0`, and `epiphany.tool_invocation_receipt.v0`. Runtime-spine advertises these as the Epiphany-facing tool boundary. `epiphany-tool-codex-mcp-spine` is the quarantined executing adapter: it consumes one typed invocation intent from CultCache, calls user-declared Codex MCP through `codex-mcp`, and emits a typed invocation receipt. Raw MCP JSON remains protocol-edge cargo; Codex MCP is transport scaffolding, not Epiphany state, prompt, scheduler, or policy authority.
- The first tool/MCP contract surface exists in `epiphany-tool-adapter`: `epiphany.tool_capability.v0`, `epiphany.tool_invocation_intent.v0`, and `epiphany.tool_invocation_receipt.v0`. Runtime-spine advertises these as the Epiphany-facing tool boundary. `epiphany-model-runtime` now materializes complete MCP-shaped model tool calls as typed invocation intents, and `epiphany-tool-codex-mcp-spine` is the quarantined executing adapter: it consumes one typed invocation intent from the mixed runtime-spine CultCache store, calls user-declared Codex MCP through `codex-mcp`, and emits a typed invocation receipt. Raw MCP JSON remains protocol-edge cargo; Codex MCP is transport scaffolding, not Epiphany state, prompt, scheduler, or policy authority.
- The active foundation directive is now `notes/codex-starvation-and-cultnet-liberation-plan.md`. The previous Codex app-server control-plane rebuild made Epiphany less rotten inside Codex, but that is not the destination. Epiphany must become a native CultCache/CultMesh/CultNet runtime while remaining an honest modified Codex-derived backend for subscription auth/model use. Codex should remain relatively vanilla and keep doing Codex things, including useful app-server and streaming bridge affordances, but it must not own Epiphany state, processes, prompts, scheduler decisions, or policy. The bridge handles interop; Codex and Epiphany do not get to rummage around in each other's organs.
- `notes/epiphany-cultmesh-dreaming-roadmap.md` is the new concrete design for distributed Epiphany dreaming. The invariant is hard: private state stays local; public dreams are separately authored typed documents distributed through CultMesh/CultNet; foreign dreams are thought weather until a reviewed local adoption receipt digests them. The first code slice should be dream schemas plus a local CultMesh-backed store, not public fanout.
- CultMesh is now the preferred Rust abstraction for that local store work. The compile-time Rust substrate is repo-contained: `vendor/cultcache-rs`, `vendor/cultnet-rs`, and `vendor/cultmesh-rs`. The old `E:\Projects\CultLib\crates\*` dependency body is dead in this checkout and must not be revived by accident. Vendored CultCache reads/writes `cultcache.store.v1`, so `state/ledgers.msgpack` and `epiphany-state status` are aligned again. The first integrations are deliberately small: status, Verse policy, global room policy, organ contract policy, native operator status, native operator snapshots, and local operator run intent/receipt round-trip through CultMesh. Use `cargo run --manifest-path .\epiphany-core\Cargo.toml --bin epiphany-cultmesh-smoke`, `cargo run --manifest-path .\epiphany-core\Cargo.toml --bin epiphany-cultmesh-status -- smoke --store .\.epiphany-smoke\cultmesh\operator-status.ccmp --runtime-id epiphany-cultmesh-status-smoke`, `cargo run --manifest-path .\epiphany-core\Cargo.toml --bin epiphany-operator-snapshot -- smoke --store .\.epiphany-smoke\cultmesh\operator-snapshots.ccmp --runtime-id epiphany-operator-snapshot-smoke --snapshot-id smoke-status`, and `cargo run --manifest-path .\epiphany-core\Cargo.toml --bin epiphany-operator-run -- smoke --store .\.epiphany-smoke\cultmesh\operator-runs.ccmp --runtime-id epiphany-operator-run-smoke --run-id smoke-run` for the focused proofs. Future local dream/status/Verse work should start from CultMesh, not raw CultNet, unless the task is polishing the CultMesh internals themselves. Preserve the three Verse tiers: `epiphany-internal` for private sub-agent typed state, `gamecult-local` for trusted LAN/Yggdrasil-tunnel GameCult sharing, and `epiphany-global` for untrusted public dreams plus topic-specific threaded public rooms for Face posts.

Binary file not shown.

View file

@ -546,5 +546,8 @@ current_status:
scaffolding only; it does not own Epiphany scheduler policy, prompt
authority, durable state, or future provider shape. The future Heimdall or
native tool-auth spine can replace this adapter without changing the
Epiphany-facing intent/receipt contract.
next_action: Continue Codex starvation and CultNet liberation by wiring the typed tool invocation intent/receipt path into the coordinator/runtime flow only where a real tool call is needed, while keeping the Codex MCP spine quarantined and replaceable.
Epiphany-facing intent/receipt contract. `epiphany-model-runtime` now
materializes complete MCP-shaped model tool calls as typed tool invocation
intents, and the Codex MCP spine can consume those intents from the mixed
runtime-spine store and emit typed success/failure receipts.
next_action: Continue Codex starvation and CultNet liberation by deciding the next loop owner for tool results: either a bounded coordinator action that executes pending tool intents and feeds reviewed `ToolResult` input back into a follow-up model turn, or a narrower operator-visible pending-tool review surface first.