pi-orchestrator-config 4.1.5

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 (175) hide show
  1. package/README.md +808 -0
  2. package/agents/api-documenter.md +32 -0
  3. package/agents/bash-expert.md +53 -0
  4. package/agents/code-reviewer-docs.md +145 -0
  5. package/agents/code-reviewer-guidelines.md +97 -0
  6. package/agents/code-reviewer-quality.md +142 -0
  7. package/agents/code-reviewer-security.md +107 -0
  8. package/agents/code-reviewer-spec.md +164 -0
  9. package/agents/debugger.md +63 -0
  10. package/agents/docker-expert.md +40 -0
  11. package/agents/docs-fetcher.md +48 -0
  12. package/agents/git-expert.md +63 -0
  13. package/agents/github-expert.md +83 -0
  14. package/agents/go-expert.md +62 -0
  15. package/agents/issue-reviewer-feasibility.md +60 -0
  16. package/agents/issue-reviewer-scope.md +63 -0
  17. package/agents/issue-reviewer-spec.md +77 -0
  18. package/agents/java-expert.md +31 -0
  19. package/agents/jenkins-expert.md +38 -0
  20. package/agents/kubernetes-expert.md +40 -0
  21. package/agents/planner.md +42 -0
  22. package/agents/python-expert.md +61 -0
  23. package/agents/reviewer.md +26 -0
  24. package/agents/scout.md +40 -0
  25. package/agents/security-auditor.md +254 -0
  26. package/agents/technical-documentation-writer.md +37 -0
  27. package/agents/test-automator.md +55 -0
  28. package/agents/test-runner.md +47 -0
  29. package/agents/ts-expert.md +23 -0
  30. package/agents/worker.md +30 -0
  31. package/extensions/acpx-provider/index.ts +104 -0
  32. package/extensions/acpx-provider/load-runtime.ts +99 -0
  33. package/extensions/acpx-provider/runtime-models.ts +40 -0
  34. package/extensions/cli-provider/agents/claude.ts +128 -0
  35. package/extensions/cli-provider/agents/cursor.ts +84 -0
  36. package/extensions/cli-provider/agents/gemini.ts +100 -0
  37. package/extensions/cli-provider/discover.ts +77 -0
  38. package/extensions/cli-provider/index.ts +57 -0
  39. package/extensions/cli-provider/parsers.ts +304 -0
  40. package/extensions/cli-provider/providers.ts +58 -0
  41. package/extensions/cli-provider/runner.ts +225 -0
  42. package/extensions/cli-provider/runtime-models.ts +32 -0
  43. package/extensions/cli-provider/session-reaper.ts +122 -0
  44. package/extensions/cli-provider/sessions.ts +533 -0
  45. package/extensions/cli-provider/shared/discover-cache.ts +235 -0
  46. package/extensions/cli-provider/types.ts +48 -0
  47. package/extensions/coms/coms-net-server.ts +1642 -0
  48. package/extensions/coms/coms-net-wrapper.ts +521 -0
  49. package/extensions/coms/coms-net.ts +1589 -0
  50. package/extensions/coms/coms-p2p.ts +1879 -0
  51. package/extensions/coms/coms-shared.ts +510 -0
  52. package/extensions/coms/coms-wrapper.ts +138 -0
  53. package/extensions/coms/index.ts +20 -0
  54. package/extensions/coms/themeMap.ts +147 -0
  55. package/extensions/image-gen/image-gen.ts +332 -0
  56. package/extensions/image-gen/index.ts +14 -0
  57. package/extensions/orchestrator/agents.ts +134 -0
  58. package/extensions/orchestrator/ask-user.ts +293 -0
  59. package/extensions/orchestrator/async-agents.ts +1037 -0
  60. package/extensions/orchestrator/async-capability.ts +129 -0
  61. package/extensions/orchestrator/async-runner.ts +324 -0
  62. package/extensions/orchestrator/async-status-parse.ts +31 -0
  63. package/extensions/orchestrator/async-status-ui.ts +201 -0
  64. package/extensions/orchestrator/async-wait.ts +36 -0
  65. package/extensions/orchestrator/btw.ts +210 -0
  66. package/extensions/orchestrator/cron-status-format.ts +126 -0
  67. package/extensions/orchestrator/cron-status-ui.ts +132 -0
  68. package/extensions/orchestrator/cron.ts +730 -0
  69. package/extensions/orchestrator/dreaming.ts +355 -0
  70. package/extensions/orchestrator/enforcement-helpers.ts +530 -0
  71. package/extensions/orchestrator/enforcement-rules.ts +329 -0
  72. package/extensions/orchestrator/enforcement.ts +828 -0
  73. package/extensions/orchestrator/extended-autocomplete.ts +593 -0
  74. package/extensions/orchestrator/git-helpers.ts +420 -0
  75. package/extensions/orchestrator/github-autocomplete.ts +250 -0
  76. package/extensions/orchestrator/icons.ts +17 -0
  77. package/extensions/orchestrator/index.ts +100 -0
  78. package/extensions/orchestrator/memory-embeddings.ts +281 -0
  79. package/extensions/orchestrator/memory-promotion.ts +449 -0
  80. package/extensions/orchestrator/memory-provenance.ts +80 -0
  81. package/extensions/orchestrator/memory-query-class.ts +90 -0
  82. package/extensions/orchestrator/memory-scoring.ts +434 -0
  83. package/extensions/orchestrator/memory-tools.ts +883 -0
  84. package/extensions/orchestrator/memory-tree.ts +212 -0
  85. package/extensions/orchestrator/nvim.ts +169 -0
  86. package/extensions/orchestrator/overlay-dashboard-utils.ts +25 -0
  87. package/extensions/orchestrator/overlay-dashboard.ts +512 -0
  88. package/extensions/orchestrator/pi-config-review-state.ts +303 -0
  89. package/extensions/orchestrator/preference-extractor.ts +106 -0
  90. package/extensions/orchestrator/project-settings.ts +468 -0
  91. package/extensions/orchestrator/promotion-queue.ts +311 -0
  92. package/extensions/orchestrator/resolve-agent-model.ts +32 -0
  93. package/extensions/orchestrator/review-ui.ts +204 -0
  94. package/extensions/orchestrator/rule-placeholders.ts +12 -0
  95. package/extensions/orchestrator/rules.ts +481 -0
  96. package/extensions/orchestrator/session-search.ts +243 -0
  97. package/extensions/orchestrator/session-validation.ts +374 -0
  98. package/extensions/orchestrator/situation-report.ts +370 -0
  99. package/extensions/orchestrator/status-bar.ts +31 -0
  100. package/extensions/orchestrator/status-line.ts +192 -0
  101. package/extensions/orchestrator/status.ts +110 -0
  102. package/extensions/orchestrator/subagent-tool.ts +1748 -0
  103. package/extensions/orchestrator/task-lifecycle.ts +88 -0
  104. package/extensions/orchestrator/utils.ts +227 -0
  105. package/extensions/pidash/index.ts +15 -0
  106. package/extensions/pidash/pidash.ts +941 -0
  107. package/extensions/pidiff/index.ts +13 -0
  108. package/extensions/pidiff/pidiff.ts +369 -0
  109. package/extensions/providers/acpx-driver.ts +479 -0
  110. package/extensions/providers/built-in-drivers.ts +52 -0
  111. package/extensions/providers/claude-driver.ts +319 -0
  112. package/extensions/providers/cursor-acpx-driver.ts +398 -0
  113. package/extensions/providers/cursor-cli-driver.ts +484 -0
  114. package/extensions/providers/gemini-driver.ts +302 -0
  115. package/extensions/providers/index.ts +513 -0
  116. package/extensions/shared/build-system-prompt.ts +57 -0
  117. package/extensions/shared/create-runtime-provider.ts +190 -0
  118. package/extensions/shared/daemon-manager.ts +248 -0
  119. package/extensions/shared/file-logger.ts +115 -0
  120. package/extensions/shared/managed-refresh.ts +211 -0
  121. package/extensions/shared/provider-driver.ts +295 -0
  122. package/extensions/shared/provider-errors.ts +305 -0
  123. package/extensions/shared/provider-registry.ts +388 -0
  124. package/extensions/shared/stream-builder.ts +275 -0
  125. package/extensions/shared/types.ts +20 -0
  126. package/extensions/shared/ui/README.md +10 -0
  127. package/extensions/shared/ui/badge.tsx +52 -0
  128. package/extensions/shared/ui/button.tsx +58 -0
  129. package/extensions/shared/ui/collapsible.tsx +21 -0
  130. package/extensions/shared/ui/dropdown-menu.tsx +266 -0
  131. package/extensions/shared/ui/input.tsx +20 -0
  132. package/extensions/shared/ui/popover.tsx +114 -0
  133. package/extensions/shared/ui/resizable.tsx +48 -0
  134. package/extensions/shared/ui/scroll-area.tsx +53 -0
  135. package/extensions/shared/ui/select.tsx +201 -0
  136. package/extensions/shared/ui/separator.tsx +25 -0
  137. package/extensions/shared/ui/tooltip.tsx +64 -0
  138. package/extensions/shared/ws-client.ts +74 -0
  139. package/package.json +59 -0
  140. package/prompts/coderabbit-rate-limit.md +95 -0
  141. package/prompts/create-coms-feature-manager.md +186 -0
  142. package/prompts/create-skill.md +128 -0
  143. package/prompts/domain-model.md +109 -0
  144. package/prompts/external-ai.md +665 -0
  145. package/prompts/implement-and-review.md +25 -0
  146. package/prompts/implement.md +26 -0
  147. package/prompts/issue-review.md +256 -0
  148. package/prompts/pr-review.md +753 -0
  149. package/prompts/query-db.md +154 -0
  150. package/prompts/refine-review.md +208 -0
  151. package/prompts/release.md +235 -0
  152. package/prompts/remember.md +33 -0
  153. package/prompts/review-handler-status.md +27 -0
  154. package/prompts/review-handler.md +677 -0
  155. package/prompts/review-local.md +159 -0
  156. package/prompts/scout-and-plan.md +21 -0
  157. package/rules/00-orchestrator-core.md +42 -0
  158. package/rules/05-issue-first-workflow.md +119 -0
  159. package/rules/10-agent-routing.md +58 -0
  160. package/rules/15-mcp-launchpad.md +46 -0
  161. package/rules/20-code-review-loop.md +234 -0
  162. package/rules/25-documentation-updates.md +15 -0
  163. package/rules/30-prompt-templates.md +19 -0
  164. package/rules/35-memory.md +240 -0
  165. package/rules/40-critical-rules.md +124 -0
  166. package/rules/45-file-preview.md +29 -0
  167. package/rules/50-agent-bug-reporting.md +90 -0
  168. package/rules/55-coms-protocol.md +63 -0
  169. package/rules/60-task-tracking.md +66 -0
  170. package/skills/conflict-resolver/SKILL.md +213 -0
  171. package/skills/skill-creator/SKILL.md +85 -0
  172. package/skills/systematic-debugging/SKILL.md +353 -0
  173. package/skills/test-driven-development/SKILL.md +335 -0
  174. package/skills/update-agents-md/SKILL.md +282 -0
  175. package/templates/coms-feature-manager-prompt.md +313 -0
