@nimiplatform/nimi-coding 0.1.0 → 0.2.1

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 (126) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/CODE_OF_CONDUCT.md +28 -0
  3. package/CONTRIBUTING.md +45 -0
  4. package/README.md +371 -344
  5. package/README.zh-CN.md +307 -0
  6. package/SECURITY.md +26 -0
  7. package/adapters/oh-my-codex/README.md +8 -9
  8. package/cli/commands/audit-sweep.mjs +10 -10
  9. package/cli/commands/classify-spec-tree.mjs +5 -0
  10. package/cli/commands/closeout.mjs +3 -0
  11. package/cli/commands/generate-spec-derived-docs.mjs +20 -0
  12. package/cli/commands/generate-spec-migration-plan.mjs +30 -0
  13. package/cli/commands/start.mjs +5 -1
  14. package/cli/commands/surface-validator-command.mjs +49 -0
  15. package/cli/commands/sweep-design.mjs +295 -0
  16. package/cli/commands/sweep.mjs +22 -0
  17. package/cli/commands/sync.mjs +132 -0
  18. package/cli/commands/topic-formatters.mjs +8 -8
  19. package/cli/commands/validate-ai-governance.mjs +167 -46
  20. package/cli/commands/validate-domain-admission.mjs +5 -0
  21. package/cli/commands/validate-guidance-bodies.mjs +5 -0
  22. package/cli/commands/validate-placement.mjs +5 -0
  23. package/cli/commands/validate-projection-edges.mjs +5 -0
  24. package/cli/commands/validate-spec-audit.mjs +5 -1
  25. package/cli/commands/validate-table-family.mjs +5 -0
  26. package/cli/commands/validate-tracked-output-admission.mjs +5 -0
  27. package/cli/constants.mjs +5 -49
  28. package/cli/help.mjs +33 -11
  29. package/cli/index.mjs +20 -2
  30. package/cli/lib/audit-sweep-runtime/admissions.mjs +38 -29
  31. package/cli/lib/audit-sweep-runtime/audit-validity.mjs +8 -0
  32. package/cli/lib/audit-sweep-runtime/chunks.mjs +11 -11
  33. package/cli/lib/audit-sweep-runtime/closeout.mjs +8 -8
  34. package/cli/lib/audit-sweep-runtime/codex-auditor-evidence.mjs +3 -3
  35. package/cli/lib/audit-sweep-runtime/codex-auditor.mjs +10 -10
  36. package/cli/lib/audit-sweep-runtime/common.mjs +7 -7
  37. package/cli/lib/audit-sweep-runtime/format.mjs +3 -3
  38. package/cli/lib/audit-sweep-runtime/ingest.mjs +8 -8
  39. package/cli/lib/audit-sweep-runtime/inventory-spec-chunks.mjs +24 -27
  40. package/cli/lib/audit-sweep-runtime/inventory.mjs +58 -18
  41. package/cli/lib/audit-sweep-runtime/ledger.mjs +1 -1
  42. package/cli/lib/audit-sweep-runtime/p0p1-profile.mjs +2 -2
  43. package/cli/lib/audit-sweep-runtime/remediation.mjs +6 -6
  44. package/cli/lib/audit-sweep-runtime/rerun.mjs +6 -6
  45. package/cli/lib/audit-sweep-runtime/status.mjs +1 -1
  46. package/cli/lib/audit-sweep-runtime/validators.mjs +2 -2
  47. package/cli/lib/authority-convergence.mjs +397 -2
  48. package/cli/lib/blueprint-audit.mjs +5 -5
  49. package/cli/lib/closeout.mjs +126 -3
  50. package/cli/lib/contracts.mjs +21 -17
  51. package/cli/lib/handoff.mjs +29 -11
  52. package/cli/lib/high-risk-admission.mjs +60 -11
  53. package/cli/lib/high-risk-decision.mjs +31 -2
  54. package/cli/lib/high-risk-ingest.mjs +5 -1
  55. package/cli/lib/high-risk-review.mjs +5 -1
  56. package/cli/lib/internal/contracts-parse.mjs +195 -24
  57. package/cli/lib/internal/contracts-validators.mjs +3 -2
  58. package/cli/lib/internal/doctor-bootstrap-surface.mjs +82 -35
  59. package/cli/lib/internal/doctor-delegated-surface.mjs +1 -1
  60. package/cli/lib/internal/doctor-finalize.mjs +12 -8
  61. package/cli/lib/internal/doctor-inspectors.mjs +34 -1
  62. package/cli/lib/internal/governance/ai/ai-context-budget-core.mjs +74 -12
  63. package/cli/lib/internal/governance/ai/ai-structure-budget-core.mjs +24 -6
  64. package/cli/lib/internal/governance/ai/check-agents-freshness.mjs +18 -23
  65. package/cli/lib/internal/surface-taxonomy-validators.mjs +931 -0
  66. package/cli/lib/internal/validators-spec.mjs +229 -20
  67. package/cli/lib/sweep-design-runtime/common.mjs +246 -0
  68. package/cli/lib/sweep-design-runtime/engine.mjs +733 -0
  69. package/cli/lib/sweep-design-runtime/fix-topic.mjs +414 -0
  70. package/cli/lib/sweep-design-runtime/lifecycle.mjs +54 -0
  71. package/cli/lib/sweep-design-runtime/results.mjs +324 -0
  72. package/cli/lib/sweep-design.mjs +8 -0
  73. package/cli/lib/sync.mjs +143 -0
  74. package/cli/lib/topic-artifacts.mjs +186 -0
  75. package/cli/lib/topic-authority-coverage.mjs +73 -0
  76. package/cli/lib/topic-closeout.mjs +560 -0
  77. package/cli/lib/topic-common.mjs +404 -0
  78. package/cli/lib/topic-decisions.mjs +332 -0
  79. package/cli/lib/topic-draft-packets.mjs +126 -7
  80. package/cli/lib/topic-execution.mjs +515 -0
  81. package/cli/lib/topic-goal.mjs +112 -33
  82. package/cli/lib/topic-ledger.mjs +281 -0
  83. package/cli/lib/topic-lifecycle-artifacts.mjs +173 -0
  84. package/cli/lib/topic-root-validation.mjs +288 -0
  85. package/cli/lib/topic-runner-commands.mjs +174 -0
  86. package/cli/lib/topic-runner-deferral.mjs +532 -0
  87. package/cli/lib/topic-runner-stale-gates.mjs +114 -0
  88. package/cli/lib/topic-runner-validation.mjs +138 -0
  89. package/cli/lib/topic-runner.mjs +109 -154
  90. package/cli/lib/topic-scaffold.mjs +252 -0
  91. package/cli/lib/topic-waves.mjs +403 -0
  92. package/cli/lib/topic.mjs +81 -93
  93. package/cli/lib/value-helpers.mjs +6 -1
  94. package/cli/seeds/bootstrap.mjs +96 -20
  95. package/cli/seeds/seed-policy.yaml +67 -0
  96. package/config/bootstrap.yaml +1 -1
  97. package/config/skill-manifest.yaml +4 -2
  98. package/config/spec-generation-inputs.yaml +41 -19
  99. package/contracts/audit-remediation-map.schema.yaml +1 -0
  100. package/contracts/audit-sweep-result.yaml +4 -0
  101. package/contracts/domain-admission.schema.yaml +56 -0
  102. package/contracts/migration-inventory.schema.yaml +80 -0
  103. package/contracts/negative-fixtures.yaml +91 -0
  104. package/contracts/placement-contract.schema.yaml +163 -0
  105. package/contracts/projection-edge.schema.yaml +130 -0
  106. package/contracts/shared-enums.yaml +68 -0
  107. package/contracts/spec-generation-audit.schema.yaml +19 -4
  108. package/contracts/spec-generation-inputs.schema.yaml +130 -29
  109. package/contracts/spec-reconstruction-result.yaml +9 -5
  110. package/contracts/surface-taxonomy.schema.yaml +201 -0
  111. package/contracts/sweep-design-result.yaml +349 -0
  112. package/contracts/table-family.schema.yaml +121 -0
  113. package/contracts/topic-goal.schema.yaml +10 -1
  114. package/contracts/tracked-output-admission.schema.yaml +70 -0
  115. package/contracts/workflow-consumer.schema.yaml +112 -0
  116. package/methodology/audit-sweep-p0p1-recall.yaml +1 -1
  117. package/methodology/spec-reconstruction.yaml +53 -30
  118. package/package.json +19 -4
  119. package/spec/_meta/command-gating-matrix.yaml +33 -0
  120. package/spec/_meta/generate-drift-migration-checklist.yaml +44 -62
  121. package/spec/_meta/governance-routing-cutover-checklist.yaml +3 -3
  122. package/spec/_meta/phase2-impacted-surface-matrix.yaml +14 -14
  123. package/spec/_meta/spec-authority-cutover-readiness.yaml +3 -5
  124. package/spec/_meta/spec-tree-model.yaml +104 -36
  125. package/spec/bootstrap-state.yaml +36 -36
  126. package/spec/product-scope.yaml +13 -10
