Skip to content

feat(timeline): structured session timeline view (#81)#126

Merged
Siddhant-K-code merged 1 commit into
mainfrom
feat/81-session-timeline
May 23, 2026
Merged

feat(timeline): structured session timeline view (#81)#126
Siddhant-K-code merged 1 commit into
mainfrom
feat/81-session-timeline

Conversation

@Siddhant-K-code
Copy link
Copy Markdown
Owner

What

Adds agent-strace timeline — a structured, phase-by-phase view of a session showing tool calls, file operations, LLM requests, errors, retries, and a wasted-spend callout for failed phases.

Closes #81

Example

Session: abc123def456 | 2026-05-19 14:32 | 4m 12s | $0.0043 | 3 errors

Phase 1: Setup (0:00–0:45)  $0.0008
  ✓ Read src/auth/handler.go
  ✓ Read src/auth/middleware.go

Phase 2: Implementation (0:45–2:10)  $0.0031
  · Run Bash (1.2s)
      pytest tests/test_auth.py
  ✗ Error: Bash
      FAILED tests/test_auth.py::TestAuthHandler
  · Run Bash (attempt 2) (1.1s)
  ✓ Write src/auth/handler.go  +3 lines

  ⚠ 2 retries in this phase

⚠ Wasted spend: 2 retries on failed phases = ~$0.0008 (19% of session cost)

Changes

  • src/agent_trace/timeline.py — new module (build_timeline, format_timeline, format_timeline_json, cmd_timeline)
  • src/agent_trace/cli.py — registers timeline subparser
  • tests/test_timeline.py — 66 tests
  • README.md — new section + command reference entries
  • src/agent_trace/__init__.py — version 0.50.0 → 0.51.0

Design notes

  • Reuses explain.py for phase detection and cost.py for token/cost estimation — no new dependencies
  • Retry detection: same tool+args key seen more than once in a phase
  • --format json emits the full phase/entry tree for downstream tooling
  • --model selects pricing table (sonnet/opus/haiku/gpt4/gpt4o)

- timeline.py: build_timeline, format_timeline, format_timeline_json, cmd_timeline
- Groups events into phases (reuses explain.py phase detection)
- Shows tool calls, file ops, LLM requests, errors, retries per phase
- Cost estimates per phase and session (reuses cost.py pricing)
- Wasted-spend callout for failed phases
- Retry detection: same tool+args called more than once
- --format json for machine-readable output
- --model flag for cost estimate pricing (sonnet/opus/haiku/gpt4/gpt4o)
- 66 tests in tests/test_timeline.py
- README: new timeline section and command reference entries
- Version bump 0.50.0 → 0.51.0

Closes #81

Co-authored-by: Ona <no-reply@ona.com>
@Siddhant-K-code Siddhant-K-code merged commit ac68378 into main May 23, 2026
4 checks passed
@Siddhant-K-code Siddhant-K-code deleted the feat/81-session-timeline branch May 23, 2026 08:33
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.

feat: session timeline view

1 participant