Agent Runtime Extension Points
Status: 2026-11-14, hooks updated 2026-11-16. Built: the roles context, skill, tool, model, guard, reviewer, observer and service; the optional interfaces InputGuard, ResultGuard,
Status: 2026-11-14, hooks updated 2026-11-16. Built: the roles context, skill, tool, model, guard, reviewer, observer and service; the optional interfaces InputGuard, ResultGuard, CompletionGuard, InputLister and Embedder (pkg/plugin/roles.go), and Rewriter, ToolNarrower, ModelGuard and StepGuard (pkg/plugin/rewrite.go, hookpoints.go, hook model); hook layers (policy.hooks), parallel gates and the observed-facts log (internal/host/engine/hookpoint.go, steps.go, internal/host/observed); manifest command hooks with Claude Code parity, P22 (internal/bundle/hooks.go, hookroles.go; reference: hooks); the Host checks and timeouts (internal/host/engine/hooks.go, guards.go, observe.go); and the agent config fields in plugins/agent/plugin.yaml. Proposed: P7, P8, P9, P11, P17, P18, P19, P20 and P21 of the proposal register; P39 and P40 are deferred until a consumer exists. The evidence is the research review of 2026-11-14. This is the complete surface through which plugins and the operator change what the Agent Runtime does.
1. Extension Forms
The agent has no extension registry of its own. A plugin extends it by declaring a role in plugin.yaml and being placed in the agent instance's uses; the operator extends it through the agent's config. In order of preference:
| Form | Declared by | Bound by | Host change to add one |
|---|---|---|---|
| Agent config field | config_schema in plugins/agent/plugin.yaml | The agent instance's config | No |
| A plugin with an existing role | roles: in the plugin's manifest | The agent's uses, the used instance's scope, exclude, grants, and the operator policy | No |
| A manifest command hook | hooks: in plugin.yaml (a guard without code) | As for the role | No (new events: bundle change) |
| An optional interface of a role | A Go interface in pkg/plugin/roles.go that a role implementation may also satisfy | As for the role | ADR |
A Caller or RuntimeHost method | pkg/plugin/roles.go | Every runtime | ADR |
| A new role | pkg/plugin/roles.go and KnownRoles in pkg/plugin/manifest.go | As for every role | ADR |
Identity and authority never come from a plugin: every role method receives the CallContext the Host filled, and each call is limited to the caller's uses. A process plugin implements the same interfaces over JSON-RPC (pkg/plugin/rpc); every new interface below also gets a JSON-RPC method and a conformance test.
2. Where Each Extension Acts in a Run
flowchart TB
A["Trigger decision start"] --> B["InputGuard.CheckInput"]
B --> C["Run start: Caller.Tools (pinned) · Caller.Skills<br/>Caller.ContextItems → ContextProvider.Context<br/>(Caller.Instructions: P9 · Caller.Subagents: P8)"]
C --> D["Each step: Caller.Chat → Model.Chat<br/>(Purpose: P20 · compaction: P5)"]
D --> E["Each tool call: agent allow/ask/deny<br/>Guard.Check (Ask: P17) · Reviewer.Review (PolicyHost: P18) · person<br/>Tool.Invoke · ResultGuard.CheckResult"]
E --> F["After the batch: (Caller.CheckStep: P7)<br/>(Caller.StepContext: P19)"]
F --> D
D --> G["Final answer: CompletionGuard.CheckCompletion<br/>(Withhold: P21)"]
G -->|feedback| D
G --> H["Result → the Host commits the run"]
H --> I["Observer.Observe run.finished<br/>(typed events, conversation grant: P11)"]Guards, reviewers and hooks act inside Caller.CallTool and the Host's input check, so they apply to every runtime, not only to plugins/agent. Context, skills, tools, models and (with P7, P9, P19) step checks, instructions and step context are what the agent asks for through Caller; a different runtime may ask for them or not.
3. Catalog of What Is Built
Timeouts are Host constants (contextTimeout, guardTimeout in internal/host/engine/hooks.go; checkTimeout, reviewTimeout in guards.go).
| Role or interface | Method | When | Power | Failure | Timeout |
|---|---|---|---|---|---|
context | ContextProvider.Context(cc, ContextInput) | Once at run start, through Caller.ContextItems | Adds reference items; cannot instruct | Omitted, context.provider_failed | 5 s |
skill | SkillSource.Skills, LoadSkill | Cards at run start; body and files on load_skill or $name | Adds cards and text; grants nothing | A list error leaves that instance out; a name offered twice is left out (skill.ambiguous) | — |
tool | Tool.Tools(cc), Invoke | Listed and pinned per run; invoked per call | Offers tools; a name offered by two instances is refused | Errors become error results for the model | Tool's own |
model | Model.Chat; optional InputLister, Embedder | Each step, through Caller.Chat; Caller.Embed | Produces responses and vectors | The run fails (P4 proposes fallback) | Run timeout |
guard | Guard.Check(cc, ToolIntent) | Before each tool call, for every instance in the call chain | Deny | Error or timeout denies | 5 s, or the instance's pre_tool hook timeouts + 1 s if longer |
guard + InputGuard | CheckInput(cc, ContextInput) | Before the runtime sees the input; guards in the runtime's uses | Refuse the run (input.denied) | Error or timeout refuses | 10 s, or the longest hook timeout + 1 s if longer |
guard + ResultGuard | CheckResult(cc, intent, res) | After each tool result, before the model sees it | Withhold the result or add a note; the ledger keeps the original | Error or timeout withholds | 10 s, or the longest hook timeout + 1 s if longer |
guard + CompletionGuard | CheckCompletion(cc, CompletionInput) | On each final answer, at most two rounds per run (maxChecks, plugins/agent/loop.go) | Feedback that asks for more work | Withholds the answer as not checked, guard.completion_failed (fail closed since 2026-11-18, the owner's decision) | 10 s, or the longest hook timeout + 1 s if longer |
reviewer | Reviewer.Review(cc, intent) | On a call that needs approval, before a person is asked | Approve, deny or escalate; needs grants: [review]; cannot approve a call whose approver is admin (since 2026-11-18, the owner's decision), only deny it | Escalates to a person | 30 s, or the longest hook timeout + 1 s if longer |
guard + Rewriter | Rewrite(cc, ToolIntent) | Before the gate phase of each tool call; a chain, runtime layer first, operator last | Replace the arguments with grants: [rewrite] (ADR 0005); the final ones are schema-checked, gated and approved | The call is refused | 5 s, or the longest hook timeout + 1 s if longer |
guard + ToolNarrower | FilterTools(cc, tools) | When a run lists its tools | Remove tools (intersection); a removed tool is refused | Ignored, guard.filter_failed | 10 s |
guard + ModelGuard | BeforeModel(cc, req), AfterModel(cc, req, resp) | Around each model call; a chain like Rewriter | Refuse the call; rewrite messages or response text with the rewrite grant | The call is refused | 10 s |
guard + StepGuard | CheckStep(cc, StepInput), asked through Caller.CheckStep | After a settled batch of tool calls, before the next model call | Add context (instruction from the operator layer) or stop the run | Skipped, guard.step_skipped | 10 s |
observer | Observer.Observe(ev, BackgroundHost) | After a fact is committed: run.finished, session.opened, session.closed, tool.finished, question.asked, question.settled, compaction.done, delivery.sent, delivery.failed (log observed_events) | Nothing; read only; unknown types ignored | Retried from a durable cursor; skipped after 8 failures (observer.event_skipped) | 2 min |
service | Service.Serve(BackgroundHost) | For the instance's lifetime | Its own work, e.g. indexing | Restarted with backoff, 1 s doubling to 5 min | — |
| Agent config field | Effect | Status |
|---|---|---|
model, name, instructions, timezone | Model instance and operator text | Built |
max_steps, max_tool_calls, max_output_tokens | Limits of the run (kernel) | Built |
allow, ask, deny | Tool name patterns for the agent's own permission rules | Built; argument rules P27 |
instructions_from, instructions_budget | Plugin instructions in the system prompt | P9 |
step_context_from | Instances asked for step context | P19 |
subagents, subagents_from | Child agent definitions for delegate | P8 |
compact_model, context_window, compact_at, compact_tail_tokens | Compaction (compaction) | P5 |
fallback_models | Models tried in order when the main model fails | P4 |
require_tools, skill_list_budget, skill_full_count, skill_full_tokens, skill_index_chars, edit_tool | Tools the agent needs, skill list size, when the skill list is full or an index (Feishu #426), edit tool form | P10, P13, Planned |
Command hooks. A manifest plugin's hooks: fill roles without code (P22, built 2026-11-16): pre_tool, post_tool, user_input, stop and subagent_stop the guard role, session_start the context role, pre_compact the observer role, and permission_request the reviewer role (only with grants: [review]; otherwise skipped and logged). They speak Claude Code's JSON protocol and run without a shell. Every matching hook runs in manifest order and answers merge deny > ask > allow; ask needs a person's approval; additionalContext from user_input becomes a context item of the run and from a non-blocking pre_tool a note on that call's result. Payloads carry session_id, cwd, tool_use_id, permission_mode and stop_hook_active. A hook times out after 10 s unless timeout is set, and the Host's bound grows with it; a failing hook denies unless on_error: ignore. The full protocol, order and merge rules are in hooks (TestHooksMergeAndAsk, TestContextAndStopEvents, TestReviewAndPreCompact, TestHookBudget).
4. The Permission Decision
flowchart LR
P["Tool call from the model"] --> R["Agent rules<br/>deny · ask · allow"]
R -->|ask| Q1["Question approve:key"]
R -->|allow| C
Q1 --> C["Caller.CallTool<br/>ledger · pin · depth"]
C --> G["Guard.Check, every guard in the chain<br/>allow < ask (P17) < deny"]
G --> A{"ToolSpec.Approval, instance approval,<br/>or a guard asked?"}
A -->|yes| V["Reviewer.Review, then a person"]
A -->|no| I
V --> I["Record started · Tool.Invoke"]
I --> RG["ResultGuard.CheckResult"]The decision forms the order allow < ask < deny, and every step can only raise it. The agent's deny removes a tool from the model's list; its ask asks before CallTool. Inside CallTool (internal/host/engine/toolcall.go), guards run before any approval, so nobody approves a call that will be denied. Granted reviewers decide first: any deny denies, approval needs every reviewer to approve, anything else goes to a person. The agent's rule and the Host's approval share the key approve:<call key>, so one call asks at most once. The arguments are fixed by the checkpointed model response, so an approval cannot outlive a change to them.
5. Proposals
5.1 P17: guard verdict ask
Built (ADR 0002): the fields below, the merge with the strictest approver, the prompt listing the asking guards, Ask as deny in input checks, and guard.asked (internal/host/engine/hooks.go, toolcall.go, TestGuardAsksForApproval). The question key is the Host's own host:approve:<call key>:<request digest> of D17.
type GuardDecision struct {
Deny bool `json:"deny"`
Ask bool `json:"ask,omitempty"` // P17: this call needs approval
Reason string `json:"reason,omitempty"` // to the approver; on deny, to the model
Approver string `json:"approver,omitempty"` // P17: "", "admin" or "any", as in ToolSpec
}- ◆Merge.
CallToolasks every guard in the chain, in order, and stops at the firstDeny. Otherwise anyAskmakes the call need approval exactly asToolSpec.Approvaldoes. The strictest approver wins, in the orderany< requester ("") <admin, across the asking guards and the tool's ownApprover. - ◆Question. One question with key
approve:<call key>; its prompt lists each asking guard as<instance>: <reason>above the arguments. Granted reviewers decide first.Askhas no meaning inCheckInputorCheckStepand is treated asDenythere. - ◆Failure. Unchanged: an error or the 5 s timeout denies.
- ◆Recovery. After a restart the call is re-entered from the ledger: guards run again (a guard that now denies denies), and the open question is found by its key, so a person is asked once.
- ◆Logging.
guard.askedwithinstance,tool,call_key.
5.2 P18: PolicyHost
Guards, reviewers, completion guards and step guards may need a model (a classifier, smart approval, a critic). Without P18 they bypass Host metering and uses.
// PolicyHost lets a policy role call a model while it decides.
type PolicyHost interface {
Chat(ctx context.Context, cc CallContext, model string, req ChatRequest) (ChatResponse, error)
}
// PolicyHostBinder is optionally implemented by guard and reviewer plugins.
type PolicyHostBinder interface{ BindPolicyHost(h PolicyHost) }- ◆Binding. Bound once when the instance starts; over JSON-RPC it is the host method
policy/chat, which carries the check's id. Existing guards compile unchanged. - ◆Limits.
modelmust be in the policy instance's ownuses. A call is accepted only while a check for thatccis in flight, otherwisepolicy.no_check. Per check: one model call forCheckandCheckStep, two forReviewandCheckCompletion;max_tokensat most 2,048; no tools; no streaming. Past that:policy.budget_exceeded. - ◆Metering. Usage counts against the run's
limits(tokens_per_run);ChatRequest.Purposeispolicy(P20), logged inmodel.called. - ◆Recovery. Policy calls have no side effects and are not in the ledger; an interrupted check is run again.
5.3 P7: StepGuard
type StepInput struct {
Step int `json:"step"` // 1-based step that just settled
Calls []StepCall `json:"calls"` // its settled calls, in call order
Usage Usage `json:"usage"` // run total so far
}
type StepCall struct {
Name string `json:"name"`
Provider string `json:"provider"`
Key string `json:"key"`
IsError bool `json:"is_error"`
Summary string `json:"summary"` // first 500 characters of the result the model saw
}
type StepDecision struct {
Deny string `json:"deny,omitempty"` // ends the run
Feedback string `json:"feedback,omitempty"` // a notice before the next step
}
type StepGuard interface { // optional, on the guard role
CheckStep(ctx context.Context, cc CallContext, in StepInput) (StepDecision, error)
}
// Caller.CheckStep(ctx, in StepInput) (StepDecision, error)- ◆When. The agent calls
Caller.CheckStepafter each tool batch, before the next model call. The Host asks the guards in the runtime'susesin order and stops at the firstDeny. - ◆Effect.
Denyends the run as failed with codeagent.step_deniedand the reason; the person gets the localized messageagent.step_denied.Feedbackfrom each guard (at most 2,000 characters each) is appended as one user-role message<orq:reminder source="<instance>" kind="step_feedback">…</orq:reminder>(reminders). - ◆Failure. An error or the 10 s timeout denies.
- ◆Recovery. The decision is stored in the checkpoint with its step number; a resumed run does not ask again for a settled step.
- ◆Command hook. A new
stepevent, mapped from Claude Code'sPostToolBatch:continue: falseordecision: "block"denies;reasonbecomesFeedbackwhencontinueis true.
5.4 P19: step context
Reference material after the run start (changed files, git state, memory for a new subtopic) without changing the prefix. Placement and token accounting are in Context; the interface is:
type ContextItem struct {
ID string `json:"id,omitempty"` // P19: stable per provider
Title string `json:"title,omitempty"`
Content string `json:"content"`
}
type StepContextInput struct {
Step int `json:"step"`
Calls []StepCall `json:"calls"` // the previous step's calls, as in P7
Known []ItemRef `json:"known,omitempty"` // items this provider already added in this run
}
type ItemRef struct {
ID string `json:"id"`
Digest string `json:"digest"` // sha256 of Content, hex
}
type StepContextProvider interface { // optional, on the context role
StepContext(ctx context.Context, cc CallContext, in StepContextInput) ([]ContextItem, error)
}
// Caller.StepContext(ctx, in StepContextInput) ([]ContextItem, error)- ◆Asked after each tool batch, only for instances listed in the agent's
step_context_from, in that order. - ◆Items are appended as one user-role message
<orq:reference>after the tool results, never inserted into the prefix. An item whose ID and digest equal a known one is dropped. - ◆3 s timeout and 4,000 characters per step for all providers together; a failure is omitted and logged
context.step_failed. - ◆Items are kept in the checkpoint; after a compaction the known items are sent once in full.
5.5 P9: InstructionSource
type Instruction struct {
ID string `json:"id"` // ^[a-z0-9][a-z0-9._-]{0,63}$, unique per instance
Text string `json:"text"` // at most 4,000 characters
}
type InstructionSource interface { // optional, on the context role
Instructions(ctx context.Context, cc CallContext) ([]Instruction, error)
}
// Caller.Instructions(ctx) ([]Instruction, error)config:
instructions_from:
- instance: org-style
required: false
instructions_budget: 8000 # characters, all sources together- ◆Only instances listed in
instructions_fromare asked, in that order; nothing else can add instructions. - ◆Read once, at the first step. The texts are stored in the checkpoint, so a resumed run sends a byte-identical system prompt. They should be stable across runs: a source whose text changes per run costs the prompt cache.
- ◆Placed as
# Instructions from <instance>sections after the operator'sinstructions; the system prompt says the operator's text wins where they conflict (system prompt). Over the budget, the last sources are dropped andagent.instructions_truncatedis logged. - ◆A source that fails or times out (5 s) is left out and logged
instructions.provider_failed; withrequired: truethe run fails withagent.instructions_missing.
5.6 P11: typed observed events and the conversation grant
Built 2026-11-16 in this form: the observed-facts log (internal/host/observed) with the types run.started, run.finished, model.called, tool.finished (named tool.called below), question.asked, question.settled, compaction.done (named run.compacted below), guard.denied, session.opened, session.closed, delivery.sent, delivery.failed (pkg/plugin/decisions.go); manifest events: (default run.finished plus the types the plugin's command hooks observe); the conversation grant, without which Input, Output, question prompts and guard reasons are empty. subagent.finished is not built.
| Type | Data |
|---|---|
run.started | {runtime, generation} |
run.finished | {state, err_code} (today's event) |
model.called | {model, purpose, usage, stop_reason, duration_ms, err_code} |
tool.called | {name, provider, key, outcome: ok|error|denied|withheld|unknown, duration_ms} |
question.asked, question.answered | {key, kind, status} |
run.compacted | {before_tokens, after_tokens, messages_removed, summary} |
subagent.finished | {agent, state, usage} |
guard.denied | {instance, stage: input|tool|step|completion, reason} |
user.forgotten | {user, tenant}: orquelo sessions forget ran for the user; it belongs to no run and reaches every observer that lists it, so a plugin erases what it derived from the person (built 2026-11-21, P105; the memory plugin removes the items they saved in conversation and shared scopes) |
- ◆Every event keeps the common fields of today's
ObservedEvent(ID,Type,RunID,Connection,Conversation,Principal) plusAtand a typedData json.RawMessage. An observer receives the types its manifest lists underevents:(default[run.finished]). - ◆Content fields (
Input,Output,summary, tool arguments and results) are filled only for observer instances with the operator grantgrants: [conversation]; otherwise they are empty. Today every observer getsInputandOutput, so this is a compatibility change in the ADR. The Memory plugin (P12) needs the grant. - ◆Delivery stays at least once from a durable cursor, with an ID that repeats on redelivery. There is no in-run streaming hook: progress goes to Presentation, and only committed facts are observed.
- ◆Run traces S3 (2026-11-21) adds the types
delivery.attempted{delivery, attempt, ok, error, dur_ms},output.presented{kind, dur_ms},progress.sent{ok, dur_ms},checkpoint.saved{}andattachment.fetched{name, ok, dur_ms}(run traces, section 10).tool.finishedgainsoutcome(ok,error,denied) andreason, and is also written for a call refused before it runs;guard.deniedgains the call'skeyand the stageresultfor a result a guard withheld. S4b addsroute.decided,context.provided,hook.decided(ask and rewrite),review.decidedandbackground.done, andsetup_msinrun.started; their data is listed inpkg/plugin/decisions.go. S7 lets runtimes and tools report the steps they run themselves through the optional host interfaceSpanReporter(host/report_spans); they are kept inreported_spans, not as facts. - ◆Run traces 4.2 (2026-11-28, Feishu #262) adds
model.retried{call, after_ms, error},run.recovered{attempt}andtool.replayed{key, tool, attempt}.
5.7 P21: withholding a final answer
type CompletionDecision struct {
Feedback string `json:"feedback,omitempty"`
Withhold string `json:"withhold,omitempty"` // P21: reason; the answer is not delivered
}Withhold beats Feedback and applies on every round, including the last. The run's final text is replaced by the localized notice agent.answer_withheld naming the guard; the original is kept nowhere: the answer is checked before it enters the history or the checkpoint, a resumed run returns the notice, and when RunInput.CompletionGuarded is set the runtime does not stream the answer before the check (changed 2026-11-17, Feishu report #35, review R06; the original used to stay in the checkpoint, from where recovery could return it). guard.withheld is logged without content. This is the same power ResultGuard has over tool results, so it only tightens. A stop command hook can return {"decision":"withhold","reason":"..."} (an Orquelo extension).
5.8 P22: command-hook parity with Claude Code
Built 2026-11-16, except the step event (waits for P7) and the 10,000-character cap per hook; the protocol as built is in hooks. cwd is the plugin directory: the Host does not know a run's workspace.
- ◆Payload. Add
cwd(the run's workspace when known, else the plugin directory),tool_use_id(needsToolIntent.Key),permission_mode: "default", andstop_hook_active(true from the second round; needsCompletionInput.Round). - ◆
additionalContext. Fromuser_inputit becomes a context item: the bundle also implementsContextProviderand returns the item held for that run. From a non-blockingpre_toolit becomes aResultDecision.Noteon the same call. At most 10,000 characters per hook (Codex spills above 2,500 tokens). - ◆
ask.permissionDecision: "ask"maps to P17. - ◆
step. The event of P7. - ◆Importer. A script using
updatedInputis reported as "ignored: arguments are not rewritten".
5.9 P8: sub-agent definitions and AgentSource
config:
subagents:
- name: reviewer # ^[a-z0-9][a-z0-9-]{0,63}$
description: Reviews a diff for bugs. # ≤ 1,024 chars, shown in the delegate tool
instructions: You review code ... # the child's operator text
tools: [read, grep, glob] # patterns within the parent's tools
model: openai # an instance in the parent's uses
skills: [code-review]
max_steps: 20
timeout: 10m
subagents_from: [team-agents] # instances whose AgentSource is offeredtype AgentCard struct{ Name, Description string }
type AgentDef struct {
Name, Description, Instructions string
Tools, Skills []string
Model string
MaxSteps int
Timeout time.Duration
}
type AgentSource interface { // optional, on the skill role
Agents(ctx context.Context, cc CallContext) ([]AgentCard, error)
LoadAgent(ctx context.Context, cc CallContext, name string) (AgentDef, error)
}
// Caller.Subagents(ctx) ([]AgentCard, error); Caller.LoadAgent(ctx, name) (AgentDef, error)- ◆Fixed rules. A child cannot
delegate, has noask_userand noSend; depth is 1; at most 4 children run at once per run, and one more is refused, not queued. A tool pattern beyond the parent's tools is a load error. - ◆Sources. Manifest plugins declare
agents:(Markdown with front matter); the importer converts Claude Codeagents/*.mdand Gemini CLI agent files. A name offered twice is left out, as for skills. - ◆Hooks. The child calls
ContextItemslike a run, so no start hook is needed.CompletionGuardruns on the child's answer withCompletionInput.Agentset (the counterpart ofSubagentStop);subagent.finishedis observed (P11).
5.10 P20: ChatRequest.Purpose
Purpose is one of step, final, compaction, subagent, policy, title. The Host logs it in model.called and may apply per-purpose limits (P18); a model plugin may ignore it. ModelInfo (context window, output limit, inputs, reasoning, prompt family) is in the LLM layer; extensions read it through Caller.ModelInfo.
5.11 Compaction surface (with P5)
- ◆No veto hook and no plugin compactor: a veto ends in context overflow. A custom summarizer is a
modelinstance named incompact_model. - ◆
run.compacted(P11) lets Memory learn what left the window. - ◆P9 instructions are unchanged by compaction; P19 known items are sent once in full afterwards.
5.12 Deferred: P40 and P39
- ◆P40, argument rewriting.
GuardDecision.Args json.RawMessage, honored only for guard instances withgrants: [rewrite]. Guards run inusesorder and each sees the previous rewrite; afterwards every guard runs once more on the final arguments, and a second rewrite denies. The ledger keeps the original and effective arguments, the approval shows the effective ones, and the result gets the notearguments changed by <instance>. No consumer yet (path normalization,--dry-runinjection). - ◆P39, model routing. Optional
Router.Route(cc, RouteInput{Purpose, Step, EstimatedTokens}) (instance string, error)on amodelplugin, whose targets must be in its ownuses;Caller.Chatresolves it once per call and records the chosen instance inmodel.called. Waits for P4.
6. Rules Every Extension Follows
- ◆Tighten only.
contextonly adds,guardonly restricts (deny, ask, withhold),revieweronly decides approvals and only withgrants: [review],observeronly reads. None can grant, relax another's decision, replace the system prompt or rewrite model output. - ◆Fixed per run. A run is pinned to its generation and its tool list to
run_tools(internal/host/broker/pin.go). Instructions (P9) and sub-agent cards (P8) are read once per run. - ◆Deterministic order. Instances are asked in
usesorder, for each instance in the call chain, each once. Install time and process start never decide. - ◆Scope decides presence. An instance whose
scopedoes not cover the run's principal and conversation is not asked;excludehides single tools and skills;policy.deny_toolsremoves tools everywhere. - ◆Bounded inputs and outputs. Each method gets only what it needs; no role receives the checkpoint, a credential or a handle to mutable state. Every text an extension returns has a character cap and every call a Host timeout.
- ◆Failure is fixed per point. Guards fail closed; context and instructions are omitted unless
required; reviewers escalate; completion checks are skipped; observers retry. - ◆Effects are tool calls. A plugin that needs a side effect during a run offers a tool, which goes through the ledger and approvals. Observers and services work through
BackgroundHostand their data directory. - ◆Recovery reuses records. Tool results come from the ledger by key; context items, instructions, step decisions, step context and completion feedback are in the checkpoint.
- ◆Builtin plugins are ordinary plugins, reached through the same roles and limits as process and manifest plugins.
7. Not Adopted
| Seen in | Point | Why not |
|---|---|---|
Pi, OpenCode, OpenClaw systemPrompt | Replace the system prompt per turn | Breaks the agent's rules and the cache; a different prompt is a different runtime plugin. P9 adds bounded sections |
| Gemini CLI, OpenCode, Hermes, Codex | Request, HTTP or stream interceptors; synthetic model responses | Vendor concerns belong in the model plugin; interceptors cannot cross the process boundary or be recovered |
| Hermes, Pi, Gemini CLI | Rewriting model output | The checkpointed response is the truth; P21 withholds |
OpenCode permission.evaluate, Crush hook allow, Claude Code allow | Plugins that relax a decision | Tighten only; automatic approval stays with reviewer and its grant |
Gemini CLI BeforeToolSelection union | Hooks that re-enable tools | Orquelo only narrows |
OpenClaw contextEngine slot | Replacing context assembly | The agent owns the layout (P5, P19); Memory is a plugin (P12) |
| Claude Code, Codex, Gemini CLI, Kimi CLI | SessionEnd (SessionStart is built as the session_start hook of the context role) | A session closes by idle rollover or /new, with no run to act in; committed facts reach observers as run.finished |
| Claude Code, Codex, Crush | PreCompact veto | A veto ends in overflow; the pre_compact hook (an observer) may only name facts to keep |
| Hermes, Pi | Per-delta stream observers | Progress is ephemeral and goes to Presentation |
Codex async, Claude Code HTTP hooks | Fire-and-forget or HTTP handlers | An observer covers asynchronous needs; an HTTP handler is a process plugin |
8. Alignment With Other Systems
Facts and citations are in the research review, topic "Extension points". Every surveyed system lets any one hook deny; all but Orquelo today let an extension raise a call to approval by its arguments, give policy a model, and add context after the turn start. Those are P17, P18 and P19.
| Hook in another system | Orquelo counterpart | What changes |
|---|---|---|
Claude Code/Codex PreToolUse, OpenClaw before_tool_call, Hermes pre_tool_call, Gemini CLI BeforeTool, Pi tool_call, OpenCode tool.execute.before, Crush/Kimi/OpenHands PreToolUse | Guard.Check with Deny or Ask (P17); hook pre_tool | No rewrite (P40 deferred); ask and requireApproval map to Ask |
Claude Code/Codex PermissionRequest, Codex approval contributor, Hermes smart approval, OpenHands analyzer | Reviewer.Review with PolicyHost (P18) | Approves only what rules and guards let through |
Claude Code/Codex UserPromptSubmit, OpenClaw before_agent_run | InputGuard.CheckInput; context via P22 | Refuse, not rewrite |
Claude Code PostToolBatch, Pi terminate/turn_end, Crush exit 49 | StepGuard (P7); hook step | Deny ends the run; feedback is a notice |
Codex world state, Pi context, Gemini CLI BeforeModel context | StepContextProvider (P19) | Append only, deduplicated by ID and digest |
Codex prompt slots and instruction providers, Hermes prompt sections, OpenClaw prepend/appendSystemContext | InstructionSource (P9) | Operator opt-in, bounded, frozen per run |
Claude Code/Codex PostToolUse, OpenClaw result middleware, Hermes transform_tool_result, Gemini CLI AfterTool | ResultGuard.CheckResult; hook post_tool | Withhold or note; the record is unchanged |
Claude Code/Codex Stop, OpenClaw before_agent_finalize, Hermes pre_verify, Pi agent_before_settle, OpenHands critic | CompletionGuard (feedback; P21 withhold) | Two rounds |
Claude Code/Codex SubagentStart, SubagentStop; OpenClaw sub-agent hooks | Child calls ContextItems; CompletionGuard on the child; subagent.finished (P8, P11) | No separate start hook |
Claude Code/Codex PreCompact/PostCompact, Hermes post_compaction, OpenCode/Pi compaction results | compact_model; run.compacted | No veto, no plugin compactor |
Codex PreModelRequest/PostModelRequest, Hermes pre/post_api_request, OpenClaw model_call_* | model.called with Purpose (P11, P20) | Observe only |
OpenClaw before_model_resolve, OpenCode model.resolve | fallback_models (P4); Router (P39) | By configuration or a routing model plugin |
Hermes transform_llm_output, redaction patterns | CompletionDecision.Withhold (P21) | Withhold, never rewrite |
| Notification and session-end hooks | observer (P11) | Observe only |
OpenClaw channel hooks (message_sending), Hermes gateway hooks | Trigger, Presentation and Delivery plugins | Not part of the Runtime |
The importer converts Claude Code PreToolUse, PostToolUse, UserPromptSubmit, Stop, SubagentStop, SessionStart, PreCompact and PermissionRequest hooks into manifest command hooks and adds the roles they fill (hooks). Others are reported as left out.
9. Built and Changing
| Item | Status |
|---|---|
| Roles, optional interfaces, command hooks, order, timeouts, failure policy | Built |
Guard ask | P17 (ADR) |
PolicyHost | P18 (ADR) |
StepGuard, Caller.CheckStep, hook step | P7 (ADR) |
Step context, ContextItem.ID | P19 (ADR) |
InstructionSource, instructions_from | P9 (ADR) |
Typed observed events, events:, grants: [conversation] | P11 (ADR) |
CompletionDecision.Withhold | P21 (ADR) |
Hook payload, additionalContext, ask; ToolIntent.Key, CompletionInput.Round | P22 (bundle; ADR for the fields) |
subagents, AgentSource | P8 (ADR for plugin definitions) |
ChatRequest.Purpose | P20 (ADR) |
| Argument rewriting, model routing | P40, P39, deferred |
10. Acceptance
Built, on macOS: TestGuardsAndReviewer, TestHooks, TestSkillCollisionsAreRefusedUntilExcluded, TestRunsKeepTheToolCatalogTheyStartedWith (internal/host/engine); TestCommandHooks, TestFailingHookDeniesUnlessIgnored, TestPathVariablesAndInstructions (internal/bundle); TestPermissionRules, TestContextItemsComeBeforeTheInput, TestCompletionFeedbackReopensTheTurn (plugins/agent); and the M6 zero-change acceptance (record).
Required for the proposals:
- ◆P17:
TestGuardAskRequiresApproval,TestGuardAskAndDenyDenies,TestGuardAskSurvivesRestart(one question after a restart). - ◆P18:
TestPolicyHostChatOnlyDuringCheck,TestPolicyHostUsageCountsAgainstRun,TestPolicyHostRespectsUses. - ◆P7: a deny ends the run with
agent.step_denied; an error denies; a restart between a step and its check asks once. - ◆P19: identical items are not re-sent; after compaction they are sent once in full; a resumed run does not ask for settled steps.
- ◆P9: only instances in
instructions_fromcontribute; arequiredfailure fails the run; a resumed run sends a byte-identical system prompt. - ◆P11: an observer without
grants: [conversation]gets empty content fields; a redelivered event keeps its ID. - ◆P21: a withheld answer is not delivered and the notice names the guard.
- ◆P22: an imported hook printing
permissionDecision: "ask"waits for approval;additionalContextfromuser_inputreaches the request as reference material. - ◆P8: a child cannot delegate or ask; a fifth concurrent child is refused.
- ◆Each new interface: a process-plugin conformance test over JSON-RPC. Linux and Windows need native runs; record for each whether the Host changed.