cliewen-openspec 0.1.0-alpha.1 → 0.2.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 (37) hide show
  1. package/CHANGELOG.md +87 -54
  2. package/README.md +106 -104
  3. package/adapters/node-test.mjs +21 -4
  4. package/dist/cli.js +7 -31
  5. package/dist/compatibility.d.ts +12 -0
  6. package/dist/compatibility.js +87 -0
  7. package/dist/core.d.ts +23 -4
  8. package/dist/core.js +107 -35
  9. package/dist/quality.d.ts +27 -0
  10. package/dist/quality.js +412 -0
  11. package/dist/release.d.ts +9 -0
  12. package/dist/release.js +23 -0
  13. package/dist/schema-source.js +1 -1
  14. package/docs/configuration.md +317 -265
  15. package/docs/testing/evidence.md +88 -86
  16. package/docs/testing/pilot-prompt.md +1 -1
  17. package/docs/testing/test-quality.md +84 -0
  18. package/package.json +9 -5
  19. package/schemas/all/templates/tasks.md +1 -5
  20. package/schemas/base/instructions/closure.md +33 -0
  21. package/schemas/base/instructions/humanizer.md +7 -0
  22. package/schemas/base/instructions/learnings.md +6 -0
  23. package/schemas/base/instructions/planning.md +31 -0
  24. package/schemas/base/instructions/product-context.md +31 -0
  25. package/schemas/base/instructions/prototyping.md +33 -0
  26. package/schemas/base/instructions/routing.md +1 -0
  27. package/schemas/base/instructions/testing-approach.md +14 -13
  28. package/schemas/base/instructions/work-scoping.md +12 -0
  29. package/schemas/base/instructions/writing.md +8 -0
  30. package/schemas/base/templates/learning.md +19 -0
  31. package/schemas/delivery/instructions/apply.md +2 -1
  32. package/schemas/delivery/instructions/tasks.md +3 -2
  33. package/schemas/delivery/templates/tasks.md +5 -7
  34. package/schemas/discovery/instructions/apply.md +1 -0
  35. package/schemas/discovery/instructions/investigation.md +1 -0
  36. package/dist/tdd.d.ts +0 -8
  37. package/dist/tdd.js +0 -276
