The agent logs as their own skill: @gemstack/skill-logs, command logs; agents-logs folded onto agent-data - #1771
Merged
Merged
Conversation
…ogs`; `agents-logs` folded onto `agent-data` The fourth skill (#1769). A run is a card (`agents/<who>/<id>.json`, eleven plain fields, the framework's rest under `caller`) and a diary (`<id>.jsonl`, four kinds of line the skill knows among the framework's events), both on the `agent-data` branch. Agents read with `logs`, `logs --ticket <file>`, `logs --branch <name>`, `logs show <id>`; the SKILL.md says to read a ticket's runs before planning or working it. The framework maps its meta and events onto the two shapes in one module, `store/run-record.ts`, and records every run through the skill at teardown; the history, the run page, the tail of an ended run and a continuation read back through the same mapping. The `agents-logs` branch is gone: its runs and the routine locks live on `agent-data`, `LOGS_BRANCH` and `LOGS_CHECKOUT_DIR` with it, and the LAYOUT marker names `runs-dir` instead. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017hpLBHRrvmubeoLrEyqtWD
This was referenced Sep 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The agent logs are the fourth skill,
@gemstack/skill-logs, commandlogs. This is #1769 built as picked there. Agents read past runs. The daemon records every run through the skill. Theagents-logsbranch is gone: the runs and the routine locks live onagent-data.What an agent gets:
The SKILL.md says when to look: before you plan or work a ticket, read its runs. A stopped or failed run says what to avoid. A done run with a PR says the work may already be there.
Cutover is by hand after merge, per machine, on every project. The recipe and the converter are below. A daemon on the old build after this merges writes to
agents-logsagain, so every machine moves at once.🤖 curated · Fable 5.1
The card and the diary
A run is two files under
agents/<who>/onagent-data.<who>is the git email the repo commits as, made safe, as before. Both files are pushed, as before.The card,
<id>.json, has eleven fields of the skill's own:id,startedAt,endedAt,status,intent,driver,model,branch,pr,ticket,cost. Everything else the daemon records sits under one key,caller. The skill stores it and never reads it. The command never prints it.The diary,
<id>.jsonl, is the event log as before, with four events written in the skill's shape:said(a driver text event),result(a driver result event),ended(theendevent) andcost(ausageevent). Every other event is written as it is.logs showprints only the four kinds.Two facts are new on the framework's meta so the card can carry them:
endedAt, set when theendevent folds, andcost, summed over theusageevents.The framework side
One module maps both ways:
packages/framework/src/store/run-record.ts.toRunCard/fromRunCardfold the meta into the card and back.toDiaryLine/fromDiaryLinemap one event to one line and back. Every reader of a recorded run comes back through it: the History list and the run page (listAgents,loadAgentEvents), the tail of an ended run (dashboard-rpc/events.tswraps the tailer's callback), a continuation's restore, and the retry's failure detail.Teardown reads the run out of its worktree (
readWorktreeAgent) and records it with the skill'swriteRun. Adoption and the Open PR button patch the card with the skill'spatchRun. Delete usesdeleteRun. The transient archive under.the-framework/agents/stays as it was, for projects that are not git repositories and for the crash rescue.The boot-time reconcile used to edit a running record in place on the branch's checkout. The next sync's rebase refuses a dirty tree and the funnel resets it, so that edit was lost within a minute. It now ends the run through the skill's funnel, as a commit.
The fold
Gone:
LOGS_BRANCH,LOGS_CHECKOUT_DIR,agent-archive.ts,archived-agent-patch.ts, the second pull in the data sync. The routine locks useDATA_BRANCH. The LAYOUT marker dropslogs-branchandarchive-dirand gainsruns-dir: agents;.the-framework/LAYOUTis regenerated in this PR. Every SPEC,FEATURES-SPEC.mdand the three dashboard comments sayagent-datanow. No file in the repo saysagents-logsany more.The daemon puts
logson every agent's PATH and links the skill into every checkout beside the other three. The system-prompt bridge for agents outside a daemon-made checkout carries the skill's text after the queue's. Both places are already marked TEMPORARY (#1748) in the code, and this PR adds to them without changing that.Calls made while building, for review
These are the agent's, not picks from the issue:
logsprints the newest 20 runs unless--limitsays otherwise. A full listing with every prompt is 126 KB on this repo.--ticket <file>matches a card whose ticket is that exact path or ends in/<file>. The skill does not know where tickets live.updatedAtsits undercaller, like every other non-card field.startedAt, not by its file name. The file-name shortcut stays for the transient archive only. The adoption pass reads about 200 small files per pass on this repo.Proof
Tests: skill-logs 16, framework 1379 node + 865 vitest, agent-data 53, skill-branches 78, skill-tickets 47, skill-queue 16. Typecheck clean.
Real data: a scratch copy of this repo's
agents-logs(208 runs, 415 files) converted with the script below.logsreads 20 cards in 0.9 s and all 208 in 2.3 s. The converter recovers the cost of 84 runs ($238.64) and an end time for all 208.Rig: a throwaway repo with a bare origin, the daemon from this branch on its own port, one real
claude-coderun started over RPC on a ticket. The run was on origin'sagent-data15 s after it ended, as one commitlogs: record run <id>. The card had the eleven fields on top and the daemon's undercaller. The History RPC returned status, ticket, cost and end time. The run page replayed withdriver,usageandendevents. From a fresh clone:logs --ticket 2026-09-09_dogfood-logs.mdfound it by file name and by path,logs show <id>printed the card with itssaid,result,costandendedlines,logs --branchfound it, and an unknown id was refusedno-run.Cutover, by hand, after merge
Per project, on every machine that runs a daemon, before that machine's daemon runs the new build:
The converter (
toRunCard/diaryOffrom the built framework, so it is the same mapping the daemon uses):cutover-convert.mjs
Not in this PR
disable-model-invocation#1770). This PR adds one gen-prompts entry and nothing else there.