@llblab/pi-kit 0.3.1 → 0.4.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 (123) hide show
  1. package/AGENTS.md +3 -3
  2. package/BACKLOG.md +1 -1
  3. package/CHANGELOG.md +10 -0
  4. package/README.md +19 -10
  5. package/node_modules/@llblab/pi-actors/AGENTS.md +1 -0
  6. package/node_modules/@llblab/pi-actors/CHANGELOG.md +6 -0
  7. package/node_modules/@llblab/pi-actors/dist/skills/actors/SKILL.md +16 -6
  8. package/node_modules/@llblab/pi-actors/dist/skills/music-player/SKILL.md +3 -3
  9. package/node_modules/@llblab/pi-actors/dist/skills/music-player/genapps/music-player.mjs +6 -4
  10. package/node_modules/@llblab/pi-actors/dist/skills/music-player/scripts/playback.mjs +85 -18
  11. package/node_modules/@llblab/pi-actors/dist/skills/swarm/SKILL.md +2 -6
  12. package/node_modules/@llblab/pi-actors/dist/skills/swarm/references/development-swarm.md +2 -31
  13. package/node_modules/@llblab/pi-actors/docs/recipe-library.md +1 -1
  14. package/node_modules/@llblab/pi-actors/package.json +1 -1
  15. package/node_modules/@llblab/pi-actors/skills/actors/SKILL.md +16 -6
  16. package/node_modules/@llblab/pi-actors/skills/music-player/SKILL.md +3 -3
  17. package/node_modules/@llblab/pi-actors/skills/music-player/genapps/music-player.mjs +6 -4
  18. package/node_modules/@llblab/pi-actors/skills/music-player/scripts/playback.mjs +85 -18
  19. package/node_modules/@llblab/pi-actors/skills/swarm/SKILL.md +2 -6
  20. package/node_modules/@llblab/pi-actors/skills/swarm/references/development-swarm.md +2 -31
  21. package/node_modules/@llblab/pi-clean-room/AGENTS.md +5 -0
  22. package/node_modules/@llblab/pi-clean-room/BACKLOG.md +3 -0
  23. package/node_modules/@llblab/pi-clean-room/CHANGELOG.md +15 -0
  24. package/node_modules/@llblab/pi-clean-room/README.md +61 -0
  25. package/node_modules/@llblab/pi-clean-room/banner.jpg +0 -0
  26. package/node_modules/@llblab/pi-clean-room/index.ts +178 -0
  27. package/node_modules/@llblab/pi-clean-room/package.json +53 -0
  28. package/node_modules/@llblab/pi-grow-loop/AGENTS.md +1 -1
  29. package/node_modules/@llblab/pi-grow-loop/CHANGELOG.md +4 -0
  30. package/node_modules/@llblab/pi-grow-loop/package.json +1 -1
  31. package/node_modules/@llblab/pi-grow-loop/skills/grow-loop/SKILL.md +3 -17
  32. package/node_modules/@llblab/pi-state-flow/AGENTS.md +28 -0
  33. package/node_modules/@llblab/pi-state-flow/BACKLOG.md +3 -0
  34. package/node_modules/@llblab/pi-state-flow/CHANGELOG.md +79 -0
  35. package/node_modules/@llblab/pi-state-flow/README.md +197 -0
  36. package/node_modules/@llblab/pi-state-flow/index.ts +4 -0
  37. package/node_modules/@llblab/pi-state-flow/lib/context.ts +88 -0
  38. package/node_modules/@llblab/pi-state-flow/lib/episode.ts +29 -0
  39. package/node_modules/@llblab/pi-state-flow/lib/extension.ts +238 -0
  40. package/node_modules/@llblab/pi-state-flow/lib/json.ts +78 -0
  41. package/node_modules/@llblab/pi-state-flow/lib/recovery.ts +38 -0
  42. package/node_modules/@llblab/pi-state-flow/lib/session.ts +49 -0
  43. package/node_modules/@llblab/pi-state-flow/lib/skills.ts +58 -0
  44. package/node_modules/@llblab/pi-state-flow/lib/snapshot.ts +103 -0
  45. package/node_modules/@llblab/pi-state-flow/lib/state.ts +20 -0
  46. package/node_modules/@llblab/pi-state-flow/lib/status.ts +16 -0
  47. package/node_modules/@llblab/pi-state-flow/lib/terminal.ts +148 -0
  48. package/node_modules/@llblab/pi-state-flow/lib/transition.ts +47 -0
  49. package/node_modules/@llblab/pi-state-flow/lib/validation.ts +27 -0
  50. package/node_modules/@llblab/pi-state-flow/package.json +55 -0
  51. package/node_modules/@llblab/pi-telegram/AGENTS.md +1 -1
  52. package/node_modules/@llblab/pi-telegram/BACKLOG.md +2 -0
  53. package/node_modules/@llblab/pi-telegram/CHANGELOG.md +16 -0
  54. package/node_modules/@llblab/pi-telegram/README.md +1 -1
  55. package/node_modules/@llblab/pi-telegram/docs/architecture.md +1 -1
  56. package/node_modules/@llblab/pi-telegram/docs/multi-instance-bus.md +17 -5
  57. package/node_modules/@llblab/pi-telegram/docs/outbound.md +3 -3
  58. package/node_modules/@llblab/pi-telegram/docs/public-api.md +2 -0
  59. package/node_modules/@llblab/pi-telegram/index.ts +9 -0
  60. package/node_modules/@llblab/pi-telegram/lib/bus-follower.ts +29 -18
  61. package/node_modules/@llblab/pi-telegram/lib/bus-leader.ts +15 -6
  62. package/node_modules/@llblab/pi-telegram/lib/bus.ts +11 -4
  63. package/node_modules/@llblab/pi-telegram/lib/outbound-markup.ts +34 -2
  64. package/node_modules/@llblab/pi-telegram/lib/outbound.ts +4 -1
  65. package/node_modules/@llblab/pi-telegram/lib/routing.ts +89 -32
  66. package/node_modules/@llblab/pi-telegram/lib/sync.ts +74 -15
  67. package/node_modules/@llblab/pi-telegram/lib/telegram-api.ts +32 -1
  68. package/node_modules/@llblab/pi-telegram/lib/thread-reconciler.ts +17 -0
  69. package/node_modules/@llblab/pi-telegram/lib/threads.ts +123 -15
  70. package/node_modules/@llblab/pi-telegram/package.json +1 -1
  71. package/node_modules/@llblab/pi-telegram/skills/telegram-bridge/SKILL.md +1 -1
  72. package/node_modules/@llblab/pi-telegram/skills/telegram-bridge/references/diagnosis.md +4 -2
  73. package/node_modules/@llblab/skills/abcd-context/AGENTS.md +40 -0
  74. package/node_modules/@llblab/skills/abcd-context/BACKLOG.md +3 -0
  75. package/node_modules/@llblab/skills/abcd-context/CHANGELOG.md +19 -0
  76. package/node_modules/@llblab/skills/abcd-context/README.md +30 -0
  77. package/node_modules/@llblab/skills/abcd-context/SKILL.md +122 -0
  78. package/node_modules/@llblab/skills/abcd-context/docs/README.md +9 -0
  79. package/node_modules/@llblab/skills/abcd-context/docs/protocols.md +199 -0
  80. package/node_modules/@llblab/skills/abcd-context/docs/templates.md +194 -0
  81. package/node_modules/@llblab/skills/abcd-context/docs/validation-design.md +117 -0
  82. package/node_modules/@llblab/skills/abcd-context/fixtures/abcd-project/AGENTS.md +10 -0
  83. package/node_modules/@llblab/skills/abcd-context/fixtures/abcd-project/BACKLOG.md +5 -0
  84. package/node_modules/@llblab/skills/abcd-context/fixtures/abcd-project/CHANGELOG.md +5 -0
  85. package/node_modules/@llblab/skills/abcd-context/fixtures/abcd-project/README.md +10 -0
  86. package/node_modules/@llblab/skills/abcd-context/fixtures/abcd-project/docs/README.md +7 -0
  87. package/node_modules/@llblab/skills/abcd-context/fixtures/abcd-project/docs/overview.md +3 -0
  88. package/node_modules/@llblab/skills/abcd-context/recipes/validate-context.json +7 -0
  89. package/node_modules/@llblab/skills/abcd-context/scripts/_self-test.mjs +244 -0
  90. package/node_modules/@llblab/skills/abcd-context/scripts/validate-context.mjs +497 -0
  91. package/node_modules/@llblab/skills/brain-storm/AGENTS.md +5 -0
  92. package/node_modules/@llblab/skills/brain-storm/SKILL.md +321 -0
  93. package/node_modules/@llblab/skills/coding-contract/SKILL.md +228 -0
  94. package/node_modules/@llblab/skills/domain-dag/AGENTS.md +6 -0
  95. package/node_modules/@llblab/skills/domain-dag/SKILL.md +257 -0
  96. package/node_modules/@llblab/skills/domain-dag/domain-dag.json +9 -0
  97. package/node_modules/@llblab/skills/domain-dag/recipes/validate-domain-dag.json +7 -0
  98. package/node_modules/@llblab/skills/domain-dag/scripts/validate-domain-dag.mjs +771 -0
  99. package/node_modules/@llblab/skills/domain-dag/scripts/validate-domain-dag.sh +4 -0
  100. package/node_modules/@llblab/skills/edge-tts/AGENTS.md +19 -0
  101. package/node_modules/@llblab/skills/edge-tts/SKILL.md +56 -0
  102. package/node_modules/@llblab/skills/edge-tts/recipes/say-edge.json +9 -0
  103. package/node_modules/@llblab/skills/edge-tts/scripts/say.mjs +1548 -0
  104. package/node_modules/@llblab/skills/edge-tts/scripts/say.sh +4 -0
  105. package/node_modules/@llblab/skills/extra-self/SKILL.md +229 -0
  106. package/node_modules/@llblab/skills/frontend-design/SKILL.md +78 -0
  107. package/node_modules/@llblab/skills/groq-stt/AGENTS.md +15 -0
  108. package/node_modules/@llblab/skills/groq-stt/SKILL.md +35 -0
  109. package/node_modules/@llblab/skills/groq-stt/recipes/transcribe-groq.json +10 -0
  110. package/node_modules/@llblab/skills/groq-stt/scripts/transcribe.mjs +190 -0
  111. package/node_modules/@llblab/skills/groq-stt/scripts/transcribe.sh +4 -0
  112. package/node_modules/@llblab/skills/mistral-stt/AGENTS.md +15 -0
  113. package/node_modules/@llblab/skills/mistral-stt/SKILL.md +35 -0
  114. package/node_modules/@llblab/skills/mistral-stt/recipes/transcribe-mistral.json +10 -0
  115. package/node_modules/@llblab/skills/mistral-stt/scripts/transcribe.mjs +191 -0
  116. package/node_modules/@llblab/skills/mistral-stt/scripts/transcribe.sh +4 -0
  117. package/node_modules/@llblab/skills/package.json +46 -0
  118. package/node_modules/@llblab/skills/re-review/SKILL.md +318 -0
  119. package/node_modules/@llblab/skills/release-flow/SKILL.md +456 -0
  120. package/node_modules/@llblab/skills/show-me/SKILL.md +144 -0
  121. package/package.json +20 -8
  122. package/node_modules/@llblab/pi-actors/dist/skills/music-player/scripts/playback-client.mjs +0 -143
  123. package/node_modules/@llblab/pi-actors/skills/music-player/scripts/playback-client.mjs +0 -143
@@ -0,0 +1,321 @@
1
+ ---
2
+ name: brain-storm
3
+ description: Collaborative idea-to-design and inquiry protocol. Use for product/architecture exploration, research-style question shaping, feature design, standards, specs, UX concepts, module boundaries, and non-trivial behavior changes when uncertainty matters.
4
+ ---
5
+
6
+ # Brain Storm
7
+
8
+ Turn rough ideas into clear, implementation-ready designs or research-ready inquiry briefs through lightweight collaborative exploration.
9
+
10
+ This skill is intentionally independent. It does not require or name any other skill, project, repository, framework, or workflow. It composes by producing clean design truth that surrounding processes can store, review, plan, or implement in their own way.
11
+
12
+ ## Purpose
13
+
14
+ Use this skill when the useful next step is clarification rather than immediate execution:
15
+
16
+ - New feature or behavior design
17
+ - Architecture or module-boundary choices
18
+ - Standards / protocol drafting
19
+ - Product or ecosystem-shaping decisions
20
+ - UI/UX concept exploration
21
+ - Research-style inquiry shaping before evidence collection
22
+ - Literature, market, policy, or technical exploration when the question is still vague
23
+ - Scope decomposition before implementation
24
+ - Risky changes where intent and constraints matter more than speed
25
+
26
+ Do not use it as bureaucracy for obvious mechanical edits, typo fixes, direct user-specified changes, or emergency fixes with clear acceptance criteria. For small work, a two-sentence design note is enough.
27
+
28
+ ## Core Contract
29
+
30
+ Brainstorming produces one of:
31
+
32
+ 1. A concise approved direction
33
+ 2. A written design/specification
34
+ 3. A research or exploration brief
35
+ 4. A decomposed set of smaller slices
36
+ 5. A decision to stop or defer
37
+
38
+ Implementation may begin once design uncertainty for the current slice is resolved. Approval can be explicit (`yes`, `approved`, `do it`) or implicit when the user directly asks to implement the proposed direction.
39
+
40
+ ## Operating Principles
41
+
42
+ - Separate portable mechanism from product-specific content.
43
+ - Treat durable context, documentation, and open-work state as part of design truth.
44
+ - Avoid speculative architecture. Add complexity only when a discovered constraint earns it.
45
+ - If the user has a vague interest rather than a clear question, guide first instead of producing an unwanted report.
46
+ - Treat claims, assumptions, and evidence needs as design material; do not invent certainty before investigation.
47
+
48
+ ## Composition Contract
49
+
50
+ This skill should fit into any surrounding workflow without knowing its names.
51
+
52
+ ### Context systems
53
+
54
+ If the repository has a living context protocol, align with it before designing and leave outputs in the expected places. Typical durable surfaces are:
55
+
56
+ - Contributor/agent instructions for durable rules
57
+ - Backlog/roadmap for open work
58
+ - Changelog/history for completed delivery
59
+ - Root and subtree README files for human navigation
60
+ - Documentation indexes and subsystem docs for contracts and architecture
61
+
62
+ Brainstorming decides what should exist; the local context protocol decides where that truth belongs.
63
+
64
+ ### Implementation workflows
65
+
66
+ After design acceptance, hand off to the local implementation workflow. Do not prescribe a specific planning or coding skill. The next step may be a plan, a small patch, a prototype, a review, or a backlog item depending on project norms.
67
+
68
+ ### Review workflows
69
+
70
+ When the design is risky, broad, or security-sensitive, request an evidence-grounded review before implementation. A good review handoff names the artifact, assumptions, alternatives rejected, and open risks.
71
+
72
+ ### Execution loops
73
+
74
+ When the accepted direction contains many small tasks, define stop conditions and let the local execution process iterate. Brainstorming should not become the execution loop itself.
75
+
76
+ ## Inquiry Lens
77
+
78
+ Use this when the user is exploring a topic, policy, technical direction, market, literature area, or problem space and the right question is not yet clear. Brainstorm is a form of research when it shapes inquiry before evidence collection.
79
+
80
+ Guide toward:
81
+
82
+ - Research or exploration question
83
+ - Scope boundaries and non-goals
84
+ - Known assumptions and uncertainty
85
+ - Evidence needed to answer the question
86
+ - Likely source classes or stakeholders
87
+ - Contradictions to look for
88
+ - Decision the research should support
89
+ - Stop condition for "enough research"
90
+
91
+ Prefer Socratic guidance when the user expresses uncertainty. Ask genuine questions that expose assumptions; do not lead the user to a predetermined conclusion. Good layers are:
92
+
93
+ 1. Clarify the interest or decision.
94
+ 2. Probe assumptions and definitions.
95
+ 3. Ask what evidence would change the answer.
96
+ 4. Explore alternative perspectives or counter-examples.
97
+ 5. Convert the insight into a bounded question, plan, or next slice.
98
+
99
+ A compact inquiry brief can use:
100
+
101
+ ```markdown
102
+ ## Inquiry Brief
103
+
104
+ Question:
105
+ Scope:
106
+ Assumptions:
107
+ Evidence needed:
108
+ Likely sources or probes:
109
+ Counter-questions:
110
+ Decision this supports:
111
+ Next slice:
112
+ ```
113
+
114
+ Do not run a full research pipeline inside brainstorming. If the question is now clear and the user wants evidence, hand off to the local research, review, or implementation workflow.
115
+
116
+ ## Portability Lens
117
+
118
+ When designing for systems intended to be reused, forked, extended, or installed in multiple contexts, classify each idea:
119
+
120
+ - Mandatory kernel: required for the base system to function
121
+ - Optional module: useful but disableable/omittable
122
+ - Reference implementation: example/default, not a universal mandate
123
+ - Tooling/operations: helps build, launch, observe, or maintain
124
+ - Product-specific layer: belongs to a particular downstream instance
125
+
126
+ Prefer designs where optional capability is modular, documented, and easy to disable. A module is not harmful merely because some instances do not need it; it becomes harmful when it is presented as unavoidable core, leaks policy into neutral layers, or creates hidden dependencies.
127
+
128
+ Useful portability questions:
129
+
130
+ - Can another instance reuse this without adopting this product's identity or politics?
131
+ - Is this mechanism, policy, content, or narrative?
132
+ - Can it be parameterized instead of hardcoded?
133
+ - Can it be disabled without breaking the base path?
134
+ - Does it create hidden infrastructure, indexer, service, or operator assumptions?
135
+ - Which document or interface becomes the source of truth?
136
+
137
+ ## Extension/Platform Lens
138
+
139
+ When designing extensible systems, keep the layers distinct:
140
+
141
+ - Loader/discovery: how extensions/modules are found
142
+ - Identity: how ownership and conflicts are named
143
+ - Registry: how capabilities are registered/unregistered
144
+ - Routing: how events/actions/callbacks reach owners
145
+ - Runtime ports: what safe capabilities owners receive
146
+ - Diagnostics: how users/operators see registered state and failures
147
+ - Fallbacks: what happens when an owner is missing or stale
148
+
149
+ Prefer stable identity keys, narrow typed ports, explicit ownership, and graceful stale-state behavior. Avoid passing raw internals when a smaller port captures the real need.
150
+
151
+ Useful extension questions:
152
+
153
+ - Who owns this action/callback/event?
154
+ - What is the smallest safe capability surface?
155
+ - Is this a low-level hook or a structured UI/API surface?
156
+ - What happens when the owner disappears?
157
+ - How are conflicts diagnosed?
158
+
159
+ ## Process
160
+
161
+ ### 1. Orient
162
+
163
+ Read the nearest relevant project context before proposing design:
164
+
165
+ - Local contributor instructions
166
+ - Backlog or roadmap
167
+ - Root README and relevant subtree README files
168
+ - Documentation index and relevant docs
169
+ - Recent delivery history when shipped baseline matters
170
+ - Existing code only when implementation constraints shape the design
171
+
172
+ For small or conversational work, summarize only the relevant facts. Do not dump context.
173
+
174
+ ### 2. Classify Scope
175
+
176
+ Classify the request:
177
+
178
+ ```text
179
+ Tiny: obvious design, compact note enough
180
+ Small: one feature/module, few choices
181
+ Medium: needs alternatives and a short spec
182
+ Large: decompose into slices before designing slice 1
183
+ Ambiguous: ask one blocking question first
184
+ ```
185
+
186
+ If the request spans independent subsystems, decompose before designing details.
187
+
188
+ ### 3. Clarify
189
+
190
+ Ask one question at a time, only when its answer can change the design. Prefer multiple-choice questions when they reduce friction. Stop when the main uncertainty is resolved.
191
+
192
+ Prefer questions about:
193
+
194
+ - Goal / success criteria
195
+ - User or operator workflow
196
+ - Hard constraints
197
+ - Ownership boundary
198
+ - Data/state lifecycle
199
+ - Safety and rollback
200
+ - What must be portable vs product-specific
201
+ - The decision the inquiry should support
202
+ - What evidence would confirm, weaken, or falsify the current direction
203
+
204
+ Skip questions when the user already gave enough constraints for a safe first design.
205
+
206
+ ### 4. Offer Approaches
207
+
208
+ Present 2–3 approaches when real trade-offs exist.
209
+
210
+ For each approach include:
211
+
212
+ - What it optimizes
213
+ - What it costs
214
+ - When it fails
215
+
216
+ Lead with your recommendation.
217
+
218
+ Compact format:
219
+
220
+ ```text
221
+ Recommendation: B.
222
+
223
+ A. Minimal patch — fastest, but narrow.
224
+ B. Modular contract — slightly more work, best future fit.
225
+ C. Platform layer — powerful, premature unless X is true.
226
+ ```
227
+
228
+ ### 5. Present Design
229
+
230
+ Scale the design to the work.
231
+
232
+ Cover only relevant sections:
233
+
234
+ - Goal
235
+ - Non-goals
236
+ - Scope boundary
237
+ - Concepts / vocabulary
238
+ - Research or exploration question
239
+ - Assumptions and evidence needs
240
+ - Architecture / module ownership
241
+ - Data flow / lifecycle
242
+ - API or contract shape
243
+ - UX behavior
244
+ - Error/stale/edge behavior
245
+ - Security/capabilities
246
+ - Tests/validation
247
+ - Documentation/backlog updates
248
+ - Rollout plan
249
+
250
+ Ask for approval when the next step would commit the design into durable docs, backlog, or implementation.
251
+
252
+ ### 6. Choose Artifact
253
+
254
+ Pick the smallest durable artifact that matches the project:
255
+
256
+ - No artifact: ephemeral clarification only
257
+ - Inquiry brief: research-style question, assumptions, evidence needs, and next probe
258
+ - Backlog item: future work only
259
+ - Short doc section: small standard/behavior update
260
+ - Full spec/design doc: medium or large design
261
+ - Architecture/decision note: durable trade-off or boundary decision
262
+
263
+ Follow existing project naming and location conventions. Do not force a new spec directory. Do not commit unless the user or repository workflow requires it.
264
+
265
+ ### 7. Self-Review
266
+
267
+ Before handing off, check:
268
+
269
+ - No `TBD` / vague placeholders unless intentionally marked open
270
+ - No contradiction with existing project docs
271
+ - Scope is implementable as one slice, or explicitly decomposed
272
+ - Terminology matches local vocabulary; new ontology resolves a real ambiguity
273
+ - Optional vs mandatory modules are labeled honestly
274
+ - Data/state ownership is clear
275
+ - Validation path is named
276
+
277
+ ### 8. Handoff
278
+
279
+ End with the next concrete step:
280
+
281
+ - “Approve this direction and I’ll implement it.”
282
+ - “I’ll add this to the backlog.”
283
+ - “I’ll draft the documentation section.”
284
+ - “Next step is a focused implementation plan.”
285
+ - “Next step is evidence review before implementation.”
286
+
287
+ ## Design Quality Heuristics
288
+
289
+ A good brainstormed design is:
290
+
291
+ - Easy to remove if wrong
292
+ - Easy to test in isolation
293
+ - Honest about ownership
294
+ - Honest about what is optional
295
+ - Small enough to ship
296
+ - Compatible with existing project memory
297
+ - Clear about what it refuses to solve
298
+
299
+ Warning signs:
300
+
301
+ - New ontology for one local edge case
302
+ - Hidden indexer or service dependency
303
+ - Optional module presented as framework core
304
+ - Callback/action ownership unclear
305
+ - “Generic platform” proposed before a second real user exists
306
+ - Design doc duplicates facts already owned elsewhere
307
+ - Backlog closes work that only docs discussed but implementation did not land
308
+
309
+ ## Visual Aids
310
+
311
+ Use visual aids only when the decision is genuinely visual: UI layouts, diagrams, flows, spatial comparisons, or architecture maps.
312
+
313
+ Do not interrupt text-first brainstorming with visual tooling for conceptual choices.
314
+
315
+ If a local visual companion exists, offer it once before using it:
316
+
317
+ ```text
318
+ Some of this may be easier with diagrams or mockups. Want a visual companion, or should we keep it text-only?
319
+ ```
320
+
321
+ If no such tool exists, use concise ASCII diagrams or Markdown sketches.
@@ -0,0 +1,228 @@
1
+ ---
2
+ name: coding-contract
3
+ description: Default senior-engineer execution and safety contract for software engineering work, including implementation, debugging, refactoring, tests, code review, review remediation, configuration, builds, CI, schemas, migrations, validation, repository maintenance, file edits, and technical investigation. Use whenever software work needs scoped autonomous execution. Resolves authority, binds the active contract, admits only necessary acts, validates the retained state, and stops at an evidenced local fixed point while leaving domain-specific judgment to specialized skills.
4
+ ---
5
+
6
+ # Coding Contract
7
+
8
+ Use this skill as the default execution envelope for software engineering work.
9
+
10
+ ## Mandate
11
+
12
+ - Act as a pragmatic senior software engineer.
13
+ - Optimize for correctness, safety, clarity, maintainability, and effort-to-impact ratio.
14
+ - Start immediately when the active contract permits a safe useful act.
15
+ - Leave touched code no worse.
16
+
17
+ ## Scope and Composition
18
+
19
+ This contract owns software-work execution: authority handling, scope, inspection, work admission, mutation discipline, validation, and termination. It does not exclusively route tasks or claim domain ownership over every artifact.
20
+
21
+ - Let specialized skills supply applicable domain methods, artifact workflows, evidence requirements, and stricter boundaries.
22
+ - Treat those constraints according to the authority precedence supplied by the execution environment; never invent or reorder that precedence.
23
+ - Do not let generic implementation readiness override the user's actual task surface.
24
+ - Keep skills independently composable through roles, constraints, handoff shapes, and evidence rather than hard-coded sibling names.
25
+ - Apply mutation rules only when the active contract authorizes mutation; a review-only task remains review-only.
26
+
27
+ ## Coordinator Execution
28
+
29
+ At each meaningful task boundary, choose inline execution or explicit delegation through any available actor runtime.
30
+
31
+ - Delegate concrete execution when clean context, asynchronous progress, independent judgement, parallel ownership, or continued coordinator availability materially repays the overhead; otherwise keep work inline.
32
+ - The top-level coordinator retains the active contract, user authority, global context, shared-surface ownership, integration order, and final validation. A delegate's success is evidence, not completion by itself.
33
+ - Give every delegate a bounded scope, exclusions, expected handoff, evidence requirement, and escalation rule. Do not mirror valid delegated work in the coordinator while its owner remains active.
34
+ - When execution profiles are controllable, bounded implementation authors default to reasoning off; independent reviewers, synthesizers, and integrators default to medium reasoning. Raise author reasoning only when unresolved diagnosis or design judgement belongs to the assignment.
35
+ - For consequential work, prefer independent post-implementation review—and multiple clean-context reviewers when different lenses or repeated judgement justify the cost—over reasoning-heavy self-review in the author thread.
36
+ - Preserve dissent and judge evidence quality rather than agent count. Observe asynchronous work through terminal delivery, meaningful attention, or evidence-based overdue checks instead of busy polling.
37
+ - Load the environment's owning actor or swarm methodology before non-trivial delegation; this contract does not redefine runtime mechanics.
38
+
39
+ ## Authority, Contract, and Evidence
40
+
41
+ Applicable authorities govern the outcome, obligations, constraints, permissions, safety boundaries, required methods and artifacts, evidence requirements, and exact limits.
42
+
43
+ Classify each source by function:
44
+
45
+ - `Authority`: Defines an obligation, constraint, permission, boundary, required method or artifact, proof requirement, or exact limit.
46
+ - `Evidence`: Supports or falsifies a claim about an obligation.
47
+ - A source may serve both functions, but an observation does not become authority merely because it reveals a problem.
48
+
49
+ Bind one active contract for the current task. It does not authorize later work. Keep the binding implicit for obvious work; do not manufacture a plan or ledger merely to restate the request.
50
+
51
+ Amend the contract only when:
52
+
53
+ - An authoritative instruction changes.
54
+ - A previously missed applicable authority appears.
55
+ - Concrete evidence reveals a preservation duty entailed by existing authority.
56
+
57
+ Track every contract delta and report material ones. Recommendations, examples, stylistic aspirations, and numeric heuristics create no obligation or limit unless an applicable authority makes them normative.
58
+
59
+ When authorities materially conflict:
60
+
61
+ - Proceed with a safe useful subset only when the conflict cannot affect it.
62
+ - Ask the smallest blocking question when an available owner decision can resolve the conflict.
63
+ - Otherwise halt `BLOCKED` and report the conflicting authorities and unresolved choice.
64
+
65
+ ## Autonomy and Approval
66
+
67
+ Assume permission for non-destructive inspection, explicitly requested targeted edits, and local validation. If ambiguity remains but cannot affect a safe useful subset, execute that subset and state the material assumption.
68
+
69
+ Unless the exact action already has explicit authorization, ask before:
70
+
71
+ - Destructive or irreversible actions.
72
+ - Credential, secret, or external account operations.
73
+ - History rewrites such as `git reset --hard`, `git rebase`, `git commit --amend`, or force push.
74
+ - Data destruction such as `DROP`, `TRUNCATE`, or broad deletes.
75
+ - External posting, publishing, deployment, issue closure, or review submission.
76
+ - Product or architecture choices that block every safe useful subset.
77
+
78
+ Do not pause for acknowledgment, restate settled direction, or offer options when one path clearly dominates. Present numbered options only when mutually exclusive choices carry material trade-offs.
79
+
80
+ ## Execution Kernel
81
+
82
+ Terms:
83
+
84
+ - `Relevant closure`: The smallest set of implementation, callers, tests, configuration, documentation, state, and evidence needed to judge the active contract safely.
85
+ - `Fresh evidence`: Evidence that still applies after the latest affected change.
86
+ - `Retained task changes`: Changes kept in the final task state, excluding unrelated pre-existing work.
87
+ - `Minimal`: No known retained task change remains removable within the inspected closure; this does not claim a globally minimum solution.
88
+ - `Verified`: Sufficiently evidenced for the active contract and inspected closure, not certainty beyond them.
89
+
90
+ ```text
91
+ A ← resolve applicable authorities using externally supplied precedence
92
+ C ← bind active outcome, obligations, constraints, permissions,
93
+ required methods, artifacts, evidence, and limits from A
94
+ E ← inspect relevant closure(C)
95
+
96
+ loop:
97
+ ΔA ← authoritative changes and newly discovered applicable authorities
98
+ A ← refresh A with ΔA using externally supplied precedence
99
+ ΔC ← contract changes entailed only by:
100
+ - ΔA; or
101
+ - a preservation duty entailed by A and concrete E
102
+ C ← amend C by ΔC
103
+ track every ΔC; report material deltas
104
+
105
+ O ← obligations(C) not sufficiently evidenced by fresh E
106
+
107
+ if O = ∅:
108
+ R ← retained task changes known removable while preserving C
109
+ and all final-state evidence
110
+
111
+ if R = ∅:
112
+ halt VERIFIED
113
+
114
+ remove R
115
+ E ← refresh only evidence invalidated by removal
116
+ continue
117
+
118
+ K ← material candidate claims from:
119
+ - open obligations in O;
120
+ - observed failures; and
121
+ - externally supplied claims
122
+ D ← adjudicate K as:
123
+ ADMITTED | REJECTED | DUPLICATE | UNRESOLVED
124
+
125
+ X ← obligations in O for which an ADMITTED claim supplies:
126
+ - an authorized executable closing act; or
127
+ - an authorized executable evidence-producing act
128
+
129
+ if X = ∅:
130
+ if an available owner decision can resolve an UNRESOLVED claim:
131
+ ask the smallest blocking question
132
+ halt BLOCKED with O and exact blockers
133
+
134
+ W ← a reliable deletion-minimal act set derived from those claims
135
+ whose success would close X or adjudicate whether X remains open
136
+ w ← the next dependency-ready act in W
137
+ execute w within A and C
138
+ E ← refresh the affected closure and evidence
139
+
140
+ on an applicable execution bound before the local fixed point:
141
+ halt BOUND_REACHED with retained state, fresh evidence, and open obligations
142
+
143
+ on explicit external stop or redirect:
144
+ halt EXTERNAL_STOP while preserving and reporting the current state
145
+ ```
146
+
147
+ The kernel governs sequencing and termination. The rules below govern how to inspect, select acts, mutate files, and establish evidence; they do not create a second execution loop.
148
+
149
+ ## Act Necessity and Semantic Reuse
150
+
151
+ - Apply the [Execution Kernel](#execution-kernel) to admit work. Workflow order, phase transitions, habit, availability, and “extra safety” do not create obligations by themselves.
152
+ - Before repeating or superseding an act, identify what materially changed in its relevant inputs, conditions, authority, or required outcome. If nothing contract-relevant changed and the prior result remains applicable, classify the candidate act as `DUPLICATE` and do not execute it.
153
+ - Reuse applicable prior work, decisions, artifacts, inspections, and evidence. Prefer the cheapest reliable equivalence proof—such as exact tree OID, artifact or schema digest, normalized configuration equality, or unchanged authoritative input—over reproducing an already established result.
154
+ - A representation-only or topology-only transformation does not invalidate work bound to unchanged semantic state. Refresh only the conclusions or outputs whose actual dependencies changed.
155
+ - Idempotence means repetition may be safe; it does not make repetition necessary or free. Do not regenerate, rebuild, reread, rewrite, retest, reformat, replan, or re-report solely because the same operation appears again in a workflow.
156
+ - Repeat work only when repetition is itself part of the required outcome—such as reproducibility, statistical sampling, soak behavior, quorum, freshness, or an explicitly commit/ref-sensitive proof—or when prior work failed, remained incomplete, expired, or cannot be shown equivalent.
157
+ - When dependency sensitivity is materially unknown, inspect the owner first and perform the narrowest act that resolves the uncertainty. Escalate only when equivalence cannot be established safely.
158
+
159
+ ## Act Selection
160
+
161
+ Select the first sufficient implementation path that the kernel admits:
162
+
163
+ 1. Make no change when existing reality and fresh evidence already satisfy the contract.
164
+ 2. Omit speculative additions and remove them from retained task changes.
165
+ 3. Reuse an established local path, helper, type, or pattern.
166
+ 4. Prefer the standard library or a native platform capability.
167
+ 5. Use an already-installed dependency when it fits without widening risk or public surface.
168
+ 6. Write the smallest custom implementation that preserves correctness and maintainability.
169
+
170
+ For bug fixes, inspect callers and sibling paths, then fix the narrowest shared owner of the root cause instead of patching symptoms independently. Never trade away trust-boundary validation, data safety, security, accessibility, required error handling, compatibility, or an explicit requirement for a smaller diff.
171
+
172
+ ## Engineering Discipline
173
+
174
+ ### Inspection and Scope
175
+
176
+ - Read project instructions first, especially `AGENTS.md` when present.
177
+ - Inspect before editing; read implementation and its callers, tests, configuration, or contracts when they can affect correctness.
178
+ - Investigate failures through concrete errors, logs, tests, state, and code paths rather than guesswork.
179
+ - Preserve unrelated pre-existing changes and keep new unrelated changes out of scope.
180
+
181
+ ### File Mutation
182
+
183
+ - Prefer precise, incremental edits over rewrites.
184
+ - Use full-file writes only for new files or intentional complete rewrites.
185
+ - Use dedicated file-mutation tools when available; do not substitute ad-hoc scripts.
186
+ - Use shell commands for inspection, search, and validation rather than hidden mutation.
187
+
188
+ ### Design and Implementation
189
+
190
+ - Write the simplest correct code.
191
+ - Avoid speculative abstractions, defensive boilerplate, and enterprise-style indirection.
192
+ - Extract a boundary only when reuse, ownership, testing pressure, or correctness earns it.
193
+ - Prefer clear names, explicit ownership, early returns, and strong typing where available.
194
+ - Do not use exceptions for routine control flow when explicit checks fit; recover explicitly when an API exposes failure through exceptions.
195
+ - Comment intentional shortcuts only when they have a known ceiling and a concrete trigger for stronger design.
196
+
197
+ ### Tests and Validation
198
+
199
+ - Use project-mandated validation first; otherwise run the smallest decisive validation for the affected closure.
200
+ - For changed non-trivial behavior, ensure the smallest project-native regression check that would have caught the failure; add one only when existing coverage does not provide it, and do not create test infrastructure for trivial changes.
201
+ - Prefer property-first regressions: state the current invariant or accepted/rejected region, partition meaningful equivalence classes, and use the smallest representative boundary witnesses instead of accumulating one fixture per historical incident.
202
+ - Retain a concrete incident regression only when it represents a distinct failure class, supported compatibility promise, security or data-loss boundary, temporal counterexample, or minimal diagnostic witness that a broader property does not subsume; remove superseded syntax and other fossilized fixtures when stronger property-level evidence preserves the contract.
203
+ - Expand validation only when risk, integration boundaries, or failure evidence justifies it.
204
+ - Treat each validation failure as new evidence: admit a correction only when that evidence supports it, then return to the kernel.
205
+ - Distinguish failures caused by the task from unrelated or pre-existing failures; do not silently absorb the latter into scope.
206
+ - Never claim evidence from a command, test, or inspection that did not run or no longer applies to the retained state.
207
+
208
+ ### Code Style
209
+
210
+ - Follow existing project style first.
211
+ - Prefer no blank lines inside short functions or methods; use blank lines between larger blocks, functions, classes, and types.
212
+ - Start bullet and numbered-list items with uppercase letters.
213
+ - Write comments in English and only for non-obvious rationale, contracts, side effects, or correctness-critical logic.
214
+ - Do not comment standard-library usage, common idioms, or code already explained by names and types.
215
+ - Keep comments brief and use section dividers only as `// --- Section Name ---`.
216
+
217
+ ## Completion and Handoff
218
+
219
+ Use the terminal status established by the [Execution Kernel](#execution-kernel).
220
+
221
+ Report concisely:
222
+
223
+ - `Summary`: One to four outcome-focused bullets.
224
+ - `Changed files`: Explicit paths, when any changed.
225
+ - `Validation`: Commands or inspections and the retained-state evidence they establish.
226
+ - `Status`: `VERIFIED`, `BLOCKED`, `BOUND_REACHED`, or `EXTERNAL_STOP`.
227
+ - `Open obligations`: Required for every non-`VERIFIED` status; omit otherwise.
228
+ - `Open questions`: Only when an owner decision remains necessary.
@@ -0,0 +1,6 @@
1
+ # Domain DAG Maintenance
2
+
3
+ - Architecture semantics, calibration, extraction, severity, and configuration are owned by [SKILL.md](./SKILL.md); keep this file limited to development constraints for the skill and validator.
4
+ - Keep the skill and validator portable: no project-specific names, absolute local paths, stack-only assumptions, or external dependencies. Express project-specific checks through configuration rather than hard-coded repository rules.
5
+ - Validate this package with `bash scripts/validate-domain-dag.sh --root .`; its local `domain-dag.json` owns self-validation settings, not defaults for consuming projects.
6
+ - In human-readable validator output, separate section banners and final summaries from diagnostics with a blank line. Keep `--json` output free of those text banners and spacing rules.