renma 0.16.0 → 0.17.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 (85) hide show
  1. package/CHANGELOG.md +35 -1
  2. package/README.md +210 -749
  3. package/architecture.md +523 -0
  4. package/design.md +458 -0
  5. package/dist/cli-help.d.ts +7 -5
  6. package/dist/cli-help.d.ts.map +1 -1
  7. package/dist/cli-help.js +23 -9
  8. package/dist/cli-help.js.map +1 -1
  9. package/dist/cli.d.ts.map +1 -1
  10. package/dist/cli.js +139 -40
  11. package/dist/cli.js.map +1 -1
  12. package/dist/commands/catalog.d.ts.map +1 -1
  13. package/dist/commands/catalog.js +4 -3
  14. package/dist/commands/catalog.js.map +1 -1
  15. package/dist/commands/graph.d.ts.map +1 -1
  16. package/dist/commands/graph.js +7 -12
  17. package/dist/commands/graph.js.map +1 -1
  18. package/dist/commands/readiness.d.ts.map +1 -1
  19. package/dist/commands/readiness.js +7 -6
  20. package/dist/commands/readiness.js.map +1 -1
  21. package/dist/commands/scaffold.d.ts.map +1 -1
  22. package/dist/commands/scaffold.js +14 -2
  23. package/dist/commands/scaffold.js.map +1 -1
  24. package/dist/commands/suggest-metadata.d.ts.map +1 -1
  25. package/dist/commands/suggest-metadata.js +54 -8
  26. package/dist/commands/suggest-metadata.js.map +1 -1
  27. package/dist/commands/suggest-semantic-split.js +3 -3
  28. package/dist/commands/suggest-semantic-split.js.map +1 -1
  29. package/dist/dependency-resolution.d.ts +6 -0
  30. package/dist/dependency-resolution.d.ts.map +1 -0
  31. package/dist/dependency-resolution.js +11 -0
  32. package/dist/dependency-resolution.js.map +1 -0
  33. package/dist/discovery.d.ts +28 -0
  34. package/dist/discovery.d.ts.map +1 -1
  35. package/dist/discovery.js +70 -15
  36. package/dist/discovery.js.map +1 -1
  37. package/dist/repository-paths.d.ts +13 -0
  38. package/dist/repository-paths.d.ts.map +1 -1
  39. package/dist/repository-paths.js +60 -2
  40. package/dist/repository-paths.js.map +1 -1
  41. package/dist/rules.d.ts.map +1 -1
  42. package/dist/rules.js +64 -85
  43. package/dist/rules.js.map +1 -1
  44. package/dist/trust-graph.d.ts.map +1 -1
  45. package/dist/trust-graph.js +7 -11
  46. package/dist/trust-graph.js.map +1 -1
  47. package/dist/types.d.ts +1 -1
  48. package/dist/types.d.ts.map +1 -1
  49. package/docs/README.md +55 -0
  50. package/docs/advanced-skill-authoring.md +140 -0
  51. package/docs/agent-skills-compatibility.md +500 -0
  52. package/docs/authoring-guide.md +324 -0
  53. package/docs/context-conflict-diagnostics.md +32 -0
  54. package/docs/context-language-diagnostics.md +99 -0
  55. package/docs/context-lens.md +253 -0
  56. package/docs/context-lifecycle-diagnostics.md +55 -0
  57. package/docs/diagnostics.md +373 -0
  58. package/docs/metadata-budget.md +14 -0
  59. package/docs/repository-context-bom.md +113 -0
  60. package/docs/security-policy.md +338 -0
  61. package/docs/user-manual.md +813 -0
  62. package/examples/context-lens/README.md +101 -0
  63. package/examples/context-lens/contexts/testing/boundary-value-analysis.md +23 -0
  64. package/examples/context-lens/lenses/testing/spec-review-boundary-values.md +29 -0
  65. package/examples/context-lens/lenses/testing/test-design-boundary-values.md +29 -0
  66. package/examples/context-lens/skills/testing/spec-review/SKILL.md +49 -0
  67. package/examples/context-repo/README.md +149 -0
  68. package/examples/context-repo/contexts/domain/payment/idempotency.md +20 -0
  69. package/examples/context-repo/contexts/testing/boundary-value-analysis.md +19 -0
  70. package/examples/context-repo/contexts/testing/negative-testing.md +19 -0
  71. package/examples/context-repo/lenses/testing/spec-review-boundary-values.md +35 -0
  72. package/examples/context-repo/renma.config.json +12 -0
  73. package/examples/context-repo/skills/testing/spec-review/SKILL.md +66 -0
  74. package/examples/context-repo/tools/appium/README.md +14 -0
  75. package/examples/github-actions/renma-ci-report.yml +36 -0
  76. package/examples/interactive-placeholder/README.md +104 -0
  77. package/examples/interactive-placeholder/assets/template.txt +1 -0
  78. package/examples/interactive-placeholder/renma.config.json +6 -0
  79. package/examples/interactive-placeholder/skills/replace-placeholder/SKILL.md +54 -0
  80. package/examples/interactive-placeholder/tools/README.md +48 -0
  81. package/examples/interactive-placeholder/tools/placeholder-demo.mjs +99 -0
  82. package/package.json +8 -1
  83. package/plan-discovery.md +740 -0
  84. package/plan.md +150 -0
  85. package/scripts/verify-package.mjs +97 -0
