renma 0.18.0 → 0.18.2

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 (74) hide show
  1. package/CHANGELOG.md +101 -1
  2. package/README.md +61 -3
  3. package/architecture.md +7 -6
  4. package/design.md +39 -32
  5. package/dist/agent-skills.d.ts +5 -6
  6. package/dist/agent-skills.d.ts.map +1 -1
  7. package/dist/agent-skills.js +2 -10
  8. package/dist/agent-skills.js.map +1 -1
  9. package/dist/catalog.d.ts +27 -1
  10. package/dist/catalog.d.ts.map +1 -1
  11. package/dist/catalog.js +62 -16
  12. package/dist/catalog.js.map +1 -1
  13. package/dist/cli-help.d.ts +8 -8
  14. package/dist/cli-help.d.ts.map +1 -1
  15. package/dist/cli-help.js +19 -4
  16. package/dist/cli-help.js.map +1 -1
  17. package/dist/command-invocation.d.ts +4 -0
  18. package/dist/command-invocation.d.ts.map +1 -0
  19. package/dist/command-invocation.js +14 -0
  20. package/dist/command-invocation.js.map +1 -0
  21. package/dist/commands/inspect.d.ts +5 -0
  22. package/dist/commands/inspect.d.ts.map +1 -1
  23. package/dist/commands/inspect.js +185 -33
  24. package/dist/commands/inspect.js.map +1 -1
  25. package/dist/commands/scaffold.js +30 -9
  26. package/dist/commands/scaffold.js.map +1 -1
  27. package/dist/commands/suggest-metadata.d.ts +6 -2
  28. package/dist/commands/suggest-metadata.d.ts.map +1 -1
  29. package/dist/commands/suggest-metadata.js +516 -72
  30. package/dist/commands/suggest-metadata.js.map +1 -1
  31. package/dist/context-lens.d.ts +1 -0
  32. package/dist/context-lens.d.ts.map +1 -1
  33. package/dist/context-lens.js +19 -1
  34. package/dist/context-lens.js.map +1 -1
  35. package/dist/diagnostic-ids.d.ts +1 -0
  36. package/dist/diagnostic-ids.d.ts.map +1 -1
  37. package/dist/diagnostic-ids.js +1 -0
  38. package/dist/diagnostic-ids.js.map +1 -1
  39. package/dist/discovery.d.ts +33 -1
  40. package/dist/discovery.d.ts.map +1 -1
  41. package/dist/discovery.js +361 -51
  42. package/dist/discovery.js.map +1 -1
  43. package/dist/metadata.d.ts +15 -1
  44. package/dist/metadata.d.ts.map +1 -1
  45. package/dist/metadata.js +235 -0
  46. package/dist/metadata.js.map +1 -1
  47. package/dist/model.d.ts +5 -10
  48. package/dist/model.d.ts.map +1 -1
  49. package/dist/rules.js +69 -23
  50. package/dist/rules.js.map +1 -1
  51. package/dist/scanner.d.ts.map +1 -1
  52. package/dist/scanner.js +66 -2
  53. package/dist/scanner.js.map +1 -1
  54. package/dist/skill-migration.d.ts.map +1 -1
  55. package/dist/skill-migration.js +6 -1
  56. package/dist/skill-migration.js.map +1 -1
  57. package/dist/types.d.ts +72 -0
  58. package/dist/types.d.ts.map +1 -1
  59. package/dist/types.js +50 -1
  60. package/dist/types.js.map +1 -1
  61. package/docs/README.md +2 -1
  62. package/docs/agent-skills-compatibility.md +8 -1
  63. package/docs/authoring-guide.md +100 -13
  64. package/docs/context-lens.md +319 -153
  65. package/docs/diagnostics.md +385 -3
  66. package/docs/metadata-budget.md +32 -0
  67. package/docs/quality-profile.md +17 -5
  68. package/docs/user-manual.md +136 -14
  69. package/examples/context-lens/README.md +8 -3
  70. package/examples/context-lens/contexts/testing/boundary-value-analysis.md +6 -2
  71. package/examples/context-lens/lenses/testing/spec-review-boundary-values.md +27 -5
  72. package/examples/context-lens/lenses/testing/test-design-boundary-values.md +27 -5
  73. package/examples/context-lens/skills/testing/spec-review/SKILL.md +33 -4
  74. package/package.json +1 -1
@@ -57,6 +57,259 @@ Structured facts in `details` are the authoritative inputs for review tooling.
57
57
  `llmHint` is guidance only; changing hint wording should not change bundle
58
58
  grouping, affected files, affected assets, or repair decisions.
59
59
 