@@ -1,265 +1,317 @@
1
- ---
2
- type: reference
3
- ---
4
- # Project configuration
5
-
6
- Cliewen reads project settings from `.cliewen-openspec/config.yaml`.
7
-
8
- ## Full defaults
9
-
10
- This is the complete configuration written by `init`. Omitted fields use these values; unknown settings and invalid values fail validation. Changes apply when the next operation reads the config. They do not rewrite existing proposals or task lists.
11
-
12
- <!-- defaults -->
13
- ```yaml
14
- docsRoot: docs
15
- features:
16
- documentation: true
17
- decisions: true
18
- mermaid: true
19
- planning: true
20
- review: true
21
- evidence: true
22
- evidence:
23
- report: .cliewen-openspec/evidence.json
24
- ac:
25
- capabilities: {}
26
- padding: 3
27
- testing:
28
- placement: per-task
29
- approach: flexible
30
- types:
31
- Unit:
32
- description: Isolated behavior without external dependencies
33
- Integration:
34
- description: Interaction between components or dependencies
35
- E2E:
36
- description: Complete user or system workflow
37
- ```
38
-
39
- ## Documentation and features
40
-
41
- | Setting | Default | Effect |
42
- |---|---|---|
43
- | `docsRoot` | `docs` | Root for durable explanations; init creates an entry README if absent |
44
- | `features.documentation` | `true` | Guidance to assess and maintain affected documentation |
45
- | `features.decisions` | `true` | Guidance for considering and recording durable decisions |
46
- | `features.mermaid` | `true` | Guidance to use embedded Mermaid where useful |
47
- | `features.planning` | `true` | Makes optional planning guidance available; does not require a plan |
48
- | `features.review` | `true` | Makes review guidance available; a separate reviewer remains optional |
49
- | `features.evidence` | `true` | Scenario-ID and execution-report checks |
50
- | `evidence.report` | `.cliewen-openspec/evidence.json` | Repository-local path to the execution report |
51
-
52
- All paths must stay inside the project; absolute paths, parent traversal, and symlink components are rejected. A custom evidence report path must be Git-ignored and untracked before the reference adapter can write it. New installations ignore the default `evidence.json` report, `transaction.json`, and local `tdd/` history in `.cliewen-openspec/.gitignore`. Existing ignore files are preserved.
53
-
54
- ## Test types
55
-
56
- `testing.types` defaults to `Unit`, `Integration`, and `E2E`, with the descriptions shown above. A project-defined mapping replaces the entire default set. Names are case-sensitive, may contain spaces, and must be nonempty, single-line names without surrounding whitespace or square brackets. Each entry requires a nonempty `description`; an empty mapping is invalid.
57
-
58
- For example, a project that calls its tests Component and System can use:
59
-
60
- ```yaml
61
- testing:
62
- types:
63
- Component:
64
- description: One component tested in process with controlled dependencies
65
- System:
66
- description: A complete workflow against a deployed system
67
- ```
68
-
69
- Each scenario needs exactly one `Test-type: Component` line beneath its heading. With the Node adapter, give each mapped test a title such as `exports rows [EXPORT-001] [Test-type: Component]`. Tasks should name the concrete test, type, and verification boundary. The checker requires evidence `testType` to match the scenario's declared type exactly; it does not assume one type substitutes for another. Task descriptions and the actual quality of the test boundary still require review.
70
-
71
- For existing projects, add types to scenarios and test titles, commit the inputs, then regenerate evidence. Older reports without `testType` fail the check and are not automatically upgraded. Evidence opt-out skips these checks. Testing types do not change per-task placement or TDD ordering.
72
-
73
- The alpha supplies guidance for documentation, decisions, Mermaid, planning, and review. It does not structurally validate those documents or independently enforce agent behavior. Disabling a facility preserves authored files. Evidence opt-out skips product evidence checks; installation, registry, and explicitly selected TDD completion checks still run.
74
-
75
- For example, to use a different documentation root and turn off Mermaid guidance:
76
-
77
- ```yaml
78
- docsRoot: project-docs
79
- features:
80
- mermaid: false
81
- ```
82
-
83
- Other fields retain their defaults. The YAML objects `features`, `ac`, and `testing` support partial settings. If you provide `evidence`, include its `report` string. Changing `docsRoot` does not move existing files. The schema artifact graph is selected by the OpenSpec schema and is not rewritten by feature flags.
84
-
85
- ## Testing and IDs at a glance
86
-
87
- ```yaml
88
- ac:
89
- padding: 3
90
- capabilities: {}
91
- testing:
92
- placement: per-task
93
- approach: flexible
94
- types:
95
- Unit:
96
- description: Isolated behavior without external dependencies
97
- Integration:
98
- description: Interaction between components or dependencies
99
- E2E:
100
- description: Complete user or system workflow
101
- ```
102
-
103
- ## Acceptance criterion IDs
104
-
105
- An ID consists of an uppercase prefix, a hyphen, and a positive sequence number. Register a prefix for each capability before allocating IDs:
106
-
107
- ```yaml
108
- ac:
109
- padding: 3
110
- capabilities:
111
- csv-export: EXP
112
- account-management: ACC
113
- support: SUP
114
- ```
115
-
116
- Capability names match their directories under `openspec/specs/` or the change's `specs/`. A new capability can be registered before its spec directory exists. There is no global prefix or automatic prefix selection.
117
-
118
- Choose a short, recognizable capability or domain name with your team. `EXPORT` and `EXP` are equally valid; Cliewen does not infer either from the change title. Reuse the chosen prefix for that capability across changes. The prefix must start with an uppercase letter and contain only uppercase letters and digits.
119
-
120
- ```sh
121
- cliewen-openspec ac next --capability csv-export # EXP-001 initially
122
- cliewen-openspec ac next --capability support # SUP-001 initially
123
- cliewen-openspec ac next EXP # Same registered sequence as csv-export
124
- ```
125
-
126
- `padding` is the minimum number of digits, from 1 to 12. For example, 1 produces `EXP-1`, 3 produces `EXP-001`, and 4 produces `EXP-0001`. Numbers grow beyond the minimum width without truncation. The separator is always a hyphen; arbitrary ID templates are not supported.
127
-
128
- Each capability owns one numeric sequence. The allocator consults the committed `.cliewen-openspec/ac-registry.json` and existing OpenSpec Markdown, including active and archived changes. It never reclaims allocated numbers. Changing padding continues the same sequence and does not rewrite existing IDs. Commit the registry together with config and specs. Parallel branches still need collision resolution; this allocator supports sequential work rather than distributed allocation.
129
-
130
- ### Renaming a prefix
131
-
132
- Use the command rather than editing an established mapping directly:
133
-
134
- ```sh
135
- cliewen-openspec ac rename-prefix csv-export EXPORT
136
- cliewen-openspec ac next --capability csv-export
137
- ```
138
-
139
- If the highest allocated number was `EXP-017`, the next ID is `EXPORT-018`. Existing scenarios and tests keep their `EXP-...` references. The command updates config and registry in one recoverable transaction, preserving YAML comments. Config and registry mismatches block allocation and are reported by `check`, including when evidence is disabled. Restore the registered prefix in config before running the rename command if you edited it manually.
140
-
141
- Current and historical prefixes remain reserved to their original capability, even if its config mapping is removed. Allocation using a retired prefix is rejected with guidance to use the current capability. Previously used prefixes cannot be reassigned, including renaming back to a historical prefix. The command also rejects target prefixes already appearing in OpenSpec documents.
142
-
143
- The registry records each capability's current prefix, previous prefixes, and highest allocated number. Existing flat alpha registries are adopted on the next allocation or rename: first map each used prefix to its original capability. Unmapped legacy counters remain reserved; they are never silently discarded or assigned to new capabilities. `check` validates this state without writing it. Removing the registry loses allocation history, so retain it in version control.
144
-
145
- The earlier experimental `ac.prefix` setting is no longer supported. Replace it with `ac.capabilities` before using this version. Existing bracketed IDs remain valid evidence references regardless of prefix history.
146
-
147
- ## Test placement
148
-
149
- `testing.placement` controls the schema's planning and implementation guidance:
150
-
151
- - `per-task` (default): Each implementation task includes its relevant tests, a test command, and a completion check. Implement a small slice, run its tests, fix failures, and then continue to the next task. Documentation-only tasks can use an appropriate validation check. This provides fast feedback throughout implementation.
152
- - `end-of-change`: Plan tests in a final verification section, with explicit links to the implementation tasks they cover.
153
-
154
- Both modes retain final regression testing and revision-bound evidence collection. Per-task test runs provide immediate feedback; the evidence adapter records results for the final committed inputs. Disabling evidence does not disable ordinary task-level testing.
155
-
156
- In flexible mode, placement is guidance supplied by the installed schema and task template. Selecting TDD also enables the completion checks below. Configuration changes do not rewrite existing task lists; revise the task plan when changing this setting.
157
-
158
- ## Test-driven development
159
-
160
- Test placement and test-driven development (TDD) are separate choices. Enable TDD with:
161
-
162
- ```yaml
163
- testing:
164
- placement: per-task
165
- approach: tdd
166
- ```
167
-
168
- `approach: flexible` is the default and permits tests before or after implementation within the selected placement. Existing config files that omit `approach` keep this behavior. `approach: tdd` requires `placement: per-task`; contradictory settings are rejected.
169
-
170
- With TDD, each implementation task contains one red-green-refactor cycle:
171
-
172
- 1. Write a focused test before implementing the behavior. Run it and observe failure for the intended missing behavior. Setup, import, and syntax errors do not establish this red phase.
173
- 2. Implement the minimum behavior needed for the test to pass and run it again.
174
- 3. Refactor with relevant tests remaining green, then continue to the next task.
175
-
176
- For example: "Add quotation-mark escaping: write and run the tagged test first and confirm the expected failure; implement escaping until the test passes; refactor and rerun the relevant tests." Record commands and observed red/green outcomes in task completion notes. If a new test already passes against existing code, report that honestly rather than claiming an observed red phase. Documentation-only work uses appropriate validation checks.
177
-
178
- With TDD selected, `check --change NAME` also requires task metadata and recorded execution history. This applies to delivery and the delivery outcome of `cliewen-all`, including when `features.evidence` is false. Discovery and combined no-delivery closure do not require delivery history. Flexible mode keeps its existing behavior.
179
-
180
- ### Describe each task
181
-
182
- Add one `yaml cliewen-tasks` fenced block to the change's `tasks.md`. Every checkbox needs a unique numeric ID and a matching entry. Keep the normal task text and completion check; the block supplies the machine-readable verification details.
183
-
184
- ````markdown
185
- - [ ] 1.1 Add CSV quoting and verify quotation marks at the Unit function boundary.
186
-
187
- ```yaml cliewen-tasks
188
- version: 1
189
- tasks:
190
- "1.1":
191
- method: tdd
192
- command: [node, --test, test/export.test.mjs]
193
- tests: [test/export.test.mjs]
194
- implementation: [export.mjs]
195
- ```
196
- ````
197
-
198
- `command` is an executable followed by its arguments, run from your project root without a shell. Use explicit project-relative file paths, including files that will be created. Globs and directories are not file lists. Test and implementation lists must be distinct and together cover the task's verification boundary. Review that coverage; Cliewen cannot discover omitted production files or infer which assertions a command runs.
199
-
200
- Choose a method for each task:
201
-
202
- | Method | Recorded sequence | When to use it |
203
- |---|---|---|
204
- | `tdd` | start → red → green | New or changed behavior; tests change before red while implementation stays unchanged |
205
- | `characterization` | start → baseline → green | Add coverage for existing behavior; baseline already passes against unchanged implementation |
206
- | `refactor` | start → baseline → green | Existing tests pass before and after refactoring; test files stay unchanged |
207
- | `verification` | start → verify | Work with another suitable completion check, such as documentation links or a build |
208
-
209
- Every method uses `command`, `tests`, and `implementation`. TDD requires both file lists to be nonempty; characterization and refactor require test files. Verification can use `tests: []` and list documents under `implementation`. Every method other than `tdd` requires a nonempty `reason` explaining the departure. For example, a documentation task can use `method: verification`, `reason: "Only the command reference changes; build the docs and check links."`, and its documentation build command. Review reasons with the task plan. A configuration or tooling change that changes behavior still needs a behavior test.
210
-
211
- ### Record actual runs
212
-
213
- Run these commands from the adopting project's root. Start before changing the task's declared files:
214
-
215
- ```sh
216
- npx --no-install cliewen-openspec tdd start --change add-csv-export --task 1.1
217
- ```
218
-
219
- Write the focused test, then record the red run using the exact command argument list from the task:
220
-
221
- ```sh
222
- npx --no-install cliewen-openspec tdd run --change add-csv-export --task 1.1 --phase red --reason "Quotation marks are not escaped yet" -- node --test test/export.test.mjs
223
- ```
224
-
225
- The recorder returns the test command's exit code. A red run should exit nonzero. Inspect the captured failure before implementing: syntax, import, setup, or wrong-expectation failures do not establish missing behavior. `--reason` records your explanation; it does not validate it.
226
-
227
- Implement the behavior and record green:
228
-
229
- ```sh
230
- npx --no-install cliewen-openspec tdd run --change add-csv-export --task 1.1 --phase green -- node --test test/export.test.mjs
231
- ```
232
-
233
- Keep test files unchanged between red and green. After refactoring production code, record green again. Failed green attempts are retained; the last run must pass. Changing tests requires another start and verification cycle. Do not manufacture a red phase for behavior already implemented; choose the honest method and explain it in the reviewed plan.
234
-
235
- For characterization or refactoring, use `--phase baseline` for the passing run before production changes, then `--phase green`. For a verification exception, use `--phase verify` after the work. Each task begins with `tdd start`. If its definition changes, start a new cycle; the recorder appends history and preserves earlier attempts.
236
-
237
- After the task's actual verification succeeds, mark its checkbox complete. Once all tasks are complete, run:
238
-
239
- ```sh
240
- npx --no-install cliewen-openspec check --change add-csv-export --json
241
- ```
242
-
243
- Keep final evidence collection and this completion check outside numbered task checkboxes and recorded task commands. A final verification task should run the actual regression suite or documentation check. Recording `check` itself would make it assess its own unfinished history while a recorder lock exists.
244
-
245
- ### Completion checks and limits
246
-
247
- The recorder appends JSON events to `.cliewen-openspec/tdd/add-csv-export.jsonl`. Events contain task-definition and file hashes, command arguments, output, exit code, and recording time. It compares snapshots before and after each command; commands that change declared inputs cannot establish the required sequence. It blocks simultaneous recording for the same change. Later tasks can edit shared files if their recorded starting states continue from the earlier task's recorded state.
248
-
249
- Missing metadata/history, unchecked tasks, stale definitions/files, malformed history, and incomplete or invalid ordering produce errors. A final passing product evidence report cannot replace this history. `check` reads it without running tests or writing files. Without `--change`, permanent-spec checks report that TDD ordering was not assessed; they do not establish task completion after archive.
250
-
251
- History is local verification data, separate from the final revision-bound evidence report. Keep it available until completion review; CI needs the same history as an artifact if it performs this check. Existing installations must add `tdd/` to `.cliewen-openspec/.gitignore` before recording. Update preserves that file. Review captured project output before sharing it; do not hand-edit events or discard failures to obtain a pass.
252
-
253
- The history is not tamper-proof and the recorder does not restrict writes through other tools. Review the actual failure cause, assertions, declared file coverage, and exception reasons. These checks establish consistency of the captured sequence, not a guarantee that every edit was observed. Stronger write control remains planned.
254
-
255
- Final regression and clean committed-revision evidence collection remain required when evidence is enabled. Finish task notes before committing and collecting evidence. Install the updated package and refresh installed schemas with `update`; older authored task lists need explicit metadata and honest new verification, not reconstructed historical claims.
256
-
257
- ## Decision filenames
258
-
259
- New projects use `NNN-short-title.md`, such as `001-use-a-shared-base.md`, for new Decision Records. The sequence starts at 1, padded to a minimum of three digits for filename sorting. Numbers above 999 grow naturally. This is a naming convention in the schema guidance, not a configurable setting or an implemented decision allocator.
260
-
261
- Existing filenames and paths are stable public addresses: never rename, move, or renumber documents to normalize naming, titles, categories, or padding. External systems such as GitHub may link to them. Edit content and metadata in place, even when a title or category changes. Existing projects retain conventions such as `ADR-059-title.md` and `PDR-074-title.md`; read their allocation rules and use their existing ID authority rather than starting a competing counter. These conventions are not yet configurable in the alpha. The project owner explicitly authorized normalizing this repository's first two decision filenames to three digits; that local exception does not authorize renaming documents in other projects.
262
-
263
- ## Existing alpha installations
264
-
265
- Install the new package, then use [update](guide/updating.md) to preview and refresh owned schema files and templates. Current support covers existing 0.1.0-alpha.1 manifests, including earlier builds. Configuration, registry, authored artifacts, and document paths are preserved. Adding config settings alone does not replace installed instructions. Other manifest versions and config/registry migrations are not supported automatically.
1
+ ---
2
+ type: reference
3
+ ---
4
+ # Project configuration
5
+
6
+ Cliewen reads project settings from `.cliewen-openspec/config.yaml`.
7
+
8
+ This reference describes version `0.2.0`. The earlier published `0.1.0-alpha.1` does not accept the `quality`, `lifecycle`, `learnings`, or `writing` settings below. Use that package's bundled reference when working with the alpha; its installation manifest is unsupported by 0.2.0.
9
+
10
+ ## Version compatibility
11
+
12
+ Cliewen requires **OpenSpec 1.15.0 or newer**, **Node.js 20.19 or newer**, and Git. Current development pins OpenSpec 1.17.0. The published 0.1.0 release was checked with OpenSpec 1.15.0; 0.2.0 checks cover OpenSpec 1.15.0 and 1.17.0.
13
+
14
+ OpenSpec has its own installation requirements:
15
+
16
+ | Installation | Node requirement |
17
+ |---|---|
18
+ | Cliewen CLI | Node 20.19+ |
19
+ | OpenSpec 1.15.0 via npm | Compatible with the Cliewen Node 20.19 minimum |
20
+ | OpenSpec 1.17.0 via npm | Node 22.12+ |
21
+ | OpenSpec standalone binary | No Node runtime for OpenSpec itself; Cliewen still needs Node |
22
+
23
+ On Node 20.19, pin `@fission-ai/openspec@1.15.0` or use a compatible OpenSpec standalone installation. The current worked npm guide uses OpenSpec 1.17.0 and therefore requires Node 22.12+. See [OpenSpec's release notes](https://github.com/Fission-AI/OpenSpec/blob/main/CHANGELOG.md) for its own runtime requirements.
24
+
25
+ The minimum is a compatibility floor, not proof that every newer release has been tested. A future Cliewen release may raise its OpenSpec or Node minimum. Review that release's requirements before upgrading.
26
+
27
+ Version 0.2.0 checks these minimums at every `init` and `update`, including previews, before recovery or installation writes. Published 0.1.0 does not perform these checks. No persistent success cache is used. Other commands keep their existing requirements; explicit `recover` remains available to restore an interrupted transaction.
28
+
29
+ The check uses the project's resolvable OpenSpec npm installation first, otherwise the CLI on PATH, including a standalone executable. It runs that installation's public `--version`; an incompatible or broken selected local installation does not fall back to a global version. Output identifies the source and detected versions. Missing tools, invalid/prerelease versions, execution failure, or a probe exceeding five seconds stop init/update with an actionable error. Cliewen neither downloads nor upgrades OpenSpec during this check.
30
+
31
+ The 0.2.0 upgrade route accepts published 0.1.0 ownership manifests and the running target version. Further source versions require explicit support; alpha installations, unknown formats, and downgrades remain unsupported. See [updating an installation](guide/updating.md) for package/resource boundaries and preview output; never relabel a manifest to bypass validation.
32
+
33
+ ## Optional product context in development
34
+
35
+ Version 0.2.0 installs `.cliewen-openspec/product-context.md` for product intent, useful cross-capability journeys, and detection of drift or scope creep. Published 0.1.0 does not contain this reference. There is no new configuration field or required artifact. `features.documentation` controls optional records under `docsRoot` or existing project paths; `features.planning` independently controls planning authority and ticket access. Disabled facilities add no corresponding work and preserve authored content. Existing supplied context still informs normal scoping. See [product intent and journeys](guide/workflow.md#keep-the-users-outcome-in-view) for an illustrative example and limits.
36
+
37
+ ## Full defaults
38
+
39
+ This is the complete configuration written by `init`. Omitted fields use these values; unknown settings and invalid values fail validation. Changes apply when the next operation reads the config. They do not rewrite existing proposals or task lists.
40
+
41
+ <!-- defaults -->
42
+ ```yaml
43
+ docsRoot: docs
44
+ learnings:
45
+ enabled: false
46
+ directory: learnings
47
+ writing:
48
+ humanizer: auto
49
+ features:
50
+ documentation: true
51
+ decisions: true
52
+ mermaid: true
53
+ planning: true
54
+ review: true
55
+ evidence: true
56
+ evidence:
57
+ report: .cliewen-openspec/evidence.json
58
+ ac:
59
+ capabilities: {}
60
+ padding: 3
61
+ testing:
62
+ placement: per-task
63
+ quality:
64
+ coverage:
65
+ mode: review
66
+ minimumCases:
67
+ positive: 1
68
+ negative: 1
69
+ boundary: 0
70
+ effectiveness:
71
+ mode: review
72
+ lifecycle:
73
+ mode: review
74
+ types:
75
+ Unit:
76
+ description: Isolated behavior without external dependencies
77
+ Integration:
78
+ description: Interaction between components or dependencies
79
+ E2E:
80
+ description: Complete user or system workflow
81
+ ```
82
+
83
+ ## Test quality and lifecycle
84
+
85
+ Each of `testing.quality.coverage.mode`, `testing.quality.effectiveness.mode`, and `testing.lifecycle.mode` accepts `off`, `review`, or `enforce`. The default is `review`: incomplete assessments produce warnings. `enforce` makes missing or invalid records blocking and requires `features.evidence: true`. `off` disables that policy's checks and guidance. Evidence opt-out leaves review guidance available but reports that execution-backed assessment is unavailable.
86
+
87
+ Coverage counts distinct passed cases by scenario and category. Configure nonnegative safe-integer minima under `testing.quality.coverage.minimumCases`; omitted categories retain their defaults. One positive and one negative case are required by default, with relevant boundary cases assessed during review. A reviewed exception can waive a category minimum for a particular scenario.
88
+
89
+ For example, to enforce coverage while leaving other policies advisory:
90
+
91
+ ```yaml
92
+ testing:
93
+ quality:
94
+ coverage:
95
+ mode: enforce
96
+ minimumCases:
97
+ positive: 2
98
+ ```
99
+
100
+ This requires two positive and one negative case per scenario. It does not count retries or prove cases are meaningfully different. See [test quality and lifecycle](testing/test-quality.md) for tagging tests, writing review records, and handling exceptions.
101
+
102
+ ## Documentation and features
103
+
104
+ | Setting | Default | Effect |
105
+ |---|---|---|
106
+ | `docsRoot` | `docs` | Root for durable explanations; init creates an entry README if absent |
107
+ | `features.documentation` | `true` | Guidance to assess and maintain affected documentation |
108
+ | `features.decisions` | `true` | Guidance for considering and recording durable decisions |
109
+ | `features.mermaid` | `true` | Guidance to use embedded Mermaid where useful |
110
+ | `features.planning` | `true` | Enables planning-authority discovery, ticket access guidance, and plan maintenance; does not require a plan |
111
+ | `features.review` | `true` | Makes review guidance available; a separate reviewer remains optional |
112
+ | `features.evidence` | `true` | Scenario-ID and execution-report checks |
113
+ | `evidence.report` | `.cliewen-openspec/evidence.json` | Repository-local path to the execution report |
114
+
115
+ All paths must stay inside the project; absolute paths, parent traversal, and symlink components are rejected. A custom evidence report path must be Git-ignored and untracked before the reference adapter can write it. New installations ignore the default `evidence.json` report, `transaction.json`, and local `tdd/` history in `.cliewen-openspec/.gitignore`. Existing ignore files are preserved.
116
+
117
+ ## Project learnings
118
+
119
+ Set `learnings.enabled: true` to ask the coding agent to retrieve and maintain reusable project lessons. `learnings.directory` is relative to `docsRoot`. For example:
120
+
121
+ ```yaml
122
+ docsRoot: notes
123
+ learnings:
124
+ enabled: true
125
+ directory: lessons
126
+ ```
127
+
128
+ This selects `notes/lessons/`. The installer does not create that directory or an empty index. When a useful lesson exists, the agent follows the existing collection's conventions or uses `.cliewen-openspec/templates/learning.md` and a short `README.md` index. The index lists titles, scope, status, and links. The agent reads the index first, then opens selected relevant notes in a later tool call. Broad content searches exclude unselected notes. Missing or unclear index information is a limitation to report, rather than a reason to load the whole collection.
129
+
130
+ New notes distinguish `tentative`, `verified`, and `retired` guidance and record the situation, observation, evidence, correction, scope, and limits. Verified notes include a `lastVerified` date. Recheck applicability: a lesson never overrides current specs or accepted decisions. At closure, merge duplicates through links, retire stale notes in place, and promote recurring guidance into tests or durable rules where useful. Explicit maintenance may read affected historical notes selected from the index; ordinary work skips retired and unrelated contents. Routine work need not produce a lesson.
131
+
132
+ Disabling learnings stops retrieval and maintenance guidance while preserving authored content. `features.documentation: false` also suppresses this workflow, even if learnings are enabled. Update and uninstall preserve authored notes and indexes; the installed template remains an owned resource. Existing knowledge outside the selected directory can be referenced without copying or moving it. Absolute, escaping, and empty directory settings are rejected; symlinks in the collection path are rejected when learnings are active. Disabled learnings do not inspect an unused collection path.
133
+
134
+ ### Instructions before context collection
135
+
136
+ Some agents gather project context before requesting OpenSpec instructions. Schema guidance becomes available when those instructions are read; it cannot prevent earlier reads. For development-source installations containing `.cliewen-openspec/planning.md`, add this rule to the project's existing agent instruction file, such as `AGENTS.md` or the host's equivalent:
137
+
138
+ ```text
139
+ Before creating or resuming an OpenSpec change, first read only .cliewen-openspec/config.yaml and .cliewen-openspec/planning.md, without batching project documents or lesson contents into that tool call. Follow the reference's learning-policy and index-first instructions before broad reads or searches, independently of features.planning. Apply its work-scoping guidance and enable planning-specific requests only when features.planning is enabled. Retrieve the selected native OpenSpec artifact or apply instructions before executing the workflow.
140
+ ```
141
+
142
+ The installer does not add or replace this project-owned rule. It requests an order; agent behavior still needs review. A trace that shows an unwanted read takes precedence over an agent's claim that it skipped the file.
143
+
144
+ Published 0.1.0 does not contain the planning reference. For that installation, request native OpenSpec artifact or apply instructions first and follow their learning-policy and index-first rules before broad context collection. Updating package code alone does not refresh installed references; use the supported installation lifecycle and review local ownership conflicts.
145
+
146
+ These are agent instructions, not a content validator. `check` cannot establish that a lesson is true, relevant, or actually retrieved. Changing settings requires no reinstall, but upgrading from an older package requires [updating its installed instructions](guide/updating.md).
147
+
148
+ ## Humanizer and writing
149
+
150
+ Baseline writing guidance applies in every mode. Agents should distinguish the accepted contract from runtime observations, describe the output representation actually checked, and name what each verification command establishes. These requests need review; neither Humanizer nor `check` validates every factual claim.
151
+
152
+ `writing.humanizer` controls the coding agent's use of an external skill:
153
+
154
+ | Value | Behavior |
155
+ |---|---|
156
+ | `auto` (default) | Inspect the host's exposed inventory and use a usable Humanizer skill when available |
157
+ | `"on"` | Explicitly request use, with the same nonblocking fallback when unavailable |
158
+ | `"off"` | Skip Cliewen's discovery, use, status messages, and installation suggestions |
159
+
160
+ For example, to disable this integration independently of learnings:
161
+
162
+ ```yaml
163
+ writing:
164
+ humanizer: "off"
165
+ ```
166
+
167
+ In auto/on mode, the agent gives one short status per session: used, detected but inaccessible, confirmed absent, or availability unknown. It claims use only after reading and applying the skill's instructions. It does not repeat the status in each artifact or PR description. If absence is confirmed, it may combine the status with one installation suggestion, respecting a refusal. An unavailable inventory is reported as unknown, not as a missing skill.
168
+
169
+ Cliewen does not scan global skill directories, install software, enable plugins, or cache availability across sessions. Installation is a deliberate user action using [Humanizer's current host-specific instructions](https://github.com/blader/humanizer#installation). Availability depends on the host's inventory and permissions; finding a file does not prove the agent can invoke it. No universal detection command or cross-host success guarantee is provided.
170
+
171
+ A failed attempt to load a skill by name does not establish that the host detected it. When inventory is unavailable, report availability as unknown and describe the failed invocation separately. Reserve "detected but inaccessible" for a skill the host actually identifies.
172
+
173
+ The skill applies to prose across proposals, specs, tasks, guides, comments, docstrings, commits, PR descriptions, messages, and replies. Preserve technical meaning, code behavior, commands, identifiers, and structured data; verify factual claims after rewriting. Baseline clear-writing rules apply in every mode and when the skill is absent. Disabling documentation guidance does not disable these writing rules or Humanizer. Independent repository or host requirements still apply.
174
+
175
+ Shared writing guidance also asks the agent to check local document links before handoff, using each containing file's directory as the base. For example, a proposal at `openspec/changes/example/proposal.md` reaches `docs/` through `../../../docs/`. Verify targets and fragments with the project's available link or rendering checks. Describe future files as planned paths until they exist. This is agent guidance; Cliewen's `check` command does not validate every Markdown link or authenticate the agent's validation claims.
176
+
177
+ ## Test types
178
+
179
+ `testing.types` defaults to `Unit`, `Integration`, and `E2E`, with the descriptions shown above. A project-defined mapping replaces the entire default set. Names are case-sensitive, may contain spaces, and must be nonempty, single-line names without surrounding whitespace or square brackets. Each entry requires a nonempty `description`; an empty mapping is invalid.
180
+
181
+ For example, a project that calls its tests Component and System can use:
182
+
183
+ ```yaml
184
+ testing:
185
+ types:
186
+ Component:
187
+ description: One component tested in process with controlled dependencies
188
+ System:
189
+ description: A complete workflow against a deployed system
190
+ ```
191
+
192
+ Each scenario needs exactly one `Test-type: Component` line beneath its heading. With the Node adapter, give each mapped test a title such as `exports rows [EXPORT-001] [Test-type: Component]`. Tasks should name the concrete test, type, and verification boundary. The checker requires evidence `testType` to match the scenario's declared type exactly; it does not assume one type substitutes for another. Task descriptions and the actual quality of the test boundary still require review.
193
+
194
+ For existing projects, add types to scenarios and test titles, commit the inputs, then regenerate evidence. Older reports without `testType` fail the check and are not automatically upgraded. Evidence opt-out skips these checks. Testing types do not change per-task placement or verification quality.
195
+
196
+ Development source extends planning with single-authority backlog guidance and an installed `.cliewen-openspec/planning.md` reference. These additions are not in published 0.1.0. See [change scoping and optional pre-change setup](guide/workflow.md#choose-the-next-delivery).
197
+
198
+ The candidate supplies guidance for documentation, decisions, Mermaid, planning, and review. It does not structurally validate those documents or independently enforce agent behavior. Disabling a facility preserves authored files. Evidence opt-out skips product evidence checks; installation and registry checks still run.
199
+
200
+ For example, to use a different documentation root and turn off Mermaid guidance:
201
+
202
+ ```yaml
203
+ docsRoot: project-docs
204
+ features:
205
+ mermaid: false
206
+ ```
207
+
208
+ Other fields retain their defaults. The YAML objects `features`, `ac`, and `testing` support partial settings. If you provide `evidence`, include its `report` string. Changing `docsRoot` does not move existing files. The schema artifact graph is selected by the OpenSpec schema and is not rewritten by feature flags.
209
+
210
+ ## Testing and IDs at a glance
211
+
212
+ ```yaml
213
+ ac:
214
+ padding: 3
215
+ capabilities: {}
216
+ testing:
217
+ placement: per-task
218
+ types:
219
+ Unit:
220
+ description: Isolated behavior without external dependencies
221
+ Integration:
222
+ description: Interaction between components or dependencies
223
+ E2E:
224
+ description: Complete user or system workflow
225
+ ```
226
+
227
+ ## Acceptance criterion IDs
228
+
229
+ An ID consists of an uppercase prefix, a hyphen, and a positive sequence number. Register a prefix for each capability before allocating IDs:
230
+
231
+ ```yaml
232
+ ac:
233
+ padding: 3
234
+ capabilities:
235
+ csv-export: EXP
236
+ account-management: ACC
237
+ support: SUP
238
+ ```
239
+
240
+ Capability names match their directories under `openspec/specs/` or the change's `specs/`. A new capability can be registered before its spec directory exists. There is no global prefix or automatic prefix selection.
241
+
242
+ Choose a short, recognizable capability or domain name with your team. `EXPORT` and `EXP` are equally valid; Cliewen does not infer either from the change title. Reuse the chosen prefix for that capability across changes. The prefix must start with an uppercase letter and contain only uppercase letters and digits.
243
+
244
+ ```sh
245
+ cliewen-openspec ac next --capability csv-export # EXP-001 initially
246
+ cliewen-openspec ac next --capability support # SUP-001 initially
247
+ cliewen-openspec ac next EXP # Same registered sequence as csv-export
248
+ ```
249
+
250
+ `padding` is the minimum number of digits, from 1 to 12. For example, 1 produces `EXP-1`, 3 produces `EXP-001`, and 4 produces `EXP-0001`. Numbers grow beyond the minimum width without truncation. The separator is always a hyphen; arbitrary ID templates are not supported.
251
+
252
+ Each capability owns one numeric sequence. The allocator consults the committed `.cliewen-openspec/ac-registry.json` and existing OpenSpec Markdown, including active and archived changes. It never reclaims allocated numbers. Changing padding continues the same sequence and does not rewrite existing IDs. Commit the registry together with config and specs. Parallel branches still need collision resolution; this allocator supports sequential work rather than distributed allocation.
253
+
254
+ ### Renaming a prefix
255
+
256
+ Use the command rather than editing an established mapping directly:
257
+
258
+ ```sh
259
+ cliewen-openspec ac rename-prefix csv-export EXPORT
260
+ cliewen-openspec ac next --capability csv-export
261
+ ```
262
+
263
+ If the highest allocated number was `EXP-017`, the next ID is `EXPORT-018`. Existing scenarios and tests keep their `EXP-...` references. The command updates config and registry in one recoverable transaction, preserving YAML comments. Config and registry mismatches block allocation and are reported by `check`, including when evidence is disabled. Restore the registered prefix in config before running the rename command if you edited it manually.
264
+
265
+ Current and historical prefixes remain reserved to their original capability, even if its config mapping is removed. Allocation using a retired prefix is rejected with guidance to use the current capability. Previously used prefixes cannot be reassigned, including renaming back to a historical prefix. The command also rejects target prefixes already appearing in OpenSpec documents.
266
+
267
+ The registry records each capability's current prefix, previous prefixes, and highest allocated number. `check` validates this state without writing it. Removing the registry loses allocation history, so retain it in version control. Do not use the native registry as a second authority for IDs allocated by another tool.
268
+
269
+ The earlier experimental `ac.prefix` setting is no longer supported. Replace it with `ac.capabilities` before using this version. Existing bracketed IDs remain valid evidence references regardless of prefix history.
270
+
271
+ ## Test placement
272
+
273
+ `testing.placement` controls the schema's planning and implementation guidance:
274
+
275
+ - `per-task` (default): Each implementation task includes its relevant tests, a test command, and a completion check. Implement a small slice, run its tests, fix failures, and then continue to the next task. Documentation-only tasks can use an appropriate validation check. This provides fast feedback throughout implementation.
276
+ - `end-of-change`: Plan tests in a final verification section, with explicit links to the implementation tasks they cover.
277
+
278
+ Both modes retain final regression testing and revision-bound evidence collection. Per-task test runs provide immediate feedback; the evidence adapter records results for the final committed inputs. Disabling evidence does not disable ordinary task-level testing.
279
+
280
+ Placement is guidance supplied by the installed schema and task template. Configuration changes do not rewrite existing task lists; revise the task plan when changing this setting.
281
+
282
+ <a id="test-driven-development"></a>
283
+
284
+ ## Evidence-first verification
285
+
286
+ Use **spec-driven development with evidence-first verification**: define expected behavior and how to verify it before implementation. Develop code and tests in small steps, check that tests detect relevant faults, and maintain them as requirements change.
287
+
288
+ 1. Describe acceptance criteria and positive, negative, and boundary cases before implementation. Consider [interactions between inputs and options](testing/test-quality.md#plan-interacting-cases), especially when existing content must be preserved. Executable tests can develop alongside the code.
289
+ 2. Verify each task before continuing, using concrete commands and actual results. With end-of-change placement, plan the final automated suite while retaining a suitable check for each task.
290
+ 3. Assess assertion effectiveness through relevant failures and review. A setup or syntax failure does not show that a test detects the intended defect.
291
+ 4. Keep tests aligned with accepted requirements, preserving active assertions and explicitly reviewing retirement.
292
+
293
+ This approach is close to [Specification by Example](https://martinfowler.com/bliki/SpecificationByExample.html), which uses concrete examples to clarify specifications, and [ATDD](https://agilealliance.org/glossary/atdd/), which agrees acceptance tests before implementation. Evidence-first verification is our descriptive wording; it does not require a particular order of test and production edits.
294
+
295
+ ### Earlier formats
296
+
297
+ The first non-prerelease release supports fresh configuration and its own `0.1.0` installation manifests. It does not migrate earlier alpha installations. Retired `testing.approach` values and effectiveness records using `method: tdd` remain invalid; do not copy them into a new project.
298
+
299
+ Existing authored history remains project-owned. Recorder commands and task-method metadata from earlier development builds do not establish completion under evidence-first verification. General format migration is outside this release's scope.
300
+
301
+ ## Decision filenames
302
+
303
+ New projects use `NNN-short-title.md`, such as `001-use-a-shared-base.md`, for new Decision Records. The sequence starts at 1, padded to a minimum of three digits for filename sorting. Numbers above 999 grow naturally. This is a naming convention in the schema guidance, not a configurable setting or an implemented decision allocator.
304
+
305
+ Existing filenames and paths are stable public addresses: never rename, move, or renumber documents to normalize naming, titles, categories, or padding. External systems such as GitHub may link to them. Edit content and metadata in place, even when a title or category changes. Existing projects retain conventions such as `ADR-059-title.md` and `PDR-074-title.md`; read their allocation rules and use their existing ID authority rather than starting a competing counter. These conventions are not configurable in `0.1.0`. This repository's earlier owner-approved filename normalization does not authorize renaming documents in other projects.
306
+
307
+ ## Installed resource versions
308
+
309
+ The `0.1.0` candidate's `init`, `update`, and `uninstall` accept only `0.1.0` installation manifests. `check` reports other manifest versions as unsupported; changing the recorded version by hand does not migrate an installation. Use a fresh project for candidate evaluation. [Update](guide/updating.md) refreshes or repairs owned resources within the supported version while preserving configuration, registry, authored artifacts, and document paths. Adding config settings alone does not replace installed instructions. General version/config/registry migrations are outside this release's scope.
310
+
311
+ ## Optional archive-session guidance
312
+
313
+ Version 0.2.0 installs `.cliewen-openspec/closure.md`. For repository-local projects, OpenSpec's project-owned `operations.archive.guidance` can point an archive session to that reference. See [closure setup and limits](guide/workflow.md#use-the-reference-from-a-separate-archive-session), including direct CLI use and removal of the optional entry after uninstall. Existing Cliewen feature and test-policy settings control the matching review responsibilities; there is no new configuration flag or automatic archive hook.
314
+
315
+ ## Optional prototype guidance
316
+
317
+ Version 0.2.0 installs `.cliewen-openspec/prototyping.md` for [bounded user-selected experiments](guide/workflow.md#try-a-prototype-when-it-can-answer-a-question). Prototype selection is per task and adds no configuration flag. Planning controls ticket/plan maintenance; learnings and documentation settings control optional lesson maintenance. Native investigation artifacts retain actual findings even when those facilities are disabled. The existing installation lifecycle owns only the reference, not prototype files or user records.