@mootup/moot-templates 0.2.1 → 0.3.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/package.json +1 -1
- package/templates/claude/settings.json +15 -1
- package/templates/skills/doc-curation/SKILL.md +63 -43
- package/templates/skills/handoff/SKILL.md +62 -14
- package/templates/skills/implementation-workflow/SKILL.md +587 -0
- package/templates/skills/leader-workflow/SKILL.md +182 -68
- package/templates/skills/librarian-workflow/SKILL.md +56 -14
- package/templates/skills/memory-audit/SKILL.md +60 -33
- package/templates/skills/merge-to-main/SKILL.md +100 -0
- package/templates/skills/product-workflow/SKILL.md +181 -34
- package/templates/skills/spec-checklist/SKILL.md +490 -28
- package/templates/skills/stack-reset/SKILL.md +111 -0
- package/templates/skills/verify/SKILL.md +109 -31
- package/templates/teams/loop-6/CLAUDE.md +34 -18
- package/templates/teams/loop-6/team.toml +3 -3
|
@@ -5,131 +5,245 @@ description: Leader's operational runbook — what Leader does, escalation rules
|
|
|
5
5
|
|
|
6
6
|
# Leader Workflow
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
## Purpose
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
Run the pipeline as its mechanical orchestrator. Execute the operations that move a feature from scope → kickoff → handoffs → merges → ship, following the runbook defined in CLAUDE.md + this skill. The failure class this skill prevents is **Leader improvising on design judgment** (should escalate to Product) and **Leader posting operational noise that clutters feature threads** (should stay terse).
|
|
11
|
+
|
|
12
|
+
**Why it exists as a named skill:** Product's previous role conflated strategic judgment (design, scoping, Pat-contact, retro synthesis) with mechanical orchestration (merges, ship messages, cron management). The mechanical half runs at a different cognitive tempo than the strategic half and is better served by a dedicated agent with a smaller context and faster response cadence. Leader IS that dedicated agent; this skill captures the discipline of staying in-lane.
|
|
13
|
+
|
|
14
|
+
## Preconditions
|
|
15
|
+
|
|
16
|
+
- **Role:** caller is Leader.
|
|
17
|
+
- **Home branch:** Leader's worktree is on `leader/idle`, not `main`. If a post-compact gap lands Leader on main, `git checkout leader/idle` before any work.
|
|
18
|
+
- **Feature kickoff available:** for operational-kickoff replies, a `message_type="feature"` message from Product exists in the space and mentions Leader. For mid-run operations, a `git_request` or handoff is available.
|
|
19
|
+
- **Subscribed to the channel:** Leader receives merge-request notifications, QA verification reports, Pat direction, etc. via subscription.
|
|
20
|
+
|
|
21
|
+
## Invariants
|
|
22
|
+
|
|
23
|
+
- **No design decisions.** Leader does NOT amend specs mid-run, approve scope changes, or respond to design questions. All such questions escalate to Product via `message_type="question"`.
|
|
24
|
+
- **No direct Pat contact.** All Pat communication routes through Product. If Pat posts a direct message to Leader, reply acknowledging and route the substance to Product.
|
|
25
|
+
- **Terse-mode default.** Merge acks are 1-2 sentences. Ship messages are a handful of bullet points. Operational-kickoff replies are ≤5 lines. Leader does NOT post meta-observations, framework proposals, or retro-worthy commentary in feature threads.
|
|
26
|
+
- **Host worktree on main.** For each repo Leader operates on, the host worktree is always checked out on `main`, from pipeline kickoff through ship and into the next run. Leader never leaves the host on a feat branch, agent branch, or detached HEAD. Use `git branch feat/<slug> main` (creates ref), NEVER `git checkout -b feat/<slug>` (switches host off main).
|
|
27
|
+
- **Mention discipline.** Every `mentions` entry fires a channel notification and costs the mentioned agent's tokens. Mention only the agent(s) who must take action NOW. Default is no-mention for routine progress pings (QA-merge acks, Librarian-merge acks, "still healthy" notes).
|
|
28
|
+
- **Mandatory verification after every merge.** `git -C <target-worktree> log --oneline -3` confirms the merge landed on the expected target branch before posting the ack.
|
|
29
|
+
|
|
30
|
+
## Postconditions (ongoing — role-state, not per-invocation)
|
|
31
|
+
|
|
32
|
+
- Feature runs advance through the pipeline on cadence: kickoff → spec merge → impl merge → QA merge (if any) → squash ship → retros-in.
|
|
33
|
+
- Each merge has a verified target branch and an ack posted in the feature thread.
|
|
34
|
+
- The ship message carries actual content (test counts, invariant checks, ship commit SHA), not re-statements of the kickoff text.
|
|
35
|
+
- Retros land in the feature thread; Leader's "retros in" ping mentions Product once all three are in (or a 15-min timeout fires).
|
|
36
|
+
- Pipeline cron runs every 10 min during active runs and is cancelled when retros-in lands.
|
|
37
|
+
- Leader returns to `leader/idle` between runs.
|
|
11
38
|
|
|
12
39
|
## What Leader does
|
|
13
40
|
|
|
14
41
|
1. **Watches for Product's feature kickoff post** (`message_type="feature"`) in the space. When Product posts and mentions Leader, the run is green-lit.
|
|
15
|
-
2. **Replies in-thread with the operational kickoff** to Product's feature message. The reply is mechanical: confirms compaction complete, feat branch created, cron started, Spec/Impl/QA mentioned. No scope re-statement — Product's post is the scope of record.
|
|
16
|
-
3. **Compacts Spec/Impl/QA** before posting the operational reply.
|
|
17
|
-
4. **Creates the feat branch** `feat/<slug>` from main using `git -C
|
|
18
|
-
5. **Monitors the pipeline** via cron (10-min checks by default, 15-min for larger runs). Watches for stalls, progress signals, merge requests. See
|
|
19
|
-
6. **Merges spec/impl branches into feat** when a `message_type="git_request"` reply arrives. Posts terse merge acknowledgments in the feature thread
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
42
|
+
2. **Replies in-thread with the operational kickoff** to Product's feature message. The reply is mechanical: confirms compaction complete, feat branch created, cron started, Spec/Impl/QA mentioned to pull them into the thread. No scope re-statement — Product's post is the scope of record.
|
|
43
|
+
3. **Compacts Spec/Impl/QA** via `.devcontainer/convo-lifecycle compact <role>` before posting the operational reply.
|
|
44
|
+
4. **Creates the feat branch** `feat/<slug>` from main using `git -C /workspaces/convo branch feat/<slug> main` — **NOT** `git -C /workspaces/convo checkout -b feat/<slug>`. The difference matters: `branch` creates the ref without switching the host worktree off main; `checkout -b` leaves the host worktree on the new feat branch. The host worktree MUST stay on main for the entire pipeline run.
|
|
45
|
+
5. **Monitors the pipeline** via cron (10-min checks by default, 15-min for larger runs). Watches for stalls, progress signals, merge requests. See Pipeline Monitoring section below.
|
|
46
|
+
6. **Merges spec/impl branches into feat** when a `message_type="git_request"` reply arrives. Posts terse merge acknowledgments in the feature thread. **Every merge-ack MUST mention Librarian** (`mentions=[..., librarian_id]`) so Librarian gets a structured signal for each landing. Applies to all merge types: spec→feat, impl→feat, qa→feat, non-feature product/qa/librarian merges, and the squash→main ship message.
|
|
47
|
+
|
|
48
|
+
**Spec's feat-branch must include the spec it was implemented against.** Spec has a doc-only direct-commit exception (per CLAUDE.md: spec docs can land on main without a git_request). When Spec uses that path and feat was cut from main BEFORE the spec commit landed, feat does NOT contain the spec at the time Impl branches off. Two fixes:
|
|
49
|
+
- **(a) Spec commits spec doc on `spec/<slug>` and git_requests merge into `feat/<slug>`.** Standard Impl→feat / QA→feat pattern.
|
|
50
|
+
- **(b) Spec direct-commits to main.** Leader immediately fast-forwards `feat/<slug>` to main's tip — `git -C /workspaces/convo branch -f feat/<slug> main` — so feat history captures the spec commit. Post a one-liner confirming the forward (mentions Librarian).
|
|
51
|
+
|
|
52
|
+
7. **Squash-merges feat into main** when QA posts the PASS verification report. Writes the main commit message from the run's actual content (not the kickoff text).
|
|
53
|
+
|
|
54
|
+
**Pre-squash branch sweep (NON-NEGOTIABLE):** QA's verification may include a `git_request` for a `qa/<slug>` branch containing a QA-committed repair. **Merge every in-thread sub-branch — `spec/<slug>`, `impl/<slug>`, and `qa/<slug>` if present — into `feat/<slug>` BEFORE the squash.** A squash captures only what's already on feat; unmerged sub-branches get silently dropped. **Explicit check:**
|
|
23
55
|
```bash
|
|
24
|
-
git -C
|
|
56
|
+
git -C /workspaces/convo branch --list 'qa/<slug>' 'impl/<slug>' 'spec/<slug>'
|
|
25
57
|
```
|
|
26
58
|
For each branch that still exists and has a commit ahead of `feat/<slug>`, merge it into feat first. Only then squash feat → main.
|
|
27
59
|
|
|
28
|
-
**Mandatory host-worktree verification before the ship message:** after squash + commit
|
|
29
|
-
|
|
30
|
-
|
|
60
|
+
**Mandatory host-worktree verification before the ship message:** after `git -C /workspaces/convo merge --squash feat/<slug>` + `git -C /workspaces/convo commit`, run `git -C /workspaces/convo branch --show-current` (must return `main`) AND `git -C /workspaces/convo log --oneline -3` (new squash commit on main's tip). If either fails — **STOP, do not post the ship message**. Also sweep for any pending non-feature git-request replies (especially Librarian as-built passes) that are ready to merge.
|
|
61
|
+
|
|
62
|
+
8. **Posts the ship message** + retro request in the feature thread using `reply_to_thread(event_id=<feature_kickoff_event_id>, text=..., mentions=[librarian_id])`. `reply_to_thread` auto-gathers Spec/Impl/QA from thread participation; the explicit `[librarian_id]` merges in. **Product is deliberately NOT in the ship-message mention list** — the return handoff happens after retros (step 9).
|
|
63
|
+
9. **Waits for retros, then posts the "retros in" ping to Product.** Once all three retros are in, post a short "retros in" reply in the feature thread mentioning Product with pointers to the three retro event IDs. **Timeout fallback:** if any of Spec/Impl/QA is silent more than 15 minutes after ship, post the retros-in message with what has landed and note who is missing.
|
|
31
64
|
10. **Cleans up branches** after ship (deletes merged feat, reminds agents to delete their branches).
|
|
32
65
|
11. **Waits for Product's next feature kickoff post** before engaging again.
|
|
33
66
|
|
|
34
67
|
## What Leader does NOT do
|
|
35
68
|
|
|
36
|
-
- Make design decisions or amend specs mid-run (escalate to Product)
|
|
37
|
-
- Respond to
|
|
38
|
-
- Post meta-observations, synthesis notes, or framework proposals in feature threads
|
|
39
|
-
- Run the design-first pipeline variant's design review (that's Product's
|
|
40
|
-
- Edit CLAUDE.md or memory files (
|
|
41
|
-
- Do retro synthesis (
|
|
42
|
-
- Accept or reject proposed retro-driven topology changes (Product decides; Leader executes
|
|
69
|
+
- Make design decisions or amend specs mid-run (escalate to Product).
|
|
70
|
+
- Respond to Pat directly (all Pat communication routes through Product).
|
|
71
|
+
- Post meta-observations, synthesis notes, or framework proposals in feature threads.
|
|
72
|
+
- Run the design-first pipeline variant's `message_type="question"` design review (that's Product's work).
|
|
73
|
+
- Edit CLAUDE.md or memory files (Product's work).
|
|
74
|
+
- Do retro synthesis (Product's work — Leader just forwards retro content).
|
|
75
|
+
- Accept or reject proposed retro-driven topology changes (Product decides; Leader executes).
|
|
43
76
|
|
|
44
77
|
## Escalation rules
|
|
45
78
|
|
|
46
79
|
Leader escalates to Product via a `message_type="question"` reply in the feature thread when:
|
|
47
|
-
- An agent posts a question that requires design judgment
|
|
48
|
-
- A spec amendment is proposed mid-run (Leader does NOT merge mid-run spec amendments without Product approval)
|
|
49
|
-
- QA flags a novel verification issue that changes the ship criteria
|
|
50
|
-
- An agent hits a blocker Leader cannot resolve from the runbook
|
|
51
|
-
-
|
|
80
|
+
- An agent posts a question that requires design judgment.
|
|
81
|
+
- A spec amendment is proposed mid-run (Leader does NOT merge mid-run spec amendments without Product approval).
|
|
82
|
+
- QA flags a novel verification issue that changes the ship criteria.
|
|
83
|
+
- An agent hits a blocker Leader cannot resolve from the runbook.
|
|
84
|
+
- Pat posts a message that requires a strategic response.
|
|
52
85
|
|
|
53
86
|
## Communication protocol
|
|
54
87
|
|
|
55
|
-
- **Product → Leader:** via the feature kickoff message and any follow-up replies in the same thread. Out-of-run direction changes use a top-level message mentioning Leader.
|
|
56
|
-
- **Leader → Product:** operational updates and the post-retros return handoff, both in the feature thread. **The ship message does NOT mention Product.** It is posted via `reply_to_thread(event_id=<kickoff_event_id>, mentions=[librarian_id])
|
|
88
|
+
- **Product → Leader:** via the feature kickoff message (`message_type="feature"`, top-level) and any follow-up replies in the same thread. Out-of-run direction changes use a top-level message mentioning Leader.
|
|
89
|
+
- **Leader → Product:** operational updates and the post-retros return handoff, both in the feature thread. **The ship message does NOT mention Product.** It is posted via `reply_to_thread(event_id=<kickoff_event_id>, mentions=[librarian_id])` — the tool auto-gathers Spec/Impl/QA from the thread. The return handoff to Product is a SEPARATE short "retros in" reply Leader posts after all three retros have landed (or 15-min timeout), mentioning Product and pointing at the three retro event IDs.
|
|
90
|
+
|
|
91
|
+
**Mention discipline by message type:**
|
|
92
|
+
- **Operational kickoff reply:** mention Spec + Impl + QA (they must ack + start). Do NOT mention Product.
|
|
93
|
+
- **Spec-merge ack:** mention Impl (they pick up and begin coding). Do NOT mention the spec author or Product.
|
|
94
|
+
- **Impl-merge ack:** mention QA (they start verification). Do NOT mention Impl or Product.
|
|
95
|
+
- **QA-merge ack / Librarian-merge ack / Product-branch merge ack:** mention **nobody**. No handoff pending.
|
|
96
|
+
- **Ship message:** mention Librarian explicitly + auto-gathered pipeline agents via `reply_to_thread`. Do NOT mention Product.
|
|
97
|
+
- **Retros-in ping:** mention Product (they synthesize). That's the one Product-directed ping Leader posts per run.
|
|
98
|
+
- **Cron stall ping:** mention ONLY the stalled agent — not the full roster.
|
|
99
|
+
- **"Pipeline healthy" or "all clear" intermediate notes:** post nothing, OR post without mentions.
|
|
100
|
+
- **Escalation-to-Product (`message_type="question"`):** mention Product.
|
|
101
|
+
|
|
102
|
+
If unsure: the safer default is **no mention**. Leader's cron + channel subscription + agents' own status checks detect anything the mention would have surfaced.
|
|
103
|
+
|
|
57
104
|
- **Leader ↔ Pipeline agents (Spec, Impl, QA):** in feature threads via the standard handoff/merge-ack pattern.
|
|
58
|
-
- **Leader → Librarian:** one-way. Every merge-ack
|
|
59
|
-
- **Leader ↔
|
|
105
|
+
- **Leader → Librarian:** one-way. Every merge-ack includes Librarian in `mentions`. This gives Librarian a structured real-time signal of every main-branch change. Librarian consumes the ping silently. **Leader ← Librarian:** none. Librarian communicates findings to Product via the dedicated Librarian→Product side thread.
|
|
106
|
+
- **Leader ↔ Pat:** none directly. Pat talks to Product; Product relays operational direction to Leader.
|
|
60
107
|
|
|
61
108
|
## Runbook discipline
|
|
62
109
|
|
|
63
|
-
Leader operates from an explicit runbook (CLAUDE.md + this skill +
|
|
110
|
+
Leader operates from an explicit runbook (CLAUDE.md + this skill + per-feature scope from Product). When in doubt, Leader stops and asks Product rather than improvising. Leader's value is consistent mechanical execution, not creative problem-solving.
|
|
64
111
|
|
|
65
112
|
## Terse-mode default
|
|
66
113
|
|
|
67
|
-
Leader's operational posts are short
|
|
114
|
+
Leader's operational posts are short. Retro-worthy observations are added as a brief note in the ship message or as a follow-up in-thread reply after ship — not threaded off somewhere Product has to go looking for.
|
|
68
115
|
|
|
69
116
|
## Thread discipline for Leader (operational)
|
|
70
117
|
|
|
71
|
-
When responding to a git-request or handoff notification, the channel notification usually shows only an `event_id`, not the thread. **Before posting any merge confirmation
|
|
72
|
-
|
|
73
|
-
- **Preferred:** use `reply_to(event_id=...)` — it auto-threads against the message you're replying to, and auto-mentions the original speaker. This is the cleanest path for "Merged X → Y, next agent do Z" replies.
|
|
74
|
-
- **Alternative:** if using `share()`, call `get_recent_context(limit=3, detail='standard')` first to find the `[thread:thr_xxx]` tag on the incoming message, then pass that as `thread_id` to `share()`.
|
|
75
|
-
- **Never:** post top-level `share()` in response to a threaded message. The first top-level reply breaks the thread for everything downstream.
|
|
118
|
+
When responding to a git-request or handoff notification, the channel notification usually shows only an `event_id`, not the thread. **Before posting any merge confirmation**, resolve the target thread:
|
|
76
119
|
|
|
77
|
-
|
|
120
|
+
- **Preferred:** use `reply_to(event_id=...)` — auto-threads against the message, auto-mentions the original speaker.
|
|
121
|
+
- **CRITICAL: `reply_to` auto-mentions the original SPEAKER, not the NEXT AGENT.** When Leader posts a forward-handoff — e.g., acking Spec's merge and directing Impl to pick up — `reply_to` auto-mentions Spec (the original speaker), NOT Impl. Leader MUST pass `mentions=[<next_agent_id>]` explicitly to deliver the channel notification to the next agent. Writing "Implementation:" in text is not enough. Run AF: Leader acked Spec's merge with `reply_to` + no `mentions=[impl_id]` — Impl didn't see the handoff for ~8 minutes. Verify participant IDs from `list_participants(detail='full')` each time.
|
|
122
|
+
- **Alternative:** if using `share()`, call `get_recent_context(limit=3, detail='standard')` first to find the `[thread:thr_xxx]` tag, then pass that as `thread_id`.
|
|
123
|
+
- **Never:** post top-level `share()` in response to a threaded message.
|
|
78
124
|
|
|
79
125
|
## Git discipline — use `git -C`, never `cd`
|
|
80
126
|
|
|
81
|
-
|
|
127
|
+
Leader operates on multiple branches across multiple worktrees. The main repo at `/workspaces/convo` is typically checked out on whatever branch was last merged INTO. A sequence like `cd /workspaces/convo && git merge <branch>` runs the merge against the currently-checked-out branch of that worktree — which may be `feat/<slug>` or some other branch — NOT `main`.
|
|
82
128
|
|
|
83
|
-
**
|
|
129
|
+
**Always use `git -C <path>` for cross-worktree git operations.** Never `cd` into another worktree and run git commands there.
|
|
84
130
|
|
|
85
|
-
**
|
|
131
|
+
**Intra-feat merges run against the leader worktree, not the host worktree.** When Leader merges `spec/<slug>` → `feat/<slug>` (or `impl/<slug>` → `feat/<slug>`), use `git -C /workspaces/convo/.worktrees/leader/` (which has feat checked out), NOT `git -C /workspaces/convo` (which is on main). A merge against the host worktree lands the sub-branch's commit directly on main — functional impact zero when the subsequent feat squash absorbs cleanly, but the process discipline matters.
|
|
132
|
+
|
|
133
|
+
**Correct patterns:**
|
|
86
134
|
|
|
87
135
|
```bash
|
|
88
|
-
#
|
|
89
|
-
git -C
|
|
90
|
-
git -C
|
|
91
|
-
git -C
|
|
92
|
-
|
|
93
|
-
#
|
|
94
|
-
git -C
|
|
95
|
-
git -C
|
|
136
|
+
# Squash-ship: feat → main
|
|
137
|
+
git -C /workspaces/convo merge --squash feat/<slug>
|
|
138
|
+
git -C /workspaces/convo commit -m "<ship message>"
|
|
139
|
+
git -C /workspaces/convo log --oneline -3 # VERIFY
|
|
140
|
+
|
|
141
|
+
# Intra-feat merge: agent branch → feat
|
|
142
|
+
git -C /workspaces/convo merge <agent-branch> --ff-only
|
|
143
|
+
git -C /workspaces/convo log --oneline -3 # VERIFY
|
|
144
|
+
|
|
145
|
+
# Non-feature: product/qa/librarian branch → main
|
|
146
|
+
git -C /workspaces/convo merge <branch> --ff-only
|
|
147
|
+
git -C /workspaces/convo log --oneline -3 # VERIFY
|
|
96
148
|
```
|
|
97
149
|
|
|
98
|
-
**MANDATORY verification step:** after every merge, run `git -C <target-worktree> log --oneline -3` and confirm the merge landed on the expected
|
|
150
|
+
**MANDATORY verification step:** after every merge, run `git -C <target-worktree> log --oneline -3` and confirm the merge landed on the expected branch before posting the merge-ack.
|
|
99
151
|
|
|
100
152
|
## Host worktree invariant: always on main (per repo)
|
|
101
153
|
|
|
102
|
-
|
|
154
|
+
For each repo Leader operates on, the host worktree is always checked out on `main`, from pipeline kickoff through ship and into the next run:
|
|
155
|
+
- **convo:** host worktree at `/workspaces/convo`, always on `main`.
|
|
156
|
+
- **mootup-io/moot:** host worktree at `/workspaces/convo/mootup-io/moot`, always on `main`.
|
|
103
157
|
|
|
104
158
|
The invariant is load-bearing on two things:
|
|
105
159
|
|
|
106
|
-
1. **The squash-merge lands on main.** `git -C <repo-path> merge --squash feat/<slug>` merges INTO the host's current branch. If the host is on `feat/<slug>` instead of `main` at squash time, the squash no-ops
|
|
107
|
-
2.
|
|
160
|
+
1. **The squash-merge lands on main.** `git -C <repo-path> merge --squash feat/<slug>` merges INTO the host's current branch. If the host is on `feat/<slug>` instead of `main` at squash time, the squash no-ops and the ship appears to succeed silently while main never advances.
|
|
161
|
+
2. **`docker compose up --build -d` on the host rebuilds from the shipped main state.** Pat runs compose directly from the repo root. If the host is on `feat/<slug>`, the rebuild pulls a stale pre-ship snapshot.
|
|
162
|
+
|
|
163
|
+
**How to keep each host on main:**
|
|
164
|
+
|
|
165
|
+
- **When creating a feat branch:** use `git -C <repo-path> branch feat/<slug> main`, NOT `git -C <repo-path> checkout -b feat/<slug>`.
|
|
166
|
+
- **When an agent's worktree is holding main hostage:** create an `<agent>/idle` branch at the current commit in that worktree to free `main` for the host.
|
|
167
|
+
- **Verification after every merge:** `git -C <repo-path> branch --show-current` MUST return `main`.
|
|
168
|
+
|
|
169
|
+
**Anti-patterns:**
|
|
170
|
+
- `git -C <repo-path> checkout -b feat/<slug>` — switches host off main.
|
|
171
|
+
- `cd <repo-path> && git checkout feat/<slug>` — same problem, worse form.
|
|
172
|
+
- Assuming the host is on main because "I haven't touched it recently" — always verify.
|
|
108
173
|
|
|
109
|
-
|
|
174
|
+
## Pre-ship host-worktree sanity check (post DS-3 near-miss)
|
|
110
175
|
|
|
111
|
-
|
|
112
|
-
- **When an agent's worktree is holding main hostage:** create an `<agent>/idle` branch at the current commit in that worktree — this preserves the agent's filesystem state while freeing the `main` ref for the host.
|
|
113
|
-
- **Verification after every merge:** `git -C <repo-path> branch --show-current` MUST return `main` before you post the ship message. If it returns anything else, STOP and fix the branch state before announcing ship.
|
|
176
|
+
Before squash-merge, Leader runs three checks:
|
|
114
177
|
|
|
115
|
-
|
|
178
|
+
```bash
|
|
179
|
+
git -C /workspaces/convo branch --show-current # must be 'main'
|
|
180
|
+
git -C /workspaces/convo status --short # must be empty
|
|
181
|
+
git -C /workspaces/convo log --oneline main -3 # spot-check recent-synthesis commit IS on main
|
|
182
|
+
```
|
|
116
183
|
|
|
117
|
-
-
|
|
118
|
-
- `cd <repo-path> && git checkout feat/<slug>` — same problem, worse form
|
|
119
|
-
- Assuming the host is on main because "I haven't touched it recently" — verify before any merge operation
|
|
184
|
+
DS-3's near-miss: initial squash from a stale host worktree state would have produced a commit with 7 extra file deletions (rolling back cycle-10 audit + Product synthesis files). The `branch --show-current` check passed; the working tree was stale. `git status --short` would have shown the discrepancy; `log --oneline -3` confirms expected recent commits. If either check fails, **STOP, do not squash** — investigate and rebase/reset first.
|
|
120
185
|
|
|
121
186
|
## Pipeline Monitoring
|
|
122
187
|
|
|
123
|
-
After handing off to another agent,
|
|
188
|
+
After handing off to another agent, Leader sets a 10-minute pipeline check using Claude Code's cron scheduler. The prompt must enumerate every stall pattern explicitly — a generic "check for activity" prompt misses nuance (e.g., comms-test → trigger gap on Run X).
|
|
124
189
|
|
|
125
190
|
```
|
|
126
|
-
CronCreate(cron="*/10 * * * *", recurring=true, prompt="Pipeline check
|
|
191
|
+
CronCreate(cron="*/10 * * * *", recurring=true, prompt="Pipeline check for Run <slug>. Call get_recent_context(limit=15, detail='minimal') AND list_participants(detail='full') and check each stall pattern in order. MENTION DISCIPLINE: each stall pattern mentions ONLY the one agent whose action is needed. If no action is required, post nothing.
|
|
192
|
+
|
|
193
|
+
1. COMMS-TEST STALL: kickoff posted, all three (Spec/Impl/QA) acked, but no 'Spec — begin baseline + draft' trigger from Leader → POST the trigger now, mention Spec ONLY.
|
|
194
|
+
2. SPEC STALL: trigger posted, no Spec status update or merge request for >10 min → mention Spec ONLY.
|
|
195
|
+
3. IMPL STALL: spec/<slug> merged, no Impl progress for >15 min AND last_seen_at >10 min → mention Impl ONLY.
|
|
196
|
+
4. QA STALL: impl/<slug> merged, no QA progress for >15 min AND last_seen_at >10 min → mention QA ONLY.
|
|
197
|
+
5. QA PASS UNSHIPPED: QA posted PASS, no ship message → execute squash-merge-to-main + ship message now.
|
|
198
|
+
6. RETROS-IN TIMEOUT: ship message posted, >15 min, not all three retros in → post retros-in ping with what's landed + who's missing. Mention Product.
|
|
199
|
+
7. ALL CLEAR: pipeline progressing → silent (no post).
|
|
200
|
+
|
|
201
|
+
If pipeline is fully idle (feature shipped + retros-in posted), CronDelete on this job.")
|
|
127
202
|
```
|
|
128
203
|
|
|
129
|
-
|
|
204
|
+
Numbered patterns are exhaustive for a standard pipeline run. When any one matches, take the named action; when none match, exit silently.
|
|
205
|
+
|
|
206
|
+
Cancel the timer when the feature completes (CronDelete after the retros-in ping lands).
|
|
207
|
+
|
|
208
|
+
## Stall recovery recipe (when an agent goes silent past escalation)
|
|
209
|
+
|
|
210
|
+
When an agent is silent past the cron's stall threshold AND past two follow-up mentions, escalate to Product via `message_type="question"`.
|
|
211
|
+
|
|
212
|
+
1. **First detection:** cron mentions the silent agent. Wait one cycle.
|
|
213
|
+
2. **Second ping:** if still silent, mention again at +10 min. Note "second ping."
|
|
214
|
+
3. **Escalate to Product:** if still silent at +20 min from first detection, post `message_type="question"` to Product summarizing: which agent, how long silent, what they were doing last, what's queued behind.
|
|
215
|
+
4. **Product directs diagnostic FIRST, clear SECOND:** `tmux capture-pane` before `clear`. `clear` is a NO-OP for UI-layer stalls (permission prompts); diagnostic-first avoids wasted recovery attempt.
|
|
216
|
+
|
|
217
|
+
**Diagnostic signatures (from `tmux capture-pane -pS -1000 -t <role>`):**
|
|
218
|
+
|
|
219
|
+
- **Claude Code permission prompt** (`Do you want to…`) → `convo-lifecycle inject <role> "2\r"` to accept + allow. `clear` is NO-OP here.
|
|
220
|
+
- **Hung tool call** (docker exec / curl with no output) → `convo-lifecycle inject <role> $'\x03'` (SIGINT); then `convo-lifecycle clear <role>` if turn-loop doesn't recover.
|
|
221
|
+
- **Stuck compact / interactive prompt** → `convo-lifecycle inject <role> $'\r'` (Enter) OR Esc.
|
|
222
|
+
- **Crashed pane / empty screen** → container restart. Preserve WIP first via `git add -A && git commit -m "WIP: <feature> stall rescue"`.
|
|
223
|
+
|
|
224
|
+
5. **Clear is for tool-call stalls, not UI-layer stalls.** Use AFTER diagnostic confirms a tool-call stall.
|
|
225
|
+
6. **Re-trigger after recovery:** once the agent posts a fresh status update, Leader re-issues the trigger (or impl/qa equivalent for current stage).
|
|
226
|
+
7. **If diagnostic + recovery fail:** escalate again — likely a docker/wrapper-script issue requiring operator hands.
|
|
227
|
+
|
|
228
|
+
This recipe is NOT auto-fired by cron — Product owns the call. Cron's job is detect/mention/escalate; Product's job is direct recovery.
|
|
229
|
+
|
|
230
|
+
## Home-branch discipline for Leader
|
|
231
|
+
|
|
232
|
+
Leader's home branch is `leader/idle`. Leader's worktree may transiently be on main to execute squash-merges — that IS the mechanical operation that produces a ship. But Leader is **never** on main as a passive idle state. Immediately after the ship-message post + post-ship branch sweep, Leader returns to `leader/idle`:
|
|
233
|
+
|
|
234
|
+
```bash
|
|
235
|
+
git -C /workspaces/convo/.worktrees/leader checkout leader/idle
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
If a compact or restart leaves Leader on main (host worktree re-resolves to default), `git checkout leader/idle` before any work.
|
|
239
|
+
|
|
240
|
+
## Defined terms
|
|
130
241
|
|
|
131
|
-
- **
|
|
132
|
-
- **
|
|
133
|
-
- **
|
|
242
|
+
- **Operational kickoff** — Leader's in-thread reply to Product's feature kickoff; mechanical details only (feat branch created, compaction complete, cron started, agents mentioned).
|
|
243
|
+
- **Ship message** — Leader's announcement of squash-merge to main; posted via `reply_to_thread(kickoff_event_id, …)`; includes commit SHA, test counts, invariant results.
|
|
244
|
+
- **Retros-in ping** — Leader's post-retros return handoff to Product; mentions Product only; includes pointers to the three retro event IDs.
|
|
245
|
+
- **Host worktree** — `/workspaces/convo` (convo) or `/workspaces/convo/mootup-io/moot` (moot); always on `main`.
|
|
246
|
+
- **Pre-ship sanity check** — three-command verification (`branch --show-current`, `status --short`, `log --oneline -3`) before squash.
|
|
247
|
+
- **Pre-squash branch sweep** — NON-NEGOTIABLE merge of every in-thread sub-branch into feat before the squash.
|
|
248
|
+
- **Leader home branch** — `leader/idle`; resting state between squash-merges.
|
|
134
249
|
|
|
135
|
-
Cancel the timer when the feature completes or the pipeline is idle.
|
|
@@ -5,22 +5,48 @@ description: Librarian's observer-role runbook — passive channel watch, Librar
|
|
|
5
5
|
|
|
6
6
|
# Librarian Workflow
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
## Purpose
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
Run the Librarian role as an observer: watch the pipeline silently, curate `docs/design/` and `docs/arch/` as synthesized layers over the more volatile `docs/product/` and `docs/specs/` workspaces, and deliver findings to Product via a dedicated side thread rather than in feature threads. The failure class this skill addresses is **in-thread observer noise** — when Librarian posted directly in feature threads, process cost (acknowledgments, coherence-check replies, watchlist updates) exceeded the value of the catches. Routing findings through a Product side thread preserves the catches while keeping feature threads clean.
|
|
11
|
+
|
|
12
|
+
**Why it exists as a named skill:** Librarian's role is subtle — observer, not participant; silent on merge-pings, active in the side thread; owns some directories but not others; requests merges from Leader directly (per recent retro) rather than through Product. The constraints are interlocking, and every rule has a specific rationale. The skill captures the stance so Librarian operates consistently across compacts and worktree rebuilds.
|
|
13
|
+
|
|
14
|
+
## Preconditions
|
|
15
|
+
|
|
16
|
+
- **Role:** caller is Librarian.
|
|
17
|
+
- **Home branch:** Librarian's worktree is on `librarian/work`. On startup, if the worktree is on `main`, `git checkout librarian/work` before any work.
|
|
18
|
+
- **Side thread established:** a dedicated Librarian→Product thread exists in the Convo space (or is about to be established on first contact). All Librarian output routes to this thread.
|
|
19
|
+
- **Channel subscription:** Librarian is subscribed and receives merge-pings from Leader.
|
|
20
|
+
|
|
21
|
+
## Invariants
|
|
22
|
+
|
|
23
|
+
- **No feature-thread posts.** Librarian MUST NOT post in feature threads at any phase (kickoff, design, spec, impl, verify, retro, ship). The observer-role separation only holds if Librarian's output stays off the feature spine.
|
|
24
|
+
- **No merge-ack replies.** Leader's merge-pings are one-way signals. Librarian ingests them silently for the as-built change log. Replying in-thread violates the observer pattern.
|
|
25
|
+
- **No blocking the pipeline.** Pipeline agents do not wait for Librarian. Product does not gate merges on Librarian's coherence passes unless a specific reason.
|
|
26
|
+
- **Topology invariance.** Librarian's output (coherence findings, doc drift flags, as-built notes) may change *how* individual roles perform their work. MUST NOT propose new pipeline edges or communication topology changes.
|
|
27
|
+
- **Direct-to-Leader merge requests.** Librarian's own `librarian/work` merges go via a top-level `message_type="git_request"` mentioning Leader directly — not routed through the Product side thread. Product-routing adds a manual forward step for every as-built; direct is the validated pattern from 2026-04-13 onward.
|
|
28
|
+
|
|
29
|
+
## Postconditions (ongoing — role-state, not per-invocation)
|
|
30
|
+
|
|
31
|
+
- Feature threads remain free of Librarian posts.
|
|
32
|
+
- `docs/design/` and `docs/arch/` reflect current system state (synthesized over active product docs and specs).
|
|
33
|
+
- `docs/specs/<run>.md` files carry as-built notes post-ship.
|
|
34
|
+
- `docs/arch/backend-structure.md` is updated when structural changes ship.
|
|
35
|
+
- Product side thread carries Librarian's findings as they arise.
|
|
36
|
+
- README and doc indexes are current for Librarian-owned directories.
|
|
11
37
|
|
|
12
38
|
## What Librarian does
|
|
13
39
|
|
|
14
|
-
1. **Watches the channel passively AND receives Leader merge pings.** No feature thread posts. No handoff acks. No watchlist updates. No "resolves cleanly" follow-ups. No coherence-check replies in feature threads. Leader mentions Librarian on every merge-ack —
|
|
15
|
-
2. **Communicates findings to Product in
|
|
16
|
-
3. **Maintains `docs/design/` and `docs/arch/`** — curated synthesis layers, Librarian-owned. Commits to `librarian/work` branch. Requests merges from Leader via
|
|
40
|
+
1. **Watches the channel passively AND receives Leader merge pings.** No feature thread posts. No handoff acks. No watchlist updates. No "resolves cleanly" follow-ups. No coherence-check replies in feature threads. Leader mentions Librarian on every merge-ack — a one-way signal, not a conversation invitation. Librarian consumes the ping to track real-time main-branch changes for the as-built change log and retro integration. **Librarian does NOT reply to merge acks.**
|
|
41
|
+
2. **Communicates findings to Product in the dedicated Librarian→Product thread.** All Librarian output — coherence catches, doc drift flags, as-built notes, retro observations — goes there.
|
|
42
|
+
3. **Maintains `docs/design/` and `docs/arch/`** — curated synthesis layers, Librarian-owned. Commits to `librarian/work` branch. Requests merges from Leader via top-level `message_type="git_request"` mentioning Leader directly.
|
|
17
43
|
4. **Maintains READMEs and doc indexes** — routine upkeep. Same branch, same merge path.
|
|
18
|
-
5. **Post-ship as-built passes** — reviews shipped specs against actual implementation, updates `docs/specs/<run>.md` with as-built notes, updates `docs/arch
|
|
44
|
+
5. **Post-ship as-built passes** — reviews shipped specs against actual implementation, updates `docs/specs/<run>.md` with as-built notes, updates `docs/arch/backend-structure.md` for shipped structural changes. Delivered as a merge request via the side thread after each ship.
|
|
19
45
|
6. **Retro integration** — extracts durable lessons from shipped retros, updates memory files or proposes CLAUDE.md edits. Product decides whether to apply them.
|
|
20
46
|
|
|
21
47
|
## What Librarian does NOT do
|
|
22
48
|
|
|
23
|
-
- Post in feature threads at any phase
|
|
49
|
+
- Post in feature threads at any phase.
|
|
24
50
|
- Ack handoffs or merge confirmations.
|
|
25
51
|
- Run real-time coherence checks during active impl.
|
|
26
52
|
- Participate in spec amendment cycles.
|
|
@@ -29,16 +55,14 @@ Librarian is an **observer role**. It does not participate in feature threads. I
|
|
|
29
55
|
## Communication protocol
|
|
30
56
|
|
|
31
57
|
- **Librarian → Product:** via the dedicated side thread. Product pulls findings at their own cadence.
|
|
32
|
-
- **Product → Librarian:** direct mention in the side thread when Product wants a specific check (coherence, drift, as-built).
|
|
33
|
-
- **Leader → Librarian:** one-way merge-ping stream. Leader mentions Librarian on every merge-ack (intra-feat merges + squash→main ship messages + non-feature merges). Librarian consumes silently — no reply, no ack, just ingest. If Librarian has findings from the merge, those route to Product via the side thread, NOT back to Leader.
|
|
34
|
-
- **Librarian → Leader:**
|
|
58
|
+
- **Product → Librarian:** direct mention in the side thread when Product wants a specific check (coherence, drift, as-built) or has a merge to confirm.
|
|
59
|
+
- **Leader → Librarian:** one-way merge-ping stream. Leader mentions Librarian on every merge-ack (intra-feat merges + squash→main ship messages + non-feature merges). Librarian consumes silently — no reply, no ack, just ingest. If Librarian has findings from the merge (e.g., "this commit drifted from the spec in section X"), those route to Product via the side thread, NOT back to Leader.
|
|
60
|
+
- **Librarian → Leader:** direct `message_type="git_request"` at top level, mentioning Leader, for every `librarian/work` merge request. Leader handles the merge, acks via a merge-ping that also mentions Librarian. No other Librarian → Leader channel.
|
|
35
61
|
- **Pipeline agents → Librarian:** not a supported channel. If Spec, Impl, or QA want doc support, they ask Product, and Product routes to Librarian if needed.
|
|
36
62
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
## Scope ownership reminder
|
|
63
|
+
## Scope ownership
|
|
40
64
|
|
|
41
|
-
Librarian owns:
|
|
65
|
+
From CLAUDE.md's Resource Ownership table, Librarian owns:
|
|
42
66
|
- `docs/design/` — curated design synthesis over active product docs
|
|
43
67
|
- `docs/arch/` — curated architecture synthesis over active specs
|
|
44
68
|
- READMEs and doc indexes
|
|
@@ -48,3 +72,21 @@ Librarian does NOT own:
|
|
|
48
72
|
- `CLAUDE.md` and memory files (Product owns)
|
|
49
73
|
- Code, specs, or test files (Spec/Impl/QA own)
|
|
50
74
|
- Git merges on main (Leader owns)
|
|
75
|
+
|
|
76
|
+
## Practice
|
|
77
|
+
|
|
78
|
+
**Home-branch anchoring.** Librarian's persistent home is `librarian/work`. The worktree stays on it continuously — all as-built passes, doc updates, and index refreshes commit here between Leader's merges. Leader's fast-forward of `librarian/work` → main advances main; Librarian's branch does not need to reset (it's the moving anchor). If a compact or worktree rebuild lands Librarian on `main`, checkout `librarian/work` immediately before any work.
|
|
79
|
+
|
|
80
|
+
**Merge-ping ingestion discipline.** When a merge-ping arrives, Librarian updates the as-built change log in local working memory. If the merged content drifted from the shipped spec, draft a finding for the side thread — but don't post until Product is available to receive it (or post-ship retro is running). Real-time side-thread posts during active implementation are the opposite of the noise reduction this skill targets.
|
|
81
|
+
|
|
82
|
+
**Retro integration timing.** Retros land in the feature thread after Leader's ship message. Librarian reads retros (silently), extracts durable patterns, and drafts memory-file or CLAUDE.md proposals for Product. Delivery is via the side thread when Product synthesis is complete — not interrupting Product mid-synthesis.
|
|
83
|
+
|
|
84
|
+
**Side-thread post shape.** Keep findings concise: "File X drifted from spec § 4.2 — spec said Y, impl did Z. Not blocking; worth noting for retro." Long-form narrative belongs in `docs/design/` or `docs/arch/` edits, not in the side thread.
|
|
85
|
+
|
|
86
|
+
## Defined terms
|
|
87
|
+
|
|
88
|
+
- **Observer role** — a role that watches pipeline events and produces curated outputs (synthesis, as-builts, retro lessons) but does not gate pipeline progression or participate in feature threads.
|
|
89
|
+
- **Side thread** — the dedicated Librarian→Product thread in the Convo space where all Librarian output routes. Distinct from any feature thread.
|
|
90
|
+
- **Merge-ping** — Leader's `mentions=[..., librarian_id]` on merge-ack messages. One-way signal for the as-built change log.
|
|
91
|
+
- **As-built pass** — post-ship review that updates `docs/specs/<run>.md` and `docs/arch/` to reflect what actually shipped vs. what the spec proposed.
|
|
92
|
+
|