Skip to content

Route logs and traces to session directory by default#23

Merged
chinmaymk merged 3 commits intomainfrom
claude/organize-session-artifacts-EfMW3
Mar 11, 2026
Merged

Route logs and traces to session directory by default#23
chinmaymk merged 3 commits intomainfrom
claude/organize-session-artifacts-EfMW3

Conversation

@chinmaymk
Copy link
Copy Markdown
Owner

Add 'session' output mode for observability that writes logs.jsonl and traces.jsonl into the session directory alongside messages.jsonl. This keeps stdout/stderr clean and co-locates all run artifacts in one place.

Session directory structure is now:
.ra/sessions/{uuid}/
meta.json, messages.jsonl, checkpoint.json,
logs.jsonl, traces.jsonl

Logger and Tracer buffer lines in memory until setSessionDir() is called, then flush pending entries and continue writing to the session file. A session is now created eagerly at startup so observability has a target directory before the interface starts.

https://claude.ai/code/session_01SaCbHUH9Lfnp3R7ZD5tabt

claude added 3 commits March 11, 2026 21:21
Add 'session' output mode for observability that writes logs.jsonl and
traces.jsonl into the session directory alongside messages.jsonl. This
keeps stdout/stderr clean and co-locates all run artifacts in one place.

Session directory structure is now:
  .ra/sessions/{uuid}/
    meta.json, messages.jsonl, checkpoint.json,
    logs.jsonl, traces.jsonl

Logger and Tracer buffer lines in memory until setSessionDir() is called,
then flush pending entries and continue writing to the session file.
A session is now created eagerly at startup so observability has a
target directory before the interface starts.

https://claude.ai/code/session_01SaCbHUH9Lfnp3R7ZD5tabt
Instead of adding pendingLines buffering and setSessionDir() to Logger
and Tracer, resolve 'session' → 'file' with computed paths in
createObservability(). Logger and Tracer stay unchanged from their
original form — no new output modes, no deferred setup.

Session is created before observability so the directory path is known
upfront. Net -96 lines.

https://claude.ai/code/session_01SaCbHUH9Lfnp3R7ZD5tabt
…racefully

- Ensure session directory exists via mkdir before creating file writers
  (create() does this, but --resume skips create())
- Fall back to stderr when output is 'session' but no sessionDir provided

https://claude.ai/code/session_01SaCbHUH9Lfnp3R7ZD5tabt
@chinmaymk chinmaymk merged commit 2cdada0 into main Mar 11, 2026
1 check passed
@chinmaymk chinmaymk deleted the claude/organize-session-artifacts-EfMW3 branch March 11, 2026 21:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants