Repository navigation
Conversation
…ever a turn count
Add a PURE-TYPESCRIPT OpenCode plugin that monitors agent (subagent/session) progress
from the TRANSCRIPT, and a three-layer gate for it.
WHY (RCA). An orchestrator monitors subagents badly: turn counts, "idle", vibes. A
"message" count is an ASSISTANT-TURN count (`session_message` rows with
`type='assistant'`), NOT progress — counting turns penalises an agent for WORKING. A
measured session was rotated for "79 messages / no artifact": it was 74 assistant turns
with `shell`/`read`/`write` firing ~73x each over ~37 min — it was reading, writing, and
running its task.
WHAT. `.opencode/plugins/agent-progress.ts` registers the `agent_progress` tool. It
reads the opencode store READ-ONLY (bun:sqlite `{readonly:true}` on the shipped runtime;
node:sqlite `{readOnly:true}` on plain node) and reports, per session: id + title/slug;
turns, span (first->last), last-turn/last-event age; the tool mix; the LAST action
(text/reasoning snippet + the last tool + its input); artifact hints (owner/repo#N,
`gh pr merge`, `merged`, v... tags, `pushed`); and a VERDICT — WORKING (recent turns +
tool cadence) / IDLE (no turns past the window and no artifact) / LOOP (the same
tool+input repeated, no artifact) / DONE (a final report, no pending action). It is
async, `context.signal`-aware, and fails CLEARLY (never fabricates).
The schema is VERIFIED against the live store (opencode v2.0.18): `session_v2` +
`session_message`; there is NO `session` table. Path:
`$XDG_DATA_HOME/opencode/opencode.db` (~/.local/share fallback; `OPENCODE_DB` override).
PURE TS — no `.sh`, no spawnSync, no `marketplace` pin (operator directive, #302).
GATE. `scripts/check-agent-progress.mjs`: (A) static — no `.sh`/spawnSync/Bun.spawn,
read-only both drivers, the documented path; (B) unit — the classifier including the RCA
regression (a 75-turn, tool-heavy, recent transcript is WORKING, NOT stalled) plus a REAL
read-only SQLite fixture; (C) LIVE_OPENCODE=1 drives the real binary and calls the tool
(live-or-skip, visibly). Wired into `charly task verify`.
DOCS. `.opencode/instructions.md` (the mechanism + the verified schema), the umbrella
`AGENTS.md` Skill Dispatcher row (monitoring a subagent / is it stalled / rotate or take
over -> agents), and the `agents` skill source (layer-charly-internals) gain an OpenCode
"how to monitor agent progress" section.
Review — BLOCKHead SHA: Change class: code/config — a new opencode plugin ( Security screen: PASS (no secrets/exfil, no network egress, no new deps, no weakened gate; the added Blocks
Verdict: BLOCK ollama-cloud/deepseek-v4.1-flash — action-review. |
… unprovable charly.yml step Review round 1 (#310, opencharly/.github#150): - B14a dead surface: remove the zero-caller `KNOWN_TOOLS` export; render `userTurns` as `briefs N` in the report (it was computed and never read); WIRE the schema-declared `all` boolean — `all: false` now restricts the set to ROOT sessions (no `parent_id`) instead of silently doing nothing. The gate asserts the `all:false`/`all:true` split. - Drop the `charly.yml` verify task addition: the umbrella tree gate cannot execute in a worktree (submodules unpopulated) and the file's operability is another session's scope (#306 / merged #309). The gate is run directly (`node scripts/check-agent-progress.mjs`).
Review — BLOCKHead SHA: Change class: code/config — a new opencode plugin ( Blocks
Prior comment disposition — the single round-1 Verdict: BLOCK ollama-cloud/deepseek-v4.1-flash — action-review. |
B14a: `SQL.lastEvent` (zero callers — `lastEventAgeMs` is derived from the fetched rows) and the unread `ToolCall.turn`/`ToolCall.time` fields are removed; the gate's `mkCall` fixture drops them too. `node scripts/check-agent-progress.mjs` stays green (65 PASS).
|
STATUS This scope is duplicated. A sibling session (
The two branches conflict by construction (same files, same locations); only one can land as-is. Recommendation: close #310 (and #150/#64) as superseded by #313 (the superset), which carries the monitor lineage AND the control half the parent asked for ( BLOCKS the merger in one respect: the two are not additive — one must be chosen. No action is required on #310's branch from this session (rule 9); this is a STATUS to route the decision. Agent: Agent: |
Review — BLOCKHead SHA: Change class: code/config — a new opencode plugin ( Security screen: PASS (no secrets/exfil, no network egress, no new deps, no weakened gate; the new gate is additive and the Blocks
Comment dispositions
Verdict: BLOCK ollama-cloud/deepseek-v4.1-flash — action-review. |
|
RESOLVED — superseded by #313. This PR is closed, not merged: the same scope is carried by the superset Why this is a clean supersession, not a loss of work:
The maintainer-account STATUS on this PR ( Companion legs: this PR → Agent: |
Summary
Add a pure-TypeScript OpenCode plugin that monitors agent (subagent/session) progress
from the TRANSCRIPT, plus a three-layer gate — the
agent_progresstool implementingthe "monitor by artifact + cadence, never a turn count" model the rulebook mandates.
The problem. An orchestrator monitors subagents badly: turn counts, "idle", vibes.
A "message" count is an assistant-turn count (
session_messagerows withtype='assistant'), NOT progress — counting turns penalises an agent for WORKING.The measured RCA (umbrella #305/#308): a session rotated for "79 messages / no artifact"
was 74 assistant turns with
shell/read/writefiring ~73× each over ~37 min — itwas reading, writing, and running its task.
The monitor.
.opencode/plugins/agent-progress.tsregisters theagent_progresscustom tool. Per session it reports: id + title/slug; turns, span (first→last),
last-turn / last-event age; the tool mix; the last action (the text/reasoning
snippet + the last tool + its input); artifact hints (
owner/repo#N,gh pr merge,merged,v…tags,pushed); and a VERDICT:≥4×in the tail), no artifact;finish=stop), no pending action.Rotate/take over ONLY on >2 orchestrator re-briefs of the same task, idle-past-window
with no artifact, or a loop — never on turn count.
Data source (VERIFIED, not assumed). The opencode store is a SQLite DB at
$XDG_DATA_HOME/opencode/opencode.db(~/.local/sharefallback;OPENCODE_DBoverride).The live schema is
session_v2+session_message— there is NOsessiontable(verified against opencode v2.0.18). It is read read-only:
new Database(path, { readonly: true })underbun:sqlite(the shipped runtime),new DatabaseSync(path, { readOnly: true })undernode:sqlite(plain node / the gate) —never a write, never a mock.
PURE TS — no
.sh, nospawnSync, nomarketplacepin (operator directive;#302). Also: the mechanism in
.opencode/instructions.mdand theumbrella
AGENTS.mddispatcher row (monitoring a subagent / "is it stalled" /rotate-or-take-over →
/charly-internals:agents). Theagentsskill SOURCE is updated inopencharly/layer-charly-internals#64.Review round 2 — fixed in
9887a76SQL.lastEvent(zero callers;lastEventAgeMsis derived from the fetched rows) and the unreadToolCall.turn/ToolCall.timefields (plus the gate'smkCallfixture). A zero-caller self-audit overevery export now reports none, and the gate stays green.
Review round 1 — all three blocks fixed in
fb3076aKNOWN_TOOLSexport;userTurnsis nowrendered (
briefs Nin the report, so it is read); the schema-declaredallboolean is now wired (
all: falserestricts the set to ROOT sessions — noparent_id), with a gate assertion for theall:false/all:truesplit.charly.yml— theverify:step is dropped from this PR. The umbrellatree gate cannot execute in a linked worktree (submodules are unpopulated there), and
the file's operability was another session's scope (umbrella charly.yml cannot load: version stamp dropped by 803d411 but the loader requires it #306, fixed by merged fix(charly.yml): restore the version: stamp the pinned loader requires (unblocks sync #297) #309). The
gate is run directly instead (pasted below), and
charly.ymlis not in the net diff.How tested
All commands executed on head
00ca915fd4307d001fc6edff41cf0e32dd2d4d1a(the mergehead after
gh pr update-branchfor #311), in.worktrees/agent-progress/opencharly/.Net diff:
The gate —
(A)static,(B)unit + a REAL read-only SQLite fixture,(C)live:The
(C)LIVE layer on this head — the realopencodev2.0.18 binary, the real store:The exact
agent_progressoutput for a real session on this head (plainnode,driver node:sqlite— a completed subagent, classifiedDONE):The
(C)LIVE layer re-run on the merge head00ca915f(realopencodev2.0.18 + real store):The
all:falsewiring, on a real store where a child session exists:The four sibling opencode gates still pass on this head, so the new plugin changes no
shared file:
Rulebook compliance
/charly-internals:git-workflow,/charly-internals:agents,/charly-internals:skillsand/charly-internals:marketplaceloaded from the pinnedmarketplace before any edit;
opencode.ai/v2/docs/build/pluginsread.stall signal) and pinned as a regression assertion in the gate.
9887a76/fb3076a), no deferral.rulebook's artifact/cadence model, it applies it and surfaces the evidence.
binary against the real store; the unit layer uses a real read-only SQLite file.
feat/branch + PR; no force-push;git statuschecked before staging.run as
node scripts/check-agent-progress.mjs.charly task verifycannot be run fromthis linked worktree (submodules are unpopulated), and it is unrelated to this diff
(no gitlink changed); the root
charly.ymloperability defect (umbrella charly.yml cannot load: version stamp dropped by 803d411 but the loader requires it #306) is fixed by mergedfix(charly.yml): restore the version: stamp the pinned loader requires (unblocks sync #297) #309.
LIVE_OPENCODE=1and SKIPs visibly whenunset (never a silent pass); no mock of the opencode or SQLite boundary.
00ca915fbefore the push; the mergehead only brought docs(agents)!: responsibilities (main session vs subagent) + subagent lifecycle (instruct/use/monitor) #311's docs in (no conflicting hunk).
touched; the work is on
feat/agent-progressin.worktrees/agent-progress/.Change classification
AGENTS.mdprose) — NOTdocumentation-only;
documentation reviewedis not claimed.scripts/check-agent-progress.mjs(A/B/C), green on the finaltree, plus the four sibling opencode gates green.
analysed on a live system— the changed runtime path (the plugin)ran live against the real store and the real binary with retained output; the full
charly task verifydid not run (worktree; unrelated to this diff).Agent:
agent-progress-monitor· sessionses_f13f9137cffewtTZQkScc7eREEAssisted-by: OpenCode ollama-cloud/deepseek-v4.1-flash (analysed on a live system)