Skip to content

Verify Claude Code cwd metadata comes from JSONL body #249

@luoyuctl

Description

@luoyuctl

Background

#102 tracks local multi-agent observability as radar. One comment raised a source-specific correctness risk that is narrow enough to route without turning agenttrace into a live dashboard: Claude Code stores session files under ~/.claude/projects/<encoded-cwd>/<uuid>.jsonl, but that encoded directory name is not a reversible project path. Any parser/report metadata that needs a project cwd should prefer the authoritative cwd value from JSONL records when present.

Evidence

  • [Radar] Track local multi-agent observability dashboards as adjacent surface #102 comment describes the concrete failure mode: Claude Code project-directory encoding can collapse /, \, and : into similar path fragments, so deriving a project name or cwd from the directory can mislabel sessions.
  • Product read-only check of origin/master at 6fb3917 found Claude JSONL parsing in internal/engine/engine.go and session loading via LoadSession(path).
  • Current Session has Name and Path; parseClaudeCodeJSONL(raw) does not expose a structured cwd/project metadata field from JSONL body records.
  • The check did not find evidence that agenttrace currently reverse-decodes ~/.claude/projects/<encoded-cwd> into a cwd, so this is a focused correctness/metadata check rather than a confirmed misparse bug.

User value

Users comparing Claude Code sessions across repositories need project/session metadata that does not silently derive from an irreversible encoded path. Correct cwd provenance improves report trust when sessions are grouped, exported, or compared downstream.

Adoption rationale

This keeps Developer experience and Reliability value aligned with local multi-source observability while staying inside agenttrace's completed-session evidence model.

Suggested scope

  • Add or verify a minimal Claude Code JSONL fixture where a record includes an authoritative cwd field.
  • Ensure parser/session/report metadata uses the JSONL body cwd when a cwd/project field is exposed.
  • Ensure no code path attempts to reconstruct cwd by replacing characters in ~/.claude/projects/<encoded-cwd>.
  • If agenttrace chooses not to expose cwd metadata yet, add a regression guard or documented parser note proving the encoded directory is not treated as authoritative cwd.

Non-goals

  • Do not build a live multi-agent monitor, watcher, or orchestration UI.
  • Do not index prompt content by default.
  • Do not infer project paths from private logs beyond local fixture-backed metadata.
  • Do not claim Antigravity, Qwen export, or other new source support.

Acceptance criteria

  • A test fixture covers a Claude Code JSONL session whose file path has an encoded project directory and whose JSONL record has an explicit cwd.
  • The test proves any exposed cwd/project metadata comes from the JSONL body, not from encoded path reversal.
  • If cwd is not currently exposed, the test or parser note proves encoded path reversal is absent and future exposure must use body metadata.
  • Existing go test ./... and relevant CI checks pass.
  • Public docs, if touched, use conservative wording and avoid live-dashboard or hosted-observability claims.

Suggested lane

lane/parser, priority/P2, status/ready-for-agent

Risk

Medium. The implementation surface is small, but incorrect project metadata can mislead downstream reports and future multi-agent comparison features.

Source

source/product: Product follow-up from #102, with read-only code inspection on origin/master at 6fb3917.

Metadata

Metadata

Assignees

No one assigned

    Labels

    lane/parserParser/import format workpriority/P2Useful follow-up worksource/productCreated or updated by product manager routingstatus/ready-for-agentReady for an agent to implement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions