sessions

A command for viewing and cleaning records of coding sessions that share work in one repository. It reads session status, heartbeats, branches, and worktree locations from a coordination file.

In plain words
What is it for?
Use it to list sessions, inspect one session's details, or clean stale sessions and their registered Git worktrees.
Why use it?
It helps identify sessions that may have crashed and removes stale coordination records and leftover Git worktrees. This reduces confusion when several agents work at once.

Command

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/rajconnects/founder-stack/sessions
Clone the repo
git clone --depth 1 https://github.com/rajconnects/founder-stack
Per session 22 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 534 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00022 $0.00534
Opus 5 $0.00011 $0.00267
Sonnet 5 $0.00004 $0.00107
Haiku 4.5 $0.00002 $0.00053

Measured yesterday against content hash fcb86c97bb7d, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

sessions scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

workflow/commands/sessions.md · 47 lines

How it starts

The opening of the file, as written. The whole thing — 47 lines — stays where its author put it; the contents beside it link to each section on GitHub.

You are inspecting parallel-session state.

Arguments: $ARGUMENTS (default: list)

Subcommands

list (default)

  1. Read .claude/coordination.json.
  2. Print a table:
    ID         STATUS              SEVERITY  PHASE       BRANCH                    HEARTBEAT (age)
    sess-abc   active              major     2a          phase-2a-billing          2m
    sess-def   completed           minor     docs        main                      —
    sess-ghi   completed_unclean   major     1c          phase-1c-auth             18m (stale)
    
  3. Below the table, list any rows where status: active and heartbeat age > staleness threshold — these are likely crashed sessions.

show <id>

Print the full row for <id> as pretty JSON. Resolve <id> against either id or resume_id (substring match OK).

clean

  1. Read .claude/coordination.json.
  2. For each row with status: active and heartbeat older than _doc.staleness_threshold_minutes:
    • Flip to completed_unclean, set completed to now.
  3. For each completed_unclean row whose worktree path exists on disk and is registered in git worktree list:
    • Run git worktree remove --force '<path>'. Capture stderr.
  4. Print a summary:
    Swept N stale rows. Removed M worktrees. K paths needed manual cleanup:
      - <path>: <reason>
    
  5. Surface anything that needs the user's eyes — never silently delete uncommitted work in a worktree without warning. If git worktree remove complains about uncommitted changes, do not add --force automatically; report and ask.

Notes

  • This command is read-mostly. clean is the only writer beyond status flips. Never mutate the claims of another session — those are owned by their writer.
  • Heartbeat ages are computed against the system clock at command run.
  • /sessions clean is the only sweep mechanism in v0.1. A scheduled background script is on the roadmap; until then, run /sessions clean manually when list shows stale rows.

Read the full file on GitHub · 47 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 47 lines · 22 tokens per session scan A fcb86c97bb7d

Subscribe to this mod's changes

sessions is a command published in the GitHub repository rajconnects/founder-stack (2 stars, last pushed 1mo ago), licensed MIT. It adds 22 tokens to every session and 534 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.