Skip to content
Back to skills

Rule Daemon Run State

ASecurity

Runs and runtime columns — run, node-state and call-context columns, call clock and membership, wall work, payload refs. A repository rule for apps/daemon/src/v1/runs/**, apps/daemon/src/v1/agents/dao/**, apps/daemon/src/v1/agents/**/run-group*, apps/daemon/src/v1/agents/**/run-hold*, apps/daemon/src/v1/agents/**/run-context*, apps/daemon/src/v1/agents/**/item-call-index*, apps/daemon/src/v1/agents/**/payload-refs*, apps/daemon/src/v1/agents/**/wall-work*, apps/daemon/src/v1/agents/**/call-*,...

  • 8 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added November 17, 2026
ai-agentsgoshellsqlnodeaws

Works with

  • terminal
  • cli

Security analysis

A100/100

Scanned December 4, 2026

npx -y skills add geniro-io/geniro-app --skill rule-daemon-run-state --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Rule Daemon Run State?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Rule Daemon Run State
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/geniro-io-rule-daemon-run-state/badge)](https://www.skillsdirectory.com/skills/geniro-io-rule-daemon-run-state)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: rule-daemon-run-state
description: "Runs and runtime columns — run, node-state and call-context columns, call clock and membership, wall work, payload refs. A repository rule for apps/daemon/src/v1/runs/**, apps/daemon/src/v1/agents/dao/**, apps/daemon/src/v1/agents/**/run-group*, apps/daemon/src/v1/agents/**/run-hold*, apps/daemon/src/v1/agents/**/run-context*, apps/daemon/src/v1/agents/**/item-call-index*, apps/daemon/src/v1/agents/**/payload-refs*, apps/daemon/src/v1/agents/**/wall-work*, apps/daemon/src/v1/agents/**/call-*, apps/daemon/src/v1/agents/**/collapse-image-blocks*, apps/ui/src/renderer/chats/call-clock*, apps/daemon/src/v1/agents/**/run-teardown*, apps/daemon/src/v1/agents/**/run-kind*, apps/daemon/src/v1/agents/**/item-seq*, apps/daemon/src/v1/agents/**/chat-history*; read it before editing a file there."
---
<!-- GENERATED by scripts/sync-agent-rules.mjs from .claude/rules/daemon-run-state.md. DO NOT EDIT: edit the source, then run `pnpm sync:agent-rules`. -->

# Runs and runtime columns

- `run_groups` (sidebar folders) are runtime state in SQLite, not YAML.
- Context readings (`Run.contextTokens` / `contextWindowTokens`, `NodeState`, `CallContext`) are LEVELS: a reading that omits a figure never clears it; a compaction clears it (`RunDao.forgetContext`).
- `CallContextDao` inserts only while the calling node still has a `node_state` row (an insert after teardown would orphan a row).
- `workedMs` / `toolCalls` are TOTALS, written by real increments (`NodeStateDao.rememberWork`), never a read-modify-write. The `node_state` / `runs` column holds the CLI-reported time only. Delegate tool calls (`parentToolUseId`) are not counted. A node turn's tools are added however it ends: at `turn_complete`, else when the turn finishes (error, cancel, or an exit with no terminal).
  - The member total is the agent's whole run. A call card draws its CONVERSATION's tools instead: the members route's `callFigures[].toolCalls`, counted from the rows (`ItemDao.ownToolCallsByCall`, after `ensureIndexed`) with `toolCallsThroughSeq`, the newest seq counted; the renderer adds only its own rows above it (`ownToolCallSeqsByCall`, twin). A sub-agent card's tools: run state's `delegates[].toolCalls` (`ItemDao.delegateToolCallCounts`, rows naming it as `parentToolUseId`, through `throughSeq`), plus its rows above (`daemonSubagentReadings`, twin).
  - A turn the CLI did not time (ACP), member or 1:1 chat, is measured by the wall clock from the agent's durable rows (`utils/wall-worked.ts`, twin of the renderer's `scanTurns`) and recorded one row per turn in `wall_turns` (`(runId, seq)` key, insert-or-ignore, never updated) by `WallWorkService`: live after each such `turn_complete` row (a chat's before its settle announce), and by a boot sweep retired by a versioned marker. No high-water mark: every catch-up records whatever its agent has unrecorded, so a turn durable late is still counted. `error` / `turn_cancelled` turns are not measured.
  - A call card's clock is its CONVERSATION's wall time, not its CLI-worked time: each call is open from a `running` status row filed under it to the ending status that answers it (its turns, its holds on its own calls and monitors, the turns those wake, an off-turn stretch after its settle), less what an approval card of it waited on the user. The nodes route serves each call's folded state as `callFigures[].clock` (`utils/call-clock.ts` `callClocksFrom`, over `SPAN_ROW_KINDS`) with its `throughSeq`; the renderer continues it over the rows above (`chats/call-clock.ts`, twin) and adds the open stretch. Live and settled are the one measure, so nothing replaces the figure when a turn lands.
  - Worked time counts every CLI-timed turn however it ended — finished, failed (`error`) or stopped (`turn_cancelled`) — less the time an answered approval card of its own conversation held it, by ONE rule (`utils/card-holds.ts`: request→verdict paired by payload id, per member and per conversation = the request's `callId`, clipped to `[end − durationMs, end]`, merged; `workedByAgent`). The CLI's own figures are never rewritten: `rememberWork` adds only a `turn_complete`'s duration to `workedMs`, and `HeldWorkService.catchUpRun` files beside it, raise-only, `heldMs` (card time of every CLI-timed turn) and `unfinishedMs` (the CLI time of failed and stopped turns) on the run (a chat) and on `node_state` (a member), live after each CLI-timed terminal row (a chat's before its settle announce, a member's on its write chain, `endsCliTimedTurn`). `UsageRecorderService` and the usage backfill file each ledger row's `UsageEvent.heldMs`; `HeldWorkSweepService` (boot, behind listen, versioned marker `held-work-measured`) files all of them for every run that ever raised a card or ended a turn in an error or a Stop, and fills only ledger rows holding none. An unanswered card holds nothing.
  - What is SERVED (nodes route `workedMs`, `RunDto.workedMs`, the settle announce, the chat export's `nodes[].workedMs`) is `workedMs + unfinishedMs − heldMs` plus the `wall_turns` sum (`servedWorkedMs`). `ChatTotals.workedMs` (every usage row) takes out the run's held time (`HeldWorkService.turnHoldsOf`) and adds its whole `wall_turns` sum (`WallTurnDao.runSum`); the nodes route's `totals`, `mainTotals` and `callFigures[].totals` take each usage row's own hold out of it and add its own `wall_turns` row (`WallTurnDao.nodeTurnsBySeq`), so a member's `totals.workedMs` equals its `workedMs`; the waterfall lanes and totals are the same CLI time less holds (`workedByAgent`); the usage Stats page and a team's statistics read `durationMs − heldMs` (`workedMsOf`), and a team's own statistics fill a turn no CLI timed from its `wall_turns` row (below). An analysis serves each member's worked time, in `view=overview` `nodes[].workedMs` and in `view=runs`, as its lane's `workedMs` plus its `wall_turns` through the snapshot (`laneWorkedMs`); the overview's `inTurnsMs` and `busyMs` are wall time, parallel conversations counted once. The chat export's `nodes[]` `turns`, `costUsd` and `estimatedCostUsd` are the member's waterfall lane, and its `calls[]` are `foldConversationTotals`' `byCall` (`utils/conversation-totals.ts`). The renderer never sums turn durations into worked time or spend: the export summary takes each agent's and each call's from the export document. `wall_turns` is dropped with the run by `RunTeardownService`.
- `Run.workedMs` / `toolCalls` are written at every ending (complete, cancelled, error) and carried on the settle announce, never on activity announces. Null means not measured, never zero. A stretch the CLI runs by itself adds its own at its ending (`ChatService.countOffTurnWork`; a member's in `onOffTurnEvent`).
- A stretch the CLI runs by itself is dated by `off_turn_started` (raised by `runCliSession` ahead of its first output: the later of the waking report and the last result when a report came since the CLI last went idle, else the first output). A chat's open turn's holds and that start (`RunHoldRegistry`) are served on run state (`turnHeldMs`, `turnHeldSince`, `turnStartedAt`), since neither leaves a row. A turn of ours starting, a stretch starting and a settle start them over.
- `NodeState.polledSpend` is a per-EVENT ledger (the vendor revises charges): each poll replaces each event's figure; never a watermark. A node answers for its `sessionIds`, its callee `call_result` sessions, and their delegates (`spawnedConversations`). Each conversation is asked of the accounts its entry records (`accounts`, canonical config directories, `''` the default login; absent for the default account alone); a new one, of the accounts its member runs under now (a chat's `Run.configDir`, a member's from the team copy, every pool member's of that CLI for a pooled member, the folder's pin first), a delegate of its parent's. One request per account, and a conversation settles only once every account it was asked of was read whole or has no login (`ACCOUNT_SIGNED_OUT`, never a failed ask), with at least one read. An entry that holds an event stays where it was found, so a chat that switched profile keeps its earlier conversations on their account; one that holds no event and was never asked of an account its member runs under now is asked of both from its member's start. A call's bill is read from the same ledger: the entries of the CLI sessions its conversation ran in (`call_result.sessionId`, and `CallContext.sessionIds`, written as the CLI names one so a running call has it) and of the delegates they launched (`ConversationSpend.spawnedBy`). In `callFigures` a session is billed to the first call naming it, since the client sums a conversation's calls.
- `Run.notes` is the user's alone and is never composed into a turn's instructions.
- Promoted payload columns (`Item.payloadId`, `toolNameLower`, `parentToolUseId`, `callId`, `utils/payload-refs.ts`) are filled only by `Item.stampPayloadRefs` (`@BeforeCreate`), so never write an item around the entity hooks (a native insert leaves them NULL and its run's lookups miss it). A run reads them only once `Run.payloadRefsVersion` equals `PAYLOAD_REFS_VERSION` (new runs are created stamped through `onCreate`, never a property initializer, which the schema sync would turn into a column default that marks every older run stamped); until then `ItemDao.payloadRef` falls back to the payload. `PayloadRefsSweepService` fills older runs after listen, in small batches. A change to `PAYLOAD_REF_KEYS` or the rule bumps `PAYLOAD_REFS_VERSION`. An older build writing the same profile after this one leaves its rows unstamped in a stamped run; that is unsupported (no downgrade).
- `RunKindRowsCache` holds a run's rows of kinds whose payload is never rewritten (`turn_complete`, `subagent_info`, `call_started`, …) and reads only past what it holds, capped at `ItemSeqAllocator.writtenThrough`; a run's deletion evicts it. `acknowledgeUserMessage` rewrites user messages, so `message` never goes through it. Two columns are filled in after insert: `inCall` (the cache reads a run that can hold calls only after `ItemCallIndexService.ensureIndexed`, and again from the start once `stampEpochOf` moves for that run) and the promoted payload columns (no reader of the cache may use them). A set is a `KindRowsView` (kinds, optionally a row filter); call records are `CALL_RECORDS` (`utils/call-seed.ts`), read `'fresh'` by every reader. The budget is payload characters across every set, never a count of sets.
- `Item.inCall` is which call's card a row is drawn in (`utils/call-membership.ts`, twin of the renderer's claim pass): `''` is the run's own flow, NULL is not stamped yet. A `call_started` is filed where its caller speaks: the run's own flow for a member's own conversation, else the call that callee conversation answers — the newest call of `callerConversationId`'s chain started before it, whose callee is the caller (`parentCallOf`) — so a call a callee makes is drawn as a card inside its caller's card. It is stamped at the one insert seam (`persistItemAndEmit`, through `ItemCallIndexService`). Older rows are stamped per run before a conversation read (`ensureIndexed`) and by a boot sweep off the ready path, retired by a versioned marker: a change to the rule bumps `CALL_MEMBERSHIP_VERSION`. While the marker names another rule, each team run is stamped again on its own (`ItemCallIndexService.restamp`: every row at or below its newest seq, only changed stamps written) — started by its first read and by the sweep, newest first. A run whose promoted columns are stamped is read one kind at a time from covering indexes alone and written by rowid (`ItemDao.inCallRowsOfKind`, `rememberInCallAt`): `inCall`, `callId` and `payloadId` sit after `payload` in the row, and reading them off the table walked every payload's overflow pages — seconds per large run cold, the whole table for the sweep, even when nothing changed. Any other run is read in `(seq, id)` batches with its payloads. Every batch, of this pass and of `ensureIndexed`, is followed by a pause at least as long as the batch held the event loop (`stampPauseAfter`), so requests get at least half of it; a commit can carry a WAL checkpoint of most of a second. A read never waits for it, only for its own run's unstamped rows: clearing stamps across runs first once held every team-thread read behind one pass over the whole table, past the renderer's 30 s request timeout. Until a run is done it reads under the previous rule's stamps; `stampEpochOf(runId)` moves once a re-stamp changed any. The marker is written only once every team run is done, so an interrupted sweep is redone whole by the next launch. A chat keeps its stamps, since its rows are all in its own flow.
- `GET /v1/chats/:runId/items` serves every row, page and anchors alike, with its base64 image blocks collapsed to a line naming them (`utils/collapse-image-blocks.ts`): the transcript draws a tool result's image block as JSON, and one page of a long run carried megabytes of them. The stored row keeps them.
- `GET /v1/chats/:runId/calls/:callId/messages` (`ChatHistoryService.callMessages`) answers a callee's newest own messages over the conversation's chain, per call and kind off the `(runId, inCall, kind, seq)` index; with `steps=true`, for an expanded call row of the Team activity block, its newest steps of any kind (its messages and reasoning with text, its named tool calls): never a tool result, a delegate's row or a person's.
- `GET /v1/chats/:runId/items` pages one conversation with `conversation=root` or `call=<id>` (a team run only). A root page also anchors, for each call it shows or that runs across it (only a call started in the run's own flow runs across it), the call's `CARD_READS` rows (per-kind caps), the callee's own task lists since its newest whole one, an open turn's tool calls (its own read apart, so sub-agents' never crowd them out), its newest row, own message and, while its turn runs, its own named tool calls, and what closes them (those tool calls' replies, its shells and delegates) — the twin of the renderer's folded call card and pairing readers — plus the `unanswerable` rows of its approval cards, and, for a call held on its own calls, what continued it since its newest `heldCall` row (its `call_answer` rows and a person's messages, `newestHolds`), without which the card keeps reading `waiting`. Those card rows, unless the page holds or already anchors them, carry the long text of a tool call's input, a reply's result and a message cut to `CARD_ROW_PREVIEW_CHARS` (`utils/card-row-preview.ts`), and an anchored settle (`call_result`) carries its result cut the same way: a folded card reads only their head, and an opened card's own page replaces them by id (`use-run-stream.ts` merges `callRows` over anchors). A `call=` page anchors the same card rows for each call of its conversation, and each call started on the page from inside it, that the page does not hold: a long turn's `running` status sits far above its newest page, and a card without it reads `pending`, which hides the Message box of the working-agents popup.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.