Extensionsdoc/{zh,en}/design/runtime/extension-points.md

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:

FormDeclared byBound byHost change to add one
Agent config fieldconfig_schema in plugins/agent/plugin.yamlThe agent instance's configNo
A plugin with an existing roleroles: in the plugin's manifestThe agent's uses, the used instance's scope, exclude, grants, and the operator policyNo
A manifest command hookhooks: in plugin.yaml (a guard without code)As for the roleNo (new events: bundle change)
An optional interface of a roleA Go interface in pkg/plugin/roles.go that a role implementation may also satisfyAs for the roleADR
A Caller or RuntimeHost methodpkg/plugin/roles.goEvery runtimeADR
A new rolepkg/plugin/roles.go and KnownRoles in pkg/plugin/manifest.goAs for every roleADR

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

mermaid
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 interfaceMethodWhenPowerFailureTimeout
contextContextProvider.Context(cc, ContextInput)Once at run start, through Caller.ContextItemsAdds reference items; cannot instructOmitted, context.provider_failed5 s
skillSkillSource.Skills, LoadSkillCards at run start; body and files on load_skill or $nameAdds cards and text; grants nothingA list error leaves that instance out; a name offered twice is left out (skill.ambiguous)—
toolTool.Tools(cc), InvokeListed and pinned per run; invoked per callOffers tools; a name offered by two instances is refusedErrors become error results for the modelTool's own
modelModel.Chat; optional InputLister, EmbedderEach step, through Caller.Chat; Caller.EmbedProduces responses and vectorsThe run fails (P4 proposes fallback)Run timeout
guardGuard.Check(cc, ToolIntent)Before each tool call, for every instance in the call chainDenyError or timeout denies5 s, or the instance's pre_tool hook timeouts + 1 s if longer
guard + InputGuardCheckInput(cc, ContextInput)Before the runtime sees the input; guards in the runtime's usesRefuse the run (input.denied)Error or timeout refuses10 s, or the longest hook timeout + 1 s if longer
guard + ResultGuardCheckResult(cc, intent, res)After each tool result, before the model sees itWithhold the result or add a note; the ledger keeps the originalError or timeout withholds10 s, or the longest hook timeout + 1 s if longer
guard + CompletionGuardCheckCompletion(cc, CompletionInput)On each final answer, at most two rounds per run (maxChecks, plugins/agent/loop.go)Feedback that asks for more workWithholds 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
reviewerReviewer.Review(cc, intent)On a call that needs approval, before a person is askedApprove, deny or escalate; needs grants: [review]; cannot approve a call whose approver is admin (since 2026-11-18, the owner's decision), only deny itEscalates to a person30 s, or the longest hook timeout + 1 s if longer
guard + RewriterRewrite(cc, ToolIntent)Before the gate phase of each tool call; a chain, runtime layer first, operator lastReplace the arguments with grants: [rewrite] (ADR 0005); the final ones are schema-checked, gated and approvedThe call is refused5 s, or the longest hook timeout + 1 s if longer
guard + ToolNarrowerFilterTools(cc, tools)When a run lists its toolsRemove tools (intersection); a removed tool is refusedIgnored, guard.filter_failed10 s
guard + ModelGuardBeforeModel(cc, req), AfterModel(cc, req, resp)Around each model call; a chain like RewriterRefuse the call; rewrite messages or response text with the rewrite grantThe call is refused10 s
guard + StepGuardCheckStep(cc, StepInput), asked through Caller.CheckStepAfter a settled batch of tool calls, before the next model callAdd context (instruction from the operator layer) or stop the runSkipped, guard.step_skipped10 s
observerObserver.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 ignoredRetried from a durable cursor; skipped after 8 failures (observer.event_skipped)2 min
serviceService.Serve(BackgroundHost)For the instance's lifetimeIts own work, e.g. indexingRestarted with backoff, 1 s doubling to 5 min—
Agent config fieldEffectStatus
model, name, instructions, timezoneModel instance and operator textBuilt
max_steps, max_tool_calls, max_output_tokensLimits of the run (kernel)Built
allow, ask, denyTool name patterns for the agent's own permission rulesBuilt; argument rules P27
instructions_from, instructions_budgetPlugin instructions in the system promptP9
step_context_fromInstances asked for step contextP19
subagents, subagents_fromChild agent definitions for delegateP8
compact_model, context_window, compact_at, compact_tail_tokensCompaction (compaction)P5
fallback_modelsModels tried in order when the main model failsP4
require_tools, skill_list_budget, skill_full_count, skill_full_tokens, skill_index_chars, edit_toolTools the agent needs, skill list size, when the skill list is full or an index (Feishu #426), edit tool formP10, 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

mermaid
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.

go
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. CallTool asks every guard in the chain, in order, and stops at the first Deny. Otherwise any Ask makes the call need approval exactly as ToolSpec.Approval does. The strictest approver wins, in the order any < requester ("") < admin, across the asking guards and the tool's own Approver.
  • ◆Question. One question with key approve:<call key>; its prompt lists each asking guard as <instance>: <reason> above the arguments. Granted reviewers decide first. Ask has no meaning in CheckInput or CheckStep and is treated as Deny there.
  • ◆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.asked with instance, 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.

go
// 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. model must be in the policy instance's own uses. A call is accepted only while a check for that cc is in flight, otherwise policy.no_check. Per check: one model call for Check and CheckStep, two for Review and CheckCompletion; max_tokens at most 2,048; no tools; no streaming. Past that: policy.budget_exceeded.
  • ◆Metering. Usage counts against the run's limits (tokens_per_run); ChatRequest.Purpose is policy (P20), logged in model.called.
  • ◆Recovery. Policy calls have no side effects and are not in the ledger; an interrupted check is run again.

5.3 P7: StepGuard

go
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.CheckStep after each tool batch, before the next model call. The Host asks the guards in the runtime's uses in order and stops at the first Deny.
  • ◆Effect. Deny ends the run as failed with code agent.step_denied and the reason; the person gets the localized message agent.step_denied. Feedback from 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 step event, mapped from Claude Code's PostToolBatch: continue: false or decision: "block" denies; reason becomes Feedback when continue is 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:

go
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

go
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)
yaml
config:
  instructions_from:
    - instance: org-style
      required: false
  instructions_budget: 8000   # characters, all sources together
  • ◆Only instances listed in instructions_from are 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's instructions; the system prompt says the operator's text wins where they conflict (system prompt). Over the budget, the last sources are dropped and agent.instructions_truncated is logged.
  • ◆A source that fails or times out (5 s) is left out and logged instructions.provider_failed; with required: true the run fails with agent.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.

TypeData
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) plus At and a typed Data json.RawMessage. An observer receives the types its manifest lists under events: (default [run.finished]).
  • ◆Content fields (Input, Output, summary, tool arguments and results) are filled only for observer instances with the operator grant grants: [conversation]; otherwise they are empty. Today every observer gets Input and Output, 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 {} and attachment.fetched {name, ok, dur_ms} (run traces, section 10). tool.finished gains outcome (ok, error, denied) and reason, and is also written for a call refused before it runs; guard.denied gains the call's key and the stage result for a result a guard withheld. S4b adds route.decided, context.provided, hook.decided (ask and rewrite), review.decided and background.done, and setup_ms in run.started; their data is listed in pkg/plugin/decisions.go. S7 lets runtimes and tools report the steps they run themselves through the optional host interface SpanReporter (host/report_spans); they are kept in reported_spans, not as facts.
  • ◆Run traces 4.2 (2026-11-28, Feishu #262) adds model.retried {call, after_ms, error}, run.recovered {attempt} and tool.replayed {key, tool, attempt}.

5.7 P21: withholding a final answer

go
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 (needs ToolIntent.Key), permission_mode: "default", and stop_hook_active (true from the second round; needs CompletionInput.Round).
  • ◆additionalContext. From user_input it becomes a context item: the bundle also implements ContextProvider and returns the item held for that run. From a non-blocking pre_tool it becomes a ResultDecision.Note on 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 updatedInput is reported as "ignored: arguments are not rewritten".

5.9 P8: sub-agent definitions and AgentSource

yaml
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 offered
go
type 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 no ask_user and no Send; 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 Code agents/*.md and Gemini CLI agent files. A name offered twice is left out, as for skills.
  • ◆Hooks. The child calls ContextItems like a run, so no start hook is needed. CompletionGuard runs on the child's answer with CompletionInput.Agent set (the counterpart of SubagentStop); subagent.finished is 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 model instance named in compact_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 with grants: [rewrite]. Guards run in uses order 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 note arguments changed by <instance>. No consumer yet (path normalization, --dry-run injection).
  • ◆P39, model routing. Optional Router.Route(cc, RouteInput{Purpose, Step, EstimatedTokens}) (instance string, error) on a model plugin, whose targets must be in its own uses; Caller.Chat resolves it once per call and records the chosen instance in model.called. Waits for P4.

6. Rules Every Extension Follows

  • ◆Tighten only. context only adds, guard only restricts (deny, ask, withhold), reviewer only decides approvals and only with grants: [review], observer only 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 uses order, for each instance in the call chain, each once. Install time and process start never decide.
  • ◆Scope decides presence. An instance whose scope does not cover the run's principal and conversation is not asked; exclude hides single tools and skills; policy.deny_tools removes 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 BackgroundHost and 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 inPointWhy not
Pi, OpenCode, OpenClaw systemPromptReplace the system prompt per turnBreaks the agent's rules and the cache; a different prompt is a different runtime plugin. P9 adds bounded sections
Gemini CLI, OpenCode, Hermes, CodexRequest, HTTP or stream interceptors; synthetic model responsesVendor concerns belong in the model plugin; interceptors cannot cross the process boundary or be recovered
Hermes, Pi, Gemini CLIRewriting model outputThe checkpointed response is the truth; P21 withholds
OpenCode permission.evaluate, Crush hook allow, Claude Code allowPlugins that relax a decisionTighten only; automatic approval stays with reviewer and its grant
Gemini CLI BeforeToolSelection unionHooks that re-enable toolsOrquelo only narrows
OpenClaw contextEngine slotReplacing context assemblyThe agent owns the layout (P5, P19); Memory is a plugin (P12)
Claude Code, Codex, Gemini CLI, Kimi CLISessionEnd (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, CrushPreCompact vetoA veto ends in overflow; the pre_compact hook (an observer) may only name facts to keep
Hermes, PiPer-delta stream observersProgress is ephemeral and goes to Presentation
Codex async, Claude Code HTTP hooksFire-and-forget or HTTP handlersAn 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 systemOrquelo counterpartWhat 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 PreToolUseGuard.Check with Deny or Ask (P17); hook pre_toolNo rewrite (P40 deferred); ask and requireApproval map to Ask
Claude Code/Codex PermissionRequest, Codex approval contributor, Hermes smart approval, OpenHands analyzerReviewer.Review with PolicyHost (P18)Approves only what rules and guards let through
Claude Code/Codex UserPromptSubmit, OpenClaw before_agent_runInputGuard.CheckInput; context via P22Refuse, not rewrite
Claude Code PostToolBatch, Pi terminate/turn_end, Crush exit 49StepGuard (P7); hook stepDeny ends the run; feedback is a notice
Codex world state, Pi context, Gemini CLI BeforeModel contextStepContextProvider (P19)Append only, deduplicated by ID and digest
Codex prompt slots and instruction providers, Hermes prompt sections, OpenClaw prepend/appendSystemContextInstructionSource (P9)Operator opt-in, bounded, frozen per run
Claude Code/Codex PostToolUse, OpenClaw result middleware, Hermes transform_tool_result, Gemini CLI AfterToolResultGuard.CheckResult; hook post_toolWithhold or note; the record is unchanged
Claude Code/Codex Stop, OpenClaw before_agent_finalize, Hermes pre_verify, Pi agent_before_settle, OpenHands criticCompletionGuard (feedback; P21 withhold)Two rounds
Claude Code/Codex SubagentStart, SubagentStop; OpenClaw sub-agent hooksChild 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 resultscompact_model; run.compactedNo 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.resolvefallback_models (P4); Router (P39)By configuration or a routing model plugin
Hermes transform_llm_output, redaction patternsCompletionDecision.Withhold (P21)Withhold, never rewrite
Notification and session-end hooksobserver (P11)Observe only
OpenClaw channel hooks (message_sending), Hermes gateway hooksTrigger, Presentation and Delivery pluginsNot 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

ItemStatus
Roles, optional interfaces, command hooks, order, timeouts, failure policyBuilt
Guard askP17 (ADR)
PolicyHostP18 (ADR)
StepGuard, Caller.CheckStep, hook stepP7 (ADR)
Step context, ContextItem.IDP19 (ADR)
InstructionSource, instructions_fromP9 (ADR)
Typed observed events, events:, grants: [conversation]P11 (ADR)
CompletionDecision.WithholdP21 (ADR)
Hook payload, additionalContext, ask; ToolIntent.Key, CompletionInput.RoundP22 (bundle; ADR for the fields)
subagents, AgentSourceP8 (ADR for plugin definitions)
ChatRequest.PurposeP20 (ADR)
Argument rewriting, model routingP40, 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_from contribute; a required failure 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; additionalContext from user_input reaches 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.