Skip to content

Evaluate: Tree-structured session storage (Pi pattern) for terraphim_persistence #683

@AlexMikhalev

Description

@AlexMikhalev

Parent Epic

#682 -- Evaluate Pi architectural patterns

Pattern

Pi (badlogic/pi-mono) uses tree-structured JSONL for session storage. Each entry has id and parentId fields, enabling in-place branching without creating new files. A visual /tree navigator lets users jump to any point and continue from there. All branches are preserved in a single file.

Current State

Evaluation Questions

  1. Does tree-structured JSONL improve debugging and replay for ADF agent sessions? Current linear format loses context on compaction. Tree format preserves all branches.
  2. Is the id/parentId overhead justified? Each entry gains two fields. Measure storage and parse overhead for typical 500-2000 message sessions.
  3. Can tree structure coexist with Claude Code's linear format? terraphim-agent imports Claude Code sessions. If we adopt tree format internally, we need a conversion layer.
  4. Does the tree structure enable new capabilities? E.g., comparing different agent approaches on the same prompt, replaying from a checkpoint with different models.

Acceptance Criteria

  • Document trade-offs (storage overhead, parsing complexity, tooling requirements)
  • Prototype tree-structured session format for terraphim_persistence
  • Benchmark parse performance vs linear JSONL for 1000+ entry sessions
  • Decision: adopt, adapt, or reject with rationale

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions