@nimiplatform/nimi-coding 0.4.0 → 0.6.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 (70) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/CONTRIBUTING.md +1 -1
  3. package/README.md +92 -55
  4. package/README.zh-CN.md +93 -56
  5. package/cli/commands/authority.mjs +80 -125
  6. package/cli/commands/clear.mjs +3 -2
  7. package/cli/commands/code.mjs +225 -0
  8. package/cli/commands/start.mjs +3 -2
  9. package/cli/constants.mjs +2 -1
  10. package/cli/dev/check-authority-surface.mjs +17 -8
  11. package/cli/dev/check-product-conformance.mjs +4 -32
  12. package/cli/dev/run-cli-smoke.mjs +6 -0
  13. package/cli/help.mjs +8 -3
  14. package/cli/index.mjs +3 -2
  15. package/cli/lib/authority/audit.mjs +262 -185
  16. package/cli/lib/authority/change-candidates.mjs +807 -0
  17. package/cli/lib/authority/closed-sets.mjs +7 -8
  18. package/cli/lib/authority/compile.mjs +6 -24
  19. package/cli/lib/authority/compiled-snapshot.mjs +143 -0
  20. package/cli/lib/authority/consumers.mjs +69 -19
  21. package/cli/lib/authority/diagnostics.mjs +10 -2
  22. package/cli/lib/authority/diff.mjs +77 -54
  23. package/cli/lib/authority/format.mjs +4 -32
  24. package/cli/lib/authority/git-snapshot.mjs +34 -379
  25. package/cli/lib/authority/graph.mjs +10 -10
  26. package/cli/lib/authority/impact.mjs +17 -144
  27. package/cli/lib/authority/review.mjs +33 -43
  28. package/cli/lib/authority/sarif.mjs +1 -8
  29. package/cli/lib/authority/source-yaml.mjs +0 -4
  30. package/cli/lib/authority/surface.mjs +19 -1
  31. package/cli/lib/authority/terms.mjs +10 -9
  32. package/cli/lib/authority/validate.mjs +6 -14
  33. package/cli/lib/code/authority-annotation-response.mjs +43 -0
  34. package/cli/lib/code/authority-annotation-scan.mjs +162 -0
  35. package/cli/lib/code/authority-annotations.mjs +293 -0
  36. package/cli/lib/code/context.mjs +710 -0
  37. package/cli/lib/code/response.mjs +165 -0
  38. package/cli/lib/doctor.mjs +3 -2
  39. package/cli/lib/entrypoints.mjs +13 -5
  40. package/cli/seeds/seed-policy.yaml +2 -2
  41. package/contracts/authority-source.schema.yaml +0 -6
  42. package/contracts/authority-verifier-bindings.schema.yaml +21 -10
  43. package/methodology/authority-authoring.yaml +68 -70
  44. package/methodology/core.yaml +10 -6
  45. package/package.json +5 -3
  46. package/spec/authority-audit.yaml +56 -52
  47. package/spec/authority-authoring.yaml +3 -16
  48. package/spec/authority-change-candidates.yaml +146 -0
  49. package/spec/authority-consumers.yaml +7 -0
  50. package/spec/authority-discovery.yaml +2 -2
  51. package/spec/authority-graph.yaml +1 -1
  52. package/spec/authority-impact.yaml +16 -39
  53. package/spec/authority-review.yaml +29 -47
  54. package/spec/authority-terms.yaml +5 -1
  55. package/spec/code-authority-annotations.yaml +42 -0
  56. package/spec/code-context.yaml +38 -0
  57. package/spec/product-scope.yaml +15 -9
  58. package/cli/commands/validate-ai-governance.mjs +0 -335
  59. package/cli/lib/authority/evidence-snapshot.mjs +0 -1
  60. package/cli/lib/authority/evidence.mjs +0 -1432
  61. package/cli/lib/internal/governance/ai/ai-context-budget-core.mjs +0 -377
  62. package/cli/lib/internal/governance/ai/ai-structure-budget-core.mjs +0 -376
  63. package/cli/lib/internal/governance/ai/check-agents-freshness.mjs +0 -155
  64. package/cli/lib/internal/governance/ai/check-high-risk-doc-metadata-core.mjs +0 -173
  65. package/cli/lib/internal/governance/config.mjs +0 -114
  66. package/cli/lib/internal/governance/shared/read-yaml-with-fragments.mjs +0 -49
  67. package/contracts/authority-evidence-bindings.schema.yaml +0 -53
  68. package/contracts/authority-evidence-probe-results.schema.yaml +0 -38
  69. package/contracts/authority-impact-dispositions.schema.yaml +0 -13
  70. package/spec/authority-evidence.yaml +0 -200
package/CHANGELOG.md CHANGED
@@ -2,6 +2,22 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 0.6.0
6
+
7
+ - Made all AI-visible operational guidance resolve the pinned project-local CLI through repository-root `pnpm exec nimicoding`, removing the false global-`PATH` availability assumption.
8
+ - Added experimental `nimicoding code context`: a JSON-only, output-bounded TypeScript 5.9.3 root-direct static context over explicit current-filesystem inputs; it does not claim inbound impact, runtime dispatch, or complete task context. TypeScript 5.9.3 is now a package runtime dependency.
9
+ - Added experimental `nimicoding code authority`: transient JSON-only Authority-to-Code, Code-to-Authority, and lifecycle audit for exact optional `nimi-authority` and `nimi-deprecated` markers in tracked current TypeScript, TSX, and Go source. Managed host instructions teach AI coding hosts to add markers only at key semantic owners and keep unannotated code unevaluated.
10
+ - Removed the legacy optional `validate-ai-governance` command and its threshold, waiver, freshness, and metadata implementation surface without a compatibility path.
11
+
12
+ ## 0.5.0
13
+
14
+ - Hard-cut canonical source admission to `nimicoding.authority/v2`; removed `fmt --upgrade`, `check --require-format`, and all v1 migration/history compatibility paths.
15
+ - Hard-cut the public `authority evidence` surface and impact-disposition contract; implementation/test/gate execution and conformance remain host-project responsibilities.
16
+ - Revised `authority audit`, `authority impact`, and `authority review` to v2 contracts: audit evaluates explicit graph and exact lexical-invariant bindings without positive proof packets, impact is pure before/after analysis, and review reports narrow assurance dimensions with business semantics and implementation conformance explicitly not evaluated.
17
+ - Added explicit-channel `authority change-candidates`, immutable per-invocation compiler snapshots with transient indexes, acronym-bearing term support, and focused source-string escape handling for authority consumer paths; no SQLite, cache, ranking, inferred relation, or semantic judgment is introduced.
18
+ - Reused one immutable snapshot pair across diff and change-derived recall, made audit consume the same read model, normalized fail-closed `partial: false` envelopes, hardened segment-aware path containment, and added corpus-bound audit surface consistency checks.
19
+ - Renamed graph and audit traversal accounting away from proof terminology while preserving complete fail-closed budget enforcement.
20
+
5
21
  ## 0.4.0
6
22
 
7
23
  - Added bounded fail-closed `authority anchors` validation for closed lexical file/script anchors and optional tracked-file scope globs against an exact Git repository root.
package/CONTRIBUTING.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Contributing
2
2
 
3
- Nimi Coding accepts changes to canonical-authority methodology, formatter/compiler primitives, exact managed projections, deterministic authority gates, and optional L3 repository checks. Historical-format reconstruction, product-semantic generation, AI-host control, provider execution, task-state management, and review-state management are outside this package.
3
+ Nimi Coding accepts changes to canonical-authority products, formatter/compiler primitives, exact managed projections, and bounded read-only code queries over explicit inputs or markers. Historical-format reconstruction, product-semantic generation, AI-host control, provider execution, task-state management, and review-state management are outside this package. Code queries remain request-local and do not establish implementation conformance.
4
4
 
5
5
  Before opening a change:
6
6
 
package/README.md CHANGED
@@ -4,13 +4,13 @@
4
4
 
5
5
  **Deterministic authority for AI coding systems and third-party extensions.**
6
6
 
7
- Nimi Coding turns project-owned normative specifications into stable identities, exact source locations, authored relations, and bounded fail-closed machine products. AI hosts, agent frameworks, CI systems, editor tooling, and third-party extensions can use those products to discover authority, assemble evidence, navigate relationships, and review exact changes without treating model inference as repository truth.
7
+ Nimi Coding turns project-owned normative specifications into stable identities, exact source locations, authored relations, and bounded fail-closed machine products. It also derives one bounded, read-only TypeScript outbound context from explicit repository, source, symbol, and tsconfig inputs. AI hosts can use these products without treating model inference as repository truth.
8
8
 
9
9
  Most end users should not need to invoke `nimicoding` directly. The primary integration surface is the documented CLI and its purpose-specific JSON products. Nimi Coding is not an AI agent, planner, code generator, approval workflow, or universal specification language.
10
10
 
11
11
  ## Why it exists
12
12
 
13
- AI models are good at generating code. They are less reliable at determining which document is authoritative, whether a search result is complete, how a rule moved across files, which declared relationships a change affects, or whether available evidence actually proves conformance.
13
+ AI models are good at generating code. They are less reliable at determining which document is authoritative, whether a search result is complete, how a rule moved across files, which declared relationships a change affects, or what a deterministic check actually evaluated.
14
14
 
15
15
  Nimi Coding makes those questions explicit:
16
16
 
@@ -19,11 +19,14 @@ Nimi Coding makes those questions explicit:
19
19
  | Several documents appear authoritative | One closed canonical authority boundary |
20
20
  | Paths and headings change | Stable logical unit IDs independent of files and order |
21
21
  | Search returns noisy or truncated context | Bounded discovery, exact query, declared context, and graph products |
