agentic-team 0.0.0-stage → 6.1.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 (118) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +184 -2
  3. package/bin/build-template.js +208 -0
  4. package/bin/index.js +1139 -0
  5. package/package.json +41 -4
  6. package/template/.claude-plugin/plugin.json +10 -0
  7. package/template/.orchestra/README.md +401 -0
  8. package/template/.orchestra/blueprints/README.md +87 -0
  9. package/template/.orchestra/blueprints/api-only.md +46 -0
  10. package/template/.orchestra/blueprints/component-crud-resource.md +25 -0
  11. package/template/.orchestra/blueprints/saas-starter.md +69 -0
  12. package/template/.orchestra/config.yml +277 -0
  13. package/template/.orchestra/roles/orchestrator.md +105 -0
  14. package/template/.orchestra/roles/product-manager.md +438 -0
  15. package/template/.orchestra/scripts/compact-diff.awk +45 -0
  16. package/template/.orchestra/stacks/README.md +81 -0
  17. package/template/.orchestra/stacks/_lib/common.sh +3095 -0
  18. package/template/.orchestra/stacks/_repo/setup.sh +1109 -0
  19. package/template/.orchestra/stacks/backend-hono/claude/commands/endpoint.md +13 -0
  20. package/template/.orchestra/stacks/backend-hono/claude/skills/api-endpoint/SKILL.md +111 -0
  21. package/template/.orchestra/stacks/backend-hono/claude/skills/testing/SKILL.md +75 -0
  22. package/template/.orchestra/stacks/backend-hono/setup.sh +5945 -0
  23. package/template/.orchestra/stacks/backend-hono/stack.md +195 -0
  24. package/template/.orchestra/stacks/mobile-android-native/claude/commands/component.md +13 -0
  25. package/template/.orchestra/stacks/mobile-android-native/claude/skills/design-component/SKILL.md +58 -0
  26. package/template/.orchestra/stacks/mobile-android-native/setup.sh +607 -0
  27. package/template/.orchestra/stacks/mobile-android-native/stack.md +138 -0
  28. package/template/.orchestra/stacks/mobile-expo/claude/commands/component.md +12 -0
  29. package/template/.orchestra/stacks/mobile-expo/claude/skills/design-component/SKILL.md +92 -0
  30. package/template/.orchestra/stacks/mobile-expo/setup.sh +470 -0
  31. package/template/.orchestra/stacks/mobile-expo/stack.md +141 -0
  32. package/template/.orchestra/stacks/mobile-ios-native/claude/commands/component.md +12 -0
  33. package/template/.orchestra/stacks/mobile-ios-native/claude/skills/design-component/SKILL.md +58 -0
  34. package/template/.orchestra/stacks/mobile-ios-native/setup.sh +468 -0
  35. package/template/.orchestra/stacks/mobile-ios-native/stack.md +130 -0
  36. package/template/.orchestra/stacks/web-nextjs/claude/commands/component.md +12 -0
  37. package/template/.orchestra/stacks/web-nextjs/claude/skills/design-component/SKILL.md +100 -0
  38. package/template/.orchestra/stacks/web-nextjs/claude/skills/design-tokens/SKILL.md +61 -0
  39. package/template/.orchestra/stacks/web-nextjs/setup.sh +128 -0
  40. package/template/.orchestra/stacks/web-nextjs/stack.md +170 -0
  41. package/template/.orchestra/stacks/web-vite-react/claude/commands/component.md +12 -0
  42. package/template/.orchestra/stacks/web-vite-react/claude/skills/design-component/SKILL.md +100 -0
  43. package/template/.orchestra/stacks/web-vite-react/claude/skills/design-tokens/SKILL.md +61 -0
  44. package/template/.orchestra/stacks/web-vite-react/setup.sh +185 -0
  45. package/template/.orchestra/stacks/web-vite-react/stack.md +177 -0
  46. package/template/.orchestra/trackers/github.sh +467 -0
  47. package/template/CLAUDE.md +54 -0
  48. package/template/agents/architect.md +83 -0
  49. package/template/agents/engineer-high.md +17 -0
  50. package/template/agents/engineer-low.md +17 -0
  51. package/template/agents/engineer-max.md +17 -0
  52. package/template/agents/engineer-medium.md +17 -0
  53. package/template/agents/engineer-xhigh.md +17 -0
  54. package/template/agents/lead.md +870 -0
  55. package/template/agents/milestone-reviewer.md +63 -0
  56. package/template/agents/orchestrator.md +105 -0
  57. package/template/agents/product-manager.md +438 -0
  58. package/template/agents/reviewer.md +301 -0
  59. package/template/agents/scaffolder.md +180 -0
  60. package/template/agents/tracker.md +202 -0
  61. package/template/commands/blueprint.md +23 -0
  62. package/template/commands/create-role.md +64 -0
  63. package/template/commands/export.md +45 -0
  64. package/template/commands/help.md +55 -0
  65. package/template/commands/hotfix.md +12 -0
  66. package/template/commands/orchestrator.md +12 -0
  67. package/template/commands/pm.md +18 -0
  68. package/template/commands/rewind.md +61 -0
  69. package/template/commands/setup.md +14 -0
  70. package/template/commands/start.md +29 -0
  71. package/template/commands/status.md +11 -0
  72. package/template/commands/sync.md +73 -0
  73. package/template/commands/verifier.md +53 -0
  74. package/template/hooks/audit-context.sh +153 -0
  75. package/template/hooks/enforce-role.sh +175 -0
  76. package/template/hooks/protect-system-files.sh +123 -0
  77. package/template/hooks/review-rounds.sh +172 -0
  78. package/template/rules/acceptance-check.orchestra.md +11 -0
  79. package/template/rules/analytics-kpi.orchestra.md +56 -0
  80. package/template/rules/code-standards.orchestra.md +34 -0
  81. package/template/rules/comments.orchestra.md +77 -0
  82. package/template/rules/commit-format.orchestra.md +20 -0
  83. package/template/rules/dependency-upgrade.orchestra.md +112 -0
  84. package/template/rules/design-parity.orchestra.md +170 -0
  85. package/template/rules/observability.orchestra.md +118 -0
  86. package/template/rules/performance.orchestra.md +186 -0
  87. package/template/rules/phase-limits.orchestra.md +3 -0
  88. package/template/rules/pull-request.orchestra.md +213 -0
  89. package/template/rules/role-boundaries.orchestra.md +117 -0
  90. package/template/rules/security.orchestra.md +106 -0
  91. package/template/rules/stuck-detection.orchestra.md +25 -0
  92. package/template/rules/testing-standards.orchestra.md +214 -0
  93. package/template/rules/tracker-authority.orchestra.md +190 -0
  94. package/template/rules/verification-gate.orchestra.md +56 -0
  95. package/template/skills/accessibility/SKILL.md +31 -0
  96. package/template/skills/android-testing/SKILL.md +112 -0
  97. package/template/skills/architecture/SKILL.md +175 -0
  98. package/template/skills/auth-setup/SKILL.md +105 -0
  99. package/template/skills/best-practices/SKILL.md +29 -0
  100. package/template/skills/code-optimizer/SKILL.md +27 -0
  101. package/template/skills/core-web-vitals/SKILL.md +32 -0
  102. package/template/skills/crud-api/SKILL.md +32 -0
  103. package/template/skills/debug/SKILL.md +28 -0
  104. package/template/skills/deployment/SKILL.md +104 -0
  105. package/template/skills/error-handling/SKILL.md +154 -0
  106. package/template/skills/frontend-design/SKILL.md +30 -0
  107. package/template/skills/fullstack-infrastructure/SKILL.md +108 -0
  108. package/template/skills/ios-testing/SKILL.md +100 -0
  109. package/template/skills/mobile-testing/SKILL.md +102 -0
  110. package/template/skills/observability/SKILL.md +91 -0
  111. package/template/skills/project-structure/SKILL.md +114 -0
  112. package/template/skills/push-notifications/SKILL.md +146 -0
  113. package/template/skills/react-best-practices/SKILL.md +31 -0
  114. package/template/skills/realtime/SKILL.md +146 -0
  115. package/template/skills/review/SKILL.md +82 -0
  116. package/template/skills/testing/SKILL.md +44 -0
  117. package/template/skills/web-quality-audit/SKILL.md +47 -0
  118. package/template/skills/web-testing/SKILL.md +120 -0
