Repository navigation
feat(box): berthd agent-host keeps a structured agent alive, and a log of everything it says - #75
Merged
Merged
Conversation
…g of everything it says `berthd agent-host --dir D -- COMMAND` runs as a tmux session's program and owns the agent's stdin and stdout. Everything that passes between them, streamed partials included, goes into the conversation's own append-only events.jsonl. A unix socket serves "attach from seq N" with nothing missed, plus write and stop. A stop closes stdin, then sends SIGTERM, then kills the whole process tree, including what tools started in sessions of their own. A host started again in the same folder carries the log on. No driver uses it yet; the Claude driver is next (design/structured-agents/plan.md, phase 2). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
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.
Phase 2 of
design/structured-agents/plan.md. Nothing uses it yet, so this PR changes no behaviour; the Claude driver (phase 3) is the first user.berthd agent-host --dir D [--socket S] [--cwd W] -- COMMANDruns as the agent's tmux session program:D/events.jsonlis append-only and numbered (seq). It holds agent stdout (JSON kept as-is, other lines as text), what was written to stdin, stderr, andstarted/exitedhost entries. Streamed partials are kept, which the agents' own transcripts lose when killed mid-turn. A line cut short by a crash is dropped on reopen, and a host started again in the same folder carries the numbering on (resume).D/host.socktakes JSON-line calls:attach(from a seq, gap-free between replay and live, ending afterexited; a reader that falls 1024 behind is let go and attaches again),write(one JSON line to stdin, logged first, non-JSON refused) andstop.exitedentry before the host exits.Tests cover the logged exchange, gap-free late attach, the log outliving the host, a second host carrying the log on, killing a setsid child that ignores SIGTERM, a cut-short log line, and a slow reader. I also ran it end to end against real
claude -p --input-format stream-json --output-format stream-json --include-partial-messages(haiku): write, then attach untilresult, then stop, with exit 0 and a 30-entry log.The plan's SQLite conversation index moves to phase 3, which is the first thing with data to put in it.
Checks run:
go vet ./...(plusGOOS=linux), andgo test -racefor./cmd/...and./internal/agenthost(-count=5on the new package).🤖 Generated with Claude Code