Agent runtime
The provider-agnostic agent kernel (packages/agent-runtime) — runAgentLoop, ToolDefinition/ToolRegistry, the envelope + consent gates, sub-agents, MCP bridging. Use when editing packages/agent-runtime or the agent kernel's contracts.From its SKILL.md
npx -y skills add everdict/everdict --skill agent-runtimeAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 2 stars2 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
5.4 KB, as published. Nobody here has run it
Agent runtime (the kernel)
packages/agent-runtime is the agent LOOP — transport-driven turns over a ToolRegistry, with the
ownership-protocol gates enforced per tool call. Depends on @everdict/contracts (+ @everdict/llm)
ONLY — never @everdict/domain; a decision the kernel needs lives in contracts (the isMeasured
precedent: authorizeToolInvocation, budgetExhausted, effectsRequireConsent).
Checklist
- The kernel executes decisions, never re-derives them (foundation conventions: one invariant, one
owner). The envelope scope gate is
authorizeToolInvocation(tool, envelope)— reads checkscope.reads("all" = executor posture), writes checkscope.writes,forbiddenbeats both; the loop consumes the answer verbatim. Do NOT add a kernel-side interpretation of the scope (that is exactly howallowedCapabilitiessilently narrowed to writes-only once). - Kernel cognition tools are
intrinsic(todo, plan, spawn, result paging, wait): part of how the agent thinks, exempt from reads/writes scope, still refusable viaforbidden. Mark them with theintrinsic(...)wrapper at registry merge — a workspace capability is NEVER intrinsic. - readOnly ≠ safe-without-consent. The permission hook fires for writes OR for a read whose declared
effectsrequire consent (effectsRequireConsent— external egress is exfiltration-shaped). Plain reads stay ungated (the senses).PermissionRequest.isReadOnlycarries the REAL access kind. The annotation derives from what the HANDLER DOES — never from the RBAC action.runs:readsays who may CALL; it does not makeexec_in_run(a shell in the live container) a read. Deriving readOnlyHint from the authz action mislabeled 8 mutating tools as promptless, plan-mode-transparent, auto-retried and concurrency-grouped reads (mcp.test.ts's effect-annotations guard pins them). Named deferral: credentialed-egress READS (github/mattermost/trace-source/image-registry reads that ship workspace-held tokens outbound) are honest reads but exfiltration-shaped — base-tooleffectsdeclarations are the follow-up sweep. A base tool's access is DECLARED, not inferred: every control-plane MCP handler gates on an Action string, and registration surfaces it asannotations.readOnlyHint— the agent bridge consumes the declaration first (baseToolReadOnly) and the name-prefix classifier is the compatibility FALLBACK only (the minting-read blacklist is the standing proof names carry no authority). External workspace servers' annotations are self-claims and are NOT trusted for gate-skipping. An UNDECLARED remote MCP read is not a plain read: the transport being an external endpoint is a structural fact, so the bridge synthesizes{dataAccess: {egress: "external"}}for a remote read-only server with no declaration (bridgedEffectsFor, apps/agent mcp-tools) — the author's own declaration always wins, stdio (local) servers synthesize nothing. - Sub-agents shrink, never escape: the child registry = the parent's read-only tools ∩ the parent's own scope, and the parent's envelope binds the child verbatim (per-run budgets re-count from zero).
- A halt owes a handoff.
budget_exhausted(and an armedwaiting) settle as SUSPENDED — never completed; the host publishes the checkpoint and reports the handoff's actual fate (published|failed|absent). See docs/architecture/ownership-protocol.md. - Tool results feed back as
toolmessages; large results offload through the ResultStore and page viaread_tool_result. MCP-bridged tools defaultisReadOnly: trueand validate on the server side. - "This run performs no effects" is
ExecutionMode, enforced at the INVOCATION point — never a host permit hook answering deny. The permit gate is consulted only for writes/consent-requiring reads, so a hook cannot bound a run whose read-only flags come from a third party (an external server'sget_or_create_*walked through a shadow try and filed a ticket).mode: {kind:"shadow", executableReads}invokes ONLY the host-ATTESTED first-party reads (ToolSession.attestedReadsin apps/agent: the control plane's own catalog + tools built in-process; never a workspace server's, nevercode__*) plus intrinsic kernel cognition; everything else is captured —shadow_intentevent + ashadow_deniedtool_result — and the mode binds sub-agents like the envelope does. Absent = live, byte-identical to before. - A withheld call is not a successful one. Downstream evidence (
tool_result.okin an ingested trace) comes from the kernel'stool_resultevent (isError/outcome), never from reading the result text; where a transcript carries no attribution, match the kernel's exported refusal constants (isKernelRefusal) rather than a guessed"Error"prefix — the kernel owns the wording and both ends move together.
SSOT: docs/architecture/ownership-protocol.md (envelope/checkpoint/effect contracts) +
docs/architecture/agent-automation.md (activation) + rule .claude/rules/events.md (facts).