farna-bootstrapper 0.0.0-stage → 0.1.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 (80) hide show
  1. package/CHANGELOG.md +91 -0
  2. package/LICENSE +30 -0
  3. package/NOTICE +42 -0
  4. package/README.md +1079 -2
  5. package/SECURITY.md +65 -0
  6. package/dist/cli/commands/check.d.ts +58 -0
  7. package/dist/cli/commands/check.js +198 -0
  8. package/dist/cli/commands/generate.d.ts +75 -0
  9. package/dist/cli/commands/generate.js +218 -0
  10. package/dist/cli/commands/init.d.ts +52 -0
  11. package/dist/cli/commands/init.js +271 -0
  12. package/dist/cli/main.d.ts +2 -0
  13. package/dist/cli/main.js +51 -0
  14. package/dist/cli/program.d.ts +23 -0
  15. package/dist/cli/program.js +183 -0
  16. package/dist/compose/resolve.d.ts +154 -0
  17. package/dist/compose/resolve.js +545 -0
  18. package/dist/config/load.d.ts +4 -0
  19. package/dist/config/load.js +45 -0
  20. package/dist/config/schema.d.ts +22 -0
  21. package/dist/config/schema.js +46 -0
  22. package/dist/core/constants.d.ts +268 -0
  23. package/dist/core/constants.js +336 -0
  24. package/dist/core/errors.d.ts +44 -0
  25. package/dist/core/errors.js +75 -0
  26. package/dist/core/fs.d.ts +31 -0
  27. package/dist/core/fs.js +169 -0
  28. package/dist/core/json.d.ts +22 -0
  29. package/dist/core/json.js +174 -0
  30. package/dist/core/paths.d.ts +45 -0
  31. package/dist/core/paths.js +110 -0
  32. package/dist/core/text.d.ts +10 -0
  33. package/dist/core/text.js +27 -0
  34. package/dist/index.d.ts +10 -0
  35. package/dist/index.js +1 -0
  36. package/dist/lock/lockfile.d.ts +229 -0
  37. package/dist/lock/lockfile.js +333 -0
  38. package/dist/materialise/source-tree.d.ts +77 -0
  39. package/dist/materialise/source-tree.js +264 -0
  40. package/dist/permissions/permissions.d.ts +128 -0
  41. package/dist/permissions/permissions.js +452 -0
  42. package/dist/render/commit.d.ts +59 -0
  43. package/dist/render/commit.js +279 -0
  44. package/dist/render/generate-lock.d.ts +9 -0
  45. package/dist/render/generate-lock.js +203 -0
  46. package/dist/render/identity.d.ts +23 -0
  47. package/dist/render/identity.js +396 -0
  48. package/dist/render/orphans.d.ts +59 -0
  49. package/dist/render/orphans.js +234 -0
  50. package/dist/render/port.d.ts +96 -0
  51. package/dist/render/port.js +1 -0
  52. package/dist/render/prepare.d.ts +33 -0
  53. package/dist/render/prepare.js +139 -0
  54. package/dist/render/root-cleanliness.d.ts +28 -0
  55. package/dist/render/root-cleanliness.js +76 -0
  56. package/dist/render/stage.d.ts +36 -0
  57. package/dist/render/stage.js +92 -0
  58. package/dist/render/staging.d.ts +16 -0
  59. package/dist/render/staging.js +94 -0
  60. package/dist/render/structured.d.ts +35 -0
  61. package/dist/render/structured.js +258 -0
  62. package/dist/render/upstream.d.ts +41 -0
  63. package/dist/render/upstream.js +179 -0
  64. package/dist/report/format.d.ts +7 -0
  65. package/dist/report/format.js +97 -0
  66. package/dist/report/warnings.d.ts +21 -0
  67. package/dist/report/warnings.js +24 -0
  68. package/dist/source/digest.d.ts +18 -0
  69. package/dist/source/digest.js +77 -0
  70. package/dist/source/frontmatter.d.ts +12 -0
  71. package/dist/source/frontmatter.js +29 -0
  72. package/dist/source/load.d.ts +103 -0
  73. package/dist/source/load.js +676 -0
  74. package/dist/source/schema.d.ts +149 -0
  75. package/dist/source/schema.js +283 -0
  76. package/dist/source/yaml.d.ts +10 -0
  77. package/dist/source/yaml.js +49 -0
  78. package/dist/verify/containment.d.ts +22 -0
  79. package/dist/verify/containment.js +753 -0
  80. package/package.json +79 -4
