buildanything 1.2.1 → 1.6.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/.claude-plugin/plugin.json +1 -1
- package/agents/design-ui-designer.md +28 -0
- package/agents/design-ux-architect.md +10 -0
- package/commands/build.md +463 -324
- package/commands/protocols/brainstorm.md +99 -0
- package/commands/protocols/build-fix.md +52 -0
- package/commands/protocols/cleanup.md +56 -0
- package/commands/protocols/design.md +287 -0
- package/commands/protocols/eval-harness.md +62 -0
- package/commands/protocols/metric-loop.md +94 -0
- package/commands/protocols/planning.md +56 -0
- package/commands/protocols/verify.md +63 -0
- package/hooks/hooks.json +2 -2
- package/hooks/session-start +65 -8
- package/package.json +1 -1
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# Planning Protocol
|
|
2
|
+
|
|
3
|
+
You are the orchestrator converting a validated Design Document and Architecture Document into an ordered, developer-ready task list.
|
|
4
|
+
|
|
5
|
+
## Input
|
|
6
|
+
|
|
7
|
+
You need two documents before running this protocol:
|
|
8
|
+
- **Design Document** (`docs/plans/YYYY-MM-DD-[topic]-design.md`) — scope, user flows, data model, tech stack
|
|
9
|
+
- **Architecture Document** (`docs/plans/architecture.md`) — services, API contracts, database schema, component tree
|
|
10
|
+
|
|
11
|
+
## Step 1: Break Down
|
|
12
|
+
|
|
13
|
+
Decompose the architecture into ordered, atomic tasks. Each task must be:
|
|
14
|
+
|
|
15
|
+
- **Implementable independently** — a developer agent can build it without needing unfinished work from other tasks
|
|
16
|
+
- **Testable** — there are concrete acceptance criteria that can be verified
|
|
17
|
+
- **Scoped to MVP** — if the design doc says a feature is deferred, do not create tasks for it
|
|
18
|
+
|
|
19
|
+
For each task:
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
### Task [N]: [name]
|
|
23
|
+
**Type:** frontend / backend / integration / infrastructure
|
|
24
|
+
**Description:** [what to build, 2-3 sentences]
|
|
25
|
+
**Acceptance Criteria:**
|
|
26
|
+
- [ ] [specific, verifiable criterion]
|
|
27
|
+
- [ ] [specific, verifiable criterion]
|
|
28
|
+
**Dependencies:** [task numbers that must complete first, or "none"]
|
|
29
|
+
**Size:** S (< 1 hour) / M (1-3 hours) / L (3+ hours)
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Step 2: Order
|
|
33
|
+
|
|
34
|
+
Order tasks by dependency chain, then by priority within each dependency level:
|
|
35
|
+
|
|
36
|
+
1. Infrastructure/scaffolding first (project setup, database schema, base config)
|
|
37
|
+
2. Core data model and API endpoints
|
|
38
|
+
3. Primary user flow (the main thing the user does)
|
|
39
|
+
4. Supporting features
|
|
40
|
+
5. Polish, error handling, edge cases
|
|
41
|
+
|
|
42
|
+
Flag any circular dependencies — these indicate an architecture problem that needs resolution before building.
|
|
43
|
+
|
|
44
|
+
## Step 3: Validate
|
|
45
|
+
|
|
46
|
+
Check the task list against the design doc:
|
|
47
|
+
|
|
48
|
+
- Every feature in MVP scope has at least one task
|
|
49
|
+
- No task exceeds the MVP boundary
|
|
50
|
+
- No task is too large (L tasks should be split if possible)
|
|
51
|
+
- Dependency chains are no deeper than 3 levels
|
|
52
|
+
- Acceptance criteria are specific enough that a developer agent can verify them without ambiguity
|
|
53
|
+
|
|
54
|
+
## Step 4: Save
|
|
55
|
+
|
|
56
|
+
Save to `docs/plans/sprint-tasks.md`.
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# Verification Protocol
|
|
2
|
+
|
|
3
|
+
You are the orchestrator. You are about to run a deterministic verification gate — a fast, sequential pass/fail check that catches regressions before expensive audit agents run.
|
|
4
|
+
|
|
5
|
+
## When to Run
|
|
6
|
+
|
|
7
|
+
Run this protocol at every phase boundary: after scaffolding, after each task, before final review. It is cheap. Run it often.
|
|
8
|
+
|
|
9
|
+
## Step 1: Detect Stack
|
|
10
|
+
|
|
11
|
+
Before running checks, detect the project's stack from manifest files:
|
|
12
|
+
|
|
13
|
+
| Manifest | Stack | Build | Types | Lint | Test | Security |
|
|
14
|
+
|----------|-------|-------|-------|------|------|----------|
|
|
15
|
+
| `package.json` | Node | `npm run build` | `npx tsc --noEmit` | `npm run lint` | `npm test` | `npm audit` |
|
|
16
|
+
| `requirements.txt` / `pyproject.toml` | Python | — | `mypy .` | `ruff check .` | `pytest` | `pip audit` |
|
|
17
|
+
| `go.mod` | Go | `go build ./...` | (included in build) | `golangci-lint run` | `go test ./...` | `govulncheck ./...` |
|
|
18
|
+
| `Cargo.toml` | Rust | `cargo build` | (included in build) | `cargo clippy` | `cargo test` | `cargo audit` |
|
|
19
|
+
|
|
20
|
+
Skip any check that does not apply (e.g., skip Build for a pure Python script, skip Type-Check for JavaScript without TypeScript). A skipped check counts as PASS.
|
|
21
|
+
|
|
22
|
+
## Step 2: Run Checks Sequentially
|
|
23
|
+
|
|
24
|
+
Call the Agent tool — description: "Verify [phase name]" — mode: "bypassPermissions" — prompt:
|
|
25
|
+
|
|
26
|
+
"Run the Verification Protocol. Execute all 6 checks sequentially, stop on first failure. Report: VERIFY: PASS (6/6) or VERIFY: FAIL at step [N] — [check name]: [reason]."
|
|
27
|
+
|
|
28
|
+
The agent runs these checks in order, stopping on the first FAIL:
|
|
29
|
+
|
|
30
|
+
| # | Check | What it does |
|
|
31
|
+
|---|-------|-------------|
|
|
32
|
+
| 1 | Build | Project compiles/bundles without errors |
|
|
33
|
+
| 2 | Type-Check | No type errors (tsc, mypy, etc.) |
|
|
34
|
+
| 3 | Lint | No lint violations |
|
|
35
|
+
| 4 | Test | All tests pass |
|
|
36
|
+
| 5 | Security | No known vulnerabilities in deps |
|
|
37
|
+
| 6 | Diff Review | `git diff` of uncommitted changes — no debug code, no secrets, no obvious regressions |
|
|
38
|
+
|
|
39
|
+
<HARD-GATE>
|
|
40
|
+
ONE AGENT, ONE PASS: The orchestrator spawns exactly ONE agent for the entire verification. This is a single Agent tool call, not 6 separate agents. The agent runs each check as a sequential shell command and evaluates the result before proceeding.
|
|
41
|
+
</HARD-GATE>
|
|
42
|
+
|
|
43
|
+
## Step 3: Handle Result
|
|
44
|
+
|
|
45
|
+
**On PASS:** Log `VERIFY: PASS (6/6)` to `docs/plans/.build-state.md`. Proceed to next phase.
|
|
46
|
+
|
|
47
|
+
**On FAIL:** Read the failure reason and spawn a targeted fix agent:
|
|
48
|
+
|
|
49
|
+
| Failed Check | Fix Strategy |
|
|
50
|
+
|-------------|-------------|
|
|
51
|
+
| Build / Type-Check / Lint | Run the Build-Fix Protocol (`commands/protocols/build-fix.md`). It isolates the first error, fixes it, rebuilds, detects cascade resolution, and reverts bad fixes automatically. |
|
|
52
|
+
| Test | Spawn fix agent: "Fix the failing test: [test name]. Read the test, read the implementation, fix the implementation — not the test — unless the test is wrong." |
|
|
53
|
+
| Security | Spawn fix agent: "Resolve vulnerability: [advisory]. Update the dependency or apply the recommended remediation." |
|
|
54
|
+
| Diff Review | Spawn fix agent: "Remove debug code / hardcoded secrets / regressions found in diff review: [details]." |
|
|
55
|
+
|
|
56
|
+
After the fix agent completes, re-run verification from Step 2.
|
|
57
|
+
|
|
58
|
+
<HARD-GATE>
|
|
59
|
+
MAX 3 FIX ATTEMPTS: If verification fails 3 times on the same phase:
|
|
60
|
+
- **Interactive mode:** present the failure history to the user. Ask for direction.
|
|
61
|
+
- **Autonomous mode:** log the failure to `docs/plans/build-log.md` and proceed with a warning.
|
|
62
|
+
Do not loop forever.
|
|
63
|
+
</HARD-GATE>
|
package/hooks/hooks.json
CHANGED
|
@@ -14,11 +14,11 @@
|
|
|
14
14
|
],
|
|
15
15
|
"PreCompact": [
|
|
16
16
|
{
|
|
17
|
-
"matcher": "",
|
|
17
|
+
"matcher": ".*",
|
|
18
18
|
"hooks": [
|
|
19
19
|
{
|
|
20
20
|
"type": "prompt",
|
|
21
|
-
"prompt": "ORCHESTRATOR STATE SAVE — Context is about to be compacted. If you are running the /buildanything:build pipeline, you MUST do these things NOW before your context is lost:\n\n1.
|
|
21
|
+
"prompt": "ORCHESTRATOR STATE SAVE — Context is about to be compacted. If you are running the /buildanything:build pipeline, you MUST do these things NOW before your context is lost:\n\n1. Save all task statuses to docs/plans/.build-state.md (TodoWrite does NOT survive compaction — .build-state.md is your only persistent store)\n2. Write `docs/plans/.build-state.md` with ALL of the following:\n - Current phase and step\n - Task progress (which tasks done, which in progress)\n - If you are in a metric loop: the Active Metric Loop section with metric definition, current iteration, full score history table, and what action to take next\n - Agents used so far\n - Whether running in autonomous mode\n - dispatches_since_save and last_save values\n3. The next thing after compaction is the SessionStart hook re-injecting your state. Save EVERYTHING or you lose your metric loop progress."
|
|
22
22
|
}
|
|
23
23
|
]
|
|
24
24
|
}
|
package/hooks/session-start
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
# buildanything: SessionStart hook
|
|
3
3
|
# Re-injects orchestrator identity after context compaction, resume, or clear.
|
|
4
|
-
# Modeled after superpowers' session-start pattern.
|
|
5
4
|
|
|
6
5
|
# Check if a build pipeline is active by looking for .build-state.md
|
|
7
6
|
BUILD_STATE=""
|
|
@@ -9,20 +8,69 @@ if [ -f "docs/plans/.build-state.md" ]; then
|
|
|
9
8
|
BUILD_STATE=$(cat "docs/plans/.build-state.md")
|
|
10
9
|
fi
|
|
11
10
|
|
|
11
|
+
# Skip if the build is already complete
|
|
12
|
+
if echo "$BUILD_STATE" | grep -q "Phase: 7 COMPLETE"; then
|
|
13
|
+
BUILD_STATE=""
|
|
14
|
+
fi
|
|
15
|
+
|
|
16
|
+
# Check if we're past Phase 3 but missing design artifacts
|
|
17
|
+
if [ -n "$BUILD_STATE" ]; then
|
|
18
|
+
CURRENT_PHASE=$(echo "$BUILD_STATE" | grep -oP 'Phase: \K[0-9]+' | head -1)
|
|
19
|
+
if [ "$CURRENT_PHASE" -ge 4 ] 2>/dev/null && [ ! -f "docs/plans/visual-design-spec.md" ]; then
|
|
20
|
+
DESIGN_WARNING="
|
|
21
|
+
DESIGN GATE VIOLATION: Current phase is ${CURRENT_PHASE} but docs/plans/visual-design-spec.md does not exist.
|
|
22
|
+
Phase 3 (Design & Visual Identity) may have been skipped. DO NOT proceed with Foundation or Build.
|
|
23
|
+
Return to Phase 3 and produce visual-design-spec.md before continuing."
|
|
24
|
+
fi
|
|
25
|
+
fi
|
|
26
|
+
|
|
12
27
|
# If no active build, just provide a minimal reminder
|
|
13
28
|
if [ -z "$BUILD_STATE" ]; then
|
|
14
29
|
CONTEXT="buildanything plugin is installed. Use /buildanything:build to start a full product pipeline, or /buildanything:idea-sweep for parallel research."
|
|
15
30
|
else
|
|
16
|
-
#
|
|
31
|
+
# Check if there's an active metric loop
|
|
32
|
+
METRIC_LOOP=""
|
|
33
|
+
if echo "$BUILD_STATE" | grep -q "Active Metric Loop"; then
|
|
34
|
+
METRIC_LOOP="
|
|
35
|
+
ACTIVE METRIC LOOP DETECTED — You were mid-iteration when context compacted.
|
|
36
|
+
1. Read commands/protocols/metric-loop.md to reload the loop protocol
|
|
37
|
+
2. Find the 'Active Metric Loop' section in .build-state.md for your metric definition and score history
|
|
38
|
+
3. Resume from the iteration indicated in the score log table
|
|
39
|
+
4. Do NOT restart the loop from scratch — continue where you left off"
|
|
40
|
+
fi
|
|
41
|
+
|
|
42
|
+
# Check for resume point
|
|
43
|
+
RESUME_POINT=""
|
|
44
|
+
if echo "$BUILD_STATE" | grep -q "Resume Point"; then
|
|
45
|
+
RESUME_POINT="
|
|
46
|
+
RESUME POINT DETECTED — This build can be continued with /buildanything:build --resume.
|
|
47
|
+
The state file contains a structured Resume Point with phase, step, and task progress.
|
|
48
|
+
Reset dispatches_since_save to 0 (fresh context window)."
|
|
49
|
+
fi
|
|
50
|
+
|
|
51
|
+
# Active build detected — inject orchestrator identity and rules directly
|
|
52
|
+
# These are inlined so they survive context compaction (no file re-read required)
|
|
17
53
|
read -r -d '' CONTEXT << 'ORCHESTRATOR'
|
|
18
54
|
BUILDANYTHING ORCHESTRATOR — ACTIVE BUILD DETECTED
|
|
19
55
|
|
|
20
|
-
|
|
56
|
+
<HARD-GATE>
|
|
57
|
+
YOU ARE AN ORCHESTRATOR. YOU COORDINATE AGENTS. YOU DO NOT WRITE CODE.
|
|
58
|
+
Every step below tells you to call the Agent tool. DO IT. Do not role-play as the agent. Do not write implementation code yourself. Do not skip the Agent tool call "because it's faster."
|
|
59
|
+
"Launch an agent" = call the Agent tool (the actual tool in your toolbar, the one that spawns a subprocess).
|
|
60
|
+
For implementation agents, set mode: "bypassPermissions".
|
|
61
|
+
For parallel work, put multiple Agent tool calls in ONE message.
|
|
62
|
+
</HARD-GATE>
|
|
63
|
+
|
|
64
|
+
ORCHESTRATOR DISCIPLINE:
|
|
65
|
+
YOU ARE A DISPATCHER, NOT A DOER. Your context is precious — protect it.
|
|
66
|
+
- TWO agent types: Research/analysis agents (keep full output — it's your decision-making input). Implementation agents (keep summary only — the code is in the repo).
|
|
67
|
+
- NEVER read source code, write code, or debug yourself — spawn agents for all implementation work.
|
|
68
|
+
- Save research outputs to docs/plans/ so you can reference files later instead of holding everything in context.
|
|
21
69
|
|
|
22
70
|
CRITICAL RULES:
|
|
23
|
-
1. You do NOT write implementation code yourself — you dispatch to specialist agents
|
|
71
|
+
1. You do NOT write implementation code yourself — you call the Agent tool to dispatch to specialist agents
|
|
24
72
|
2. You follow phase gates — no advancing without quality gate approval
|
|
25
|
-
3. Every
|
|
73
|
+
3. Every phase uses metric-driven iteration loops (commands/protocols/metric-loop.md)
|
|
26
74
|
4. You must re-read commands/build.md if you are unsure of the process
|
|
27
75
|
|
|
28
76
|
YOUR CURRENT STATE (from docs/plans/.build-state.md):
|
|
@@ -30,12 +78,21 @@ ORCHESTRATOR
|
|
|
30
78
|
|
|
31
79
|
CONTEXT="${CONTEXT}
|
|
32
80
|
${BUILD_STATE}
|
|
81
|
+
${METRIC_LOOP}
|
|
82
|
+
${RESUME_POINT}
|
|
83
|
+
${DESIGN_WARNING}
|
|
33
84
|
|
|
34
85
|
NEXT ACTIONS:
|
|
35
86
|
1. Re-read commands/build.md to reload the full orchestrator process
|
|
36
|
-
2.
|
|
37
|
-
3.
|
|
38
|
-
4.
|
|
87
|
+
2. Re-read commands/protocols/metric-loop.md if you are mid-loop
|
|
88
|
+
3. Re-read commands/protocols/design.md if you are in Phase 3 (Design & Visual Identity)
|
|
89
|
+
4. Re-read docs/plans/sprint-tasks.md for task list and acceptance criteria
|
|
90
|
+
5. Re-read docs/plans/architecture.md for architecture context
|
|
91
|
+
6. Re-read CLAUDE.md for build decisions
|
|
92
|
+
7. Re-read docs/plans/learnings.md if it exists (patterns and pitfalls from previous builds)
|
|
93
|
+
8. Rebuild TodoWrite from docs/plans/.build-state.md (TodoWrite does NOT survive compaction)
|
|
94
|
+
9. Resume from the phase and step indicated in your state above
|
|
95
|
+
10. Dispatch work to specialist agents — do not implement directly"
|
|
39
96
|
fi
|
|
40
97
|
|
|
41
98
|
# Output as additional_context for Claude Code
|
package/package.json
CHANGED