package/README.md CHANGED
@@ -1,348 +1,375 @@
1
1
  # @nimiplatform/nimi-coding
2
2
 
3
- `@nimiplatform/nimi-coding` is the standalone host-agnostic boundary package
4
- for the Nimi Coding methodology.
5
-
6
- The product goal is to let arbitrary projects install a reusable AI coding
7
- governance toolkit, bootstrap a project-local `.nimi/**` layer, and then use
8
- AI-native authority, packet, and acceptance discipline for high-risk work.
9
-
10
- ## Primary Path
11
-
12
- The primary `nimicoding` path is for an ordinary project with mixed inputs:
13
-
14
- 1. gather code/docs/structure/human notes
15
- 2. hand off `spec_reconstruction` to an external host
16
- 3. generate a canonical tree under `/.nimi/spec/**`
17
- 4. run `validate-spec-tree`
18
- 5. run `validate-spec-audit`
19
- 6. close out reconstruction
20
- 7. hand off `doc_spec_audit` and close it out locally
21
-
22
- `blueprint-audit`, benchmark parity, and direct-copy helpers remain available,
23
- but they are support-only or repo-local special cases. They do not define
24
- default reconstruction completion.
25
-
26
- In this monorepo, `/.nimi/spec/**` is now the repo-wide product authority.
27
- Pre-cutover authority history now lives in Git rather than a repo-local
28
- archive tree. Pre-cutover readiness work was evidence only and did not
29
- authorize the flip by itself.
30
-
31
- ## Current Status
32
-
33
- This repository is boundary-complete for its intended standalone scope.
34
-
35
- Its completed standalone scope is:
36
-
37
- - package identity
38
- - repository foundation
39
- - initial AI-native methodology seed
40
- - package-owned repo-local support profile source for future governance slices
41
- - machine-readable reconstruction, doc-spec-audit, and high-risk execution result contracts
42
- - package-owned canonical high-risk admission schema contract
43
- - seed-only high-risk execution schemas for packet, orchestration-state, prompt, worker-output, and acceptance
44
- - vendor-neutral external host-profile seed
45
- - package-owned external host compatibility contract seed
46
- - host-adapter seed for constrained external execution-host interop
47
- - package-owned admitted host-profile overlay seed for `oh_my_codex`
48
- - package-owned external execution artifact landing-path contract seed
49
- - vendor-neutral external delegated skill runtime contract seed
50
- - vendor-neutral delegated skill installer seed
51
- - fail-closed delegated skill installer result-contract seed
52
- - local-only installer operational evidence-home seed
53
- - fail-closed collapsed installer summary projection lifecycle-contract seed
54
- - package-owned bootstrap source under `config/**`, `contracts/**`, `methodology/**`, and `spec/**`
55
- - a bounded standalone CLI with staged `start`, validation, handoff, local closeout projection, explicit admission, and mechanical execution-artifact validation
56
- - a host-agnostic semantic + interop boundary for external AI hosts such as OMX, Codex, Claude, Gemini, or another contract-observing host
57
-
58
- It intentionally defers:
59
-
60
- - packet-bound run kernel
61
- - provider-backed execution
62
- - scheduler, notification, and automation backend surfaces
3
+ **English** · [简体中文](README.zh-CN.md)
4
+
5
+ [![npm](https://img.shields.io/npm/v/@nimiplatform/nimi-coding.svg?label=npm)](https://www.npmjs.com/package/@nimiplatform/nimi-coding)
6
+ [![license](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
7
+ [![node](https://img.shields.io/badge/node-%3E%3D24-brightgreen.svg)](#requirements)
8
+
9
+ > A **vendor-neutral, AI-native methodology toolkit** for governing
10
+ > high-risk AI-assisted software work. Bootstraps a project-local
11
+ > `.nimi/**` truth surface, ships the `nimicoding` CLI, and turns
12
+ > "AI plausibly finished this" into "the four closure dimensions
13
+ > are evidenced."
14
+
15
+ Reader documentation: <https://docs.nimi.ai/nimicoding>
16
+ npm package: [`@nimiplatform/nimi-coding`](https://www.npmjs.com/package/@nimiplatform/nimi-coding)
17
+
18
+ ---
19
+
20
+ ## Why This Exists
21
+
22
+ AI-assisted implementation routinely produces output that **compiles,
23
+ passes existing tests, looks plausible to a reviewer, and is still
24
+ wrong** about authority, scope, semantics, or product meaning. These
25
+ are not bugs in the conventional sense — they are *closure failures*:
26
+ the work was claimed done in a state where the closure conditions had
27
+ not actually held.
28
+
29
+ A short, non-exhaustive list of failure shapes Nimi Coding is
30
+ designed to catch:
31
+
32
+ - **Stale-doc anchoring** — the assistant follows a document that
33
+ looked authoritative but had drifted from the active spec.
34
+ - **Implicit scope expansion** — the assistant edits an adjacent
35
+ surface "while it's in the file"; ownership silently shifts.
36
+ - **Plausible synthesis** — when authoritative source is missing,
37
+ the assistant invents a coherent answer indistinguishable from a
38
+ real one.
39
+ - **Old-route preservation** — a new route is added alongside the
40
+ old one as "safe migration"; the old route was supposed to be
41
+ deleted.
42
+ - **Build-pass closure** work declared done because tests run,
43
+ even though consumer-facing behavior is wrong.
44
+ - **Pseudo-success** a typed contract failure is hidden behind a
45
+ fallback that returns "something" instead of failing closed.
46
+
47
+ Better prompts and better tests do not address this. The loop
48
+ reviewing the AI's output is the same loop that produced it. Nimi
49
+ Coding introduces **structural separation** instead.
50
+
51
+ ## What Nimi Coding Is (And Is Not)
52
+
53
+ Nimi Coding is **not** another AI coding assistant. It does not write
54
+ code, dispatch to a provider, or run an agent loop.
55
+
56
+ It is the **standalone host-agnostic boundary package** that sits as
57
+ a governance layer under whichever AI host you use (Claude, Codex,
58
+ Gemini, OMX, or your own). It ships:
59
+
60
+ - a package-owned **methodology** under `methodology/**`
61
+ - typed **contracts** under `contracts/**`
62
+ - **bootstrap + host profile** config under `config/**`
63
+ - a **bootstrap spec seed** under `spec/**`
64
+ - the **`nimicoding` CLI** for bootstrap, validation, skill handoff,
65
+ local closeout, topic lifecycle, sweep audit, sweep design, and
66
+ high-risk execution gates
67
+ - **host adapter** profile overlays for external AI hosts
68
+
69
+ It deliberately does **not** ship:
70
+
71
+ - a packet-bound run kernel
72
+ - provider-backed AI execution
73
+ - a scheduler
74
+ - notification infrastructure
75
+ - an automation backend
63
76
  - self-hosted methodology execution
64
77
 
65
- ## CLI Status
66
-
67
- This repository now carries a boundary-complete standalone `nimicoding` CLI.
68
-
69
- At the current stage it provides:
70
-
71
- - executable package bin wiring
72
- - help and version output
73
- - a primary `nimicoding start` entrypoint for bootstrap, resume, and next-stage AI task prep
74
- - a conservative `nimicoding clear` entrypoint for removing package-managed setup without deleting project-owned truth
75
- - a bounded `nimicoding doctor`
76
- - an explicit `nimicoding blueprint-audit` equivalence check for comparing a repo-local blueprint root with the candidate canonical tree under `.nimi/spec`
77
- - a repo-local `pnpm check:spec-authority-cutover-readiness` gate for pre-cutover readiness validation before authority execution
78
- - an explicit `nimicoding handoff` export
79
- - an explicit `nimicoding admit-high-risk-decision` semantic admission surface
80
- - a local-only `nimicoding closeout` projection
81
- - a bounded local-only `nimicoding ingest-high-risk-execution` projection
82
- - a bounded local-only `nimicoding review-high-risk-execution` projection
83
- - a bounded local-only `nimicoding decide-high-risk-execution` projection
84
- - mechanical validators for execution-packet, orchestration-state, prompt, worker-output, and acceptance
85
- - skill-specific result contract seeding for reconstruction, doc/spec audit, and local-only high-risk execution closeout
86
- - seed-only execution contract extraction under `.nimi/contracts/**`
87
- - package-owned bootstrap source projection from `config/**`, `contracts/**`, `methodology/**`, and `spec/**`
88
-
89
- Current `nimicoding start` behavior is intentionally narrow:
90
-
91
- - detect the current project state and continue from the right stage
92
- - create or resume the `.nimi/**` seed by projecting package-owned source into host paths
93
- - seed AI-native spec-reconstruction guidance inside `.nimi/**`
94
- - keep repo-local support-only methodology assets package-owned unless a host explicitly opts into them
95
- - seed package-owned machine contracts inside `.nimi/contracts/**`
96
- - seed package-owned execution schemas for future high-risk methodology artifacts without admitting runtime ownership
97
- - seed canonical skill-manifest, host-profile, installer, delegated runtime contract, installer result contract, installer operational evidence home, and external handoff truth inside `.nimi/**`
98
- - seed canonical host-adapter truth inside `.nimi/**` so external execution hosts can be admitted without becoming semantic owners
99
- - seed canonical collapsed installer summary projection lifecycle truth inside `.nimi/**`
100
- - update `.gitignore` for local runtime state
101
- - optionally update `AGENTS.md` and `CLAUDE.md` as a staged confirmation inside `start`
102
- - explain one step at a time, confirm one step at a time, and apply one step at a time in interactive mode
103
- - prepare one authoritative JSON AI task package for `spec_reconstruction` or `doc_spec_audit` when the current project stage requires it
104
- - let the user choose a target host such as Codex, Claude, or oh-my-codex for that next AI task
105
- - print a short paste-ready prompt directly in the terminal during `start` instead of requiring users to open a generated prompt file
106
- - fail closed on unknown CLI options
107
- - validate bootstrap integrity and delegated-runtime posture with `doctor`
108
- - preserve existing truth files rather than overwriting them
109
- - refuse unsupported bootstrap contract versions
110
-
111
- Current `nimicoding clear` behavior is intentionally narrow:
112
-
113
- - remove only managed AI blocks in `AGENTS.md` and `CLAUDE.md`
114
- - remove only package-owned bootstrap files under `.nimi/config/**`, `.nimi/contracts/**`, and `.nimi/methodology/**` when the local file still exactly matches the packaged seed
115
- - preserve locally modified bootstrap files even when they live under those package-owned bootstrap paths
116
- - preserve `.nimi/spec/**`, `.nimi/local/**`, and `.nimi/cache/**`
117
- - avoid deleting project-owned truth or local operational artifacts implicitly
118
-
119
- ## Topic Lifecycle Reports
120
-
121
- Human-authored local report work now uses a topic lifecycle workspace rooted at:
122
-
123
- - `/.nimi/topics/**`
124
-
125
- Canonical topic lifecycle roots are:
126
-
127
- - `proposal`
128
- - `ongoing`
129
- - `pending`
130
- - `closed`
131
-
132
- The primary organization unit is a topic folder:
133
-
134
- - `.nimi/topics/<state>/YYYY-MM-DD-topic-slug/`
135
-
136
- Each topic folder should carry a lightweight `topic.yaml` state record and may
137
- include:
138
-
139
- - `README.md`
140
- - `design.md`
141
- - `preflight.md`
142
- - `waves.md`
143
- - `packet-*.md`
144
- - `closeout.md`
145
-
146
- Topic folder rules:
147
-
148
- - use sortable date-first topic ids: `YYYY-MM-DD-topic-slug`
149
- - express lifecycle by moving the topic folder between `proposal`, `ongoing`,
150
- `pending`, and `closed`
151
- - keep one canonical copy of a topic at a time
152
- - record lifecycle transitions in `topic.yaml`; do not rely on folder moves
153
- alone as the state evidence surface
154
-
155
- Canonical constraints:
156
-
157
- - human-authored topic lifecycle reports must use
158
- `/.nimi/topics/{proposal|ongoing|pending|closed}/<topic-id>/**`
159
- - flat markdown files directly under `/.nimi/topics/` are outside the
160
- admitted methodology model
161
- - `.local/report/**` is not an accepted root for human-authored topic
162
- lifecycle reports; keep it only for execution evidence or machine outputs
163
- - `.local/work/**` is no longer the primary methodology workspace for
164
- human-authored topic execution materials
165
-
166
- Applicability boundary:
167
-
168
- - topic workflow is intentionally heavy and not the default entrypoint for all
169
- engineering work
170
- - use a topic when the work is authority-bearing, high-risk, cross-module,
171
- multi-wave, or likely to need remediation / re-audit discipline
172
- - small low-risk changes should stay on the ordinary non-topic path unless there
173
- is an explicit reason they need topic-level governance
174
-
175
- Development rhythm:
176
-
177
- - a topic is the canonical home for one major iteration line, not a micro
178
- requirement backlog
179
- - waves are the bounded execution unit inside a topic
180
- - entering `ongoing` requires a topic-local `preflight.md` with one selected
181
- next execution target, a bounded stop line, consumed inputs/contexts, expected
182
- closeout checks, and explicit forbidden reopenings
183
- - `pending` is an optional no-active-development state for topics that are not
184
- ready to close: use it when you want to distinguish "waiting on evidence or
185
- an external trigger" from active `ongoing` work, and record explicit reopen
186
- or close criteria instead of leaving that wait implicit
187
- - each wave should own one primary closure goal and end in a bounded result such
188
- as an authority cut, implementation packet, bounded re-audit, or explicit
189
- pause/defer note
190
- - planning-only waves may harden one execution target, but they must not chain
191
- indefinitely; if no bounded closure is reached after a planning wave, pause or
192
- re-preflight instead of opening unbounded new planning waves
193
- - closeout stays layered: context closure, wave closeout, and final topic
194
- closeout are distinct evidence surfaces
195
-
196
- Avoid the older `slug-YYYY-MM-DD.md` shape because it sorts poorly and makes
197
- cross-report navigation harder. Stable machine report artifacts that are meant
198
- to behave like a current snapshot, such as `blueprint-equivalence-audit.json`,
199
- should keep their fixed names.
200
-
201
- ## Canonical Spec Redesign Prep
202
-
203
- The package now seeds Phase 0 / Phase 1 canonical-spec redesign contracts under
204
- `.nimi/spec/_meta/**` together with rewritten `bootstrap-state.yaml` and
205
- `product-scope.yaml`.
206
-
207
- At this stage:
208
-
209
- - these files are machine contracts and implementation authority for canonical spec generation
210
- - active repository authority now lives under `/.nimi/spec/**`
211
- - `start`, `doctor`, `handoff`, `closeout`, and high-risk gating already read the canonical tree lifecycle instead of treating the old five-file compact model as authoritative completion
212
- - `nimicoding blueprint-audit` remains the explicit audit surface for benchmark-vs-canonical equivalence checks; it does not perform routing changes on its own
213
- - `pnpm check:spec-authority-cutover-readiness` remains a pre-cutover readiness aggregator; after cutover it is historical/preflight-only rather than the active authority source
214
- - canonical spec generation now reads mixed inputs from `.nimi/config/spec-generation-inputs.yaml` and treats any blueprint root as an optional benchmark rather than a universal host assumption
215
- - completed canonical reconstruction now requires both structural validity and file-level auditability under `.nimi/spec/_meta/spec-generation-audit.yaml`
216
- - `nimicoding validate-spec-tree` checks canonical tree structure, while `nimicoding validate-spec-audit` checks per-file grounding, inference, and unresolved-gap tracking
217
-
218
- Current `nimicoding doctor` behavior is intentionally narrow:
219
-
220
- - validate that `.nimi/**` bootstrap seed files are present
221
- - validate that `.nimi/local/` and `.nimi/cache/` exist and remain ignored
222
- - validate bootstrap contract compatibility metadata
223
- - validate bootstrap-only and reconstruction-seeded lifecycle markers
224
- - validate cross-contract reference alignment across manifest, handoff, runtime, installer, and host-profile truth
225
- - validate host-adapter boundary truth and adapter selection posture
226
- - validate admitted package-owned adapter profile overlays for named external hosts
227
- - validate the packaged external host compatibility contract
228
- - expose the supported external host posture, examples, and required/forbidden host behavior
229
- - validate skill result-contract alignment
230
- - validate the packaged high-risk execution result contract
231
- - validate the packaged canonical high-risk admission schema contract
232
- - validate the external execution artifact landing-path contract
233
- - validate seed-only high-risk execution schemas under `.nimi/contracts/**`
234
- - validate handoff context-order readiness for an external AI host
235
- - expose the standalone completion profile, status, completed surfaces, deferred execution surfaces, and promoted parity gaps
236
- - expose the generic external-host compatibility posture, admitted named overlay posture, and future-only host-specific surfaces
237
- - validate canonical `.nimi/spec/high-risk-admissions.yaml` record shape against the packaged admission schema contract when present
238
- - fail closed when lifecycle state, canonical tree readiness, and auditability drift apart
239
- - report local `doc_spec_audit` closeout artifact status without promoting it to semantic truth
240
- - emit either human-readable output or machine-readable JSON with `--json`
241
-
242
- Current `nimicoding handoff` behavior is intentionally narrow:
243
-
244
- - require explicit `--skill <skill-id>`
245
- - export an authoritative machine-readable external handoff payload with `--json`
246
- - optionally project a human-readable host briefing with `--prompt`
247
- - remain host-agnostic: Claude, Codex, Gemini, OMX, or another external host may consume the same contract if it respects the declared boundaries
248
- - export the package-owned host compatibility contract ref, supported host posture, supported host examples, and required/forbidden host behavior
249
- - expose whether a generic external host is compatible, whether a named admitted overlay is merely available or currently selected, and which host-specific surfaces remain future-only
250
- - reuse `doctor` validation and fail closed when bootstrap or delegated handoff posture is invalid
251
- - allow `spec_reconstruction` handoff during bootstrap-only mode
252
- - expose selected named adapter overlay metadata when an admitted host profile is selected
253
- - export `resultContractRef` plus skill-specific closeout summary expectations
254
- - export execution schema refs, expected artifact kinds, expected local artifact roots, and external execution summary status for `high_risk_execution`
255
- - refuse `doc_spec_audit` and `high_risk_execution` handoff until the canonical tree under `.nimi/spec` is ready
256
-
257
- Current `nimicoding closeout` behavior is intentionally narrow:
258
-
259
- - require explicit `--skill`, `--outcome`, and `--verified-at`
260
- - optionally import those fields plus an optional contract-validated `summary` from an external JSON payload with `--from`
261
- - project external skill results into a local-only closeout payload
262
- - optionally write the payload under `.nimi/local/handoff-results/` with `--write-local`
263
- - fail closed if a `completed` outcome contradicts the current canonical-tree or audit state
264
- - support contract-validated local-only summary import for `high_risk_execution`
265
- - fail closed if imported high-risk execution refs escape the declared local artifact roots
266
- - fail closed if imported high-risk execution summaries omit refs, drift in shape, or claim an illegal external execution status
267
- - fail closed if imported `summary` content violates the declared skill result contract
268
- - fail closed if an imported JSON summary does not match the current project or required shape
269
- - never promote local closeout artifacts to project semantic truth
270
-
271
- Current `nimicoding admit-high-risk-decision` behavior is intentionally narrow:
272
-
273
- - require explicit `--from <json>` and `--admitted-at <iso8601>`
274
- - accept only `nimicoding.high-risk-decision.v1` payloads with `decisionStatus: manager_decision_recorded`
275
- - derive `topic_id` and `packet_id` from the mechanically valid attached packet
276
- - project canonical admission preview for `.nimi/spec/high-risk-admissions.yaml`
277
- - write tracked semantic truth only when `--write-spec` is given explicitly
278
- - fail closed on malformed decision payloads, malformed admissions truth, or missing packet identity
279
-
280
- Current `nimicoding ingest-high-risk-execution` behavior is intentionally narrow:
281
-
282
- - require explicit `--from <json>` pointing at a local high-risk closeout artifact
283
- - accept only `high_risk_execution` closeout artifacts with `outcome: completed` and `summary.status: candidate_ready`
284
- - mechanically validate the referenced packet, orchestration-state, prompt, and worker-output artifacts using the packaged validators
285
- - require all evidence refs to exist under the declared local artifact roots
286
- - project a local-only ingest payload and optionally write it under `.nimi/local/handoff-results/`
287
- - fail closed on contract drift, root escape, missing artifacts, or invalid worker-output/prompt/schema shape
288
- - never decide semantic acceptance, disposition, or finding judgment
289
-
290
- Current `nimicoding review-high-risk-execution` behavior is intentionally narrow:
291
-
292
- - require explicit `--from <json>` pointing at a local high-risk ingest artifact
293
- - accept only `nimicoding.high-risk-ingest.v1` payloads with `ok: true`
294
- - project a local-only review-ready attachment payload for manager-owned review
295
- - carry attachment refs, ingest validation evidence, and the declared semantic review owner
296
- - fail closed if the ingest payload is malformed, not local-only, or mechanically invalid
297
- - never decide semantic acceptance, disposition, or finding judgment
298
-
299
- Current `nimicoding decide-high-risk-execution` behavior is intentionally narrow:
300
-
301
- - require explicit `--from <json>`, `--acceptance <path>`, and `--verified-at <iso8601>`
302
- - accept only `nimicoding.high-risk-review.v1` payloads with `ok: true`
303
- - require `reviewStatus: ready_for_manager_review`
304
- - mechanically validate the provided acceptance artifact and require an explicit `Disposition:` line
305
- - project a local-only manager decision payload and optionally write it under `.nimi/local/handoff-results/`
306
- - fail closed if the review payload is malformed, not local-only, or points at another project
307
- - never auto-promote the manager decision into canonical semantic truth without explicit admission
308
-
309
- Current mechanical validator behavior is intentionally narrow:
310
-
311
- - require an explicit artifact path for each validator command
312
- - emit machine-readable `validator-cli-result.v1` JSON on both success and refusal
313
- - validate only the package-owned seed contract shape for execution-packet, orchestration-state, prompt, worker-output, and acceptance
314
- - fail closed on missing required sections, malformed YAML, or seed-contract drift
315
- - avoid semantic acceptance, topic orchestration, scheduler ownership, or provider execution claims
316
-
317
- The package now carries package-owned bootstrap source under `config/**`,
318
- `contracts/**`, `methodology/**`, and `spec/**`. `nimicoding start`
319
- projects those files into a host project's `/.nimi/**`
320
- surface at runtime. The package also carries adapter overlays under
321
- `adapters/**/profile.yaml` so external execution hosts such as
322
- `oh-my-codex` can be admitted as constrained bridges instead of semantic
323
- owners while keeping external execution closeout local-only, root-bounded,
324
- and non-semantic until an explicit manager-owned admission writes canonical
325
- summary truth into `.nimi/spec/high-risk-admissions.yaml`.
326
-
327
- Boundary-complete in this package does not mean promoted-runtime parity. The
328
- package-owned source lives directly under `config/**`, `contracts/**`,
329
- `methodology/**`, and `spec/**`. Only generated or adopted host projects use
330
- `.nimi/**`. Standalone does not add `run-*` commands, provider invocation,
331
- scheduler logic, or transport adapters in this cut.
332
-
333
- ## Intended Direction
334
-
335
- The expected future experience is roughly:
336
-
337
- 1. install `@nimiplatform/nimi-coding`
338
- 2. run `nimicoding start`
339
- 3. confirm or accept managed AI entrypoints
340
- 4. let an external AI host use seeded `.nimi/**` reconstruction guidance, manifest, host-profile, installer, delegated runtime contract, installer result contract, collapsed installer summary projection lifecycle contract, installer operational evidence guidance, and the authoritative handoff JSON contract to
341
- reconstruct the project canonical tree
342
- 5. use the methodology for later high-risk work
343
-
344
- ## Development Posture
345
-
346
- This repository is the standalone boundary package. Deferred runtime surfaces
347
- such as packet-bound execution, provider-backed execution, scheduler,
348
- notification, and automation remain outside the packaged scope.
78
+ Runtime ownership stays with an external AI host. The methodology
79
+ and contracts stay portable. You can change AI hosts tomorrow
80
+ without changing the methodology contract.
81
+
82
+ When a host project runs `nimicoding start`, the package-owned
83
+ sources are *projected* into that project's
84
+ `.nimi/{config,contracts,methodology,spec}/**` surface. The adopted
85
+ project then owns its `.nimi/spec/**` product authority. **The
86
+ package does not make a host read package source paths directly**
87
+ the adopted project always reads its own projected `.nimi/**`.
88
+
89
+ ## The Mental Model
90
+
91
+ Four moves separate Nimi Coding from a checklist:
92
+
93
+ | Move | What it means |
94
+ | --- | --- |
95
+ | **Authority is named** | Every change names where its truth lives (`.nimi/spec/**`), who owns the surface, and what kind of work is happening. |
96
+ | **Execution is packetized** | Implementation is bounded by a frozen packet declaring allowed reads, allowed writes, acceptance invariants, negative tests, stop lines, and reopen conditions — *before* the worker begins. |
97
+ | **Closure is multidimensional** | Four independent closure gates — Authority, Semantic, Consumer, Drift Resistance — must all hold. Three out of four is not closed. |
98
+ | **Roles are separated** | Manager owns wave admission and judgement; Worker owns the packet write set; Auditor performs structural review from a **structurally separate loop** (a different AI session, a different vendor). |
99
+
100
+ See [Four Closures](https://docs.nimi.ai/nimicoding/four-closures) and
101
+ [The Paradigm](https://docs.nimi.ai/nimicoding/the-paradigm) for the
102
+ full framework.
103
+
104
+ ## Who This Is For
105
+
106
+ | Persona | What you get |
107
+ | --- | --- |
108
+ | Solo founder shipping with AI | Team-scale review discipline without a team — route the auditor through a second AI session on the same laptop |
109
+ | Small team (2–5) adopting AI | Structural review redundancy that scales without headcount |
110
+ | OSS maintainer accepting AI-authored PRs | Provable contribution discipline packet boundaries, typed evidence, four-closure gates |
111
+ | Organization under AI-coding compliance pressure | Audit trail and structured acceptance independent of any single AI vendor |
112
+ | Researcher studying AI engineering practice | Observable methodology corpus over real repository history |
113
+
114
+ If you have ever watched an AI-assisted change look complete to every
115
+ available signal type checker green, tests green, reviewer
116
+ approved and turn out to be wrong about authority, scope, or
117
+ product meaning, this package is for you.
118
+
119
+ ## Requirements
120
+
121
+ | Requirement | Version |
122
+ | --- | --- |
123
+ | Node.js | `>=24.0.0` |
124
+ | Package manager (consumer) | npm, pnpm, yarn, or compatible |
125
+ | pnpm (repository development) | `>=10.0.0` |
126
+
127
+ A version-controlled project is recommended `start` creates files.
128
+
129
+ ## Install
130
+
131
+ In the repository that should receive the `.nimi/**` governance
132
+ layer:
133
+
134
+ ```bash
135
+ npm install --save-dev @nimiplatform/nimi-coding
136
+ # or
137
+ pnpm add -D @nimiplatform/nimi-coding
138
+ ```
139
+
140
+ Check the CLI:
141
+
142
+ ```bash
143
+ npx nimicoding --version
144
+ npx nimicoding --help
145
+ ```
146
+
147
+ ## 5-Minute Minimal Path
148
+
149
+ Most projects should start small. The first successful path is:
150
+
151
+ ```bash
152
+ # 1. Bootstrap .nimi/** in your project root
153
+ npx nimicoding start
154
+
155
+ # 2. Check the bootstrap is healthy
156
+ npx nimicoding doctor --json
157
+
158
+ # 3. Hand off canonical spec reconstruction to your AI host
159
+ npx nimicoding handoff --skill spec_reconstruction --json
160
+
161
+ # 4. After the host consumes that payload and materializes .nimi/spec/**,
162
+ # validate the canonical tree
163
+ npx nimicoding validate-spec-tree .nimi/spec
164
+ npx nimicoding validate-spec-audit
165
+ ```
166
+
167
+ After this, you have a project-local `.nimi/**` truth surface, a
168
+ typed reconstruction of project authority into `.nimi/spec/**`, and
169
+ mechanical validators you can re-run on every change.
170
+
171
+ `handoff` exports an authoritative task payload. It does not call an AI
172
+ provider or run the reconstruction itself; the external host must
173
+ consume the payload, write or return the expected artifacts, and then
174
+ the local validators check the result.
175
+
176
+ You do **not** need to create topics, freeze packets, or run
177
+ high-risk gates for ordinary low-risk changes. Those tools exist for
178
+ authority-bearing, cross-module, multi-wave, or audit-sensitive work.
179
+
180
+ To remove only package-managed bootstrap material from a test
181
+ project (preserves `.nimi/spec/**`, `.nimi/local/**`, `.nimi/cache/**`,
182
+ and locally modified bootstrap files):
183
+
184
+ ```bash
185
+ npx nimicoding clear --yes
186
+ ```
187
+
188
+ ## When You Need More: Topics, Waves, Packets
189
+
190
+ For authority-bearing, high-risk, or cross-module work, escalate to
191
+ the topic lifecycle. A topic groups one strategic change; waves split
192
+ the topic into bounded units of work; each wave freezes a **packet**
193
+ before the worker begins.
194
+
195
+ ```bash
196
+ nimicoding topic create <slug> --justification <text>
197
+ nimicoding topic wave add <topic-id> <wave-id> <slug> \
198
+ --goal <text> --owner-domain <domain>
199
+ nimicoding topic packet freeze <topic-id> --from <draft-path>
200
+ nimicoding handoff --skill high_risk_execution --json
201
+ nimicoding ingest-high-risk-execution --from result.json
202
+ nimicoding review-high-risk-execution --from ingest.json
203
+ nimicoding decide-high-risk-execution --from review.json \
204
+ --acceptance accept.md --verified-at <iso8601>
205
+ ```
206
+
207
+ Each step is bounded by typed validation. Skipping a step or
208
+ smuggling fields through means the CLI refuses (fail closed, no
209
+ exceptions).
210
+
211
+ ## The Four Declared Skills
212
+
213
+ External AI hosts implement these skills; the `handoff` CLI emits a
214
+ machine-readable payload for each:
215
+
216
+ | Skill | Purpose | Required at bootstrap |
217
+ | --- | --- | --- |
218
+ | `spec_reconstruction` | Reconstruct canonical project authority into `.nimi/spec/**` with source basis and unresolved-gap tracking | yes |
219
+ | `doc_spec_audit` | Audit per-file grounding and inference against the canonical tree | yes |
220
+ | `audit_sweep` | Split a target root into auditable chunks and record typed evidence | no |
221
+ | `high_risk_execution` | Execute admitted high-risk packets with typed packet / orchestration / prompt / worker-output / acceptance evidence | no |
222
+
223
+ See [Skills](https://docs.nimi.ai/nimicoding/skills) for contract
224
+ detail.
225
+
226
+ ## CLI Surface
227
+
228
+ Common commands, grouped by entry scenario:
229
+
230
+ ```bash
231
+ # Bootstrap
232
+ nimicoding start
233
+ nimicoding sync --check
234
+ nimicoding doctor --json
235
+ nimicoding clear --yes
236
+
237
+ # Skill handoff and local closeout
238
+ nimicoding handoff --skill <id> --json
239
+ nimicoding closeout --from result.json --write-local
240
+
241
+ # Spec audit
242
+ nimicoding validate-spec-tree .nimi/spec
243
+ nimicoding validate-spec-audit
244
+ nimicoding blueprint-audit
245
+
246
+ # Topic lifecycle
247
+ nimicoding topic create <slug> --justification <text>
248
+ nimicoding topic wave add|select|admit ...
249
+ nimicoding topic packet freeze ...
250
+ nimicoding topic worker dispatch ...
251
+ nimicoding topic result record ...
252
+ nimicoding topic closeout ...
253
+ nimicoding topic true-close-audit ...
254
+ nimicoding topic run-next-step <topic-id> --json
255
+
256
+ # Sweep audit / sweep design
257
+ nimicoding sweep audit plan --root <dir> --json
258
+ nimicoding sweep audit chunk ...
259
+ nimicoding sweep design intake|packet-build|result-ingest|finalize ...
260
+
261
+ # High-risk execution gates
262
+ nimicoding admit-high-risk-decision --from <json> --admitted-at <iso8601>
263
+ nimicoding ingest-high-risk-execution --from <json>
264
+ nimicoding review-high-risk-execution --from <json>
265
+ nimicoding decide-high-risk-execution --from <json> \
266
+ --acceptance <path> --verified-at <iso8601>
267
+
268
+ # Mechanical artifact validators
269
+ nimicoding validate-execution-packet <path>
270
+ nimicoding validate-orchestration-state <path>
271
+ nimicoding validate-prompt <path>
272
+ nimicoding validate-worker-output <path>
273
+ nimicoding validate-acceptance <path>
274
+ ```
275
+
276
+ Conceptual CLI overview:
277
+ <https://docs.nimi.ai/nimicoding/cli>
278
+ Field-level reference:
279
+ <https://docs.nimi.ai/nimicoding/reference/cli-commands>
280
+
281
+ ## How Does This Compare To
282
+
283
+ | | Cursor / Copilot / Claude Code | Lint / TDD / Code review | Nimi Coding |
284
+ | --- | --- | --- | --- |
285
+ | Writes code | yes | no | **no** |
286
+ | Catches local bugs | partial | yes | n/a |
287
+ | Catches authority drift | no | no | **yes** |
288
+ | Catches consumer-closure failure | no | no | **yes** |
289
+ | Vendor lock-in | yes (per tool) | no | **no — host-agnostic** |
290
+ | Audit trail across AI sessions | chat transcript | PR comments | **typed evidence under `.nimi/**`** |
291
+
292
+ Nimi Coding sits *underneath* the AI host you already use. It is the
293
+ machinery that lets the work AI did graduate from "looks done" to
294
+ "closed across four dimensions, with evidence."
295
+
296
+ ## Repository Map
297
+
298
+ | Path | Purpose |
299
+ | --- | --- |
300
+ | `bin/nimicoding.mjs` | Executable package binary |
301
+ | `cli/**` | CLI implementation |
302
+ | `config/**` | Package-owned bootstrap and host profile source |
303
+ | `contracts/**` | Package-owned machine-readable schemas and contracts |
304
+ | `methodology/**` | Package-owned methodology source (policies) |
305
+ | `spec/**` | Bootstrap spec seed and package scope source |
306
+ | `adapters/**` | External host adapter profile overlays (e.g. `oh-my-codex`) |
307
+ | `test/**` | Node test suite and fixtures |
308
+
309
+ Adopted projects use `.nimi/**` for the projected layer. This
310
+ repository itself keeps the package-owned source directly under
311
+ `config/**`, `contracts/**`, `methodology/**`, and `spec/**`.
312
+
313
+ ## Development
314
+
315
+ ```bash
316
+ pnpm install
317
+ pnpm test # runs the node:test suite (329 tests at 0.2.1)
318
+ pnpm check:pack # npm pack --dry-run
319
+ pnpm check:ci # test + pack + CLI help/version smoke
320
+ ```
321
+
322
+ Local CLI smoke:
323
+
324
+ ```bash
325
+ node ./bin/nimicoding.mjs --version
326
+ node ./bin/nimicoding.mjs --help
327
+ ```
328
+
329
+ Before opening a pull request, read [CONTRIBUTING.md](CONTRIBUTING.md).
330
+ The short version: keep changes scoped, preserve the host-agnostic
331
+ boundary, do not add runtime ownership unless the methodology
332
+ contract is explicitly redesigned, and run the relevant tests before
333
+ claiming the work is done.
334
+
335
+ ## Publishing
336
+
337
+ Releases are tag-driven through GitHub Actions. A `vX.Y.Z` tag
338
+ publishes the matching `package.json` version after tests, dry-run
339
+ packing, and CLI smoke checks pass. The workflow also supports a
340
+ manual dry-run release gate.
341
+
342
+ The package publishes with npm provenance enabled.
343
+
344
+ ## Security
345
+
346
+ Do not disclose vulnerabilities in public GitHub issues. Use a
347
+ private channel:
348
+
349
+ - GitHub private security advisory for
350
+ [`nimiplatform/nimi-coding`](https://github.com/nimiplatform/nimi-coding/security/advisories/new)
351
+ - `security@nimi.ai`
352
+
353
+ See [SECURITY.md](SECURITY.md) for the supported reporting path.
354
+
355
+ ## Documentation
356
+
357
+ Full reader documentation lives at <https://docs.nimi.ai/nimicoding>,
358
+ including:
359
+
360
+ - [The Paradigm](https://docs.nimi.ai/nimicoding/the-paradigm)
361
+ - [Four Closures](https://docs.nimi.ai/nimicoding/four-closures)
362
+ - [False Closure Typology](https://docs.nimi.ai/nimicoding/false-closure-typology)
363
+ - [Forbidden Shortcuts](https://docs.nimi.ai/nimicoding/forbidden-shortcuts)
364
+ - [Role Separation](https://docs.nimi.ai/nimicoding/role-separation)
365
+ - [Topic Lifecycle](https://docs.nimi.ai/nimicoding/topic-lifecycle)
366
+ - [The Package](https://docs.nimi.ai/nimicoding/the-package)
367
+ - [CLI Surface](https://docs.nimi.ai/nimicoding/cli)
368
+ - [Installation](https://docs.nimi.ai/nimicoding/installation)
369
+ - [Adoption Path](https://docs.nimi.ai/nimicoding/adoption-path)
370
+ - [Comparison](https://docs.nimi.ai/nimicoding/comparison)
371
+ - [Walkthrough](https://docs.nimi.ai/nimicoding/walkthrough)
372
+
373
+ ## License
374
+
375
+ MIT. See [LICENSE](LICENSE).