@mootup/moot-templates 0.1.0-rc.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.
Files changed (43) hide show
  1. package/README.md +42 -0
  2. package/dist/index.d.ts +21 -0
  3. package/dist/index.d.ts.map +1 -0
  4. package/dist/index.js +35 -0
  5. package/dist/index.js.map +1 -0
  6. package/package.json +39 -0
  7. package/templates/CLAUDE.md +233 -0
  8. package/templates/claude/hooks/auto-orient.sh +21 -0
  9. package/templates/claude/hooks/git-guard.sh +56 -0
  10. package/templates/claude/hooks/grep-baseline-diff.sh +41 -0
  11. package/templates/claude/hooks/handoff-status-check.sh +40 -0
  12. package/templates/claude/settings.json +51 -0
  13. package/templates/devcontainer/devcontainer.json +25 -0
  14. package/templates/devcontainer/post-create.sh +68 -0
  15. package/templates/devcontainer/run-moot-channel.sh +70 -0
  16. package/templates/devcontainer/run-moot-mcp.sh +74 -0
  17. package/templates/devcontainer/run-moot-notify.sh +59 -0
  18. package/templates/skills/doc-curation/SKILL.md +80 -0
  19. package/templates/skills/handoff/SKILL.md +46 -0
  20. package/templates/skills/leader-workflow/SKILL.md +135 -0
  21. package/templates/skills/librarian-workflow/SKILL.md +50 -0
  22. package/templates/skills/memory-audit/SKILL.md +85 -0
  23. package/templates/skills/product-workflow/SKILL.md +69 -0
  24. package/templates/skills/spec-checklist/SKILL.md +99 -0
  25. package/templates/skills/verify/SKILL.md +64 -0
  26. package/templates/teams/loop-3/CLAUDE.md +72 -0
  27. package/templates/teams/loop-3/README.md +6 -0
  28. package/templates/teams/loop-3/team.toml +108 -0
  29. package/templates/teams/loop-4/CLAUDE.md +72 -0
  30. package/templates/teams/loop-4/README.md +6 -0
  31. package/templates/teams/loop-4/team.toml +126 -0
  32. package/templates/teams/loop-4-observer/CLAUDE.md +76 -0
  33. package/templates/teams/loop-4-observer/README.md +7 -0
  34. package/templates/teams/loop-4-observer/team.toml +141 -0
  35. package/templates/teams/loop-4-parallel/CLAUDE.md +76 -0
  36. package/templates/teams/loop-4-parallel/README.md +6 -0
  37. package/templates/teams/loop-4-parallel/team.toml +142 -0
  38. package/templates/teams/loop-4-split-leader/CLAUDE.md +76 -0
  39. package/templates/teams/loop-4-split-leader/README.md +7 -0
  40. package/templates/teams/loop-4-split-leader/team.toml +140 -0
  41. package/templates/teams/loop-6/CLAUDE.md +43 -0
  42. package/templates/teams/loop-6/README.md +9 -0
  43. package/templates/teams/loop-6/team.toml +161 -0
@@ -0,0 +1,85 @@
1
+ ---
2
+ name: memory-audit
3
+ description: Recurring audit of operator memory entries. Every fifth pipeline retro synthesis, the memory curator reviews accumulated feedback/project/reference entries and promotes team-generic rules to durable docs or skills, retires already-promoted entries, and keeps operator-specific state in memory. Invoked by the role that owns memory curation (typically Product).
4
+ ---
5
+
6
+ # Memory Audit
7
+
8
+ ## Purpose
9
+
10
+ Operator memory accumulates organically as pipeline retros land. Most entries are useful at the moment of capture but their durable home is uncertain — some describe team-generic rules that belong in CLAUDE.md or a workflow skill, some restate rules already documented elsewhere, and some are genuinely operator-specific state that should stay local. Without a recurring audit the memory directory drifts: promotion candidates go unpromoted, already-promoted entries become redundant, and staleness accumulates.
11
+
12
+ This skill is the steady-state cadence that keeps the memory layer in sync with the durable documentation layer.
13
+
14
+ ## When to invoke
15
+
16
+ Every fifth pipeline retro synthesis, counted from the previous audit (or from the start of the repo's history if no audit has run yet).
17
+
18
+ The count is derived from the git log at invocation time; no counter state file is kept.
19
+
20
+ ```bash
21
+ # Replace <repo> with the path to the repository (e.g. the main worktree).
22
+ LAST_AUDIT=$(git -C <repo> log main --grep="^memory audit:" -1 --format=%H 2>/dev/null)
23
+ if [ -n "$LAST_AUDIT" ]; then
24
+ COUNT=$(git -C <repo> log "${LAST_AUDIT}..HEAD" main --grep="synthesis" --oneline | wc -l)
25
+ else
26
+ COUNT=$(git -C <repo> log main --grep="synthesis" --oneline | wc -l)
27
+ fi
28
+ echo "retro-synthesis commits since last audit: $COUNT"
29
+ ```
30
+
31
+ If `COUNT >= 5`, run the audit. Otherwise no-op.
32
+
33
+ The "synthesis" grep matches pipeline-run retrospective synthesis commits whose subject follows the convention `Run <label> synthesis — ...`. The audit-closing commit uses the subject prefix `memory audit: ...` so the next count cycle can find it.
34
+
35
+ ## Who runs it
36
+
37
+ The role that owns memory curation. In the default team topology, that is Product (Product already owns retro synthesis and the durable-documentation layer). In a team topology without a Product role, the equivalent role — the one that edits CLAUDE.md and memory files — runs the audit.
38
+
39
+ ## The three-criterion promotion rubric
40
+
41
+ A memory entry is a promotion candidate only if all three conditions hold:
42
+
43
+ 1. **Validated across ≥3 pipeline runs.** A single-run observation is provisional; three runs establish that the rule is real and the failure mode recurs. Two-run entries stay in memory pending validation or refutation.
44
+ 2. **Operator-agnostic.** The rule applies to any team running this pipeline topology, not just to this operator or this specific deployment. Test: would another operator running the same team template benefit from this rule? If yes, it's team-generic. If no, it's operator-specific and stays in memory.
45
+ 3. **Describes a rule.** The entry is normative ("do X", "don't Y", "when X, then Y") not descriptive ("the current state is X" / "this commit fixed Y"). Descriptive entries are project state and belong in `project_*` memory regardless of how broadly applicable they might feel.
46
+
47
+ All three are required. Borderline entries stay in memory until the next audit cycle, when more data may resolve the ambiguity.
48
+
49
+ ## Classification outcomes
50
+
51
+ Every entry falls into exactly one of four buckets:
52
+
53
+ - **(a) Already promoted — retire.** The rule exists verbatim or near-verbatim in CLAUDE.md, a workflow skill, or another durable artifact. Retire the memory entry (delete the file and remove the `MEMORY.md` index line).
54
+ - **(b) Needs promotion — draft and retire.** All three criteria hold and no durable home exists yet. Draft the promotion (new CLAUDE.md bullet, new skill section, or new checklist item) in a single commit; retire the memory entry in the same commit or the next one.
55
+ - **(c) Keep in memory.** At least one criterion fails (operator-specific, single-run, descriptive). Update the memory entry if needed; leave it in place.
56
+ - **(d) Retire unconditionally.** The entry is stale (documents a bug since fixed, references a subsystem no longer in the codebase) and no longer useful. Delete with no promotion.
57
+
58
+ ## Execution recipe
59
+
60
+ 1. **Resolve the count.** Run the git-log snippet above; confirm `COUNT >= 5`. If not, no-op and return.
61
+ 2. **Enumerate entries.** Read `MEMORY.md`. For each file it links to, open the memory file and note its frontmatter `type` (user / feedback / project / reference).
62
+ 3. **Classify.** For each entry, apply the three-criterion rubric and assign to (a), (b), (c), or (d).
63
+ 4. **Confirm promotion targets.** For each (b) entry, identify the most-specific durable home: a workflow skill if the rule is role-specific; CLAUDE.md if the rule spans roles; a checklist item in spec-checklist if the rule is spec-authoring discipline; and so on. If no natural home exists, demote to (c) pending a future refactor that creates one.
64
+ 5. **Draft promotions and retirements.** Edit durable artifacts to add the promoted text. Delete the corresponding memory files. Update `MEMORY.md` to remove the retired index lines.
65
+ 6. **Write the audit report.** Create a product-facing doc under `docs/product/` named `memory-audit-<yyyy-mm-dd>.md` that enumerates the starting count, the classification of each entry, and the set of durable-doc edits made. The report is useful for future audits (diff vs prior report) and for operator review.
66
+ 7. **Commit.** The commit message subject line MUST start with `memory audit:` so the next count cycle can anchor on it. Example: `memory audit: 2026-04-17 — retired 45 already-promoted, promoted 40, left 24 operator-specific`.
67
+
68
+ ## What NOT to promote
69
+
70
+ - **Operator identity, deployment specifics, or local-environment constraints.** These are operator-specific by definition.
71
+ - **Historical session records.** `project_session_*` files are provenance, not rules.
72
+ - **Stale bug-fix memories.** If a memory documents a bug that has since been fixed, retire it with disposition (d) — don't try to promote the fix itself.
73
+ - **Workflow-topology changes.** Retros (and this audit's promotions) may change *how* individual roles perform their work but must NOT change the pipeline topology (who talks to whom). Topology changes go back as "performance/communication changes only."
74
+
75
+ ## Audit-report ratcheting
76
+
77
+ Keep the most recent audit report. Delete audit reports older than three cycles — they're no longer actionable and the durable-doc state has moved on. The most-recent report provides the diff baseline for the next audit; older reports clutter `docs/product/` without adding value.
78
+
79
+ ## What success looks like
80
+
81
+ A steady-state audit where the number of (a) entries (already-promoted-redundant) trends toward zero over several cycles. If (a) entries are persistently large, the retro-synthesis step is under-promoting during normal synthesis and the audit is compensating — flag this to the team via the next retro synthesis or a question message to the role that owns retro synthesis.
82
+
83
+ A steady-state audit where (b) entries are in the 0–5 range per cycle. Larger (b) sets suggest the retro-synthesis step is skipping promotion candidates entirely — same diagnosis and same fix.
84
+
85
+ A steady-state audit where (c) entries are the bulk of the memory file count: this is healthy. Operator-specific state is what memory is for.
@@ -0,0 +1,69 @@
1
+ ---
2
+ name: product-workflow
3
+ description: Product's strategic workflow — pipeline variants (standard vs design-first), variant triage, spec length targets, Impl pre-draft rule, pipeline kickoff composition, retrospective synthesis, topology invariance. Invoke on Product startup.
4
+ ---
5
+
6
+ # Product Workflow
7
+
8
+ Product holds strategic direction, feature scoping, design decisions, and high-bandwidth negotiations with Spec during design-first runs. Product is the **primary point of contact with the team lead** — all lead communication routes through Product. Product owns CLAUDE.md edits, memory file curation, and retro synthesis. Product composes and posts the feature kickoff top-level with `message_type="feature"`; Leader takes over for operational execution.
9
+
10
+ Product does NOT run the pipeline cron, does NOT post operational merge acks in feature threads, and does NOT handle mechanical merges day-to-day. Those are Leader's responsibilities.
11
+
12
+ ## Pipeline Variants
13
+
14
+ **Standard pipeline (small–medium features):** Product compacts Leader → Product posts feature kickoff (`message_type="feature"`) → Leader replies in-thread with operational kickoff (compact Spec/Impl/QA, create feat branch, start cron) → Spec → Impl → QA → Leader ships in-thread → Product reads retros from the thread.
15
+
16
+ **Design-first pipeline (larger features):** Product writes scope with open questions → Product posts a `message_type="question"` design review to Spec directly (high-bandwidth strategic negotiation, Product-owned) → the team lead reviews (or Spec's judgment if the lead is away) → Product locks scope → Product compacts Leader → Product posts feature kickoff → Leader replies in-thread with operational kickoff (NO second compact — Spec retains design context) → Spec → Impl → QA → Leader ships → Product reads retros.
17
+
18
+ The design pass front-loads decisions, gives Product feedback to incorporate before scoping, and gives Spec context that accelerates the spec phase. Use it for features with non-obvious design decisions, new infrastructure patterns, or multiple open questions. **Product owns the design phase directly**; Leader only takes over at the operational-kickoff reply step.
19
+
20
+ ## Variant triage
21
+
22
+ Design-first is for scope with semantic decisions, new contracts, novel patterns, or ≥2 non-obvious open questions. Pure structural extractions — move code from A to B, update imports, add structural invariants — use the standard pipeline. Design-first overhead on a mechanical lift is wasted; the speedup is ~8× for simple refactors when using the standard pipeline. When in doubt, standard pipeline is cheaper to undo (schedule a follow-up design review) than design-first is to compress.
23
+
24
+ ## Spec length scales with churn, not template inertia
25
+
26
+ For mechanical-lift refactors, budget spec length ~3× the LOC of the projected code diff. Do not inherit a full complex-feature spec template (multi-row risk tables, three-stage handoff checklists, exhaustive decision logs) when the problem doesn't exercise it. Below ~3:1, further compression costs a question from Impl or a verification gap — diminishing returns. Target 3:1 as the floor, not 2:1. Trim template boilerplate that the problem doesn't exercise; preserve copy-pastable test bodies and substitution tables that eliminate Impl↔Spec review cycles.
27
+
28
+ ## Impl pre-draft during standby
29
+
30
+ Standing rule: while Impl is idle waiting for Spec's handoff, Impl may pre-draft an implementation sketch in working memory — blast-radius analysis, substitution candidates, import impacts. This front-loads analysis that would otherwise serialize after the handoff. When Spec's commit lands, Impl compares their pre-draft against the formal spec and applies or discards. Divergence between pre-draft and spec is fine (Spec's call wins unless escalated).
31
+
32
+ ## Pipeline Kickoff
33
+
34
+ **Product** composes and posts the feature kickoff top-level with `message_type="feature"`, mentioning Leader. The kickoff defines the effort: goal, scope boundaries, baseline commit, structural invariants, ship criteria, retro carryover. Product does not name the feat branch or run operational steps — that's Leader's job in the reply. The first line of the kickoff text renders as the thread title — keep it natural (no `[FEATURE]` bracket prefix); the pill is attached automatically from `message_type`.
35
+
36
+ **Product** compacts Leader before posting the kickoff (gives Leader a clean context for the run). **Leader** replies in-thread with the operational kickoff after compacting the pipeline agents for fresh context. **Never compact Product** — Product preserves private context across features for strategic continuity.
37
+
38
+ Do NOT compact Librarian — Librarian operates independently and maintains its own context across features.
39
+
40
+ **For design-first pipeline:** Do NOT compact again between the design review and the feature kickoff. Spec's design review context is valuable and should be preserved.
41
+
42
+ **Do NOT mention Librarian on feature kickoffs or ship messages.** Librarian is an observer role and does not participate in feature threads. Standard kickoff mention list: `[Spec, Implementation, QA]`. Librarian watches silently and communicates with Product directly via a dedicated side thread outside the feature thread.
43
+
44
+ **Kickoff content comes from Product.** Product composes the feature kickoff directly — scope, baseline, ship criteria, retro carryover. Leader's operational-kickoff reply adds mechanical details only: feat branch name, confirmation that compaction is complete, cron started, agent mentions. Leader does not invent scope. If the kickoff is ambiguous or missing context Leader needs, Leader posts a `message_type="question"` reply in the feature thread rather than guessing.
45
+
46
+ ## Retrospective
47
+
48
+ After QA verifies and Leader confirms a feature has shipped, Spec/Impl/QA each post one short retro message in the feature thread with `message_type="retro"` (as a `reply_to` against Leader's ship message). Each agent should consider:
49
+
50
+ - What went well in the process
51
+ - What caused friction or confusion
52
+ - What could be improved for next time (workflow, threading, handoff format, tooling)
53
+ - Whether any step should become a skill or be automated
54
+
55
+ **Keep retros short.** Bullet points, not paragraphs. The retro's job is to produce durable signal for Product's synthesis, not to re-narrate the run. Retros that balloon into synthesis essays are themselves a process-cost problem.
56
+
57
+ **Do NOT mention Librarian on retro-request ship messages.** Librarian is an observer role and does not participate in feature threads. They watch ship events passively and deliver as-built passes via the dedicated Librarian→Product side thread.
58
+
59
+ **Topology invariance principle:** Retros may change *how individual agents perform their work* (spec templates, impl disciplines, QA parity plans, handoff message content) but must NOT change the team interaction topology (who talks to whom, when they talk, the number of review cycles per run). The pipeline topology (Lead → Product → Leader → Spec → Impl → QA → Leader → Product) is invariant. Retros optimize the work at each node, not the connections between nodes.
60
+
61
+ **Leader ensures the retros are visible in the feature thread** (Leader posts a "retros in" ping mentioning Product once all three retros are in, so Product gets a notification). Leader does not collect-and-forward, and does not do retro synthesis — retros live in the thread, Product reads them there.
62
+
63
+ **Product reads retros and takes action** before the next run kicks off. Actions include updating CLAUDE.md, creating/updating memory files, modifying skills, or changing agent prompts. Observations without actions mean the same feedback surfaces next retro. Actions that would change the topology are rejected on principle — they go back as "performance/communication changes only."
64
+
65
+ **Invoke `memory-audit` during synthesis.** After posting the retro-synthesis commit, invoke the `memory-audit` skill. The skill computes the count of synthesis commits since the last `memory audit:` commit and runs the audit if the count has reached five. The skill is fast (a no-op in four out of five invocations) and keeps the memory/documentation drift bounded.
66
+
67
+ **Spike before speccing tooling:** For infrastructure or CLI-interaction features (shell scripts, devcontainer setup, agent interaction), do a quick manual spike to validate assumptions before writing a full spec. Platform code (APIs, frontends) is predictable enough for spec-first. Shell + CLI interaction is not.
68
+
69
+ **Failed approaches:** If an approach fails, revert fully and keep the docs. The reverted spec provides negative-space constraints ("what doesn't work and why") that accelerate the redesign.
@@ -0,0 +1,99 @@
1
+ ---
2
+ name: spec-checklist
3
+ description: Generate a prefilled verification checklist for writing a spec. Use at the start of spec work to ensure nothing is missed.
4
+ argument-hint: [feature scope or description]
5
+ ---
6
+
7
+ Generate a verification checklist for writing a spec for the given feature.
8
+
9
+ ## Feature
10
+
11
+ $ARGUMENTS
12
+
13
+ ## Checklist
14
+
15
+ Work through each item before writing the spec. Check off as you go.
16
+
17
+ ### API & Data Layer
18
+ - [ ] **Existing API endpoints:** Which endpoints are relevant? Do any already serve the data needed?
19
+ - [ ] **API gaps:** Are new endpoints needed? What request/response shapes?
20
+ - [ ] **Data model changes:** Any new fields, tables, or migrations?
21
+ - [ ] **Real-time events:** Does this feature need streaming / SSE / WebSocket updates? Are the right events already emitted?
22
+
23
+ ### Frontend
24
+ - [ ] **Existing components:** Which components are affected? Read them before proposing changes.
25
+ - [ ] **Existing helpers:** Check shared utilities — is there code that already does part of this?
26
+ - [ ] **Framework compatibility:** Confirm patterns match the project's framework idioms (reactive state, effect model, component API).
27
+ - [ ] **Styling:** Document exact colors, sizes, and spacing using the existing palette.
28
+
29
+ ### Dependencies
30
+ - [ ] **New libraries needed?** Confirm compatibility with the project's toolchain.
31
+ - [ ] **Bundle size impact:** Estimate size delta for any new frontend dependencies.
32
+ - [ ] **Security:** Does the library handle untrusted input safely? Do we need sanitization?
33
+
34
+ ### Test Infrastructure
35
+ - [ ] **Test runners available?** Verify the test tooling exists before specifying tests.
36
+ - [ ] **Test plan:** Define test cases covering: happy path, edge cases, error cases, regressions.
37
+ - [ ] **Test data setup (UI features):** If the feature involves visual changes, include concrete setup steps (e.g. HTTP calls, fixtures) that create the right data shape for manual or e2e verification. Don't rely on code review alone for visual correctness.
38
+
39
+ ### Interface Design
40
+ - [ ] **Hide internal topology from consumers.** If the spec requires the client to enumerate sources, manage subscriptions, or know the internal structure of the data, the abstraction is wrong. The server should aggregate.
41
+
42
+ ### Cross-Cutting
43
+ - [ ] **Verify claims in the feature scope.** Don't trust Product's assumptions about what exists — check the code.
44
+ - [ ] **Accessibility:** Any ARIA labels, keyboard navigation, or screen reader concerns?
45
+ - [ ] **Performance:** Any large data sets, heavy computation, or expensive renders?
46
+ - [ ] **Security:** XSS, injection, auth boundaries?
47
+
48
+ ### Spec Document
49
+ - [ ] **Reference code by function/class name + file path** — never use line numbers (they drift between commits)
50
+ - [ ] **Files to create/modify** — explicit table with file paths and actions
51
+ - [ ] **Open questions** — list anything that needs Product input
52
+ - [ ] **Out of scope** — confirm alignment with feature boundaries
53
+
54
+ ### Baselines (§ 14 gates)
55
+ - [ ] **Empty-diff shortcut first.** Run `git diff <prior_ship>..<feat_tip> -- <source-dirs>`. If empty, inherit the prior ship's gate matrix verbatim — no re-running tests/typechecks/lints. Fall back to full re-measurement if the diff is non-empty or the run is a structural refactor where the diff-based check could miss a latent failure.
56
+ - [ ] **Cross-repo first run: empty-diff shortcut does NOT apply.** When the first pipeline run in a new repo kicks off, there is no prior ship to inherit from. Always remeasure from scratch at the feat tip: run the repo's test command, typecheck, and any project-specific baseline commands. Explicitly enumerate any pre-existing failures in § 2 so QA doesn't false-alarm on the delta.
57
+ - [ ] **Pytest count formula.** When your gate section projects a pytest delta, use the explicit formula `baseline + N new test functions = new total`. **Additive assertions inside existing test functions do NOT add to the count.** Check that the test-plan count matches the headline target.
58
+ - [ ] **Full re-measure if diff is non-empty.** Run baseline commands at the current `feat/<slug>` tip. Never inherit counts from a prior spec or memory of what the count was last run. Inter-run merges drift the numbers silently.
59
+ - [ ] **Paste literal output** — BASELINE-FROZEN blocks with the exact command and its output.
60
+ - [ ] **Prefer "≤ N" over "= N"** when the residual count lives in suppressed / unrelated files (scripts/, auto-generated).
61
+
62
+ ### § 13 Draft-time Command Execution (NON-NEGOTIABLE)
63
+
64
+ **Run these commands BEFORE writing § 5 / § 11 / § 14, not as a review pass.** Reading commands is NOT the same as executing them. Executed commands routinely produce 1-2 spec amendments per run by surfacing stale assumptions.
65
+
66
+ **Position in the workflow:** § 13 commands are *grounding*, not *review*. Running them *first* produces correct imports, paths, and counts on first write — skipping that step forces mid-draft patches.
67
+
68
+ - [ ] **Execute § 13 commands at the START of spec drafting**, before writing § 5/§ 11/§ 14. The output drives what goes into those sections, not the other way around.
69
+ - [ ] **Every quoted count** in § 11 / § 14 / § 6 is the literal output of an executed command, not a hand-estimate.
70
+ - [ ] **Every file path** referenced in Product's doc has been verified with `ls` or `test -e`. Product docs drift; phantom paths get caught at spec time, not at Impl's first test run.
71
+ - [ ] **Every Product-enumerated implementation step** has been verified against current code. Product docs sometimes describe as "to do" steps that have already shipped, or describe as shipped steps that were never completed. Grep/read each step before writing § 5.
72
+
73
+ ### § 11 Surprises for Impl — Missing-Imports Audit
74
+ For every new symbol referenced in § 5 code snippets (function calls, exception catches, type annotations), grep the target file for the import:
75
+
76
+ ```
77
+ grep -n "^import <sym>\|^from [^ ]* import.*<sym>" <target-file>
78
+ ```
79
+
80
+ If the grep returns empty, add a § 11 line: "**Missing import** — `<sym>` is not imported in `<target-file>`. Add `import <sym>` (or `from <module> import <sym>`) to the top of the file."
81
+
82
+ Common culprits:
83
+ - [ ] Stdlib modules newly introduced by § 5: `json`, `asyncio`, `re`, `uuid`, `time`, `os`, `sys`.
84
+ - [ ] New exception types in `except` clauses.
85
+ - [ ] New typing imports: `Any`, `Callable`, `Awaitable`.
86
+
87
+ **Test snippet imports must be self-contained.** Every symbol a § 7 test snippet calls must be explicitly imported inside that snippet (at the top of the test function or at the top of the test file). Do NOT assume `import foo as foo_mod` at the file top brings bare `foo_mod.cmd` into the test function's namespace — call sites that use the bare name will fail with `NameError` even if the alias import exists. Rule: for every symbol referenced by its bare name in a § 7 test snippet, grep the snippet for a matching `from <module> import <name>` or `import <name>` line. If absent, add it.
88
+
89
+ ### Test Cleanup Fixtures
90
+ - [ ] **FK cascade enumeration.** If a test fixture deletes rows from a table with FK-dependent children, grep `REFERENCES <parent>(id)` in the schema files to find ALL child tables. Enumerate them in dependency order in the spec's test-infra section, OR specify `TRUNCATE ... CASCADE` as the default. Partial recipes silently fail when the schema grows new FKs.
91
+ - [ ] **Verify the fixture helper at the target line before prescribing additive assertions.** When the spec says "add `assert X` to test Y at line N," grep test Y for the fixture it uses to confirm the fixture matches what the assertion needs. Cheap check at spec-draft time, saves Impl the recast work.
92
+ - [ ] **Subprocess env forwarding under pytest-xdist.** If any test runs a subprocess that imports project config, the spec must list ALL mutated config vars to forward. In-memory config mutations don't cross process boundaries.
93
+
94
+ ### Token / Secret Literals in § 7 Test Snippets
95
+ - [ ] **Never hard-code token prefix literals in § 7 test snippets.** Import from the project's token-constants module instead. Arch invariants that block raw literal usage in tests will trip the Impl gate — catch at spec-draft time.
96
+
97
+ ### Protocol Cross-Reference
98
+ - [ ] **If any D-decision touches an inter-agent protocol** — mention lists on ship/kickoff/handoff messages, thread discipline, retros-in routing, token-ring mention rules, status-update discipline — scan CLAUDE.md's § Agent Workflow for the current live rule before freezing the spec decision. Live protocol evolves faster than spec templates; a spec that hard-codes a stale mention list forces Impl to either follow it blindly (wrong behavior) or deviate (compliance ambiguity).
99
+ - [ ] **Prefer live protocol references over inline protocol rules** in D-decisions.
@@ -0,0 +1,64 @@
1
+ ---
2
+ name: verify
3
+ description: QA verification workflow. Rebuild the test stack, run tests, diff against spec, and post a structured pass/fail report. Use when QA receives a handoff.
4
+ argument-hint: [commit hash or feature name]
5
+ ---
6
+
7
+ Run the QA verification workflow for a feature handoff.
8
+
9
+ ## Steps
10
+
11
+ 1. **Identify what to verify.** Check the recent Moot channel context for the handoff message. Note the commit hash, spec file, and files changed ($ARGUMENTS may contain the commit hash).
12
+
13
+ 2. **Rebuild the test stack** (QA owns the stack). Use the project's rebuild command. For example, on a docker compose project:
14
+ ```bash
15
+ docker compose up --build -d
16
+ ```
17
+ Wait for services to be healthy.
18
+
19
+ 3. **Install test dependencies** for your language/toolchain. For example:
20
+ ```bash
21
+ <project-test-install-command>
22
+ ```
23
+
24
+ 4. **Run the test suite:**
25
+ ```bash
26
+ <project-test-run-command>
27
+ ```
28
+ Note pass/fail count and any new failures.
29
+
30
+ **If you see a flood of errors at suite start** (contention from residual state left over from a prior run, stale DB connections, etc.): restart the relevant services to clear residual state before investigating further. This is the first diagnostic step, not a last resort.
31
+
32
+ 5. **Check the frontend build** (if applicable):
33
+ ```bash
34
+ <project-frontend-build-command>
35
+ ```
36
+
37
+ 6. **Code review.** Read the changed files and diff against the spec:
38
+ - Does the implementation match the spec?
39
+ - Are there deviations? Are they justified?
40
+ - Were all spec test cases included?
41
+ - Any security concerns (XSS, injection, etc.)?
42
+
43
+ 7. **Post verification report** to the Moot channel in the feature thread:
44
+
45
+ ```
46
+ Verification complete for [feature] (commit [hash]).
47
+
48
+ **Code review:** [Approved/Changes requested]
49
+ - [finding 1]
50
+ - [finding 2]
51
+
52
+ **Tests:**
53
+ - Backend: [X passed, Y failed]
54
+ - Frontend build: [clean/errors]
55
+ - New test coverage: [included/missing]
56
+
57
+ **Spec compliance:** [matches/deviations noted]
58
+
59
+ Verdict: **[Approved/Blocked]**
60
+ ```
61
+
62
+ 8. Mention Leader in the report so the pipeline advances. If blocked, mention Implementation with what needs to change.
63
+
64
+ 9. **Small repairs.** If you find an unambiguous bug during verification (wrong status code, missing validation a test covers, obvious typo), fix it directly — commit to your branch and include the fix in your report. No git-request needed for these. If the fix involves judgment calls or design decisions, flag it instead of fixing.
@@ -0,0 +1,72 @@
1
+ # {project_name}
2
+
3
+ TODO: Describe your project. What does it do? What problem does it solve?
4
+
5
+ ## Status
6
+
7
+ TODO: What works, what doesn't. Update as the project evolves.
8
+
9
+ ## Tech stack
10
+
11
+ TODO: Language, frameworks, databases, build tools.
12
+
13
+ ## Running
14
+
15
+ TODO: How to run the project, run tests, build, deploy.
16
+
17
+ ## Code conventions
18
+
19
+ TODO: Formatting, linting, type checking, naming conventions.
20
+
21
+ ## Agent Workflow
22
+
23
+ {role_count} agents collaborate on this project: {role_list}. They communicate via the Convo shared context server.
24
+
25
+ ### Roles
26
+
27
+ {role_descriptions}
28
+
29
+ ### Resource Ownership
30
+
31
+ {resource_ownership}
32
+
33
+ ### Git Workflow
34
+
35
+ {git_description}
36
+
37
+ ### Startup
38
+
39
+ On connecting to a space (including restarts and resumes), every agent must:
40
+ 1. Call orientation() to get identity, focus space, and context
41
+ 2. Subscribe to the channel for push notifications
42
+ 3. Post a status_update confirming identity and readiness
43
+
44
+ ### Work Pipeline
45
+
46
+ {workflow_description}
47
+
48
+ ```
49
+ {pipeline_diagram}
50
+ ```
51
+
52
+ {handoff_protocol}
53
+
54
+ Before handing off, the agent must commit to their branch and request a merge from the leader via a `[GIT-REQUEST]` thread.
55
+
56
+ **Status updates on handoff:** Every agent must call `update_status` when receiving or completing a handoff.
57
+
58
+ ### Channel Threading Protocol
59
+
60
+ {threading_protocol}
61
+
62
+ ### Clarification Flow
63
+
64
+ When an agent is blocked and needs input, use `[QUESTION]` threads in the channel. Mention the target agent.
65
+
66
+ ### Tracking Decisions
67
+
68
+ Use `propose_decision` for choices that involve tradeoffs, creativity, or judgment -- decisions where a different person might choose differently. Do NOT track mechanical or purely deductive decisions.
69
+
70
+ ### Retrospective
71
+
72
+ After the verifier approves and the leader confirms a feature is complete, every agent posts a retro message in the `[FEATURE]` thread.
@@ -0,0 +1,6 @@
1
+ # loop-3 -- Minimal Pipeline
2
+
3
+ Three-agent pipeline for small projects where a separate design phase adds overhead.
4
+ Leader --> Implementation --> Verifier --> Leader.
5
+
6
+ Use for projects small enough that the leader can scope work directly to the implementer.
@@ -0,0 +1,108 @@
1
+ toml_schema_version = "1"
2
+
3
+ [archetype]
4
+ id = "mootup/loop-3"
5
+ version = "1.0"
6
+ diverged_at = ""
7
+
8
+ [team]
9
+ name = "loop-3"
10
+ description = "Minimal three-agent pipeline for small projects"
11
+ version = "1.0"
12
+ origin = "Reduced loop-4; same pattern as the markdraft example"
13
+
14
+ # -- Roles --
15
+
16
+ [[roles]]
17
+ name = "leader"
18
+ display_name = "Leader"
19
+ harness = "claude-code"
20
+ model = "sonnet"
21
+ theme = "yellow"
22
+ responsibilities = """
23
+ Product direction, prioritization, feature scoping, and team coordination.
24
+ Owns git operations (commits, branches, merges). Scopes work directly
25
+ to the implementer -- no separate design phase. Human interface."""
26
+
27
+ startup_prompt = """
28
+ You are the Leader agent. Call orientation() to get your identity,
29
+ focus space, and context in one call. Then subscribe to the channel.
30
+ Post a status_update confirming you are online."""
31
+
32
+ [[roles]]
33
+ name = "implementation"
34
+ display_name = "Implementation"
35
+ harness = "claude-code"
36
+ model = "opus"
37
+ theme = "cyan"
38
+ responsibilities = """
39
+ Code implementation based on leader's scope. Writes common-case behavioral
40
+ tests before handoff (pipeline gate). Follows scope precisely -- asks for
41
+ clarification rather than guessing."""
42
+
43
+ startup_prompt = """
44
+ You are the Implementation agent. Call orientation() then subscribe to
45
+ the channel. Post a status_update confirming you are online. Wait for work."""
46
+
47
+ [[roles]]
48
+ name = "qa"
49
+ display_name = "Verifier"
50
+ harness = "claude-code"
51
+ model = "sonnet"
52
+ theme = "green"
53
+ responsibilities = """
54
+ Test strategy, test implementation, feature verification. Owns the docker
55
+ compose stack. Extends test coverage beyond requirements based on own
56
+ analysis. Includes security verification. May commit small repairs
57
+ directly when the intended behavior is unambiguous."""
58
+
59
+ startup_prompt = """
60
+ You are the Verifier agent. Call orientation() then subscribe to the channel.
61
+ Post a status_update confirming you are online. Wait for work."""
62
+
63
+ # -- Workflow --
64
+
65
+ [workflow]
66
+ description = """
67
+ Work flows through agents in sequence, one feature at a time:
68
+ Leader --> Implementation --> Verifier --> Leader.
69
+ Each handoff is a channel message mentioning the next agent.
70
+ Leader scopes work directly to the implementer (no design phase)."""
71
+
72
+ pipeline = ["leader", "implementation", "qa"]
73
+
74
+ [workflow.threads]
75
+ feature = "[FEATURE]"
76
+ question = "[QUESTION]"
77
+ git_request = "[GIT-REQUEST]"
78
+ stack_request = "[STACK-REQUEST]"
79
+
80
+ [workflow.handoff]
81
+ method = "mention"
82
+ includes = ["summary of work done", "what next agent needs to do", "files changed", "branch name"]
83
+
84
+ # -- Git --
85
+
86
+ [git]
87
+ description = """
88
+ Each agent works in a git worktree. Feature branches from main,
89
+ agent branches from feature branch. Squash-merge features to main."""
90
+
91
+ strategy = "worktree"
92
+ feature_branch = "feat/{slug}"
93
+ agent_branch = "{role}/{slug}"
94
+ merge_to_main = "squash"
95
+
96
+ [git.ownership]
97
+ main_branch = "leader"
98
+ stack = "qa"
99
+
100
+ # -- Resource ownership --
101
+
102
+ [resources]
103
+ description = """
104
+ Shared resources have a single owner to avoid contention."""
105
+
106
+ [resources.owners]
107
+ git = "leader"
108
+ docker_stack = "qa"
@@ -0,0 +1,72 @@
1
+ # {project_name}
2
+
3
+ TODO: Describe your project. What does it do? What problem does it solve?
4
+
5
+ ## Status
6
+
7
+ TODO: What works, what doesn't. Update as the project evolves.
8
+
9
+ ## Tech stack
10
+
11
+ TODO: Language, frameworks, databases, build tools.
12
+
13
+ ## Running
14
+
15
+ TODO: How to run the project, run tests, build, deploy.
16
+
17
+ ## Code conventions
18
+
19
+ TODO: Formatting, linting, type checking, naming conventions.
20
+
21
+ ## Agent Workflow
22
+
23
+ {role_count} agents collaborate on this project: {role_list}. They communicate via the Convo shared context server.
24
+
25
+ ### Roles
26
+
27
+ {role_descriptions}
28
+
29
+ ### Resource Ownership
30
+
31
+ {resource_ownership}
32
+
33
+ ### Git Workflow
34
+
35
+ {git_description}
36
+
37
+ ### Startup
38
+
39
+ On connecting to a space (including restarts and resumes), every agent must:
40
+ 1. Call orientation() to get identity, focus space, and context
41
+ 2. Subscribe to the channel for push notifications
42
+ 3. Post a status_update confirming identity and readiness
43
+
44
+ ### Work Pipeline
45
+
46
+ {workflow_description}
47
+
48
+ ```
49
+ {pipeline_diagram}
50
+ ```
51
+
52
+ {handoff_protocol}
53
+
54
+ Before handing off, the agent must commit to their branch and request a merge from the leader via a `[GIT-REQUEST]` thread.
55
+
56
+ **Status updates on handoff:** Every agent must call `update_status` when receiving or completing a handoff.
57
+
58
+ ### Channel Threading Protocol
59
+
60
+ {threading_protocol}
61
+
62
+ ### Clarification Flow
63
+
64
+ When an agent is blocked and needs input, use `[QUESTION]` threads in the channel. Mention the target agent.
65
+
66
+ ### Tracking Decisions
67
+
68
+ Use `propose_decision` for choices that involve tradeoffs, creativity, or judgment -- decisions where a different person might choose differently. Do NOT track mechanical or purely deductive decisions.
69
+
70
+ ### Retrospective
71
+
72
+ After the verifier approves and the leader confirms a feature is complete, every agent posts a retro message in the `[FEATURE]` thread.
@@ -0,0 +1,6 @@
1
+ # loop-4 -- Standard Pipeline
2
+
3
+ Four-agent software development pipeline proven over 30+ features.
4
+ Product --> Spec --> Implementation --> QA --> Product.
5
+
6
+ Use for projects with enough complexity that implementation benefits from a design phase.