Skip to content

feat: session recorder — save chat turns to JSONL for later replay #65

@VforVitorio

Description

@VforVitorio

What problem does this solve?

Currently all conversation history is lost when the user exits lmcode chat. Users have no way to review what the agent did in a previous session, which makes debugging and auditing harder.

Proposed solution

Record each session to a JSONL file in ~/.local/share/lmcode/sessions/ so sessions can be replayed, searched, or resumed later.

Design:

  • Each session gets a unique ID (timestamp-based, e.g. 2026-03-22T14-05-00)
  • Events saved: session_start, user_message, assistant_message, tool_call, tool_result, session_end
  • Storage path: ~/.local/share/lmcode/sessions/<id>.jsonl (via config/paths.py)
  • Event models already exist in session/models.py (stub)
  • Recorder stub in session/recorder.py (needs implementation)

Scope:

  • Wire up SessionRecorder in agent/core.py — emit events at each turn
  • Implement session/recorder.py — append JSONL lines
  • Implement session/storage.py — list + load sessions

Roadmap: v1.0 (required before session viewer can be built)

Alternatives considered

None considered.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions