Repository navigation
Show Claude Code subagents and outside sessions as characters - #405
Open
Omar-Tnzxo wants to merge 1 commit into
Open
Omar-Tnzxo wants to merge 1 commit into
Omar-Tnzxo wants to merge 1 commit into
Conversation
Subagents: Claude Code workers are now hooked for SubagentStart and SubagentStop. Each running subagent is kept on the worker (WorkerInfo.subagents, server/subagents.ts), with what it was asked to do from its agent-<id>.meta.json and its latest tool call from its own PreToolUse (hooks from inside a subagent carry its agent_id). The page stands them round the worker's chair (features/subagents). Visitors: Claude Code sessions the office didn't start (the desktop app, a terminal, an IDE) are found under ~/.claude/projects (server/visitors/), read-only: only stat'ed, listed and read in head and tail slices, never written. Each shows in the lobby by the elevator of the floor whose checkout or origin its folder is (else the first floor, marked as the lobby), with its title, status, latest tool call and its subagents and workflow agents round it (features/visitors). --no-visitors turns it off. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
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.
What
Two ways to see more of what Claude Code is doing, in the office itself:
SubagentStartandSubagentStoptoo. Each subagent a worker has running (the Agent tool, a workflow's agents) stands round its chair as a smaller worker without a headset, with a card saying what kind it is, what it was asked to do (itsagent-<id>.meta.jsondescription) and its latest tool call (hooks fired from inside a subagent carry itsagent_id, so its ownPreToolUseupdates it). It goes atSubagentStop; one stopped mid-turn without a word goes after 15 minutes of silence, and a new session has none. Past six round one desk, a sign says how many more.originis, else on the first floor marked as the lobby. Each has a card with its name in the app (or its first prompt), its folder and branch and its latest tool call, a status light (working, done, waiting on you, when it hops), and its subagents and workflow agents round it. Aiming at one says where it runs.--no-visitors(orAGENT_OFFICE_VISITORS=0) turns them off.How it plugs in
Following
docs/code-layout.md: no new code inmain.ts,server.ts, the store orprotocol.tsbeyond one line in each list.src/server/subagents.ts, plus two hook events and one call inproviders/claude.ts;WorkerInfo.subagents(not saved inworkers.json).src/server/visitors/(scan.ts,transcript.ts,index.ts): a building-wide service made inoffice/services.ts, avisitorsmessage (protocol/visitors.ts) and avisitorsfield ofFloorView(ws/handlers/visitors.ts).features/subagents/,features/visitors/, thevisitorsslice (last inSLICES), andworld/character/subagent.tsfor the figure both use.--no-visitorsinconfig.ts; README,docs/features.md,docs/how-it-works.mdanddocs/configuration.mdupdated.Read-only, and what it reads
The visitor scan runs every 4 s only while someone is in the office. It lists and stats
~/.claude/projects($CLAUDE_CONFIG_DIR/projects), restats transcripts older than 6 hours only once a minute, and reads only the first 64 KB and last 256 KB of transcripts written in the last 10 minutes (or with a subagent written to in the last 3), again only when one changed. Files are opened read-only and nothing is ever written, moved or locked there, and nothing is sent to those sessions;tests/visitors.test.tschecks a scan leaves every file's bytes and mtime as they were. Session ids that are, or ever were, the office's own workers' are skipped, and so are sessions inside a floor's.agent-office. Agent ids are checked against[A-Za-z0-9_-]{1,64}before they're used in a path. What browsers get is the title, folder (last two parts), branch, status, the latest tool call (one line, 80 characters) and the subagents' descriptions: anyone signed in to the office can already read all of that from a shell worker, but--no-visitorsis there for an office whose people shouldn't see the host user's other sessions.Verified
npm run typecheck,npm test(623 pass;tests/subagents.test.tsandtests/visitors.test.tsare new, and the pinned store and welcome lists inclient-storeandserver-dispatchgainedvisitors),npm run build;tests/size.test.tsstays green.release.ymlpacks it installs withinstall.sh(AGENT_OFFICE_TARBALL) and runs.Checked against Claude Code 2.1.319, whose hook input has
agent_id/agent_typeon events from inside a subagent andagent_transcript_pathonSubagentStop.🤖 Generated with Claude Code