@opendesignai/harness 0.0.0-stage → 0.2.0-alpha.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 (39) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +132 -2
  3. package/dist/cli.d.mts +1 -0
  4. package/dist/cli.mjs +1723 -0
  5. package/dist/eslint-comments.d.mts +40 -0
  6. package/dist/eslint-comments.mjs +182 -0
  7. package/dist/paths-DBoYPrGy.mjs +59 -0
  8. package/dist/plugin.d.mts +41 -0
  9. package/dist/plugin.mjs +1410 -0
  10. package/docs/adopting.md +224 -0
  11. package/docs/baseline-move.md +56 -0
  12. package/docs/clones.md +51 -0
  13. package/docs/decisions/0001-oxlint.md +74 -0
  14. package/docs/decisions/0002-react-compiler-rules.md +34 -0
  15. package/docs/decisions/0003-agent-harness.md +37 -0
  16. package/docs/hooks.md +128 -0
  17. package/docs/ratchet.md +65 -0
  18. package/docs/rules/no-api-path-literal.md +35 -0
  19. package/docs/rules/no-cjk-literal.md +38 -0
  20. package/docs/rules/no-constant-flag.md +33 -0
  21. package/docs/rules/no-error-message-match.md +63 -0
  22. package/docs/rules/no-locale-branch.md +55 -0
  23. package/docs/rules/no-process-env.md +37 -0
  24. package/docs/rules/no-product-literal.md +41 -0
  25. package/docs/rules/no-raw-fetch.md +33 -0
  26. package/docs/rules/no-raw-storage.md +43 -0
  27. package/docs/rules/no-shell-imports-product.md +48 -0
  28. package/docs/rules/no-swallowed-catch.md +76 -0
  29. package/docs/rules/no-window-bus.md +35 -0
  30. package/docs/size.md +52 -0
  31. package/docs/unused.md +76 -0
  32. package/package.json +75 -3
  33. package/presets/base.json +7 -0
  34. package/presets/platform-boundary.json +4 -0
  35. package/presets/product.json +4 -0
  36. package/presets/react-compiler.json +13 -0
  37. package/presets/rules/base.json +49 -0
  38. package/presets/rules/platform-boundary.json +6 -0
  39. package/presets/rules/product.json +5 -0
