Files
Maximilian Roos ac958c2326 chore(clawpatch): track hand-authored threat models under .config/clawpatch (#2822)
## Summary

[clawpatch](https://www.npmjs.com/package/clawpatch) is the automated
Codex-driven code reviewer we used for a security/data-safety review
pass over worktrunk. It keyed its state to a gitignored `.clawpatch/`
directory — which means the work vanishes when the worktree is removed.
This relocates that state to `.config/clawpatch/`, alongside the repo's
other tool configs (`insta.yaml`, `nextest.toml`, `wt.toml`, …), and
tracks only the durable, reusable inputs.

The auto-mapper is near-blind to worktrunk's layout (it seeds features
from `src/main.rs`, `src/bin/*`, `tests/*` only — not `src/commands/`,
`src/git/`, `src/config/`), so every high-value finding came from six
**hand-authored** feature definitions. Each is a threat model mapping a
worktrunk security/data-safety invariant to the exact files implementing
it — `approval_gate`, `merge_safety`, `remove`, `config_deprecation`,
`repo_cache`, `switch_resolve`. That mapping is the actual review IP and
is worth keeping in-repo: model- and tool-agnostic, equally usable by a
future review pass.

## What's tracked vs not

Tracked (8 files): the 6 `feat_custom_*.json` threat models, the tuned
`config.json`, and a `.gitignore` allowlist block.

Everything else stays gitignored — derived, machine-specific, or
transient:

- `findings/` — regenerated by `clawpatch review`, and tied to old
branch state
- `project.json` — regenerated by `clawpatch init`, contains an absolute
`rootPath`
- the auto-mapped `feat_cli-command` feature — deterministic from
`clawpatch map`
- `runs/` `reports/` `locks/` `patches/` — per-run transient

The `.gitignore` uses an allowlist (`ignore .config/clawpatch/*`, then
re-include `config.json` and `features/feat_custom_*.json`) so a future
`clawpatch map`/`review` cannot accidentally start tracking regenerated
state.

## Usage note

Run with `--state-dir .config/clawpatch` or
`CLAWPATCH_STATE_DIR=.config/clawpatch`. The in-file `stateDir` alone is
not enough: clawpatch's config discovery only honors the relocated
directory when the state dir is set via flag or env. `config.json` also
adds `.config/clawpatch/**` to `exclude` so clawpatch never reviews its
own state.

## Test plan

No code change — config and gitignore only. Verified `clawpatch status
--state-dir .config/clawpatch` reads the relocated state (7 features, 31
findings) and `git check-ignore` confirms the allowlist tracks exactly
`config.json` + the 6 `feat_custom_*.json`.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude <noreply@anthropic.com>
2026-05-19 20:22:28 -07:00

39 lines
733 B
JSON

{
"schemaVersion": 1,
"stateDir": ".config/clawpatch",
"include": [
"**/*"
],
"exclude": [
"node_modules/**",
"dist/**",
"build/**",
"target/**",
".build/**",
".git/**",
".clawpatch/**",
".config/clawpatch/**"
],
"provider": {
"name": "codex",
"model": null
},
"commands": {
"typecheck": "cargo check --workspace --all-targets",
"lint": null,
"format": "cargo fmt --all --check",
"test": "cargo test --workspace"
},
"review": {
"maxContextFiles": 24,
"maxOwnedFiles": 12,
"maxFindingsPerFeature": 10,
"minConfidenceToFix": "medium"
},
"git": {
"requireCleanWorktreeForFix": true,
"commit": false,
"openPr": false
}
}