@@ -0,0 +1,324 @@
1
+ # Renma Authoring Guide
2
+
3
+ This is the canonical guide for authoring and improving Skills and Context
4
+ Assets in a Renma repository.
5
+
6
+ ## Responsibility Boundary
7
+
8
+ Use your platform's standard Skill authoring guidance for general Skill design,
9
+ then use Renma for repository-specific governance and validation.
10
+
11
+ Platform-native authoring guidance owns:
12
+
13
+ - name and trigger description;
14
+ - usage and exclusion boundaries;
15
+ - instructions and workflow;
16
+ - constraints and safety behavior;
17
+ - examples; and
18
+ - completion criteria.
19
+
20
+ Renma complements that guidance with:
21
+
22
+ - canonical metadata and Agent Skills compatibility;
23
+ - dependency and graph validation;
24
+ - ownership and lifecycle governance;
25
+ - security policy validation;
26
+ - workflow clarity diagnostics; and
27
+ - repository-wide scan and readiness evidence.
28
+
29
+ Renma does not replace platform-native authoring guidance, generate domain
30
+ intent, or automatically improve a Skill body. Human judgment remains required
31
+ for semantics, ownership, policy, dependencies, and source-of-truth claims.
32
+
33
+ ## New Skill Workflow
34
+
35
+ Use this sequence for a new Skill:
36
+
37
+ ```text
38
+ platform-native Skill authoring guidance
39
+ -> renma scaffold skill
40
+ -> review and complete the generated Skill
41
+ -> renma scan . --fail-on high
42
+ -> fix relevant diagnostics
43
+ -> rerun validation
44
+ -> human review
45
+ ```
46
+
47
+ ### 1. Design the Skill
48
+
49
+ Before generating a file, use the standard guidance for your platform to define:
50
+
51
+ - the recurring task or decision;
52
+ - the trigger and nearby cases that should not use the Skill;
53
+ - required inputs and evidence;
54
+ - the ordered workflow and decision points;
55
+ - safety and repository constraints; and
56
+ - the output and completion criteria.
57
+
58
+ Do not guess missing owners, policies, dependencies, product behavior, domain
59
+ rules, or source-of-truth documents. Record gaps for a human to resolve.
60
+
61
+ ### 2. Generate one repository-compatible starting point
62
+
63
+ Run the Renma generator once:
64
+
65
+ ```bash
66
+ renma scaffold skill skills/testing/spec-review/SKILL.md \
67
+ --id skill.testing.spec-review \
68
+ --title "Spec Review" \
69
+ --owner qa-platform \
70
+ --tags testing,spec-review
71
+ ```
72
+
73
+ The target must be a canonical `SKILL.md` under `skills/**` or
74
+ `.agents/skills/**`. File mode refuses to overwrite an existing file and
75
+ requires an explicit owner. The output is a deterministic starting point, not
76
+ a finished Skill.
77
+
78
+ Do not run two independent generators against the same target file. Some
79
+ platform-native authoring tools create files themselves, so choose one of these
80
+ safe approaches:
81
+
82
+ 1. Run `renma scaffold skill`, then ask the platform tool to review and refine
83
+ that existing file.
84
+ 2. Ask the platform tool to use `renma scaffold skill` as the starting point
85
+ instead of independently generating the same target.
86
+
87
+ `--format prompt` prints the deterministic scaffold and constraints without
88
+ writing the file. `--format json` prints the existing structured bundle. These
89
+ modes do not reserve or create the target path.
90
+
91
+ ### 3. Review and complete the scaffold
92
+
93
+ Use platform-native guidance to complete:
94
+
95
+ - `description`, including positive and negative trigger boundaries;
96
+ - required inputs and preflight evidence;
97
+ - instructions, decisions, and workflow;
98
+ - constraints and security behavior;
99
+ - completion criteria and validation; and
100
+ - intended Renma metadata and Context relationships.
101
+
102
+ Preserve the repository's intended behavior. Keep reusable domain, testing,
103
+ product, platform, or tool knowledge in independently owned Context Assets when
104
+ it should outlive one Skill.
105
+
106
+ ### 4. Validate, fix, and rerun
107
+
108
+ Start with the release gate:
109
+
110
+ ```bash
111
+ renma scan . --fail-on high
112
+ ```
113
+
114
+ Review every relevant diagnostic, correct the underlying wording, metadata, or
115
+ relationship, and rerun the same scan. Do not weaken security policy or add a
116
+ suppression merely to make validation pass.
117
+
118
+ Use other deterministic views when they answer a specific review question:
119
+
120
+ ```bash
121
+ renma inspect skills/testing/spec-review/SKILL.md
122
+ renma catalog . --format markdown
123
+ renma graph . --focus skill.testing.spec-review --format mermaid
124
+ renma ownership . --format markdown
125
+ renma readiness . --format markdown
126
+ ```
127
+
128
+ The final step is human review of the Skill's intent, workflow, policy,
129
+ relationships, and remaining uncertainty.
130
+
131
+ ## Existing Skill Workflow
132
+
133
+ Use this sequence for an existing Skill:
134
+
135
+ ```text
136
+ review with platform-native Skill authoring guidance
137
+ -> renma scan . --fail-on high
138
+ -> inspect relevant diagnostics and repository evidence
139
+ -> use suggest-metadata only for metadata or migration work
140
+ -> prepare and review intended changes
141
+ -> renma scan . --fail-on high
142
+ -> fix relevant diagnostics
143
+ -> rerun validation
144
+ -> human review
145
+ ```
146
+
147
+ ### 1. Review the whole Skill
148
+
149
+ Use platform-native authoring guidance to review the trigger description,
150
+ instructions, workflow, constraints, examples, and completion criteria. This is
151
+ semantic authoring review; `suggest-metadata` does not perform it.
152
+
153
+ ### 2. Scan and inspect repository evidence
154
+
155
+ ```bash
156
+ renma scan . --fail-on high
157
+ renma inspect skills/testing/spec-review/SKILL.md
158
+ ```
159
+
160
+ `scan` is the general deterministic starting point for an existing Skill. Use
161
+ `inspect`, `catalog`, `graph`, `ownership`, or `readiness` when one of those
162
+ commands answers a specific evidence question. Renma reports structural and
163
+ governance evidence; it does not perform the whole-Skill semantic review.
164
+
165
+ ### 3. Generate a metadata or migration suggestion when needed
166
+
167
+ ```bash
168
+ renma suggest-metadata skills/testing/spec-review/SKILL.md
169
+ ```
170
+
171
+ Optionally provide an owner only when a human has explicitly confirmed it:
172
+
173
+ ```bash
174
+ renma suggest-metadata skills/testing/spec-review/SKILL.md \
175
+ --owner qa-platform \
176
+ --format json
177
+ ```
178
+
179
+ `suggest-metadata` reads one target and prints a deterministic prompt or JSON
180
+ payload to stdout. It does not edit, rename, or move the file. Its supported
181
+ responsibilities are:
182
+
183
+ - compact canonical metadata suggestions;
184
+ - explicit owner retrofit and one-way migration of recognized pre-0.16
185
+ governance and security metadata;
186
+ - pre-0.16 to canonical Agent Skills migration candidates;
187
+ - conflict and unsafe-evidence detection; and
188
+ - validation of the rendered candidate.
189
+
190
+ It does not rewrite the body, infer ownership, choose between conflicting
191
+ semantic values, infer missing security policy, or propose reverse migration
192
+ for a canonical Skill. An owner candidate requires explicit human-provided
193
+ evidence. Security policy remains intentionally authored and deterministically
194
+ validated.
195
+
196
+ Do not route an already canonical Skill through `suggest-metadata` as ceremony.
197
+ Use it only for a metadata retrofit, explicit owner retrofit, recognized
198
+ pre-0.16 one-way migration, or blocked migration review.
199
+
200
+ ### 4. Review before applying
201
+
202
+ Treat the output as a candidate. Compare it with the source and apply only the
203
+ intended metadata, path migration, or migration changes. Preserve the Markdown
204
+ body and unknown vendor metadata unless a separately reviewed semantic change
205
+ requires otherwise.
206
+
207
+ If migration is blocked:
208
+
209
+ 1. Review the reported conflicts or invalid evidence.
210
+ 2. Confirm the Skill's intent using platform-native authoring guidance.
211
+ 3. Do not apply a candidate while Renma cannot generate it safely.
212
+ 4. Correct the source evidence.
213
+ 5. Rerun `renma suggest-metadata <SKILL.md>`.
214
+ 6. After intended corrections, run `renma scan . --fail-on high` and repeat the
215
+ fix-and-rerun loop.
216
+
217
+ Renma never chooses a semantic winner automatically. The detailed one-way
218
+ migration and blocking contract is in
219
+ [Agent Skills Compatibility and Migration](agent-skills-compatibility.md).
220
+
221
+ ## Canonical Skill Metadata
222
+
223
+ Agent Skills owns the standard Skill identity and body. Renma fields are flat,
224
+ string-valued `metadata.renma.*` entries. JSON-array strings encode lists:
225
+
226
+ ```yaml
227
+ ---
228
+ name: spec-review
229
+ description: Review specifications for ambiguity and missing boundaries. Use when requirements need evidence-backed review before implementation.
230
+ metadata:
231
+ renma.id: skill.testing.spec-review
232
+ renma.title: Spec Review
233
+ renma.owner: qa-platform
234
+ renma.status: stable
235
+ renma.tags: '["testing","spec-review"]'
236
+ renma.requires-context: '["context.testing.boundary-value-analysis"]'
237
+ renma.optional-context: '[]'
238
+ ---
239
+ ```
240
+
241
+ Do not use a nested `metadata.renma` mapping, native YAML booleans for canonical
242
+ security fields, or comma-separated canonical lists. See the compatibility and
243
+ security guides for the complete contracts.
244
+
245
+ ## Context Asset And Context Lens Authoring
246
+
247
+ Create a Context Asset when knowledge should be reusable and independently
248
+ owned:
249
+
250
+ ```bash
251
+ renma scaffold context contexts/testing/boundary-value-analysis.md \
252
+ --owner qa-platform
253
+ ```
254
+
255
+ A Context Asset should contain durable, source-backed domain knowledge,
256
+ testing heuristics, tool constraints, platform facts, or reviewed policy. Keep
257
+ task-specific prompt instructions and runtime selection rules out of shared
258
+ Context.
259
+
260
+ Create a Context Lens when one purpose needs a focused interpretation of one or
261
+ more Context Assets:
262
+
263
+ ```bash
264
+ renma scaffold context_lens \
265
+ lenses/testing/spec-review-boundary-values.md \
266
+ --owner qa-platform
267
+ ```
268
+
269
+ The repository can represent both:
270
+
271
+ ```text
272
+ Skill -> Context Lens -> Context Asset
273
+ Skill -> Context Asset
274
+ ```
275
+
276
+ These metadata relationships are static governance evidence. Renma does not
277
+ select, load, or inject Context at runtime.
278
+
279
+ Context and Context Lens scaffolds keep their top-level Renma metadata syntax;
280
+ the Agent Skills `metadata.renma.*` serialization boundary applies to Skills.
281
+
282
+ For current guidance on deriving several thin, bounded Skills from a broad
283
+ existing Skill—including focused `inspect`, graph, Context reuse, and Appium
284
+ examples—see [Advanced Skill Authoring](advanced-skill-authoring.md). That guide
285
+ keeps current thin-Skill authoring separate from proposed 0.18.0 Skill-to-Skill
286
+ discovery.
287
+
288
+ ## Optional Codex Example
289
+
290
+ Codex `skill-creator` is one example of platform-native authoring guidance; it
291
+ is not a Renma dependency and is not named in generic CLI output.
292
+
293
+ After creating the Renma scaffold, a safe request is:
294
+
295
+ ```text
296
+ Use skill-creator to review and refine the existing
297
+ skills/testing/spec-review/SKILL.md scaffold. Preserve its intended Renma
298
+ metadata and repository behavior. Do not independently generate a second target
299
+ file. Do not invent owners, policy, dependencies, domain rules, or
300
+ source-of-truth claims. After the reviewed edits, run
301
+ `renma scan . --fail-on high`, fix relevant diagnostics, and rerun the scan.
302
+ ```
303
+
304
+ Alternatively, ask `skill-creator` to use `renma scaffold skill` as its
305
+ starting point. In both cases, only one generator creates the target file.
306
+
307
+ ## Review Checklist
308
+
309
+ Before human approval, confirm that:
310
+
311
+ - the description says when the Skill should and should not be selected;
312
+ - instructions, constraints, and completion criteria are explicit;
313
+ - owners, policies, dependencies, and domain claims are evidence-backed;
314
+ - reusable knowledge has an appropriate Context boundary;
315
+ - generated or suggested changes were reviewed rather than applied blindly;
316
+ - blocked migration evidence was resolved instead of bypassed;
317
+ - `renma scan . --fail-on high` was rerun after fixes; and
318
+ - no policy weakening or new suppression was used merely to pass validation.
319
+
320
+ The operating principle remains:
321
+
322
+ ```text
323
+ LLM proposes. Renma verifies. Human approves.
324
+ ```
@@ -0,0 +1,32 @@
1
+ # Context Conflict Graph Diagnostics
2
+
3
+ Renma checks declared `conflicts` metadata so incompatible context assets do not become required together without review.
4
+
5
+ These diagnostics are deterministic catalog diagnostics. They do not choose runtime context, infer conflict intent, create scan finding IDs, or rewrite metadata.
6
+
7
+ ## Invalid conflicts metadata
8
+
9
+ Renma warns when an asset's `conflicts` metadata points at itself or points at an asset that does not exist in the catalog.
10
+
11
+ Example messages:
12
+
13
+ ```text
14
+ Asset conflicts metadata references itself: "context.testing.boundary-analysis".
15
+ Asset conflicts target "context.testing.missing" does not match a catalog entry.
16
+ ```
17
+
18
+ Fix self references by removing the conflict entry. Fix missing targets by correcting the asset ID, adding the missing asset, or removing stale metadata.
19
+
20
+ ## Conflicting required context
21
+
22
+ Renma warns when a skill requires two context assets that are declared as conflicting:
23
+
24
+ ```text
25
+ Skill requires conflicting context assets "context.testing.boundary-analysis" and "context.testing.fuzz-testing".
26
+ ```
27
+
28
+ A skill should not require conflicting context assets as always-loaded base knowledge. Split the skill, move one context to `optional_context`, remove stale `conflicts` metadata, or document a safer static relationship.
29
+
30
+ ## Relationship to context lens
31
+
32
+ These checks are useful before adding purpose-oriented lens assets. A lens should not have to compensate for skills that require mutually conflicting base context.
@@ -0,0 +1,99 @@
1
+ # Context Language Diagnostics
2
+
3
+ Renma checks canonical active shared context assets for small English-only wording patterns that can make reusable context harder for humans and agents to apply safely.
4
+
5
+ These diagnostics are deterministic catalog diagnostics. They do not call an LLM, infer a replacement threshold, infer a date or version, create scan finding IDs, or rewrite context content.
6
+
7
+ ## Scope
8
+
9
+ The checks apply only to shared context assets that are active and canonical:
10
+
11
+ - the artifact kind is `context`
12
+ - the asset has an `id` that starts with `context.`
13
+ - the asset has an `owner`
14
+ - the asset status is not `deprecated` or `archived`
15
+
16
+ ## Vague wording
17
+
18
+ Renma warns when a shared context body contains broad English wording such as:
19
+
20
+ - `usually`
21
+ - `often`
22
+ - `quickly`
23
+ - `soon`
24
+ - `as needed`
25
+ - `where appropriate`
26
+ - `major`
27
+
28
+ These terms are not always wrong, but they often require a concrete condition, threshold, required evidence, or uncertainty-handling rule before the context is safe to reuse broadly.
29
+
30
+ Example warning message:
31
+
32
+ ```text
33
+ Shared context asset contains vague wording "often".
34
+ ```
35
+
36
+ Prefer replacing vague wording with concrete boundaries, or keep the uncertainty explicit:
37
+
38
+ ```md
39
+ WDA may be involved only when session startup logs show WDA build, launch, or connection errors.
40
+ ```
41
+
42
+ Do not invent thresholds or domain facts just to satisfy the diagnostic. Ask the context owner when the boundary is unknown.
43
+
44
+ ## Currentness wording
45
+
46
+ Renma warns when a shared context body contains relative English currentness wording without an explicit date or version on the same line, such as:
47
+
48
+ - `recently`
49
+ - `latest`
50
+ - `currently`
51
+ - `as of now`
52
+
53
+ Example warning message:
54
+
55
+ ```text
56
+ Shared context asset contains currentness wording "recently" without an explicit date or version.
57
+ ```
58
+
59
+ Prefer a stable date, version, or review boundary:
60
+
61
+ ```md
62
+ As of 2026-07-01, Appium driver installation guidance uses this path.
63
+ ```
64
+
65
+ Versioned wording is also acceptable when it makes the claim stable:
66
+
67
+ ```md
68
+ The latest Appium 2.8 behavior is covered here.
69
+ ```
70
+
71
+ ## Prompt or runtime-selection wording
72
+
73
+ Renma warns when a shared context body looks like a prompt artifact or runtime context-selection rule instead of reusable base knowledge. Examples include:
74
+
75
+ - role-prompt wording such as `You are an ... assistant`
76
+ - runtime selection wording such as `always load this context`
77
+ - priority wording such as `use this context first`
78
+ - direct runtime wording such as `select this context at runtime`
79
+ - prompt-artifact wording such as `system prompt`
80
+
81
+ Example warning message:
82
+
83
+ ```text
84
+ Shared context asset contains prompt or runtime-selection wording "role prompt".
85
+ ```
86
+
87
+ Prefer keeping the context as reusable knowledge:
88
+
89
+ ```md
90
+ This context describes Appium setup terminology and constraints for maintainers.
91
+ ```
92
+
93
+ Put prompt assembly, runtime context selection, and assistant role instructions outside shared context assets. Renma does not choose runtime context, assemble prompts, inject context into agents, or execute agent workflows.
94
+
95
+ ## Relationship to metadata diagnostics
96
+
97
+ These body-language diagnostics complement usage-boundary metadata diagnostics such as missing `when_to_use`, missing `when_not_to_use`, and placeholder usage-boundary metadata.
98
+
99
+ Keep `when_to_use` and `when_not_to_use` compact. Put detailed explanations, examples, and caveats in the Markdown body or referenced context assets.
@@ -0,0 +1,253 @@
1
+ # Context Lens Assets
2
+
3
+ `context_lens` is a Renma asset type for purpose-oriented interpretation over reusable context assets.
4
+
5
+ It keeps the Renma core boundary intact:
6
+
7
+ ```text
8
+ LLM proposes. Renma verifies. Human approves.
9
+ ```
10
+
11
+ Renma catalogs and validates repository assets. Agents and tools decide what to do at runtime.
12
+
13
+ Renma does not select lenses for a task, rank lenses, assemble prompts, inject context, or run an LLM to judge lens quality.
14
+
15
+ ## Model
16
+
17
+ ```text
18
+ references -> contexts -> context_lenses -> skills
19
+ ```
20
+
21
+ The design principle is:
22
+
23
+ ```text
24
+ Knowledge should be reusable.
25
+ Interpretation should be purpose-oriented.
26
+ Execution should be skill-specific.
27
+ ```
28
+
29
+ Use this split when the same base context should be read differently for different purposes.
30
+
31
+ For example, a payment retry context can support:
32
+
33
+ - a spec review lens that focuses on ambiguity and source-of-truth gaps
34
+ - a test design lens that focuses on boundary values and expected results
35
+ - a failure analysis lens that focuses on observed symptoms and logs
36
+
37
+ The base context remains reusable. The lens explains how that context should be interpreted for a purpose.
38
+
39
+ See [`examples/context-lens`](../examples/context-lens) for a runnable fixture with two valid lenses, readiness output, inspect output, and an invalid diagnostic example.
40
+
41
+ ## Minimal Valid Lens
42
+
43
+ A minimal valid lens declares a stable ID, owner, purpose, and at least one `applies_to` target.
44
+
45
+ ```yaml
46
+ ---
47
+ id: lens.testing.spec-review.boundary-values
48
+ type: context_lens
49
+ owner: qa-platform
50
+ status: experimental
51
+ purpose: spec_review
52
+ applies_to:
53
+ - context.testing.boundary-value-analysis
54
+ ---
55
+ # Spec Review Lens for Boundary Values
56
+
57
+ Review the boundary value analysis context for ambiguity, missing limits, and unclear sources of truth.
58
+ ```
59
+
60
+ `type: context_lens` is optional for files under `lenses/**`, but it is recommended because it makes the file's intent obvious in code review. It is required when a lens is stored under `context/**` or `contexts/**`.
61
+
62
+ ## Multiple Lenses
63
+
64
+ Multiple lenses can interpret the same base context for different review purposes:
65
+
66
+ ```yaml
67
+ ---
68
+ id: lens.testing.spec-review.boundary-values
69
+ type: context_lens
70
+ owner: qa-platform
71
+ status: experimental
72
+ purpose: spec_review
73
+ applies_to:
74
+ - context.testing.boundary-value-analysis
75
+ focus:
76
+ - ambiguity
77
+ - missing boundary
78
+ expected_outputs:
79
+ - unresolved questions
80
+ - risk notes
81
+ ---
82
+ ```
83
+
84
+ ```yaml
85
+ ---
86
+ id: lens.testing.test-design.boundary-values
87
+ type: context_lens
88
+ owner: qa-platform
89
+ status: experimental
90
+ purpose: test_design
91
+ applies_to:
92
+ - context.testing.boundary-value-analysis
93
+ focus:
94
+ - inclusive limits
95
+ - zero and empty values
96
+ - overflow behavior
97
+ expected_outputs:
98
+ - test cases
99
+ - edge-case checklist
100
+ ---
101
+ ```
102
+
103
+ A skill declares static lens relationships with `requires_lens` or `optional_lens`:
104
+
105
+ ```yaml
106
+ ---
107
+ id: skill.testing.spec-review
108
+ owner: qa-platform
109
+ status: experimental
110
+ requires_context:
111
+ - context.testing.boundary-value-analysis
112
+ requires_lens:
113
+ - lens.testing.spec-review.boundary-values
114
+ ---
115
+ ```
116
+
117
+ These fields create catalog and graph relationships. They do not make Renma choose runtime context or inject the lens into an agent.
118
+
119
+ ## Supported Fields
120
+
121
+ Prefer compact, flat metadata. Detailed interpretation guidance belongs in the Markdown body, not in frontmatter.
122
+
123
+ - `id`: required stable lens ID. Prefer the `lens.<domain>.<purpose>` prefix style.
124
+ - `type`: recommended `context_lens` discriminator.
125
+ - `owner`: required accountable owner.
126
+ - `status`: optional lifecycle status: `experimental`, `stable`, `deprecated`, or `archived`.
127
+ - `version`: optional lens schema version. The supported schema version is `1`.
128
+ - `scope`: optional lens scope. The supported scope is `context`.
129
+ - `purpose`: required short purpose label such as `spec_review`, `test_design`, or `failure_analysis`.
130
+ - `applies_to`: required context asset IDs or repository-relative paths this lens interprets.
131
+ - `focus`: optional compact review focus terms.
132
+ - `expected_outputs`: optional compact output expectations.
133
+
134
+ Deprecated field aliases such as `target`, `targets`, `output`, and `outputs` produce warnings. Use `applies_to` and `expected_outputs`.
135
+
136
+ ## Diagnostics
137
+
138
+ Context Lens governance diagnostics use stable string codes in JSON output. The detailed diagnostics appear in `scan` and `readiness`; concise summaries appear in `readiness` and `inspect`.
139
+
140
+ Invalid example:
141
+
142
+ ```yaml
143
+ ---
144
+ id: lens.testing.spec-review.boundary-values
145
+ owner: qa-platform
146
+ applies_to:
147
+ - ./contexts/testing/missing.md
148
+ ---
149
+ # Spec Review Lens
150
+ ```
151
+
152
+ Expected diagnostics include:
153
+
154
+ - `CONTEXT-LENS-MISSING-REQUIRED-FIELD` because `purpose` is missing.
155
+ - `CONTEXT-LENS-PATH-NORMALIZATION-MISMATCH` because `./contexts/testing/missing.md` normalizes to `contexts/testing/missing.md`.
156
+ - `CONTEXT-LENS-TARGET-NOT-FOUND` because the target path does not resolve to a cataloged asset.
157
+
158
+ Blocking Context Lens diagnostics are `error` diagnostics. Warnings are reported by default but do not fail readiness unless another policy makes the repository not ready.
159
+
160
+ ## Readiness And Inspect
161
+
162
+ `renma readiness --json` includes an additive `summary.contextLens` object:
163
+
164
+ ```json
165
+ {
166
+ "summary": {
167
+ "contextLens": {
168
+ "enabled": true,
169
+ "detected": true,
170
+ "totalLensCount": 2,
171
+ "validLensCount": 2,
172
+ "invalidLensCount": 0,
173
+ "diagnosticCounts": {
174
+ "error": 0,
175
+ "warning": 0,
176
+ "info": 0
177
+ }
178
+ }
179
+ }
180
+ }
181
+ ```
182
+
183
+ Markdown readiness includes a `Context Lens` section with lens counts, diagnostic counts, a representative diagnostic code, definition paths, and target references.
184
+
185
+ `renma inspect <file> --format text` includes a concise Context Lens summary:
186
+
187
+ ```text
188
+ Context Lens:
189
+ - Enabled: yes
190
+ - Detected: yes
191
+ - Lenses: 2/2 valid (0 invalid)
192
+ - Diagnostics: error 0, warning 0, info 0
193
+ - Representative diagnostic: (none)
194
+ - Definition paths: lenses/testing/spec-review-boundary-values.md, lenses/testing/test-design-boundary-values.md
195
+ - Target references: context.testing.boundary-value-analysis
196
+ ```
197
+
198
+ `renma inspect <file> --format json` includes the same additive `contextLens` summary object.
199
+
200
+ ## CI Usage
201
+
202
+ Use readiness in CI when Context Lens governance should block merges:
203
+
204
+ ```bash
205
+ renma readiness . --json
206
+ ```
207
+
208
+ The command exits `1` when readiness is not ready, including when blocking Context Lens diagnostics are present.
209
+
210
+ For pull-request review artifacts, `renma ci-report` continues to report deterministic catalog, graph, readiness, finding, and security deltas. It does not call an LLM or make subjective lens-quality judgments.
211
+
212
+ ## Authoring Helpers
213
+
214
+ Use `scaffold` to create a compact starter lens:
215
+
216
+ ```bash
217
+ renma scaffold context_lens lenses/testing/spec-review-boundary-values.md \
218
+ --id lens.testing.spec-review.boundary-values \
219
+ --title "Spec Review Boundary Values Lens" \
220
+ --owner qa-platform \
221
+ --tags testing,spec-review
222
+ ```
223
+
224
+ Use `inspect` on a lens to review its purpose metadata and declared graph neighborhood. Lens inspection shows inbound skill references, outbound `applies_to` context targets, and the static `skill -> lens -> context` chain.
225
+
226
+ ## Good Lens Boundaries
227
+
228
+ A lens should answer:
229
+
230
+ - What purpose is this context being read for?
231
+ - Which context assets does it apply to?
232
+ - What questions, risks, checks, or evidence should be emphasized?
233
+ - What output shape should the agent or human reviewer produce?
234
+
235
+ A lens should not become:
236
+
237
+ - a copy of the base context
238
+ - a long prompt template
239
+ - a runtime routing rule
240
+ - a QA-specific rule hardcoded into Renma core
241
+ - a replacement for the skill entrypoint
242
+
243
+ ## Non-Goals For 0.12.0
244
+
245
+ Renma 0.12.0 intentionally does not implement:
246
+
247
+ - runtime selection
248
+ - prompt assembly
249
+ - context injection
250
+ - automatic LLM judgment or subjective scoring
251
+ - external signal imports from Codex, Claude, IDEs, or similar tools
252
+
253
+ The release stabilizes deterministic Context Lens governance: summary output, diagnostics, readiness integration, inspect integration, docs, and examples.