60
+ ## Classification Evidence
61
+
62
+ `inspect`, `suggest-metadata`, and relevant scan finding or diagnostic
63
+ `details` include additive `classification` evidence. Classification answers
64
+ what path rule matched; governance separately answers whether owner, policy, or
65
+ metadata is declared, inherited, missing, or not required. A file's kind never
66
+ implies that it has an owner. `inspect` additionally exposes
67
+ `repositoryBoundary`, preserving resolution source and repository-relative path
68
+ when resolved or stable unresolved/ambiguous reason evidence and candidate
69
+ roots when no safe boundary can be selected.
70
+
71
+ For marker-free directory-segment inference, only `.agents`, `skills`,
72
+ `contexts`, `context`, `lenses`, and `tools` can positively establish a
73
+ structural boundary. Recognized root filenames are handled separately:
74
+ `AGENTS.md` may establish its containing directory as the structural root when
75
+ no stronger repository marker is available, while `renma.config.json` and
76
+ `.renma.json` normally establish the boundary through repository-marker
77
+ detection. The support-like names `profiles`, `references`, `examples`,
78
+ `scripts`, and `assets` are guards only: they can block a later boundary-like
79
+ segment or contribute ambiguity evidence, but never establish a repository root
80
+ by themselves.
81
+
82
+ > Classification describes how Renma interpreted repository structure. It does
83
+ > not by itself prove ownership, policy, lifecycle, source-of-truth status, or
84
+ > human intent.
85
+
86
+ > Governance evidence describes what is actually declared or inherited.
87
+
88
+ > Decision evidence describes whether Renma recommends a change, blocks one,
89
+ > requires confirmation, or recommends no change.
90
+
91
+ ### How to Read Classification Evidence
92
+
93
+ These fields answer different questions and must not be substituted for one
94
+ another:
95
+
96
+ | Field | What it indicates | What it does not indicate |
97
+ | --- | --- | --- |
98
+ | `kind` | The semantic parsing or inventory role Renma assigned to the file. | Governance scope, ownership, policy, lifecycle, validity, or human intent. |
99
+ | `scope` | The structural governance boundary implied by the path. | That governance metadata exists, is valid, or may be inherited. |
100
+ | `matchedRule` | The primary stable structural rule that classified the normalized repository-relative path. | That the resulting asset is owned, current, authoritative, or safe to change. |
101
+ | `reasonCode` | A more specific deterministic reason for the rule result. | Governance or a repair decision by itself. |
102
+ | `parentResolution` | How repository evidence resolved the parent implied by a Skill-local path. | The parent's owner or policy values. It is normally absent outside Skill-local classification. |
103
+ | `governance` | Declared or inherited ownership, policy, and metadata provenance supported by repository evidence. | Human intent beyond the declarations Renma found. |
104
+ | `decisionStatus` | The application gate for a command that can recommend a change. It is decision evidence, not classification evidence. | A different structural classification or permission to ignore blocked evidence. |
105
+
106
+ `kind` is one of `skill`, `agent`, `context`, `context_lens`, `profile`,
107
+ `reference`, `example`, `script`, `asset`, `config`, or `unknown`. It selects a
108
+ semantic parsing or inventory role. It is not equivalent to `scope`: for
109
+ example, a `reference` can be `skill-local`, while a repository tool currently
110
+ has `kind: "unknown"` and `scope: "repository-support"`. Metadata can refine a
111
+ file under a Context root from `context` to `context_lens` without changing the
112
+ structural rule that matched.
113
+
114
+ Optional classification fields add evidence without changing those core
115
+ meanings:
116
+
117
+ | Field | Meaning | Do not infer |
118
+ | --- | --- | --- |
119
+ | `reason` | Human-readable explanation of the current result. | A stable machine branch; wording may improve without a contract change. |
120
+ | `recognizedRoot` | The repository-relative asset root or boundary recognized by the matched rule, such as `skills`, `.agents/skills`, or `contexts`. | The absolute filesystem repository root; use `repositoryBoundary` for that evidence. |
121
+ | `parentAssetCandidatePath` | The parent Skill path implied by structure before repository resolution. | That the file exists or supplies governance. |
122
+ | `parentAssetPath` | The one parent Skill source path selected by a `resolved` result. | That the parent declares an owner or policy. |
123
+ | `parentAssetCandidates` | All plausible parent Skill paths retained by an `ambiguous` result. | That the first candidate is preferred or safe to select. |
124
+ | `supportDirectory` | The support-like directory involved in classification, such as `references` or `scripts`. | That the directory is valid Skill-local support without the matching rule and parent evidence. |
125
+ | `ignoredNestedSegments` | Nested support-like names that did not override a higher-priority recognized root. | That Renma ignored the file's content or omitted it from inventory. |
126
+ | `competingRules` | Stable negative evidence explaining why a nearby alternative rule did not match. | An additional positive classification or permission to choose that rule. |
127
+
128
+ #### Scope
129
+
130
+ | `scope` | Meaning | Do not infer |
131
+ | --- | --- | --- |
132
+ | `independent` | The path establishes a recognized first-class asset or agent boundary rather than Skill-local or repository-support placement. | That owner, policy, lifecycle, or source-of-truth metadata exists or is valid. |
133
+ | `skill-local` | The path is under a recognized canonical Skill support directory. | That a parent Skill exists or that inheritance is valid. Check `parentResolution` and `governance`. |
134
+ | `repository-support` | The path is recognized as repository implementation or configuration support. | That it is an independently governed Context Asset. |
135
+ | `unknown` | The path rule does not establish a known governance scope. | That the file is irrelevant, safe, unowned, or outside the repository. |
136
+
137
+ #### Matched Rules
138
+
139
+ `matchedRule` is the primary stable structural classification. Rules are applied
140
+ in the precedence shown after this table, so a higher-priority match prevents a
141
+ later, more generic interpretation.
142
+
143
+ | `matchedRule` | Repository evidence matched | Indicates | Must not be inferred |
144
+ | --- | --- | --- | --- |
145
+ | `skill-entrypoint` | A recognized canonical or historical Skill entrypoint shape under `skills/**` or `.agents/skills/**`. | The file is classified as a Skill entrypoint with independent scope. | That Agent Skills frontmatter is valid, that governance is complete, or that no migration is needed. |
146
+ | `skill-local-support` | A path inside `references/`, `profiles/`, `examples/`, `scripts/`, or `assets/` beneath a recognized Skill path shape. | The file has a structurally implied Skill parent candidate and Skill-local scope. | That the parent exists or inheritance is valid. Require `parentResolution: "resolved"` and governance evidence. |
147
+ | `context-root` | A file under `contexts/**`. | The file is an independent Context Asset by structure; metadata may refine its `kind` to `context_lens`. | That owner, lifecycle, policy, or source-of-truth metadata is complete or valid. |
148
+ | `context-root-legacy` | A file under the supported legacy `context/**` root. | The file is an independent Context Asset by the compatibility path rule. | That it is current, owned, authoritative, or should be moved automatically. |
149
+ | `lens-root` | A file under `lenses/**`. | The file is an independent Context Lens by structure. | That Lens targets, governance, or policy declarations are valid. |
150
+ | `agent-root` | `AGENTS.md` or a file under `.agents/**` after higher-priority Skill entrypoint rules. | The file is repository agent guidance with independent scope. | That it is an Agent Skill, that its instructions are valid, or that governance is complete. |
151
+ | `repository-tool` | A file under top-level `tools/**`. | The file is repository implementation with repository-support scope. | That it is an independently governed Context Asset. |
152
+ | `config-file` | A filename matching `renma.config.json` or `.renma.json` after higher-priority rules. | The file is recognized as Renma configuration support. | That its contents are valid, effective for a particular target, or proof of asset governance. |
153
+ | `generic-reference` | A nested `references/` directory outside recognized independent and Skill-local asset boundaries. | The file receives the `reference` parsing or inventory role, but its scope remains unknown. | That it belongs to a Skill, may inherit governance, or is an independent Context Asset. |
154
+ | `generic-example` | A nested `examples/` directory outside recognized independent and Skill-local asset boundaries. | The file receives the `example` parsing or inventory role, but its scope remains unknown. | That it belongs to a Skill, may inherit governance, or is independently governed. |
155
+ | `generic-profile` | A nested `profiles/` directory outside recognized independent and Skill-local asset boundaries. | The file receives the `profile` parsing or inventory role, but its scope remains unknown. | That it is selected by a Skill, may inherit governance, or defines effective policy. |
156
+ | `unknown` | No supported positive structural rule matched, or the path uses an unsupported reserved layout. | Renma has no more specific structural classification for the path. | That the file is irrelevant, harmless, unowned, safe to edit, or outside the resolved repository. |
157
+
158
+ The stable path-rule precedence is:
159
+
160
+ 1. `skill-entrypoint`.
161
+ 2. `skill-local-support` inside a recognized Skill boundary.
162
+ 3. Recognized asset roots: `context-root`, `context-root-legacy`, `lens-root`,
163
+ and `agent-root`.
164
+ 4. Repository support or configuration: `repository-tool` and `config-file`.
165
+ 5. Compatible nested rules: `generic-reference`, `generic-example`, and
166
+ `generic-profile`.
167
+ 6. `unknown`.
168
+
169
+ #### Parent Skill Resolution
170
+
171
+ `parentResolution` is meaningful for `skill-local-support`. Only `resolved`
172
+ permits Renma to claim one parent Skill, and even then consumers must inspect
173
+ `governance` to learn whether that parent supplies an owner or policy.
174
+
175
+ | `parentResolution` | Meaning | Consumer behavior |
176
+ | --- | --- | --- |
177
+ | `structural-candidate` | Path classification derived a possible `parentAssetCandidatePath`, but repository evidence has not resolved it. | Do not claim inheritance. Resolve the repository and parent evidence first. |
178
+ | `resolved` | Repository evidence found exactly one parent Skill and exposes it as `parentAssetPath`. | Inheritance may be reported only as supported by the accompanying governance evidence. |
179
+ | `missing` | No parent Skill exists at the structurally implied location. | Do not claim inheritance; treat a related change recommendation as blocked until the layout is reviewed. |
180
+ | `ambiguous` | More than one parent Skill candidate remains plausible; candidates may appear in `parentAssetCandidates`. | Do not choose a parent or claim inheritance; require layout or human resolution. |
181
+
182
+ For example, these two files have the same semantic role and structural scope,
183
+ but only the first has one resolved parent:
184
+
185
+ ```json
186
+ {
187
+ "classification": {
188
+ "kind": "reference",
189
+ "scope": "skill-local",
190
+ "matchedRule": "skill-local-support",
191
+ "parentResolution": "resolved",
192
+ "parentAssetPath": "skills/foo/SKILL.md"
193
+ },
194
+ "governance": {
195
+ "ownership": {
196
+ "declaredOwner": null,
197
+ "effectiveOwner": "docs",
198
+ "source": "inherited"
199
+ }
200
+ }
201
+ }
202
+ ```
203
+
204
+ ```json
205
+ {
206
+ "classification": {
207
+ "kind": "reference",
208
+ "scope": "skill-local",
209
+ "matchedRule": "skill-local-support",
210
+ "parentResolution": "missing"
211
+ },
212
+ "governance": {
213
+ "ownership": {
214
+ "declaredOwner": null,
215
+ "effectiveOwner": null,
216
+ "source": "unowned"
217
+ }
218
+ }
219
+ }
220
+ ```
221
+
222
+ The resolved example may inherit the owner shown by governance evidence. The
223
+ missing example must not inherit merely because its scope remains
224
+ `skill-local`.
225
+
226
+ #### Reason Codes
227
+
228
+ `reasonCode` narrows the primary structural result without replacing
229
+ `matchedRule`. Representative groups are:
230
+
231
+ - Skill boundary evidence: `under-canonical-skill-root`,
232
+ `under-skill-support-directory`, `unsupported-skill-local-directory`, and
233
+ `outside-recognized-skill-boundary`.
234
+ - Independent asset roots: `under-recognized-context-root`,
235
+ `under-legacy-context-root`, `under-recognized-lens-root`, and
236
+ `under-recognized-agent-root`.
237
+ - Repository support: `repository-tool-not-context` and
238
+ `recognized-config-file`.
239
+ - Generic or negative boundary evidence: `under-generic-support-directory`,
240
+ `outside-recognized-context-root`, and
241
+ `outside-recognized-asset-boundary`.
242
+
243
+ Some negative reason codes occur inside `competingRules`, where `matched: false`
244
+ records why a nearby interpretation did not apply. Human-readable `reason`
245
+ wording may improve over time. Machine consumers should branch on
246
+ `matchedRule` and `reasonCode`, retain unfamiliar future values, and never infer
247
+ governance from a reason code alone.
248
+
249
+ #### Governance and Decision Evidence
250
+
251
+ Governance is separate from classification. `ownership` reports declared and
252
+ effective owners plus whether the source is `declared`, `inherited`, or
253
+ `unowned`. When available, `policySource`, `policyInheritedFrom`, and
254
+ `metadataState` report equivalent provenance for policy and metadata. A
255
+ resolved parent can still be unowned or have missing policy, so classification
256
+ alone is never enough to construct governance.
257
+
258
+ Commands that make recommendations expose one of these `decisionStatus`
259
+ values:
260
+
261
+ | `decisionStatus` | Meaning | Consumer behavior |
262
+ | --- | --- | --- |
263
+ | `deterministic` | Renma has enough supported evidence to construct the reported change candidate. | Review and apply only the reported candidate; do not infer additional changes. |
264
+ | `human-confirmation-required` | Renma constructed candidate evidence, but human intent or semantics must be confirmed before application. | Do not apply until the required human confirmation occurs. |
265
+ | `blocked` | Conflicting, incomplete, unsafe, or unresolved evidence prevents a change recommendation. | Hard stop. Do not apply a patch even if another payload field looks candidate-like. |
266
+ | `no-change-recommended` | Renma successfully determined that no edit is recommended. | Treat as a successful no-edit result; do not manufacture a patch. |
267
+
268
+ `decisionStatus` is the authoritative application gate. The accompanying
269
+ decision `reasonCode` and `summary` explain that outcome; neither changes the
270
+ structural classification.
271
+
272
+ #### Safe Consumer Rules
273
+
274
+ 1. Do not infer ownership from `kind`.
275
+ 2. Do not infer inheritance from `scope: "skill-local"`.
276
+ 3. Require `parentResolution: "resolved"` plus governance evidence before
277
+ claiming inheritance.
278
+ 4. Treat `decisionStatus: "blocked"` as a hard stop.
279
+ 5. Treat `decisionStatus: "no-change-recommended"` as a successful no-edit
280
+ result.
281
+ 6. Use `matchedRule` and `reasonCode` for machine branching, not the
282
+ human-readable `reason`.
283
+ 7. Preserve forward compatibility with unknown future enum values. Retain the
284
+ raw value and fail closed rather than guessing its meaning.
285
+
286
+ Example additive details:
287
+
288
+ ```json
289
+ {
290
+ "classification": {
291
+ "kind": "context",
292
+ "scope": "independent",
293
+ "matchedRule": "context-root",
294
+ "reasonCode": "under-recognized-context-root",
295
+ "recognizedRoot": "contexts",
296
+ "ignoredNestedSegments": ["references"],
297
+ "reason": "The file is under the recognized contexts/** root. The nested references/ segment does not change its classification."
298
+ }
299
+ }
300
+ ```
301
+
302
+ Adding classification evidence does not emit a finding for every file, change
303
+ diagnostic severity, or change scan pass/fail behavior. Existing
304
+ `requires_human_decision` repair constraints remain the mechanism for intent
305
+ that Renma cannot infer.
306
+
307
+ `suggestedMode: "no-proposal"` with `no-change-recommended` is a successful
308
+ result, especially for ordinary Skill-local support that inherits governance.
309
+ Suggestion consumers should also handle unknown future `suggestedMode` values
310
+ conservatively. These command-contract refinements do not change scan finding
311
+ severity, scan pass/fail thresholds, or Readiness scoring.
312
+
60
313
  Example:
61
314
 
62
315
  ```json
@@ -109,6 +362,132 @@ edit shapes. `requires_human_decision` marks ambiguity that should not be guesse
109
362
  by automation. `risk` highlights security, data-handling, or destructive-action
110
363
  concerns.
111
364
 
365
+ ## Presenting Renma Evidence to a User
366
+
367
+ Raw Renma JSON is evidence for an LLM or coding agent, not usually the best
368
+ user-facing explanation. The consumer should translate the relevant fields into
369
+ plain language while preserving the boundary between confirmed facts,
370
+ recommendations, and unresolved human intent.
371
+
372
+ The overall loop is:
373
+
374
+ ```text
375
+ Renma emits deterministic evidence
376
+ -> LLM summarizes the evidence
377
+ -> user supplies missing intent
378
+ -> LLM performs the smallest supported change
379
+ -> Renma verifies the result
380
+ -> LLM summarizes the new state
381
+ ```
382
+
383
+ In practice, an LLM or coding agent should:
384
+
385
+ 1. Read Renma's deterministic evidence.
386
+ 2. Summarize the important facts in user-facing language.
387
+ 3. Separate confirmed facts from recommendations and unresolved intent.
388
+ 4. Ask only for human decisions that Renma cannot determine.
389
+ 5. Rerun the relevant Renma command after the user supplies new intent.
390
+ 6. Explain how the evidence or recommendation changed.
391
+ 7. Repeat until the intended repository state is explicit and Renma verifies
392
+ it.
393
+
394
+ A useful summary normally contains:
395
+
396
+ - **Confirmed repository facts:** paths, declarations, resolved relationships,
397
+ and other evidence Renma actually observed.
398
+ - **Renma's deterministic interpretation:** the classification, governance,
399
+ and decision evidence without added assumptions.
400
+ - **Current recommendation:** the smallest change Renma supports, or an
401
+ explicit successful no-change result.
402
+ - **Unresolved human decisions:** only intent that repository evidence cannot
403
+ determine.
404
+ - **Next safe verification step:** the relevant structured Renma command, or a
405
+ statement that no executable action is safe yet.
406
+
407
+ For example:
408
+
409
+ ```text
410
+ Renma classified this file as a Skill-local Reference.
411
+
412
+ One parent Skill resolved at skills/foo/SKILL.md, and the effective owner is
413
+ inherited from that Skill.
414
+
415
+ No independent metadata change is currently recommended.
416
+
417
+ A human decision is needed only if this knowledge is intended to be reused
418
+ outside this Skill. If so, consider promoting it to contexts/** and then rerun
419
+ Renma.
420
+ ```
421
+
422
+ LLM consumers must follow these guardrails:
423
+
424
+ - Do not expose raw diagnostics without summarizing their meaning when a
425
+ user-facing explanation is expected.
426
+ - Do not ask the user to decide facts Renma already resolved.
427
+ - Do not invent an owner, policy, lifecycle, reference, or source-of-truth
428
+ claim.
429
+ - Do not convert `structural-candidate` into `resolved`.
430
+ - Do not claim inheritance without `parentResolution: "resolved"` and matching
431
+ governance evidence.
432
+ - Do not present `decisionStatus: "blocked"` as an applicable patch.
433
+ - Do not assume every diagnostic requires an edit.
434
+ - Do not hide unresolved human intent behind an automatic recommendation.
435
+ - Treat `no-change-recommended` as a valid successful outcome.
436
+ - After new user intent is provided, rerun Renma rather than relying on an old
437
+ result.
438
+
439
+ ### Iterative Example
440
+
441
+ Initial Renma evidence:
442
+
443
+ ```text
444
+ kind: reference
445
+ scope: skill-local
446
+ parentResolution: resolved
447
+ decisionStatus: no-change-recommended
448
+ ```
449
+
450
+ LLM summary:
451
+
452
+ ```text
453
+ This file is local support for one Skill and already inherits its governance.
454
+ No metadata change is needed. Should this knowledge remain local, or is it
455
+ intended for reuse by other Skills?
456
+ ```
457
+
458
+ User:
459
+
460
+ ```text
461
+ It should be reusable by three Skills.
462
+ ```
463
+
464
+ LLM response:
465
+
466
+ ```text
467
+ That changes the repository-design intent. I will treat promotion to an
468
+ independent Context Asset as the candidate direction, preserve the original
469
+ meaning, and rerun Renma after the placement and references are updated.
470
+ ```
471
+
472
+ After the intended patch, Renma verifies:
473
+
474
+ ```text
475
+ kind: context
476
+ scope: independent
477
+ matchedRule: context-root
478
+ ```
479
+
480
+ LLM summary:
481
+
482
+ ```text
483
+ The knowledge is now an independent Context Asset under contexts/**. Renma
484
+ verified the new classification. Ownership and references should now be
485
+ reviewed as independent governance rather than inherited Skill-local state.
486
+ ```
487
+
488
+ This example is conceptual. Renma does not automatically move files, invent
489
+ references, or decide that local knowledge should be promoted.
490
+
112
491
  ## Review Bundles
113
492
 
114
493
  `renma scan --json` also includes `reviewBundles`, a deterministic grouping of
@@ -183,8 +562,9 @@ These diagnostics are emitted after files are parsed into catalog entries. For s
183
562
  Owner absence is handled as ownership coverage information. Shared assets
184
563
  without `owner` are accepted and reported as unowned by `renma ownership`;
185
564
  Renma does not invent an owner. Skill-local support is the exception: it uses
186
- deterministic effective ownership inherited from its nearest owning Skill and
187
- reports that provenance separately from declared metadata.
565
+ deterministic effective ownership only after repository evidence resolves one
566
+ parent Skill with an effective owner, and reports that inherited provenance
567
+ separately from declared metadata.
188
568
 
189
569
  | Severity | Message | Meaning | Fix |
190
570
  | --------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------- |
@@ -215,6 +595,7 @@ Context Lens governance diagnostics use stable `code` values in JSON output. `er
215
595
  | `CONTEXT-LENS-GOVERNANCE-MEANINGLESS` | `warning` | A lens has no purpose, target, focus, expected output, or body guidance. | Add compact governance metadata or reviewed interpretation guidance. |
216
596
  | `CONTEXT-LENS-MISSING-REQUIRED-FIELD` | `error` | A lens is missing `id`, `owner`, `purpose`, or `applies_to`. | Add the required field in frontmatter. |
217
597
  | `CONTEXT-LENS-PATH-NORMALIZATION-MISMATCH` | `warning` | A path target normalizes to a different repository-relative path. | Use the normalized path shown by the diagnostic. |
598
+ | `CONTEXT-LENS-TARGET-NOT-CONTEXT` | `error` | An `applies_to` target resolves to a cataloged asset whose kind is not `context`. | `applies_to` must reference a Context Asset ID or path; Skills, support assets, other Lenses, and repository metadata are not valid Lens targets. |
218
599
  | `CONTEXT-LENS-TARGET-NOT-FOUND` | `error` | An `applies_to` target does not resolve to a cataloged asset ID or path. | Correct the target, add the missing context asset, or update discovery config. |
219
600
  | `CONTEXT-LENS-UNPARSEABLE-FRONTMATTER` | `error` | A lens frontmatter block starts with `---` but does not close. | Add the closing `---` delimiter or remove malformed frontmatter. |
220
601
  | `CONTEXT-LENS-UNSUPPORTED-KIND` | `warning` or `error` | `type: context_lens` appears under an unsupported artifact kind, or a lens file declares an unsupported type. | Store lens definitions under `lenses/**`, `context/**`, or `contexts/**`, and use `type: context_lens`. |
@@ -347,7 +728,8 @@ examples by asset kind.
347
728
  | `QUAL-SKILL-MIXED-RESPONSIBILITY` | Skill may mix workflow and reusable knowledge. | A sufficiently large Skill has multiple distinct reusable-knowledge signals. | Promote only independently owned shared knowledge; keep Skill-local workflow and detail local. |
348
729
  | `QUAL-SKILL-PROGRESSIVE-DISCLOSURE` | Progressive disclosure needs review. | Reserved 0.18 focused-workflow contract identifier. | Keep read conditions and core workflow in `SKILL.md`; place details by semantic responsibility. |
349
730
  | `QUAL-SKILL-TOKEN-BUDGET` | Skill body exceeds an advisory estimate. | Markdown body exceeds 2,000 or 5,000 estimated tokens. | Review progressive disclosure without splitting or moving content by size alone. |
350
- | `QUAL-SUPPORT-ASSET-TOKEN-BUDGET` | Support asset exceeds an advisory estimate. | A context, reference, profile, or example exceeds its token budget. | Review coherent scope, structure, read conditions, reference depth, responsibility mixing, and duplication; size alone does not require a split. |
731
+ | `QUAL-INVALID-TOKEN-BUDGET-OVERRIDE` | Support-asset decision metadata is invalid. | The decision is malformed, unsafe to represent exactly, ambiguous, incomplete, orphaned, duplicated, or unnecessary while the asset remains within its default. | Correct or remove the declaration. Ask about a meaningful split first; use an override only after the user confirms the asset should remain intentionally long. |
732
+ | `QUAL-SUPPORT-ASSET-TOKEN-BUDGET` | Support asset exceeds its effective advisory estimate. | A context, reference, profile, or example exceeds its default or valid declared override. | Ask whether a semantic split preserves coherence and execution order. Split only with user agreement; otherwise record an explicit rationale, never an override added merely to pass diagnostics. |
351
733
  | `QUAL-USER-LOCAL-PATHS` | User-local path appears in content. | Guidance includes machine-specific paths such as home directories. | Replace local paths with repository-relative or configurable paths. |
352
734
  | `SEC-DESTRUCTIVE-COMMAND` | Destructive command appears. | Content includes risky commands such as forced deletion or reset. | Remove it, gate it with explicit safety guidance, or use a safer command. |
353
735
  | `SEC-ENV-COPY` | Environment copying is suggested. | Content copies broad environment or secret-bearing files. | Narrow the copied data and document secret handling. |
@@ -4,11 +4,43 @@ Renma intentionally keeps asset frontmatter small. Frontmatter should work as a
4
4
 
5
5
  Use frontmatter for concise fields such as `id`, `owner`, `status`, `tags`, `when_to_use`, `when_not_to_use`, and declared context relationships. Put detailed guidance, examples, procedures, policy rationale, and long routing prose in the markdown body or in referenced context assets.
6
6
 
7
+ Contexts, references, profiles, and examples also support these top-level
8
+ human-decision fields:
9
+
10
+ ```yaml
11
+ token_budget_override: 6000
12
+ token_budget_rationale: "This is a single ordered workflow and splitting it would break execution order."
13
+ token_budget_reviewed_at: "2026-07-12"
14
+ ```
15
+
16
+ `token_budget_override` must be a positive safe integer greater than the asset
17
+ kind's default content limit, and `token_budget_rationale` must be a non-empty
18
+ string. `token_budget_reviewed_at` is optional and must be a real `YYYY-MM-DD`
19
+ date when present. Invalid metadata does not replace the default limit.
20
+ The three fields form one decision bundle: rationale and review-date fields are
21
+ invalid without an override. Duplicate fields, relevant YAML errors, and an
22
+ override declared while the full file remains within its default limit also
23
+ produce `QUAL-INVALID-TOKEN-BUDGET-OVERRIDE`. Renma selects no value from an
24
+ ambiguous or invalid bundle, and catalog output omits all three normalized
25
+ fields.
26
+
27
+ These fields record a declared human decision; Renma never inserts them. When
28
+ the default is exceeded, first ask whether the asset can be split along
29
+ meaningful semantic boundaries without harming coherence or execution order.
30
+ Split only after the user agrees. Use an override only when the user confirms
31
+ the asset should remain intentionally long, and never recommend one merely to
32
+ make diagnostics pass.
33
+
34
+ Renma records and validates this declaration; it cannot prove that a human
35
+ actually reviewed the asset. `token_budget_reviewed_at` is declared provenance,
36
+ not independently verified evidence.
37
+
7
38
  Current metadata budget diagnostics:
8
39
 
9
40
  | Finding | Meaning | Typical fix |
10
41
  | --- | --- | --- |
11
42
  | `META-FRONTMATTER-TOO-LARGE` | Frontmatter has grown beyond the compact index budget. | Move long prose, examples, procedures, or rationale into the body or referenced context assets. |
12
43
  | `META-LIST-ITEM-TOO-LONG` | A block-list metadata item is too long to serve as concise routing/index metadata. | Keep the list item short and move detailed conditions into body sections. |
44
+ | `QUAL-INVALID-TOKEN-BUDGET-OVERRIDE` | Support-asset token-budget decision metadata is invalid or ambiguous. | Correct or remove it after an explicit user decision; invalid metadata leaves the default content limit active. |
13
45
 
14
46
  These diagnostics are intentionally advisory. They should help reduce LLM-facing catalog noise and token usage without deleting substantive knowledge.
@@ -5,7 +5,7 @@ the active profile as `renma-quality@<Renma package version>`, derived from
5
5
  `package.json` at build time. The source is `src/quality-profile.ts`. The current
6
6
  implementation does not expose quality overrides in `renma.config.json`; fixed
7
7
  defaults preserve comparable repository reports. The internal shape is
8
- versioned so later releases can add reviewed overrides without scattering
8
+ versioned so later releases can add declared overrides without scattering
9
9
  constants across rules.
10
10
 
11
11
  `estimated_tokens` means Renma's deterministic, model-neutral estimate. Latin
@@ -14,6 +14,18 @@ grouped in two-code-point units; other punctuation is grouped in units of up to
14
14
  three code points. It is not an exact token count for any model. Skill budgets
15
15
  measure Markdown after frontmatter. Content-asset budgets measure the full file.
16
16
 
17
+ Contexts, references, profiles, and examples may record a declared human
18
+ decision and effective limit with top-level `token_budget_override` and
19
+ `token_budget_rationale` metadata. The override must be a positive safe integer
20
+ greater than the asset kind's unchanged default. Optional
21
+ `token_budget_reviewed_at` must be a real `YYYY-MM-DD` date. Renma does not add
22
+ these fields automatically. When an asset exceeds its default, an agent should
23
+ first ask whether it can be split along meaningful boundaries without harming
24
+ coherence or execution order, and split only after the user agrees. An override
25
+ is appropriate only when the user confirms the long-form asset is intentionally
26
+ coherent or ordered; it is not a general ignore mechanism. Renma validates the
27
+ declaration but cannot prove that human review occurred.
28
+
17
29
  ## Agent Skills requirements and recommendations
18
30
 
19
31
  | Field | Value | Unit and trigger | Severity | Source | Rationale and false-positive risk | Diagnostic | Reviewed | Configurable later |
@@ -39,10 +51,10 @@ and `assets/` directories are valid. See the official
39
51
  | `descriptionMinChars` | 0 | characters; disabled | none | Renma | Length does not establish selection clarity | `QUAL-SHORT-DESCRIPTION` removed from default behavior | 0.18.0 | possibly |
40
52
  | `skillTokenWarn` | 2,000 | `estimated_tokens`; body above | low | Renma | Early progressive-disclosure review; focused workflows may exceed it | `QUAL-SKILL-TOKEN-BUDGET` | 0.18.0 | possibly |
41
53
  | `skillTokenStrongWarn` | 5,000 | `estimated_tokens`; body above | medium | Agent Skills recommendation with Renma severity | Stronger review, not a required split | `QUAL-SKILL-TOKEN-BUDGET` | 0.18.0 | possibly |
42
- | `contentTokenWarn.context` | 4,000 | `estimated_tokens`; full file above | low | Renma | Review coherent scope; size alone is insufficient | `QUAL-SUPPORT-ASSET-TOKEN-BUDGET` | 0.18.0 | possibly |
43
- | `contentTokenWarn.reference` | 5,000 | same | low | Renma | Detailed local references may legitimately be long | same | 0.18.0 | possibly |
44
- | `contentTokenWarn.profile` | 2,000 | same | low | Renma | Profiles should remain reviewable overlays | same | 0.18.0 | possibly |
45
- | `contentTokenWarn.example` | 2,500 | same | low | Renma | Complete examples may legitimately be long | same | 0.18.0 | possibly |
54
+ | `contentTokenWarn.context` | 4,000 | `estimated_tokens`; full file above effective limit | low | Renma | Prefer an agreed semantic split when coherence survives; intentionally coherent or ordered assets may record a declared decision | `QUAL-SUPPORT-ASSET-TOKEN-BUDGET` | 0.18.1 | metadata only after human decision |
55
+ | `contentTokenWarn.reference` | 5,000 | same | low | Renma | Detailed local references may legitimately be long | same | 0.18.1 | same |
56
+ | `contentTokenWarn.profile` | 2,000 | same | low | Renma | Profiles should remain reviewable overlays | same | 0.18.1 | same |
57
+ | `contentTokenWarn.example` | 2,500 | same | low | Renma | Complete examples may legitimately be long | same | 0.18.1 | same |
46
58
  | `lowHeadingDensityMinTokens` | 400 | body `estimated_tokens`, with fewer than 2 headings | low | Renma | Long prose can still be intentionally linear | `QUAL-LOW-HEADING-DENSITY` | 0.18.0 | possibly |
47
59
  | `lowHeadingDensityMinHeadings` | 2 | headings | low | Renma | Navigation heuristic only | same | 0.18.0 | possibly |
48
60