@askdkc/kiokuko 0.1.32 → 0.2.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 (153) hide show
  1. package/README.ja.md +55 -4
  2. package/README.ko.md +50 -4
  3. package/README.md +55 -4
  4. package/README.zh-CN.md +50 -4
  5. package/dist/agent-file/render.d.ts +1 -1
  6. package/dist/agent-file/render.d.ts.map +1 -1
  7. package/dist/agent-file/render.js +11 -6
  8. package/dist/agent-file/render.js.map +1 -1
  9. package/dist/akinator/agent-task.d.ts +2 -0
  10. package/dist/akinator/agent-task.d.ts.map +1 -1
  11. package/dist/akinator/agent-task.js +39 -12
  12. package/dist/akinator/agent-task.js.map +1 -1
  13. package/dist/akinator/capabilities.d.ts.map +1 -1
  14. package/dist/akinator/capabilities.js +21 -14
  15. package/dist/akinator/capabilities.js.map +1 -1
  16. package/dist/akinator/skill-discovery-attempt.d.ts +1 -0
  17. package/dist/akinator/skill-discovery-attempt.d.ts.map +1 -1
  18. package/dist/akinator/skill-discovery-attempt.js +20 -18
  19. package/dist/akinator/skill-discovery-attempt.js.map +1 -1
  20. package/dist/cli.d.ts.map +1 -1
  21. package/dist/cli.js +5 -1
  22. package/dist/cli.js.map +1 -1
  23. package/dist/commands/agent.d.ts.map +1 -1
  24. package/dist/commands/agent.js +18 -9
  25. package/dist/commands/agent.js.map +1 -1
  26. package/dist/commands/enno.d.ts +7 -0
  27. package/dist/commands/enno.d.ts.map +1 -0
  28. package/dist/commands/enno.js +76 -0
  29. package/dist/commands/enno.js.map +1 -0
  30. package/dist/commands/setup.d.ts +5 -1
  31. package/dist/commands/setup.d.ts.map +1 -1
  32. package/dist/commands/setup.js +83 -18
  33. package/dist/commands/setup.js.map +1 -1
  34. package/dist/config/paths.d.ts +6 -0
  35. package/dist/config/paths.d.ts.map +1 -1
  36. package/dist/config/paths.js +40 -0
  37. package/dist/config/paths.js.map +1 -1
  38. package/dist/enno-oduno/adapters.d.ts +18 -0
  39. package/dist/enno-oduno/adapters.d.ts.map +1 -0
  40. package/dist/enno-oduno/adapters.js +216 -0
  41. package/dist/enno-oduno/adapters.js.map +1 -0
  42. package/dist/enno-oduno/directives.d.ts +12 -0
  43. package/dist/enno-oduno/directives.d.ts.map +1 -0
  44. package/dist/enno-oduno/directives.js +215 -0
  45. package/dist/enno-oduno/directives.js.map +1 -0
  46. package/dist/enno-oduno/enno-oduno.d.mts +2 -0
  47. package/dist/enno-oduno/enno-oduno.d.mts.map +1 -0
  48. package/dist/enno-oduno/enno-oduno.mjs +3 -0
  49. package/dist/enno-oduno/enno-oduno.mjs.map +1 -0
  50. package/dist/enno-oduno/experts.d.ts +6 -0
  51. package/dist/enno-oduno/experts.d.ts.map +1 -0
  52. package/dist/enno-oduno/experts.js +18 -0
  53. package/dist/enno-oduno/experts.js.map +1 -0
  54. package/dist/enno-oduno/goki.d.mts +2 -0
  55. package/dist/enno-oduno/goki.d.mts.map +1 -0
  56. package/dist/enno-oduno/goki.mjs +3 -0
  57. package/dist/enno-oduno/goki.mjs.map +1 -0
  58. package/dist/enno-oduno/handoff.d.ts +4 -0
  59. package/dist/enno-oduno/handoff.d.ts.map +1 -0
  60. package/dist/enno-oduno/handoff.js +18 -0
  61. package/dist/enno-oduno/handoff.js.map +1 -0
  62. package/dist/enno-oduno/harness.d.ts +20 -0
  63. package/dist/enno-oduno/harness.d.ts.map +1 -0
  64. package/dist/enno-oduno/harness.js +65 -0
  65. package/dist/enno-oduno/harness.js.map +1 -0
  66. package/dist/enno-oduno/instructions.d.ts +2 -0
  67. package/dist/enno-oduno/instructions.d.ts.map +1 -0
  68. package/dist/enno-oduno/instructions.js +3 -0
  69. package/dist/enno-oduno/instructions.js.map +1 -0
  70. package/dist/enno-oduno/role-runner.d.ts +9 -0
  71. package/dist/enno-oduno/role-runner.d.ts.map +1 -0
  72. package/dist/enno-oduno/role-runner.js +171 -0
  73. package/dist/enno-oduno/role-runner.js.map +1 -0
  74. package/dist/enno-oduno/schemas.d.ts +615 -0
  75. package/dist/enno-oduno/schemas.d.ts.map +1 -0
  76. package/dist/enno-oduno/schemas.js +336 -0
  77. package/dist/enno-oduno/schemas.js.map +1 -0
  78. package/dist/enno-oduno/service.d.ts +47 -0
  79. package/dist/enno-oduno/service.d.ts.map +1 -0
  80. package/dist/enno-oduno/service.js +841 -0
  81. package/dist/enno-oduno/service.js.map +1 -0
  82. package/dist/enno-oduno/skills.d.ts +22 -0
  83. package/dist/enno-oduno/skills.d.ts.map +1 -0
  84. package/dist/enno-oduno/skills.js +127 -0
  85. package/dist/enno-oduno/skills.js.map +1 -0
  86. package/dist/enno-oduno/store.d.ts +61 -0
  87. package/dist/enno-oduno/store.d.ts.map +1 -0
  88. package/dist/enno-oduno/store.js +337 -0
  89. package/dist/enno-oduno/store.js.map +1 -0
  90. package/dist/enno-oduno/types.d.ts +191 -0
  91. package/dist/enno-oduno/types.d.ts.map +1 -0
  92. package/dist/enno-oduno/types.js +41 -0
  93. package/dist/enno-oduno/types.js.map +1 -0
  94. package/dist/enno-oduno/verifier.d.ts +9 -0
  95. package/dist/enno-oduno/verifier.d.ts.map +1 -0
  96. package/dist/enno-oduno/verifier.js +101 -0
  97. package/dist/enno-oduno/verifier.js.map +1 -0
  98. package/dist/enno-oduno/zenki.d.mts +2 -0
  99. package/dist/enno-oduno/zenki.d.mts.map +1 -0
  100. package/dist/enno-oduno/zenki.mjs +3 -0
  101. package/dist/enno-oduno/zenki.mjs.map +1 -0
  102. package/dist/ledger/types.d.ts +1 -1
  103. package/dist/ledger/types.d.ts.map +1 -1
  104. package/dist/ledger/types.js +5 -0
  105. package/dist/ledger/types.js.map +1 -1
  106. package/dist/mcp/server.d.ts.map +1 -1
  107. package/dist/mcp/server.js +66 -26
  108. package/dist/mcp/server.js.map +1 -1
  109. package/dist/setup/claude-config.d.ts +2 -0
  110. package/dist/setup/claude-config.d.ts.map +1 -1
  111. package/dist/setup/claude-config.js +12 -0
  112. package/dist/setup/claude-config.js.map +1 -1
  113. package/dist/setup/enno-client-config.d.ts +9 -0
  114. package/dist/setup/enno-client-config.d.ts.map +1 -0
  115. package/dist/setup/enno-client-config.js +172 -0
  116. package/dist/setup/enno-client-config.js.map +1 -0
  117. package/dist/setup/opencode-config.d.ts +2 -0
  118. package/dist/setup/opencode-config.d.ts.map +1 -1
  119. package/dist/setup/opencode-config.js +12 -0
  120. package/dist/setup/opencode-config.js.map +1 -1
  121. package/dist/setup/render.d.ts +2 -0
  122. package/dist/setup/render.d.ts.map +1 -1
  123. package/dist/setup/render.js +21 -12
  124. package/dist/setup/render.js.map +1 -1
  125. package/dist/setup/standard-skills.d.ts +23 -4
  126. package/dist/setup/standard-skills.d.ts.map +1 -1
  127. package/dist/setup/standard-skills.js +51 -1
  128. package/dist/setup/standard-skills.js.map +1 -1
  129. package/dist/skills/discovery-service.d.ts.map +1 -1
  130. package/dist/skills/discovery-service.js +2 -1
  131. package/dist/skills/discovery-service.js.map +1 -1
  132. package/dist/skills/types.d.ts +1 -0
  133. package/dist/skills/types.d.ts.map +1 -1
  134. package/migrations/013_enno_oduno.sql +176 -0
  135. package/migrations/014_oduno_reflection_phases.sql +40 -0
  136. package/package.json +7 -1
  137. package/skills/kiokuko-enno-oduno/SKILL.md +122 -0
  138. package/skills/kiokuko-enno-oduno/enno-oduno.png +0 -0
  139. package/skills/kiokuko-single-purpose-functions/SKILL.md +44 -258
  140. package/skills/kiokuko-single-purpose-functions/references/boundaries-and-ownership.md +50 -0
  141. package/skills/kiokuko-single-purpose-functions/references/domain-and-types.md +48 -0
  142. package/skills/kiokuko-single-purpose-functions/references/effects-and-data.md +43 -0
  143. package/skills/kiokuko-single-purpose-functions/references/protocols-and-idempotency.md +42 -0
  144. package/skills/kiokuko-single-purpose-functions/references/verification.md +41 -0
  145. package/skills/kiokuko-soul/SKILL.md +72 -0
  146. package/skills/kiokuko-ui-design-soul/SKILL.md +39 -1178
  147. package/skills/kiokuko-ui-design-soul/references/accessibility-and-navigation.md +31 -0
  148. package/skills/kiokuko-ui-design-soul/references/async-recovery.md +49 -0
  149. package/skills/kiokuko-ui-design-soul/references/forms-and-controls.md +35 -0
  150. package/skills/kiokuko-ui-design-soul/references/interaction-feedback.md +34 -0
  151. package/skills/kiokuko-ui-design-soul/references/responsive-and-platform.md +38 -0
  152. package/skills/kiokuko-ui-design-soul/references/safety-and-review.md +39 -0
  153. package/templates/AGENTS.md +9 -6
