buildanything 2.0.0 → 2.1.2

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 (115) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +9 -1
  3. package/README.md +57 -61
  4. package/agents/a11y-architect.md +2 -0
  5. package/agents/briefing-officer.md +172 -0
  6. package/agents/business-model.md +14 -12
  7. package/agents/code-architect.md +6 -1
  8. package/agents/code-reviewer.md +3 -2
  9. package/agents/code-simplifier.md +12 -4
  10. package/agents/design-brand-guardian.md +19 -0
  11. package/agents/design-critic.md +16 -11
  12. package/agents/design-inclusive-visuals-specialist.md +2 -0
  13. package/agents/design-ui-designer.md +17 -0
  14. package/agents/design-ux-architect.md +15 -0
  15. package/agents/design-ux-researcher.md +102 -7
  16. package/agents/engineering-ai-engineer.md +2 -0
  17. package/agents/engineering-backend-architect.md +2 -0
  18. package/agents/engineering-data-engineer.md +2 -0
  19. package/agents/engineering-devops-automator.md +2 -0
  20. package/agents/engineering-frontend-developer.md +13 -0
  21. package/agents/engineering-mobile-app-builder.md +2 -0
  22. package/agents/engineering-rapid-prototyper.md +15 -2
  23. package/agents/engineering-security-engineer.md +2 -0
  24. package/agents/engineering-senior-developer.md +13 -0
  25. package/agents/engineering-sre.md +2 -0
  26. package/agents/engineering-technical-writer.md +2 -0
  27. package/agents/feature-intel.md +8 -7
  28. package/agents/ios-app-review-guardian.md +2 -0
  29. package/agents/ios-foundation-models-specialist.md +2 -0
  30. package/agents/ios-product-reality-auditor.md +292 -0
  31. package/agents/ios-storekit-specialist.md +2 -0
  32. package/agents/ios-swift-architect.md +1 -0
  33. package/agents/ios-swift-search.md +1 -0
  34. package/agents/ios-swift-ui-design.md +7 -4
  35. package/agents/marketing-app-store-optimizer.md +2 -0
  36. package/agents/planner.md +6 -1
  37. package/agents/pr-test-analyzer.md +3 -2
  38. package/agents/product-feedback-synthesizer.md +62 -0
  39. package/agents/product-owner.md +163 -0
  40. package/agents/product-reality-auditor.md +216 -0
  41. package/agents/product-spec-writer.md +176 -0
  42. package/agents/refactor-cleaner.md +9 -1
  43. package/agents/security-reviewer.md +2 -1
  44. package/agents/silent-failure-hunter.md +2 -1
  45. package/agents/swift-build-resolver.md +2 -0
  46. package/agents/swift-reviewer.md +2 -1
  47. package/agents/tech-feasibility.md +5 -3
  48. package/agents/testing-api-tester.md +2 -0
  49. package/agents/testing-evidence-collector.md +24 -0
  50. package/agents/testing-performance-benchmarker.md +2 -0
  51. package/agents/testing-reality-checker.md +2 -1
  52. package/agents/visual-research.md +7 -5
  53. package/bin/adapters/scribe-tool.ts +4 -2
  54. package/bin/adapters/write-lease-tool.ts +1 -1
  55. package/bin/buildanything-runtime.ts +20 -107
  56. package/bin/graph-index.js +24 -0
  57. package/bin/graph-index.ts +340 -0
  58. package/bin/mcp-servers/graph-mcp.js +26 -0
  59. package/bin/mcp-servers/graph-mcp.ts +481 -0
  60. package/bin/mcp-servers/orchestrator-mcp.js +26 -0
  61. package/bin/mcp-servers/orchestrator-mcp.ts +361 -0
  62. package/bin/setup.js +272 -111
  63. package/commands/build.md +424 -177
  64. package/commands/idea-sweep.md +2 -2
  65. package/commands/setup.md +15 -4
  66. package/commands/ux-review.md +3 -3
  67. package/commands/verify.md +3 -0
  68. package/docs/migration/phase-graph.yaml +573 -157
  69. package/hooks/design-md-lint +4 -0
  70. package/hooks/design-md-lint.ts +295 -0
  71. package/hooks/pre-tool-use.ts +37 -6
  72. package/hooks/record-mode-transitions.ts +63 -6
  73. package/hooks/subagent-start.ts +3 -2
  74. package/package.json +3 -1
  75. package/protocols/agent-prompt-authoring.md +165 -0
  76. package/protocols/architecture-schema.md +10 -3
  77. package/protocols/cleanup.md +4 -0
  78. package/protocols/decision-log.md +8 -4
  79. package/protocols/design-md-authoring.md +520 -0
  80. package/protocols/design-md-spec.md +362 -0
  81. package/protocols/fake-data-detector.md +1 -1
  82. package/protocols/ios-fake-data-detector.md +65 -0
  83. package/protocols/ios-phase-branches.md +128 -43
  84. package/protocols/launch-readiness.md +9 -5
  85. package/protocols/metric-loop.md +1 -1
  86. package/protocols/page-spec-schema.md +234 -0
  87. package/protocols/product-spec-schema.md +354 -0
  88. package/protocols/sprint-tasks-schema.md +53 -0
  89. package/protocols/state-schema.json +38 -3
  90. package/protocols/state-schema.md +32 -2
  91. package/protocols/verify.md +29 -1
  92. package/protocols/web-phase-branches.md +246 -76
  93. package/skills/ios/ios-bootstrap/SKILL.md +1 -1
  94. package/src/graph/ids.ts +86 -0
  95. package/src/graph/index.ts +32 -0
  96. package/src/graph/parser/architecture.ts +603 -0
  97. package/src/graph/parser/component-manifest.ts +268 -0
  98. package/src/graph/parser/decisions-jsonl.ts +407 -0
  99. package/src/graph/parser/design-md-pass2.ts +253 -0
  100. package/src/graph/parser/design-md.ts +477 -0
  101. package/src/graph/parser/page-spec.ts +496 -0
  102. package/src/graph/parser/product-spec.ts +930 -0
  103. package/src/graph/parser/screenshot.ts +342 -0
  104. package/src/graph/parser/sprint-tasks.ts +317 -0
  105. package/src/graph/storage/index.ts +1154 -0
  106. package/src/graph/types.ts +432 -0
  107. package/src/graph/util/dhash.ts +84 -0
  108. package/src/lrr/aggregator.ts +105 -10
  109. package/src/orchestrator/hooks/context-header.ts +34 -10
  110. package/src/orchestrator/hooks/token-accounting.ts +25 -14
  111. package/src/orchestrator/mcp/cycle-counter.ts +2 -1
  112. package/src/orchestrator/mcp/scribe.ts +27 -16
  113. package/src/orchestrator/mcp/write-lease.ts +30 -13
  114. package/src/orchestrator/phase4-shared-context.ts +20 -4
  115. package/protocols/visual-dna.md +0 -185
@@ -0,0 +1,165 @@
1
+ # Agent Prompt Authoring Standard
2
+
3
+ You are producing text that will become another agent's prompt. Task briefs, finding reports, routing rows, fix specs, critic verdicts — when your output is read by a downstream agent and shapes its behavior, the quality of your text is the quality of that next dispatch's input.
4
+
5
+ This protocol defines how to write that text well.
6
+
7
+ ## Who this applies to
8
+
9
+ - `briefing-officer` — writes per-task briefs read by implementers
10
+ - `product-feedback-synthesizer` — writes routing rows read by Phase 5.5 fix dispatches
11
+ - `product-reality-auditor` — writes findings.json read by the synthesizer
12
+ - `design-critic` — writes findings that drive metric-loop fix prompts
13
+ - `product-owner` — writes feature-delegation plans read by briefing officers
14
+ - `code-architect` — writes implementation blueprints read by sprint planner + implementers
15
+ - LRR chapter judges — write verdicts read by the aggregator for backward routing
16
+
17
+ If your output is consumed by a human, this protocol does not apply — write for humans normally.
18
+
19
+ ## The single rule
20
+
21
+ The receiving agent has not seen this conversation. It cannot ask follow-up questions. It will read your output and act. If a smart colleague reading the same text would be confused, the receiving agent will be too.
22
+
23
+ ## Standards
24
+
25
+ ### 1. Ground in quotes, not paraphrase
26
+
27
+ When your output references a source artifact (product-spec, page-spec, decisions.jsonl, findings.json, architecture.md), quote the source verbatim and carry the source location as a trailing reference. Paraphrase reintroduces the drift the graph layer was built to prevent.
28
+
29
+ - Weak: `User has 3 attempts to enter a code per the spec`
30
+ - Good: `User has 3 verification attempts before lockout (from product-spec.md L142)`
31
+
32
+ If the graph returns the field directly, copy it character-for-character. ID-to-label resolution and list-filtering are the only allowed transformations.
33
+
34
+ When the source field is negative by design (DNA `Don'ts`, banned phrases, system invariants), quote it verbatim — do not rewrite to positive framing. Standard 1 (verbatim) wins over Standard 2 (positive) when the source itself is intentionally negative.
35
+
36
+ ### 2. Tell the receiver what to do, not what not to do
37
+
38
+ Positive prescriptions are unambiguous. Negative prescriptions force the receiver to enumerate the negative space and pick something from it — that's where drift happens.
39
+
40
+ - Weak: `Don't use generic colors`
41
+ - Good: `Use locked DNA palette: primary #0F172A, accent #F59E0B`
42
+
43
+ - Weak: `Don't skip error handling`
44
+ - Good: `On 4xx response, render the error toast component with the API body's message field`
45
+
46
+ Negative framing is justified for actual invariants the receiver would otherwise rationalize around — see Standard 5 for when to escalate.
47
+
48
+ ### 3. Add the why for non-obvious constraints
49
+
50
+ Without motivation, the receiver cannot judge edge cases. A stated reason lets it reason about whether the rule applies in a borderline situation.
51
+
52
+ - Weak: `Use the manifest entry`
53
+ - Good: `Use the manifest entry — this slot is HARD-GATE; rebuilding it from scratch will fail Phase 5 brand audit`
54
+
55
+ - Weak: `Cap retries at 3`
56
+ - Good: `Cap retries at 3 — backend rate-limits at 5 req/sec per user (from architecture.md L88)`
57
+
58
+ ### 4. Wrap structured inputs in XML tags
59
+
60
+ When you slot a complex artifact into your output (wireframe, acceptance criteria, persona constraints, API contract), wrap it. The receiver parses the boundary unambiguously.
61
+
62
+ ```
63
+ <wireframe>
64
+ [verbatim ASCII from page-specs/checkout.md L20-45]
65
+ </wireframe>
66
+
67
+ <acceptance_criteria>
68
+ - Form renders all required fields per layout
69
+ - Submitting valid input calls POST /api/checkout once
70
+ </acceptance_criteria>
71
+ ```
72
+
73
+ This matters most when your output contains long-form quoted content (>10 lines). Short inline values do not need tags.
74
+
75
+ ### 5. Reserve HARD-GATE language for actual invariants
76
+
77
+ `MUST`, `STOP`, `do NOT` lose force when overused. Reserve them for rules where violation breaks the pipeline. Soft preferences dressed up as hard gates dilute the genuine ones.
78
+
79
+ Use HARD-GATE language for:
80
+ - Pipeline-breaking failures (graph-call failure → STOP, no silent fallback)
81
+ - Race-condition triggers (writer-owner violations corrupt files)
82
+ - Audit-blocking decisions (manifest `hard_gate: true` slots)
83
+ - Drift-introducing transformations on graph fields (verbatim slotting)
84
+
85
+ Use normal prescriptive language for everything else: "Use", "Include", "Quote", "Reference". A rule stated once with rationale is stronger than the same rule stated three times in escalating caps.
86
+
87
+ If you find yourself repeating a rule, the rule is fragile — fix it once at the source instead.
88
+
89
+ ## Worked example — task brief block
90
+
91
+ ### Weak brief
92
+
93
+ ```
94
+ ### Task 4.1: Build checkout
95
+ - Agent: engineering-frontend-developer
96
+ - Context:
97
+ - Build the checkout flow per the spec
98
+ - Make sure errors are handled
99
+ - Use good design
100
+ - Acceptance: works
101
+ ```
102
+
103
+ Violations: pointer-not-content (Standard 1), vague verb "handled" (Standard 2), uninstantiated "good design" (Standard 2), no testable criteria.
104
+
105
+ ### Improved brief
106
+
107
+ ```
108
+ ### Task 4.1: Build checkout payment-method form
109
+ - Agent: engineering-frontend-developer
110
+ - Skills: react-best-practices, shadcn-composition
111
+ - Context:
112
+ <wireframe>
113
+ [verbatim ASCII from page-specs/checkout.md L20-45]
114
+ </wireframe>
115
+ - Components: shadcn Form.field, shadcn Input.text, shadcn Button.primary
116
+ - Tokens: colors.primary, spacing.lg
117
+ - API: POST /api/checkout, body {payment_method_id: string, amount_cents: number}, returns 200 {order_id} or 4xx {error: string}
118
+ - Error states:
119
+ - 402 → toast "Payment declined. Try a different card." (from product-spec.md L142)
120
+ - 422 → inline field error "Invalid card number" (from product-spec.md L145)
121
+ - Business rules: amount_cents minimum 50 (from product-spec.md L156)
122
+ - Persona: [Buyer] complete checkout in 3 fields max (from product-spec.md L167)
123
+ - Acceptance:
124
+ - Form renders all fields specified in wireframe
125
+ - Submitting valid payment_method_id calls POST /api/checkout once
126
+ - 402 response shows toast within 200ms
127
+ - 422 response shows inline error tied to the offending field
128
+ ```
129
+
130
+ Why this works: wireframe quoted verbatim, components carry library + variant, every constraint has a source ref, acceptance criteria are testable.
131
+
132
+ ## Worked example — synthesizer routing row
133
+
134
+ ### Weak finding
135
+
136
+ ```json
137
+ {
138
+ "finding_id": "f-042",
139
+ "description": "Checkout has issues with persona requirements",
140
+ "target_phase": 1
141
+ }
142
+ ```
143
+
144
+ ### Improved finding
145
+
146
+ ```json
147
+ {
148
+ "finding_id": "f-042",
149
+ "source": "product-reality",
150
+ "feature_id": "checkout",
151
+ "target_phase": 1,
152
+ "target_task_or_step": "1.6",
153
+ "description": "Buyer persona constraint at product-spec.md L167 requires 3-field checkout, but spec also requires billing_address (5 fields) and shipping_address (5 fields). Constraint and required fields are mutually exclusive — spec needs disambiguation before Phase 4 can proceed.",
154
+ "evidence_path": "evidence/product-reality/checkout/findings.json#f-042"
155
+ }
156
+ ```
157
+
158
+ Why this works: contradiction stated concretely with line refs, evidence pointer is reachable, routing decision (`target_phase: 1`) is justified by the description text rather than asserted.
159
+
160
+ ## When you are tempted to break these rules
161
+
162
+ - **"It's faster to summarize than to quote"** — the time you save now is paid with interest by the implementer who has to re-read the source to recover what you summarized away.
163
+ - **"The receiver will figure it out"** — the receiver has no conversation history. It will guess, and the guess will be plausible-looking but wrong.
164
+ - **"Adding the source ref is noisy"** — Phase 5 auditors and reviewers use source refs to spot-check. Without them, every claim is unverifiable.
165
+ - **"This rule is critical, I should repeat it for emphasis"** — repetition signals fragility. State it once with the why; if the rule actually breaks the pipeline, escalate to HARD-GATE language at the rule's source instead of restating in every dispatch.
@@ -14,7 +14,7 @@ The synthesized `architecture.md` MUST contain these top-level headings, in this
14
14
  - `# Data Model`
15
15
  - `# Security`
16
16
  - `# Infrastructure`
17
- - `# MVP Scope`
17
+ - `# Scope`
18
18
  - `# Out of Scope`
19
19
 
20
20
  For iOS builds, `# Frontend` MAY be titled `# App` and `# Backend` MAY be omitted if the app is fully on-device (the `refs.json` index reflects whatever headings exist). For web builds, all eight headings are required.
@@ -34,7 +34,7 @@ Every synthesized `architecture.md` MUST provide at least these subsection ancho
34
34
 
35
35
  ### Under `# Frontend`
36
36
 
37
- - `frontend/layout` — page hierarchy, routing, navigation structure. MUST state whether the product exposes a public, unauthenticated, content-indexable surface (yes / no / partial) — downstream SEO skill loading keys off this answer.
37
+ - `frontend/layout` — page hierarchy, routing, navigation structure. MUST state whether the product exposes a public, unauthenticated, content-indexable surface (yes / no / partial) — downstream SEO skill loading keys off this answer. MUST include a navigation map listing every route with its nav element (sidebar item, tab, breadcrumb, direct URL only).
38
38
  - `frontend/components` — core component list and responsibilities.
39
39
  - `frontend/state` — state management approach (stores, context, local state boundaries).
40
40
  - `frontend/styling` — design tokens, CSS/styling approach.
@@ -42,7 +42,7 @@ Every synthesized `architecture.md` MUST provide at least these subsection ancho
42
42
  ### Under `# Backend`
43
43
 
44
44
  - `backend/services` — service boundaries and responsibilities.
45
- - `backend/api` — API contracts (routes, request/response shapes).
45
+ - `backend/api` — API contracts (routes, request/response shapes). Each endpoint heading MUST include feature attribution annotations: `**POST /api/orders** (provides: order-placement)` or `**GET /api/inventory/{id}** (provides: inventory) (consumes: order-placement)`. Use the feature's kebab-case name from `product-spec.md`. `provides` = the feature that implements this endpoint; `consumes` = features that call it. These annotations are parsed by the graph indexer to emit `feature_provides_endpoint` / `feature_consumes_endpoint` edges — without them, the Product Owner cannot group features by API dependency.
46
46
  - `backend/persistence` — data layer, ORM choice, query patterns.
47
47
 
48
48
  ### Under `# Data Model`
@@ -56,6 +56,13 @@ Every synthesized `architecture.md` MUST provide at least these subsection ancho
56
56
  - `security/input-validation` — boundary validation rules.
57
57
  - `security/secrets` — secret storage and rotation.
58
58
 
59
+ ### Under `# Infrastructure`
60
+
61
+ - `infrastructure/deployment` — deployment target (Vercel, AWS, self-hosted, TestFlight), CI/CD approach, environment strategy (dev/staging/prod).
62
+ - `infrastructure/caching` — caching strategy (CDN, in-memory, database query cache), cache invalidation approach, what's cached and for how long. Stub with "N/A — no caching layer needed" if the product doesn't warrant it.
63
+ - `infrastructure/background-jobs` — async processing model (email sending, webhook handling, scheduled tasks, queue system). Stub with "N/A — no background processing needed" if all operations are synchronous.
64
+ - `infrastructure/env-vars` — required environment variables and secrets for each environment (dev/staging/prod). List every key the app needs to run, which service it authenticates with, and whether it's a secret or a config value. Format: `STRIPE_SECRET_KEY — Stripe payment processing — secret — required`.
65
+
59
66
  ## Ref format used by implementer prompts