22
+ | A selected TypeScript symbol still requires broad file reading | One explicitly bounded root-direct outbound code-context projection |
23
+ | Authority-to-code links are guessed from names or nearby text | Optional exact authored markers with deterministic bidirectional lookup |
24
+ | A semantic cut leaves unchanged survivors outside declared relations | Change-derived recall over caller-selected exact owner/scope/term/relation/Definition channels |
22
25
  | A model cannot cite the exact source | Portable field- and relation-level SourceMap locations |
23
26
  | Textual diffs obscure semantic change | Stable-ID semantic diff and declared impact obligations |
24
- | “No result” is presented as “clean” | Explicit budgets, completeness, gaps, refusal, and failure semantics |
27
+ | “No result” is presented as “clean” | Explicit budgets, scoped statuses, refusal, and failure semantics |
25
28
  | A Git review may mix moving inputs | Immutable base OID plus race-checked complete worktree capture |
26
- | A file or test name is treated as proof | Evidence and conformance are separate product states |
29
+ | Structural checks are read as product conformance | Business semantics and implementation conformance remain explicitly `not_evaluated` |
27
30
 
28
31
  ## Product model
29
32
 
@@ -38,7 +41,7 @@ Authority Foundation
38
41
  ▼
39
42
  Spec Intelligence Plane
40
43
  discover · query · context · refs/path/subgraph
41
- diff · impact · audit · review · evidence
44
+ diff · change-candidates · impact · audit · review
42
45
  │
43
46
  ▼
44
47
  Purpose-specific JSON / human output / SARIF (audit only)
@@ -56,12 +59,19 @@ Projects own all product meaning. Nimi Coding admits, locates, relates, and deri
56
59
  | Authority Foundation | Canonical YAML/Markdown, formatter, complete-root check, private deterministic compiler and SourceMap | Unknown or unsupported canonical input is rejected, not ignored |
57
60
  | Discovery and exact reads | Exact kind/owner/scope/lifecycle filters, normalized lexical snippets, optional direct relation preview, exact query, bounded declared context | No semantic search, automatic authority selection, or absence proof |
58
61
  | Graph navigation | Incoming/outgoing refs, deterministic paths, bounded subgraphs over `applies_to` and `supersedes` | Only authored relations; no inferred semantic graph |
59
- | Change intelligence | Stable-ID semantic diff and relation-derived impact obligations | Impact is a review requirement, not synchronization proof |
60
- | Deterministic audit | Project-owned verifier bindings, observations/findings/required gaps, JSON and SARIF 2.1.0 | The current built-in detector is a narrow governance verifier, not a natural-language contradiction engine |
61
- | Git-aware review | Immutable base commit plus exact, race-checked current worktree snapshot composed through compile/diff/impact/audit | Read-only; not branch, PR, approval, or release orchestration |
62
- | Authority-to-code evidence | Exact authority/scope to declared package-script command/test target reachability | Static narrow slice only; commands/tests are not executed and completed evidence leaves conformance `not_evaluated` |
62
+ | Change intelligence | Stable-ID semantic diff, change-derived active-survivor recall, and relation-derived impact obligations | Candidate completeness is scoped to explicit channels; impact accepts no disposition or completion state |
63
+ | Deterministic audit | Project-owned bindings for the graph verifier and exact lexical invariants, with JSON and SARIF 2.1.0 | Exact case-sensitive token/phrase checks only; no synonym, embedding, or natural-language contradiction inference |
64
+ | Git-aware review | Immutable base commit plus exact, race-checked current worktree snapshot composed through compile/diff/impact/audit | Read-only; business semantics and implementation conformance are explicitly `not_evaluated` |
65
+ | TypeScript code context | Root declaration source plus root-direct static bindings, portable declaration loci, and eligible target source slices | Explicit `.ts`/`.tsx` root and tsconfig, TypeScript 5.9.3, outbound only; no locating, inbound impact, runtime dispatch, or task-completeness claim |
66
+ | Explicit code-authority links | Transient Authority→Code, Code→Authority, and lifecycle audit over optional exact markers in tracked current `.ts`, `.tsx`, and `.go` source | Marker location only; no declaration ownership, annotation coverage, implementation conformance, or unannotated legacy detection |
63
67
 
64
- The current Nimi-realm validation corpus contains 38 canonical containers, 793 authority units, and 1,260 authored relations. Those figures demonstrate a real large-corpus replay; they are not package limits or a claim that the grammar covers every possible domain.
68
+ The current Nimi-realm validation corpus contains 33 canonical containers, 2,212 authority units, and 2,159 authored relations. Those figures demonstrate a real large-corpus replay; they are not package limits or a claim that the grammar covers every possible domain.
69
+
70
+ ## Using the 0.6 code surface
71
+
72
+ `start` writes package-managed guidance into the marked blocks in `AGENTS.md` and `CLAUDE.md`. On an existing installation, `doctor` diagnoses drift in that guidance and the compact methodology projection; `sync --apply` restores the exact current package projections while preserving host-owned text outside the managed blocks. An AI host that honors repository instructions can therefore learn when to request `code authority` or `code context`, and when a changed authority-governed feature warrants a small number of `nimi-authority` markers at key semantic owners.
73
+
74
+ This is instruction-based integration, not an automatic execution layer. Nimi Coding installs no hook or daemon, intercepts no task, requires no fixed preflight, and owns no task or completion state. The host decides whether a query is useful for the current coding task. `code authority` only recalls explicit markers and current authority lifecycle; `code context` only returns the admitted root-direct TypeScript projection. Neither result proves conformance, replaces affected builds and tests, or evaluates unannotated code.
65
75
 