@@ -1,288 +1,74 @@
1
1
  ---
2
2
  name: kiokuko-single-purpose-functions
3
- description: Use whenever writing, modifying, reviewing, debugging, or refactoring code in any language or repository. Enforce one cohesive contract per function, validation at hostile boundaries, caller-owned input immutability, narrow types, deterministic domain logic, explicit safe failures, separation of persistence and external effects, and focused runnable tests. Do not create meaningless micro-functions or rewrite unrelated code.
3
+ description: Use whenever writing, modifying, reviewing, debugging, or refactoring code. Apply a compact universal function contract, then route each function or WorkUnit to one to three versioned expert fragments for its actual risks.
4
4
  ---
5
5
 
6
6
  <!-- KIOKUKO MANAGED STANDARD SKILL: kiokuko-single-purpose-functions -->
7
7
 
8
- # Single-purpose function contracts
8
+ # Single-purpose function router
9
9
 
10
- ## Objective
10
+ ## Outcome
11
11
 
12
- Build and change software by composing functions that each fulfill one explicit, testable contract.
12
+ Create code whose functions each own one cohesive externally observable responsibility, with explicit boundaries, effects, failures, and focused verification across languages, frameworks, and repositories.
13
13
 
14
- Apply this guidance across languages, frameworks, and repositories. Typed examples are intentional: adapt their contracts to the project’s type system, validation tools, error model, persistence layer, and test framework instead of treating TypeScript syntax as a requirement.
14
+ This file is the mandatory compact index for code work. It is not a request to read every reference. Read this index completely, select the smallest sufficient expert set, and then read only those expert files.
15
15
 
