Skip to content

Add README sessions pulse helper #794

Description

@quick-ricon

Goal

Add a shimmer-owned README helper that can refresh the local session pulse snapshot used by README.tsx.

The README wants to show local machine session topology as a deliberate snapshot, not as build-time nondeterminism. The useful numbers are:

  • recorded sessions in the local sessions corpus
  • live session processes
  • branch tips in the session forest

Why tips, not branches

A branch tip is a terminal session head: a session node with no child sessions. That answers the operational question: "how many resumable/current conversation heads exist?"

Counting "branches" is ambiguous and overcounts history: it could mean fork events, root-to-leaf paths, named continuations, or internal split segments. A long linear continuation chain should still count as one tip; a singleton session with no children is also one tip.

Current findings

Read-only probes on Or's machine on 2026-06-23:

sessions query --limit 10000 --sql 'select count(*) from sessions' --format json
# recorded sessions: 659

sessions ps --json
# live session processes: 0

For branch tips, current sessions query does not expose structured session-to-session edges. The only path found today is parsing the fork notice text emitted by sessions copy:

with fork_edges as (
  select
    session_id as child_session_id,
    substr(
      text_excerpt,
      instr(text_excerpt, 'forked from ') + length('forked from '),
      36
    ) as parent_session_id
  from messages
  where text_excerpt like '[Session Fork Notice]%'
    and instr(text_excerpt, 'forked from ') > 0
)
select
  (select count(*) from sessions) as recorded_sessions,
  (select count(*) from fork_edges) as fork_edges,
  (select count(*) from sessions s where not exists (
    select 1 from fork_edges e where e.parent_session_id = s.session_id
  )) as branch_tips;

That returned:

recorded_sessions: 659
fork_edges: 3
branch_tips: 657

Proposed shimmer work

Add a task group such as:

shimmer readme sessions-pulse
# or
shimmer readme:sessions-pulse --json

It should:

  1. Use sessions query --limit <large> for recorded session count.
  2. Use sessions ps --json for live process count.
  3. Count branch tips from a structured edge source if available.
  4. Until sessions query exposes session edges, either:
    • use the fork-notice SQL parser with a clear caveat, or
    • block on / coordinate a sessions enhancement that projects sourceSessionId / fork edges into SQL.
  5. Print a README.tsx snippet or JSON payload that makes refreshing the manual snapshot easy.
  6. Include BATS coverage with a mocked sessions binary; tests must not depend on Or-machine session history.

Acceptance

  • README.tsx documents the refresh command in comments.
  • README.md includes a manual snapshot with recorded sessions, branch tips, live processes, capture date, and source.
  • README generation stays deterministic in CI; no build-time calls to sessions.
  • The helper has tests and handles missing sessions / jq with clear errors.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions