Files
platform/todo/agent-coordination/an-agent-cannot-learn-its-own-session-id.md
pastilhasandClaude Opus 5 1ae986bb31 convention: an agent's commit names the session that made it
Three agents committed to this repository in one night and `git log` could not tell
them apart. `Co-Authored-By` says "an agent", which stopped being useful the moment
there was more than one.

So a trailer carrying the transcript id — not the session name, because names are
renamed by restarts and two sessions were renamed in a single night while their
transcript ids survived. The transcript holds the reasoning a commit message
cannot: what was considered and dropped, what was measured, what the owner decided.
A commit that names its session is one whose "why" is still answerable later.

The precondition is not built and is now a todo: an agent cannot reliably discover
its own transcript id. No environment variable carries it and the only exposure is
a background task's output path, so learning who you are means starting a job you
do not need. `commanderBlock` already hands a commander its id, so the mechanism
exists for one case and wants generalising.

Until then: an agent that knows its id adds the trailer, one that does not leaves it
out rather than guessing.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Officer-Session: 656f5c85-e49a-4f1f-b9f3-042a04b4d043
2026-08-23 14:43:21 +00:00

1.8 KiB

id, title, theme, status, created, date_source, order
id title theme status created date_source order
agent-coordination/an-agent-cannot-learn-its-own-session-id An agent cannot learn its own transcript id, so it cannot sign its own work agent-coordination open 2026-08-23 stated 2

An agent has no reliable way to find out its own transcript id, which blocks the commit convention in CLAUDE.md — "an agent's commit names the session that made it."

Searched on 2026-08-23. No environment variable carries it. ~/.claude/sessions/ is keyed on process id, not transcript. The only exposure found is indirect: a background task's output path contains it (/tmp/claude-1000/<project>/<transcript-id>/tasks/<id>.output), so an agent can learn who it is by starting a job it does not need and reading the path back. That works and it is absurd.

The mechanism already exists for one case. commanderBlock in api/command-hq/commander-block.ts hands a commander its own transcript id, because a commander needs it to write its pid and spawned records. So the platform knows the id at turn time and can already put it in a preamble — it just does that for commanders only.

What to build: give every session its own id the same way. One line in whatever preamble a session already receives, phrased as a fact rather than an instruction.

Two things to get right:

  • The transcript id, never the session name. Names are renamed by restarts — two sessions were renamed in one night on 2026-08-23 — and a commit trailer naming something that no longer exists is worse than no trailer.
  • It unblocks more than the trailer. The delegation problem in this theme is keyed on transcript ids too, and a manager cannot record "I am X" in a delegation row it cannot name itself in.

Until it lands: an agent that happens to know its id adds the trailer, and one that does not leaves it out rather than guessing.