16
- Use it for the smallest coherent surface touched by the task. Do not turn an ordinary change into a repository-wide rewrite.
16
+ ## Universal core
17
17
 
18
- ## What “one thing” means
18
+ Apply these invariants to every created or changed function:
19
19
 
20
- A function does one thing when it has:
20
+ 1. State one contract: input, success, expected failures, effects, and observable result.
21
+ 2. Give it one responsibility and one reason to change. Do not create meaningless micro-functions.
22
+ 3. Validate hostile input at the boundary; keep the private core constrained by types or validated values.
23
+ 4. Do not mutate caller-owned input unless mutation is the explicit API contract.
24
+ 5. Make domain decisions deterministic. Keep persistence, network, filesystem, process, clock, randomness, UI, and logging effects explicit.
25
+ 6. Return or throw failures intentionally. Do not silently swallow, partially succeed, or leak lower-layer accidents as the public contract.
26
+ 7. Add the smallest runnable test that proves success, the important failure, and the regression being changed.
27
+ 8. Preserve unrelated code and existing public behavior unless the task explicitly changes it.
21
28
 
22
- - one cohesive externally observable responsibility;
23
- - one primary reason to change;
24
- - one defined success result;
25
- - one explicit set of expected failures;
26
- - one declared effect profile.
29
+ Small is not the objective. Cohesion is. Keep operations together when splitting them would hide sequencing, duplicate policy, or weaken a transaction.
27
30
 
28
- “One thing” does not mean one statement, one branch, or the shortest possible function.
31
+ ## MoE selection contract
29
32
 
30
- Good examples include:
33
+ For each new or materially changed function, or for the smallest WorkUnit that owns a cohesive use case:
31
34
 
32
- - parse one untrusted request;
33
- - normalize one validated configuration value;
34
- - calculate one price or ranking;
35
- - load one record through a persistence interface;
36
- - render one output representation;
37
- - coordinate one atomic use case.
35
+ 1. classify the dominant risk;
36
+ 2. select one expert ID from the table below;
37
+ 3. add at most two more only when the same contract genuinely crosses those risks;
38
+ 4. record a concrete reason for every selection;
39
+ 5. read the selected files before implementation or review.
38
40
 
39
- An orchestration function may call several functions. Its single responsibility is coordinating one use case. Keep detailed policy in domain functions and external mechanics in adapters or stores.
41
+ Do not make a new Skill per function. The function contract is the execution envelope; `expertRefs` are its mixture-of-experts dispatch. If two functions need materially different expert sets or reasons to change, split the WorkUnit or record separate function contracts inside it.
40
42
 
41
- ## Project contracts outrank generic advice
42
-
43
- Before changing code, inspect the relevant source, tests, documentation, types, error conventions, and adjacent helpers.
44
-
45
- Preserve the repository’s established contracts unless the task explicitly changes them:
46
-
47
- - public APIs and serialized formats;
48
- - error types, codes, and messages;
49
- - transaction and concurrency rules;
50
- - ownership and mutation conventions;
51
- - framework and dependency boundaries;
52
- - security and privacy requirements;
53
- - test and build commands.
54
-
55
- Reuse a project helper when it already implements the required behavior. Do not introduce a parallel result type, validation library, database wrapper, dependency container, or architecture merely because it is familiar from another project.
56
-
57
- ## Function layers
58
-
59
- Classify every new or materially changed function before implementing it.
60
-
61
- ### Boundary parser or validator
62
-
63
- A boundary function receives data that is not yet trusted, including network requests, command-line input, environment variables, configuration files, database rows, files, messages, provider responses, and deserialized state.
64
-
65
- It should:
66
-
67
- 1. bound work before expensive processing;
68
- 2. reject malformed shape, type, range, encoding, size, depth, count, or unknown fields when required;
69
- 3. avoid invoking caller-controlled getters, proxies, hooks, or serialization behavior;
70
- 4. create an owned normalized value;
71
- 5. return that value or produce one narrow, safe expected failure.
72
-
73
- After validation, delegate to typed or otherwise constrained internal code. Do not make every internal helper revalidate the same value.
74
-
75
- ### Pure domain function
76
-
77
- A pure domain function performs one decision, state transition, normalization, ranking, projection, or calculation over validated values.
78
-
79
- It must not hide reads of time, randomness, environment, locale-sensitive state, mutable globals, filesystem, database, or network. Pass variable dependencies explicitly. The same explicit inputs should produce the same output.
80
-
81
- ### Persistence function
82
-
83
- A persistence function performs one storage capability.
84
-
85
- It should:
86
-
87
- - use the project’s established database or storage abstraction;
88
- - parameterize queries where applicable;
89
- - avoid transport and presentation concerns;
90
- - avoid network and unrelated filesystem work;
91
- - remain transaction-agnostic unless it explicitly owns the transaction;
92
- - validate stored data before treating it as domain state;
93
- - preserve revision, idempotency, ordering, and identity invariants.
94
-
95
- ### Effect adapter
96
-
97
- An adapter wraps one external capability, such as reading a file, calling a provider, obtaining time, generating an identifier, writing a response, or opening a database.
98
-
99
- Expose the smallest capability required. Prefer a narrow function or interface over a broad service container.
100
-
101
- ### Use-case orchestrator
102
-
103
- An orchestrator coordinates one application operation. It may combine validation, pure decisions, persistence, and adapters, but it should not absorb their detailed policies.
104
-
105
- ## Required contract
106
-
107
- Before implementing a new function or materially changing an existing one, determine:
43
+ In Enno-Oduno plans, `expertRefs` is required for code-changing WorkUnits and is revision-bound. Outside Enno-Oduno, keep the same mapping in the working plan or review notes:
108
44
 
