Source walkthrough
OpenCode orchestrator source walkthrough: a sticky parent and explicit handoffs
Jev classifies the user turn; policy keeps a configured parent and can suggest a specialist tool. The distinction matters: an escalation hint is not an executed child task, and retaining a parent model is not a measured cache saving.
1. The hook sees bounded text, not the whole repository
The plugin entry loads configuration and creates hooks. chat.message skips internal child sessions and sessions with automatic routing off. Unmanaged, pinned models are left alone. For managed models it extracts non-synthetic user text, up to 16 KiB by default, and checks the model catalog and eligible tiers.
askJev sends request text, current parent tier, a context-token count and available tiers. One Choice selects fast/balanced/strong/long; three Score questions report task, reasoning and tool complexity. The routing state contains a token count, not the parent transcript or source files. File-only or empty usable text skips this route.
2. Stay, escalate and release depend on existing state
At the default minimum confidence of 0.3, a confident strong/long choice suggests escalation. Without an active strong child, missing, invalid or low-confidence Jev output stays on the parent. With an active strong child, a confident easy judgment releases it, a confident hard judgment continues escalation, and unavailable or unsure Jev also releases it. Explicit model overrides and parallel-intent rules take precedence.
The hook sets a managed request to the configured sticky parent and appends an escalation hint. The parent must actually call jev_escalate; the code records a missed hint on a later turn if it did not. An explicit user model override is an escape hatch that can change the parent. release calls clearStrongStreak: it clears local child tracking and the concurrency slot, rather than deleting or aborting a server session.
3. What the child receives and returns
jev_escalate selects an eligible strong model, then creates or resumes a child. The first handoff fetches up to 200 parent messages and formats them within a default 200,000-byte budget; old messages are removed first when oversized. File parts contribute names, tool output is clipped to 400 characters, and synthetic or ignored text is excluded. This is a selected transcript, not a complete repository snapshot.
A resumed strong child receives a delta based on the previous handoff’s message count. The tool sends the task, waits for idle (default child timeout 300 seconds) and returns the last assistant text with child/model/context metadata. Parallel children use the fast tier with parent-tier fallback, and the default concurrency cap is three. Check context completeness and delta behavior in long sessions before relying on the handoff.
4. Failure handling and version declarations
Default Jev settings are a 1,500 ms SDK timeout, one retry and a 3,000 ms abort deadline. Missing credentials, exceptions or a malformed model_tier answer return null and reach the state-dependent policy above. Catalog failure or no eligible sticky parent leaves the current request unchanged. Child creation, prompt or wait errors are returned as tool failure text; they are not a completed specialist answer.
This commit declares package 0.2.1, Node ≥22, SDK ^0.6.0, development plugin 1.18.31 and an optional plugin peer range ≥1.0.0. Those declarations do not establish compatibility with every host in that range. askJev does not pin a Jev model in its request or retain a served-model field in its result. Record the resolved dependency lockfile, host version and actual API model when testing version-specific claims.
What to measure before adopting this pattern
For a useful local check, mock Jev with hard/high-confidence, easy/high-confidence, low-confidence and null outputs, each with and without an active strong child. Separately verify that the parent obeys the hint, that the child receives required context, and that failed delegation recovers. Cache-read tokens, total tokens, quality and completed-task cost need a host-level comparison; model retention alone does not prove savings.
README checked on 2026-11-02; this fixed-commit source walkthrough was added on 2026-11-03. We have not run the plugin in OpenCode, called Jev for this review, or reproduced cache or cost savings. The transferable idea is a typed judgment feeding an explicit state machine with visible handoffs.