@@ -0,0 +1,224 @@
1
+ # Adopting od-harness in a repository
2
+
3
+ The goal of the adoption change: lint, size budget, baseline ratchet and the incremental duplication (jscpd) and unused-code (knip) checks run in CI as the single required check `harness-gates / harness-gates`; all existing debt is frozen in baselines or tolerated by comparison with the base commit, and only new violations fail.
4
+
5
+ ## 1. Install
6
+
7
+ Install from the public npm registry, `alpha` dist-tag, and pin both packages exactly. Oxlint must be the version od-harness is tested with (its `peerDependencies`).
8
+
9
+ ```sh
10
+ pnpm add -D --save-exact @opendesignai/harness@alpha oxlint@1.96.0
11
+ # or: npm install -D --save-exact @opendesignai/harness@alpha oxlint@1.96.0
12
+ ```
13
+
14
+ pnpm 12 checks every version it installs against `minimumReleaseAge` (1,440 minutes unless the repository sets it): a version published more recently needs an entry in `minimumReleaseAgeExclude` in `pnpm-workspace.yaml`, and CI's frozen install checks the lockfile against both. To adopt or upgrade to an od-harness release within that window, install the exact version and commit its entry, for example `"@opendesignai/harness@0.2.0-alpha.0"`. Under pnpm's built-in setting, which is not strict, `pnpm install` writes the entry itself; a repository that sets `minimumReleaseAge` approves it at pnpm's prompt or adds it by hand. The entry can go once the release is older than the window; the pnpm documentation describes these settings.
15
+
16
+ Releases are published to npm under the `opendesignai` organization with the `alpha` dist-tag, by the release workflow through npm trusted publishing ([README, Versioning](../README.md#versioning)). To try an unreleased change, run `pnpm pack` in an od-harness checkout and install the tarball it writes (never the checkout itself, which has `catalog:` and `workspace:` specifiers), for example `"@opendesignai/harness": "file:vendor/opendesignai-harness-0.1.0-alpha.0.tgz"`.
17
+
18
+ Add a `.node-version` file if the repository does not have one; CI sets up Node from it.
19
+
20
+ ## 2. Configure Oxlint
21
+
22
+ Create `.oxlintrc.json` at the repository root:
23
+
24
+ ```json
25
+ {
26
+ "$schema": "./node_modules/oxlint/configuration_schema.json",
27
+ "extends": [
28
+ "./node_modules/@opendesignai/harness/presets/base.json",
29
+ "./node_modules/@opendesignai/harness/presets/platform-boundary.json"
30
+ ],
31
+ "ignorePatterns": ["**/dist/**", "**/build/**", "**/vendor/**", "studio/src/i18n/**"],
32
+ "rules": {
33
+ "od/no-shell-imports-product": [
34
+ "error",
35
+ {
36
+ "shell": ["studio/src/"],
37
+ "product": ["studio/src/motion/game/", "studio/src/super-agent/gamePublish/"],
38
+ "aliases": { "@/": "studio/src/" }
39
+ }
40
+ ],
41
+ "od/no-raw-storage": ["error", { "wrapper": "studio/src/utils/safeStorage.ts" }]
42
+ },
43
+ "overrides": [
44
+ { "files": ["studio/src/utils/safeStorage.ts"], "rules": { "od/no-raw-storage": "off" } },
45
+ {
46
+ "files": ["gateway/**", "server.ts"],
47
+ "rules": { "od/no-api-path-literal": "off", "od/no-raw-fetch": "off" }
48
+ }
49
+ ]
50
+ }
51
+ ```
52
+
53
+ - Presets: always `base`; add `platform-boundary` where shell and product code share the repository (od-platform, the openmotion pilot branch, opengame); add `product` in product packages.
54
+ - `od/no-product-literal` defaults to the full product names (`opengame`, `openmotion`), because the short ids `game` and `motion` are also ordinary words in product code. Platform repositories, where the short ids are product identities (manifest `name`, `/api/<name>/`), list them explicitly: `"od/no-product-literal": ["error", { "products": ["opengame", "openmotion", "game", "motion"] }]`.
55
+ - `react-compiler`: add `./node_modules/@opendesignai/harness/presets/react-compiler.json` as the last `extends` entry in a repository that uses React Compiler. od-platform extends it from the start; a product repository adds it in the change that turns React Compiler on, not before. It turns on the eight React Compiler-derived rules that `base` turns off (`react/refs`, `react/set-state-in-effect`, …), so it only works after `base`. Why: [ADR 0002](decisions/0002-react-compiler-rules.md).
56
+ - `extends` takes file paths, not package names, so keep the `./node_modules/…` prefix.
57
+ - The base preset reports unused disable directives as errors (`options.reportUnusedDisableDirectives`); there is no need to repeat it here.
58
+ - The base preset already turns `od/no-cjk-literal` off in tests and fixtures (`*.test.*`, `*.spec.*`, `__tests__/`, `__fixtures__/`, `fixtures/`). Exclude the repository's own i18n catalog, as `ignorePatterns` does above.
59
+ - Exemptions are `overrides` entries in this file. The file belongs to the platform owner (CODEOWNERS); every exemption is reviewed there, never inline.
60
+ - CODEOWNERS also gives the platform owner `package.json` (the harness version), `.harness/config.json` and the knip configuration (step 3a). `od-harness ratchet` admits new rule IDs into an existing baseline only in a change that upgrades the harness, or whose `.oxlintrc.json` change turns those rules on, so this review is what guards the baselines ([ratchet](ratchet.md#why-a-config-or-version-change-admits-new-rule-ids)). With a pnpm catalog, `pnpm-workspace.yaml` holds the harness version: give it to the owner too. A new baseline file it admits only in the adoption change, without relying on review.
61
+ - Run Oxlint from the repository root: path options (`shell`, `product`) are relative to the working directory.
62
+
63
+ Add scripts:
64
+
65
+ ```json
66
+ {
67
+ "scripts": {
68
+ "lint": "oxlint --deny-warnings",
69
+ "size": "od-harness size",
70
+ "ratchet": "od-harness ratchet --base origin/main",
71
+ "clones": "od-harness clones --base origin/main",
72
+ "unused": "od-harness unused --base origin/main"
73
+ }
74
+ }
75
+ ```
76
+
77
+ The scripts also tell knip that `oxlint` and `@opendesignai/harness` are in use, so `od-harness unused` does not report the two new devDependencies in the adoption change.
78
+
79
+ ## 3. Clean up what cannot be baselined
80
+
81
+ Unused disable directives are reported as errors but cannot go into `oxlint-suppressions.json` (opengame had 44, openmotion 43). Run `oxlint --fix` (removes some) and delete the remaining reported comments by hand. This includes disable comments for rules the presets turn off, such as `oxlint-disable-line react/refs` without the `react-compiler` preset (3 in each of the two).
82
+
83
+ Also remove disable comments that name no rule (`/* eslint-disable */`, `// eslint-disable-next-line`, `/* oxlint-disable */`). They switch off every rule in their range, `od/*` included, and `eslint-comments/no-restricted-disable` rejects them. Do not baseline them: the baseline would then hold one `eslint-comments` entry while the violations they hide never show up in it. To find them:
84
+
85
+ ```sh
86
+ git grep -n -E '(eslint|oxlint)-disable(-next-line|-line)?[[:space:]]*(\*/|--|$)'
87
+ ```
88
+
89
+ Upstream `@eslint-community/eslint-plugin-eslint-comments` crashes under Oxlint 1.96.0 on such a comment in the first line of a file, which drops every `od/*` result for that file. The base preset therefore loads od-harness's wrapper of the plugin (`dist/eslint-comments.mjs`), which reports these comments on their own line instead; see [docs/upstream/oxc-negative-column.md](https://github.com/nexu-io/od-harness/blob/main/docs/upstream/oxc-negative-column.md).
90
+
91
+ ## 3a. Configure the incremental checks
92
+
93
+ `od-harness clones` (jscpd) and `od-harness unused` (knip) keep no baseline: they compare the change with its base commit and fail only on what the change adds. Both tools are dependencies of od-harness; do not install them for the gates. In `gates.yml@v1` both gates are off by default: turn them on with `clones: true` and `unused: true` (step 5).
94
+
95
+ - **knip** runs with the repository's knip configuration at the root (`knip.json`, `package.json#knip`, …), on both sides. A repository that ran the maintainability report moves `.github/maintainability/knip.json` to `knip.json` at the root, in the adoption change, and removes the old report job. Without a configuration knip's defaults apply. Exemptions (`entry`, `ignore`, `ignoreDependencies`) live there, so the file belongs to the owner. Details: [unused](unused.md).
96
+ - **jscpd** runs with od-harness's settings (JavaScript and TypeScript, 12 lines and 80 tokens) and ignores only what `.harness/config.json` lists in `clones.ignore`: od-harness has no ignore list of its own, so without the file jscpd checks tests, fixtures, generated and vendored code too. A `.jscpd.json` is not read. Details: [clones](clones.md).
97
+
98
+ The two tools take their exclusions from different files, both owned by the platform owner (CODEOWNERS):
99
+
100
+ | Gate | What it leaves out is listed in | Not read by it |
101
+ | -------- | --------------------------------------------- | ---------------------- |
102
+ | `clones` | `clones.ignore` in `.harness/config.json` | the knip configuration |
103
+ | `unused` | the knip configuration (`entry`, `ignore`, …) | `.harness/config.json` |
104
+
105
+ Recommended `.harness/config.json`, to copy into the adoption change. It holds every glob of the maintainability report's `jscpd.json` (`.github`, `build`, `dist`, `fixtures`, `node_modules`, `template-library`, `templates`, `tests`, test and spec files, `*.d.ts`) and also leaves out coverage output, vendored code, minified files, `test/`, `__tests__/`, `__fixtures__/`, `__mocks__/` and generated code:
106
+
107
+ ```json
108
+ {
109
+ "clones": {
110
+ "ignore": [
111
+ "**/node_modules/**",
112
+ "**/dist/**",
113
+ "**/build/**",
114
+ "**/coverage/**",
115
+ "**/vendor/**",
116
+ "**/*.d.ts",
117
+ "**/*.min.js",
118
+ "**/*.test.*",
119
+ "**/*.spec.*",
120
+ "**/__tests__/**",
121
+ "**/test/**",
122
+ "**/tests/**",
123
+ "**/__fixtures__/**",
124
+ "**/fixtures/**",
125
+ "**/__mocks__/**",
126
+ "**/generated/**",
127
+ "**/__generated__/**",
128
+ "**/*.generated.*",
129
+ "**/.github/**",
130
+ "**/template-library/**",
131
+ "**/templates/**"
132
+ ]
133
+ }
134
+ }
135
+ ```
136
+
137
+ A path listed there is not checked by `clones` at all: no clone in it fails, and no clone between it and other code. The owner decides what is added or removed, for example when a repository wants its tests checked too (remove the test globs) or has vendored code elsewhere (add its directory).
138
+
139
+ od-harness reads `.harness/config.json` from the directory it runs in, the `working-directory` of `gates.yml` (the repository root by default), as it reads the two baselines, and the globs are relative to that directory. Where the gates run in a package of a larger repository, the file goes into that package: a `.harness/config.json` anywhere else is not read, and jscpd then checks every file, tests and fixtures included.
140
+
141
+ Trial on openmotion and opengame (adoption change against the snapshot HEAD, both clean): `clones` scanned 2,018 and 1,917 files with 84 and 106 existing clones in about 3 s; `unused` found 640 and 464 existing findings in about 5 to 6 s, with `npm ci` done first.
142
+
143
+ A repository whose JavaScript and TypeScript files are all smaller than jscpd's 80 tokens (a new repository) gives jscpd nothing to scan, and `clones` stops with exit 2 ("jscpd scanned no file") instead of passing. Leave `clones` off in the workflow inputs (the default in `v1`) and turn it on in the first change that adds such code (owner-reviewed).
144
+
145
+ ## 4. Generate the baselines (only if there is existing debt)
146
+
147
+ If `pnpm exec oxlint` and `pnpm exec od-harness size` already pass, skip this step: see [Adopting with zero debt](#adopting-with-zero-debt).
148
+
149
+ On a clean checkout of the branch you are adopting on:
150
+
151
+ ```sh
152
+ pnpm exec oxlint --suppress-all # writes oxlint-suppressions.json
153
+ pnpm exec oxlint # must now pass
154
+ pnpm exec od-harness size --init # writes .harness/size-baseline.json
155
+ ```
156
+
157
+ Commit both files. `--suppress-all` and `size --init` are adoption-only commands; afterwards the baselines only shrink.
158
+
159
+ If some generated or vendored source is exempt from the size budget, list it in `.harness/config.json` before `--init`:
160
+
161
+ ```json
162
+ { "size": { "ignore": ["studio/src/generated/**"] } }
163
+ ```
164
+
165
+ `od-harness ratchet` accepts a new baseline file only in the change that adds `@opendesignai/harness` to `package.json`, so generate the baselines in the adoption change itself. A baseline that the adoption change does not create cannot be added later.
166
+
167
+ ### Adopting with zero debt
168
+
169
+ A repository whose code already passes (od-platform) adopts without baselines:
170
+
171
+ - do not run `oxlint --suppress-all` or `od-harness size --init`, and do not commit `oxlint-suppressions.json` or `.harness/size-baseline.json`;
172
+ - every violation fails CI from the first day and is fixed, never frozen;
173
+ - `od-harness ratchet` rejects any later change that creates either baseline file, also a harness upgrade or a change to `.oxlintrc.json`, and also when an administrator merges without owner review, as long as the caller's workflow keeps `ratchet` on (turning a gate off is a reviewed workflow change). This keeps the repository at zero: violations that an upgrade or a config change brings, including a newly extended `react-compiler` preset, are fixed in that change, not frozen.
174
+
175
+ ## 5. Call the gate in CI
176
+
177
+ `.github/workflows/harness.yml`:
178
+
179
+ ```yaml
180
+ name: harness
181
+
182
+ on:
183
+ pull_request:
184
+ push:
185
+ branches: [main]
186
+ merge_group:
187
+
188
+ permissions:
189
+ contents: read
190
+
191
+ jobs:
192
+ harness-gates:
193
+ uses: nexu-io/od-harness/.github/workflows/gates.yml@v1
194
+ with:
195
+ clones: true # off by default in v1
196
+ unused: true # off by default in v1
197
+ commands: pnpm test # optional
198
+ ```
199
+
200
+ Set `clones: true` and `unused: true` in the change that adopts or upgrades to a version of `@opendesignai/harness` that has these gates, together with the configuration of step 3a.
201
+
202
+ - The workflow picks pnpm (`pnpm-lock.yaml`) or `npm ci` (`package-lock.json`), sets up Node from `.node-version` and checks out the full history so `ratchet` can read the base commit.
203
+ - It runs the gates that are on, in this order: `oxlint --deny-warnings`, `od-harness size`, then `od-harness ratchet`, `od-harness clones` and `od-harness unused`, each with `--base "$HARNESS_BASE_REF"`, through `pnpm exec` or `npx --no-install`. Then it runs each line of `commands` (for example `pnpm test`, or `npm test` with npm). Every command runs even after a failure, and the job fails if any failed. The install step comes first, so knip can load the repository's tool configurations.
204
+ - `HARNESS_BASE_REF` is the PR base, the merge-queue base, or the previous commit on push.
205
+ - Inputs: `lint`, `size` and `ratchet` (booleans, default `true`); `clones` and `unused` (booleans, default `false` in `v1`, turned on as above; turning them on by default takes a new tag, `v2`); `commands` (default empty), `working-directory`, `node-version-file`, `fetch-depth` (keep `0`: `ratchet`, `clones` and `unused` read the base commit, and fail with exit code 2 when it is missing), `timeout-minutes`, `runs-on`. Turning a gate on or off is a change to this workflow file and goes through owner review.
206
+ - Do not repeat `pnpm lint` or any `od-harness` gate in `commands`: the gates already run them, from one definition in od-harness.
207
+ - Make the check `harness-gates / harness-gates` required in the branch ruleset.
208
+ - Reference the workflow by the git tag `v1` (`gates.yml@v1`), as above.
209
+
210
+ ## Day to day
211
+
212
+ | Situation | What to do |
213
+ | ------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
214
+ | Lint reports a new violation | Fix it. Do not add a disable comment (rejected) or touch the baseline (ratchet fails). |
215
+ | You fixed existing debt | Run `oxlint --prune-suppressions` and commit the smaller `oxlint-suppressions.json`; CI fails until you do. |
216
+ | A frozen file got smaller | Run `od-harness size --update` and commit; CI fails until you do. |
217
+ | A frozen file must grow | Move code out of it instead. |
218
+ | A file is deleted | Prune both baselines (`oxlint --prune-suppressions`, `od-harness size --update`). |
219
+ | A file or directory is moved | `git mv` (the move must be staged), fix the imports, then, before committing, `od-harness baseline move <old path> <new path>`; commit the baselines with the moved files in the same change. Each new file must still be its old file: a rename git sees (`git diff -M30% -l0`), nothing else counts. The move is reviewed with the change that makes it: `ratchet` lists each moved entry in its output, and where CODEOWNERS covers every path the owner reviews it like any other change. See [baseline move](baseline-move.md). |
220
+ | `od-harness clones` reports a clone | Extract the shared code instead of copying it. Generated or vendored code goes into `clones.ignore` (owner review); the marker text `jscpd:ignore-start` or `jscpd:ignore-end` on added or edited lines (in a comment, a string or code) of the files jscpd scans—`.es`, `.es6` and files without those extensions whose first line is a shebang that contains `node` included—and tracked files among them that `.gitignore` or `.ignore` excludes, fail the gate. |
221
+ | `od-harness unused` reports a finding | Delete the unused file, export or dependency, or use it. Code used where knip cannot see it is declared in the knip configuration (owner review); the tags `@public`, `@beta` and `@alias` in a comment (a block comment, or a line comment on a line of its own), and tracked files that `.gitignore` excludes, fail the gate. |
222
+ | Upgrading od-harness adds a rule | On an otherwise clean branch, run `oxlint --suppress-all` to baseline the new rule; `ratchet` accepts new rule IDs in the change that upgrades the harness. A repository without `oxlint-suppressions.json` fixes the violations instead; `ratchet` does not let it create one. |
223
+ | Upgrading od-harness turns a rule off | Run `oxlint --prune-suppressions` and delete the disable comments that became unused, in the upgrade change. |
224
+ | Turning on React Compiler | Extend `react-compiler` after `base` in the same change. Fix what it reports, or, in a repository that has `oxlint-suppressions.json`, baseline it there (`oxlint --suppress-all` on an otherwise clean branch); `ratchet` accepts the new rule IDs because this `.oxlintrc.json` change turns them on (it compares the effective configurations; an unrelated edit to `.oxlintrc.json` admits nothing). |
@@ -0,0 +1,56 @@
1
+ # od-harness baseline move
2
+
3
+ Baselines are keyed by file path. When a file with frozen debt moves, its entries name a path that no longer exists, and the debt shows up again at the new path: Oxlint reports the violations, `od-harness size` reports the file as over budget, and `od-harness ratchet` rejects entries for paths the base does not have. `od-harness baseline move` takes the entries along with the files.
4
+
5
+ ```text
6
+ od-harness baseline move <from> <to> [--suppressions <path>] [--base <ref>]
7
+ ```
8
+
9
+ `<from>` and `<to>` are a file or a directory, relative to the directory od-harness runs in (the repository root), spelled like the baseline keys. `<to>` is the new path of `<from>`, not its new parent directory.
10
+
11
+ ## Steps
12
+
13
+ ```sh
14
+ git mv studio/src/motion/game packages/game/src # 1. move the files (staged)
15
+ # fix the imports of the moved files and of their importers
16
+ pnpm exec od-harness baseline move studio/src/motion/game packages/game/src # 2. move the entries
17
+ pnpm exec oxlint && pnpm exec od-harness size # 3. both pass again
18
+ git add -A && git commit # 4. one change: the files and the baselines
19
+ ```
20
+
21
+ The command:
22
+
23
+ 1. finds every entry under `<from>` in `oxlint-suppressions.json` and `.harness/size-baseline.json` and renames it to the same place under `<to>`;
24
+ 2. refuses, and writes nothing, when an old path still exists (move the files first: debt never moves to a file while the old one stays), when a new path does not exist, when a new path already has entries of its own (a move never merges debt into a file), or when git does not see a new file as a rename of its old one (step 3);
25
+ 3. checks that every new file is its old file moved, with the condition `ratchet` applies: `git diff -M30% -l0 <ref>` must pair each new file with its old one, over the whole change (git's default 50% similarity lowered to 30%; `-l0` lifts the limit on the number of files git compares, `diff.renameLimit`). `<ref>` is `--base`, by default `HEAD`, so the move must be staged (`git mv`, or `git add` of both paths) and not yet committed; untracked files are not compared. A new file that keeps less than 30% of the old content, or that git pairs with another old file, is not this move: the old debt is gone with the old file, so prune its entries (`oxlint --prune-suppressions`, `od-harness size --update`) and fix the violations of the new file, or split it;
26
+ 4. checks that every rule's total in `oxlint-suppressions.json` and the sum of frozen lines in the size baseline are unchanged; the frozen line count of a file moves with it;
27
+ 5. writes `oxlint-suppressions.json` the way Oxlint writes it (sorted, so `oxlint --prune-suppressions` leaves it unchanged) and the size baseline the way `od-harness size` writes it. It writes no other file: there is no record of the move besides the renamed entries.
28
+
29
+ `--base <ref>` checks a move that is committed already against the commit before it (for example `--base origin/main`). It is a pre-check only: the gate is `ratchet` against the PR base, which applies the same condition to the whole change.
30
+
31
+ Exit codes: 0 moved, 1 refused (the message says why and what to do), 2 usage error (no baseline here, a path outside the working directory, `<to>` inside `<from>`, an unknown `--base`).
32
+
33
+ Paths are compared with their exact spelling, so a case-only rename (`old.ts` → `Old.ts`) works on file systems that ignore case too.
34
+
35
+ ## What `ratchet` accepts
36
+
37
+ `od-harness ratchet` accepts an entry for a file that the base commit does not have only as a move, and only when all of these hold:
38
+
39
+ - git sees the rename between the base and the working tree: `git diff -M30% -l0 <base>` over the whole change, so a file that was moved and also edited counts while it keeps at least 30% of its content, however many files the change moves;
40
+ - the old path had an entry in the same baseline at the base, and no longer exists (spelled exactly so);
41
+ - the moved entry is not larger than the old one, for every rule (suppressions) or in lines (size baseline);
42
+ - each old entry moves to one new file only.
43
+
44
+ Every rule's total must not grow, as for any change. Anything else is still a new file in the baseline and fails: deleting a file with debt and adding an unrelated one is not a move, also not with the owner's approval, and no file in the change can declare one. In the trial directory moves on openmotion and opengame, all 30 and 47 moved entries followed a rename git saw.
45
+
46
+ The 30% threshold: an unrelated file stays near 0%, even one with the same name or the same number of lines; a rewrite that keeps 14 of 40 lines is at 34%.
47
+
48
+ After `baseline move`, `od-harness size` judges a moved file that is over budget by its entry under the new path.
49
+
50
+ ## Review
51
+
52
+ A baseline move is reviewed with the change that makes it. No file of its own records the move: `ratchet` accepts moved entries only for renames git sees, whatever a reviewer approves, and lists each one in its output (`baseline entry moved from …`, `frozen size moved from …`). In a repository whose CODEOWNERS covers every path (`* @owner`), the platform owner reviews it like any other change. The baselines themselves stay outside CODEOWNERS otherwise, so that changes that only shrink them need no owner.
53
+
54
+ ## More baseline kinds
55
+
56
+ The command handles each baseline kind through one loader that lists its entry paths, renames them, and reports the totals a move must keep (`src/cli/baseline-move.ts`). A future kind, for example per-file stylelint counts, adds a loader there and a matching check in `ratchet`; the command and its refusals stay the same.
package/docs/clones.md ADDED
@@ -0,0 +1,51 @@
1
+ # od-harness clones
2
+
3
+ No new duplicated code. `od-harness clones --base <ref>` runs [jscpd](https://github.com/kucherenko/jscpd) on the working tree and on the base commit (in CI: `"$HARNESS_BASE_REF"`, the PR base) and fails when this change adds a clone. Clones the base already has are tolerated; there is no baseline file to maintain.
4
+
5
+ ```text
6
+ od-harness clones --base <ref>
7
+ ```
8
+
9
+ Exit codes: 0 no new clone, 1 a new clone (or code hidden from jscpd, below), 2 usage or environment error (an unknown ref, jscpd failed, nothing was scanned).
10
+
11
+ ## What counts
12
+
13
+ jscpd 5.4.3 (a dependency of od-harness, pinned) runs with these settings, the ones of the maintainability report openmotion and opengame ran before:
14
+
15
+ | Setting | Value |
16
+ | ------- | --------------------------------------------------------------------------------------------------------------- |
17
+ | formats | `javascript`, `typescript`, `jsx`, `tsx` |
18
+ | mode | `weak` (comments are not compared) |
19
+ | size | at least 12 lines and 80 tokens |
20
+ | ignored | only the globs in `clones.ignore` of `.harness/config.json`; od-harness ignores no path or file name of its own |
21
+ | git | files that `.gitignore` or an `.ignore` file excludes are not scanned (jscpd reads both), also tracked ones |
22
+
23
+ od-harness has no ignore list of its own: without `clones.ignore`, jscpd scans every JavaScript and TypeScript file that git does not ignore, tests, fixtures, generated and vendored code included. A repository lists what the gate does not check in `.harness/config.json`, which the platform owner reviews (CODEOWNERS): a listed path is not checked at all, and the owner decides what is added or removed. Start from the [recommended configuration](adopting.md#3a-configure-the-incremental-checks) (dependencies, built and vendored code, type declarations, minified files, tests, fixtures and mocks, generated code, and the extra globs of the maintainability report's `jscpd.json`).
24
+
25
+ Globs are relative to the directory od-harness runs in. A `.jscpd.json` in the repository is not read; the settings above and `clones.ignore` are the only configuration. `od-harness unused` does not read `clones.ignore`: what knip leaves out is set in the knip configuration ([unused](unused.md)).
26
+
27
+ ## How "new" is decided
28
+
29
+ 1. jscpd's own comparison (`--baseline-from-ref <base> --fail-on-new-clones 0`): it checks the base commit out in a temporary git worktree, scans it with the same settings and fingerprints every clone by the text of its two fragments. A clone whose fingerprint the base does not have, or has fewer times, is new. Line shifts and renamed files keep a clone's fingerprint.
30
+ 2. od-harness then keeps only the new clones that touch lines this change adds or edits (from `git diff --text --find-renames <base>` over the files jscpd scans—the extensions below, and files without them whose first line is a shebang that contains `node`—and the files of new clones; untracked files count whole). `--text` reads every such file as text, so a `-diff` or `binary` attribute in `.gitattributes` does not hide its lines. jscpd pairs the copies of a fragment in scan order, so when a file with three or more copies moves, jscpd can pair the copies differently and report an old clone as new. Such re-paired clones in unchanged code are not counted; the summary says how many there were.
31
+
32
+ Consequences:
33
+
34
+ - Copying a function into a new or existing file fails.
35
+ - Editing code that is already duplicated, even a comment or whitespace inside the copied lines, gives the clone a new fingerprint: it counts as new. Deduplicate it in that change.
36
+ - Moving or renaming files does not create clones.
37
+
38
+ ## How to fix a failure
39
+
40
+ The report names both copies (`src/a.ts:10-30 duplicates src/b.ts:5-25 (21 lines)`).
41
+
42
+ - **Fix**: extract the shared code into one function or module and call it from both places. Look for an existing implementation first (the capability index of the repository, if it has one).
43
+ - **Exemption**: generated or vendored code and fixtures are excluded through `clones.ignore` in `.harness/config.json`, which the platform owner reviews (CODEOWNERS).
44
+ - **Not an exemption**: the marker text `jscpd:ignore-start` / `jscpd:ignore-end`. jscpd honours the markers anywhere in a file's text (also in a string or code), so in a file jscpd scans with these formats—one with the extension `.js`, `.jsx`, `.mjs`, `.cjs`, `.es`, `.es6`, `.ts`, `.tsx`, `.mts` or `.cts`, or a file without such an extension whose first line is a shebang that contains `node` (such as `#!/usr/bin/env node`, `#!/usr/bin/node16` or `#!/usr/bin/env nodemon`)—any added or edited line that holds `jscpd:ignore-start` or `jscpd:ignore-end` fails, also a marker moved from elsewhere or an end marker that closes a start the base already has; the report names the files. Markers on lines the change does not touch are left alone.
45
+ - **Not an exemption either**: ignore rules. jscpd skips files that `.gitignore` or an `.ignore` file excludes, even tracked ones (`git add -f`). Among the files with those extensions or such a shebang, `od-harness clones` lists the tracked ones such rules exclude (`git ls-files --cached --ignored`, with `--exclude-standard` and with `--exclude-per-directory=.ignore`) and fails when the change adds or edits one of them, or edits a `.gitignore` or `.ignore` file anywhere in the repository (then every listed file counts, so ignoring the existing copy of a new clone fails too). Fix: change the rule so it no longer matches the file, or add a `!path` exception after it. A rule that excludes a parent directory (`dir/`) cannot be undone with `!path`, because git does not look inside an excluded directory: exclude its contents instead (`dir/*`), then add `!dir/file`. Generated or vendored code goes into `clones.ignore`, and a file listed there is not reported.
46
+
47
+ ## Requirements
48
+
49
+ - The base commit must be in the clone: `gates.yml` checks out with `fetch-depth: 0`. A missing base is a usage error (exit 2), never a pass.
50
+ - jscpd adds a temporary git worktree to the repository during the run and removes it afterwards.
51
+ - jscpd ships prebuilt binaries for Linux, macOS and Windows (x64, arm64) as optional dependencies; npm and pnpm install the one for the platform.
@@ -0,0 +1,74 @@
1
+ # 0001: Run od rules with Oxlint, write them in ESLint plugin format
2
+
3
+ - Status: accepted (2026-12-03)
4
+ - Scope: how `od/*` rules are written, which linter runs them, how existing debt is baselined, and single-file checks in agent hooks
5
+ - Evidence: the linter evaluation (ESLint, Oxlint and Biome on opengame `f1119f03c6` and openmotion `69f15883f`) and a survey of 65 well-known active repositories, both from 2026-12-03
6
+ - Supersedes: an earlier draft that chose ESLint
7
+
8
+ ## Context
9
+
10
+ The 2026-12-03 review set the gate principle: every rule that a program can check becomes a linter rule and blocks in CI. Biome and Oxlint were both proposed; the original harness plan used ESLint 10 with typescript-eslint (no type-aware rules). The decision was to measure against four criteria first:
11
+
12
+ 1. Can it host `od/*` custom rules, each with its own rule ID and a three-part message?
13
+ 2. Can it block only new violations, with a per-file × per-rule baseline?
14
+ 3. Can a single file be checked in under one second, including process start-up?
15
+ 4. Can it run in Claude Code and Codex PostToolUse hooks and exit 2 on new violations?
16
+
17
+ Each linter implemented three representative rules: `od/no-locale-branch` (AST pattern), `od/no-shell-imports-product` (path-based import boundary that reads configuration) and `od/no-raw-storage`.
18
+
19
+ ## Options
20
+
21
+ | | ESLint 10.16.0 | Oxlint 1.96.0 | Biome 2.6.10 |
22
+ | ------------------------------------------ | ---------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
23
+ | Custom rules | Stable rule API; all three rules; rules read options | Loads the ESLint plugin unchanged through `jsPlugins`; hits identical to ESLint line by line. JS plugins are marked "alpha and not subject to semver" | GritQL cannot see the file path; path-based rules need the Developer Preview JS plugins; plugins cannot read options; same-file alias tracking took 9.9 s per file and had to be dropped (opengame: 20 fewer hits) |
24
+ | Block only new violations | Native bulk suppressions | Native `--suppress-all` / `--prune-suppressions`, same file format as ESLint; the flags are not in `--help` and the docs PR is unmerged | None; needs a wrapper script |
25
+ | Single-file cold start (1,603 / 109 lines) | 304 / 224 ms | 73 / 61 ms | 89 / 37 ms (without alias tracking) |
26
+ | Whole repository (opengame) | 6.8 s | 0.45 s | 1.1 s |
27
+ | Hook (fake Claude / Codex payloads) | Works, 0.23–0.34 s | Works, 0.08–0.09 s | Works through a wrapper, 0.11–0.15 s |
28
+ | Forbid inline disables of `od/*` | Yes | Yes (eslint-comments plugin loaded as a JS plugin) | No |
29
+
30
+ Survey (65 hand-picked active repositories, 2026-12-03): 20 use Oxlint as their main linter, 18 of them migrated from ESLint in 2026 (Vite, Vitest, Electron, Sentry, vercel/ai, tRPC, Turborepo, tldraw, PostHog, Twenty, Plane, Langfuse, LobeChat and others); at least 14 load custom JS plugin rules. Sentry's setup matches ours: design-system rules plus an `oxlint-suppressions.json` baseline. 30 still use ESLint, mostly framework repositories (React, Vue, Svelte) and the Codex and Gemini CLIs; 6 lint with Biome.
31
+
32
+ ## Decision
33
+
34
+ 1. **Oxlint runs the rules**, pinned to an exact version in od-harness (no `^`).
35
+ 2. **Rules are written as an ESLint plugin**, loaded by Oxlint as a JS plugin, one rule ID per rule. Rules use only the ESLint API that Oxlint's JS plugins support: no type information, no `parserServices`, options that are plain JSON. The same plugin can be run by ESLint again at any time.
36
+ 3. **Existing debt lives in `oxlint-suppressions.json`** and may only shrink; CI compares it with the base commit.
37
+ 4. **No bypass**: `@eslint-community/eslint-plugin-eslint-comments` is loaded as a JS plugin to reject `eslint-disable` and `oxlint-disable` comments for `od/*` and `rules-of-hooks`; unused disable directives are reported.
38
+ 5. **No Biome; ESLint is the fallback only.** CI never runs two linters.
39
+ 6. Type-aware rules (for example floating promises) stay off. Oxlint's type-aware mode depends on TypeScript 7; revisit once the repositories are on TypeScript 7.
40
+
41
+ ## Consequences
42
+
43
+ Benefits:
44
+
45
+ - About 0.07 s per file and 0.5 s per repository, so hooks and local verification cost almost nothing and there is room for the repositories to grow.
46
+ - Same toolchain family as Vite 8 (Rolldown, Oxc), in line with where the ecosystem is moving.
47
+ - Rule code is not tied to the runner; switching back to ESLint is a configuration change.
48
+
49
+ Costs and follow-ups:
50
+
51
+ - **Upgrade risk**: the JS plugin API is not covered by semver and the bulk suppression flags are undocumented. Before an Oxlint upgrade merges, two checks must agree completely: (1) the rule cases, including the 13 cases from the linter evaluation (in the `no-locale-branch`, `no-raw-storage` and `no-shell-imports-product` cases), under ESLint's RuleTester and through the Oxlint CLI (`test/oxlint-conformance.test.ts`); (2) the hit comparison on real code: ESLint and Oxlint must report the same lines for `od/no-locale-branch`, `od/no-raw-storage` and `od/no-shell-imports-product` (`node scripts/hit-compare.ts <snapshot-dir>...` on opengame and openmotion checkouts; at the measured commits 399 / 129 / 65 and 73 / 119 / 15 hits).
52
+ - **Noise when a baseline is exceeded**: once a file × rule count is exceeded, the whole group is reported (in the evaluation: one new hit, 68 lines). Hooks and local verification must filter by changed lines before showing results to an agent.
53
+ - **Unused disable directives** are not accepted into the ESLint baseline (opengame 39, openmotion 38); check the same for Oxlint and clean them up in the adoption change if needed.
54
+ - **Baselines are keyed by file path**: moving a file resurfaces its debt, so a `baseline move` command is needed before directories move.
55
+ - **`exhaustive-deps` is Oxlint's own implementation**, so counts change (opengame: ESLint 152, Oxlint 165); the differences were not reviewed one by one.
56
+
57
+ ## Review triggers (any one of them reopens running the rules with ESLint)
58
+
59
+ - After an Oxlint upgrade, the rule cases or the hit comparison diverge and cannot be fixed within one release cycle.
60
+ - Oxlint removes or breaks the bulk suppression flags.
61
+ - A required rule can only be written with ESLint-specific APIs (for example `parserServices`).
62
+
63
+ Cost of switching back: the plugin code does not change; the configuration is rewritten as `eslint.config.mjs`; the baseline file format is the same and is regenerated once with ESLint rule IDs. This assumes ESLint can parse the repository's TypeScript: typescript-eslint 8.74 supports TypeScript below 6.1 only, so a repository already on TypeScript 7 that switches back must pin the parser to TypeScript 6, as this repository's `tools/ts-eslint-parser` does.
64
+
65
+ ## Addendum: what the first version measured (od-harness 0.1.0-alpha.0, 2026-12-03)
66
+
67
+ - Configuration is `.oxlintrc.json` with `extends` (file paths, resolved relative to the extending file; package names are not resolved), not `oxlint.config.ts`.
68
+ - `options.reportUnusedDisableDirectives` takes effect from an extended configuration too (checked through two levels of `extends`, from a local file and from a preset in `node_modules`), although Oxlint's configuration schema describes it as root-only. The base preset sets it to `error`; `test/presets.test.ts` and `pnpm smoke` check that a consumer without the option still gets the errors, so an upgrade that changes this fails there.
69
+ - Unused disable directives are **not** accepted into `oxlint-suppressions.json` either (openmotion 40, opengame 41 at severity `error`). `oxlint --fix` removes some of them (same-line `oxlint-disable-line`); the rest are removed by hand in the adoption change.
70
+ - Exceeding a file × rule count reports the whole group under Oxlint too (one new hit in a file with 179 baselined hits: 180 reported).
71
+ - A disable comment that names no rule (`/* eslint-disable */`) makes `@eslint-community/eslint-plugin-eslint-comments` report at column -1. ESLint accepts that; Oxlint 1.96.0 throws a RangeError on line 1, and the file loses every JS plugin diagnostic (all `od/*`). The presets load a thin wrapper of the plugin (`src/eslint-comments/`) that reports at column 0 instead. A naive clamp that keeps the report's end inside the comment is suppressed by the comment itself, so the wrapper uses a zero-width location; `test/presets.test.ts` covers every directive form. Upstream issue draft: `docs/upstream/oxc-negative-column.md`.
72
+ - `oxlint --suppress-all` also freezes `eslint-comments/no-restricted-disable` reports. Inline disables that exist at adoption become baseline debt; `od-harness ratchet` keeps that count from growing.
73
+ - Oxlint reports columns in UTF-8 bytes (native rules too); ESLint reports UTF-16 code units. Lines agree. The conformance suite converts before comparing.
74
+ - With `correctness` enabled and the react plugin on, Oxlint also runs its React Compiler-derived correctness rules (`react/refs`, `react/set-state-in-effect`, `react/immutability`, …), which add several hundred baseline entries per repository. The base preset turns them off and the opt-in `react-compiler` preset turns them on ([0002](0002-react-compiler-rules.md)).
@@ -0,0 +1,34 @@
1
+ # 0002: Keep the React Compiler rules out of the base preset
2
+
3
+ - Status: accepted (2026-12-03)
4
+ - Scope: which of Oxlint's `react/*` correctness rules the `base` preset runs
5
+ - Evidence: trial runs of the presets on opengame `f1119f03c6` and openmotion `69f15883f7` (Oxlint 1.96.0, `pnpm trial`), 2026-12-03
6
+
7
+ ## Context
8
+
9
+ The `base` preset turns on Oxlint's whole `correctness` category with the `react` plugin. In Oxlint 1.96.0 that category includes eight rules derived from React Compiler's checks:
10
+
11
+ `react/refs`, `react/set-state-in-effect`, `react/immutability`, `react/preserve-manual-memoization`, `react/purity`, `react/use-memo`, `react/incompatible-library`, `react/static-components`.
12
+
13
+ They check the assumptions React Compiler relies on. Neither product repository uses React Compiler, and none of the eight is in the harness plan's rule table. In the trial they made up a large share of what the presets reported:
14
+
15
+ | Repository | Diagnostics | From the eight rules | Largest |
16
+ | ---------- | ----------- | -------------------- | ------------------------------------- |
17
+ | openmotion | 4,299 | 681 (15.8%) | `refs` 395, `set-state-in-effect` 213 |
18
+ | opengame | 7,489 | 890 (11.9%) | `refs` 464, `set-state-in-effect` 316 |
19
+
20
+ The diagnostics are the baseline entries (openmotion 4,259, opengame 7,448) plus the unused disable directives that cannot be baselined (40, 41).
21
+
22
+ ## Decision
23
+
24
+ 1. `base` turns the eight rules off explicitly. `react/rules-of-hooks` and `react/exhaustive-deps` stay on.
25
+ 2. A separate preset, `presets/react-compiler.json`, turns the eight rules on as errors. It is extended after `base` (a later `extends` entry wins, so listed before `base` it has no effect).
26
+ 3. od-platform extends `react-compiler` from the start. A product repository extends it in the change that turns React Compiler on.
27
+
28
+ ## Consequences
29
+
30
+ - Trial after the change: openmotion baseline 3,578 entries in 500 files (was 4,259 in 629), opengame 6,558 in 547 files (was 7,448 in 682). With `react-compiler` extended again, both repositories report exactly the earlier 681 and 890.
31
+ - Disable comments for these rules become unused directives under `base` alone, and unused directives are errors. Both snapshots have three `oxlint-disable-line react/refs` comments (unused directives: openmotion 43, opengame 44). The adoption change deletes them, or the repository extends `react-compiler`.
32
+ - Turning `react-compiler` on later changes `.oxlintrc.json`, so `od-harness ratchet` accepts the new rule IDs in that change. A repository that has `oxlint-suppressions.json` can freeze the existing hits there (`oxlint --suppress-all` on an otherwise clean branch); a repository without it fixes them, because only the adoption change may create a baseline file.
33
+ - This decision covers the eight rules above only. Oxlint 1.96.0's `correctness` category has further React rules in the same area (`react/set-state-in-render`, `react/globals`, `react/error-boundaries`, `react/void-use-memo`); they stay in `base` and report nothing on either snapshot.
34
+ - Versioning (README, "Versioning"): a change that makes a preset report more, such as putting these rules back into `base`, only ships in a minor or major version; a change that only turns rules off, like this one, may ship in a patch version.
@@ -0,0 +1,37 @@
1
+ # 0003: One agent harness for Claude Code, Codex and Antigravity
2
+
3
+ - Status: Proposed. The platform owner decided the points below on 2026-12-04; this record lands with A4-1a and becomes Accepted when it merges.
4
+ - Scope: the hook program, the agent configuration that `od-harness init` generates, the managed block in `AGENTS.md`, and the skills that `init` installs.
5
+ - Evidence: live-machine probe G2 (`claude` 2.1.332, `agy` 1.5.21, `codex-cli` 0.171.0-alpha.13.2 static checks and `hooks/list`; Codex interactive hook trust pending live verification), 2026-12-04.
6
+
7
+ ## Context
8
+
9
+ OpenDesign repositories are worked on with three coding agents: Claude Code, the OpenAI Codex CLI and the Google Antigravity CLI (`agy`). They differ in instruction files, hook events, decisions a hook can return, trust models and skill locations; [`docs/hooks.md`](../hooks.md) keeps the capability matrix with sources and empirical status. The only merge gate is CI (`harness-gates`). Agent-side guards give feedback earlier and stop the commands that CI cannot undo: bypassing git hooks, pushing to protected branches, publishing, rewriting baselines, destroying local work.
10
+
11
+ ## Decision
12
+
13
+ 1. **One hook program.** The package ships one hook entry, `@opendesignai/harness/hook`, called with `<agent> <event>`. `od-harness init` writes each agent's configuration into the repository only and never touches user-level settings. Every agent uses what it supports; CI alone decides whether a change merges. Each agent must at least deny the dangerous commands, run `od-harness verify --quick` before it stops, and keep its instruction chain within the size limits.
14
+ 2. **Data-driven lists and zero-dependency parser.** The deny and ask lists, the gate files and the protected branches are data shared with `verify`. Integration branches (`main`, `master`, `release/*`, `cloud/main`, plus configurable `hooks.integrationBranches`, defaulting to `["pilot/mfe"]`) deny any push; other `pilot/*` branches ask (or degrade per agent) on ordinary pushes and deny force pushes, `+refspec` pushes and deletions. Shell commands are read by od-harness's own zero-dependency POSIX sh parser, not by `shell-quote`: it splits compound commands, unwraps wrappers, `bash -c`, `eval`, subshells, command substitutions and here-docs fed to shells, and checks redirection and write targets. When it cannot resolve a command, it matches keywords and denies on a deny keyword. Where an agent cannot ask reliably (Codex does not support `ask` on `PreToolUse`; Antigravity runs `ask` and `force_ask` calls unasked under `always-proceed`), the lists specify per agent whether such a call is denied or allowed with a notice.
15
+ 3. **Fail closed on PreToolUse, except when the harness is missing.** A `PreToolUse` hook (`pre-bash`, `pre-edit`) that fails for any reason (exception, bad or oversize stdin, missing configuration, missing external tool, its own deadline) denies the call, and Claude Code `PreToolUse` hooks set `onFailure: "block"` so that a hook which cannot start blocks as well. Antigravity `PreToolUse` always emits an explicit `decision` (`"allow"` or `"deny"`), never `{}`. The one exception is a missing package, as in a fresh clone before `npm ci` / `pnpm install --frozen-lockfile`: Antigravity, and Claude Code with `onFailure: "block"`, would otherwise block every command, including the install. In that case the launcher (A4-1b) allows the call and reports that hooks are inactive; `node_modules/@opendesignai/harness/**` is classified as a D-class protected path, uninstalling `@opendesignai/harness` is denied, and removing `node_modules` recursively asks on Claude Code and denies on Codex and Antigravity. `Stop`, `PostToolUse`, `PreInvocation` and `SessionStart` hooks never block because of their own errors; they allow and emit a visible notice, so an agent is never trapped in a loop.
16
+ 4. **Codex.** `.codex/hooks.json` holds one entry per event. Codex hashes each hook's command with its arguments, timeout, status message and matcher, but not the script contents, and keys the trust by the file's absolute path and the entry's position. Upgrading the harness therefore asks for no new trust as long as those fields and the order of the entries stay the same, so they are fixed before the first release that generates them. Codex skips a hook nobody has trusted without saying so; `od-harness doctor` reports the trust status. `.codex/rules/od-harness.rules` is generated by default: `git push` and `gh pr merge` prompt; `git reset --hard`, `git clean -f…` and `rm -rf .git` are forbidden, and the hook denies them as well, since prefix rules only see an argv prefix. Codex hook runtime behavior is implemented from official documentation and remains pending live-machine verification after interactive hook trust.
17
+ 5. **Skills.** `.agents/skills/od-*/` is the canonical copy (`SKILL.md` and `references/`), read by Codex and agy. Claude Code reads nothing under `.agents/` (Claude Code 2.1.332), so `init` also writes `.claude/skills/od-*/SKILL.md`: a byte-identical copy of `SKILL.md` only. `references/` is not copied; `SKILL.md` links to its references by their `.agents/skills/od-*/references/…` path, which resolves from both copies. Both copies are committed, `init --check` keeps them identical to the installed package, and `.gitattributes` marks both `linguist-generated=true`. Generated hook and rule files are not marked, so their diffs stay expanded in review.
18
+ 6. **No git hooks.** Agent hooks block bypassing existing local git hooks (`--no-verify`, `core.hooksPath`, `GIT_CONFIG_*`), but A4 does not install git hooks.
19
+
20
+ ## Removing the Claude Code copy
21
+
22
+ The copy under `.claude/skills/` exists only because Claude Code does not read `.agents/skills/`. When Claude Code documents `.agents/skills/` as a skills location and the oldest Claude Code version od-harness supports reads it:
23
+
24
+ - the next od-harness minor release stops generating `.claude/skills/od-*` and states that Claude Code version in its release notes;
25
+ - `od-harness init` and `od-harness agents sync` delete each `.claude/skills/od-*` directory whose `SKILL.md` carries `metadata.generated-by: od-harness@…`, never any other directory, and remove the `.gitattributes` lines they added;
26
+ - `init --check` fails while such a directory remains, so a consumer removes it in the change that upgrades the harness;
27
+ - this record is updated with the Claude Code version and the od-harness release.
28
+
29
+ Checking the trigger is an item on the od-harness release checklist.
30
+
31
+ ## Consequences
32
+
33
+ - Upgrading the harness changes behaviour without new Codex trust prompts. Review of `package.json`, the lockfile and exact version pins (CODEOWNERS), npm provenance, and a CI check that rejects `file:`, `link:` and git sources for the harness make up for trust that does not cover script content.
34
+ - Generated agent configuration can run commands on a teammate's machine, so `.claude/`, `.codex/`, `.agents/` (hooks, rules, plugins, `od-*` skills), `.gitattributes` and the instruction files are owned in CODEOWNERS, and the protected branches require code owner review.
35
+ - **Claude Code must be started from the repository root.** Claude Code reads the committed `.claude/settings.json` only from the directory it starts in; started in a subdirectory, it runs none of these hooks and ignores `permissions.deny`. `od-harness` does not generate `.claude/settings.local.json` (`--local` is not implemented); the managed block in `AGENTS.md` and `docs/hooks.md` document this requirement, and CI still checks every change.
36
+ - Claude Code users get the skills a release later than they could if symbolic links worked everywhere; a committed symbolic link becomes a text file on a default Windows checkout.
37
+ - An agent without hooks, or a person, is checked only by CI.