109
45
  ```text
110
- Function:
111
- Layer: boundary | domain | persistence | adapter | orchestrator
112
- Responsibility:
113
- Inputs and trust level:
114
- Input ownership:
115
- Success output:
116
- Expected failures:
117
- Other propagated failures:
118
- External effects:
119
- Transaction or resource ownership:
120
- Idempotency or replay behavior:
121
- Security and privacy constraints:
122
- Preconditions:
123
- Postconditions:
46
+ target -> responsibility -> expert IDs -> focused verifier
124
47
  ```
125
48
 
126
- The contract may remain internal for a small change, but the implementation and tests must reflect it.
127
-
128
- ## Non-negotiable rules
129
-
130
- ### 1. Do not mutate caller-owned input
131
-
132
- Treat parameters as immutable unless the contract explicitly transfers ownership.
133
-
134
- - Do not modify caller-provided objects, arrays, maps, sets, buffers, collections, or records.
135
- - Return a new value for transformations.
136
- - Local mutation of newly allocated, unobservable data is allowed when it improves clarity or measured performance.
137
- - Do not use shared mutable state for domain behavior.
138
-
139
- Add an input-snapshot test when accidental mutation is plausible.
140
-
141
- ### 2. Validate values at the real trust boundary
142
-
143
- Static types, annotations, interfaces, and schemas known only to the compiler do not validate runtime data.
144
-
145
- Use the repository’s established validation approach. Validate external JSON, database rows, configuration, files, provider responses, and messages before converting them into domain values. Reject or explicitly handle unknown fields when the contract is closed.
146
-
147
- Use an unconstrained type such as `unknown`, a raw byte buffer, or a generic map only at a real boundary. Internal helpers should receive constrained values.
148
-
149
- ### 3. Bound work before trust
150
-
151
- Every externally influenced collection, string, nested object, retry loop, result set, or payload needs a justified bound.
152
-
153
- Check limits before full traversal, expansion, hashing, serialization, proportional allocation, persistence, retrying, or returning data. Truncate only when the contract explicitly defines a preview or diagnostic field; otherwise reject oversized authoritative input.
154
-
155
- ### 4. Produce an owned snapshot
156
-
157
- Do not retain references to hostile or caller-controlled data after validation. Copy accepted values into owned structures before canonicalization, hashing, persistence, or asynchronous use.
158
-
159
- Where the runtime permits hostile object behavior, account for accessors, proxies, cycles, malformed text, unsupported prototypes, and non-finite numbers.
160
-
161
- ### 5. Use narrow types and exact states
162
-
163
- - Prefer the strongest practical static analysis and type-checking mode supported by the project.
164
- - Avoid escape hatches such as `any`, unchecked casts, suppressed diagnostics, or untyped dictionaries when a narrower representation is possible.
165
- - Use enums, literal unions, sealed variants, value objects, or equivalent exact state models.
166
- - Distinguish missing, null, unknown, empty, unavailable, and invalid when the protocol distinguishes them.
167
- - Omit absent optional values rather than inventing ambiguous placeholders.
168
- - Keep assertions adjacent to the runtime check that proves them.
169
-
170
- ### 6. Make expected failures explicit and safe
171
-
172
- Use the project’s established error taxonomy or result convention. Choose the narrowest existing failure category.
173
-
174
- Do not use `false`, `null`, an empty string, or a swallowed exception to represent several unrelated failures. Do not catch an error merely to hide it or continue from uncertain state.
175
-
176
- At public boundaries:
177
-
178
- - map internal failures to stable public behavior;
179
- - keep details bounded and allowlisted;
180
- - never echo credentials, tokens, private data, raw request bodies, or unsafe provider responses;
181
- - preserve both operation and cleanup failures when both occur.
182
-
183
- ### 7. Keep domain decisions deterministic
184
-
185
- Inject time, randomness, environment, current directory, locale, filesystem, database, network, and provider access. Use stable ordering and serialization when output participates in hashes, identities, manifests, caches, snapshots, or replay.
186
-
187
- ### 8. Preserve transaction and resource discipline
188
-
189
- - Let one use case own the transaction or resource lifecycle.
190
- - Keep low-level storage functions composable inside that owner.
191
- - Do not perform network calls, user prompts, or unrelated slow work while holding a write transaction or scarce lock.
192
- - Do not add nested transaction ownership where an outer transaction already exists.
193
- - Treat ambiguous commit or cleanup state explicitly; do not compensate as though rollback were proven.
194
-
195
- ### 9. Preserve idempotency and compare-and-swap semantics
196
-
197
- Bind every meaning-bearing input to request identities, expected revisions, generation tokens, content hashes, or cache keys.
198
-
199
- - Exact replay may reuse the recorded acknowledgement.
200
- - Reusing an identity with changed input is a conflict.
201
- - Compare the exact observed version before mutation.
202
- - Never silently overwrite newer or independently owned state.
203
- - Never present partial or ambiguous cleanup as full success.
204
-
205
- ### 10. Preserve external contracts
206
-
207
- A refactor is not behavior-preserving if it accidentally changes a machine contract.
208
-
209
- Preserve applicable command output, exit status, API schema, HTTP status, protocol envelope, database migration history, file format, line ending, file mode, ownership marker, event order, and backward-compatibility behavior.
210
-
211
- ### 11. Keep security checks in the success path
212
-
213
- Security validation is not optional logging. Apply required authorization, normalization, sanitization, size checks, secret detection, and path or URL restrictions before persistence or delivery.
214
-
215
- A detected secret or invalid value must not reappear in errors, logs, hashes exposed to callers, temporary diagnostics, or responses.
216
-
217
- ### 12. Test the contract independently
218
-
219
- Use the repository’s existing test framework and style. Cover the applicable cases:
220
-
221
- - normal success;
222
- - empty, minimum, maximum, and exact boundary values;
223
- - wrong primitive type or malformed structure;
224
- - unknown fields for closed inputs;
225
- - each expected failure category;
226
- - no mutation of caller-owned input;
227
- - no secret or raw invalid-value echo;
228
- - deterministic ordering, hashing, or replay identity;
229
- - exact replay and changed-input conflict;
230
- - bounded retry and non-retryable failure;
231
- - operation-plus-cleanup failure;
232
- - integration with the real boundary when adapter behavior changes.
233
-
234
- Assert observable behavior, not private call order, unless ordering itself is a documented invariant.
235
-
236
- ## Required workflow
237
-
238
- 1. Read the governing repository contracts and adjacent implementation.
239
- 2. Define the smallest coherent behavior change.
240
- 3. Classify each changed function’s layer.
241
- 4. Determine its input, output, failure, effect, ownership, and replay contract.
242
- 5. Validate once at the hostile boundary and create owned data.
243
- 6. Implement deterministic policy in the pure core.
244
- 7. Add only the narrow external capability required.
245
- 8. Compose the use case without mixing detailed policies into orchestration.
246
- 9. Add a regression test for the counterexample that would disprove the contract.
247
- 10. Run the narrowest affected tests, then the repository’s documented static, type, test, build, and package checks as applicable.
248
- 11. Report what changed, what was verified, what was skipped, and any residual risk.
249
-
250
- Do not invent commands that are absent from the repository.
251
-
252
- ## Decomposition tests
49
+ Do not load unselected fragments “just in case.” If repository evidence exposes a new risk, update the selection explicitly before consuming that fragment.
253
50
 
