# @shadowclone/harness

Sets up a repository harness: shared agent instructions, skills, and checks. It serves `shadowclone init --repo` and `shadowclone check`.

<!-- package-facts:start -->

(generated by `bun run guides`; do not edit by hand)

- Package name: `@shadowclone/harness`
- Workspace dependencies: `@shadowclone/changes`, `@shadowclone/core`, `@shadowclone/environment`, `@shadowclone/profile`, `@shadowclone/redact`, `@shadowclone/sessions`, `@shadowclone/skills`
- External dependencies: `smol-toml`, `zod`
- Export subpaths: `.`, `./testing`

<!-- package-facts:end -->

## Owns

- `src/detect/`: finds the tools, scripts, and entries of a repository.
- `src/plan/` and `src/render/`: `planHarness` and the text of `AGENTS.md`, Claude settings, and the harness skills.
- `src/apply.ts`: `applyHarness`.
- `src/check/`: `runHarnessCheck` and `renderCheckReport` for the `human`, `json`, and `claude-stop` formats.
- `src/memory.ts`: memory candidates and decisions.

## Rules

- `applyHarness` takes the `harness-write.db` lock. It writes through `commitLocalChanges`, so `undo` can reverse it.
- The plan holds each file's previous text. The write fails when a file changed after the plan.
- The shared rule section is at most `harnessRuleByteBudget` (6144) bytes.
- Personal guidance enters shared files only with the `personal` option.
- A personal skill cannot replace a skill that Shadowclone authors.
- Shadowclone rewrites only the text between its own markers. A symbolic link is `skipped`. A changed or malformed section is `preserved`.

## Tests

Run `bun test` in this folder, or `bun test packages/harness` from the root. The `./testing` export gives fixture repositories (`bunTaskList`, `pythonConfig`) and `harnessTestSetup`. Fixtures run `git` in temporary folders.

Update this file in the same commit when you change the package purpose, public exports, dependencies, or a rule above.
