Skip to content

[feat] Tail ahead-of-archive source sessions #308

Closed

Description

@Sinity

Problem

Current ingestion is timer-driven, so sessions are generally queryable
only after the archive catches up. That misses a primary use case:
"show me what the agent is doing now" or "search the latest session
state before the next ingest pass".

This is not a separate ontology of "live transcripts" or "partial
transcripts". A session state read from an actively written source file
should mean the same thing as a session state read from the stable
archive. The real distinction is only freshness and provenance:

  • stable archive state: the last ingested snapshot
  • tailed source state: newer source bytes that the archive has not yet
    absorbed

The repository should support tailing ahead-of-archive source state
through the normal query surface without inventing a second semantic
model, a second query language, or a special class of supposedly
non-final conversations.

Strengthened scope

This issue must resolve the architecture decisively and implement one
canonical path for tail/catch-up support.

Required outcomes:

  • choose one architecture rather than leaving both "query raw files
    directly" and "periodic ingest overlay" in play
  • preserve normal query semantics; tail mode must behave like ordinary
    archive querying, not a bespoke inspection mode with different result
    meaning
  • define explicit freshness/provenance semantics for ahead-of-archive
    source state without implying that the conversation model itself has
    changed
  • handle append growth, rewrite/truncation, duplication, disappearance,
    and archive catch-up deterministically
  • land an MVP for the highest-value provider first (Claude Code), with a
    substrate shape that other providers can adopt later

Architecture decision

This issue now chooses one canonical architecture for the MVP:

  • add an opt-in root tail mode (--tail, or an equivalent clearly
    tail-named surface) that queries an archive-shaped overlay, not a
    special live-only result model
  • the overlay consists of the normal archive as the base plus source
    artifacts that are ahead of the archive (unseen or observed with a
    newer materialized source state)
  • ahead-of-archive artifacts are reparsed and rematerialized through the
    existing parser and archive materialization pipeline; there is no raw
    file grep path and no provider-specific alternate query engine
  • for the MVP, the overlay must support Claude Code source sessions first
  • when a tailed source artifact corresponds to a session already present
    in the archive, the tailed state replaces the older archived state for
    query purposes; when it is unseen, it appears as a new queryable
    session
  • when stable ingest catches up to the same source state, tail mode stops
    adding any delta for that artifact; the query result then naturally
    matches ordinary archive mode again
  • each overlaid result must carry machine-readable provenance/freshness
    describing whether it came from archive state only or from an
    ahead-of-archive source observation

Design requirements

  • Tail mode must preserve the same conversation/query semantics as normal
    archive mode.
  • The implementation must keep archive meaning centralized rather than
    creating a second parallel query engine with different semantics.
  • Existing filters such as --since, --contains, provider filters,
    and session-oriented queries must behave coherently under tail mode.
  • Replacement and deduplication between tailed source state and archived
    state must be explicit and testable.
  • This should build on the temporal vocabulary from #311 rather than
    inventing a separate time model.
  • Operator-facing language should describe tailing, freshness, or
    catch-up, not "partial transcripts".

Acceptance criteria

  • A user can opt into querying Claude Code sessions with ahead-of-archive
    tailing instead of waiting for session close or the next scheduled
    ingest.
  • Tail-mode results use the same query/result semantics as ordinary
    archive results.
  • The implementation tolerates files that are being appended, rewritten,
    or removed without corrupting the stable archive.
  • Tests cover append growth, duplicate observation, replacement of older
    archived state by newer tailed state, and disappearance of the delta
    after archive catch-up.
  • The issue records the chosen architecture clearly enough that later
    provider support and #312 can build on it.

Non-goals

  • Full provider coverage in the first slice.
  • Attention or intent inference from source-write gaps.
  • Maintaining multiple long-term tail architectures in parallel.

Dependency value

This should land after #311 and is easier after #310, because tail
mode should reuse the normal query surface and content projection
contracts rather than inventing its own rendering path.

Activity

  1. changed the title [-][feat] Realtime / live-session ingestion[/-] [+][feat] Tail ahead-of-archive source sessions[/+] on Apr 23, 2026
  2. Sinity commented on Apr 23, 2026

    @Sinity
    OwnerAuthor

    Execution note:

    I am correcting the issue architecture before implementation.

    The prior "live / partial transcript" wording was wrong. This slice will
    instead implement tail/catch-up semantics:

    • same conversation and query model as ordinary archive reads
    • stable archive as the base dataset
    • ahead-of-archive Claude Code source files as a temporary tail overlay
    • no separate live-only transcript ontology
    • no raw-file grep side path

    Implementation direction for the MVP:

    • add an opt-in --tail root query mode
    • build a temporary overlay archive by snapshotting the normal DB and
      rematerializing only Claude Code source files whose observed state is
      ahead of raw_conversations.file_mtime
    • replace archived conversation state with newer tailed state when the
      same session advances
    • expose machine-readable tail provenance on results
    • block mutation routes in tail mode so we do not pretend temporary
      overlay writes are durable archive edits

    I’m executing that architecture now on
    feature/feat/tail-ahead-of-archive-sessions.

  3. Sinity commented on Apr 23, 2026

    @Sinity
    OwnerAuthor

    Execution update for #308:

  4. Sinity commented on Apr 23, 2026

    @Sinity
    OwnerAuthor

    Merged via PR #392: #392

    Landed on master as e714ef3b.

    What shipped:

    • --tail reuses normal query semantics instead of creating a separate live-mode ontology
    • stable archive remains the base dataset; ahead-of-archive Claude Code source state is layered into a temporary overlay archive for query-time reads
    • JSON/summaries expose machine-readable tail provenance when a result comes from unseen or ahead-of-archive source state
    • direct runtime coverage now exercises replacement, unseen-session, parse-failure fallback, and archive catch-up behavior

    Verification completed locally before merge:

    • targeted strict mypy
    • focused pytest coverage for overlay + CLI paths
    • devtools render-all
    • devtools verify
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:cliarea:pipelinearea:storagetype:feat

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions