/streams — the parallel-contribution janitor
You maintain state/active-streams.yaml as the live coordination substrate for every parallel stream, and
you garbage-collect abandoned work. The operating model is adrs/drafts/parallel-contribution-operating-model.md;
the protocol every stream follows is playbooks/stream-coordination.md; the resource inventory is
adrs/drafts/parallel-contribution-infra.md (R1-R9 / O1-O10). This skill is the read + reconcile + GC view.
$ARGUMENTS: empty → the full dashboard. <stream-id> → focus one stream. gc → run the reclaim sweep.
1. Read + verify-live (never trust the record — O4/O8/O9)
Read state/active-streams.yaml. For every entry, re-derive the truth from the working trees and docker —
a record is a claim, the tree is the truth:
git -C ../odd-platform rev-parse HEAD + --abbrev-ref HEAD + git status --porcelain (vs the recorded head/branch).
- the same for
../documentation and every ../odd-platform-<id> worktree (git worktree list).
git -C ../odd-platform status lineage/ + the probe_run_id in lineage/odd-platform/feature-flows.yaml
(who actually holds the R9 lineage lock — never guess a stream; O8).
docker ps (which <id>-* / probe-* stacks + ports + images are live) — a <id>-* or probe-* stack
whose <id> has no LIVE entry is an ORPHAN stack (a crashed/manual run that skipped teardown) → GC it (§3).
cat state/locks/heavy-e2e.holder — the flock holder of the serialized heavy-e2e lock (the authoritative
"who is running the full regression right now"; absent = the lock is free; see run-regression.sh).
Reconcile the registry to what you observe: fix stale heads, wrong lock holders, and the unowned_dirty_state
block. Stamp each touched entry with a verified-at. Commit the reconciliation (explicit path, atomic).
2. Classify each stream
- LIVE —
updated within the heartbeat window (default 4h) and a non-terminal phase; its worktree +
stack match the record. Leave it; just report.
- STALE —
updated older than the window AND a non-terminal phase (intake…pr-pending). The session likely
ended mid-flight. Candidate for resume/reclaim.
- ORPHANED — a worktree / contrib branch / held port / image tag with no registry entry, OR an entry
whose isolation no longer exists on disk. Also:
unowned_dirty_state (dirty paths no entry claims — e.g. a
probe-run's lineage/** residue, a stray spec). Surface it; never sweep it (O10).
- COMPLETE — terminal (
merged/done/blocked/review-complete). Should already be cleared; clear it.
3. Offer per STALE / ORPHANED stream (the GC) — gc mode
For each, present the options; never act destructively without the work captured or an explicit discard:
- resume — the worktree + branch + record are intact; print the exact commands to re-attach (the
cd ../odd-platform-<id>, the SUT tag, the ports) and the next pending DoD gate. Nothing is reclaimed.
- reclaim — free the namespace only after the work is captured (the contrib branch is pushed to origin,
or its uncommitted diff is saved to
state/abandoned/<id>.patch with a one-line provenance header and
surfaced). Then free, in order: tear down its stack — docker compose -p <id> -f lineage/_extractor/probe-stacks/odd-minimal.docker-compose.yml down -v (containers + network + volume; the
backstop for a run that crashed before run-regression.sh's teardown trap fired) — drop the image tag
(docker image rm odd-platform:odd-team-sut-<id>), remove the worktree, release the ports, clear the registry
entry. Print what was captured + where before freeing anything.
- discard — maintainer-confirmed only. Even then, save the diff to
state/abandoned/<id>.patch first
(a discard is recoverable for one release cycle), then free the namespace.
The invariant (non-negotiable): abandoned work is never silently lost and never silently blocking. Every
reclaim either pushes the branch or parks the patch; every discard parks the patch and is human-confirmed.
4. The dashboard (default, no args)
Print a compact table: id · role · work-item · phase · LIVE/STALE/ORPHANED · isolation (worktree/image/ports) · lineage-lock? · last-verified. Then:
- Next-free namespace — the lowest unused stream id pattern + the next free port pair + the next image tag,
so a starting stream can copy them (the
shared_resources.next_free values, re-derived live).
- Serialized-resource status — who holds
lineage/** (R9); the heavy-e2e flock (cat state/locks/heavy-e2e.holder — the authoritative one-at-a-time holder that run-regression.sh acquires,
G-C2); and the wants: e2e queue order.
- GC candidates — the STALE/ORPHANED list with the recommended action each.
Rules
- Verify live over record, always (O4/O8/O9). If the registry and the tree disagree, the tree wins; fix the
registry.
- Never sweep what you do not own (O10). Unowned dirty state is reported for its owner to reconcile; this
skill does not
git checkout -- / git add / revert another stream's paths. The single exception is a
human-confirmed discard, and even then the diff is parked first.
- Capture before reclaim. No worktree is removed and no branch is deleted until its work is pushed or parked.
- Atomic registry commits (explicit path; never
git add -A — R5/O3).
- This skill is read-mostly + reconcile; it does not run builds, suites,
/enrich, or pushes of code. It
curates the coordination substrate so the other skills run safely in parallel.
1---2name: streams3description: The parallel-work janitor. Lists every active /contribute + /review + probe-run stream from state/active-streams.yaml, reconciles each against the LIVE working trees (never the records), flags STALE / ORPHANED streams, and offers resume / reclaim / discard — with the invariant that no resource is reclaimed until its work is captured. Run it to see what is in flight, to pick a non-colliding namespace before starting a stream, or to clean up after abandoned work.4---56# /streams — the parallel-contribution janitor78You maintain `state/active-streams.yaml` as the **live** coordination substrate for every parallel stream, and9you garbage-collect abandoned work. The operating model is `adrs/drafts/parallel-contribution-operating-model.md`;10the protocol every stream follows is `playbooks/stream-coordination.md`; the resource inventory is11`adrs/drafts/parallel-contribution-infra.md` (R1-R9 / O1-O10). This skill is the read + reconcile + GC view.1213`$ARGUMENTS`: empty → the full dashboard. `<stream-id>` → focus one stream. `gc` → run the reclaim sweep.1415## 1. Read + verify-live (never trust the record — O4/O8/O9)1617Read `state/active-streams.yaml`. For **every** entry, re-derive the truth from the working trees and docker —18a record is a claim, the tree is the truth:1920- `git -C ../odd-platform rev-parse HEAD` + `--abbrev-ref HEAD` + `git status --porcelain` (vs the recorded `head`/branch).21- the same for `../documentation` and every `../odd-platform-<id>` worktree (`git worktree list`).22- `git -C ../odd-platform status lineage/` + the `probe_run_id` in `lineage/odd-platform/feature-flows.yaml`23 (who actually holds the R9 lineage lock — never guess a stream; O8).24- `docker ps` (which `<id>-*` / `probe-*` stacks + ports + images are live) — a `<id>-*` or `probe-*` stack25 whose `<id>` has **no LIVE entry** is an ORPHAN stack (a crashed/manual run that skipped teardown) → GC it (§3).26- `cat state/locks/heavy-e2e.holder` — the flock holder of the serialized heavy-e2e lock (the authoritative27 "who is running the full regression right now"; absent = the lock is free; see `run-regression.sh`).2829Reconcile the registry to what you observe: fix stale heads, wrong lock holders, and the `unowned_dirty_state`30block. Stamp each touched entry with a `verified-at`. Commit the reconciliation (explicit path, atomic).3132## 2. Classify each stream3334- **LIVE** — `updated` within the heartbeat window (default **4h**) and a non-terminal `phase`; its worktree +35 stack match the record. Leave it; just report.36- **STALE** — `updated` older than the window AND a non-terminal `phase` (intake…pr-pending). The session likely37 ended mid-flight. Candidate for resume/reclaim.38- **ORPHANED** — a worktree / contrib branch / held port / image tag with **no** registry entry, OR an entry39 whose isolation no longer exists on disk. Also: `unowned_dirty_state` (dirty paths no entry claims — e.g. a40 probe-run's `lineage/**` residue, a stray spec). Surface it; never sweep it (O10).41- **COMPLETE** — terminal (`merged`/`done`/`blocked`/review-complete). Should already be cleared; clear it.4243## 3. Offer per STALE / ORPHANED stream (the GC) — `gc` mode4445For each, present the options; **never act destructively without the work captured or an explicit discard**:4647- **resume** — the worktree + branch + record are intact; print the exact commands to re-attach (the48 `cd ../odd-platform-<id>`, the SUT tag, the ports) and the next pending DoD gate. Nothing is reclaimed.49- **reclaim** — free the namespace **only after the work is captured** (the contrib branch is pushed to origin,50 **or** its uncommitted diff is saved to `state/abandoned/<id>.patch` with a one-line provenance header and51 surfaced). Then free, in order: **tear down its stack** — `docker compose -p <id> -f52 lineage/_extractor/probe-stacks/odd-minimal.docker-compose.yml down -v` (containers + network + volume; the53 backstop for a run that crashed before `run-regression.sh`'s teardown trap fired) — drop the image tag54 (`docker image rm odd-platform:odd-team-sut-<id>`), remove the worktree, release the ports, clear the registry55 entry. Print what was captured + where before freeing anything.56- **discard** — maintainer-confirmed only. Even then, save the diff to `state/abandoned/<id>.patch` first57 (a discard is recoverable for one release cycle), then free the namespace.5859**The invariant (non-negotiable):** abandoned work is never silently lost and never silently blocking. Every60reclaim either pushes the branch or parks the patch; every discard parks the patch and is human-confirmed.6162## 4. The dashboard (default, no args)6364Print a compact table: `id · role · work-item · phase · LIVE/STALE/ORPHANED · isolation (worktree/image/ports)65· lineage-lock? · last-verified`. Then:6667- **Next-free namespace** — the lowest unused stream id pattern + the next free port pair + the next image tag,68 so a starting stream can copy them (the `shared_resources.next_free` values, re-derived live).69- **Serialized-resource status** — who holds `lineage/**` (R9); the heavy-e2e flock (`cat70 state/locks/heavy-e2e.holder` — the authoritative one-at-a-time holder that `run-regression.sh` acquires,71 G-C2); and the `wants: e2e` queue order.72- **GC candidates** — the STALE/ORPHANED list with the recommended action each.7374## Rules7576- **Verify live over record, always** (O4/O8/O9). If the registry and the tree disagree, the tree wins; fix the77 registry.78- **Never sweep what you do not own** (O10). Unowned dirty state is reported for its owner to reconcile; this79 skill does not `git checkout --` / `git add` / revert another stream's paths. The single exception is a80 human-confirmed `discard`, and even then the diff is parked first.81- **Capture before reclaim.** No worktree is removed and no branch is deleted until its work is pushed or parked.82- **Atomic registry commits** (explicit path; never `git add -A` — R5/O3).83- This skill is **read-mostly + reconcile**; it does not run builds, suites, `/enrich`, or pushes of code. It84 curates the coordination substrate so the other skills run safely in parallel.