254
- Split or redesign a function when one or more are true:
51
+ ## Expert index
255
52
 
256
- 1. Its responsibility requires “and then” to join unrelated observable outcomes.
257
- 2. It validates transport data, decides policy, performs persistence, and formats a response in one body.
258
- 3. It directly uses more than one unrelated external subsystem.
259
- 4. It returns a value while mutating external state not required by its contract.
260
- 5. It owns a transaction while performing network or unrelated slow work.
261
- 6. Its pure decision can be tested only by booting unrelated infrastructure.
262
- 7. A boolean flag switches between unrelated modes.
263
- 8. Error mapping or validation policy is duplicated across layers.
264
- 9. Security, replay, or cleanup state is implicit instead of represented.
53
+ | Expert ID | Select when the contract owns | Read |
54
+ | --- | --- | --- |
55
+ | `code.boundary.v1` | parsing, validation, authorization, ownership, untrusted input | [boundaries-and-ownership.md](references/boundaries-and-ownership.md) |
56
+ | `code.domain.v1` | domain rules, state transitions, narrow types, deterministic decisions | [domain-and-types.md](references/domain-and-types.md) |
57
+ | `code.effects.v1` | database, filesystem, network, process, transaction, resource lifetime | [effects-and-data.md](references/effects-and-data.md) |
58
+ | `code.protocol.v1` | retry, idempotency, concurrency, revisions, external/public protocols | [protocols-and-idempotency.md](references/protocols-and-idempotency.md) |
59
+ | `code.verification.v1` | regression repair, test design, review, compatibility or failure evidence | [verification.md](references/verification.md) |
265
60
 
266
- Do not split when extraction would create a meaningless one-line wrapper, scatter one atomic state machine, or obscure resource ownership.
61
+ Typical selections:
267
62
 
268
- ## Prohibited shortcuts
63
+ - pure calculation: `code.domain.v1`;
64
+ - request parser: `code.boundary.v1` + `code.verification.v1`;
65
+ - transactional write: `code.effects.v1` + `code.protocol.v1`;
66
+ - public API repair: `code.boundary.v1` + `code.protocol.v1` + `code.verification.v1`.
269
67
 
270
- Do not:
68
+ ## Escalation references
271
69
 
272
- - claim static types prove external input is valid;
273
- - cast external data directly into a domain type;
274
- - weaken types merely to satisfy one inconvenient call site;
275
- - mutate input because copying is inconvenient;
276
- - swallow corruption, conflict, partial failure, or uncertain state;
277
- - echo invalid or secret-like values in public failures;
278
- - retry by matching error-message text when structured classification exists;
279
- - run external work inside a write transaction without a documented reason;
280
- - bypass revision, idempotency, identity, authorization, or ownership checks;
281
- - overwrite independently owned state;
282
- - create dozens of trivial wrappers to satisfy a function-count or line-count target;
283
- - change public contracts as incidental cleanup;
284
- - declare completion without naming the verification actually run.
70
+ Read [kiokuko-patterns.md](references/kiokuko-patterns.md) only when a selected fragment needs a fuller TypeScript example. Read [review-checklist.md](references/review-checklist.md) for comprehensive code review or final verification, not for every function edit.
285
71
 