package/README.md CHANGED
@@ -1,3 +1,1080 @@
1
- # Temporary Holding Version
1
+ # farna-bootstrapper
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ [![CI](https://github.com/farnalabs/farna-bootstrapper/actions/workflows/ci.yml/badge.svg)](https://github.com/farnalabs/farna-bootstrapper/actions/workflows/ci.yml)
4
+
5
+ Compile named agent personas and their resources into the configuration a coding harness
6
+ actually reads, and prove that the committed output still matches the source.
7
+
8
+ ## What it is
9
+
10
+ `farna-bootstrapper` is a build-time compiler for coding-agent configuration. You declare personas
11
+ and their resources once, under `.farna/`, and it renders the files a harness reads:
12
+
13
+ - **`generate`** renders every live persona for exactly one configured target, verifies the bytes
14
+ the renderer produced, and only then writes them. It also writes `.farna/lock.json`, which records
15
+ what it owns.
16
+ - **`check`** renders the same source into a temporary directory and compares it with the
17
+ repository. Exit `0` when identical, `1` when anything drifted. It never writes.
18
+ - **`init`** creates the source root and the ignore/attribute lines generated output needs.
19
+
20
+ It is a compiler in the useful sense, not a loader:
21
+
22
+ - the output is **verified, not trusted**. Containment means equality: a renderer that drops a field,
23
+ weakens a permission, mixes two personas or invents a directive is refused before the first byte is
24
+ written. File existence is never accepted as proof.
25
+ - a capability a target cannot carry is **reported, never dropped silently**. Every permission
26
+ category is validated before anything is materialised; one the target cannot map refuses the run.
27
+ - the output is **reproducible**: no timestamps, hostnames or absolute paths in the lockfile, and the
28
+ same source produces the same bytes and the same lockfile on every machine.
29
+ - it works **offline**. Generation and checking make no network request of their own.
30
+
31
+ ## What it is not
32
+
33
+ - **Not an agent runtime, launcher or framework.** It writes configuration; it does not run an agent,
34
+ proxy a model, or manage a session. A hook, MCP server or command it writes is data that the
35
+ harness may execute later; this tool never executes it.
36
+ - **Not a model gateway or a hosted service.** There is no server, no account and no phone-home.
37
+ - **Not a telemetry collector.** There is no analytics package, no usage ping and no crash reporter,
38
+ and no dependency on Farna Control at build time or run time.
39
+ - **Not a multi-target orchestrator in this release.** Exactly one configured target is rendered per
40
+ run; more than one is refused.
41
+ - **Not a replacement for the harness.** It does not claim runtime behaviour. The README's
42
+ capability matrix states what each target carries; the harness remains the authority on what it
43
+ does with it.
44
+
45
+ ## Status
46
+
47
+ This is the first public release. It implements three commands (`init`, `generate` and
48
+ `check`), three targets (`claudecode`, `opencode` for OpenCode 2.x and `opencodev1` for OpenCode
49
+ 1.x), agent mode plus OpenCode profile mode, six resource kinds (`rule`, `permission`, `mcp`,
50
+ `skill`, `command` and `hook`) with a model class, and composition with one base persona per
51
+ composed persona. Exactly one configured target is rendered per run. Everything else is
52
+ deliberately deferred; see
53
+ [What this slice does not do](#what-this-slice-does-not-do) and
54
+ [Residual risks and known gaps](#residual-risks-and-known-gaps).
55
+
56
+ ## Quickstart
57
+
58
+ Requires **Node.js 22.22.0 or newer** and npm. Nothing needs to be installed globally.
59
+
60
+ ```sh
61
+ mkdir my-agents && cd my-agents
62
+ git init
63
+ npx farna-bootstrapper init
64
+ ```
65
+
66
+ `init` creates `.farna/config.jsonc`, the empty persona and resource directories, and the
67
+ `.gitignore` and `.gitattributes` lines generated output needs. Add one YAML file per persona and
68
+ one file per resource; [Use](#use) has a complete pair. Then:
69
+
70
+ ```sh
71
+ npx farna-bootstrapper generate # render the target and write .farna/lock.json
72
+ npx farna-bootstrapper check # exit 0 when the tree matches a fresh render
73
+ ```
74
+
75
+ Commit `.farna/` and the generated files. Running `check` in CI is the drift gate: a hand edit, a
76
+ stale render, or a source change that was never regenerated exits `1` and names the path.
77
+
78
+ ## The loop
79
+
80
+ 1. You declare personas and their resources under `.farna/`, and select one target in the config.
81
+ 2. `farna-bootstrapper generate` renders that target's artefacts and records what it wrote in
82
+ `.farna/lock.json`. Claude Code gets one whole file per persona under `.claude/agents/`; OpenCode
83
+ in agent mode gets one whole file per persona under `.opencode/agents/` and no workspace file;
84
+ OpenCode in profile mode gets the active persona's agent file, its `opencode.jsonc` at the
85
+ repository root, and its skill, command and hook output under `.opencode/`.
86
+ 3. `farna-bootstrapper check` renders the same input into a temporary directory and compares it
87
+ with the repository. Exit `0` when identical, `1` when anything drifted.
88
+
89
+ `generate` never writes until every gate has passed. Containment means equality, not substring
90
+ presence: each persona's artefact must be a non-empty markdown file whose emitted frontmatter has
91
+ exactly the keys that target writes, with matching values. Claude Code writes `name`, `description`
92
+ and `model`, plus `disallowedTools` and, only when a permission resource opts in, `tools`;
93
+ OpenCode 2.x writes `description`, `mode`, `model` and the ordered `permissions` records; OpenCode
94
+ 1.x writes `name`, `description`, `mode`, `model` and the per-tool `permission` map. The body is
95
+ exactly that persona's composed body, with one trailing newline normalised. An absent field must be absent, and an extra
96
+ field is refused: a renderer that adds a harness directive such as `permissionMode` or `hooks` is
97
+ adding a capability the persona never declared. A renderer that drops content, weakens or invents a
98
+ permission, mixes personas, prepends or appends anything of its own is refused before the first byte
99
+ reaches the repository. Every permission category is validated before anything is materialised: a
100
+ category the target cannot carry refuses the run (F011) rather than being emitted as an inert
101
+ string.
102
+
103
+ ## Requirements
104
+
105
+ - Node.js **22.22.0 or newer**
106
+ - npm
107
+ - For the `opencode` target, OpenCode **2.x** (package `@opencode/cli`, current 2.3.2, installed
108
+ from <https://opencode.ai/v2/install>). Its emitted per-agent file is the V2 shape (`description`,
109
+ `mode`, `model`, ordered `permissions` records, no `name`), its config nests servers under
110
+ `mcp.servers`, and its plugin is the `{ id, setup }` module.
111
+ - For the `opencodev1` target, OpenCode **1.x** (package `opencode-ai`, current 1.19.6). Its
112
+ emitted per-agent file is the V1 shape (`name`, `description`, `mode`, `model`, the per-tool
113
+ `permission` map), its config is the flat `mcp.<name>` map, its command frontmatter spells
114
+ `subtask`/`variant` (this product authors only `description`, which both majors share) and its
115
+ plugin is the `RulesyncHooksPlugin` module.
116
+ - The tool does not shell out to OpenCode, so a version is documented rather than probed.
117
+ - Profile mode is supported for both OpenCode targets. Agent mode works on all three targets.
118
+
119
+ ## Install
120
+
121
+ ```sh
122
+ npx farna-bootstrapper --version # run it once, without installing
123
+ npm install --save-dev farna-bootstrapper
124
+ npm install -g farna-bootstrapper
125
+ ```
126
+
127
+ The package has no `postinstall` script and makes no network request after install. `prepare` builds
128
+ `dist/` for a git install and `prepack` builds it for the published tarball; a source checkout
129
+ therefore produces a working `bin` without a manual build.
130
+
131
+ The renderer's integrity is read from exactly two npm lock records at the **install root**,
132
+ the nearest ancestor of the product package that owns a `node_modules` directory: the hidden
133
+ `<installRoot>/node_modules/.package-lock.json` and `<installRoot>/package-lock.json`. In a hoisted
134
+ npm workspace the renderer sits at `<ws>/node_modules/rulesync`, so that workspace root *is* the
135
+ install root and its record at `<ws>/package-lock.json` (and its hidden record) is read. In those
136
+ records the `packages` map is searched for the renderer's entry under a key ending in
137
+ `node_modules/<renderer>`; a nested install (`npm install --install-strategy=nested`), which
138
+ records `node_modules/farna-bootstrapper/node_modules/rulesync`, is read from those same two
139
+ records. A workspace root *above* the install root, a parent monorepo and a sibling package are not
140
+ read and may yield `W114`. Those two records are the only supported source of integrity; every
141
+ other npm layout is not promised. When more than one renderer entry matches — for example another
142
+ global package's nested copy in a shared global record — its integrity must still equal the pin: a
143
+ different tarball is refused (F010), so a stranger's entry cannot stand in for the pinned renderer.
144
+
145
+ The guarantee is exact: **the installed renderer version is enforced; the integrity is best effort
146
+ and is checked only in those two records; if no renderer entry is found there, the tool emits
147
+ `W114_RENDERER_INTEGRITY_UNVERIFIED` and does not claim a clean integrity pass.** A different
148
+ version is refused (F010, exit 5). A different npm-recorded integrity is refused the same way. When
149
+ no renderer entry exists in those records — a global or linked install that wrote no npm lockfile,
150
+ or a layout the tool does not read — or the entry has no string integrity, the version check still
151
+ applies, the run continues, and the warning says which of the two happened. That warning appears in
152
+ the human report and the `--json` warnings array, so a run never claims a clean integrity pass it
153
+ could not make. It is deliberately **not** written into `.farna/lock.json`: the lockfile records
154
+ source-derived state only (the pin, resolved resources, source-derived warnings, file hashes), and a
155
+ runtime verification result must not change the byte-compared artefact. A record that is present
156
+ but cannot be read, is a symlink or is not a regular file, or is above the 64 MiB npm-record bound,
157
+ is refused (F010) rather than treated as absent: an integrity that exists but cannot be read must
158
+ fail exactly like one that differs. The pin is provenance, not a sandbox — it does not make an
159
+ unverifiable install verified. That bound is separate from the 4 MiB bound on this product's own
160
+ derived `.farna/lock.json`, because npm's record scales with the dependency tree.
161
+
162
+ ### Supported targets
163
+
164
+ | Target id | Harness | Version | Package | Agent mode | Profile mode |
165
+ |---|---|---|---|---|---|
166
+ | `claudecode` | Claude Code | not version-probed | — | yes | not in this release |
167
+ | `opencode` | OpenCode | 2.x | `@opencode/cli` | yes | yes |
168
+ | `opencodev1` | OpenCode | 1.x | `opencode-ai` | yes | yes |
169
+
170
+ Exactly one target is configured per run; configuring `opencode` and `opencodev1` together is
171
+ `F001`. All three targets write different shapes for the same source; switching target is one
172
+ config edit (see [Targets](#targets)). The two OpenCode targets write the **same paths** in each
173
+ major's own shapes, so a switch rewrites the recorded output in place rather than orphaning it. The
174
+ tool never shells out to a harness, so a version is documented rather than detected.
175
+
176
+ ### The library entry
177
+
178
+ The package also exports its TypeScript types (`.`, `types: ./dist/index.d.ts`). In this release
179
+ that entry is types-only: the CLI is the product surface, and there is no runtime library API to
180
+ depend on. The `./package.json` subpath is exported for tooling.
181
+
182
+ ## Use
183
+
184
+ ```sh
185
+ mkdir my-agents && cd my-agents
186
+ farna-bootstrapper init
187
+ ```
188
+
189
+ `init` creates (it accepts `--json` after the command name, like `generate` and `check`, emitting
190
+ one object on stdout):
191
+
192
+ ```text
193
+ .farna/
194
+ config.jsonc
195
+ personas/
196
+ resources/
197
+ rules/
198
+ permissions/
199
+ mcp/
200
+ skills/
201
+ commands/
202
+ hooks/
203
+ .gitignore # .farna/local.jsonc, the journal, the generate lock, the staging namespace and OS metadata
204
+ .gitattributes # .farna/** and every generated path, for every target, pinned to LF
205
+ ```
206
+
207
+ The `--json` object is `schemaVersion`, `command` (`init`), `ok`, `exitCode`, `root`,
208
+ `configPath`, `created` and `updated` (the array of existing shared files this run appended to),
209
+ and `nextStep`. It reports the shared files as `created` or `updated`, and `created` names only the
210
+ directories this run actually created (a pre-existing directory is omitted); it never claims a path
211
+ it did not touch. `init` preserves the existing bytes and mode of `.gitignore` and `.gitattributes`,
212
+ appends only the missing lines, and restores both byte for byte if a later step fails.
213
+
214
+ Add one YAML file per persona under `.farna/personas/`, one Markdown file per rule under
215
+ `.farna/resources/rules/`, and one JSONC file per permission under
216
+ `.farna/resources/permissions/`. The workspace resource kinds live in their own directories:
217
+ `mcp/<id>.jsonc`, `skills/<id>/SKILL.md` (plus any extra files), `commands/<id>.md` and
218
+ `hooks/<id>.jsonc`. They are read and validated in this slice but require profile mode, so agent
219
+ mode refuses a persona that references one (F001):
220
+
221
+ ```yaml
222
+ # .farna/personas/builder.yaml
223
+ kind: persona
224
+ id: builder
225
+ displayName: Builder
226
+ purpose: Writes code, runs the tests, and follows the house conventions.
227
+ model: standard
228
+ resources:
229
+ - rule/house-style
230
+ - permission/builder-default
231
+ ```
232
+
233
+ ```yaml
234
+ # .farna/personas/builder-python.yaml
235
+ kind: persona
236
+ id: builder-python
237
+ displayName: Python Builder
238
+ purpose: Writes Python and runs the Python checks.
239
+ extends: builder
240
+ resources:
241
+ - rule/python-style
242
+ - permission/python-tools
243
+ ```
244
+
245
+ ```markdown
246
+ ---
247
+ kind: rule
248
+ id: house-style
249
+ displayName: House style
250
+ ---
251
+
252
+ Write the smallest change that satisfies the ticket.
253
+ ```
254
+
255
+ ```jsonc
256
+ // .farna/resources/permissions/builder-default.jsonc
257
+ {
258
+ "kind": "permission",
259
+ "id": "builder-default",
260
+ "tools": {
261
+ "read": "allow",
262
+ "write": "allow",
263
+ "edit": "allow",
264
+ "shell": "allow",
265
+ "task": "deny"
266
+ }
267
+ }
268
+ ```
269
+
270
+ ```jsonc
271
+ // .farna/config.jsonc
272
+ {
273
+ "schemaVersion": 1,
274
+ "targets": { "claudecode": {} },
275
+ "models": {
276
+ "standard": { "claudecode": "claude-sonnet-4-5" }
277
+ }
278
+ }
279
+ ```
280
+
281
+ Then run:
282
+
283
+ ```sh
284
+ farna-bootstrapper generate # write the agent files and the lockfile
285
+ farna-bootstrapper generate --dry-run # print the plan, write nothing
286
+ farna-bootstrapper generate --adopt # take ownership of existing outputs (see below)
287
+ farna-bootstrapper check # prove the tree matches a fresh render
288
+ farna-bootstrapper generate --persona <id> # OpenCode profile mode, overriding the config
289
+ farna-bootstrapper check --persona <id> # check the same selection
290
+ ```
291
+
292
+ The complete flag surface:
293
+
294
+ | Command | Flag | Behaviour |
295
+ |---|---|---|
296
+ | all | `--json` | emit one JSON object on stdout and suppress the human report; a typed failure also writes its one human line to stderr |
297
+ | all | `-v, --version`, `-h, --help` | print the compiled-in version or usage; neither needs the renderer |
298
+ | `init` | `--json` | the created/updated paths and the next step |
299
+ | `generate` | `--dry-run` | print the plan and write nothing; `would-write` and `unchanged` are counted separately |
300
+ | `generate` | `--adopt` | take ownership of every existing planned managed output; required when the lockfile is missing |
301
+ | `generate` | `--persona <id>` | run profile mode as that persona; wins over `targets.<target>.active` and is not written back |
302
+ | `check` | `--persona <id>` | check the same selection |
303
+
304
+ `--persona` is the one CLI selection override. It selects profile mode and wins over
305
+ `targets.<target>.active`; see [Profile mode](#profile-mode).
306
+
307
+ `--json` is a per-command flag: place it after the command
308
+ (`farna-bootstrapper generate --json`), not before it. Every command then emits one machine-readable
309
+ object on stdout and no human report: a success is one object on stdout and nothing on stderr; a
310
+ typed failure is one object on stdout and its single human line on stderr. Every object carries
311
+ `schemaVersion`, `command`, `ok` and `exitCode`; a success object also carries the command's own
312
+ fields (`init` adds `root`, `configPath`, `created`, `updated` and `nextStep`), and a typed failure
313
+ also carries `code`, `subject` and `message`. `--dry-run` compares each managed path with the
314
+ working tree, so `unchanged` and
315
+ `would-write` are distinguished rather than every path being reported as a write. Its summary
316
+ counts the `would-write` files, not the size of the plan: a tree that already matches reports
317
+ `would write 0 file(s), N unchanged`.
318
+
319
+ A persona's rule text is joined into the body of its subagent, in canonical rule-id order, under a
320
+ `## displayName` heading. The rule body itself is never re-wrapped or re-indented. There is no
321
+ shared root rules file: the per-agent body is the only rule surface, so one persona's rules never
322
+ reach another persona's artefact.
323
+
324
+ ## Targets
325
+
326
+ Exactly one target is configured per run. Switching target is one config edit:
327
+
328
+ ```jsonc
329
+ // .farna/config.jsonc — the OpenCode 2.x target
330
+ {
331
+ "schemaVersion": 1,
332
+ "targets": { "opencode": {} },
333
+ "models": {
334
+ "standard": { "opencode": "anthropic/claude-sonnet-4-5" }
335
+ }
336
+ }
337
+ ```
338
+
339
+ ```jsonc
340
+ // .farna/config.jsonc — the OpenCode 1.x target
341
+ {
342
+ "schemaVersion": 1,
343
+ "targets": { "opencodev1": { "active": "builder" } },
344
+ "models": {
345
+ "standard": { "opencodev1": "anthropic/claude-sonnet-4-5" }
346
+ }
347
+ }
348
+ ```
349
+
350
+ A model class maps per target, so a class used on `opencodev1` needs an `opencodev1` mapping (and
351
+ one used on `opencode` needs an `opencode` mapping). Configuring both OpenCode targets at once is
352
+ `F001`: the two write the same paths and one run has one lockfile and one mode plan.
353
+
354
+ All targets are rendered by the pinned rulesync renderer; the product derives the feature set from
355
+ the materialised source instead of passing `*`, and verifies the bytes the renderer produced before
356
+ writing any of them.
357
+
358
+ ### Capability matrix
359
+
360
+ What this release actually carries. A cell is either **native** (written into the emitted
361
+ artefact), **profile only** (written at the workspace level, so it requires profile mode and exactly
362
+ one live persona), **not carried** (refused with `F001`, naming the reference; nothing is written),
363
+ or **unknown** (the harness behaviour is not verified by this release, so it is never claimed as a
364
+ tick).
365
+
366
+ | Capability | Claude Code, per agent | Claude Code, workspace | OpenCode 2.x, per agent | OpenCode 2.x, workspace | OpenCode 1.x, per agent | OpenCode 1.x, workspace |
367
+ |---|---|---|---|---|---|---|
368
+ | `rule` | native | — | native | — | native | — |
369
+ | `model` | native | — | native | — | native | — |
370
+ | `permission` | native (allow-list via opt-in) | — | native (deny-list; `write` folds into `edit`, W112) | — | native (per-tool map; `write` folds into `edit`, W112) | — |
371
+ | `mcp` | not carried | — | not carried in agent mode | profile only (`mcp.servers`) | not carried in agent mode | profile only (flat `mcp.<name>`) |
372
+ | `skill` | not carried | — | not carried in agent mode | profile only | not carried in agent mode | profile only |
373
+ | `command` | not carried | — | not carried in agent mode | profile only | not carried in agent mode | profile only |
374
+ | `hook` | not carried | — | not carried in agent mode | profile only; `{ id, setup }` plugin, representable events only (W101) | not carried in agent mode | profile only; `RulesyncHooksPlugin`, representable events only (W101) |
375
+ | `temperature` | not carried (not authored) | — | not carried (not authored) | — | not carried (not authored) | — |
376
+ | `tools` (per-agent) | native (allow-list via opt-in) | — | not carried (an OpenCode allow-list cannot be expressed) | — | not carried (an OpenCode allow-list cannot be expressed) | — |
377
+
378
+ The OpenCode V1 columns record these differences from V2, each verified against rulesync 43.11.0
379
+ output in this repository's golden tests:
380
+
381
+ - **Agent frontmatter** — V1 keeps `name` and writes the per-tool `permission` map; V2 drops `name`
382
+ and writes the ordered `permissions` array. A file carrying a V2 field is read as V2 by OpenCode
383
+ 2.x, which is why a V2 agent must not carry `name`.
384
+ - **MCP config** — V1 writes the flat `mcp.<name>` map with an explicit `enabled: true`; V2 nests
385
+ servers under `mcp.servers` and omits an enabled server's toggle.
386
+ - **Commands** — V1's command frontmatter spells `subtask` and a separate `variant`; V2 spells
387
+ `subagent` and joins the variant onto `model`. This product authors only `description`, so the
388
+ emitted command frontmatter is the same on both; a `subtask`/`variant` field is refused at the
389
+ source boundary rather than being silently written in the wrong spelling.
390
+ - **Hooks plugin** — V1 writes the `RulesyncHooksPlugin` module, which OpenCode 2.x does not run;
391
+ V2 writes the `{ id, setup }` plugin, which OpenCode 1.x does not run.
392
+
393
+ Cells that are not verified by a test in this release are **unknown**, never a tick. In particular,
394
+ this release verifies the emitted bytes and their containment; it does not verify that a particular
395
+ OpenCode build honours `temperature` or per-agent `tools`, and it does not author either field, so
396
+ they are not claimed.
397
+
398
+ Two details matter more than the table:
399
+
400
+ - **OpenCode's workspace kinds are not an agent-mode loss warning.** A workspace emission would give
401
+ every persona the declaring persona's MCP server, skill, command or hook, with no per-recipient
402
+ record and no opt-out. That is not a capability the author declared for those personas, so agent
403
+ mode refuses the reference and points at profile mode instead of emitting it.
404
+ - **Claude Code's workspace kinds are absent from this release.** `claudecode` does not carry
405
+ `mcp`, `skill`, `command` or `hook` at all yet; a reference is refused rather than silently
406
+ losing it. Profile mode on `claudecode` is later work.
407
+
408
+ A full 71-target capability matrix, the `agent with loss` and `refuse` plan outcomes, and a
409
+ generated capability report page are not in this release. See
410
+ [What this slice does not do](#what-this-slice-does-not-do).
411
+
412
+ ### Output layout
413
+
414
+ ```text
415
+ claudecode, agent mode:
416
+ .claude/agents/<id>.md one whole file per persona
417
+
418
+ opencode or opencodev1, agent mode:
419
+ .opencode/agents/<id>.md one whole file per persona
420
+
421
+ opencode or opencodev1, profile mode (active: <id>):
422
+ opencode.jsonc the active persona's MCP servers, merged into the user's own keys
423
+ .opencode/agents/<id>.md only the active persona
424
+ .opencode/skills/<skill-id>/** the active persona's skills and their extra files
425
+ .opencode/commands/<id>.md the active persona's commands
426
+ .opencode/plugins/rulesync-hooks.js the active persona's carried hooks
427
+ (skills, commands and hooks are under .opencode/, not the root)
428
+
429
+ all targets:
430
+ .farna/lock.json the manifest and the source-derived warnings
431
+ ```
432
+
433
+ Every path is conditional on a declaration: a persona with no MCP server emits no
434
+ `opencode.jsonc`, one with no hooks emits no plugin, and one with no skills has no skill tree.
435
+ Agent mode writes none of the workspace paths. `check` computes the expected set independently of
436
+ what the renderer reports, so a dropped or invented file is refused rather than written.
437
+
438
+ ### Profile mode
439
+
440
+ OpenCode carries MCP servers, skills, commands and hooks at the **workspace** level, not per agent.
441
+ In agent mode a workspace emission would give every persona the declaring persona's resource, with
442
+ no per-recipient record and no opt-out. That is not a capability the author declared for those
443
+ personas, so the four kinds require profile mode: exactly one persona is live, and it owns the
444
+ workspace. Agent mode still refuses such a reference with `F001_INVALID_CONFIG`, naming the
445
+ resource, the declaring persona and "requires profile mode"; nothing is written.
446
+
447
+ Select profile mode in the config:
448
+
449
+ ```jsonc
450
+ // .farna/config.jsonc
451
+ {
452
+ "schemaVersion": 1,
453
+ "targets": {
454
+ "opencode": { "active": "builder" }
455
+ }
456
+ }
457
+ ```
458
+
459
+ Or override the committed selection for one run:
460
+
461
+ ```sh
462
+ farna-bootstrapper generate --persona reviewer
463
+ farna-bootstrapper check --persona reviewer
464
+ ```
465
+
466
+ `--persona` wins over `targets.<target>.active`. A persona that does not exist is
467
+ `F001_INVALID_CONFIG` naming the config field or `--persona`; the tool never picks a persona for
468
+ you. Agent mode is the default when no active persona is set.
469
+
470
+ **The invariant is one persona per workspace.** In profile mode only the active persona is
471
+ materialised and verified: no other persona's agent file, MCP server, skill, command or hook is
472
+ emitted, and the containment gate accepts only the active set. Every persona is still resolved, so
473
+ a broken declaration anywhere in the source is still refused; only emission is scoped to the live
474
+ persona. The lockfile records one `personas[]` entry, `mode: "profile"`, `activePersona: "<id>"` and
475
+ `notLive: [<every other persona>]`; in agent mode `mode` is `"agent"`, `activePersona` is `null`
476
+ and `notLive` is empty. `generate` and `check` print the not-live set, and `--json` carries it as
477
+ `notLive`, so a deactivated persona is never silent.
478
+
479
+ Selecting profile mode with `active` or `--persona` when the live persona declares no capability
480
+ that *requires* it (an MCP server or a hook, which OpenCode carries only at the workspace level) is
481
+ a choice, and it is reported as `W109_PROFILE_BY_CHOICE` at info severity. A skill or command is
482
+ content the target could in principle drop, so it does not force the mode.
483
+
484
+ **The profile is the repository root.** It is never a cache directory and never a subdirectory
485
+ below another config. The exact paths are in [Output layout](#output-layout).
486
+
487
+ Profile mode is supported for both OpenCode targets (`opencode` and `opencodev1`). `claudecode`
488
+ refuses an `active` value or `--persona` with `F001_INVALID_CONFIG`: its only workspace-only
489
+ capability is `command`, a content capability that does not force a profile, so profile mode there
490
+ is later work. Accepting the setting and ignoring it would be a silent no-op.
491
+
492
+ A hook OpenCode cannot represent (`session-end`, or a matcher on a non-tool event) is reported as
493
+ `W101_CAPABILITY_DROPPED` at `high` severity and is not emitted; it is never silently omitted.
494
+
495
+ #### Orphan handling
496
+
497
+ A persona switch, a removed resource or a target edit leaves output the committed lockfile records
498
+ but the current source no longer produces. `check` reports every such recorded path as
499
+ `F007_DRIFT` drift with kind `unexpected`. An unrecorded file is ordinarily ignored, because it
500
+ belongs to the user.
501
+
502
+ `check` also compares a `configDigest` recorded in the lockfile: a change to the config or to **any**
503
+ persona or resource file is drift even when the live persona renders no different byte, so an edit
504
+ to a non-live persona's declaration cannot hide. The digest covers the **raw** `config.jsonc`
505
+ bytes as well as the parsed value, so a comment or whitespace edit in the config is drift exactly
506
+ like a comment edit in a persona file.
507
+
508
+ `generate` may remove a recorded orphan, under four guards:
509
+
510
+ 1. it must exist and be a relative, escape-free path in a managed location — one of
511
+ `.claude/agents/`, `.opencode/agents/`, `.opencode/commands/`, `.opencode/skills/`,
512
+ `.opencode/plugins/`, or a target's whole root config file (`opencode.jsonc`). A recorded path
513
+ that is already **absent** is simply dropped from the new lockfile; the managed-location guard
514
+ applies only to a path that exists, so the action it prints can always be carried out;
515
+ 2. it must still be a **regular file**; a symbolic link is refused (`F003`) and never followed;
516
+ 3. its bytes must still equal the SHA-256 the lockfile recorded. The check is repeated immediately
517
+ before the `rm`, so a file changed between the preflight and the removal is refused rather than
518
+ deleted. A file edited since the last generate is refused with `F007_DRIFT`: ownership can no
519
+ longer be proven, so it is not deleted;
520
+ 4. it must be recorded. An unrecorded file is the user's and is never removed.
521
+
522
+ A structured entry (`opencode.jsonc`) owns only its `mcp` key. When the source no longer declares
523
+ an MCP server, `generate` deletes only that key in place: a file that still carries the user's own
524
+ keys is kept, with its comments, and the record is dropped; a file that holds nothing but the owned
525
+ key is removed. Once the user has removed the owned key itself the record is dropped and the file
526
+ left alone.
527
+
528
+ The whole orphan set is preflighted before anything is written, so a refusal leaves the tree
529
+ untouched. Removals happen before the new managed set is committed: a commit that then fails names
530
+ the removals it already made, so the error never claims "nothing was written" for a tree that is
531
+ partially updated. An empty directory left after removing a skill's last file is not removed: the
532
+ contract is to remove recorded regular files, not directories.
533
+
534
+ ### A missing lockfile: refuse, then adopt
535
+
536
+ The lockfile is the only proof that a path is this tool's output. When it is absent, a file at a
537
+ planned path could be this tool's earlier render or the user's own file, and the tool has no way to
538
+ tell. It therefore **refuses** rather than guessing from a file name: if `.farna/lock.json` is
539
+ missing and any planned managed output already exists, `generate` and `check` fail with
540
+ `F007_DRIFT` naming those outputs and the action `run generate --adopt`.
541
+
542
+ `generate --adopt` is the explicit adoption. It takes ownership of every existing planned managed
543
+ output: `opencode.jsonc` is merged in place so only the owned `mcp` key changes and the user's keys
544
+ and comments survive, every other planned file is overwritten with the fresh render, and the
545
+ lockfile records the result. A file **not in the plan** is neither adopted nor removed. `check`
546
+ never adopts; it only tells the user to run `generate --adopt`.
547
+
548
+ The trade-off is deliberate: with no lockfile the tool does not scan for stale renders by path. A
549
+ stale output that is not recorded and not in the plan is the user's responsibility; naming a file
550
+ is not proof that this tool wrote it.
551
+
552
+ The one unrecorded path `check` still reports is an extra file inside a **skill directory** this
553
+ tool owns (recorded or planned at `W107_OUTSIDE_OWNERSHIP`, never deleted), which is a recorded-path
554
+ question rather than a name guess. A file under a name no declaration would emit
555
+ (`.opencode/commands/custom.md`, `.opencode/skills/custom/`) is genuinely the user's and is not
556
+ reported.
557
+
558
+ MCP `env` and `headers` values are references only. A resource declares
559
+ `{ "fromEnv": "EXAMPLE_TOKEN" }`; the materialiser writes rulesync's canonical `${EXAMPLE_TOKEN}`.
560
+ A literal value in a credential position is `F002_SECRET_LITERAL` and is never echoed. An MCP
561
+ `http` URL may not carry userinfo (`F002`, never echoed); a credential-shaped query parameter
562
+ (`token`, `api_key`, `apikey`, `access_token`, `secret`, `password`) is reported as
563
+ `W115_CREDENTIAL_IN_URL` and never echoed either. A stdio `command` is the program only: whitespace
564
+ and control characters are refused (F001) with a message to put the arguments in `args`.
565
+
566
+ `args` accepts literals, because a command genuinely needs them (`-y`, `serve`, a path). A literal
567
+ that *looks like a credential* (`sk-`, `ghp_`, `glpat-`, `npm_`, `AKIA`, a JWT, or a long token-shaped
568
+ string with letters and digits) is reported as `W116_SECRET_IN_ARGS` at high severity, naming the
569
+ argument's position and never echoing the value: it would otherwise be written verbatim into
570
+ `opencode.jsonc`. A `{ "fromEnv": "NAME" }` reference inside `args` cannot be expressed — rulesync
571
+ 43.11.0 accepts only string arguments and copies them into the emitted command verbatim, so the
572
+ reference would reach the server as the unexpanded text `${NAME}` — and is refused (F001) with the
573
+ supported alternative: put the credential in `env` or `headers`.
574
+
575
+ The workspace resource kinds are **not** carried by `claudecode` either. A persona that references
576
+ one is refused (F001) rather than silently losing it.
577
+
578
+ ## Composition
579
+
580
+ `extends` names at most one base persona. Resolution is:
581
+
582
+ 1. Resolve `extends` recursively, depth at most 32; a cycle, a self-extension or a missing base
583
+ is refused (F001) and the cycle message names the whole path.
584
+ 2. The base persona's rules and permissions are unioned into the child, by `(kind, id)`.
585
+ 3. The child's own `resources` are added in declaration order. Rule bodies are deduplicated by
586
+ id; permissions are merged by category, and the stricter value wins.
587
+ 4. The model is inherited from the base or set on the persona. Two different concrete models in
588
+ one composed set are a conflict (F005), never a silent override.
589
+ 5. The composed persona's body is both rule sets, and its permission entries are the union. In
590
+ the example above `builder-python` carries both rule markers and not the reviewer's, because
591
+ the reviewer's rules were never in its chain.
592
+
593
+ `resources` may be empty. A persona with no rules has an empty composed body: its artefact carries
594
+ only its frontmatter, so a permission-only persona (a locked-down reviewer with no prose) is valid
595
+ and generates cleanly.
596
+
597
+ A composed persona is one new name. There are no multi-parent unions and no per-target branches
598
+ in the source.
599
+
600
+ ## Permissions
601
+
602
+ The canonical categories are `read`, `write`, `edit`, `shell`, `network`, `mcp`, `task` and `*`.
603
+ They are validated at plan time and mapped to the target's own form before anything is written:
604
+
605
+ | Category | Claude Code entry | OpenCode 2.x record | OpenCode 1.x map |
606
+ |---|---|---|---|
607
+ | `read` | `Read` / `Read(P)` | `{action: read}` | `read` |
608
+ | `write` | `Write` / `Write(P)` | `{action: edit}` (folds into `edit`, W112) | `edit` (folds into `edit`, W112) |
609
+ | `edit` | `Edit` / `Edit(P)` | `{action: edit}` | `edit` |
610
+ | `shell` | `Bash` / `Bash(P)` | `{action: shell}` | `bash` |
611
+ | `task` | `Agent` / `Agent(P)` | `{action: subagent}` | `task` |
612
+ | `network` | none | none | none — refused (F011, exit 3) |
613
+ | `mcp` (bare) | none | none | none — refused (F011, exit 3) |
614
+ | `*` | expands to every category | same | same — refused (F011), because it covers `network` |
615
+
616
+ On OpenCode 2.x the records are an ordered array of `{ action, resource, effect }`. `bash` is
617
+ emitted as `shell` and `task` as `subagent`. OpenCode documents last-match-wins, so order is
618
+ semantic: the catch-all is emitted first, and pattern resources keep their source declaration
619
+ order. Sorting by codepoint could put an earlier allow after a later deny and silently turn a deny
620
+ into an allow. The permission digest is order-sensitive for the same reason.
621
+
622
+ On OpenCode 1.x the same resolved map is written as the per-tool `permission` object, with
623
+ `shell` under OpenCode's own key `bash` and `task` under `task`; both OpenCode targets fold `write` into
624
+ `edit` and refuse `network` and a bare `mcp` before anything is materialised. `write` has no
625
+ OpenCode category on either target: every write-derived `allow` that no edit declaration covers is
626
+ reported as `W112_PERMISSION_LOSSY` (HIGH), including when an unrelated edit allow exists. A record
627
+ whose emitted effect is deny is never reported: it narrows, and a stricter rule must never be
628
+ presented as a loss. `ask` is emitted as `deny` on all targets and reported as
629
+ `W111_ASK_DOWNGRADED`, because none of them has a measured ask surface.
630
+
631
+ ### Allow-list vs deny-list
632
+
633
+ Claude Code's per-agent `tools` field is an **allow-list**: naming three tools removes every tool
634
+ it does not name, including `Glob`, `Grep`, `WebFetch`, `TodoWrite`, `NotebookEdit` and any tool
635
+ this product does not model. The default is therefore a **deny-list**: `allow` entries emit
636
+ nothing (the tool is available unless denied), while `deny` and an `ask` downgraded to `deny` are
637
+ emitted into `disallowedTools`. A partial allow set can never silently narrow a persona.
638
+
639
+ A permission resource may opt in with `"allowlist": true`. The resolved persona then emits the
640
+ ordered `tools` allow-list and a `W113_ALLOW_LIST_NARROWS` warning names examples of the unmodelled
641
+ tools the narrowing removes (the product does not enumerate every harness tool). The mode is persona-scoped: if any contributing resource opts in, the union of
642
+ its resolved `allow` entries becomes the allow-list. `check` applies the same rule, so a renderer
643
+ that invents or drops `tools` is refused either way. If the opt-in resolves to no `allow` entry
644
+ (every category is denied, or a deny removed the only allow), `tools` is omitted and W113 reports
645
+ that the opt-in had no effect, naming the categories that removed it; emitting `tools: []` would
646
+ remove every tool. The persona's permission digest records that same effective value.
647
+
648
+ A pattern is resolved against its category before it is emitted: if the category's winning value is
649
+ `deny` (including an `ask` downgraded to `deny`), an `allow` pattern under it is not emitted and the
650
+ drop is reported (W106) naming the pattern. Emitting both would leave the harness, not this tool,
651
+ deciding which of two contradictory entries wins. Every other category is native and maps 1:1 onto a
652
+ distinct tool, so there is no W112 on Claude Code. When two permission resources disagree on a
653
+ category, the stricter value wins and the disagreement is reported (W106). On Claude Code both
654
+ arrays are sorted alphabetically and every entry starts with the harness's capitalised tool name.
655
+
656
+ A pattern key that is a canonical array index (`"0"`, `"1"`, `"10"`, ...) is refused at the source
657
+ boundary (F001). JavaScript enumerates an object's array-index keys first, in ascending numeric
658
+ order, before every other key in declaration order, so a numeric pattern would silently move ahead
659
+ of the patterns declared before it. Order is semantic (OpenCode is last-match-wins) and the digest
660
+ would be identical for both spellings, so the tool refuses the key instead of emitting an order the
661
+ source did not declare. Spell the resource as a non-numeric pattern such as `"**/10/**"`, or choose
662
+ another key that is not a bare integer.
663
+
664
+ An OpenCode persona may not opt into the Claude Code `tools` allow-list. OpenCode's records are a
665
+ deny-list and cannot name every unmodelled tool, so `"allowlist": true` is refused (F001) on that
666
+ target rather than silently ignored.
667
+
668
+ Only harness-specific category names reach the renderer source tree; a product category name is
669
+ never written there, and a test asserts it.
670
+
671
+ Warnings are printed by `generate` and `check`. The warning set covers every resolved persona, not
672
+ only the live one: each warning names its persona, so a declaration an inactive persona makes is
673
+ still visible in profile mode. Source-derived warnings are recorded in `.farna/lock.json`.
674
+ `W107_OUTSIDE_OWNERSHIP` is reported by `check` as a drift item rather than a source warning: it
675
+ describes the working tree (an extra skill file), not the source. `W114_RENDERER_INTEGRITY_UNVERIFIED`
676
+ is a runtime verification result about the machine, so it is printed but deliberately not recorded;
677
+ recording it would make two machines with identical sources produce different lockfile bytes.
678
+
679
+ ## Warnings and exit codes
680
+
681
+ ### Warnings
682
+
683
+ A warning is a report, not a failure: it never changes what is rendered. A run that emits one still
684
+ exits `0` unless the warning records a refusal (which is a typed error, not a warning). The severity
685
+ is part of the code's definition, never set by a flag.
686
+
687
+ | Code | Default severity | What it reports |
688
+ |---|---|---|
689
+ | `W101_CAPABILITY_DROPPED` | high for a boundary capability, medium for content | A resolved capability the target cannot carry was not emitted. In profile mode this is a hook OpenCode cannot represent (`session-end`, or a matcher on a non-tool event). Never a silent omission. |
690
+ | `W106_DENY_WINS` | medium when the losing value is `allow`, otherwise info | Two permission resources disagreed on a category; the stricter value won, and the disagreement (and what it removed) is named. |
691
+ | `W107_OUTSIDE_OWNERSHIP` | low | An unrecorded file is inside a skill directory this tool owns. `check` reports it as drift; `generate` never deletes it. |
692
+ | `W109_PROFILE_BY_CHOICE` | info | Profile mode was selected although the live persona declares no capability that requires it (an MCP server or a hook). Agent mode is the default. |
693
+ | `W111_ASK_DOWNGRADED` | medium | An `ask` permission was emitted as `deny`, because no target has a measured ask surface. |
694
+ | `W112_PERMISSION_LOSSY` | high | On OpenCode, `write` folds into `edit`; a write-derived `allow` that no edit declaration covers is lost. A deny is never reported, because a stricter rule is not a loss. |
695
+ | `W113_ALLOW_LIST_NARROWS` | medium | A permission resource opted into the Claude Code `tools` allow-list, which removes every tool the product does not model. Examples of the removed tools are named; an opt-in that resolves to nothing is reported as having no effect. |
696
+ | `W114_RENDERER_INTEGRITY_UNVERIFIED` | medium | No npm lock record at the install root supplied the renderer's tarball integrity. The pinned version is still enforced; this is a provenance gap, never a clean pass. |
697
+ | `W115_CREDENTIAL_IN_URL` | high | An MCP `http` URL carries a credential-shaped query parameter (`token`, `api_key`, `apikey`, `access_token`, `secret`, `password`). The value is never echoed. |
698
+ | `W116_SECRET_IN_ARGS` | high | An MCP `args` literal looks like a credential (`sk-`, `ghp_`, `glpat-`, `npm_`, `AKIA`, a JWT, or a long token-shaped string). The value is never echoed; put the credential in `env` or `headers` instead. |
699
+
700
+ ### Exit codes
701
+
702
+ | Exit | Meaning | Codes |
703
+ |---|---|---|
704
+ | `0` | success; warnings are allowed | — |
705
+ | `1` | invalid input, an unsafe path, or drift | `F001_INVALID_CONFIG`, `F002_SECRET_LITERAL`, `F003_PATH_UNSAFE`, `F007_DRIFT` |
706
+ | `2` | a conflict between declarations | `F005_CONFLICT` |
707
+ | `3` | a requested capability is refused | `F011_PERMISSION_UNMAPPED` |
708
+ | `4` | the renderer lost or invented declared content | `F008_DECLARED_NOT_EMITTED` |
709
+ | `5` | the render or the write failed | `F009_RENDER_FAILED`, `F010_RENDERER_MISMATCH`, `F012_WRITE_FAILED` |
710
+
711
+ `check` uses exit `1` for drift and carries `F007_DRIFT` in its payload with the first drifted path
712
+ as `subject`; drift is a result, not an exception, so it is absent from the exception table. A
713
+ usage error (an unknown command or option) exits `1`. Under `--json` the human report is
714
+ suppressed: a success is one object on stdout and nothing on stderr; a typed failure is one object
715
+ on stdout and its single human line on stderr.
716
+
717
+ ## Layout
718
+
719
+ ```text
720
+ src/
721
+ cli/ Commander wiring, the three commands, and the error boundary
722
+ config/ strict JSONC config schema and loader
723
+ source/ YAML personas; markdown rules, skills and commands; JSONC permissions,
724
+ MCP servers and hooks; strict frontmatter and reference-only secrets
725
+ compose/ mode resolution, extends resolution, resource union, deny-wins merge, digests
726
+ permissions/ the canonical vocabulary and the Claude Code and OpenCode mappings
727
+ materialise/ persona and workspace resources -> rulesync source tree
728
+ render/ port.ts (the seam), upstream.ts (the only rulesync import),
729
+ identity.ts (installed vs pinned renderer), prepare.ts (the pipeline),
730
+ stage.ts (the disposable stage), commit.ts (the write), staging.ts,
731
+ orphans.ts (recorded-orphan preflight and removal), generate-lock.ts
732
+ (the atomic lock directory), structured.ts (in-place, key-level
733
+ ownership of opencode.jsonc), root-cleanliness.ts (skill-tree extras)
734
+ verify/ containment and cross-persona isolation gates
735
+ lock/ lockfile construction and validated reading
736
+ core/ constants, typed errors, paths, strict UTF-8 reads, canonical JSON
737
+ report/ text and JSON output, warning records
738
+ tests/
739
+ fixtures/demo/ the demo fixture: two personas, two rules, no permissions
740
+ fixtures/composed/ builder, builder-python (extends builder) and reviewer, with permissions
741
+ fixtures/opencode/ the OpenCode 2.x fixture: rules, permissions and the files for the refused kinds
742
+ fixtures/opencode-v1/ the OpenCode 1.x fixture, same shape on the V1 target
743
+ fixtures/profile/ OpenCode 2.x profile mode: two personas with distinct MCP, skill, command and hook
744
+ fixtures/profile-v1/ OpenCode 1.x profile mode, same source on the V1 target
745
+ golden/ every target's pinned emitted bytes, both OpenCode majors included
746
+ unit/ composition, permissions, fake and mutating renderer gates, loader, init,
747
+ check, paths, profile mode and orphan removal
748
+ integration/ the real pinned renderer
749
+ cli/ the built CLI: exit codes, JSON envelopes and drift output
750
+ scripts/ CI gates: the minimum test count, real-renderer suites and tarball contents
751
+ ```
752
+
753
+ `.farna/lock.json` records `schemaVersion`, `product` (name and version), `target` (`claudecode`,
754
+ `opencode` or `opencodev1`), `mode` (`agent` or `profile`), `activePersona` (the persona id in profile mode, `null`
755
+ in agent mode), the `renderer` identity, each **live** persona's composition base and resolved
756
+ resource ids (each with the persona that contributed it, across every loaded kind), a persona
757
+ digest, an order-sensitive permission digest, every source-derived warning, and the path, size and
758
+ SHA-256 of every managed file. It does **not** list
759
+ itself: the lockfile is built from the managed files before its own record is appended, so its own
760
+ bytes are deliberately
761
+ absent from `files`. It contains no timestamps, hostnames or absolute paths. A lockfile written
762
+ by an earlier version that recorded `W114` in `warnings[]` is repaired by one `generate`, which
763
+ drops the runtime record and rewrites the same source-derived document.
764
+
765
+ The `renderer` record is the build's **pin** (`RENDERER_PIN`), not the integrity the local package
766
+ manager wrote, and it is what `check` compares the installed package against. Two machines that
767
+ both verified their install, and a machine that could not verify its own, therefore produce
768
+ byte-identical lockfiles for the same source: `W114_RENDERER_INTEGRITY_UNVERIFIED` is reported in
769
+ the command output, never recorded in this artefact. A lockfile that recorded it made a runtime
770
+ verification result part of the byte comparison, so `check` reported `F007_DRIFT` on
771
+ `.farna/lock.json` between a verified and an unverified machine even though no source had changed.
772
+
773
+ ## Determinism
774
+
775
+ The generated bytes are the product, so they must not depend on where or when the command ran.
776
+
777
+ - **The lockfile is source-derived.** It records the product version, the target and mode, the live
778
+ persona (and the not-live set), each persona's composition and digests, the source warnings, and
779
+ each managed file's path, size and SHA-256. It records no timestamp, hostname, absolute path, user
780
+ name or process id.
781
+ - **Ordering is canonical.** Personas and resources are sorted by kind and codepoint id before
782
+ hashing or writing. Permission records are the one deliberate exception: they keep source order
783
+ because OpenCode is last-match-wins, so the digest is order-sensitive there too.
784
+ - **The renderer is pinned.** `rulesync` is pinned to exactly `43.11.0` with a tarball integrity (see
785
+ [The renderer boundary](#the-renderer-boundary)). The lockfile records the pin, not the integrity
786
+ the local package manager happened to write, so two machines that both verified their install -
787
+ and one that could not verify its own - produce the same lockfile bytes for the same source.
788
+ - **Line endings are pinned.** `init` adds `/.farna/**` and every generated path to `.gitattributes`
789
+ with `text eol=lf`, so a Windows checkout does not change a source byte (and therefore
790
+ `configDigest`) or make `check` report drift the source never declared. This repository pins its
791
+ own `.farna/**` tree the same way.
792
+ - **`check` is a byte comparison.** It re-renders into a temporary directory and compares the exact
793
+ bytes (or, for `opencode.jsonc`, the owned key's value). A file that exists is not a file that
794
+ matches.
795
+
796
+ The repository's own suites include golden byte comparisons and a two-root determinism test. Two
797
+ clean runs of the same source on one machine produce identical bytes and an identical lockfile;
798
+ cross-machine determinism follows from the same rules, and CI runs on Linux.
799
+
800
+ ## The renderer boundary
801
+
802
+ `src/render/port.ts` defines `RenderTarget`. `src/render/upstream.ts` is the only module that
803
+ imports `rulesync`, and `src/cli/main.ts` is the only place that binds the real implementation.
804
+ Unit tests use an independent fake renderer, so the failure modes the port exists to catch can be
805
+ exercised without the network or the real renderer.
806
+
807
+ `rulesync` is pinned to exactly `43.11.0` with a tarball integrity. The lockfile records that pin,
808
+ and `check` compares it with the installed package before any byte comparison. The renderer
809
+ identity policy has three parts:
810
+
811
+ 1. **Version — enforced.** A different name or version fails `F010` with exit `5`. This runs first,
812
+ so a missing integrity can never let a substituted renderer pass.
813
+ 2. **Integrity — best effort, from two records.** The installed integrity is read from exactly two
814
+ npm records at the install root (the nearest ancestor of the product package that owns a
815
+ `node_modules` directory): `node_modules/.package-lock.json` and `package-lock.json`. The
816
+ `packages` map is searched for the renderer's entry under any key ending in
817
+ `node_modules/<renderer>` (a scoped name keeps its scope in the key). A nested install records
818
+ it as `node_modules/farna-bootstrapper/node_modules/rulesync`. When more than one entry matches,
819
+ the one nested under farna-bootstrapper's own package wins, then the shallowest, then the
820
+ earlier record. In a hoisted workspace the renderer is at the workspace root, so that root is
821
+ the install root and its record is read; the search never leaves the install root beyond that,
822
+ so a workspace root above it, a parent monorepo or a sibling package records a different copy
823
+ and is never read, and cannot refuse a healthy install with a foreign integrity or verify one
824
+ it did not examine. A string integrity that was found is compared exactly with the pin; a
825
+ different one is `F010`, including when a shared record's matching entry belongs to another
826
+ package: only the pinned tarball passes.
827
+ 3. **Unverifiable — named, never silently passed.** A record that exists but cannot be read, is a
828
+ symlink or is not a regular file, or is above the 64 MiB npm-record bound, is refused `F010`
829
+ naming the record, even when the other supported record is usable. Only a genuinely absent
830
+ entry in the two supported records, or an entry with no string integrity, is
831
+ `W114_RENDERER_INTEGRITY_UNVERIFIED`: the version check still applies, the run continues, and
832
+ the warning names whether no record was found or the record had no integrity. The pin is **not**
833
+ substituted for a missing integrity and the tool never claims a clean integrity pass it could
834
+ not make.
835
+
836
+ The 64 MiB npm-record bound is deliberately separate from the 4 MiB bound on `.farna/lock.json`:
837
+ npm's record scales with the dependency tree, so a legitimate monorepo lockfile is several
838
+ megabytes. The check never degrades a known integrity to a version-only comparison. Because the
839
+ lockfile records source-derived state only, a machine that could not verify its install does not
840
+ change its bytes: `W114` is reported by the command, and verified and unverified machines produce
841
+ the same lockfile for the same source, so `check` agrees across them.
842
+
843
+ The renderer is imported **in-process**. The pin is provenance, not a sandbox: it ties the
844
+ committed bytes to a published tarball when the integrity is verifiable, but a package patched in
845
+ place with the same `package.json` and integrity is not detected, and an unverifiable install is
846
+ reported rather than blocked (see the residual list). The product never uses rulesync's `--delete`;
847
+ cleanup is ownership-scoped, and this slice never deletes a user file.
848
+
849
+ The renderer call is hermetic: its working directory is the disposable stage and its `configPath`
850
+ is a file inside that stage, so an ambient `rulesync.jsonc` (or `rulesync.local.jsonc`) in the
851
+ caller's directory cannot flip `dryRun`, `delete` or `check`. Those three options are also pinned
852
+ explicitly.
853
+
854
+ Every source directory and output path used by `generate`, `generate --dry-run` and `check` is
855
+ checked with `lstat` before use. The write and dry-run paths refuse a symbolic link wherever it
856
+ appears: `.farna`, its subdirectories, `config.jsonc`, any ancestor of a managed output path
857
+ (including `.claude` symlinked inside the repository), and a managed file itself. `check` reports
858
+ a symlinked managed file as drift instead of following it. The dry-run plan goes through the same
859
+ guard as the write path, so it cannot report a plan the real command would refuse.
860
+
861
+ `generate` preflights the whole set, sweeps its own staging namespace, stages each file as a hidden
862
+ `.<target>.farna-tmp-<pid>-<uuid>` sibling on the same filesystem, and renames only after every
863
+ write has succeeded. A caught failure before the first rename removes the staging files and the
864
+ directories this run created; if a directory cannot be removed, the diagnostic names it rather than
865
+ claiming a clean tree. A failure between renames restores the files already replaced and names any
866
+ file it could not restore. A crash or kill between renames can still leave a mixed tree; see
867
+ [Residual risks and known gaps](#residual-risks-and-known-gaps). `init` preflights `.gitignore`
868
+ before creating anything, preserves its line ending, writes the new file with `O_EXCL` under an
869
+ unpredictable name and proves it is a regular file before renaming it over `.gitignore`, and removes
870
+ what it created if it subsequently fails.
871
+
872
+ ## Examples
873
+
874
+ Three complete source trees live in [`examples/`](examples/). All are exercised by the test suite:
875
+ the built CLI generates each one in a temporary copy and `check` must exit `0`.
876
+
877
+ - [`examples/claude-code/`](examples/claude-code/) - two personas (`builder`, `reviewer`) in agent
878
+ mode on the `claudecode` target, with two rules and a real read-only reviewer restriction. Run it
879
+ with `node ../../dist/cli/main.js generate` then `check` from that directory.
880
+ - [`examples/opencode-v2/`](examples/opencode-v2/) - profile mode on the `opencode` target (OpenCode
881
+ 2.x, `@opencode/cli`): one live persona (`builder`) that owns the workspace, with a rule, a
882
+ permission set, one MCP server, one skill, one command and one hook, plus a second persona that is
883
+ resolved but not live. The MCP credential is an environment reference, not a literal.
884
+ - [`examples/opencode-v1/`](examples/opencode-v1/) - the same source tree on the `opencodev1` target
885
+ (OpenCode 1.x, `opencode-ai`): the V1 agent frontmatter, the flat `mcp` map, the V1 command
886
+ frontmatter and the `RulesyncHooksPlugin`. It writes the same paths as the V2 example.
887
+
888
+ Each example has its own README with the exact commands and the files it writes. None commits
889
+ generated output; the example is the source tree.
890
+
891
+ ## Where to look for a decision
892
+
893
+ This README is the user-facing contract and the record of the behaviour it covers. Each target's
894
+ section, the [Capability matrix](#capability-matrix), [Warnings](#warnings) and
895
+ [Residual risks and known gaps](#residual-risks-and-known-gaps) answer the questions a separate
896
+ design note would otherwise answer. If a behaviour is not explained anywhere here, open an issue
897
+ rather than inferring it from a generated file. See also [CONTRIBUTING.md](CONTRIBUTING.md) for
898
+ where a change belongs and which gates it must pass.
899
+
900
+ ## What this slice does not do
901
+
902
+ Deliberately out of scope:
903
+
904
+ - `doctor`; `agent with loss` and `refuse` as plan outcomes; profile mode on `claudecode`;
905
+ rendering more than one configured target per run; every target other than `claudecode`,
906
+ `opencode` and `opencodev1`; the full 71-target capability matrix and the capability report page
907
+ - model resources (a model is the persona's `model` class in this slice)
908
+ - carrying `mcp`, `skill`, `command` or `hook` on any target in **agent** mode; profile mode is
909
+ where those workspace capabilities belong, and agent mode still refuses them
910
+ - `patch` and `replaceWith` on a persona resource reference; `targets` filters on personas and
911
+ resources; `--strict`; `--accept-config` gating; `.farna/local.jsonc`
912
+ - removing a recorded orphan that is not in a managed location: a path outside `.claude/agents/`,
913
+ `.opencode/` or `opencode.jsonc` is refused rather than deleted, because ownership cannot be
914
+ proven; an empty directory left after a skill's last file is removed is not swept
915
+ - region ownership (`CLAUDE.md`, `AGENTS.md`); `opencode.jsonc` is the only structured file, and the
916
+ only key it owns is `mcp`. Every other managed path is a whole file or a whole tree
917
+
918
+ Recursive deletion is limited to directories the tool created. There are three sites:
919
+ `src/render/stage.ts` removes the disposable `mkdtemp` stage, and `src/render/generate-lock.ts`
920
+ removes the lock directory renamed aside on reclaim and again on release. Each deletes only a
921
+ directory this tool created; no user content is recursively deleted.
922
+
923
+ ## Residual risks and known gaps
924
+
925
+ These are deliberate limits of the current controls, stated rather than implied away:
926
+
927
+ - **TOCTOU between preflight and write.** Every ancestor is `lstat`'ed before the write, but a
928
+ symlink swapped in between that check and the `mkdir`/`rename` is not detected. Node exposes no
929
+ `openat`/`O_NOFOLLOW` equivalent, so closing this needs a separate seam.
930
+ - **Crash between renames.** A caught rename failure restores the files already replaced and names
931
+ any it could not restore. A process kill or power loss between two renames can leave a mixed tree
932
+ (some new artefact files, a stale lockfile). Re-running `generate` replaces the managed set and
933
+ rewrites the record; `check` reports the drift.
934
+ - **Renderer file-content tampering.** The renderer is imported in-process and the identity check
935
+ reads the installed package's version and the npm-recorded tarball integrity. A renderer patched
936
+ in place with the same `package.json` and the same tarball integrity is not detected. The pin is
937
+ provenance, not a sandbox.
938
+ - **Stage cleanup.** The stage lives under the canonical temporary root; the containment check uses
939
+ `path.relative`, so a Windows checkout recognises its own stage (a hardcoded `/` used to refuse it
940
+ and leak the directory), and creation failures after `mkdtemp` still reach the cleanup. If the
941
+ stage cannot be removed (for example a renderer left an unreadable subdirectory in it), the
942
+ cleanup failure is a warning naming the leftover path and never replaces the renderer's own error.
943
+ - **Lockfile read.** `.farna` must be a real directory and `.farna/lock.json` a real regular file of
944
+ at most 4 MiB, opened with `O_NOFOLLOW`. A symlink, FIFO or oversized file is a typed refusal
945
+ rather than a follow or a hang. A lockfile that is **present but malformed or of an incompatible
946
+ version** is a typed F001 naming `.farna/lock.json` with the delete-and-regenerate recovery; it is
947
+ never treated as "no records". A lockfile written before profile mode existed (no `mode`, no
948
+ `activePersona`) is still accepted and normalised to agent mode, so its recorded paths are not
949
+ silently forgotten.
950
+ - **One `generate` at a time.** `.farna/.generate.lock` is a **directory** created with `mkdir`
951
+ (atomic on every supported filesystem), its owner recorded in `pid`, around the whole read →
952
+ plan → remove → commit sequence, and released in a `finally`. A second live run is a typed F001
953
+ ("lock held"). A lock whose owner pid is dead, or that is older than the age bound, is reclaimed
954
+ by renaming it aside (only one reclaimer can win) and retrying the `mkdir`. A non-directory at the
955
+ lock path is a typed error, never "another generate is running".
956
+ - **Generated modes are explicit.** Managed files are created `0644` and managed directories
957
+ `0755`, then re-asserted with `chmod`; the process umask no longer decides whether generated
958
+ output is group- or world-writable.
959
+ - **Staging leftovers.** A killed `generate` can leave `.<target>.farna-tmp-*` siblings. They are
960
+ ignored by `check` and swept at the start of the next `generate`; a leftover in a directory the
961
+ next plan does not touch (an unplanned directory) is not swept and is left on disk. Removal is
962
+ best-effort and a leftover is never a managed path.
963
+ - **Orphan removal is preflighted, not transactional.** The whole orphan set is checked before the
964
+ first write, and removals run before the new set is committed. A filesystem failure while
965
+ removing, or a commit failure after a removal, leaves a mixed tree: the failure message names the
966
+ paths already removed, `check` reports them, and re-running `generate` completes the switch. A
967
+ recorded orphan replaced by a directory, a symlink or edited bytes is refused rather than guessed
968
+ at, and must be removed deliberately. The bytes are re-read and re-hashed immediately before each
969
+ `rm`: a file changed between the preflight and the removal is refused rather than deleted.
970
+ - **An empty directory is left after a skill's last file is removed.** Only recorded regular files
971
+ are removed; the now-empty `<skill>/` (or `scripts/`) directory is harmless and carries no
972
+ declaration.
973
+ - **The profile-mode per-agent frontmatter keeps `mode: subagent`.** The persona's own harness file
974
+ is unchanged by profile mode; promoting the live persona to OpenCode's primary `mode` is a
975
+ separate product decision, not a rendering detail, and is not claimed here.
976
+ - **No coverage gate.** There is no coverage provider or threshold in this slice. CI runs lint,
977
+ type-check, tests (with a minimum count and real-renderer suite assertions), a dependency audit at
978
+ `moderate`, and a published-tarball check.
979
+ - **Windows-specific test skips.** Four classes of test cannot run on Windows: the symlink
980
+ regression suites (creating a symbolic link needs a privilege the runner does not grant), the
981
+ POSIX file- and directory-mode assertions (mode bits are not meaningful on NTFS), the FIFO cases
982
+ (Windows has no `mkfifo`-equivalent endpoint to create one), and the install-layout suite (its
983
+ fixtures model a hoisted or nested install with symlinks). CI runs all of them on Linux; the
984
+ guard code itself is platform-independent.
985
+ - **Unrecorded files are not drift.** With a lockfile present, `check` compares the paths in the
986
+ fresh plan (missing or changed) and the paths the committed lockfile records (an output the source
987
+ no longer produces). A file the user keeps in a managed directory is not this tool's output, so it
988
+ is neither reported nor followed; a repository may keep its own commands and its own skill
989
+ directories. The exceptions are an extra file inside a recorded or planned skill directory
990
+ (`W107`) and a missing lockfile, which refuses rather than guessing (see *A missing lockfile*). A
991
+ symlink at a *managed* path is still drift, and a symlinked ancestor is still refused.
992
+ - **The hooks plugin is verified by structure, with one provenance gap.** Containment compares the
993
+ commands, events and matchers the plugin registers. rulesync escapes a hook command for a template
994
+ literal (backslashes doubled, backticks and `${` prefixed with a backslash); the gate undoes that
995
+ escaping in the inverse order before comparing, because it is the renderer's representation of the
996
+ same command. Each command's matcher is read from the slice between the previous command and this
997
+ one, so a matcher-less hook cannot inherit a neighbour's guard and a dropped matcher cannot be
998
+ replaced by an earlier identical one. The parser matches rulesync 43.11.0's two registration shapes
999
+ and cannot recognise a registration emitted as a template literal under a future renderer, so a
1000
+ plugin that keeps the same commands but changes its registration shape is caught only by `check`
1001
+ against a fresh render of the pinned renderer. A change to rulesync's generated helper code that
1002
+ keeps the same registrations is likewise caught only by `check`, not by a committed plugin
1003
+ golden.
1004
+ - **Skill extra files must be UTF-8.** The managed-output pipeline compares and writes text, so a
1005
+ binary asset inside a skill directory is refused (F001) rather than carried; decoding and
1006
+ re-encoding a valid UTF-8 file is byte-identical.
1007
+
1008
+ ## Behaviour notes
1009
+
1010
+ These are the deliberate choices a reader of the harness documentation may not expect. Each is
1011
+ rendered by the pinned renderer and verified before a byte is written.
1012
+
1013
+ - **Personas are YAML; config and permission resources are JSONC.** Config and permission files
1014
+ reject duplicate keys. Persona files are `.farna/personas/*.yaml`.
1015
+ - **A permission resource may declare `patterns`.** A resource can carry
1016
+ `patterns: { "<category>": { "<pattern>": "allow" | "ask" | "deny" } }` in addition to its bare
1017
+ category values, which emits the harness's `Bash(P)` / `Edit(P)` byte form. A numeric pattern key
1018
+ is refused because JavaScript would reorder it.
1019
+ - **A permission resource's identity is its declared `id`, not its file name.** Two permission
1020
+ files may declare the same id: identical content is deduplicated, different content is
1021
+ `F005_CONFLICT` naming both paths. A rule's identity is its file name.
1022
+ - **A model conflict is detected on the resolved concrete model id.** Two model classes that map to
1023
+ the same id do not conflict; two classes that resolve to different ids do.
1024
+ - **The OpenCode per-agent `task` category is authored as `task`.** The V2 raise path translates
1025
+ `task` to `subagent`; authoring `agent` would emit a record OpenCode does not read.
1026
+ - **An unrepresentable OpenCode hook is a reported loss, not an omission.** `session-end`, or a
1027
+ matcher on a non-tool event, is reported as `W101_CAPABILITY_DROPPED` and is not emitted.
1028
+ - **`"allowlist": true` is refused on OpenCode.** OpenCode's records are a deny-list and cannot
1029
+ name every unmodelled tool, so the Claude Code allow-list opt-in has no faithful representation.
1030
+ - **Profile mode is OpenCode-only in this release.** `claudecode` refuses `active` rather than
1031
+ accepting a setting that does nothing.
1032
+ - **The lockfile field is `activePersona`.** `mode` is `agent` or `profile`; `notLive` records the
1033
+ resolved-but-not-live personas. Both the mode and the selection are optional on read, so a
1034
+ lockfile written before profile mode existed still parses and is normalised to agent mode.
1035
+ - **`opencode.jsonc` is structured, not whole-file.** It owns the `mcp` key only and edits it in
1036
+ place, preserving the user's own keys and comments.
1037
+ - **Orphan removal is limited to recorded regular files in managed locations.** A symlink, a
1038
+ directory, an edited file or an unrecorded user file is never removed.
1039
+
1040
+ ## Develop
1041
+
1042
+ ```sh
1043
+ npm ci
1044
+ npm run lint
1045
+ npm run typecheck
1046
+ npm test
1047
+ npm run build
1048
+ npm audit --audit-level=moderate
1049
+ node scripts/assert-pack.mjs # the tarball is dist/ plus the legal files, with no source map
1050
+ npm pack --dry-run # the exact package npm would publish
1051
+ npm publish --dry-run # the publish path, without publishing
1052
+ ```
1053
+
1054
+ `npm run build` compiles `src/` to `dist/`. After a build, run the CLI with
1055
+ `node dist/cli/main.js`, or link it with `npm link` to get the `farna-bootstrapper` binary.
1056
+
1057
+ The golden tests in `tests/golden/`, the real-renderer tests in `tests/integration/` and the
1058
+ example tests in `tests/integration/examples.test.ts` drive the real, pinned renderer. They always
1059
+ run: a missing or broken `rulesync` fails collection loudly rather than skipping. CI compares the
1060
+ test files on disk with the committed `scripts/expected-test-files.json` manifest, requires every
1061
+ manifest file to have run, and fails on either difference — so a deleted suite cannot hide behind
1062
+ the total, and a new suite is a deliberate, visible manifest edit. It also enforces a minimum total
1063
+ test count (not an exact one), that no test is pending or `todo`, that `numPassedTests` accounts for
1064
+ the whole run, and that the real-renderer suites ran. CI also type-checks `tests/`, audits
1065
+ dependencies at `moderate`, and proves that `npm pack` from a tree with `dist/` moved aside still
1066
+ contains the entry points, which can only happen if `prepack` builds them, and that every path in
1067
+ the tarball is on the allowlist with no source map.
1068
+
1069
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for the full gate list and the pull-request expectations.
1070
+ Maintainers publish a release by pushing a `v*` tag; `.github/workflows/release.yml` verifies the
1071
+ tag is on `main`, runs the gates, publishes the packed tarball to npm with provenance, and creates
1072
+ the GitHub Release. The publish job waits for approval on the `release` environment, whose
1073
+ `NPM_TOKEN` secret carries the npm token. See [Releasing](CONTRIBUTING.md#releasing).
1074
+
1075
+ ## Licence
1076
+
1077
+ MIT, Copyright (c) 2026 Farnalabs Ltd. See `LICENSE` and `NOTICE`. Security reports are handled
1078
+ under [SECURITY.md](SECURITY.md). This project depends on
1079
+ [rulesync](https://github.com/dyoshikawa/rulesync) (MIT, Copyright (c) 2024 dyoshikawa), used
1080
+ unmodified as a library; the third-party licence text is reproduced in `NOTICE`.