@ps-neko/nekowork 0.1.0-alpha.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 (203) hide show
  1. package/AGENTS.md +112 -0
  2. package/CLAUDE.md +81 -0
  3. package/LICENSE +21 -0
  4. package/README.md +283 -0
  5. package/REVIEW.md +96 -0
  6. package/RULES.md +51 -0
  7. package/SOUL.md +21 -0
  8. package/WORKING-CONTEXT.md +52 -0
  9. package/agent.yaml +219 -0
  10. package/agents/architect.md +57 -0
  11. package/agents/code-reviewer.md +60 -0
  12. package/agents/codex-challenger.md +53 -0
  13. package/agents/codex-reviewer.md +56 -0
  14. package/agents/debugger.md +33 -0
  15. package/agents/doc-writer.md +51 -0
  16. package/agents/executor.md +41 -0
  17. package/agents/planner.md +49 -0
  18. package/agents/research.md +50 -0
  19. package/agents/security-reviewer.md +47 -0
  20. package/agents/test-engineer.md +41 -0
  21. package/bridge/mcp-server.js +301 -0
  22. package/commands/claude-led-codex-review.md +29 -0
  23. package/docs/ADVANCED.md +321 -0
  24. package/docs/AI-DEVELOPMENT-LIFECYCLE.md +105 -0
  25. package/docs/ARCHITECTURE.md +205 -0
  26. package/docs/AUDIT.md +114 -0
  27. package/docs/AUTH-MIGRATION.md +282 -0
  28. package/docs/CHANGELOG.md +97 -0
  29. package/docs/CLI-STAGES.md +89 -0
  30. package/docs/CODEMAPS/README.md +15 -0
  31. package/docs/CODEMAPS/agents.md +22 -0
  32. package/docs/CODEMAPS/bridge.md +18 -0
  33. package/docs/CODEMAPS/hooks.md +28 -0
  34. package/docs/CODEMAPS/manifests.md +14 -0
  35. package/docs/CODEMAPS/rules.md +22 -0
  36. package/docs/CODEMAPS/schemas.md +21 -0
  37. package/docs/CODEMAPS/scripts.md +158 -0
  38. package/docs/CODEMAPS/skills.md +29 -0
  39. package/docs/CODEMAPS/tests.md +98 -0
  40. package/docs/CORE-INVARIANTS.md +38 -0
  41. package/docs/DEMO.md +110 -0
  42. package/docs/EXAMPLE-PROJECT.md +92 -0
  43. package/docs/PORTING.md +154 -0
  44. package/docs/PRODUCT-PRINCIPLES.md +303 -0
  45. package/docs/PUBLISH-ALPHA.md +106 -0
  46. package/docs/QUICKSTART.md +344 -0
  47. package/docs/RELEASE-READINESS.md +140 -0
  48. package/docs/RISK-CLASSIFIER.md +50 -0
  49. package/docs/RUNBOOK.md +146 -0
  50. package/docs/SECURITY.md +79 -0
  51. package/docs/SETUP.md +142 -0
  52. package/docs/WHY-NEKOWORK.md +64 -0
  53. package/docs/case-studies/README.md +16 -0
  54. package/docs/case-studies/SINDRESORHUS-IS-PLAIN-OBJ.md +141 -0
  55. package/docs/dev-log/2026-04-29-p1-recovery.md +142 -0
  56. package/docs/dev-log/2026-04-29-week1-4.md +81 -0
  57. package/docs/examples/GITHUB-ACTIONS-HARDENING.md +86 -0
  58. package/docs/examples/QUALITY-LIFECYCLE-SMOKE.md +32 -0
  59. package/docs/examples/TRADING-DASHBOARD-MOCK.md +65 -0
  60. package/docs/workflows-stash/README.md +32 -0
  61. package/docs/workflows-stash/harness-review.yml +166 -0
  62. package/docs/workflows-stash/harness-validate.yml +48 -0
  63. package/examples/github-actions-hardening/.github/workflows/hardened-validate.yml +38 -0
  64. package/examples/github-actions-hardening/README.md +31 -0
  65. package/examples/github-actions-hardening/case-study/ASK.md +26 -0
  66. package/examples/github-actions-hardening/case-study/GATE_STATUS.md +28 -0
  67. package/examples/github-actions-hardening/case-study/PLAN.md +25 -0
  68. package/examples/github-actions-hardening/case-study/SHIP_READY.md +21 -0
  69. package/examples/github-actions-hardening/case-study/TASK.md +30 -0
  70. package/examples/github-actions-hardening/case-study/TEAM_HANDOFFS.md +37 -0
  71. package/examples/github-actions-hardening/case-study/VERIFY_SUMMARY.md +35 -0
  72. package/examples/github-actions-hardening/case-study/WORK_SUMMARY.md +24 -0
  73. package/examples/github-actions-hardening/package.json +12 -0
  74. package/examples/github-actions-hardening/scripts/check.mjs +43 -0
  75. package/examples/quality-lifecycle-smoke/README.md +30 -0
  76. package/examples/quality-lifecycle-smoke/case-study/ASK.md +24 -0
  77. package/examples/quality-lifecycle-smoke/case-study/GATE_STATUS.md +10 -0
  78. package/examples/quality-lifecycle-smoke/case-study/PLAN.md +19 -0
  79. package/examples/quality-lifecycle-smoke/case-study/SHIP_READY.md +11 -0
  80. package/examples/quality-lifecycle-smoke/case-study/TASK.md +19 -0
  81. package/examples/quality-lifecycle-smoke/case-study/TEAM_HANDOFFS.md +21 -0
  82. package/examples/quality-lifecycle-smoke/case-study/VERIFY_SUMMARY.md +44 -0
  83. package/examples/quality-lifecycle-smoke/case-study/WORK_SUMMARY.md +19 -0
  84. package/examples/quality-lifecycle-smoke/package.json +8 -0
  85. package/examples/quality-lifecycle-smoke/scripts/check.mjs +44 -0
  86. package/examples/trading-dashboard-mock/README.md +33 -0
  87. package/examples/trading-dashboard-mock/case-study/ASK.md +24 -0
  88. package/examples/trading-dashboard-mock/case-study/GATE_STATUS.md +28 -0
  89. package/examples/trading-dashboard-mock/case-study/PLAN.md +23 -0
  90. package/examples/trading-dashboard-mock/case-study/SHIP_READY.md +21 -0
  91. package/examples/trading-dashboard-mock/case-study/TASK.md +29 -0
  92. package/examples/trading-dashboard-mock/case-study/TEAM_HANDOFFS.md +49 -0
  93. package/examples/trading-dashboard-mock/case-study/VERIFY_SUMMARY.md +35 -0
  94. package/examples/trading-dashboard-mock/case-study/WORK_SUMMARY.md +27 -0
  95. package/examples/trading-dashboard-mock/fixtures/market.json +9 -0
  96. package/examples/trading-dashboard-mock/index.html +76 -0
  97. package/examples/trading-dashboard-mock/package.json +9 -0
  98. package/examples/trading-dashboard-mock/scripts/check.mjs +54 -0
  99. package/examples/trading-dashboard-mock/src/app.js +83 -0
  100. package/examples/trading-dashboard-mock/src/styles.css +227 -0
  101. package/hooks/hooks.json +44 -0
  102. package/hooks/scripts/config-protection.js +34 -0
  103. package/hooks/scripts/gateguard-fact-force.js +146 -0
  104. package/hooks/scripts/persistent-mode.mjs +27 -0
  105. package/hooks/scripts/pre-bash-dispatcher.js +63 -0
  106. package/hooks/scripts/quality-gate.js +106 -0
  107. package/manifests/install-components.json +195 -0
  108. package/manifests/install-modules.json +101 -0
  109. package/manifests/install-profiles.json +134 -0
  110. package/package.json +96 -0
  111. package/rules/common/coding-style.md +71 -0
  112. package/rules/common/security.md +69 -0
  113. package/rules/common/testing.md +58 -0
  114. package/rules/python/coding-style.md +80 -0
  115. package/rules/python/testing.md +86 -0
  116. package/rules/typescript/coding-style.md +97 -0
  117. package/rules/typescript/security.md +67 -0
  118. package/rules/typescript/testing.md +78 -0
  119. package/schemas/agent-yaml.schema.json +168 -0
  120. package/schemas/agent.schema.json +32 -0
  121. package/schemas/handoff.schema.json +105 -0
  122. package/schemas/hooks.schema.json +35 -0
  123. package/schemas/install-components.schema.json +46 -0
  124. package/schemas/install-modules.schema.json +39 -0
  125. package/schemas/install-profiles.schema.json +32 -0
  126. package/schemas/install-state.schema.json +42 -0
  127. package/schemas/routing.schema.json +42 -0
  128. package/schemas/skill.schema.json +19 -0
  129. package/scripts/agents/dispatch.js +144 -0
  130. package/scripts/agents/runners/claude.js +214 -0
  131. package/scripts/agents/runners/codex.js +233 -0
  132. package/scripts/agents/runners/gemini.js +92 -0
  133. package/scripts/agents/runners/mock.js +107 -0
  134. package/scripts/auth/github-import-gh.js +52 -0
  135. package/scripts/auth/github-login.js +79 -0
  136. package/scripts/auth/github-logout.js +21 -0
  137. package/scripts/auth/github-status.js +46 -0
  138. package/scripts/build-claude.js +101 -0
  139. package/scripts/build-codemaps.js +286 -0
  140. package/scripts/build-codex.js +93 -0
  141. package/scripts/build-cursor.js +132 -0
  142. package/scripts/build-gemini.js +117 -0
  143. package/scripts/build-opencode.js +117 -0
  144. package/scripts/ci/catalog.js +120 -0
  145. package/scripts/ci/check-markers.js +48 -0
  146. package/scripts/ci/security-hardening.js +270 -0
  147. package/scripts/ci/validate-agents.js +88 -0
  148. package/scripts/ci/validate-hooks.js +99 -0
  149. package/scripts/ci/validate-manifests.js +128 -0
  150. package/scripts/ci/validate-skills.js +93 -0
  151. package/scripts/cli.js +1134 -0
  152. package/scripts/core/auth-guard.js +22 -0
  153. package/scripts/core/build-roots.js +11 -0
  154. package/scripts/core/cli-resolver.js +64 -0
  155. package/scripts/core/execution-workspace.js +84 -0
  156. package/scripts/core/git-mutation-guard.js +79 -0
  157. package/scripts/core/install-state.js +125 -0
  158. package/scripts/core/json-extractor.js +32 -0
  159. package/scripts/core/subprocess.js +74 -0
  160. package/scripts/daemon/wait.js +278 -0
  161. package/scripts/demo-external-project.js +222 -0
  162. package/scripts/demo-quick-run.js +193 -0
  163. package/scripts/demo-review.js +204 -0
  164. package/scripts/doctor.js +296 -0
  165. package/scripts/install-apply.js +185 -0
  166. package/scripts/install-plan.js +411 -0
  167. package/scripts/lib/acceptance-criteria.js +105 -0
  168. package/scripts/lib/costs.js +82 -0
  169. package/scripts/lib/instincts.js +194 -0
  170. package/scripts/lib/keychain.js +85 -0
  171. package/scripts/lib/profile-policy.js +134 -0
  172. package/scripts/lib/profile-safety.js +81 -0
  173. package/scripts/lib/risk-classifier.js +145 -0
  174. package/scripts/lib/router.js +138 -0
  175. package/scripts/lib/severity.js +99 -0
  176. package/scripts/lib/token-vault.js +136 -0
  177. package/scripts/orchestrators/apply.js +225 -0
  178. package/scripts/orchestrators/ask.js +143 -0
  179. package/scripts/orchestrators/gate.js +179 -0
  180. package/scripts/orchestrators/ralph.js +179 -0
  181. package/scripts/orchestrators/review.js +452 -0
  182. package/scripts/orchestrators/run.js +151 -0
  183. package/scripts/orchestrators/ship.js +339 -0
  184. package/scripts/orchestrators/team-lite.js +270 -0
  185. package/scripts/orchestrators/team.js +244 -0
  186. package/scripts/orchestrators/verify.js +306 -0
  187. package/scripts/orchestrators/work.js +207 -0
  188. package/scripts/portability/simulate-port.js +220 -0
  189. package/scripts/repair.js +184 -0
  190. package/scripts/sync-claude-md.js +220 -0
  191. package/scripts/verify/claude-live.js +30 -0
  192. package/scripts/verify/codex-live.js +60 -0
  193. package/scripts/verify/gemini-live.js +48 -0
  194. package/scripts/verify/runtime.js +105 -0
  195. package/skills/claude-led-codex-review/SKILL.md +133 -0
  196. package/skills/plan-eng-review/SKILL.md +51 -0
  197. package/skills/porting/SKILL.md +69 -0
  198. package/skills/ralph/SKILL.md +48 -0
  199. package/skills/release-readiness/SKILL.md +62 -0
  200. package/skills/review/SKILL.md +42 -0
  201. package/skills/security-hardening/SKILL.md +59 -0
  202. package/skills/ship/SKILL.md +44 -0
  203. package/skills/tdd-workflow/SKILL.md +42 -0
