IronClaw architecture proposal

Capability response normalization

One existing runtime outcome, one central processor, fewer wrappers, safe protocol defaults, and additive persistence—without credential probing or new lifecycle states.

Proposed · 2026-08-14

One response is transformed too many times

Transport is already mediated and final model output is already hardened. The unnecessary complexity is the chain of wrappers and repeated matches between dispatch and the runtime outcome.

RuntimeAdapterResult / DispatchError
                    │
                    ▼
        CapabilityDispatchResult
                    │
                    ▼
CapabilityInvocationResult / CapabilityInvocationError
                    │
                    ▼
 completion helpers / translation helper / resume-specific matches
                    │
                    ▼
        RuntimeCapabilityOutcome
Current execution pathRed marks information loss
Capability callAuthorized, approved, and resource-scoped
Credential presenceMissing credentials raise a preflight auth gate
Runtime selectionWASM · MCP · first-party · ToolAdapter
Mediated transportBounded egress with host-side credential injection
↓
WASM conventionGuest returns optional output/error strings; host reparses JSON hidden in the error string
MCP blind spotJSON-RPC result is success even when CallToolResult.isError is true
First-party mappingEach handler maps status, body, auth, and diagnostic independently
ToolAdapter mappingTyped result/error, but auth and ordinary failure carry different diagnostic shapes
↓
Shared success pathRuntimeAdapterResult, resource accounting, output obligations
Parallel failure pathsDispatchError mixes provider outcomes with runtime failures
Runtime outcomeCompleted, Failed, AuthRequired, or another gate
Model projectionSecret scrub, control normalization, injection fence
Incorrect or lossy seam Duplicated interpretation Existing trusted boundary Existing shared behavior
WASM

Weak final ABI

Provider packages encode structured errors into strings because the WIT response has no typed outcome.

MCP

Protocol error as success

The JSON-RPC envelope is parsed, but the semantic CallToolResult error bit is not.

First-party

Per-handler policy

Useful details depend on which helper or handler happened to map the response.

ToolAdapter

Closest existing shape

Typed errors exist, but provider rejection, auth, and infrastructure are still not one semantic vocabulary.

Root cause

IronClaw already has the right runtime-neutral outcome. The defect is that no single owner constructs it, so success, auth, and failure are repeatedly renamed and reclassified.