286
- ## Completion gate
72
+ ## Completion report
287
73
 
288
- Before declaring completion, use `references/review-checklist.md`. Read `references/kiokuko-patterns.md` when examples would help; despite the historical filename, its guidance applies across languages and repositories.
74
+ Report the function or WorkUnit contracts changed, selected expert IDs, focused verifier results, and anything not verified. A build alone does not prove boundary, failure, or interaction behavior.
@@ -0,0 +1,50 @@
1
+ <!-- KIOKUKO MANAGED STANDARD SKILL: kiokuko-single-purpose-functions -->
2
+
3
+ # `code.boundary.v1` — boundaries and ownership
4
+
5
+ Select this expert when a function receives data or authority from a caller, user, file, database, environment, network, parser, plugin, or another process.
6
+
7
+ ## Contract
8
+
9
+ The public boundary accepts broad input only long enough to validate and normalize it into a narrow internal value. Reject malformed, ambiguous, oversized, unauthorized, or out-of-scope input before domain work or effects begin.
10
+
11
+ Define explicitly:
12
+
13
+ - what input representations are accepted;
14
+ - whether normalization changes identity or only representation;
15
+ - which limits prevent resource abuse;
16
+ - which caller or principal is authorized;
17
+ - which errors are public and stable;
18
+ - who owns mutable collections, buffers, streams, or objects after the call.
19
+
20
+ Validation must match the actual threat boundary. A TypeScript type annotation does not validate JSON. A UI constraint does not validate an HTTP request. A prior parser does not authorize the current operation.
21
+
22
+ ## Ownership rules
23
+
24
+ - Treat caller-owned inputs as immutable by default. Copy before sorting, filtering in place, deleting keys, or retaining a mutable reference.
25
+ - Do not return internal mutable state directly when callers could corrupt invariants.
26
+ - Make transfer of ownership explicit for streams, handles, transactions, and buffers.
27
+ - Avoid aliases where one layer can mutate data another layer assumes is stable.
28
+ - Preserve original user data through validation failures unless destructive normalization is the explicit contract.
29
+
30
+ ## Boundary shape
31
+
32
+ Prefer a thin public function that performs hostile-boundary work and then calls a constrained private core:
33
+
34
+ ```ts
35
+ function parseCreateRequest(input: unknown): CreateRequest {
36
+ const parsed = createRequestSchema.safeParse(input);
37
+ if (!parsed.success) throw new PublicError('invalid_request');
38
+ return parsed.data;
39
+ }
40
+
41
+ function decideCreate(request: CreateRequest): CreateDecision {
42
+ // No unknown input remains here.
43
+ }
44
+ ```
45
+
46
+ Do not scatter the same validation across several deeper functions. Centralize public error mapping so transport, database, or parser details do not accidentally become the API.
47
+
48
+ ## Focused verification
49
+
50
+ Test at least one valid input, each materially different rejection class, caller-input immutability, and the absence of effects after rejection. For authorization boundaries, include a counterexample that has valid shape but insufficient authority.
@@ -0,0 +1,48 @@
1
+ <!-- KIOKUKO MANAGED STANDARD SKILL: kiokuko-single-purpose-functions -->
2
+
3
+ # `code.domain.v1` — domain rules and narrow types
4
+
5
+ Select this expert when the function decides business rules, computes values, classifies states, or moves an entity through a state machine.
6
+
7
+ ## Contract
8
+
9
+ Domain logic should be deterministic for the same validated input. Keep clocks, randomness, persistence, network calls, environment reads, and logging outside the decision or inject their values explicitly.
10
+
11
+ Model legal states and transitions directly. Prefer narrow unions, enums, tagged results, value objects, and exhaustive branches over booleans or loosely related nullable fields whose combinations can become invalid.
12
+
13
+ Define:
14
+
15
+ - the valid input state;
16
+ - the exact transition or result;
17
+ - invariants preserved before and after;
18
+ - expected domain rejections;
19
+ - whether the operation is total or intentionally partial.
20
+
21
+ ## Cohesion rules
22
+
23
+ - A function may contain several steps when they implement one rule and change for the same reason.
24
+ - Split unrelated policy decisions even if they currently share a caller.
25
+ - Do not extract trivial wrappers that merely rename an expression without creating a useful contract.
26
+ - Do not mix “decide what should happen” with “persist or publish it” when the decision can be represented as data.
27
+
28
+ Example:
29
+
30
+ ```ts
31
+ type Transition =
32
+ | { kind: 'advance'; next: State }
33
+ | { kind: 'reject'; code: 'stale_revision' | 'terminal' };
34
+
35
+ function decideAdvance(current: State, expectedRevision: number): Transition {
36
+ if (current.revision !== expectedRevision) return { kind: 'reject', code: 'stale_revision' };
37
+ if (current.status === 'completed') return { kind: 'reject', code: 'terminal' };
38
+ return { kind: 'advance', next: { ...current, revision: current.revision + 1 } };
39
+ }
40
+ ```
41
+
42
+ ## Failure behavior
43
+
44
+ Expected domain failure is part of the result contract, not an accident to catch broadly. Use one explicit representation consistently. Reserve unexpected exceptions for integrity failures or defects that the current function cannot safely classify.
45
+
46
+ ## Focused verification
47
+
48
+ Test representative valid states, every legal transition family, forbidden transitions, boundary values, and determinism. When a state space is finite, test exhaustiveness or generate a transition table rather than relying only on happy-path examples.
@@ -0,0 +1,43 @@
1
+ <!-- KIOKUKO MANAGED STANDARD SKILL: kiokuko-single-purpose-functions -->
2
+
3
+ # `code.effects.v1` — effects, data, and resource lifetime
4
+
5
+ Select this expert when a contract touches a database, filesystem, network, subprocess, cache, message bus, clock, random source, UI runtime, or long-lived resource.
6
+
7
+ ## Contract
8
+
9
+ Make the effect profile visible at the function boundary. A function that appears pure but reads global state, mutates a cache, logs sensitive data, or launches background work has a misleading contract.
10
+
11
+ Separate four concerns when practical:
12
+
13
+ 1. validate and authorize the request;
14
+ 2. decide the domain change;
15
+ 3. apply effects under an explicit atomicity policy;
16
+ 4. translate infrastructure outcomes into the public result.
17
+
18
+ Do not split a transaction merely to make functions shorter. Operations that must commit or roll back together belong under one transaction owner. Conversely, do not hide unrelated writes inside a function whose name promises only a read or calculation.
19
+
20
+ ## Data integrity
21
+
22
+ - State which writes are atomic and which partial outcomes are possible.
23
+ - Use compare-and-set, revision checks, unique constraints, or locks where concurrent writers can violate invariants.
24
+ - Check affected-row counts when they prove the intended state transition occurred.
25
+ - Never claim persistence before durable completion.
26
+ - Keep schema or serialization compatibility explicit at stored-data boundaries.
27
+ - Do not swallow a failed cleanup, rollback, or close when it changes correctness.
28
+
29
+ ## External effects
30
+
31
+ - Bound time, output, memory, and retries.
32
+ - Define cancellation semantics: cancelling the UI is not the same as cancelling the work.
33
+ - Close files, streams, transactions, child processes, and subscriptions on success and failure.
34
+ - Avoid fire-and-forget work unless ownership, failure reporting, and process lifetime are deliberately defined.
35
+ - Sanitize logs and previews; do not leak secrets or private payloads through diagnostic output.
36
+
37
+ ## Testing seam
38
+
39
+ Inject the narrow effect capability needed by the contract rather than an entire ambient service container. A focused fake should let tests observe calls, order, arguments, cleanup, and failure mapping without reproducing the infrastructure implementation.
40
+
41
+ ## Focused verification
42
+
43
+ Test successful effect order, failure before mutation, failure during mutation, rollback or cleanup, timeout/cancellation, and concurrent or stale writes when applicable. Integration-test the real adapter separately from deterministic domain tests.
@@ -0,0 +1,42 @@
1
+ <!-- KIOKUKO MANAGED STANDARD SKILL: kiokuko-single-purpose-functions -->
2
+
3
+ # `code.protocol.v1` — protocols, concurrency, and idempotency
4
+
5
+ Select this expert when callers retry, messages can be duplicated, state is revisioned, several actors race, or a public/API/storage protocol must remain compatible.
6
+
7
+ ## Contract
8
+
9
+ Identity, ordering, and state transition rules are public behavior. Do not infer them from error text, timestamps, repository-wide “latest” records, or other ambiguous signals.
10
+
11
+ Define:
12
+
13
+ - the stable operation or request identity;
14
+ - which input fields are bound to that identity;
15
+ - the exact legal source states;
16
+ - the expected revision or version;
17
+ - retry and replay behavior;
18
+ - what a duplicate with identical input returns;
19
+ - what a duplicate identity with changed input returns;
20
+ - which actor owns each transition.
21
+
22
+ ## Idempotency
23
+
24
+ A safe idempotent operation distinguishes exact replay from conflicting reuse. Persist or derive a digest from the complete bound input. Return the stored result for an exact replay; reject changed input under the same key.
25
+
26
+ Do not generate a new identity for a transport retry. Do generate a new identity for a new logical operation, even when the visible task text happens to match.
27
+
28
+ ## Concurrency
29
+
30
+ - Check revision and allowed source state in the same atomic mutation.
31
+ - Make ambiguous candidates fail closed or remain unbound; never guess.
32
+ - Treat zero or multiple affected rows as evidence that the expected transition did not occur.
33
+ - Prevent stale completion, retry, or callback results from overwriting newer state.
34
+ - Keep terminal states terminal unless the protocol explicitly defines a new revision or recovery transition.
35
+
36
+ ## Compatibility
37
+
38
+ For versioned APIs or stored structures, accept an older representation only when the compatibility policy is explicit and tested. Do not create silent fallback paths that bypass a new safety invariant. Prefer a clean break when old data cannot satisfy the current contract safely.
39
+
40
+ ## Focused verification
41
+
42
+ Test first execution, exact replay, conflicting reuse, stale revision, wrong source state, concurrent claim, terminal-state behavior, and response compatibility. A text-match test is insufficient when the protocol exposes structured codes or exact identities.
@@ -0,0 +1,41 @@
1
+ <!-- KIOKUKO MANAGED STANDARD SKILL: kiokuko-single-purpose-functions -->
2
+
3
+ # `code.verification.v1` — focused evidence and review
4
+
5
+ Select this expert for regression repair, behavior review, compatibility changes, or any function whose correctness claim depends on evidence beyond ordinary local reasoning.
6
+
7
+ ## Evidence contract
8
+
9
+ Verification must exercise the same boundary and pipeline as the reported or intended behavior. A build does not replace a typecheck. A unit test of a helper does not replace the HTTP, CLI, hook, database, browser, or packaging path that failed.
10
+
11
+ Before editing, state a falsifiable invariant and at least one counterexample. After editing, run the smallest focused verifier that proves the change, then the broader verifier proportional to regression risk.
12
+
13
+ ## Test shape
14
+
15
+ For each changed contract cover:
16
+
17
+ - representative success;
18
+ - important expected failure;
19
+ - the reported regression or a concrete counterexample;
20
+ - absence of forbidden effects after rejection;
21
+ - ownership or immutability when mutable input is possible;
22
+ - concurrency, retry, cancellation, or cleanup when the selected experts require them.
23
+
24
+ Prefer observable behavior over private implementation details. Use deterministic inputs and narrow fakes. Keep test names specific enough to identify the contract and failure class.
25
+
26
+ ## Review method
27
+
28
+ Trace caller to boundary to domain decision to effects to public result. Check generated instructions, stored representations, migrations, packaging manifests, and runtime adapters when they are part of delivery; source code alone may not be the shipped behavior.
29
+
30
+ Classify uncertainty honestly:
31
+
32
+ - verified by a matching runnable test;
33
+ - inspected from source only;
34
+ - blocked by environment or unavailable dependency;
35
+ - not checked.
36
+
37
+ Do not convert a sandbox, listener, DNS, registry, or permission restriction into a product defect without a matching permitted rerun. Do not repeatedly run an unchanged blocked verifier.
38
+
39
+ ## Completion
40
+
41
+ Report exact verifier commands or test names, their result, changed contract scope, and remaining gaps. If only a subset ran, do not claim the full suite passed.
@@ -0,0 +1,72 @@
1
+ ---
2
+ name: kiokuko-soul
3
+ description: Use before every non-trivial Kiokuko-governed task as the mandatory first-read SOUL router. Route applicable Enno-Oduno control, code work, and interactive UI work to the bundled specialist Skills without replacing their contracts.
4
+ ---
5
+
6
+ <!-- KIOKUKO MANAGED STANDARD SKILL: kiokuko-soul -->
7
+
8
+ # Kiokuko SOUL router
9
+
10
+ ## Outcome
11
+
12
+ Start every non-trivial Kiokuko-governed task from one stable routing decision, then read the applicable compact specialist indexes and only the expert fragments required by the current role and work.
13
+
14
+ This Skill routes work. It does not duplicate specialist instructions, invent an Enno-Oduno run, select another model, or authorize effects beyond the user request and current client permissions.
15
+
16
+ ## Required entry
17
+
18
+ Read this Skill before any other bundled Kiokuko Skill.
19
+
20
+ For every `task_prepare` call, set `soulRead: true` only after reading this
21
+ complete local `SKILL.md` for the current logical request. `task_prepare` also
22
+ requires the exact local `kiokuko-soul` capability for every task. Omission,
23
+ false attestation, missing availability, unknown availability, aliases,
24
+ namespaced copies, and fetched references fail closed. The attestation is an
25
+ explicit client claim; it is not remote proof of model cognition.
26
+
27
+ Then inspect the current user request, repository evidence, `task_prepare` or `task_answer` result when present, and any revision-bound Enno-Oduno directive. Treat a returned `nextAction`, role, required-Skill list, and stop condition as authoritative for that run.
28
+
29
+ Read the complete `SKILL.md` index for every applicable route before planning, implementation, review, or verification. Each specialist index defines versioned expert fragments. Read only fragments selected by the approved WorkUnit or concrete task risk; do not load every reference by default. Do not substitute this router's summary for a specialist core contract.
30
+
31
+ ## Routes
32
+
33
+ ### Enno-Oduno control
34
+
35
+ Read and apply `kiokuko-enno-oduno` only when its activation boundary is satisfied:
36
+
37
+ - `task_prepare` or `task_answer` returned `ennoOduno.applicable=true` for the current `enno-oduno` role;
38
+ - a continuation directive resumes that role for an existing run; or
39
+ - the user explicitly asks to inspect or operate an Enno-Oduno run.
40
+
41
+ Do not invent a run, role, revision, WorkUnit, or state transition merely because Kiokuko is present.
42
+
43
+ ### Code work
44
+
45
+ Read and apply the `kiokuko-single-purpose-functions` index before writing, modifying, debugging, refactoring, or reviewing code, and before decomposing a code-changing WorkPlan. Select one to three `code.*` expert fragments for each cohesive function or WorkUnit.
46
+
47
+ ### Interactive UI work
48
+
49
+ Read and apply the `kiokuko-ui-design-soul` index before designing, implementing, modifying, debugging, or reviewing an interactive interface. Select one to three `ui.*` expert fragments for the actual interaction risks. If UI work changes code, apply both the code and UI indexes.
50
+
51
+ ### Combined work
52
+
53
+ Routes compose. Read every applicable specialist index; never choose only one when the task spans multiple contracts. Fragment selection remains narrow inside those routes.
54
+
55
+ Use this order:
56
+
57
+ 1. `kiokuko-soul`;
58
+ 2. `kiokuko-enno-oduno` when the current role requires Enno-Oduno control;
59
+ 3. `kiokuko-single-purpose-functions` for code planning or code work;
60
+ 4. `kiokuko-ui-design-soul` for interactive UI work.
61
+
62
+ The current revision-bound directive may narrow which routes the active role performs. Do not let a later route cross a role boundary or expand an approved WorkUnit.
63
+
64
+ ## Availability and trust
65
+
66
+ When a current directive or capability recommendation marks a routed Skill as required, stop on `required_capability_unavailable`, a blocked Enno-Oduno state, or equivalent unavailable-required-Skill result.
67
+
68
+ Do not satisfy a required bundled Skill with a similarly named, namespaced, fetched, or reference-only Skill. Never install or execute external Skill content automatically.
69
+
70
+ Skill availability alone is not evidence that its contract was applied. The
71
+ mandatory `soulRead: true` attestation makes that claim explicit but does not
72
+ turn it into cryptographic or remote proof.