Skip to content

[skip-cr] feat: repo-wide session counts on line 1 - #13

Merged
vtmocanu merged 4 commits into
mainfrom
feature/peer-sessions
Oct 4, 2026
Merged

vtmocanu merged 4 commits into
mainfrom
feature/peer-sessions

Conversation

@vtmocanu

@vtmocanu vtmocanu commented Oct 4, 2026

Copy link
Copy Markdown
Owner

Summary

Adds repo-wide session counts to the right edge of line 1 (STATUSLINE_PEERS, on by default). When another Claude Code session works in the same repository, every statusline in that repo shows the same picture, by state:

  • ⚙N busy (a turn or background subagent is running)
  • ◷N the turn ended but background shells are still running
  • ?N idle, and its last reply asked you something (reverse video)
  • ○N idle, asked nothing

Zero counts are omitted, a lone session renders as before, and the count the current session belongs to is bracketed ([⚙2] ?1 ○1). Codex peer threads are not counted.

How

  • States come from Claude Code's internal session registry (~/.claude/sessions/*.json): live pid, .status, .cwd inside a git worktree list path (symlinked cwd resolved on a miss). Registry files are parsed one by one so a malformed file is skipped.
  • ? reads each idle peer's transcript tail in one batched jq pass: a pending AskUserQuestion (no tool_result yet) or a final text line ending in ?.
  • Placed in line 1's spare columns with the update indicator; dropped, never truncated.

Testing

  • task ci: syntax, shellcheck, 206 tests in UTF-8 and LC_ALL=C, 75 fetcher tests in both locales.
  • 15 new tests: filters (self, other repo, dead pid, pid 0, unknown status, path-prefix lookalike, Codex shim, malformed file), symlinked cwd, zero counts, opt-out, width, placement with the update indicator, narrow drop, ? from text and from a pending/answered/cancelled question prompt, unsafe session ids.
  • Live: ran as the maintainer's statusline across the uzi and cc-statusline sessions; a background subagent was observed to keep a session busy.
  • Reviewed by the Codex buddy (REVISE: 4 items on 9b40251, all fixed in 6318320).

🤖 Generated with Claude Code

Count every live Claude Code session in the same repo (this one included)
from the session registry and show them right-aligned on line 1:
busy, background shells, waiting on you (?), and idle. Hidden when the
session is alone in its repo; STATUSLINE_PEERS=0 opts out. Codex shim
entries are excluded. The ? state is a transcript-tail hint. Docs pending.
Review fixes: parse registry files one by one so a malformed file cannot
hide the rest; reject pid 0; resolve a symlinked cwd before the worktree
match; treat an answered or cancelled question prompt as settled; read
every idle peer's transcript tail in one batched jq pass. The count the
current session belongs to is now bracketed in any state.
@coderabbitai

coderabbitai Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a05e575f-f84b-434a-a93d-1418aa887a04
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@vtmocanu
vtmocanu merged commit c74a4f7 into main Oct 4, 2026
2 checks passed
vtmocanu added a commit that referenced this pull request Oct 4, 2026
Repo-wide session counts on line 1 (#13) and the GPT context hold for
all-zero usage reports (#14).
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.

1 participant