@@ -0,0 +1,335 @@
1
+ ---
2
+ name: test-driven-development
3
+ description: "TDD: enforce RED-GREEN-REFACTOR, tests before code."
4
+ ---
5
+
6
+ # Test-Driven Development (TDD)
7
+
8
+ ## Overview
9
+
10
+ Write the test first. Watch it fail. Write minimal code to pass.
11
+
12
+ **Core principle:** If you didn't watch the test fail, you don't know if it tests the right thing.
13
+
14
+ **Violating the letter of the rules is violating the spirit of the rules.**
15
+
16
+ ## When to Use
17
+
18
+ **Always:**
19
+
20
+ - New features
21
+ - Bug fixes
22
+ - Refactoring
23
+ - Behavior changes
24
+
25
+ **Exceptions (ask the user first):**
26
+
27
+ - Throwaway prototypes
28
+ - Generated code
29
+ - Configuration files
30
+
31
+ Thinking "skip TDD just this once"? Stop. That's rationalization.
32
+
33
+ ## The Iron Law
34
+
35
+ ```text
36
+ NO PRODUCTION CODE WITHOUT A FAILING TEST FIRST
37
+ ```
38
+
39
+ Write code before the test? Delete it. Start over.
40
+
41
+ **No exceptions:**
42
+
43
+ - Don't keep it as "reference"
44
+ - Don't "adapt" it while writing tests
45
+ - Don't look at it
46
+ - Delete means delete
47
+
48
+ Implement fresh from tests. Period.
49
+
50
+ ## Red-Green-Refactor Cycle
51
+
52
+ ### RED — Write Failing Test
53
+
54
+ Write one minimal test showing what should happen.
55
+
56
+ **Good test:**
57
+
58
+ ```python
59
+ def test_retries_failed_operations_3_times():
60
+ attempts = 0
61
+ def operation():
62
+ nonlocal attempts
63
+ attempts += 1
64
+ if attempts < 3:
65
+ raise Exception('fail')
66
+ return 'success'
67
+
68
+ result = retry_operation(operation)
69
+
70
+ assert result == 'success'
71
+ assert attempts == 3
72
+ ```
73
+
74
+ Clear name, tests real behavior, one thing.
75
+
76
+ **Bad test:**
77
+
78
+ ```python
79
+ def test_retry_works():
80
+ mock = MagicMock()
81
+ mock.side_effect = [Exception(), Exception(), 'success']
82
+ result = retry_operation(mock)
83
+ assert result == 'success' # What about retry count? Timing?
84
+ ```
85
+
86
+ Vague name, tests mock not real code.
87
+
88
+ **Requirements:**
89
+
90
+ - One behavior per test
91
+ - Clear descriptive name ("and" in name? Split it)
92
+ - Real code, not mocks (unless truly unavoidable)
93
+ - Name describes behavior, not implementation
94
+
95
+ ### Verify RED — Watch It Fail
96
+
97
+ **MANDATORY. Never skip.**
98
+
99
+ ```bash
100
+ # Run the specific test
101
+ uv run pytest tests/test_feature.py::test_specific_behavior -v
102
+ ```
103
+
104
+ Confirm:
105
+
106
+ - Test fails (not errors from typos)
107
+ - Failure message is expected
108
+ - Fails because the feature is missing
109
+
110
+ **Test passes immediately?** You're testing existing behavior. Fix the test.
111
+
112
+ **Test errors?** Fix the error, re-run until it fails correctly.
113
+
114
+ ### GREEN — Minimal Code
115
+
116
+ Write the simplest code to pass the test. Nothing more.
117
+
118
+ **Good:**
119
+
120
+ ```python
121
+ def add(a, b):
122
+ return a + b # Nothing extra
123
+ ```
124
+
125
+ **Bad:**
126
+
127
+ ```python
128
+ def add(a, b):
129
+ result = a + b
130
+ logging.info(f"Adding {a} + {b} = {result}") # Extra!
131
+ return result
132
+ ```
133
+
134
+ Don't add features, refactor other code, or "improve" beyond the test.
135
+
136
+ **Cheating is OK in GREEN:**
137
+
138
+ - Hardcode return values
139
+ - Copy-paste
140
+ - Duplicate code
141
+ - Skip edge cases
142
+
143
+ We'll fix it in REFACTOR.
144
+
145
+ ### Verify GREEN — Watch It Pass
146
+
147
+ **MANDATORY.**
148
+
149
+ ```bash
150
+ # Run the specific test
151
+ uv run pytest tests/test_feature.py::test_specific_behavior -v
152
+
153
+ # Then run ALL tests to check for regressions
154
+ uv run pytest tests/ -q
155
+ ```
156
+
157
+ Confirm:
158
+
159
+ - Test passes
160
+ - Other tests still pass
161
+ - Output pristine (no errors, warnings)
162
+
163
+ **Test fails?** Fix the code, not the test.
164
+
165
+ **Other tests fail?** Fix regressions now.
166
+
167
+ ### REFACTOR — Clean Up
168
+
169
+ After green only:
170
+
171
+ - Remove duplication
172
+ - Improve names
173
+ - Extract helpers
174
+ - Simplify expressions
175
+
176
+ Keep tests green throughout. Don't add behavior.
177
+
178
+ **If tests fail during refactor:** Undo immediately. Take smaller steps.
179
+
180
+ ### Repeat
181
+
182
+ Next failing test for next behavior. One cycle at a time.
183
+
184
+ ## Why Order Matters
185
+
186
+ ### "I'll write tests after to verify it works"
187
+
188
+ Tests written after code pass immediately. Passing immediately proves nothing:
189
+
190
+ - Might test the wrong thing
191
+ - Might test implementation, not behavior
192
+ - Might miss edge cases you forgot
193
+ - You never saw it catch the bug
194
+
195
+ Test-first forces you to see the test fail, proving it actually tests something.
196
+
197
+ ### "I already manually tested all the edge cases"
198
+
199
+ Manual testing is ad-hoc. You think you tested everything but:
200
+
201
+ - No record of what you tested
202
+ - Can't re-run when code changes
203
+ - Easy to forget cases under pressure
204
+ - "It worked when I tried it" ≠ comprehensive
205
+
206
+ Automated tests are systematic. They run the same way every time.
207
+
208
+ ### "Deleting X hours of work is wasteful"
209
+
210
+ Sunk cost fallacy. The time is already gone. Your choice now:
211
+
212
+ - Delete and rewrite with TDD (high confidence)
213
+ - Keep it and add tests after (low confidence, likely bugs)
214
+
215
+ The "waste" is keeping code you can't trust.
216
+
217
+ ### "TDD is dogmatic, being pragmatic means adapting"
218
+
219
+ TDD IS pragmatic:
220
+
221
+ - Finds bugs before commit (faster than debugging after)
222
+ - Prevents regressions (tests catch breaks immediately)
223
+ - Documents behavior (tests show how to use code)
224
+ - Enables refactoring (change freely, tests catch breaks)
225
+
226
+ "Pragmatic" shortcuts = debugging in production = slower.
227
+
228
+ ### "Tests after achieve the same goals — it's spirit not ritual"
229
+
230
+ No. Tests-after answer "What does this do?" Tests-first answer "What should this do?"
231
+
232
+ Tests-after are biased by your implementation. You test what you built, not what's required. Tests-first force edge case discovery before implementing.
233
+
234
+ ## Common Rationalizations
235
+
236
+ | Excuse | Reality |
237
+ | ------ | ------- |
238
+ | "Too simple to test" | Simple code breaks. Test takes 30 seconds. |
239
+ | "I'll test after" | Tests passing immediately prove nothing. |
240
+ | "Tests after achieve same goals" | Tests-after = "what does this do?" Tests-first = "what should this do?" |
241
+ | "Already manually tested" | Ad-hoc ≠ systematic. No record, can't re-run. |
242
+ | "Deleting X hours is wasteful" | Sunk cost fallacy. Keeping unverified code is technical debt. |
243
+ | "Keep as reference, write tests first" | You'll adapt it. That's testing after. Delete means delete. |
244
+ | "Need to explore first" | Fine. Throw away exploration, start with TDD. |
245
+ | "Test hard = design unclear" | Listen to the test. Hard to test = hard to use. |
246
+ | "TDD will slow me down" | TDD faster than debugging. Pragmatic = test-first. |
247
+ | "Manual test faster" | Manual doesn't prove edge cases. You'll re-test every change. |
248
+ | "Existing code has no tests" | You're improving it. Add tests for the code you touch. |
249
+
250
+ ## Red Flags — STOP and Start Over
251
+
252
+ If you catch yourself doing any of these, delete the code and restart with TDD:
253
+
254
+ - Code before test
255
+ - Test after implementation
256
+ - Test passes immediately on first run
257
+ - Can't explain why test failed
258
+ - Tests added "later"
259
+ - Rationalizing "just this once"
260
+ - "I already manually tested it"
261
+ - "Tests after achieve the same purpose"
262
+ - "Keep as reference" or "adapt existing code"
263
+ - "Already spent X hours, deleting is wasteful"
264
+ - "TDD is dogmatic, I'm being pragmatic"
265
+ - "This is different because..."
266
+
267
+ **All of these mean: Delete code. Start over with TDD.**
268
+
269
+ ## Verification Checklist
270
+
271
+ Before marking work complete:
272
+
273
+ - [ ] Every new function/method has a test
274
+ - [ ] Watched each test fail before implementing
275
+ - [ ] Each test failed for expected reason (feature missing, not typo)
276
+ - [ ] Wrote minimal code to pass each test
277
+ - [ ] All tests pass
278
+ - [ ] Output pristine (no errors, warnings)
279
+ - [ ] Tests use real code (mocks only if unavoidable)
280
+ - [ ] Edge cases and errors covered
281
+
282
+ Can't check all boxes? You skipped TDD. Start over.
283
+
284
+ ## When Stuck
285
+
286
+ | Problem | Solution |
287
+ | ------- | -------- |
288
+ | Don't know how to test | Write the wished-for API. Write the assertion first. Ask the user. |
289
+ | Test too complicated | Design too complicated. Simplify the interface. |
290
+ | Must mock everything | Code too coupled. Use dependency injection. |
291
+ | Test setup huge | Extract helpers. Still complex? Simplify the design. |
292
+
293
+ ## Pi Agent Integration
294
+
295
+ ### Running Tests
296
+
297
+ Use `bash` to run tests at each step:
298
+
299
+ ```bash
300
+ # RED: Run the failing test
301
+ uv run pytest tests/test_feature.py::test_name -v
302
+
303
+ # GREEN: Run after implementing
304
+ uv run pytest tests/test_feature.py::test_name -v
305
+
306
+ # Full suite: Check for regressions
307
+ uv run pytest tests/ -q
308
+ ```
309
+
310
+ ### With subagent
311
+
312
+ The test-automator agent follows TDD discipline.
313
+ The orchestrator delegates test creation and verification to this agent.
314
+
315
+ ### With systematic-debugging
316
+
317
+ Bug found? Write failing test reproducing it. Follow TDD cycle. The test proves the fix and prevents regression.
318
+
319
+ Never fix bugs without a test.
320
+
321
+ ## Testing Anti-Patterns
322
+
323
+ - **Testing mock behavior instead of real behavior** — mocks should verify interactions, not replace the system under test
324
+ - **Testing implementation details** — test behavior/results, not internal method calls
325
+ - **Happy path only** — always test edge cases, errors, and boundaries
326
+ - **Brittle tests** — tests should verify behavior, not structure; refactoring shouldn't break them
327
+
328
+ ## Final Rule
329
+
330
+ ```text
331
+ Production code → test exists and failed first
332
+ Otherwise → not TDD
333
+ ```
334
+
335
+ No exceptions without the user's explicit permission.
@@ -0,0 +1,282 @@
1
+ ---
2
+ name: update-agents-md
3
+ description: "Create or update AGENTS.md / CLAUDE.md using industry best practices. Use when the user asks to create AGENTS.md, update project documentation, or after code changes that need documentation updates."
4
+ ---
5
+
6
+ # AGENTS.md Best Practice Guide
7
+
8
+ Research-backed guide for creating and updating AGENTS.md files.
9
+ Sources: GitHub (2,500-repo analysis), Augment Code (measured eval), Blake Crosley (pattern analysis), agents.md spec.
10
+
11
+ ---
12
+
13
+ ## Mode: Creating New AGENTS.md
14
+
15
+ 1. Scan the repo — identify tech stack, build system, test framework, file structure
16
+ - For monorepos, use subdirectory AGENTS.md files scoped to each package — don't put everything in one root file.
17
+ 2. Use the **Template** below as starting skeleton
18
+ 3. Fill in all **Required Sections** in order
19
+ 4. Verify total is under 150 lines (longer files hurt performance)
20
+ 5. Move detailed content to referenced files if needed
21
+
22
+ ## Mode: Updating Existing AGENTS.md
23
+
24
+ 1. Read the entire current file first
25
+ 2. Run the **Audit Checklist** below
26
+ 3. Fix gaps in priority order — don't rewrite what already works
27
+ 4. Verify size stays under 150 lines after changes
28
+
29
+ ## Mode: Post-Code-Change Update
30
+
31
+ 1. Check if the change affects: commands, file structure, dependencies, workflows
32
+ 2. Update only the affected sections — don't touch unrelated content
33
+ 3. Verify commands in the file still work
34
+
35
+ ---
36
+
37
+ ## Required Sections (in this order)
38
+
39
+ Order matters — front-load highest-ROI content. Commands FIRST.
40
+
41
+ ### 1. Build & Test Commands (HIGHEST ROI)
42
+
43
+ ```markdown
44
+ ## Commands
45
+ - Build: `<build command>`
46
+ - Test: `<test command with flags>`
47
+ - Lint: `<lint command with flags>`
48
+ - Type check: `<type check command>`
49
+ - Full verify: `<lint command> && <test command> && <type check command>`
50
+ ```
51
+
52
+ Rules:
53
+
54
+ - Exact invocations with flags — not just tool names
55
+ - Include the "full verify" one-liner the agent runs before committing
56
+ - Every instruction in the file should answer: "What command proves this was done?"
57
+
58
+ ### 2. Definition of Done
59
+
60
+ ```markdown
61
+ ## Definition of Done
62
+ A task is complete when ALL pass:
63
+ 1. `<lint command>` exits 0
64
+ 2. `<test command>` exits 0 with no failures
65
+ 3. `<type check command>` exits 0
66
+ 4. Changed files staged and committed
67
+ 5. Commit message: `type(scope): description`
68
+ ```
69
+
70
+ Rules:
71
+
72
+ - Specific exit codes, not feelings
73
+ - Without this, "done" means "I think I'm done" — the #1 agent failure mode
74
+
75
+ ### 3. Escalation Rules
76
+
77
+ ```markdown
78
+ ## When Blocked
79
+ - Tests fail after 3 attempts → stop, report failing test with full output
80
+ - Missing dependency → check requirements first, then ask
81
+ - Merge conflicts → stop, show conflicting files
82
+ - NEVER: delete files to resolve errors, force push, skip tests
83
+ ```
84
+
85
+ Rules:
86
+
87
+ - Without escalation rules, agents improvise destructively when blocked
88
+ - Pair every "never" with what to do instead
89
+
90
+ ### 4. Project Context
91
+
92
+ ```markdown
93
+ ## Project
94
+ - Stack: <technology with version>, <technology with version>, <build tool>
95
+ - Structure: `src/` (app code), `tests/` (tests), `docs/` (documentation)
96
+ - Key deps: <dependency> for <purpose>, <dependency> for <purpose>
97
+ ```
98
+
99
+ Rules:
100
+
101
+ - Specific versions and key dependencies
102
+ - Vague descriptions ("React project") are useless — include versions and key deps
103
+ - File structure with one-line descriptions
104
+
105
+ ### 5. Task-Organized Sections
106
+
107
+ ```markdown
108
+ ## When Writing Code
109
+ - Run `<lint command>` after every file change
110
+ - Add type hints to all new functions
111
+ - Test: `<test command for specific module>`
112
+
113
+ ## When Reviewing Code
114
+ - Check security: `<security audit command>`
115
+ - Verify coverage: `<test command with coverage flag>`
116
+
117
+ ## When Releasing
118
+ - Update version in `<manifest file>`
119
+ - Run full suite: `<test command> && <lint command> && <type check command>`
120
+ - Tag: `git tag -a v<version> -m "Release v<version>"`
121
+ ```
122
+
123
+ Rules:
124
+
125
+ - "When X" sections let agents select relevant instructions by task context
126
+ - Flat topic lists force parsing everything regardless of current task
127
+ - Task-organized > topic-organized
128
+
129
+ ### 6. Boundaries
130
+
131
+ ```markdown
132
+ ## Boundaries
133
+ - ✅ Always: run tests before commits, follow naming conventions
134
+ - ⚠️ Ask first: database schema changes, adding dependencies, modifying CI
135
+ - 🚫 Never: commit secrets, edit dependency dirs, force push to main
136
+ ```
137
+
138
+ Rules:
139
+
140
+ - Three tiers: always do, ask first, never do
141
+ - Pair every "don't" with a "do" — warning-only docs consistently underperform
142
+ - 15+ sequential "don'ts" without "dos" cause agent overexploration
143
+
144
+ ---
145
+
146
+ ## Size Budget (for generated AGENTS.md files)
147
+
148
+ These limits apply to the AGENTS.md files you CREATE, not to this skill guide.
149
+
150
+ | Metric | Target | Why |
151
+ |--------|--------|-----|
152
+ | Total file | Under 150 lines | Longer files actively hurt (Augment, measured) |
153
+ | Per section | Under 50 lines | Context window truncation risk |
154
+ | Reference files | 3-10 max | Agent reads 90%+ when referenced from AGENTS.md |
155
+
156
+ **Progressive disclosure:** Keep main file concise. Push details to referenced files:
157
+
158
+ ```markdown
159
+ For detailed API conventions, see `docs/api-conventions.md`.
160
+ For migration procedures, see `docs/migrations.md`.
161
+ ```
162
+
163
+ **Warning:** A 150-line AGENTS.md on top of 500K of surrounding docs won't save the agent from the docs. Fix the documentation environment, not just the entry point.
164
+
165
+ ---
166
+
167
+ ## Decision Table
168
+
169
+ When the agent needs to choose what patterns to include:
170
+
171
+ | If you want to improve... | Use this pattern |
172
+ |--------------------------|-----------------|
173
+ | Reuse of existing code | 3-10 line examples from actual prod code |
174
+ | Following codebase conventions | Decision tables for ambiguous choices |
175
+ | Wiring of complex features | Numbered procedural workflows |
176
+ | Handling of gotchas | "Don't X" paired with "Do Y instead" |
177
+ | Reducing context rot | Progressive disclosure via reference files |
178
+
179
+ ---
180
+
181
+ ## Anti-Patterns (NEVER do these)
182
+
183
+ | Anti-Pattern | Why it fails | Fix |
184
+ |-------------|-------------|-----|
185
+ | Prose paragraphs without commands | Agent can't verify compliance | Add the command that proves it |
186
+ | "Be careful with X" | Not a constraint — no trigger, no action | "Run `cmd` before X. Abort if Y." |
187
+ | Contradictory priorities without ordering | Agent skips verification, rushes to code | Number priorities: P1 > P2 > P3 |
188
+ | Style guide without enforcement command | No verification mechanism | Add the lint command that enforces it |
189
+ | 15+ "don'ts" without "dos" | Agent overexplores, stays conservative | See Boundaries rules above |
190
+ | Architecture overview essays | Agent reads 100K+ tokens of docs | Keep to 2-3 sentences, reference files for details |
191
+
192
+ ---
193
+
194
+ ## Writing Style Rules
195
+
196
+ - Fewer lines = more compliance. One sentence per concept.
197
+ - Reserve MANDATORY/NEVER/FORBIDDEN for data loss, security, or irreversible actions. When everything is critical, nothing stands out.
198
+ - Use precise language — ambiguous rules get exploited. Scope restrictions clearly (e.g., 'Outside slash commands, never use bash' not 'never use bash').
199
+ - One ❌/✅ example per section only when it shows a specific recurring mistake.
200
+ - Merge sub-sections that say the same thing from different angles.
201
+ - Numbered checklists over ASCII flowcharts — fewer tokens, easier to follow.
202
+ - Match the project's existing format — read the file before editing.
203
+
204
+ ---
205
+
206
+ ## Cross-Tool Compatibility
207
+
208
+ | Tool | Native file | Reads AGENTS.md? |
209
+ |------|------------|-------------------|
210
+ | Codex CLI | AGENTS.md | Yes (native) |
211
+ | Cursor | `.cursor/rules` | Yes (native) |
212
+ | GitHub Copilot | `.github/copilot-instructions.md` | Yes (native) |
213
+ | Claude Code | CLAUDE.md | Yes (native + CLAUDE.md) |
214
+ | Gemini CLI | GEMINI.md | Configurable |
215
+ | Windsurf | `.windsurfrules` | Yes (native) |
216
+
217
+ **Strategy:** Write AGENTS.md as canonical source. Claude Code reads both AGENTS.md and CLAUDE.md natively — use CLAUDE.md for Claude-specific overrides only.
218
+
219
+ ---
220
+
221
+ ## Template
222
+
223
+ ````markdown
224
+ # Project Name
225
+
226
+ Brief one-line description of the project.
227
+
228
+ ## Commands
229
+ - Build: `<build command>`
230
+ - Test: `<test command with flags>`
231
+ - Lint: `<lint command>`
232
+ - Full verify: `<all-in-one verification command>`
233
+
234
+ ## Definition of Done
235
+ A task is complete when ALL pass:
236
+ 1. `<lint>` exits 0
237
+ 2. `<test>` exits 0
238
+ 3. `<type check>` exits 0
239
+ 4. Files committed with message: `type(scope): description`
240
+
241
+ ## When Blocked
242
+ - Tests fail after 3 attempts → stop, report with full output
243
+ - Missing dependency → check manifest first, then ask
244
+ - NEVER: delete files to fix errors, force push, skip tests
245
+
246
+ ## Project
247
+ - Stack: <technologies with versions>
248
+ - Structure: `src/` (code), `tests/` (tests), `docs/` (docs)
249
+
250
+ ## When Writing Code
251
+ - <key convention 1>
252
+ - <key convention 2>
253
+ - Test: `<how to run relevant tests>`
254
+
255
+ ## When Reviewing Code
256
+ - <review checklist item 1>
257
+ - <review checklist item 2>
258
+
259
+ ## Boundaries
260
+ - ✅ Always: <what to always do>
261
+ - ⚠️ Ask first: <what needs approval>
262
+ - 🚫 Never: <what to never do>
263
+ ````
264
+
265
+ ---
266
+
267
+ ## Audit Checklist (for updating existing files)
268
+
269
+ Run through when reviewing an existing AGENTS.md:
270
+
271
+ - [ ] Commands section exists and comes FIRST (before any prose)?
272
+ - [ ] All commands are exact invocations with flags (not just tool names)?
273
+ - [ ] Definition of Done section with specific exit codes?
274
+ - [ ] Escalation rules — what to do when blocked?
275
+ - [ ] Total file under 150 lines?
276
+ - [ ] Each section under 50 lines?
277
+ - [ ] Organized by task ("When X") not by topic?
278
+ - [ ] Every "don't" paired with a "do"?
279
+ - [ ] No prose paragraphs without commands?
280
+ - [ ] No ambiguous directives ("be careful", "where possible")?
281
+ - [ ] No contradictory priorities without explicit ordering?
282
+ - [ ] Detailed content in referenced files, not inline?