60
67
 
61
68
  Phase 5.1 implementer prompts inject a `ARCHITECTURE REFS:` block in place of pasted architecture content. The block is parsed by the implementer agent, which uses the `Read` tool to fetch refs on demand.
@@ -52,3 +52,7 @@ After the cleanup agent finishes, spot-check that acceptance criteria still hold
52
52
  - Scope is sacred. Only files from the implementation changeset. Zero exceptions.
53
53
  - This runs AFTER implementation, BEFORE the metric loop.
54
54
  - If cleanup breaks acceptance criteria, revert and skip. Never block the metric loop on a cleanup failure.
55
+
56
+ ### Build Log Rotation
57
+
58
+ At Phase 0, if `docs/plans/build-log.md` exceeds 500 lines, archive it to `docs/plans/build-log.prev.md` and start a fresh log. The archived log preserves full history for debugging. The 500-line threshold keeps the active log within a reasonable context budget for agents that read it.
@@ -11,12 +11,12 @@ Rows live in `docs/plans/decisions.jsonl`, one JSON object per line, append-only
11
11
  "decision_id": "D-<phase>-<seq>",
12
12
  "phase": "2.2",
13
13
  "timestamp": "<ISO8601>",
14
- "decision": "chose SQLite over Postgres for MVP persistence",
14
+ "decision": "chose SQLite over Postgres for initial persistence",
15
15
  "chosen_approach": "SQLite with single-file .db in project root",