@@ -0,0 +1,321 @@
1
+ # Advanced Features
2
+
3
+ The public alpha path focuses on `doctor`, `ask`, `plan`, `team`, `work`, `verify`, `gate`, `ship`, `apply`, `run`, `review`, `review-cycle`, and install/apply. This page keeps the larger runtime surface discoverable without crowding the first-run docs.
4
+
5
+ ## team
6
+
7
+ `team` is the public read-only team handoff command:
8
+
9
+ ```bash
10
+ node scripts/cli.js team "split and review this change" --workers planner,research,security,test --no-write --session team-smoke
11
+ ```
12
+
13
+ Rules:
14
+
15
+ - Workers create handoffs only.
16
+ - No worker runs the `implement` stage.
17
+ - All live Claude calls run in non-interactive handoff mode and are protected by the git mutation guard.
18
+ - The next mutating step must be a single executor work/review cycle.
19
+
20
+ Outputs:
21
+
22
+ - `.harness/state/sessions/<id>/team.json`
23
+ - `.harness/state/sessions/<id>/team-summary.json`
24
+ - `.harness/state/sessions/<id>/handoffs/`
25
+
26
+ ## work
27
+
28
+ `work` is the public single-executor implementation phase:
29
+
30
+ ```bash
31
+ node scripts/cli.js work "implement the accepted plan" --single-executor --session work-smoke
32
+ ```
33
+
34
+ Rules:
35
+
36
+ - Only the `executor` agent runs.
37
+ - Acceptance criteria are required as a session artifact and are written to `acceptance-criteria.json`.
38
+ - Codex review does not run in this command.
39
+ - Ship does not run in this command.
40
+ - Mock mode writes an implement handoff only.
41
+ - Live mode uses an isolated git worktree and persists a diff under the session.
42
+ - The target project is not mutated directly by `work`.
43
+
44
+ Outputs:
45
+
46
+ - `.harness/state/sessions/<id>/work-summary.json`
47
+ - `.harness/state/sessions/<id>/acceptance-criteria.json`
48
+ - `.harness/state/sessions/<id>/handoffs/03-implement.md`
49
+ - `.harness/state/sessions/<id>/handoffs/03-implement.json`
50
+ - `.harness/state/sessions/<id>/diffs/` when live execution produces a diff
51
+
52
+ ## verify
53
+
54
+ `verify` is the public Codex-only verification phase:
55
+
56
+ ```bash
57
+ node scripts/cli.js verify "verify the accepted work" --session work-smoke
58
+ node scripts/cli.js verify "verify sensitive auth work" --session work-smoke --secure
59
+ ```
60
+
61
+ Rules:
62
+
63
+ - A prior `work` handoff in the same session is required.
64
+ - Codex review always runs.
65
+ - Codex challenge runs when `--secure` is set or sensitive task/file names are detected.
66
+ - The shared risk classifier decides challenge and Human Gate policy.
67
+ - Implement does not run.
68
+ - Ship does not run.
69
+ - Critical or blocking findings write `HUMAN_GATE`.
70
+
71
+ Outputs:
72
+
73
+ - `.harness/state/sessions/<id>/verify-summary.json`
74
+ - `.harness/state/sessions/<id>/handoffs/05-codex-review.md`
75
+ - `.harness/state/sessions/<id>/handoffs/06-codex-challenge.md` when secure/challenge is active
76
+ - `.harness/state/sessions/<id>/HUMAN_GATE` when Codex blocks or reports critical findings
77
+
78
+ ## gate
79
+
80
+ `gate` is the explicit human decision phase:
81
+
82
+ ```bash
83
+ node scripts/cli.js gate status --session work-smoke
84
+ node scripts/cli.js gate approve --session work-smoke --reason "Reviewed and accepted the risk"
85
+ node scripts/cli.js gate block --session work-smoke --reason "Release risk rejected"
86
+ ```
87
+
88
+ Rules:
89
+
90
+ - `status` inspects `HUMAN_GATE`, `GATE_APPROVED`, and `GATE_BLOCKED`.
91
+ - `approve` requires an open `HUMAN_GATE` and a reason.
92
+ - `block` requires an existing session and a reason.
93
+ - Approval does not delete `HUMAN_GATE`; it records `GATE_APPROVED` for audit.
94
+ - An explicit block records `GATE_BLOCKED` and keeps `ship` stopped.
95
+ - The target project is not mutated by this command.
96
+
97
+ Outputs:
98
+
99
+ - `.harness/state/sessions/<id>/GATE_APPROVED` when approved
100
+ - `.harness/state/sessions/<id>/GATE_BLOCKED` when blocked
101
+ - `.harness/state/sessions/<id>/gate-summary.json`
102
+ - `.harness/state/sessions/<id>/gate-events.jsonl`
103
+
104
+ ## ship
105
+
106
+ `ship` is the public ship/no-ship readiness phase:
107
+
108
+ ```bash
109
+ node scripts/cli.js ship "prepare ship readiness" --require-clean-gates --session work-smoke
110
+ ```
111
+
112
+ Rules:
113
+
114
+ - A prior `work` handoff in the same session is required.
115
+ - A prior `verify`/`codex-review` handoff in the same session is required.
116
+ - Existing `HUMAN_GATE` blocks ship unless `gate approve` recorded a later approval.
117
+ - Blocking or critical Codex findings write or preserve `HUMAN_GATE`.
118
+ - Financial and deploy-sensitive risk policy is rechecked before readiness.
119
+ - `approve_with_fixes` creates a no-ship handoff rather than a ready marker.
120
+ - The target project is not mutated by this command.
121
+
122
+ Outputs:
123
+
124
+ - `.harness/state/sessions/<id>/ship-summary.json`
125
+ - `.harness/state/sessions/<id>/handoffs/07-ship.md` when not human-gated
126
+ - `.harness/state/sessions/<id>/SHIP_READY` when Codex verification is fully approved
127
+ - `.harness/state/sessions/<id>/NO_SHIP` when fixable findings remain
128
+
129
+ ## apply
130
+
131
+ `apply` is the explicit project-mutation phase for live work diffs:
132
+
133
+ ```bash
134
+ node scripts/cli.js apply --session work-smoke
135
+ node scripts/cli.js apply --session work-smoke --allow-dirty
136
+ ```
137
+
138
+ Rules:
139
+
140
+ - A prior `work` handoff in the same session is required.
141
+ - A prior `verify`/`codex-review` handoff in the same session is required.
142
+ - `SHIP_READY` is required.
143
+ - `NO_SHIP`, open `HUMAN_GATE`, or `GATE_BLOCKED` stops apply.
144
+ - A captured diff from `work --live` is required.
145
+ - The project must be a git worktree.
146
+ - The project worktree must be clean, excluding `.harness/` session state, unless `--allow-dirty` is used.
147
+ - `APPLIED_DIFF` makes apply idempotent unless `--force` is used.
148
+
149
+ Outputs:
150
+
151
+ - `.harness/state/sessions/<id>/APPLIED_DIFF`
152
+ - `.harness/state/sessions/<id>/apply-summary.json`
153
+
154
+ ## run
155
+
156
+ `run` is the public convenience wrapper for the decomposed pipeline:
157
+
158
+ ```bash
159
+ node scripts/cli.js run "implement and verify this change" --session run-smoke
160
+ node scripts/cli.js run "sensitive auth change" --session run-smoke --secure
161
+ node scripts/cli.js run "live change" --session run-smoke --live --apply
162
+ ```
163
+
164
+ Rules:
165
+
166
+ - Runs `work -> verify -> ship`.
167
+ - Does not apply by default.
168
+ - `--secure` is forwarded to `verify`.
169
+ - `--live` is forwarded to `work`, `verify`, and `ship`.
170
+ - `--apply` runs `apply` only when `ship` produced `SHIP_READY`.
171
+ - Open gates stop the run with exit code 3.
172
+ - `NO_SHIP` skips apply and leaves a no-ship readiness handoff.
173
+
174
+ Policy:
175
+
176
+ - `run` is the short safe wrapper for new users.
177
+ - `run` does not call `plan` in the `0.0.3` line.
178
+ - `plan` is recommended before `work` for larger changes.
179
+ - `work` still records `acceptance-criteria.json`, so `run` preserves success criteria evidence.
180
+ - `apply` is always explicit; use `run --apply` only after live work can produce a captured diff.
181
+
182
+ Outputs:
183
+
184
+ - `.harness/state/sessions/<id>/run-summary.json`
185
+ - all normal `work`, `verify`, `ship`, and optional `apply` outputs
186
+
187
+ ## review-cycle
188
+
189
+ `review-cycle` is the explicit compatibility alias for the legacy full workflow:
190
+
191
+ ```bash
192
+ node scripts/cli.js review-cycle "legacy full-cycle smoke" --no-ship
193
+ ```
194
+
195
+ Rules:
196
+
197
+ - It is equivalent to `review` in the `0.0.3` line.
198
+ - It keeps the old `ideate -> plan -> implement -> self-review -> codex-review -> codex-challenge -> ship` behavior discoverable while new automation migrates to `run` or the decomposed commands.
199
+ - It writes `review-summary.json` with `mode: legacy-full-review-cycle`.
200
+ - It may use legacy live-review behavior, so new controlled project mutation should prefer `work --live -> verify -> ship -> apply`.
201
+
202
+ ## team-lite
203
+
204
+ `team-lite` is a lightweight staged team pipeline inspired by OMC concepts:
205
+
206
+ ```bash
207
+ node scripts/cli.js team-lite "split and verify this change" --session team-smoke
208
+ ```
209
+
210
+ Stages:
211
+
212
+ - `team-plan`
213
+ - `team-prd`
214
+ - `team-exec`
215
+ - `team-verify`
216
+ - `team-fix`
217
+
218
+ Product rule:
219
+
220
+ - Team stages produce handoffs and coordination state.
221
+ - Multi-worker phases are read-only by default.
222
+ - Project file mutation belongs to a single executor phase in the main work/review path.
223
+ - Codex verification and human gate policy still apply after team output is used.
224
+ - `team-lite.json` records `mode: advanced-team-lite-handoff`, `mutation: read-only-handoffs`, and `target_project_mutated: false`.
225
+
226
+ Outputs:
227
+
228
+ - `.harness/state/sessions/<id>/team-lite.json`
229
+ - `.harness/state/sessions/<id>/monitor.json`
230
+ - `.harness/state/sessions/<id>/heartbeat.jsonl`
231
+ - `.harness/state/sessions/<id>/handoffs/`
232
+
233
+ ## ralph
234
+
235
+ `ralph` is an explicit opt-in loop that repeats until PRD acceptance criteria pass, a human gate is hit, a cost cap stops it, or `--max-iter` is reached.
236
+
237
+ ```bash
238
+ node scripts/cli.js ralph "finish the acceptance criteria" --max-iter 5
239
+ node scripts/cli.js ralph "finish using the decomposed flow" --engine run --max-iter 5
240
+ ```
241
+
242
+ Rules:
243
+
244
+ - The default engine is `review`, preserving the legacy full review-cycle behavior.
245
+ - `--engine run` repeats the decomposed `run` wrapper instead: `work -> verify -> ship`.
246
+ - Ralph never applies by default; even with the run engine, project mutation still belongs to an explicit `apply` path outside the loop.
247
+ - Each iteration writes a child session such as `<ralph-session>-i1`.
248
+ - The parent session writes `ralph-summary.json` with the selected engine and iteration sessions.
249
+
250
+ Use it only when repeated local iteration is desired. It is not part of the basic quickstart.
251
+
252
+ ## wait
253
+
254
+ `wait` is the persistent wakeup daemon for explicit active sessions:
255
+
256
+ ```bash
257
+ node scripts/cli.js wait status
258
+ node scripts/cli.js wait start
259
+ node scripts/cli.js wait stop
260
+ ```
261
+
262
+ Rules:
263
+
264
+ - The persistent-mode hook writes `wakeup.json` only when a session has an `active` file.
265
+ - The daemon parses `active` and resumes only supported modes: `ralph`, `run`, and `review-cycle`.
266
+ - Ralph active sessions may resume with either `engine: review` or `engine: run`.
267
+ - `HUMAN_GATE` stops resume and writes `wait-summary.json` instead.
268
+ - Failed resume attempts keep `wakeup.json` and add a short backoff.
269
+ - Successful or blocked decisions append `wait-events.jsonl`.
270
+
271
+ This is still an advanced opt-in surface. It does not bypass gates and does not apply diffs by itself.
272
+
273
+ ## instincts
274
+
275
+ Instincts are project-local learning records. Promotion is intentionally manual.
276
+
277
+ ```bash
278
+ node scripts/cli.js instincts list
279
+ node scripts/cli.js instincts ready --blocked
280
+ node scripts/cli.js instincts promote <id>
281
+ ```
282
+
283
+ Promotion requires confidence `1.0`; automatic promotion without human confirmation is outside the 0.0.3 release scope.
284
+
285
+ ## Cost Tracking
286
+
287
+ Cost records are appended to `.harness/costs.jsonl` when live runners report token usage.
288
+
289
+ ```bash
290
+ node scripts/cli.js costs --since=7d
291
+ node scripts/cli.js costs --since=7d --rows
292
+ node scripts/cli.js costs --since=7d --json
293
+ ```
294
+
295
+ These are estimates, not billing records.
296
+
297
+ ## Rust Runtime
298
+
299
+ The Rust runtime under `runtime/` is a supervisor and IPC experiment for persistent operation.
300
+
301
+ Verify it with:
302
+
303
+ ```bash
304
+ npm run verify:runtime
305
+ ```
306
+
307
+ The Node CLI remains the primary 0.0.3 user path.
308
+
309
+ ## Full Builder Surface
310
+
311
+ The install/apply flow builds the configured harness outputs. You can also run builders directly:
312
+
313
+ ```bash
314
+ node scripts/build-claude.js
315
+ node scripts/build-codex.js
316
+ node scripts/build-cursor.js
317
+ node scripts/build-gemini.js
318
+ node scripts/build-opencode.js
319
+ ```
320
+
321
+ Use `HARNESS_PROJECT_ROOT=<target>` to project outputs into another repository while reading catalog inputs from the NEKOWORK checkout.
@@ -0,0 +1,105 @@
1
+ # AI Development Lifecycle
2
+
3
+ NEKOWORK is a local-first AI development quality runtime. Its job is not to collect every useful agent feature; its job is to make AI development disciplined, high-quality, independently verified, and human-gated.
4
+
5
+ ## Position
6
+
7
+ ```text
8
+ Good development habits
9
+ + quality rules, hooks, and skills
10
+ + product-aware scope control
11
+ + read-only multi-agent thinking
12
+ + Codex verification
13
+ + Human Gate and explicit apply
14
+ = NEKOWORK gated AI development runtime
15
+ ```
16
+
17
+ The short slogan remains:
18
+
19
+ ```text
20
+ Claude work -> Codex verification -> Human Gate
21
+ ```
22
+
23
+ ## Product Rules
24
+
25
+ 1. Claude should develop well.
26
+ 2. The workflow should produce high-quality work.
27
+ 3. Independent verification is mandatory before trust.
28
+ 4. Human Gate is a feature, not a failure.
29
+ 5. Multiple agents may think, but only one executor writes.
30
+ 6. Rich skills, hooks, and rules may improve quality, but cannot weaken safety.
31
+ 7. Apply is explicit and evidence-based.
32
+
33
+ ## Absorption Model
34
+
35
+ External project ideas are absorbed as capabilities, not as a new architecture:
36
+
37
+ | Source Pattern | Useful Strength | NEKOWORK Boundary |
38
+ |---|---|---|
39
+ | Development discipline | Brainstorm, plan, TDD, debugging, verification before completion | `quality`, `developer`, and `testing` profiles |
40
+ | Rich agent environment | Skills, hooks, rules, MCP, memory, scanner-style checks | Profile/module based selective install |
41
+ | Product questioning | Product, design, QA, release, and scope control questions | `ask`, `plan`, and `product` profile |
42
+ | Team orchestration | Multiple perspectives and parallel review | `team` read-only handoffs |
43
+ | NEKOWORK core | Codex verification, Human Gate, controlled apply | Non-bypassable runtime invariants |
44
+
45
+ Capabilities can expand. The architecture cannot weaken the verification loop.
46
+
47
+ ## Workflow
48
+
49
+ ```text
50
+ ask
51
+ -> plan
52
+ -> team
53
+ -> work
54
+ -> verify
55
+ -> gate
56
+ -> ship
57
+ -> apply
58
+ ```
59
+
60
+ Quality enters early through `ask` and `plan`, not only at the final review step. Team mode collects multiple perspectives, but the write phase stays single-executor. Verification is independent, gate decisions are explicit, and apply requires evidence.
61
+
62
+ ## Quality Profile
63
+
64
+ The `quality` profile is the disciplined-development bundle:
65
+
66
+ - brainstorm before work
67
+ - test-first planning
68
+ - systematic debugging
69
+ - evidence-based review
70
+ - verification before completion
71
+ - quality gate required
72
+ - Codex verification required
73
+ - Human Gate on critical findings
74
+ - single-executor mutation policy
75
+
76
+ Example:
77
+
78
+ ```bash
79
+ node scripts/install-plan.js --profile quality
80
+ node scripts/cli.js plan "implement feature X" --session feature-x
81
+ node scripts/cli.js run "implement feature X" --profile quality --session feature-x
82
+ node scripts/cli.js verify "verify feature X" --profile quality --strict-quality --session feature-x
83
+ ```
84
+
85
+ `--strict-quality` is opt-in. In normal quality mode, missing evidence or acceptance coverage is recorded as warnings. In strict quality mode, those warnings become a fix-required verification verdict before ship readiness.
86
+
87
+ ## Evidence-Based Review
88
+
89
+ Review findings should be specific enough to audit later:
90
+
91
+ ```json
92
+ {
93
+ "claim": "The implementation may allow real order execution.",
94
+ "evidence": "OrderPanel imports brokerClient from src/api/broker.ts.",
95
+ "severity": "critical",
96
+ "category": "security",
97
+ "required_fix": "Replace brokerClient with a mock adapter before ship.",
98
+ "confidence": 0.91,
99
+ "gate_required": true
100
+ }
101
+ ```
102
+
103
+ The handoff schema allows these fields on issues so Codex review and challenge findings can carry evidence instead of vague objections.
104
+
105
+ `verify-summary.json` can also record structured `acceptance_coverage` rows so acceptance criteria are checked against review evidence instead of only being written at plan time.
@@ -0,0 +1,205 @@
1
+ # Architecture
2
+
3
+ NEKOWORK is the product. HARNESS is the local runtime packaged by NEKOWORK as a local-first AI development harness. The project keeps one canonical catalog and projects it into multiple agent surfaces.
4
+
5
+ ## Core Idea
6
+
7
+ ```text
8
+ agent.yaml
9
+ |
10
+ |-- agents/
11
+ |-- skills/
12
+ |-- hooks/
13
+ |-- rules/
14
+ |-- manifests/
15
+ |
16
+ +--> builders
17
+ |-- .claude/
18
+ |-- .codex/
19
+ |-- .cursor/
20
+ |-- .gemini/
21
+ `-- .opencode/
22
+ ```
23
+
24
+ The canonical source is the repository catalog. Generated harness directories are outputs and can be rebuilt.
25
+
26
+ ## Product Invariants
27
+
28
+ NEKOWORK is a verification runtime, not a general agent pack:
29
+
30
+ ```text
31
+ Claude work -> Codex verification -> Human Gate
32
+ ```
33
+
34
+ Core invariants:
35
+
36
+ - Multi-worker phases are read-only by default.
37
+ - Only one executor may mutate project files in a work cycle.
38
+ - Codex review is the default independent verification path.
39
+ - Secure or sensitive changes require Codex challenge or human gate.
40
+ - Profiles may add capabilities, but they cannot weaken core safety gates.
41
+
42
+ See [PRODUCT-PRINCIPLES.md](PRODUCT-PRINCIPLES.md), [CORE-INVARIANTS.md](CORE-INVARIANTS.md), [CLI-STAGES.md](CLI-STAGES.md), and [RISK-CLASSIFIER.md](RISK-CLASSIFIER.md) for the product contract, stage semantics, and risk policy.
43
+
44
+ ## Runtime Shape
45
+
46
+ ```text
47
+ User command
48
+ |
49
+ +--> scripts/cli.js
50
+ |
51
+ |-- doctor
52
+ |-- install plan/apply
53
+ |-- ask / plan / team / work / verify / gate / ship / apply / run / review / review-cycle
54
+ |-- ralph
55
+ |-- team-lite
56
+ |-- sessions / costs / instincts
57
+ |
58
+ +--> orchestrators/
59
+ |
60
+ +--> agents/dispatch.js
61
+ |
62
+ +--> provider runners
63
+ |-- mock
64
+ |-- claude CLI
65
+ |-- codex CLI
66
+ `-- gemini CLI
67
+ ```
68
+
69
+ Mock mode is the default. Live mode delegates authentication to local provider CLIs.
70
+
71
+ ## Public Flow
72
+
73
+ The public alpha surface is intentionally small:
74
+
75
+ ```bash
76
+ node scripts/cli.js doctor
77
+ node scripts/cli.js install --plan --profile developer
78
+ node scripts/cli.js install --apply --profile developer --project-root <target>
79
+ node scripts/cli.js ask "clarify a risky or ambiguous request" --project-root <target>
80
+ node scripts/cli.js plan "target project smoke" --project-root <target>
81
+ node scripts/cli.js team "target project handoff review" --project-root <target>
82
+ node scripts/cli.js work "single executor implementation" --session work-smoke --project-root <target>
83
+ node scripts/cli.js verify "Codex verification" --session work-smoke --project-root <target>
84
+ node scripts/cli.js gate status --session work-smoke --project-root <target>
85
+ node scripts/cli.js ship "ship readiness" --session work-smoke --project-root <target>
86
+ node scripts/cli.js apply --session work-smoke --project-root <target>
87
+ node scripts/cli.js run "decomposed wrapper" --session run-smoke --project-root <target>
88
+ node scripts/cli.js review "change request" --no-ship --project-root <target>
89
+ node scripts/cli.js review-cycle "legacy full-cycle request" --no-ship --project-root <target>
90
+ ```
91
+
92
+ Advanced features are documented separately:
93
+
94
+ - `team-lite`
95
+ - `ralph`
96
+ - instincts
97
+ - cost tracking
98
+ - Rust runtime
99
+
100
+ ## Review Pipeline
101
+
102
+ The `0.0.3` `review` command remains the Claude-led and Codex-reviewed legacy full cycle. `review-cycle` is an explicit compatibility alias for the same behavior:
103
+
104
+ ```text
105
+ ideate
106
+ -> plan
107
+ -> implement
108
+ -> self-review
109
+ -> codex-review
110
+ -> codex-challenge when secure or sensitive
111
+ -> ship when not --no-ship
112
+ ```
113
+
114
+ The long-term phase model is additive and keeps `review` compatibility during migration:
115
+
116
+ ```text
117
+ ask -> plan -> team -> work -> verify -> gate -> ship -> apply
118
+ ```
119
+
120
+ `ask` is a local question gate. `team` creates read-only handoffs from multiple worker perspectives. `work` lets one executor produce an implement handoff and, in live mode, an isolated workspace diff. `verify` runs Codex-only verification against that prior work handoff. `gate` records explicit human approve/block decisions for `HUMAN_GATE`. `ship` creates a ship/no-ship readiness handoff and refuses to bypass unresolved gates. `apply` is the only decomposed command in this chain that mutates the target project, and only by applying a verified `SHIP_READY` live-work diff. `team-lite` remains an advanced read-only staged handoff experiment. Future `review` can be retired or kept as a compatibility wrapper once callers have migrated to the decomposed commands.
121
+
122
+ `work` does not run Codex review or ship. It also does not mutate the target project directly; live executor changes are captured as a session diff for later verification.
123
+
124
+ `work` also ensures `acceptance-criteria.json` exists. It reuses planned PRD acceptance criteria when available or records a task-derived minimum so verification and ship readiness always have success criteria to inspect.
125
+
126
+ `verify` does not implement or ship. It requires `--session <id>` so it can read the prior `work` handoff and optional diff. Critical or blocking Codex findings write `HUMAN_GATE`.
127
+
128
+ `gate` does not inspect or edit project files. It writes audit markers: `GATE_APPROVED`, `GATE_BLOCKED`, `gate-summary.json`, and `gate-events.jsonl`.
129
+
130
+ `ship` does not implement, verify, publish, deploy, or mutate the target project. It requires both prior `work` and Codex verification handoffs. It writes `SHIP_READY` only for fully approved verification or explicit human gate approval, writes `NO_SHIP` for fixable findings, and stops with a human gate when `HUMAN_GATE` is unresolved or explicitly blocked.
131
+
132
+ `apply` requires `SHIP_READY`, no newer `NO_SHIP`, no unresolved gate, and a captured diff from `work --live`. It applies that diff with `git apply --3way`, records `APPLIED_DIFF`, and leaves commit/push/release actions to the human.
133
+
134
+ `run` is the compatibility-friendly wrapper around the decomposed path. It runs `work -> verify -> ship` and only runs `apply` when `--apply` is explicitly requested and `SHIP_READY` exists. New automation should prefer `run` or the explicit decomposed commands; old automation can continue to use `review` or `review-cycle`.
135
+
136
+ `ralph` is an advanced repeated-iteration loop. Its default engine remains legacy `review` for compatibility, but `ralph --engine run` repeats the decomposed wrapper and records child run sessions. Ralph does not apply diffs; verified mutation still flows through `apply`.
137
+
138
+ `wait` is an advanced persistent wakeup daemon. It watches session `wakeup.json` files, parses the session `active` contract, and resumes only supported modes (`ralph`, `run`, `review-cycle`). It writes `wait-summary.json` / `wait-events.jsonl`, backs off failed resumes, and refuses to resume sessions with `HUMAN_GATE`.
139
+
140
+ Handoffs use five required fields:
141
+
142
+ - `Decided`
143
+ - `Rejected`
144
+ - `Risks`
145
+ - `Files`
146
+ - `Remaining`
147
+
148
+ This keeps Claude and Codex contexts separated and makes review artifacts compact enough to inspect.
149
+
150
+ ## Project Root Split
151
+
152
+ NEKOWORK supports running as a tool inside another repository:
153
+
154
+ ```text
155
+ target-project/
156
+ .harness-tool/ # NEKOWORK tool checkout or submodule
157
+ .harness/ # target project state
158
+ ```
159
+
160
+ The tool root supplies catalog inputs. The target project root receives generated outputs, session state, and git-aware work.
161
+
162
+ ## Authentication Model
163
+
164
+ Provider auth is delegated by default:
165
+
166
+ | Provider | Default auth |
167
+ |---|---|
168
+ | Claude | `claude` local CLI session |
169
+ | Codex | `codex` local CLI session |
170
+ | Gemini | `gemini` or Google local CLI session |
171
+
172
+ Long-lived API key environment variables are warned about or blocked before delegated provider calls unless the user explicitly opts into the metered path.
173
+
174
+ ## Safety Model
175
+
176
+ Key guardrails:
177
+
178
+ - Provider CLI path trust checks reject workspace-local shims by default.
179
+ - Git mutation guards detect unexpected writes from read-only provider phases.
180
+ - Multi-worker phases must stay read-only unless a single executor phase explicitly owns mutation.
181
+ - `security-hardening` checks workflow permissions, action refs, dependency specs, MCP pins, OIDC policy, and package lock presence.
182
+ - `doctor` checks local readiness and generated-output freshness.
183
+ - Human gates remain the final stop for critical or repeated-risk changes.
184
+
185
+ ## Generated Outputs
186
+
187
+ Builders project the catalog into tool-specific files:
188
+
189
+ | Target | Output |
190
+ |---|---|
191
+ | Claude Code | `.claude/` |
192
+ | Codex CLI | `.codex/config.toml` |
193
+ | Cursor | `.cursor/hooks.json` |
194
+ | Gemini CLI | `.gemini/GEMINI.md` |
195
+ | OpenCode | `.opencode/config.json` |
196
+
197
+ `scripts/repair.js` checks install-state hashes and rebuilds stale outputs.
198
+
199
+ ## Release State
200
+
201
+ The current release line is `0.1.0-alpha.0`:
202
+
203
+ - Repository and GitHub tarball release are available.
204
+ - Public npm metadata is prepared, but publish execution is blocked until npm owner auth is available.
205
+ - Clone, submodule, and local checkout integration remain the supported install paths until the package is published.