66
76
  ## Five-minute adoption path
67
77
 
@@ -74,6 +84,8 @@ pnpm exec nimicoding start --yes
74
84
 
75
85
  `start` creates the compact AI-visible authoring guide, managed instruction blocks in `AGENTS.md` and `CLAUDE.md`, and the ignored `.nimi/local/` root. It does not generate product semantics or create `.nimi/spec` for the project.
76
86
 
87
+ `pnpm exec nimicoding` is the supported host invocation: run it from the repository root so automation resolves the pinned project-local package. A global `nimicoding` binary in `PATH` is neither required nor a valid availability check.
88
+
77
89
  Author a complete canonical source such as `.nimi/spec/checkout.authority.yaml`:
78
90
 
79
91
  ```yaml
@@ -97,7 +109,7 @@ units:
97
109
  target: definition.checkout-session
98
110
  ```
99
111
 
100
- > The example is the current v2 authoring format: the container carries `owner` and a single `scope`, and units omit `lifecycle` and empty `relations`. `nimicoding.authority/v1` is a migration input only -- `fmt --upgrade` reads it and emits v2, and history-facing commands still read it -- not a format to author in.
112
+ > `nimicoding.authority/v2` is the only admitted source format. The container carries `owner` and a single `scope`, and units may omit `lifecycle` and empty `relations`. Older source formats fail closed in formatting, admission, compilation, and history-facing analysis; Git history remains the recovery record rather than a compatibility input.
101
113
 
102
114
  Format changed files, admit the complete root, and query one exact unit:
103
115
 
@@ -132,7 +144,7 @@ Only active-unit `meaning`, `statement`, `condition`, and `failure` fields are s
132
144
 
133
145
  Canonical YAML is a closed `format` plus non-empty `units` container. Canonical Markdown is a strict single-unit profile. The model is intentionally compact: `Rule` and `Definition`, `active` and `removed`, `must` and `must_not`, plus authored `applies_to` and linear `supersedes` relations.
134
146
 
135
- If a domain needs member-level API, schema, enum, state-machine, formula, or catalog structure that this grammar does not support, keep that precision in a specialized artifact outside the canonical grammar. Connect it only through an explicitly admitted project binding or adapter; the current built-in evidence slice supports package-script targets, not general API, schema, consumer, or runtime integration. Do not add arbitrary canonical fields: unknown fields fail closed so that no consumer can silently ignore intended authority.
147
+ If a domain needs member-level API, schema, enum, state-machine, formula, or catalog structure that this grammar does not support, keep that precision in a specialized artifact outside the canonical grammar. Connect it through a project-owned adapter when a real integration requires it. Do not add arbitrary canonical fields: unknown fields fail closed so that no consumer can silently ignore intended authority.
136
148
 
137
149
  ## AI host and extension journey
138
150
 
@@ -145,12 +157,11 @@ Task has no exact authority ID
145
157
  → fmt changed sources + check the complete root
146
158
  → review immutable base versus exact worktree
147
159
  (semantic diff + declared impact + current audit)
148
- → separately, if configured, inspect current-worktree evidence
149
160
  ```
150
161
 
151
162
  The host owns authority selection, planning, editing, retries, remediation, review state, and completion. Nimi Coding owns request validation, deterministic computation, explicit budgets, exact locations, and honest result boundaries.
152
163
 
153
- For machine integration, invoke the CLI with an argument array and consume both its exit status and JSON envelope. Read product-specific operation, completeness, policy, gap, and evidence states; never infer clean from an empty candidate/finding array. Invalid usage or internal failure and a completed-but-blocking or incomplete product have distinct command-specific exits.
164
+ For machine integration, invoke the CLI with an argument array and consume both its exit status and JSON envelope. Read each product's scoped operation, analysis, and blocking status; never infer business or implementation conformance from an empty candidate/finding array. Invalid usage or internal failure and a completed-but-blocked product have distinct command-specific exits.
154
165
 
155
166
  In a configured Git project, use exact Git-aware review for one composed authority change product:
156
167
 
@@ -158,16 +169,30 @@ In a configured Git project, use exact Git-aware review for one composed authori
158
169
  pnpm exec nimicoding authority review . \
159
170
  --base origin/main \
160
171
  --bindings .nimi/config/authority-verifiers.yaml \
161
- --dispositions .nimi/local/authority-impact-dispositions.yaml \
162
172
  --max-units 1024 \
163
173
  --max-edges 4096 \
164
174
  --max-bytes 2097152 \
165
175
  --json
166
176
  ```
167
177
 
168
- This example assumes that the repository already owns valid verifier bindings and impact dispositions, and that `origin/main` resolves to a commit containing `.nimi/spec`. `start` intentionally creates none of those project semantics or governance files.
178
+ This example assumes that the repository already owns valid verifier bindings and that `origin/main` resolves to a commit containing `.nimi/spec`. `start` intentionally creates none of those project semantics or policy files.
179
+
180
+ The base ref is resolved once to a full commit OID. The base `.nimi/spec` tree is read from Git objects; the complete current `.nimi/spec` filesystem tree includes tracked unchanged files, edits, deletions, untracked files, and unsupported entries. Capture races, missing objects, invalid corpora, malformed bindings, and insufficient budgets refuse the result instead of publishing mixed analysis. The command never checks out, stashes, resets, stages, commits, or manages a PR.
181
+
182
+ For a redesign or rename that can leave unchanged active survivors outside the declared graph, run change-derived recall over an explicit channel set:
183
+
184
+ ```bash
185
+ pnpm exec nimicoding authority change-candidates path/to/before-spec .nimi/spec \
186
+ --channels direct_relation,definition_identity,definition_title \
187
+ --max-candidates 2048 \
188
+ --max-reasons 20000 \
189
+ --max-bytes 33554432 \
190
+ --json
191
+ ```
192
+
193
+ The result contains each recalled active non-root unit, its raw normative fields and modality, and exact side-qualified reasons. `complete: true` means the full union and all reasons for the caller-requested channels—not semantic relevance, conflict, retirement, authority validity, or implementation conformance. Owner, scope, and changed-term channels are available when the host explicitly wants their broader recall. Source-container proximity is excluded because regrouping is non-semantic and a complete annotation would grow as the root/candidate Cartesian product.
169
194
 
170
- The base ref is resolved once to a full commit OID. The base `.nimi/spec` tree is read from Git objects; the complete current `.nimi/spec` filesystem tree includes tracked unchanged files, edits, deletions, untracked files, and unsupported entries. Capture races, missing objects, invalid corpora, malformed bindings/dispositions, and insufficient budgets refuse the result instead of publishing a mixed or false-clean review. The command never checks out, stashes, resets, stages, commits, or manages a PR.
195
+ Diff, review, and change-derived recall reuse immutable per-invocation compiler snapshots with transient `byId`, owner, scope, container, incoming, and outgoing indexes. Nothing is persisted: SQLite, cache invalidation, incremental compilation, embeddings, and cleanup state remain outside the product until a measured workload justifies them.
171
196
 
172
197
  ## Comparison: old Nimi, current Nimi Coding, and a mature conventional spec stack
173
198
 
@@ -176,7 +201,7 @@ The base ref is resolved once to a full commit OID. The base `.nimi/spec` tree i
176
201
  | Dimension | Pre-refactor Nimi spec system | Current Nimi Coding | Mature conventional spec stack |
177
202
  | --- | --- | --- | --- |
178
203
  | Authority boundary | Human contracts, tables, generated views, maps, and profile rules required precedence conventions | One closed canonical authority root | Several specialized sources of truth, usually without one cross-format boundary |
179
- | Reference corpus shape | 144 mixed files: 101 Markdown, 43 YAML, including 33 generated views and 42 tables | 38 canonical containers compiling to 793 stable units | Project-specific and heterogeneous |
204
+ | Reference corpus shape | 144 mixed files: 101 Markdown, 43 YAML, including 33 generated views and 42 tables | 33 canonical containers compiling to 2,212 stable units | Project-specific and heterogeneous |
180
205
  | Identity | Contract IDs, `R-*` anchors, paths, and table rows were not universal | One stable ID per unit, independent of file, order, move, or regroup | Strong inside some formats, inconsistent across formats |
181
206
  | Domain-internal precision | Some tables modeled entities, required fields, API operations, Prisma/OpenAPI/service locators directly | Many enum/schema/state/catalog details remain atomic prose inside a Definition | OpenAPI, Schema, Protobuf, and dedicated DSLs are strongest in their domains |
182
207
  | Human rationale | Rich contracts and generated guides | Deliberately compact; long rationale belongs outside canonical authority | ADRs and design documents are strongest |
@@ -188,10 +213,10 @@ The base ref is resolved once to a full commit OID. The base `.nimi/spec` tree i
188
213
  | Relationship graph | Links, maps, custom fields, and Atlas-like projections | One authored, bounded `applies_to`/`supersedes` graph | `$ref`, links, imports, and conventions remain format-specific |
189
214
  | Conflict discovery | Custom checks could find project-specific drift | Structural conflicts are deterministic; prose contradictions still require AI/human analysis | Format-local conflicts can be strong; cross-format conflict remains difficult |
