Summary
The daemon's /list endpoint only returns startedBy, happySessionId, and pid for each session. The working directory is available in memory (TrackedSession.spawnOptions.directory) but not exposed in the response.
Why
External tools (TUIs, scripts, dashboards) that list sessions need the working directory to:
- Resume sessions correctly —
claude --resume must run from the original directory since session files are stored per-project (~/.claude/projects/<encoded-cwd>/)
- Display useful context — showing which project a session is working in
- Avoid brittle workarounds — currently requires reading
/proc/{pid}/cwd (Linux-only, fails for dead processes) or reverse-engineering Claude's project directory encoding
Current state
controlServer.ts /list response:
children: z.array(z.object({
startedBy: z.string(),
happySessionId: z.string(),
pid: z.number()
}))
TrackedSession already has:
spawnOptions?: SpawnSessionOptions; // contains directory: string
And the /session-started webhook receives metadata which may also contain the path.
Suggested change
Add directory (optional) to the /list response:
children: z.array(z.object({
startedBy: z.string(),
happySessionId: z.string(),
pid: z.number(),
directory: z.string().optional(),
}))
Populated from child.spawnOptions?.directory for daemon-spawned sessions, and from webhook metadata for terminal-started sessions.
🤖 Generated with Claude Code
Summary
The daemon's
/listendpoint only returnsstartedBy,happySessionId, andpidfor each session. The working directory is available in memory (TrackedSession.spawnOptions.directory) but not exposed in the response.Why
External tools (TUIs, scripts, dashboards) that list sessions need the working directory to:
claude --resumemust run from the original directory since session files are stored per-project (~/.claude/projects/<encoded-cwd>/)/proc/{pid}/cwd(Linux-only, fails for dead processes) or reverse-engineering Claude's project directory encodingCurrent state
controlServer.ts/listresponse:TrackedSessionalready has:And the
/session-startedwebhook receives metadata which may also contain the path.Suggested change
Add
directory(optional) to the/listresponse:Populated from
child.spawnOptions?.directoryfor daemon-spawned sessions, and from webhook metadata for terminal-started sessions.🤖 Generated with Claude Code