squadrant 0.16.6 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1511 -448
- package/dist/index.js.map +1 -1
- package/dist/squadrantd.js +111 -104
- package/dist/squadrantd.js.map +1 -1
- package/package.json +1 -1
- package/plugin/skills/captain-ops/SKILL.md +26 -7
- package/scripts/read-handoff.sh +16 -4
package/package.json
CHANGED
|
@@ -8,17 +8,40 @@ description: Complete captain playbook — session startup, crew spawning, statu
|
|
|
8
8
|
## Session Startup
|
|
9
9
|
|
|
10
10
|
1. Read `~/.config/squadrant/config.json` — match your current working directory. Note your `spokeVault`, `group`, `groupRole`, and `maxCrew` (default: 5).
|
|
11
|
-
2. **Check for handoff
|
|
11
|
+
2. **Check for a handoff, and verify live repo state — every boot, not just when the handoff is missing:**
|
|
12
12
|
```bash
|
|
13
13
|
~/.config/squadrant/scripts/read-handoff.sh "{spokeVaultPath}"
|
|
14
|
+
squadrant handoff facts {project} --fetch
|
|
14
15
|
```
|
|
15
|
-
|
|
16
|
+
`read-handoff.sh` — if a handoff exists (`"exists"` is not false), read the context carefully:
|
|
16
17
|
- `currentState` — what was happening when the last session ended
|
|
17
18
|
- `openBranches` — branches with uncommitted/unmerged work
|
|
18
19
|
- `nextSteps` — what the previous session planned to do next
|
|
19
20
|
- `blockedItems` — unresolved blockers
|
|
20
21
|
- `decisions` — important decisions already made (don't re-decide)
|
|
21
|
-
The handoff file is
|
|
22
|
+
The handoff file is archived to `{spokeVault}/handoffs/<date>.json` after reading (not deleted) — use it as your primary context source.
|
|
23
|
+
|
|
24
|
+
`squadrant handoff facts {project} --fetch` — run this **every session start, unconditionally**, not only when the handoff is missing. `--fetch` is the one deliberate network call in your startup: it updates remote-tracking refs before reporting, so what follows is verified, not stale-and-silent. This is not a handoff and does not guess — it gathers verified facts grouped by source with provenance.
|
|
25
|
+
|
|
26
|
+
**Check `liveRepo.branchState` explicitly — these are flags, act on them directly, don't just skim past them:**
|
|
27
|
+
- `upstreamStatus: "behind"` — your local branch is stale relative to origin; don't trust local-only diffs until you've reconciled.
|
|
28
|
+
- `upstreamStatus: "diverged"` — both sides moved; this needs a decision (rebase/merge), not silence.
|
|
29
|
+
- `upstreamStatus: "upstream-gone"` — the remote branch was deleted; this local branch is likely done.
|
|
30
|
+
- `upstreamStatus: "no-upstream"` — never pushed.
|
|
31
|
+
- `dirtyWorkingTree: true` — uncommitted changes are sitting from a prior session; find out why before proceeding.
|
|
32
|
+
- `onUnexpectedBranch: true` — you're sitting on a `crew/*` worktree branch; a captain's own checkout normally shouldn't be.
|
|
33
|
+
- `mergedIntoBase: true` — this branch is fully merged into base already; safe to switch back to base / clean up.
|
|
34
|
+
- (This is the direct fix for a real incident: local `main` was 164 commits behind origin with no signal anything was wrong, and got reported as "188 commits ahead" when the true count was 24. Don't let that happen silently again — these flags exist so you don't have to eyeball `git log`.)
|
|
35
|
+
|
|
36
|
+
**Check tasks from the same call — `liveRepo.liveCrews`** lists every non-terminal crew task (name/state/task/question) for this project. A `state: "blocked"` entry with a `question` is waiting on you right now; don't miss it under everything else in the payload.
|
|
37
|
+
|
|
38
|
+
If `read-handoff.sh` reported `"exists": false`, reconstruct from this SAME `handoff facts` call's output instead of cold-starting blind — no need to run it twice:
|
|
39
|
+
- `checkpoint` — the newest archived handoff, if any, read in full (already covers history up to when it was written).
|
|
40
|
+
- `gapSessions` — captain sessions after the checkpoint, each with its own transcript (the work no handoff covers — read `meta.gapSessionIds` to see the boundary at a glance).
|
|
41
|
+
- `claudeMem` — your project's raw recent session summary and decisions.
|
|
42
|
+
- `meta` — which sources were actually available (`sourcesAvailable`/`sourcesMissing`), and `registryNote`/`checkpointFilename`/`usedFallbackWindow` explaining how the gap was determined.
|
|
43
|
+
|
|
44
|
+
**You do the synthesizing, not the command.** Compose your own understanding of `currentState`/`openBranches`/`nextSteps`/`blockedItems`/`decisions` from this evidence — cross-referencing `liveRepo` (exact, current) against `claudeMem` (distilled, can be stale) and each gap session's `transcript` (inference) yourself. State plainly in-session that this context is reconstructed and therefore inferred, not what the previous session actually wrote.
|
|
22
45
|
3. Search **claude-mem** (`mem-search` skill) for your project name to get additional continuity.
|
|
23
46
|
4. Check `{spokeVault}/daily-logs/` — read the most recent log if one exists.
|
|
24
47
|
5. Check `{spokeVault}/learnings/` — **selectively** load relevant learnings (see "Selective Loading" section below). Do NOT read all files — grep by task keywords and tags.
|
|
@@ -30,8 +53,6 @@ The handoff file is auto-deleted after reading. Use this as your primary context
|
|
|
30
53
|
If relevant pages exist, read them for context before starting work.
|
|
31
54
|
8. Crew lifecycle events (done / blocked / idle) are delivered to your captain pane automatically by the squadrant daemon via daemon-direct cmux delivery (#332). No relay setup required.
|
|
32
55
|
|
|
33
|
-
9. (Opt-in) Status writes are not required on every event. Only run `~/.config/squadrant/scripts/write-status.sh` when you have a meaningful note worth recording (a blocker, a deliberate "starting work on X", etc.) — not on a schedule.
|
|
34
|
-
|
|
35
56
|
## Crew Setup
|
|
36
57
|
|
|
37
58
|
You do NOT create an Agent Team. You spawn each crew session on demand as a **new tab** in your workspace via `squadrant crew spawn` (use `--direction right|down|...` to split into a pane instead). The surface is a fresh CLI session with the crew template loaded as system prompt — disposable, restartable, runtime-agnostic.
|
|
@@ -262,8 +283,6 @@ After a crew task completes:
|
|
|
262
283
|
5. Record learnings if any (see "Recording Learnings" below).
|
|
263
284
|
6. Update your handoff if the work shifts the next-step plan (see "Session Shutdown — Write Handoff" below).
|
|
264
285
|
|
|
265
|
-
Status writes (`write-status.sh`) are opt-in; you don't need to write status after every event.
|
|
266
|
-
|
|
267
286
|
## Status Board (show after substantive turns)
|
|
268
287
|
|
|
269
288
|
After a **substantive turn** — shipped a release, opened or merged a PR, filed an issue, spawned or closed crews, or moved multiple threads at once — end your reply with a tight scannable board. Skip it after trivial answers; the board is signal, not noise.
|
package/scripts/read-handoff.sh
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
2
|
# Usage: read-handoff.sh <spoke-vault-path> [--keep]
|
|
3
|
-
# Reads and prints handoff.json, then
|
|
4
|
-
# Captain calls this on session startup to load previous
|
|
3
|
+
# Reads and prints handoff.json, then archives it to handoffs/<date>.json
|
|
4
|
+
# (unless --keep). Captain calls this on session startup to load previous
|
|
5
|
+
# context.
|
|
5
6
|
set -euo pipefail
|
|
6
7
|
|
|
7
8
|
VAULT="${1:?Usage: read-handoff.sh <vault-path> [--keep]}"
|
|
@@ -16,7 +17,18 @@ fi
|
|
|
16
17
|
# Print the handoff content
|
|
17
18
|
cat "$HANDOFF_FILE"
|
|
18
19
|
|
|
19
|
-
#
|
|
20
|
+
# Archive (don't delete) unless --keep flag. Multi-session days are the norm
|
|
21
|
+
# (compacts, relaunches), so a same-day archive must never be clobbered by a
|
|
22
|
+
# later read on the same day — uniquify with -2, -3, ... instead of overwriting.
|
|
20
23
|
if [ "$KEEP" != "--keep" ]; then
|
|
21
|
-
|
|
24
|
+
ARCHIVE_DIR="$VAULT/handoffs"
|
|
25
|
+
mkdir -p "$ARCHIVE_DIR"
|
|
26
|
+
DATE=$(date -u +%Y-%m-%d)
|
|
27
|
+
DEST="$ARCHIVE_DIR/$DATE.json"
|
|
28
|
+
N=2
|
|
29
|
+
while [ -e "$DEST" ]; do
|
|
30
|
+
DEST="$ARCHIVE_DIR/$DATE-$N.json"
|
|
31
|
+
N=$((N + 1))
|
|
32
|
+
done
|
|
33
|
+
mv "$HANDOFF_FILE" "$DEST"
|
|
22
34
|
fi
|