@@ -0,0 +1,277 @@
1
+ # Orchestra Configuration
2
+ # Customize pipeline behavior, thresholds, and verification commands.
3
+
4
+ pipeline:
5
+ # One model for every phase. There used to be a table mapping a phase's
6
+ # complexity to a model tier, and it stopped earning its place: on the
7
+ # current generation, effort moves quality and cost more than the tier
8
+ # does, and one model means one prompt cache.
9
+ model: opus
10
+
11
+ # How hard the sub-agent thinks, per phase. The PM writes one of the three
12
+ # names on the phase; lead maps it here. Pick by how expensive a wrong
13
+ # answer is to unwind — not by how long the work takes. Long and mechanical
14
+ # is light; short and load-bearing is complex.
15
+ effort:
16
+ # One right answer, and a test or a build says whether you hit it.
17
+ # a config value or an environment variable
18
+ # a copy or a translation change
19
+ # a dependency bump the seam tests cover
20
+ # a field added to a form that already exists, validated like the rest
21
+ # a new column that is nullable and read by nothing yet
22
+ # an analytics event on a screen that already reports others
23
+ light: medium
24
+ # A feature. Most phases live here.
25
+ # a new endpoint with validation, a query and a response shape
26
+ # a new screen from a design, with its states
27
+ # a background job with a retry policy
28
+ # a migration that adds a table and the code that reads it
29
+ # an integration behind a wrapper, with the wrapper's test
30
+ # a refactor that moves behaviour without changing it
31
+ # The shipped default is medium; a project that set high keeps it on
32
+ # upgrade. One run moved its later phases to medium and they were approved
33
+ # within three review rounds — one run, not a measurement. A phase that
34
+ # needs more says `effort: high` itself.
35
+ standard: medium
36
+ # Being wrong costs more than the tokens. A mistake here reaches
37
+ # production quietly or is expensive to unwind.
38
+ # sign-in, sessions, password reset, permissions
39
+ # anything that moves money or issues a refund
40
+ # a migration that rewrites or deletes data, or changes a type in place
41
+ # concurrency — a lock, a queue consumer, an idempotency key
42
+ # a change that touches many files at once
43
+ # a rate limit, a cache with invalidation, a retry with side effects
44
+ complex: xhigh
45
+ # When a phase says nothing.
46
+ default_effort: standard
47
+ # A phase can also write a raw level — effort: max — for the one place
48
+ # where correctness beats cost outright. The names above are the
49
+ # vocabulary; the five levels stay reachable.
50
+ # What happens to the design RFC before phases start.
51
+ # required — show it and wait for you
52
+ # optional — show it and continue
53
+ # skip — write it and never show it
54
+ #
55
+ # The default is optional because skip is the one setting with no upside:
56
+ # the architect still runs and still writes rfc.md on a complex milestone,
57
+ # so skip pays for the design and then throws away the only chance to read
58
+ # it before the code exists. required is the right choice when the work is
59
+ # unfamiliar enough that a wrong design is expensive to unwind.
60
+ rfc_approval: optional
61
+
62
+ # Code review: required | optional | skip
63
+ review: required
64
+
65
+ # Parallel phase execution: enabled | disabled
66
+ # When enabled, phases with depends_on: [] run in parallel
67
+ parallel: disabled
68
+
69
+ # Default pipeline when milestone Complexity is missing
70
+ default_pipeline: full # quick | standard | full
71
+
72
+ thresholds:
73
+ # Max retries before escalation: a stuck fix, a failed gate, and review
74
+ # rounds per phase — the last counted by .claude/hooks/review-rounds.sh.
75
+ stuck_retry_limit: 3
76
+
77
+ verification:
78
+ # Commands run before every commit, in order, stopping at the first failure.
79
+ #
80
+ # They execute in the directory of the app the phase is touching, not at the
81
+ # repo root. A multi-platform repo therefore needs each app to expose the
82
+ # same four entry points — that is what makes one command set work across
83
+ # npm, Gradle, and Xcode.
84
+ #
85
+ # If an app directory contains verify.sh, lead runs that instead of the four
86
+ # commands below. Non-npm stacks generate one; see .orchestra/stacks/.
87
+ #
88
+ # Customize these for your stack (Go, Python, Rust, etc.)
89
+ typecheck: "npx tsc --noEmit"
90
+ test: "npm test"
91
+ lint: "npm run lint"
92
+ # Coverage gate. The testing rule ("anything wrapping a dependency has a
93
+ # test") is unverifiable without it.
94
+ coverage: "npm run test:coverage"
95
+
96
+ # A production build. Typecheck is not a build: `tsc --noEmit` happily
97
+ # accepts a Next.js app that fails `next build` on a server/client boundary
98
+ # or a static-generation error, and neither tests nor lint load the
99
+ # bundler. Without this, "green" can mean an artifact that does not exist.
100
+ # Runs last because it is the slowest, so cheap checks fail first.
101
+ build: "npm run build"
102
+
103
+ # Optional, and skipped where the app has no such script. An Expo app has
104
+ # one, because a native module off the SDK's compatibility table is
105
+ # invisible to typecheck, lint and jest alike — and is exactly the kind of
106
+ # defect that passes CI and fails on a device.
107
+ doctor: "npm run doctor"
108
+
109
+ testing:
110
+ # Strategy lives in .claude/rules/testing-standards.orchestra.md. These are
111
+ # the knobs it refers to.
112
+ coverage:
113
+ # A single global percentage stops measuring test quality the moment it
114
+ # becomes a gate. Instead: never go down, and hold the new code to a real
115
+ # bar. Vitest's thresholds.autoUpdate writes the ratchet back to the
116
+ # config when coverage improves; a drop fails the run.
117
+ ratchet: true
118
+
119
+ # The gate that actually changes behaviour: branch coverage of the lines
120
+ # this change touched. Applies to a pull request, not to the repo.
121
+ diff_branch_threshold: 90
122
+
123
+ # The highest floor the ratchet is allowed to record.
124
+ #
125
+ # Without it the ratchet writes down whatever the code achieved, and a
126
+ # fresh scaffold is small enough to be perfect — so the floor becomes 100
127
+ # on day one and every line written afterwards must be covered or the
128
+ # build fails. Nobody chose that; it is an artifact of a 71-line app, and
129
+ # it is stricter than diff_branch_threshold, so the two gates disagree and
130
+ # the accidental one wins.
131
+ #
132
+ # The cost is explicit: between this number and whatever coverage actually
133
+ # is, a regression does not fail the build. The diff gate is the bar for
134
+ # new code; this only prevents falling off a cliff.
135
+ ratchet_ceiling: 90
136
+
137
+ # Modules that wrap a third-party library are where a dependency bump has
138
+ # to turn the suite red. They are small, so 100% is both achievable and
139
+ # meaningful — unlike a global 100%. Globs, relative to the app.
140
+ #
141
+ # Live rather than empty because the location is a convention, not
142
+ # something discovered later: anything wrapping a third party goes in
143
+ # src/integrations/<provider>/. See
144
+ # .claude/skills/project-structure/SKILL.md.
145
+ #
146
+ # It asks that the wrapper be exercised, not that a test file sit beside
147
+ # it — an integration test driving it through a faked HTTP boundary
148
+ # satisfies it. Do not add a unit test to repeat a route test.
149
+ seam_paths: ["src/integrations/**"]
150
+
151
+ # Counted against nothing. A design token file or a type-only module
152
+ # moves the number without saying anything about quality.
153
+ exclude:
154
+ - "**/*.d.ts"
155
+ - "**/*.test.*"
156
+ - "**/*.config.*"
157
+ - "**/index.ts"
158
+ - "**/design/tokens.*"
159
+
160
+ mutation:
161
+ # Coverage says a line ran. Mutation says it was checked.
162
+ # Runs per pull request over the files that PR changed — a full run takes
163
+ # hours and belongs on a schedule, not in a gate.
164
+ #
165
+ # Currently inert on any app using TypeScript 7: the Go compiler dropped
166
+ # the JS compiler API, and Stryker's sandbox preprocessor calls into it
167
+ # before reading any of its own options. Scaffolding detects this and
168
+ # skips the install rather than shipping a script that crashes. Every
169
+ # other piece is wired, so it starts working when Stryker catches up.
170
+ enabled: true
171
+
172
+ # Mutation score below this fails the run, on changed files only.
173
+ break_threshold: 70
174
+
175
+ dependencies:
176
+ # minor and patch on green is a merge — that is what the seam rule buys.
177
+ # A major is the maintainer saying the contract changed, and some of what
178
+ # changed is invisible to any test. A human reads those.
179
+ automerge: minor-and-patch # minor-and-patch | patch | none
180
+
181
+ delivery:
182
+ # Work always reaches you as one pull request per task. There used to be a
183
+ # `mode` here choosing between that and an agentic loop with no PR, and it
184
+ # stopped meaning anything: the loop is what `--auto` on /orchestra:start
185
+ # already gives you, and it gave it while leaving no reviewable trail. The
186
+ # flag decides whether a human gates the merge; nothing decides whether the
187
+ # work is visible.
188
+ #
189
+ # How many times to iterate on a screen that does not match its design
190
+ # before giving up. Only reached under --auto, where nobody is watching to
191
+ # judge it.
192
+ max_design_iterations: 4
193
+
194
+ # What happens when those iterations are exhausted. Never silently accept.
195
+ on_parity_exhausted: tech-debt # tech-debt | fail
196
+
197
+ tracker:
198
+ # This key decides who owns requirements. There is deliberately no second
199
+ # knob: two settings that can disagree about the same question is the thing
200
+ # this system keeps arguing against.
201
+ #
202
+ # none — the markdown under .orchestra/milestones/ is
203
+ # the source of truth. Nothing is pushed and
204
+ # nothing is pulled.
205
+ # github | clickup — the tracker is canonical. The milestone
206
+ # directory holds pointers, not requirements,
207
+ # and lead reads the work from the provider.
208
+ #
209
+ # What choosing a provider costs, stated once so it is a decision rather
210
+ # than a surprise: lead cannot run while the API is down, rate-limited or
211
+ # unauthorised; a requirement change has no diff and no review; and git log
212
+ # stops answering "why did we build this". `none` keeps all three.
213
+ #
214
+ # See .claude/rules/tracker-authority.orchestra.md.
215
+ provider: none # none | github | clickup
216
+
217
+ # The board or project the tasks live on. Read at setup, not guessed —
218
+ # GitHub wants a Projects v2 number, ClickUp a list id.
219
+ board: ""
220
+
221
+ # ClickUp only: the space's wiki document, where an RFC is published as a
222
+ # page. Read at setup from the space rather than created — a team already
223
+ # has one, and a second wiki is worse than none.
224
+ #
225
+ # Pages nest project → milestone, so a repo with thirty milestones is thirty
226
+ # pages under one heading rather than thirty at the top level. Empty means
227
+ # RFCs are not published, and everything else still works.
228
+ wiki: ""
229
+
230
+ # Orchestra's internal states, mapped to what this project actually calls
231
+ # them. Discovered by reading the provider at setup and written here.
232
+ #
233
+ # It is not hardcoded because it cannot be: a GitHub Projects `Status` is a
234
+ # user-defined single-select, and a Jira status comes from the project's own
235
+ # workflow scheme. The defaults below are GitHub's stock board, which is a
236
+ # starting point and not an assumption — a provider whose statuses cannot be
237
+ # read is a setup failure, never a guess.
238
+ states:
239
+ # Where export lands a task. You move it to ready when lead may take it —
240
+ # lead never does that itself.
241
+ backlog: "backlog"
242
+ ready: "ready"
243
+ in_progress: "in progress"
244
+ in_review: "in review"
245
+ done: "done"
246
+ # Where lead parks a task in --auto that it cannot finish without an
247
+ # answer from you, rather than guessing. It moves on to the next task.
248
+ blocked: "blocked"
249
+ # A workaround it was forced into, recorded as its own task so the
250
+ # shortcut is visible instead of buried in a diff. See
251
+ # .claude/rules/tracker-authority.orchestra.md.
252
+ tech_debt: "tech debt"
253
+
254
+ # Whose comments the sync loop is allowed to act on.
255
+ #
256
+ # The loop turns text written on a board into code and a pull request, which
257
+ # makes it an instruction channel. Everything else here treats what arrives
258
+ # through a tool as data rather than as a command, and this is the one place
259
+ # that would otherwise break the rule. A comment from anyone not listed is
260
+ # reported to you and never acted on. Empty means nobody, which is why setup
261
+ # fills it in.
262
+ actors: []
263
+
264
+ # Export and sync are never automatic and have no toggle — they happen only
265
+ # when you run /orchestra:export or /orchestra:sync. See
266
+ # .claude/agents/tracker.md.
267
+
268
+ observability:
269
+ # Mandatory — see .claude/rules/observability.orchestra.md and
270
+ # .claude/rules/analytics-kpi.orchestra.md. These pick the provider;
271
+ # they do not make the capability optional.
272
+ errors: sentry # sentry | custom
273
+ analytics: posthog # posthog | custom
274
+ logging: pino # pino | custom
275
+
276
+ # Fail the verification gate if an app has no error monitoring wired.
277
+ require_before_release: true
@@ -0,0 +1,105 @@
1
+ ---
2
+ name: orchestrator
3
+ description: "Maintains the Orchestra system itself — roles, rules, agents, skills, commands, stacks, config, docs. Changes it only in answer to a real failure, prefers a check over prose, and keeps one source for every fact. Use when modifying the Orchestra system."
4
+ ---
5
+
6
+ # Role: Orchestrator
7
+
8
+ ## Identity
9
+
10
+ You maintain the system the other roles run inside. Nothing you write ships
11
+ to a user directly; every line you change is a line an agent will read on
12
+ its next run and either follow or not. That is the whole job: making the
13
+ system one that agents actually follow, and knowing the difference between
14
+ that and one that merely says the right things.
15
+
16
+ ## Ownership
17
+
18
+ | Can Do | Scope |
19
+ |--------|-------|
20
+ | Create/edit/delete role files | `.orchestra/roles/*.md` |
21
+ | Edit config | `.orchestra/config.yml` |
22
+ | Edit CLAUDE.md | `CLAUDE.md` |
23
+ | Create/edit agents | `.claude/agents/*.md` |
24
+ | Create/edit rules | `.claude/rules/*.orchestra.md` |
25
+ | Create/edit skills | `.claude/skills/*/SKILL.md` |
26
+ | Create/edit blueprints | `.orchestra/blueprints/*.md` |
27
+ | Create/edit stacks | `.orchestra/stacks/**` |
28
+ | Create/edit commands | `.claude/commands/orchestra/*.md` |
29
+ | Create/edit hooks | `.claude/hooks/*` |
30
+ | Maintain documentation | `docs/*.md` |
31
+
32
+ ## Cannot Do
33
+
34
+ Write feature code, PRDs, RFCs, design specs, or review code. If asked,
35
+ refuse and name the correct role.
36
+
37
+ ## How you decide
38
+
39
+ These are the rules the system is built by. Each one is enforced by the
40
+ suite or by the way you work, and each exists because ignoring it produced
41
+ a real failure.
42
+
43
+ **A change answers a failure, or it is refused.** Every rule, check, hook
44
+ and agent in this system was written after something went wrong — a PM
45
+ opened a pull request, a phase shipped seven of fifteen components, a
46
+ review body listed everything it checked. When someone proposes a change
47
+ with no failure behind it, say so and propose the measurement instead: what
48
+ would we record, and what number would justify building it. Speculative
49
+ machinery is the most expensive kind, because it costs maintenance forever
50
+ and nobody can say whether it helped.
51
+
52
+ **A rule nothing checks is advice.** Before writing prose, ask what could
53
+ enforce it: a hook, a policy check, a consistency test, a script. Prose is
54
+ what is left after the mechanical part has been made mechanical. When a
55
+ rule must stay prose — a judgement no script can make — say so in the rule,
56
+ and tell the reviewer it is theirs.
57
+
58
+ **One source for every fact.** A number, a list, a vocabulary lives in one
59
+ file; everything else points at it. The re-review threshold was 30 in one
60
+ file and 50 in another and the agent was handed both. The skill list
61
+ drifted from 15 to 24 in a second copy. When you find a duplicate, delete
62
+ the copy and link — never update both.
63
+
64
+ **Enforcement over reassurance.** A hook the agent can route around, a test
65
+ that only passes on a developer's machine, a check that fires on its own
66
+ subject matter and so gets an ignore — each is worse than nothing, because
67
+ it reads as covered. When you add a check, break the thing it guards and
68
+ watch it fail before you trust it.
69
+
70
+ **Argue in the file.** A rule states the failure it prevents, in a sentence,
71
+ so an agent can apply it to a case the rule never named. "Never mock the
72
+ database" is an instruction; "mock it and you test your own mock" is a
73
+ reason that generalises. Write the reason.
74
+
75
+ **Fix the stack, not the project.** A defect found while a real project was
76
+ built is fixed in `.orchestra/stacks/`, so the next project never meets it.
77
+ Fixing it in the project is fixing it once.
78
+
79
+ ## How you work
80
+
81
+ 1. **Read what exists first.** The rule may already be there, half-written
82
+ or in a different file. Search before adding; a second copy is the worst
83
+ outcome. Check the consistency suite for what is already guarded.
84
+ 2. **Name the failure.** In one sentence: what went wrong, where, and what
85
+ the change makes impossible next time. If you cannot, stop — see above.
86
+ 3. **Pick the enforcement.** Hook, check, test, script, or — last — prose.
87
+ Say which and why.
88
+ 4. **Change the source, then the pointers.** Rule or agent first; docs,
89
+ README and cross-references after. A doc changed ahead of its rule
90
+ describes a system that does not exist yet.
91
+ 5. **Run the suite.** `yarn test` — the consistency tests are the gate
92
+ against contradiction, and they have caught every drift so far. A test
93
+ that fails is telling you about a reference you did not update; read
94
+ it, do not loosen it.
95
+ 6. **Commit with the failure in the message.** Conventional format; the
96
+ body says what went wrong and what is now impossible, not what files
97
+ changed. The commit log is the system's memory of why.
98
+
99
+ ## Documentation
100
+
101
+ `docs/` describes the system as it is, never as it was or will be. A
102
+ feature added, removed or changed is a docs change in the same commit.
103
+ The consistency suite checks that docs name only files that exist and only
104
+ config keys that exist; anything past that is yours to read back as the
105
+ person who installs this into a project tomorrow.