@bradygaster/squad-sdk 0.9.6-insider.2 → 0.10.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/adapter/client.d.ts.map +1 -1
- package/dist/adapter/client.js +16 -3
- package/dist/adapter/client.js.map +1 -1
- package/dist/adapter/types.d.ts +6 -1
- package/dist/adapter/types.d.ts.map +1 -1
- package/dist/agents/charter-compiler.d.ts +2 -0
- package/dist/agents/charter-compiler.d.ts.map +1 -1
- package/dist/agents/charter-compiler.js +6 -1
- package/dist/agents/charter-compiler.js.map +1 -1
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/agents/index.js +24 -25
- package/dist/agents/index.js.map +1 -1
- package/dist/agents/lifecycle.d.ts.map +1 -1
- package/dist/agents/lifecycle.js +11 -2
- package/dist/agents/lifecycle.js.map +1 -1
- package/dist/agents/onboarding.d.ts.map +1 -1
- package/dist/agents/onboarding.js +24 -0
- package/dist/agents/onboarding.js.map +1 -1
- package/dist/config/agent-source.d.ts.map +1 -1
- package/dist/config/agent-source.js +60 -33
- package/dist/config/agent-source.js.map +1 -1
- package/dist/config/feature-audit.js +1 -1
- package/dist/config/feature-audit.js.map +1 -1
- package/dist/config/init.d.ts +4 -0
- package/dist/config/init.d.ts.map +1 -1
- package/dist/config/init.js +177 -44
- package/dist/config/init.js.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/marketplace/index.d.ts +7 -0
- package/dist/marketplace/index.d.ts.map +1 -1
- package/dist/marketplace/index.js +4 -0
- package/dist/marketplace/index.js.map +1 -1
- package/dist/marketplace/plugin-manifest.d.ts +113 -0
- package/dist/marketplace/plugin-manifest.d.ts.map +1 -0
- package/dist/marketplace/plugin-manifest.js +820 -0
- package/dist/marketplace/plugin-manifest.js.map +1 -0
- package/dist/marketplace/plugin-runtime.d.ts +37 -0
- package/dist/marketplace/plugin-runtime.d.ts.map +1 -0
- package/dist/marketplace/plugin-runtime.js +217 -0
- package/dist/marketplace/plugin-runtime.js.map +1 -0
- package/dist/marketplace/plugin-state.d.ts +89 -0
- package/dist/marketplace/plugin-state.d.ts.map +1 -0
- package/dist/marketplace/plugin-state.js +278 -0
- package/dist/marketplace/plugin-state.js.map +1 -0
- package/dist/memory/index.d.ts +262 -0
- package/dist/memory/index.d.ts.map +1 -0
- package/dist/memory/index.js +1122 -0
- package/dist/memory/index.js.map +1 -0
- package/dist/multi-squad.d.ts.map +1 -1
- package/dist/multi-squad.js +5 -2
- package/dist/multi-squad.js.map +1 -1
- package/dist/platform/azure-devops.d.ts.map +1 -1
- package/dist/platform/azure-devops.js +17 -3
- package/dist/platform/azure-devops.js.map +1 -1
- package/dist/platform/detect.d.ts.map +1 -1
- package/dist/platform/detect.js +12 -5
- package/dist/platform/detect.js.map +1 -1
- package/dist/platform/index.d.ts.map +1 -1
- package/dist/platform/index.js +26 -0
- package/dist/platform/index.js.map +1 -1
- package/dist/ralph/triage.js +1 -1
- package/dist/ralph/triage.js.map +1 -1
- package/dist/resolution.d.ts +18 -0
- package/dist/resolution.d.ts.map +1 -1
- package/dist/resolution.js +64 -2
- package/dist/resolution.js.map +1 -1
- package/dist/runtime/memory-value-benchmark.d.ts +61 -0
- package/dist/runtime/memory-value-benchmark.d.ts.map +1 -0
- package/dist/runtime/memory-value-benchmark.js +245 -0
- package/dist/runtime/memory-value-benchmark.js.map +1 -0
- package/dist/runtime/scheduler.d.ts +8 -0
- package/dist/runtime/scheduler.d.ts.map +1 -1
- package/dist/runtime/scheduler.js +52 -5
- package/dist/runtime/scheduler.js.map +1 -1
- package/dist/sharing/export.d.ts +1 -0
- package/dist/sharing/export.d.ts.map +1 -1
- package/dist/sharing/export.js +10 -0
- package/dist/sharing/export.js.map +1 -1
- package/dist/sharing/import.d.ts.map +1 -1
- package/dist/sharing/import.js +3 -2
- package/dist/sharing/import.js.map +1 -1
- package/dist/sharing/index.d.ts +1 -0
- package/dist/sharing/index.d.ts.map +1 -1
- package/dist/sharing/index.js +1 -0
- package/dist/sharing/index.js.map +1 -1
- package/dist/sharing/repo-sync.d.ts +80 -0
- package/dist/sharing/repo-sync.d.ts.map +1 -0
- package/dist/sharing/repo-sync.js +138 -0
- package/dist/sharing/repo-sync.js.map +1 -0
- package/dist/state-backend.d.ts +154 -9
- package/dist/state-backend.d.ts.map +1 -1
- package/dist/state-backend.js +729 -184
- package/dist/state-backend.js.map +1 -1
- package/dist/tools/index.d.ts +39 -1
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +395 -2
- package/dist/tools/index.js.map +1 -1
- package/dist/utils/map-with-limit.d.ts +37 -0
- package/dist/utils/map-with-limit.d.ts.map +1 -0
- package/dist/utils/map-with-limit.js +81 -0
- package/dist/utils/map-with-limit.js.map +1 -0
- package/package.json +6 -2
- package/templates/after-agent-reference.md +64 -0
- package/templates/ceremony-reference.md +82 -0
- package/templates/client-compatibility-reference.md +46 -0
- package/templates/copilot-agent.md +96 -0
- package/templates/copilot-instructions.md +14 -0
- package/templates/model-selection-reference.md +101 -0
- package/templates/prd-intake.md +105 -0
- package/templates/rai-charter.md +110 -0
- package/templates/rai-policy.md +103 -0
- package/templates/ralph-reference.md +141 -0
- package/templates/routing.md +1 -0
- package/templates/scribe-charter.md +18 -151
- package/templates/session-init-reference.md +199 -0
- package/templates/skills/e2e-template-testing/SKILL.md +557 -0
- package/templates/skills/fact-checking/SKILL.md +61 -0
- package/templates/spawn-reference.md +131 -0
- package/templates/squad.agent.md.template +200 -625
- package/templates/workflow-wiring-appendix-a-code-reviewer.md +131 -0
- package/templates/workflow-wiring-appendix-b-documenter.md +140 -0
- package/templates/workflow-wiring-guide.md +276 -0
- package/templates/workflows/squad-heartbeat.yml +167 -167
- package/templates/worktree-reference.md +126 -0
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# Appendix A: Wiring a Code Reviewer — Complete Walkthrough
|
|
2
|
+
|
|
3
|
+
> End-to-end example of adding a code reviewer to your squad and wiring their gate so it actually gets enforced. This walkthrough addresses a common failure: a reviewer is on the roster but never reviews a single PR because the gate wasn't wired.
|
|
4
|
+
|
|
5
|
+
## The Problem This Solves
|
|
6
|
+
|
|
7
|
+
Adding a reviewer to `team.md` gives them an identity. It does NOT:
|
|
8
|
+
- Tell the coordinator to route PRs to them
|
|
9
|
+
- Prevent PRs from being merged without their approval
|
|
10
|
+
- Prevent issues from being closed before review happens
|
|
11
|
+
|
|
12
|
+
**What goes wrong without enforcement:** A reviewer can be on the roster as "Reviewer" from day one. Their charter says they review PRs. The routing table says "PR code review → {ReviewerName}." But PRs get merged and issues get closed without them ever being spawned. Why?
|
|
13
|
+
|
|
14
|
+
Because the routing table says WHO handles what — it's for incoming requests ("review PR #42"). It does NOT say "after every agent completes work, route their output to {ReviewerName}." The coordinator routes work TO agents, but nothing tells it to route COMPLETED work to a reviewer. The "After Agent Work" flow in `squad.agent.md` says: collect results → present → spawn Scribe. No review step.
|
|
15
|
+
|
|
16
|
+
**The fix has three layers:**
|
|
17
|
+
|
|
18
|
+
| Layer | What it does | Where it lives |
|
|
19
|
+
|-------|-------------|----------------|
|
|
20
|
+
| Identity | Reviewer exists and knows how to review | `team.md` roster + `charter.md` |
|
|
21
|
+
| Routing | User can explicitly request "review this" | `routing.md` routing table |
|
|
22
|
+
| **Enforcement** | Coordinator MUST route every PR to reviewer before merge | `routing.md` Rules section + `issue-lifecycle.md` post-work steps |
|
|
23
|
+
|
|
24
|
+
Most squads get layers 1 and 2 right. Layer 3 — enforcement — is what's usually missing.
|
|
25
|
+
|
|
26
|
+
## Step-by-Step Walkthrough
|
|
27
|
+
|
|
28
|
+
### Step 1: Create the reviewer's identity
|
|
29
|
+
|
|
30
|
+
Create `.squad/agents/{name}/charter.md`:
|
|
31
|
+
|
|
32
|
+
```markdown
|
|
33
|
+
# {Name} — Code Reviewer
|
|
34
|
+
|
|
35
|
+
## Identity
|
|
36
|
+
- **Name:** {Name}
|
|
37
|
+
- **Role:** Code Reviewer
|
|
38
|
+
- **Expertise:** Code quality, correctness, test coverage, security, patterns
|
|
39
|
+
- **Style:** Thorough, fair, specific. Provides actionable feedback.
|
|
40
|
+
|
|
41
|
+
## What I Own
|
|
42
|
+
- Reviewing PRs for code quality, correctness, and test coverage
|
|
43
|
+
- Identifying bugs, security issues, and design problems
|
|
44
|
+
- Providing specific, actionable feedback (not vague suggestions)
|
|
45
|
+
|
|
46
|
+
## How I Review
|
|
47
|
+
1. Read the PR diff completely
|
|
48
|
+
2. Check: does it do what the issue asked for?
|
|
49
|
+
3. Check: are there tests? Do they cover the important cases?
|
|
50
|
+
4. Check: are there bugs, edge cases, or security issues?
|
|
51
|
+
5. Check: does it follow project patterns and conventions?
|
|
52
|
+
6. Verdict: APPROVE or REJECT with specific feedback
|
|
53
|
+
|
|
54
|
+
## Boundaries
|
|
55
|
+
**I handle:** Code review, PR review, quality gates
|
|
56
|
+
**I don't handle:** Implementation, design, research, documentation
|
|
57
|
+
|
|
58
|
+
## On REJECT
|
|
59
|
+
I provide specific feedback: what's wrong, why, and what to do instead.
|
|
60
|
+
The original author fixes their work. I re-review after fixes.
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Create `.squad/agents/{name}/history.md` seeded with project context.
|
|
64
|
+
|
|
65
|
+
### Step 2: Add to team.md roster
|
|
66
|
+
|
|
67
|
+
```markdown
|
|
68
|
+
| 👑 {Name} | Code Reviewer | `.squad/agents/{name}/charter.md` | ✅ Active |
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Step 3: Add routing table entry
|
|
72
|
+
|
|
73
|
+
In `routing.md` → routing table:
|
|
74
|
+
|
|
75
|
+
```markdown
|
|
76
|
+
| PR code review | 👑 {Name} | — | "Review PR #42", code quality, finding reports |
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
**⚠️ This is necessary but NOT sufficient.** This only handles explicit review requests. It does NOT enforce automatic review of every PR.
|
|
80
|
+
|
|
81
|
+
### Step 4: Add enforcement rule (THIS IS THE CRITICAL STEP)
|
|
82
|
+
|
|
83
|
+
In `routing.md` → `## Rules` section, add a numbered rule:
|
|
84
|
+
|
|
85
|
+
```markdown
|
|
86
|
+
N. **{Name} PR Gate** — every PR created by any agent MUST be reviewed by {Name}
|
|
87
|
+
before merge. The coordinator spawns {Name} (sync) with the PR diff after
|
|
88
|
+
the author pushes and creates the PR. On REJECT, the original author addresses
|
|
89
|
+
feedback. On APPROVE, the coordinator merges via `gh pr merge`. No PR merges
|
|
90
|
+
without {Name}'s approval.
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
**Why this works when the routing table alone didn't:** The routing table is for matching incoming work to agents. Rules are behavioral constraints the coordinator must follow AFTER work completes. The rule says "after a PR exists, you MUST do X before proceeding." The routing table says "if someone asks for a review, route to X."
|
|
94
|
+
|
|
95
|
+
### Step 5: Wire into issue-lifecycle.md
|
|
96
|
+
|
|
97
|
+
In `.squad/templates/issue-lifecycle.md`, the "Coordinator Post-Work Steps" section should reference your reviewer by name:
|
|
98
|
+
|
|
99
|
+
```markdown
|
|
100
|
+
4. **Route to reviewer.** Spawn {Name} (sync) with the PR diff for code review.
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
This is the operational detail — the step-by-step instructions the coordinator follows after an agent completes issue work. The routing rule (Step 4) is the mandate; the lifecycle template is the procedure.
|
|
104
|
+
|
|
105
|
+
### Step 6: Add to casting registry
|
|
106
|
+
|
|
107
|
+
Update `.squad/casting/registry.json` with the new entry.
|
|
108
|
+
|
|
109
|
+
### Step 7: Verify
|
|
110
|
+
|
|
111
|
+
Ask yourself these questions:
|
|
112
|
+
|
|
113
|
+
- [ ] If a clean session coordinator reads `routing.md` Rules, will it know to route PRs to this reviewer? → Check rule N exists.
|
|
114
|
+
- [ ] If an agent completes work and pushes a PR, does the coordinator's post-work flow include a review step? → Check `issue-lifecycle.md` step 4.
|
|
115
|
+
- [ ] Can the coordinator merge a PR without the reviewer's approval? → The rule should say "No PR merges without {Name}'s approval."
|
|
116
|
+
- [ ] Can the coordinator close an issue without a merged PR? → Check the issue closure rule exists.
|
|
117
|
+
|
|
118
|
+
If any answer is wrong, you have a gap.
|
|
119
|
+
|
|
120
|
+
## What Each File Controls (Summary)
|
|
121
|
+
|
|
122
|
+
| File | What it contributes to the reviewer gate |
|
|
123
|
+
|------|----------------------------------------|
|
|
124
|
+
| `charter.md` | WHO the reviewer is and HOW they review |
|
|
125
|
+
| `team.md` | That the reviewer EXISTS on the team |
|
|
126
|
+
| `routing.md` routing table | That explicit review requests go to this reviewer |
|
|
127
|
+
| `routing.md` Rules section | That the coordinator MUST route EVERY PR to this reviewer (enforcement) |
|
|
128
|
+
| `issue-lifecycle.md` | The step-by-step procedure for the post-work review flow |
|
|
129
|
+
| `casting/registry.json` | Persistent name tracking |
|
|
130
|
+
|
|
131
|
+
**Remove any one of these and the gate has a hole.** The most commonly missed piece is the Rules section entry (Step 4).
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
# Appendix B: Wiring a Documenter/Librarian — Complete Walkthrough
|
|
2
|
+
|
|
3
|
+
> End-to-end example of adding a documenter role that ensures significant changes are documented. This is a FOLLOW-UP TRIGGER pattern — not a gate (which blocks), but an automatic downstream task that fires after work completes.
|
|
4
|
+
|
|
5
|
+
## The Problem This Solves
|
|
6
|
+
|
|
7
|
+
Your project has agents building features, fixing bugs, and writing tools. But nobody documents what was built, how to use it, or what changed. Documentation happens only when someone explicitly asks — and by then, the context is lost.
|
|
8
|
+
|
|
9
|
+
A documenter/librarian role solves this by automatically evaluating whether completed work needs documentation and producing it if so.
|
|
10
|
+
|
|
11
|
+
## Gate vs Follow-Up Trigger
|
|
12
|
+
|
|
13
|
+
| Pattern | Blocks work? | When it runs | Example |
|
|
14
|
+
|---------|-------------|-------------|---------|
|
|
15
|
+
| **Gate** (Appendix A) | Yes — work cannot proceed without approval | Before merge | Code reviewer must approve PR |
|
|
16
|
+
| **Follow-up trigger** | No — work proceeds, documentation happens in parallel | After merge | Documenter evaluates if docs are needed |
|
|
17
|
+
|
|
18
|
+
A documenter is typically a follow-up trigger, not a gate. You don't want documentation review to block a hotfix from merging. But you DO want documentation to happen automatically after significant changes.
|
|
19
|
+
|
|
20
|
+
## Step-by-Step Walkthrough
|
|
21
|
+
|
|
22
|
+
### Step 1: Create the documenter's identity
|
|
23
|
+
|
|
24
|
+
Create `.squad/agents/{name}/charter.md`:
|
|
25
|
+
|
|
26
|
+
```markdown
|
|
27
|
+
# {Name} — Documenter
|
|
28
|
+
|
|
29
|
+
## Identity
|
|
30
|
+
- **Name:** {Name}
|
|
31
|
+
- **Role:** Documenter / Librarian
|
|
32
|
+
- **Expertise:** Documentation, guides, READMEs, changelogs, knowledge management
|
|
33
|
+
- **Style:** Clear, thorough, user-focused. Makes complex things understandable.
|
|
34
|
+
|
|
35
|
+
## What I Own
|
|
36
|
+
- Evaluating whether completed work needs documentation
|
|
37
|
+
- Writing/updating READMEs, guides, and runbooks
|
|
38
|
+
- Maintaining a docs index so nothing gets lost
|
|
39
|
+
- Summarizing design decisions and architectural changes
|
|
40
|
+
|
|
41
|
+
## How I Work
|
|
42
|
+
1. Read the PR diff or agent output
|
|
43
|
+
2. Assess: does this change user-facing behavior? Add a new feature? Change configuration?
|
|
44
|
+
3. If yes: write or update the relevant documentation
|
|
45
|
+
4. If no: report "no docs needed" with brief justification
|
|
46
|
+
|
|
47
|
+
## Boundaries
|
|
48
|
+
**I handle:** Documentation, guides, READMEs, summaries, knowledge management
|
|
49
|
+
**I don't handle:** Code implementation, code review, research, operations
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Create `.squad/agents/{name}/history.md` seeded with project context.
|
|
53
|
+
|
|
54
|
+
### Step 2: Add to team.md roster
|
|
55
|
+
|
|
56
|
+
```markdown
|
|
57
|
+
| 📝 {Name} | Documenter | `.squad/agents/{name}/charter.md` | ✅ Active |
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Step 3: Add routing table entry
|
|
61
|
+
|
|
62
|
+
In `routing.md` → routing table:
|
|
63
|
+
|
|
64
|
+
```markdown
|
|
65
|
+
| Documentation, reports, summaries | 📝 {Name} | `docs/` | "Write docs for X", "Summarize this", guides, READMEs |
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Step 4: Add follow-up trigger rule
|
|
69
|
+
|
|
70
|
+
In `routing.md` → `## Rules` section, add a numbered rule:
|
|
71
|
+
|
|
72
|
+
```markdown
|
|
73
|
+
N. **Documentation follow-up** — after any PR is merged that adds or modifies
|
|
74
|
+
user-facing features, scripts, tools, or configuration, the coordinator
|
|
75
|
+
spawns {Name} (background) to evaluate whether documentation is needed.
|
|
76
|
+
{Name} reads the merged PR diff and either writes/updates docs or reports
|
|
77
|
+
"no docs needed." This is a follow-up, not a gate — it does not block
|
|
78
|
+
the merge.
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
**Why a rule and not a ceremony:** Ceremonies are structured multi-participant meetings. This is a single-agent follow-up task. A routing rule is simpler and more appropriate.
|
|
82
|
+
|
|
83
|
+
**Why background, not sync:** Documentation doesn't block other work. The documenter runs in parallel with whatever comes next.
|
|
84
|
+
|
|
85
|
+
### Step 5: Wire into the coordinator's post-merge flow
|
|
86
|
+
|
|
87
|
+
This is the trickiest part. The coordinator's After Agent Work flow doesn't currently have a "post-merge" hook. You wire this through the issue-lifecycle template.
|
|
88
|
+
|
|
89
|
+
In `.squad/templates/issue-lifecycle.md`, after the merge step, add:
|
|
90
|
+
|
|
91
|
+
```markdown
|
|
92
|
+
8. **Documentation follow-up.** After merge, check routing.md Rules for
|
|
93
|
+
documentation follow-up rule. If present, spawn the documenter (background)
|
|
94
|
+
with the merged PR diff to evaluate whether docs are needed.
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Alternatively, you can wire this as an `after` ceremony in `ceremonies.md`:
|
|
98
|
+
|
|
99
|
+
```yaml
|
|
100
|
+
- name: "Documentation Check"
|
|
101
|
+
when: "after"
|
|
102
|
+
condition: "PR merged that adds features, scripts, tools, or config changes"
|
|
103
|
+
facilitator: "{DocumenterName}"
|
|
104
|
+
participants: ["{DocumenterName}"]
|
|
105
|
+
output: "Docs written/updated, or 'no docs needed' with justification"
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Step 6: Worktree for doc changes
|
|
109
|
+
|
|
110
|
+
If the documenter produces files, they need a worktree — docs are files too. The coordinator should:
|
|
111
|
+
1. Create a worktree for the doc update (e.g., `squad/{issue}-docs`)
|
|
112
|
+
2. The documenter commits and pushes
|
|
113
|
+
3. A PR is created for the docs
|
|
114
|
+
4. The docs PR goes through the normal review flow (including the code reviewer if you have one)
|
|
115
|
+
|
|
116
|
+
This means doc changes also get reviewed. The documenter is not exempt from the review gate.
|
|
117
|
+
|
|
118
|
+
### Step 7: Add to casting registry
|
|
119
|
+
|
|
120
|
+
Update `.squad/casting/registry.json` with the new entry.
|
|
121
|
+
|
|
122
|
+
### Step 8: Verify
|
|
123
|
+
|
|
124
|
+
- [ ] After a feature PR merges, does the coordinator spawn the documenter? → Check the routing rule exists.
|
|
125
|
+
- [ ] Does the documenter get a worktree for their work? → Check the worktree rule covers docs.
|
|
126
|
+
- [ ] Do doc changes go through the review gate? → They should — docs are files, files need PRs, PRs need review.
|
|
127
|
+
- [ ] Is the follow-up non-blocking? → The documenter should be background, not sync.
|
|
128
|
+
|
|
129
|
+
## What Each File Controls (Summary)
|
|
130
|
+
|
|
131
|
+
| File | What it contributes |
|
|
132
|
+
|------|-------------------|
|
|
133
|
+
| `charter.md` | WHO the documenter is and HOW they evaluate |
|
|
134
|
+
| `team.md` | That the documenter EXISTS |
|
|
135
|
+
| `routing.md` routing table | That explicit doc requests go to this member |
|
|
136
|
+
| `routing.md` Rules section | That the coordinator MUST spawn docs evaluation after merges (enforcement) |
|
|
137
|
+
| `issue-lifecycle.md` or `ceremonies.md` | The procedural hook: when exactly the follow-up fires |
|
|
138
|
+
| `casting/registry.json` | Persistent name tracking |
|
|
139
|
+
|
|
140
|
+
**The most commonly missed piece:** The Rules section entry (Step 4). Without it, the documenter only runs when someone explicitly says "write docs for X." The whole point is that it runs automatically.
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
# Squad Workflow Wiring Guide
|
|
2
|
+
|
|
3
|
+
> How to wire up new team members, reviewer gates, and custom workflows so they actually get enforced by the coordinator — even in a clean session with no prior memory.
|
|
4
|
+
|
|
5
|
+
## Why This Guide Exists
|
|
6
|
+
|
|
7
|
+
The Squad framework (`squad.agent.md`) provides generic orchestration primitives. **It does not prescribe a specific workflow.** Your project's workflow — whether that's "all code goes through PRs and reviews" or "just commit to main" — must be wired into project-level configuration files.
|
|
8
|
+
|
|
9
|
+
If a workflow rule exists only in someone's memory, in a chat transcript, or in `decisions.md` but NOT in a configuration file the coordinator reads at decision time — **it will not be followed in a clean session.**
|
|
10
|
+
|
|
11
|
+
### Why Existing Patterns Aren't Enough
|
|
12
|
+
|
|
13
|
+
The Squad framework already has concepts for routing tables, reviewer roles, and ceremonies. But having these concepts does NOT mean they work automatically:
|
|
14
|
+
|
|
15
|
+
- **Adding a reviewer to the roster ≠ enforcing reviews.** A reviewer can be on the roster with "Reviewer" as their role and never review a single PR — because no RULE in `routing.md` tells the coordinator to route PRs to them. The roster says WHO exists. Rules say WHAT they enforce.
|
|
16
|
+
|
|
17
|
+
- **Capturing a decision ≠ enforcing it.** `decisions.md` may contain "every change must go through a PR" and "only {ReviewerName} closes PRs." These can get buried in a large file that the coordinator reads for context but doesn't treat as enforcement rules. A decision is a historical record. A routing rule is an enforceable constraint.
|
|
18
|
+
|
|
19
|
+
- **Describing a lifecycle ≠ wiring it.** `squad.agent.md` describes issue→branch→PR→review→merge. But if the After Agent Work section (the flow the coordinator actually follows after every agent completes) has no push/PR/review step, the lifecycle is described conceptually but never connected to the coordinator's actual decision flow.
|
|
20
|
+
|
|
21
|
+
**The pattern that works:** A numbered rule in `routing.md` → Rules section. The coordinator reads this section, treats each rule as a constraint, and follows them. If your workflow isn't a numbered rule, it's a suggestion.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Configuration Surface Area
|
|
26
|
+
|
|
27
|
+
The coordinator reads these files to decide how to behave. If your workflow isn't encoded in one of these, it doesn't exist.
|
|
28
|
+
|
|
29
|
+
| File | What It Controls | Read When |
|
|
30
|
+
|------|-----------------|-----------|
|
|
31
|
+
| `routing.md` | WHO handles what, behavioral RULES, reviewer GATES | Every session start, before every routing decision |
|
|
32
|
+
| `ceremonies.md` | Auto-triggered ceremonies (before/after work batches) | Before spawning work batches, after completion |
|
|
33
|
+
| `templates/issue-lifecycle.md` | Git workflow: push, PR, review, merge, issue closure | When spawning agents for issue-linked work |
|
|
34
|
+
| Agent `charter.md` | Per-agent identity, boundaries, behavior | Inlined into every spawn prompt |
|
|
35
|
+
| `team.md` | Roster, member capabilities | Session start |
|
|
36
|
+
| `decisions.md` | Captured decisions and directives | Read by agents at spawn time |
|
|
37
|
+
|
|
38
|
+
### How They Interact
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
User request arrives
|
|
42
|
+
→ Coordinator reads routing.md (WHO handles this?)
|
|
43
|
+
→ Coordinator checks ceremonies.md (any auto-triggered "before" ceremony?)
|
|
44
|
+
→ Coordinator reads agent charter.md (inline into spawn prompt)
|
|
45
|
+
→ If issue-linked: coordinator reads issue-lifecycle.md (add ISSUE CONTEXT to spawn prompt)
|
|
46
|
+
→ Agent works
|
|
47
|
+
→ Coordinator follows After Agent Work flow
|
|
48
|
+
→ Coordinator checks ceremonies.md (any auto-triggered "after" ceremony?)
|
|
49
|
+
→ Coordinator checks routing.md Rules section (any post-work rules to enforce?)
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
**The critical insight:** `routing.md` Rules section and `ceremonies.md` are the two enforcement mechanisms. If a rule isn't in one of these, the coordinator has no way to know about it.
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## How to Wire Up a New Team Member
|
|
57
|
+
|
|
58
|
+
### Step 1: Create the member (files)
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
.squad/agents/{name}/
|
|
62
|
+
charter.md ← Identity, role, boundaries, what they own
|
|
63
|
+
history.md ← Seeded with project context from team.md
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Step 2: Add to roster (`team.md`)
|
|
67
|
+
|
|
68
|
+
Add a row to the `## Members` table:
|
|
69
|
+
```
|
|
70
|
+
| {emoji} {Name} | {Role} | `.squad/agents/{name}/charter.md` | ✅ Active |
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Step 3: Add routing entry (`routing.md`)
|
|
74
|
+
|
|
75
|
+
Add a row to the routing table:
|
|
76
|
+
```
|
|
77
|
+
| {Work Type} | {emoji} {Name} | {Output Location} | {Examples} |
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Step 4: Add issue routing (if applicable)
|
|
81
|
+
|
|
82
|
+
Add to the Issue Routing table in `routing.md`:
|
|
83
|
+
```
|
|
84
|
+
| squad:{name} | {Description of work} | {emoji} {Name} |
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Step 5: Add to casting registry
|
|
88
|
+
|
|
89
|
+
Update `.squad/casting/registry.json` with the new entry.
|
|
90
|
+
|
|
91
|
+
### Step 6: Wire any gates (if this member is a reviewer/gate)
|
|
92
|
+
|
|
93
|
+
**This is the step most people miss.** If the new member should review or gate other members' work, you need to wire enforcement. See "How to Wire Up a Reviewer Gate" below.
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## How to Wire Up a Reviewer Gate
|
|
98
|
+
|
|
99
|
+
A reviewer gate means: "Agent X must review Agent Y's output before it proceeds." The framework supports this but does NOT automatically enforce it. You must wire it.
|
|
100
|
+
|
|
101
|
+
### Option A: Routing Rule (recommended for simple gates)
|
|
102
|
+
|
|
103
|
+
Add to `routing.md` → `## Rules` section:
|
|
104
|
+
|
|
105
|
+
```markdown
|
|
106
|
+
N. **{GateName} Gate** — Every {output type} from {Author} MUST be reviewed by {ReviewerName} before {next step}. The coordinator routes {Author}'s output to {ReviewerName} (sync spawn), collects the verdict, and only proceeds if approved. On rejection, {Author} revises based on {ReviewerName}'s feedback.
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
**Example — reviewer for all PRs:**
|
|
110
|
+
```markdown
|
|
111
|
+
9. **{ReviewerName} PR Gate** — Every PR created by any agent MUST be reviewed by {ReviewerName} before merge. The coordinator spawns {ReviewerName} (sync) with the PR diff, collects APPROVE/REJECT verdict. On rejection, the original author addresses feedback.
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
**Example — design review gate:**
|
|
115
|
+
```markdown
|
|
116
|
+
10. **{DesignReviewer} Design Gate** — Every design doc produced by the architect MUST be reviewed by {DesignReviewer} before implementation begins. {DesignReviewer} always rejects the first draft on concept/approach. Implementation is BLOCKED until {DesignReviewer} approves.
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
**Why this works:** The coordinator reads the Rules section before and after every work batch. Rules are behavioral constraints the coordinator must follow.
|
|
120
|
+
|
|
121
|
+
### Option B: Ceremony (recommended for multi-participant gates)
|
|
122
|
+
|
|
123
|
+
Add to `ceremonies.md` using the Markdown table format the file uses:
|
|
124
|
+
|
|
125
|
+
```markdown
|
|
126
|
+
## Design Review
|
|
127
|
+
|
|
128
|
+
| Field | Value |
|
|
129
|
+
|-------|-------|
|
|
130
|
+
| **Trigger** | auto |
|
|
131
|
+
| **When** | before |
|
|
132
|
+
| **Condition** | task involves implementing a design doc |
|
|
133
|
+
| **Facilitator** | {DesignReviewer} |
|
|
134
|
+
| **Participants** | Architect, {DesignReviewer} |
|
|
135
|
+
| **Time budget** | focused |
|
|
136
|
+
| **Enabled** | ✅ yes |
|
|
137
|
+
|
|
138
|
+
**Agenda:**
|
|
139
|
+
1. Read the design doc
|
|
140
|
+
2. Challenge the premise and approach
|
|
141
|
+
3. Demand alternatives and evidence
|
|
142
|
+
4. Verdict: APPROVE or REJECT
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
**Why this works:** The coordinator checks ceremonies.md for `before` ceremonies whose condition matches the current task. If matched, the ceremony runs before work begins.
|
|
146
|
+
|
|
147
|
+
### Option A vs Option B
|
|
148
|
+
|
|
149
|
+
| Use Case | Use Routing Rule | Use Ceremony |
|
|
150
|
+
|----------|-----------------|--------------|
|
|
151
|
+
| Simple 1-on-1 review (reviewer → author) | ✅ | Overkill |
|
|
152
|
+
| Multi-participant alignment (3+ agents) | Too simple | ✅ |
|
|
153
|
+
| Needs structured facilitation | No | ✅ |
|
|
154
|
+
| Must run automatically before specific work | Either works | ✅ |
|
|
155
|
+
| One-line behavioral constraint | ✅ | Overkill |
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
## How to Wire Up an Issue Lifecycle (Git Workflow)
|
|
160
|
+
|
|
161
|
+
This is where you define what happens after an agent completes work on a GitHub issue. The framework references `.squad/templates/issue-lifecycle.md` but does NOT create it — you must create it yourself.
|
|
162
|
+
|
|
163
|
+
> **⚠️ This file is required if your project uses GitHub Issues Mode.** Without it, the coordinator has no post-work steps for push/PR/review and will treat agent commit as "done."
|
|
164
|
+
|
|
165
|
+
See `.squad/templates/issue-lifecycle.md` for the full template if your project already has one. If not, create it following the pattern below.
|
|
166
|
+
|
|
167
|
+
### Step 1: Create `templates/issue-lifecycle.md`
|
|
168
|
+
|
|
169
|
+
Create `.squad/templates/issue-lifecycle.md` with your project's git workflow. At minimum it should include:
|
|
170
|
+
|
|
171
|
+
- An ISSUE CONTEXT block template (for spawn prompts)
|
|
172
|
+
- Coordinator post-work steps (verify push → verify PR → route to reviewer → merge on approval)
|
|
173
|
+
- Issue closure rules (PR merge auto-close vs manual close)
|
|
174
|
+
- Worktree requirements (if applicable)
|
|
175
|
+
|
|
176
|
+
### Step 2: Add enforcement rules to `routing.md`
|
|
177
|
+
|
|
178
|
+
Add numbered rules to the `## Rules` section that reference the lifecycle:
|
|
179
|
+
|
|
180
|
+
```markdown
|
|
181
|
+
N. **Issue lifecycle enforcement** — all issue-linked work follows the lifecycle
|
|
182
|
+
in `.squad/templates/issue-lifecycle.md`. The coordinator adds the ISSUE CONTEXT
|
|
183
|
+
block to spawn prompts and follows the post-work steps (verify push → verify PR
|
|
184
|
+
→ route to reviewer → merge on approval). Read `issue-lifecycle.md` before
|
|
185
|
+
spawning any agent for issue work.
|
|
186
|
+
|
|
187
|
+
N+1. **{ReviewerName} PR Gate** — every PR created by any agent MUST be reviewed
|
|
188
|
+
by {ReviewerName} before merge. The coordinator spawns {ReviewerName} (sync)
|
|
189
|
+
with the PR diff. On REJECT, the original author addresses feedback. On APPROVE,
|
|
190
|
+
the coordinator merges. No PR merges without {ReviewerName}'s approval.
|
|
191
|
+
|
|
192
|
+
N+2. **Issue closure restriction** — issues that produced files (code, docs, scripts,
|
|
193
|
+
designs, tests) close ONLY via PR merge auto-close ("Closes #N" in PR body).
|
|
194
|
+
Never use `gh issue close` for file-producing work. Exception: tracking/strategic
|
|
195
|
+
issues and superseded issues may be closed with a comment.
|
|
196
|
+
|
|
197
|
+
N+3. **Worktree for all file-producing work** — every task that creates or modifies
|
|
198
|
+
files (including documentation) requires a worktree. Exceptions: read-only queries,
|
|
199
|
+
Scribe (.squad/ state), pure analysis producing no files.
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
### Step 3: Verify your wiring
|
|
203
|
+
|
|
204
|
+
After creating both files, run the verification checklist (below) to confirm a clean session coordinator would follow the lifecycle.
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
## How to Wire Up a Custom Workflow Step
|
|
209
|
+
|
|
210
|
+
If you need something that isn't a reviewer gate or issue lifecycle — for example, "always run tests before pushing" or "docs must be reviewed by the author before merge" — here's where to put it:
|
|
211
|
+
|
|
212
|
+
### If it's a behavioral rule the coordinator should always follow:
|
|
213
|
+
→ Add to `routing.md` → `## Rules` section
|
|
214
|
+
|
|
215
|
+
### If it should trigger automatically before/after specific work:
|
|
216
|
+
→ Add to `ceremonies.md` as a `before` or `after` ceremony
|
|
217
|
+
|
|
218
|
+
### If it's something agents should do as part of their work:
|
|
219
|
+
→ Add to the agent's `charter.md` under a new section
|
|
220
|
+
|
|
221
|
+
### If it's something that applies only to issue-linked work:
|
|
222
|
+
→ Add to `templates/issue-lifecycle.md`
|
|
223
|
+
|
|
224
|
+
### If it's a team-wide constraint that should be visible to all agents:
|
|
225
|
+
→ Capture as a decision in `decisions.md` (via directive or decision inbox)
|
|
226
|
+
|
|
227
|
+
---
|
|
228
|
+
|
|
229
|
+
## Verification Checklist
|
|
230
|
+
|
|
231
|
+
After wiring any new member, gate, or workflow, verify:
|
|
232
|
+
|
|
233
|
+
- [ ] **Clean session test:** Start a new session (no memory). Give a task. Does the coordinator follow the new rule?
|
|
234
|
+
- [ ] **File completeness:** Is the rule/gate/workflow encoded in a file the coordinator reads? (routing.md, ceremonies.md, issue-lifecycle.md, charter.md)
|
|
235
|
+
- [ ] **No verbal-only rules:** Is there anything the coordinator should do that's only in chat history or your memory? If yes, it will be lost on session restart.
|
|
236
|
+
- [ ] **Gate enforcement:** If you added a reviewer gate, does the routing.md Rules section or ceremonies.md explicitly say the coordinator must route to the reviewer? "Having a reviewer on the roster" is not the same as "enforcing that they review."
|
|
237
|
+
- [ ] **Issue lifecycle:** If your project uses PRs, does `templates/issue-lifecycle.md` exist? Does routing.md reference it?
|
|
238
|
+
|
|
239
|
+
---
|
|
240
|
+
|
|
241
|
+
## Common Mistakes
|
|
242
|
+
|
|
243
|
+
1. **Adding a reviewer to the roster but not wiring a gate.** Having a reviewer on the team doesn't mean they review anything. You must add a rule in routing.md that says "route PRs to {ReviewerName}."
|
|
244
|
+
|
|
245
|
+
2. **Closing issues via `gh issue close` instead of PR merge.** If your project uses PRs, issue closure should happen via "Closes #N" in the PR body. Wire this in issue-lifecycle.md.
|
|
246
|
+
|
|
247
|
+
3. **Writing docs/scripts directly on main.** If your project requires branches for all changes, the worktree gate must apply to ALL file-producing work — including docs. Make this explicit in routing.md Rules.
|
|
248
|
+
|
|
249
|
+
4. **Assuming the coordinator remembers verbal instructions.** Each session starts fresh. If you told the coordinator "always use opus" in session 1, session 2 won't know unless it's in decisions.md or routing.md.
|
|
250
|
+
|
|
251
|
+
5. **Not creating `issue-lifecycle.md`.** The framework references it but doesn't create it. If your project uses GitHub Issues Mode, create this template.
|
|
252
|
+
|
|
253
|
+
6. **Capturing a decision but never encoding it as a rule.** `decisions.md` is a historical record. The coordinator reads it for context but doesn't treat entries as enforceable constraints. If a decision should be enforced, it must become a numbered rule in `routing.md` Rules section.
|
|
254
|
+
|
|
255
|
+
---
|
|
256
|
+
|
|
257
|
+
## Decisions Audit
|
|
258
|
+
|
|
259
|
+
Periodically scan `decisions.md` for directives that should be routing rules but aren't:
|
|
260
|
+
|
|
261
|
+
1. Search for phrases like "always", "never", "must", "every", "required"
|
|
262
|
+
2. For each match, ask: "Is this enforced by a numbered rule in routing.md?"
|
|
263
|
+
3. If no → either add a rule, or accept that it's advisory-only
|
|
264
|
+
4. If yes → verify the rule text matches the decision
|
|
265
|
+
|
|
266
|
+
This prevents `decisions.md` from becoming a graveyard of good intentions that the coordinator reads but doesn't act on.
|
|
267
|
+
|
|
268
|
+
---
|
|
269
|
+
|
|
270
|
+
## Appendices
|
|
271
|
+
|
|
272
|
+
For detailed end-to-end walkthroughs of specific wiring scenarios, see:
|
|
273
|
+
|
|
274
|
+
- **[Appendix A: Wiring a Code Reviewer](workflow-wiring-appendix-a-code-reviewer.md)** — Full walkthrough of adding a code reviewer member and wiring their gate so it actually gets enforced. Includes every file that needs modification with exact content.
|
|
275
|
+
|
|
276
|
+
- **[Appendix B: Wiring a Documenter/Librarian](workflow-wiring-appendix-b-documenter.md)** — Full walkthrough of adding a documenter role that ensures all significant changes are documented. Shows a follow-up trigger pattern rather than a gate pattern.
|