16
16
  "rejected_alternatives": [
17
17
  {
18
18
  "approach": "Postgres via Supabase",
19
- "reason": "adds infra setup to Phase 0 prereqs; overkill for single-user MVP",
19
+ "reason": "adds infra setup to Phase 0 prereqs; overkill for single-user app",
20
20
  "revisit_criterion": "multi-user access OR >10k rows OR concurrent writes"
21
21
  }
22
22
  ],
@@ -96,12 +96,12 @@ Subagents return `deviation_row` objects in their structured result. The orchest
96
96
  "decision_id": "D-2-03",
97
97
  "phase": "2.2",
98
98
  "timestamp": "2026-04-13T16:05:41Z",
99
- "decision": "chose SQLite over Postgres for MVP persistence",
99
+ "decision": "chose SQLite over Postgres for initial persistence",
100
100
  "chosen_approach": "SQLite with single-file .db in project root, migrations via drizzle-kit",
101
101
  "rejected_alternatives": [
102
102
  {
103
103
  "approach": "Postgres via Supabase",
104
- "reason": "adds infra setup to Phase 0 prereqs; overkill for single-user MVP.",
104
+ "reason": "adds infra setup to Phase 0 prereqs; overkill for single-user app.",
105
105
  "revisit_criterion": "multi-user access OR >10k rows OR concurrent writes"
106
106
  },
107
107
  {
@@ -129,3 +129,7 @@ Subagents return `deviation_row` objects in their structured result. The orchest
129
129
  ## Ref Field Convention
130
130
 
131
131
  Every row carries a `ref` anchor (e.g., `architecture.md#backend/persistence` or `visual-design-spec.md#<anchor>`) that downstream readers use to widen context without pasting prose. The resume handler passes the row's short fields *plus* the ref — the resumed agent reads the anchor via its own Read tool if it needs the full context. This matches the existing `refs.json` pattern in `commands/build.md` (primary/secondary anchors handed to implementers instead of pasted content), and keeps rehydration token cost bounded to ~300 tokens for the top 5 rows regardless of how much architectural prose sits behind each anchor.
132
+
133
+ ### Malformed Row Handling
134
+
135
+ When reading `decisions.jsonl` or `learnings.jsonl`, consumers MUST skip malformed rows (invalid JSON) with a warning logged to `build-log.md` rather than crashing. Shape: `"WARN: skipped malformed row at line N in [file]: [parse error]"`. This prevents a single corrupt append from blocking the entire LRR Aggregator or Learnings Loader.