gptme-agent-events
A live, harness-agnostic event stream of what an agent is doing (tool calls, test runs, commits, pushes, PRs, errors, turn ends), plus sinks that consume it. The first sink is sound: hear an agent work, using gptme's own sound effects.
Status: alpha (0.1.0). Claude Code, gptme and Codex are supported and
tested against real trajectories.
Why
Every agent harness already writes a trajectory log as it works. This package follows those logs on the agent's host and turns new lines into one small schema, so anything downstream (a sound player, a status widget, a dashboard) can ask "what is the agent doing right now?" without knowing each harness's log format, and without adding hooks to the agent's hot path.
Install
Not published on PyPI. From a gptme-contrib checkout:
uv run --package gptme-agent-events gptme-agent-events --help
# or install the command
uv tool install "git+https://github.com/gptme/gptme-contrib#subdirectory=packages/gptme-agent-events"
It depends on gptme-sessions, which provides the
shell parser for detecting commits and pushes. The sound sink needs gptme
installed (for its sound files) and a system player (afplay, paplay or
ffplay).
Usage
# On the agent's host: follow every live trajectory, one JSON event per line.
gptme-agent-events tail --agent bob
# Hear it from your own machine.
ssh bob 'gptme-agent-events tail --agent bob' | gptme-agent-events sound
# The whole fleet, with Alice and Gordon a bit quieter.
{ ssh bob 'gptme-agent-events tail --agent bob' &
ssh alice 'gptme-agent-events tail --agent alice' &
ssh gordon 'gptme-agent-events tail --agent gordon' & } \
| gptme-agent-events sound --agent-volume alice=0.6 --agent-volume gordon=0.6
# Your own local sessions.
gptme-agent-events tail | gptme-agent-events sound
Useful tail options:
--root HARNESS=DIRadds or replaces a trajectory root, for agents that keep logs outside the defaults (for example--root gptme=~/bob/logs).--harnesslimits which harnesses are followed.--from-start --oncereplays recently active files and exits, which is handy for checking what the extractors make of a session.
Default roots: ~/.claude/projects (or $CLAUDE_CONFIG_DIR/projects),
$GPTME_LOGS_HOME or ~/.local/share/gptme/logs, and ~/.codex/sessions (or
$CODEX_HOME/sessions).
Event schema
{"kind":"tool","ts":"2026-11-12T10:20:34.334Z","agent":"bob","harness":"claude-code",
"session":"e68fc377-…","tool":"Bash","tool_class":"test"}
| Field | Meaning |
|---|---|
kind |
tool, turn_end, error, commit, push, pr_open, session_start |
tool |
The harness's own tool name (Bash, patch, exec_command, …) |
tool_class |
Harness-agnostic class: read, search, write, shell, test, web, agent, other |
subagent |
true for work done by a subagent of the session |
detail |
cwd (private) and repo (GitHub owner/name) where known; path (private) for file writes; sha, url, ref, dir (private) and source (git or shell) for commits, pushes and PRs |
Commits and pushes come from git
Shell output is a weak signal for whether a commit landed: wrapper scripts,
hooks and | tail hide the [branch sha] line, unattended scripts commit
without any tool call, and a commit can be undone a second later. So tail
also watches git's reflogs for every repository an agent touches (any event's
cwd or commit directory, plus --repo DIR):
logs/HEADandworktrees/*/logs/HEADentries starting withcommitbecomecommitevents;update by pushentries underlogs/refs/remotes/becomepushevents.
Commits are attributed to sessions through their Git-Session-Id trailer, and a
push through the trailer of the commit it pushed. When the trailer names a
session the follower has seen, the event takes that session's harness;
otherwise harness is git (for example, a script commit). For watched
repositories, shell results annotate matching reflog events rather than producing
a second event. A missing trailer can inherit the shell result's session,
harness and tool: commits match by SHA when available, otherwise a unique result
of the same kind in the same repository within five seconds is required. A
trailer always wins over shell attribution. Events may wait up to five seconds
for a tool result from the next poll; unmatched shell evidence is emitted as a
fallback (including repositories with reflogs disabled). Ambiguous concurrent
results are not used to guess a session. Pass --no-git to rely on shell output
only.
Without git watching, or for repos that can't be resolved, commits, pushes and
PRs are reported when the tool result shows the command succeeded; a failed
call becomes error instead. PRs always come from the tool result (gh pr create output). gptme's markdown tool format has no call ids, so there they
are reported with the call.
Privacy
Events never contain prompts, replies, shell commands or tool output. Commands
are inspected in memory to classify them and then dropped. The stream is meant
to stay private (stdout, ssh). Any sink that publishes beyond the agent's own
host must drop detail.cwd, detail.dir and detail.path, and only forward
repo/sha/url/ref for public repos. Commit slugs come from the checkout's
origin, parsed with an exact GitHub host and scheme-default port. Pushes
remain unlinked: reflogs record the remote name, not the URL used at push time,
so even a currently public remote cannot authorize historical push details.
Shell-only pushes also do not carry an authorized repo, and landings never
inherit the session cwd's repo. Push events still reach private sinks such as
sound; they do not replace the public feed's latest authorized milestone.
Sounds
sound prints one line per event (local time, agent, harness, session,
event kind, tool, repo@sha or URL, then ♪ sound or why it was skipped:
throttled, busy, silent), so the terminal doubles as a live log; -q
turns that off.
11:48:48 bob claude-code 9e91d4cc tool:shell Bash ♪ seashell_click
11:48:49 bob claude-code 9e91d4cc commit Bash ErikBjare/bob@d6e437d98e80 (git) ♪ chime_clean_ring
gptme-agent-events sound --list shows the mapping. Defaults use the sounds
gptme ships with:
| Event | Sound |
|---|---|
turn_end |
bell (gptme's ding) |
tool read / search / web |
page_turn |
tool write |
file_write |
tool shell |
seashell_click |
tool test |
drilling |
tool agent / other |
sawing |
commit / push / pr_open |
chime_clean_ring / chime_complex_ring / chime_improved |
error |
chime_beating |
session_start |
chime |
Override with --map tool:shell=sawing, or silence with --map tool:read=.
Tool sounds are throttled during bursts (--min-gap, default 0.15 s);
milestones are never dropped for spacing.
Publishing a public status feed
publish keeps one row per agent up to date in gptme.ai's agent_status
table (the "what are the agents doing" feed). Only public-safe facts leave the
host:
state(working/idle) and the latestactivityclass, never task text, commands, paths or output;- the latest commit, push or PR only if its repository is public on
GitHub (checked via the GitHub API; unknown counts as private). Negative
lookups are cached, but positive visibility is rechecked for new milestones
and before writing retained milestone details. A revoked or failed lookup
clears the retained details within one heartbeat interval, even when the
agent is idle and its row has stopped changing. The retained milestone is
the most recent public landing: a landing in a private repository never
replaces it, so its
milestone_atstays the timestamp of that public event; - commits elsewhere only as a count over the last hour.
Milestones are written at once; other changes at most every 20 s per agent, plus a heartbeat every 4 min while working. Retained milestone details are reauthorized on that same 4 min cadence regardless of state, so a repository that turns private is stopped from being served even if nothing else changes. After 5 quiet minutes the agent is published as idle. Failed writes retain the latest pending row and retry no faster than the write interval (at least one second), even for milestones. Failures report only HTTP status or exception class on stderr, never credentials or token-command output. End-of-input flushes debounced changes once; it does not override failed-write backoff or wait for recovery.
# One host publishing for several agents, pulling their streams over ssh:
{ gptme-agent-events tail --agent bob &
ssh alice@alice '~/.local/bin/gptme-agent-events tail --agent alice --no-git' &
ssh gordon '~/.local/bin/gptme-agent-events tail --agent gordon --no-git' & } \
| gptme-agent-events publish --agent bob --agent alice --agent gordon \
--supabase-url "$GPTME_FEED_SUPABASE_URL" --anon-key "$GPTME_FEED_ANON_KEY" \
--token-cmd "my-gptme-ai-token"
# See what would be written:
gptme-agent-events tail | gptme-agent-events publish --agent bob --dry-run
--token-cmd prints an access token for the account that owns the agents in
public_agents; it is re-run when the token expires. GITHUB_TOKEN, if set,
raises the GitHub API rate limit for visibility lookups.
Library use
from gptme_agent_events import Follower, default_sources
for event in Follower(default_sources(), agent="bob").run():
print(event.kind, event.tool_class)
Extractors can also be fed records directly
(ClaudeCodeExtractor(session).feed(record)), which is how other sinks or
publishers can reuse the parsing without the follower.
Roadmap
- Publisher for a public status feed (replacing the single-row
bob_heartbeatbeacon behind gptme.ai's "Right now Bob is" widget), with a privacy projection that only names things already public. - Copilot and Pi extractors (gptme-sessions already parses both).