2.2 KiB
| title | status | type | priority | created_at | updated_at |
|---|---|---|---|---|---|
| Agent discovery looks in wrong subagents directory — sessions show 0 agents | todo | bug | high | 2026-03-30T04:43:21Z | 2026-03-30T04:43:21Z |
Problem
agents list <session-id> always returns empty results. The subagent directory path used in discovery is wrong.
Root cause
discover_agents_for_session(session_file) in src/parser/discovery.rs:198-205 does:
let parent = session_file.parent(); // ~/.claude/projects/<project-dir>/
let subagents_dir = parent.join("subagents"); // ~/.claude/projects/<project-dir>/subagents/
That directory never exists.
discover_all_agents() has the same bug: it iterates project dirs and looks at proj_path.join("subagents") directly — also wrong.
Actual disk structure
Confirmed across multiple sessions in the live ~/.claude/projects/ dir:
~/.claude/projects/<project-dir>/
<session-uuid>.jsonl ← session file
<session-uuid>/ ← directory with same name as UUID (no .jsonl)
subagents/
agent-<id>.jsonl
agent-<id>.meta.json
Example path that should work but currently returns empty:
~/.claude/projects/.../def4776b-25a6-4eca-99e7-f222926c297a/subagents/agent-a8e741de240089eef.jsonl
Required fix
discover_agents_for_session(session_file) should construct:
let stem = session_file.file_stem().unwrap(); // "def4776b-...-f222926c297a"
let session_dir = session_file.parent().unwrap().join(stem);
let subagents_dir = session_dir.join("subagents");
discover_all_agents() must also be updated to walk UUID subdirectories inside each project dir instead of looking at <project-dir>/subagents/ directly.
Secondary issue
The existing unit tests in src/commands/agents.rs (dump_with_real_agent_returns_ok, transcribe_with_real_agent_returns_ok) create subagents at the old wrong path (projects/subagents/) and must be updated alongside the fix.
Relevant files
src/parser/discovery.rs—discover_agents_for_session(lines 198–205),discover_all_agents(lines 211–266),collect_agents_in_dirsrc/commands/agents.rs— integration tests