190
215
  | Semantic change | File diff and generated drift dominated | Stable-ID semantic diff; rename/regroup/format-only changes can be semantic zero | Prose is line-diffed; specialized formats may have excellent domain diff tools |
191
- | Impact and audit | Project scripts, maps, and team knowledge | Declared relation impact plus project-bound finding/gap semantics | Build graphs, CODEOWNERS, linters, and tests are strong but fragmented |
216
+ | Impact and audit | Project scripts, maps, and team knowledge | Declared relation impact plus configured graph and exact lexical findings | Build graphs, CODEOWNERS, linters, and tests are strong but fragmented |
192
217
  | Git review | No unified exact authority snapshot product | Immutable-base, race-checked worktree review | Usually Git diff plus independent format-specific checks |
193
- | Spec-to-code relationship | Direct paths were detailed but could become stale | A narrow, identity-bound package-script evidence slice exists | Codegen, type checking, and contract tests can be substantially stronger |
194
- | Executable conformance | Some custom scripts checked specific project facts | Intentionally not claimed by current evidence | High-quality tests and executable contracts are strongest |
218
+ | Spec-to-code relationship | Direct paths were detailed but could become stale | Authority core stores no mapping; optional exact code markers provide authored locating only, with unannotated code and conformance not evaluated | Codegen, type checking, and contract tests can be substantially stronger |
219
+ | Executable conformance | Some custom scripts checked specific project facts | Explicitly `not_evaluated` by review | High-quality tests and executable contracts are strongest |
195
220
  | Ecosystem | Highly project-specific | Stable CLI/JSON products, but no public JS SDK or model/tool standard yet | OpenAPI/Schema/test ecosystems and third-party interoperability are mature |
196
221
  | Authoring cost | Multiple representations and generators were expensive | IDs, owners, scopes, lifecycles, and relations require discipline | Lowest during exploration; governance cost rises with corpus size |
197
222
  | Best fit | A project-specific integrated spec system | Stable normative authority control alongside a large, AI-consumed estate of specialized specs | Exploration and specialized API/data/behavior contracts |
@@ -205,44 +230,33 @@ The current architecture is already a strong substrate for AI coding because it
205
230
  Three levels of product truth should remain distinct:
206
231
 
207
232
  1. **Strong today:** stable identity, fail-closed admission, exact SourceMap, authored graph navigation, bounded machine products, semantic diff, and exact Git review.
208
- 2. **Improved but incomplete:** locating and tracing the exact inputs for human/AI conflict review, task-context assembly, owner/scope accountability, and spec-to-code traceability. Contradiction judgment itself is not a deterministic product.
233
+ 2. **Improved but incomplete:** optional authored marker lookup and bounded TypeScript outbound context reduce implementation navigation, while complete task context, unannotated code, and conformance remain unevaluated. Contradiction judgment itself is not a deterministic product.
209
234
  3. **Intentionally not solved:** universal business-semantic completeness, automatic authority selection, executable code conformance, model reasoning, and AI workflow orchestration.
210
235
 
211
- The long-term ceiling is high if Nimi Coding standardizes the authority protocol rather than attempting to absorb every domain language. A model-native ecosystem could train AI systems to discover before guessing, resolve exact IDs, distinguish authored facts from inference, honor gaps and completeness, and request review/evidence after edits. Deterministic runtime products must remain the oracle; model familiarity must never replace admission or evidence.
236
+ The long-term ceiling is high if Nimi Coding standardizes the authority protocol rather than attempting to absorb every domain language. A model-native ecosystem could train AI systems to discover before guessing, resolve exact IDs, distinguish authored facts from inference, honor refusal and scoped status, and request bounded analysis after edits. Deterministic runtime products must remain the oracle; model familiarity must never replace admission or the project's real tests and gates.
212
237
 
213
238
  ## Safety and truth boundaries
214
239
 
215
240
  - Only `*.authority.yaml` and `*.authority.md` under `.nimi/spec/**` are canonical product authority.
216
241
  - IDs, relations, owners, and scopes are declared facts. Nimi Coding does not infer relations or organizational truth from prose.
217
242
  - `discover` is deterministic lexical candidate retrieval, not semantic search, selection, context assembly, or absence proof.
243
+ - `change-candidates` returns the complete union only for explicitly requested deterministic channels. It does not rank, infer conflict, choose retirement, or prove absence outside those channels.
218
244
  - `context` is a complete bounded outgoing interpretation closure, not complete task context.
219
245
  - `audit` evaluates explicitly bound deterministic governance checks; it does not prove that all business rules are non-contradictory.
220
- - `impact` produces declared review obligations; a disposition does not prove implementation or tests are synchronized.
221
- - `review` audits the captured current snapshot and does not attribute a current finding to the change unless a future product explicitly compares finding fingerprints.
246
+ - `impact` reports declared relation impact and host-owned consumer/test follow-up targets. It accepts no disposition or completion state.
247
+ - `review` audits the captured current snapshot and reports `businessSemanticStatus` and `implementationConformanceStatus` as `not_evaluated`; it does not attribute a current finding to the change.
222
248
  - Snapshot no-follow hardening is platform-dependent. On `win32`, Node.js does not expose `O_NOFOLLOW`/`O_DIRECTORY`, so snapshot capture uses surrounding `lstat`/`realpath` validation without descriptor-level no-follow guarantees.
223
- - `evidence` currently proves only declared package-script target reachability. It executes no command or test; every completed evidence product reports `conformanceStatus: not_evaluated`, while refused input returns no evidence product.
224
249
  - Raw AuthorityIR, SourceMap internals, and compiler implementation are package-private. There is currently no public JavaScript API (`exports` is empty).
225
- - `.nimi/local/**` is derived or local evidence, never product authority.
226
-
227
- ## Future roadmap
250
+ - `.nimi/local/**` is derived or local output, never product authority.
228
251
 
229
- The roadmap is paused at the current validated baseline. The entries below are candidate lanes, not implementation authorization, release promises, or an implied sequence. A future iteration should select one real adopter journey at a time.
252
+ ## Future work
230
253
 
231
- | Candidate lane | Intended product | Entry condition |
232
- | --- | --- | --- |
233
- | Stateless AI tool adapter | Typed tools over current bounded JSON products, potentially via MCP or an extension API | A real host integration demonstrates that direct CLI invocation is insufficient |
234
- | General M4 API/consumer evidence | API/consumer locators and producer → API → consumer reachability | A real canonical-authority seam exists; no inference from the current package-script slice |
235
- | D2 IDE/LSP | Live diagnostics, exact-ID navigation/completion, full-snapshot unsaved-buffer overlays | A sustained editor journey justifies a separate delivery unit |
236
- | D3 local Studio | Read-only unit/graph/diff/impact/audit/evidence exploration | Several real review/exploration journeys are validated first |
237
- | D4 external semantic candidates | Model/embedding/reranking candidates with provenance and abstention | Lexical/graph shortcomings are measured on an owner-approved task corpus |
238
- | E1 multi-repository Atlas | Visibility-filtered composition of canonical repository snapshots | Ecosystem repositories, identity, visibility, ownership, and workspace membership are explicit |
239
-
240
- Conditional work remains separate:
254
+ Version 0.6 intentionally stops at the current request-local products. No next phase is implied. A later iteration should begin with one real adopter failure and add only the smallest missing mechanism:
241
255
 
242
- - Structured Definitions, replacement DAGs, owner/scope registries, or a public library API require demonstrated authoring/query/consumer loss.
243
- - Storage, SQLite, cache, or incremental compilation require a real workload to violate a predeclared SLO and profiling to identify repeated parse/index/join as the cause.
244
- - Version bump, tag, publish, ecosystem activation, and release compatibility are independent release decisions.
245
- - AI planning, delegation, execution, approval, task state, model/provider orchestration, and inferred model findings do not belong in the core package.
256
+ - Add a typed host adapter only if direct CLI invocation proves insufficient in actual use.
257
+ - Add unsaved-buffer support only if a sustained editor journey requires it.
258
+ - Add storage, semantic retrieval, or multi-repository composition only after measured use demonstrates a concrete loss that the current transient exact products cannot address.
259
+ - AI planning, delegation, execution, approval, task state, model/provider orchestration, implementation conformance, and completion tracking remain outside the core package.
246
260
 
247
261
  ## Command reference
248
262
 
@@ -253,18 +267,17 @@ The current public integration surface is the CLI. All budgets are explicit posi
253
267
  | Author and admit | `authority fmt`, `authority check`, `authority compile` |
254
268
  | Find and read | `authority discover`, `authority query`, `authority context` |
255
269
  | Navigate | `authority refs`, `authority path`, `authority subgraph` |
256
- | Analyze and review | `authority audit`, `authority diff`, `authority impact`, `authority review` |
270
+ | Analyze and review | `authority audit`, `authority diff`, `authority change-candidates`, `authority impact`, `authority review` |
257
271
  | Validate lexical anchors | `authority anchors` |
258
- | Connect bounded evidence | `authority evidence` |
272
+ | Read implementation context and explicit links | `code context`, `code authority` |
259
273
  | Project lifecycle | `start`, `sync`, `doctor`, `clear` |
260
- | Optional L3 repository governance | `validate-ai-governance` |
261
274
 
262
275
  <details>
263
276
  <summary>Complete authority command syntax</summary>
264
277
 
265
278
  ```text
266
- nimicoding authority fmt <file> [--check] [--upgrade] [--json]
267
- nimicoding authority check <path> [--scope-bindings <file>] [--require-format <format>] [--json]
279
+ nimicoding authority fmt <file> [--check] [--json]
280
+ nimicoding authority check <path> [--scope-bindings <file>] [--json]
268
281
  nimicoding authority compile <path> [--json]
269
282
  nimicoding authority anchors <repository-path> --spec <corpus-path> [--scope-bindings <file>] [--embedded-paths] --max-units <n> --max-anchors <n> --max-bytes <n> [--json]
270
283
  nimicoding authority consumers <repository-path> --spec <corpus-path> [--external-root <scheme>=<path>]... --max-files <n> --max-refs <n> --max-bytes <n> [--json]
@@ -278,31 +291,55 @@ nimicoding authority path <path> <from-id> <to-id> --traversal <directed|inciden
278
291
  nimicoding authority subgraph <path> <id> --direction <incoming|outgoing|both> --relations <comma-separated-relation-types> --depth <n> --max-units <n> --max-edges <n> --max-bytes <n> [--json]
279
292
  nimicoding authority audit <path> --bindings <file> --max-units <n> --max-edges <n> --max-bytes <n> [--json|--sarif]
280
293
  nimicoding authority diff <before-path> <after-path> --max-bytes <n> [--json]
281
- nimicoding authority impact <before-path> <after-path> --dispositions <file> --max-bytes <n> [--json]
282
- nimicoding authority review <repository-path> --base <git-ref> --bindings <file> --dispositions <file> --max-units <n> --max-edges <n> --max-bytes <n> [--json]
283
- nimicoding authority evidence <repository-path> --bindings <tracked-.nimi/config-path> [--probe-results <.nimi/local-path>] --max-units <n> --max-bindings <n> --max-locators <n> --max-edges <n> --max-input-bytes <n> --max-bytes <n> [--json]
294
+ nimicoding authority change-candidates <before-path> <after-path> --channels <comma-separated-closed-set> --max-candidates <n> --max-reasons <n> --max-bytes <n> [--json]
295
+ nimicoding authority impact <before-path> <after-path> --max-bytes <n> [--json]
296
+ nimicoding authority review <repository-path> --base <git-ref> --bindings <file> --max-units <n> --max-edges <n> --max-bytes <n> [--json]
284
297
  ```
285
298
 
286
299
  </details>
287
300
 
301
+ <details>
302
+ <summary>Explicit code-authority marker syntax</summary>
303
+
304
+ ```text
305
+ // nimi-authority: <exact-authority-id>
306
+ // nimi-deprecated: <exact-authority-id>
307
+
308
+ nimicoding code authority --repo <exact-git-worktree-root> (--authority <exact-id>|--source <repo-relative-.ts-.tsx-or-.go-path>|--audit) --max-files <integer> --max-bytes <integer>=512
309
+ ```
310
+
311
+ Markers are optional exact authored links. The command compiles the repository's complete canonical `.nimi/spec`, scans the selected Git-tracked current-filesystem source scope once, and returns one complete compact JSON result or refuses. `nimi-deprecated` records an explicit developer judgment and is reported by the audit; the tool does not infer that judgment or prove marker pairing, declaration ownership, conformance, or hard-cut completion. Unannotated code remains valid and `not_evaluated`. No index, cache, scope binding, report, or task state is written.
312
+
313
+ </details>
314
+
315
+ <details>
316
+ <summary>TypeScript code context syntax</summary>
317
+
318
+ ```text
319
+ nimicoding code context <repo-relative-.ts-or-.tsx-path> --repo <exact-git-worktree-root> --symbol <top-level-identifier> --tsconfig <repo-relative-tsconfig> --max-bytes <integer>=512
320
+ ```
321
+
322
+ The command reads the current filesystem and writes one compact JSON response to stdout. `completed` covers only its closed root-direct static-binding policy. `partial` reports the first output-budget frontier; `refused` contains no usable context product. The command neither edits the repository nor selects, runs, or records verification.
323
+
324
+ </details>
325
+
288
326
  Relation types are a non-empty unique subset of the closed set `applies_to,supersedes`; discovery relation preview requires direction, relation types, and edge budget together.
289
327
 
290
328
  <details>
291
- <summary>Project lifecycle, governance, and global syntax</summary>
329
+ <summary>Project lifecycle and global syntax</summary>
292
330
 
293
331
  ```text
294
332
  nimicoding start [--yes]
295
333
  nimicoding sync [--apply|--check|--dry-run] [--json]
296
334
  nimicoding clear [--yes]
297
335
  nimicoding doctor [--verbose|--json]
298
- nimicoding validate-ai-governance --profile <profile-id> --scope <all|agents-freshness|context-budget|structure-budget|high-risk-doc-metadata> [--json]
299
336
  ```
300
337
 
301
338
  Global presentation options are `--lang en|zh`, `--color`, and `--no-color`.
302
339
 
303
340
  </details>
304
341
 
305
- Projection ownership is exact: `start`/`sync` own only their documented managed paths and marked instruction blocks. Files outside those exact managed surfaces are not inspected or modified by projection sync. Optional `validate-ai-governance` remains separate from authority admission and host task execution.
342
+ Projection ownership is exact: `start`/`sync` own only their documented managed paths and marked instruction blocks. Files outside those exact managed surfaces are not inspected or modified by projection sync. Code queries are request-local and do not participate in authority admission or host task execution.
306
343
 
307
344
  ## Development
308
345