---
description: Show the array of launch-beacon monitor sessions via the launch-beacon MCP — which is most recent, how many events each has, last event time, suspected liveness. Use to confirm a session is being recorded, find an old session to inspect, or audit disk usage. Read-only.
---

# /kit:beacon-array

Liveness + inventory across every `launch-beacon monitor` session this repo has recorded — one row per beacon in the array.

Parse `$ARGUMENTS` as space-separated tokens, in any order:
- `full` — expanded report. Empty → terse one-line-per-session summary.
- `--worktree=<slug>` — orbit worktree slug. Forwarded to MCP as the `worktree` arg.
- `--project_root=<path>` — explicit project root (absolute, or relative to cwd). Forwarded as `project_root`. Takes precedence over `--worktree`.

Examples:
- `/kit:beacon-array` → terse one-line-per-session summary
- `/kit:beacon-array full` → expanded report
- `/kit:beacon-array --worktree=beacon_rewrite` → enumerate sessions captured in that worktree
- `/kit:beacon-array full --worktree=beacon_rewrite` → expanded report for that worktree

## Enumerate sessions

Call `mcp__local-launch-beacon__beacon_sessions`, forwarding `worktree` / `project_root` if supplied. Returns an array of per-session summaries: token, event count, kind breakdown, first/last seq, last event timestamp.

If the response is `{sessions: []}` OR `{error: ...}`, **alert the user with the exact MCP error string**, then walk the fallback below — do NOT silently `ls`.

**Fallback when the MCP returns nothing:**
1. If the user did NOT pass `--worktree` / `--project_root` and `launch-orbit` has worktrees registered for this repo, suggest re-running with `--worktree=<slug>` before falling back to the filesystem.
2. Look for `.launchsecure/beacon-*.ndjson` in cwd, then in up to 2 parent dirs. Use the `Read` tool — never `ls`, `find`, or globbing as the primary path.
3. If files are found at an alternative path, tell the user the path mismatch explicitly: `"MCP scans <root>/.launchsecure/ but sessions live at <found-path>. Reading directly."`
4. If nothing is found anywhere, stop with: `"No beacon sessions found in .launchsecure/. Start one with: npx launch-beacon monitor"`.

## Per-session facts

For each session the MCP returns:
- **token** — session id
- **events** — total event count
- **last_ts** — last event timestamp (epoch ms)
- **last_kind** — kind of the last event (read from the kind breakdown's most-recent entry, or call `beacon_event(seq: last_seq)` for certainty)
- **kinds** — kind breakdown map (`{click: 142, fetch: 71, …}`)
- **first_seq / last_seq** — bounds

Compute **age** from `last_ts` (current epoch minus `last_ts`):
- < 5s → "just now"
- < 60s → "Ns ago"
- < 1h → "Nm ago"
- < 24h → "Nh ago"
- else → "Nd ago"

## Liveness heuristic

- **active** — `last_ts` is within the last 5 seconds (matches the receiver's batch-flush interval)
- **idle** — between 5 seconds and 30 minutes
- **stale** — older than 30 minutes (the receiver enforces a 30-min cap)

## Default output (no arguments)

```
.launchsecure/
  ● 8f3c2a91     247 events    click (just now)        ACTIVE
    a1b2c3d4      89 events    error (12m ago)         idle
    2557799f   1,247 events    route (2h ago)          stale

3 sessions, 1 active.
```

Rules:
- Glyph: `●` (filled) for active, blank for idle/stale.
- Columns: token (8 chars) — events (right-aligned, thousands-separated) — last event "kind (age)" — status word.
- Sort newest-first by `last_ts`.
- Summary line: total count + how many active.
- Plain text, monospace alignment.

## Full output (`/kit:beacon-array full`)

Same per-session block as default, then expand each:

```
● 8f3c2a91 — ACTIVE
   events:      247
   last event:  2026-05-26T12:20:51Z (just now)
   last kind:   click
   kinds:       click 142, fetch 71, route 12, error 3, dialog 9, probe 10
   seq range:   1–247
   started:     2026-05-26T12:12:33Z (8m ago)

  a1b2c3d4 — idle
   ...
```

For the `started` timestamp, call `mcp__local-launch-beacon__beacon_event` with `seq: <first_seq>, session: <token>` (and forward the same `worktree` / `project_root` args you used on `beacon_sessions`) and read its `ts`. Only do this for the full view — skip in the default view to keep it sub-second.

`kinds:` formatted as `kind1 N1, kind2 N2, …` sorted by count desc, comma-separated.

End with the same summary line as default.

## File size

The `beacon_sessions` summary does NOT include byte size. Both default and full views omit it — size isn't load-bearing for diagnosis. If the user explicitly asks ("how big is this file?"), fall back to `Read`-then-count or `wc -c` for that single file and tell them so: `"MCP doesn't expose byte size — falling back to wc -c."`.

## Constraints

- **MCP-first.** Use `beacon_sessions` and `beacon_event` — never `ls`, `wc`, `stat`, `tail`, `sed` as the primary path.
- **Alert on fallback.** If the MCP can't answer, say so verbatim before reading the files directly.
- **Read-only.** No deletion, no rotation, no auto-cleanup.
- **Fast.** Default view should be sub-second even with many sessions.
- **Plain text.** No markdown tables, no fenced blocks in the actual output.
- **Don't suggest cleanup.** That's `/kit:beacon-clear`'s job. Stale sessions are informational, not an error.
