@houserules/cli
v0.22.0
Published
houserules: an interactive installer for portable Claude Code context discipline: hooks, skills, agents, changesets integration, and token-efficiency tooling.
Maintainers
Readme
houserules
A Claude Code session spends most of its budget on context it pays for every turn, and on conclusions it derives a second time because the first one was never written down. houserules is a portable collection of infrastructure that pushes that work off the main agent's context window.
It installs hooks, skills, agents, and rules into any repo, detects what the repo already uses, and previews every write before making it.
Table of contents
- The one idea
- Install
- What
initdoes - Modules
- Parallel phases
- Milestones
- Plugins
- After install
- Working in manual mode
- Staying current
- Ledgers: what is committed and what is generated
- Changesets are the canonical changelog
- Token spend and response style
- Writing a plugin
- Upgrading from a pre-split version
- Support matrix & port hazards
- Contributing
- License
The one idea
Context out, not context in. Every piece pushes work off the main agent's context window: into disposable subagents, onto disk (ledgers, changesets), into deterministic scripts, or behind grep-able snapshots. The main thread holds verdicts and pointers, not the reading that produced them. Four levers:
- Resident context (paid every turn): a lean CLAUDE.md, nested per-package guidance, "grep don't read whole" rules.
- Re-derivation (paying twice for one conclusion): guardrail docs, backlog ledger, changesets, memory conventions.
- Round-trips (permission stalls, re-orientation): permission allowlist, hooks, the session-start header.
- Cost-not-count (same tokens, cheaper rate):
model: haikuandeffort: lowsubagents, plus opt-in output compression.
Install
pnpm create @houserulesThat adds @houserules/cli to the repo's devDependencies with the package manager that ran
it and runs houserules init. npm create @houserules and yarn create @houserules do the
same. The package is @houserules/cli and the binary it installs is houserules, the same
split @changesets/cli uses for changeset. Every later command is pnpm houserules <cmd>,
or npx houserules <cmd>, since the local binary is on the path once the package is a
dependency. Installing the cli yourself with pnpm add -D @houserules/cli and running
pnpm houserules init lands in the same place.
Preview without writing with --dry-run. Skip the prompts with --yes. From a local
checkout, run node /path/to/houserules/packages/cli/dist/cli.js init.
Requires Node 22 or newer.
Claude Code 2.1.314 or later is the floor. doctor warns when the running version is below the highest one the install relies on, and an install with an agent pinned to model: fable needs 2.1.321.
What init does
- Detects the repo read-only: package manager, workspace packages, per-package fix
scripts (it knows
fixvslint:fix+format:fixdivergence), TypeScript, changesets state, and existing.claude/files. Then it shows you the profile it concluded. - Asks which modules you want (multiselect, preselected from detection) and which targets to track.
- Previews the full plan: every file it would create, the exact
settings.jsondiff, and what it skips because it's yours. Only then does it write. - Records a receipt (
.claude/houserules.manifest.json, file hashes) soupdatecan refresh houserules files without clobbering your edits, anddoctorcan tell drift from damage. It also writes your chosen modules intomodulesin the config, and a managed block in.claude/.gitignorethat ignores the manifest and the installed files. The config,settings.json, and the.gitignorestay tracked. See the installed payload.
Non-destructive guarantees: it never runs package-manager installs, never touches
settings.local.json, never rewrites unparseable JSON, backs up settings.json once before
its first merge, and --dry-run writes nothing at all.
In your CLAUDE.md houserules maintains a marked block, everything between
<!-- houserules:claude-md start --> and <!-- houserules:claude-md end -->. It rewrites
only what is inside those markers. Every byte outside them is yours and is never modified.
Opt out with "claudeMd": { "managed": false } in .claude/houserules.config.json and houserules will
not touch the file at all. That opt-out also skips .claude/houserules.md.
In CLAUDE.md the block holds one line, @.claude/houserules.md. The houserules sections live in
that file, which houserules writes and refreshes. The managed .claude/.gitignore block lists it,
so git does not track it. A release that changes the sections rewrites only that ignored file, and
CLAUDE.md does not change. With "instructionsFile": "AGENTS.md" the block keeps the full
sections, because tools other than Claude Code read AGENTS.md without resolving @ imports.
update converts an existing block of full sections to the import line when the block is as
houserules wrote it. A block you edited is left alone and reported as yours.
On a fresh clone .claude/houserules.md is missing until the sync runs. Claude Code loads nothing
for a missing import and says nothing about it. The SessionStart sync writes the file and prints its
restart line. Staying current describes that sync. To hand-edit the sections,
run houserules eject .claude/houserules.md, as for any other payload file. See
Editing an installed file.
houserules writes that block into the file your repo already has: CLAUDE.md, else AGENTS.md,
else it seeds CLAUDE.md. Set "instructionsFile": "AGENTS.md" or "CLAUDE.md" in
.claude/houserules.config.json to force one. The key goes into the config init seeds, or into a
complete config written by hand. claudeMd.managed keeps its name and covers either
file. Claude Code reads AGENTS.md natively from v2.1.277, but only when no CLAUDE.md is on the
path, so a CLAUDE.md silences the block in AGENTS.md. doctor warns when that happens. You have
two ways out. Add an @AGENTS.md line to the CLAUDE.md, or set the following in
~/.claude/settings.json. Claude Code reads this setting from the user file only and ignores it in
project and local settings.
{
"pluginConfigs": {
"cc-plugin-agents-md@builtin": {
"options": { "instructionFiles": "claude-md-and-agents-md" }
}
}
}Modules
@houserules/cli ships exactly 18 modules. Everything else lives in a plugin package.
| Module | Default | What you get |
| ------------------ | ------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| core | always | shared libs, config-driven Bash guard (blocks git commit/push/stash, git checkout/restore/reset --hard/clean, gh pr create), houserules.config.json, read-only git permissions, CLAUDE.md seed (filled from detection) or staged additions |
| lint-fix | on when fix scripts found | Stop hook: fix the files the turn changed and surface only unfixable residue. It does so only with fix.passPaths on and fix scripts that take paths. Without the key it runs nothing, since a whole-tree fix outlasts a Stop. init turns fix.passPaths on for a new install whose fix scripts all take paths, and otherwise leaves it off with a next step naming the path-taking form. It also exits without running after a read-only turn or while background tasks are running. SubagentStop is wired only when fix.onSubagentStop is true, since parallel subagents would each fix every package at once |
| session-context | on | SessionStart hook: 3-line branch/changes/targets header |
| rename | on when TypeScript | semantic TS rename via the LanguageService |
| reviewers | off | per-target read-only reviewer agent drafts (marked DRAFT until you fill the authoritative source) |
| debug-session | off | /debug-session skill: hypothesis→tagged-trace→cleanup loop (logs under .claude/debug/, verdicts via jq, all instrumentation removed) + SessionStart backstop + debugger agent template |
| plans | off | /plan-project skill: persist large/multi-phase work to a gitignored .claude/plans/<name>/ (PLAN + living ROADMAP + per-phase sub-plans), then stop. Implementing a phase is a separate step. Resume by grepping ROADMAP status. An effort of several independently owned plans that run at the same time becomes a milestone, see Milestones |
| orchestrate | off | /orchestrate skill + phase-orchestrator (opus) and task-worker (sonnet) agents, plus a closeout-worker (sonnet) that runs a closeout phase as one ordered job from the plan-project closeout template, and a closeout phase carries the flat signal, so it runs in the dispatcher's own context: by default each planned phase runs one layer down, where the orchestrator slices it on file ownership, writes the shared seam first, and dispatches one worker per slice in waves. You relay its per-wave reports, never diffs. Independent phases of one plan run concurrently. /orchestrate <milestone> runs one step of a milestone, with a phase from each member plan side by side. --flat keeps the slicing at the main conversation (pairs with plans). A module option adds task-worker-research (WebFetch, WebSearch). Per-slice model and effort follow the slice's shape: haiku/low for mechanical, opus/high for seams, the worker defaults otherwise (effort needs Claude Code 2.1.292+) |
| research | off | three off-context agents for planned phases: research-spike (one scoped question set, one cited report), research-synth (merge reports into one reference doc), refactor-planner (reconcile audit reports into a sliced refactor plan) (pairs with plans) |
| verify-changed | off | /verify-changed skill + script: run check/test/lint on the changed packages and their transitive dependents, in the background from the calling context. Only the PASS/FAIL-per-package verdict reaches the main context |
| ready | off | /ready skill: off-context pre-handoff roll-up giving one ready/not-ready verdict plus the falsifiable acceptance checklist (pairs with verify-changed + reviewers) |
| sweep | off | /sweep skill: shard a repo-wide mechanical edit into per-package writer subagents that report only counts. The orchestrator pays O(shards) and never sees the match set |
| read-guard | off | PreToolUse(Read) guard: redirects unbounded whole-file reads of lockfiles/dist/*.min.*/oversized files toward grep or a windowed read (reads with offset/limit pass untouched) |
| tool-output-trim | off | PostToolUse(Bash|Read) hook: trims a result over 16 KiB to its first 12 KiB and last 4 KiB with an elision line, so a runaway command or whole-file read does not fill the context. Needs Claude Code 2.1.121+. |
| regen | off | PostToolUse(Edit|Write) hook: re-run a user-owned generator when an edited file matches a target's regen { sourceGlob, command }, so a generated reference snapshot never silently stales |
| statusline | off | kit-aware statusLine: pending changeset debt + houserules targets touched (wired only if you have no statusline of your own) |
| code-cleanliness | off | .claude/rules/code-cleanliness.md: intention-revealing names, functions under 20-30 lines, no magic values, no dead code. Path-scoped, plus .claude/reference/design-principles.md (SOLID, DRY, KISS, YAGNI, rule of three), pull-only and never auto-loaded, and the /tidy skill that audits a working diff against the rule |
| ci-settings | off | .claude/settings.ci.json: a deny list for unattended runs, blocking edits to .github/**, the lockfile, dist/**, and .changeset/**. Deliberately NOT merged into settings.json, since those denials would break interactive work. Opt in per run with claude --settings .claude/settings.ci.json. Under --bare, which runs no project hooks, this deny list is the only guard |
Parallel phases
/orchestrate runs the independent phases of one plan at the same time. Each one marked with the worktree signal gets its own git worktree under .claude/worktrees/, so two phases can edit the same package without seeing each other's half-finished files. When a phase closes, its worktree's diff is checked against the main checkout and applied unstaged, and one whole-tree check runs after the last apply. A patch that no longer applies reruns that phase once from the new tree.
/plan-project marks phases worktree by default whenever two or more can run together. In a paid trial, worktree phases finished 33.9% faster than phases sharing one checkout, at 8.5% more cost. Slices inside a phase still share its tree, split by file ownership. plan-lint suggests the signal when two unordered phases without it have overlapping Domain roots.
Milestones
A milestone coordinates several plans that different owners run at the same time. It schedules them as ordered steps. Each step runs one phase from each member plan side by side and closes on one check over the whole tree.
Most work does not need one. A milestone fits only when the phases split into groups with disjoint write roots, two groups can run at once without waiting on you, an artifact crosses between groups mid-sequence, and each group could finish on a different day. The planning recipe states the four questions. The first "no" routes the work to a single plan.
/plan-projectroutes to the milestone tier when the effort passes that bar./orchestrate <milestone>runs the open step, or opens the next one./orchestrate <milestone>/<member> <phase>runs one member phase on its own.
Plugins
A plugin is a separate package that contributes more modules. Install it as a dependency
and declare it in .claude/houserules.config.json (see Writing a plugin) to
select its modules.
| Package | Modules it ships |
| ------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| @houserules/plugin-prose | ships code-comments, prose-voice, output-prose, pr-description |
| @houserules/plugin-testing | ships testing (plus opt-in testing-typescript, testing-javascript, testing-svelte, and testing-3d language and framework guides, chosen through the module's options) and playwright-mcp (the Playwright MCP server config, cross-browser, with test assertions enabled) |
| @houserules/plugin-changesets | ships changesets, ledger |
| @houserules/plugin-backlog | ships backlog |
| @houserules/plugin-decisions | ships decisions |
| @houserules/plugin-persona-auditor | ships persona-auditor |
| @houserules/plugin-typescript | ships typescript (a path-scoped rule for the type-system decisions with a right answer, deferring comments to code-comments and naming to code-cleanliness) |
| @houserules/plugin-accessibility | ships accessibility (WCAG rule, pull-only criteria reference, and the wcag.mjs router, plus opt-in React/Svelte/Vue/HTML guides chosen through the module's options) and accessibility-review |
| @houserules/plugin-three | ships three (a path-scoped Three.js rule, plus opt-in Threlte and React Three Fiber guides chosen through the module's options) |
| @houserules/plugin-svelte | ships svelte (a Svelte 5 rule plus an opt-in SvelteKit guide) and svelte-mcp (the Svelte MCP server configs, installed to .claude/mcp/svelte.*.json for you to wire up) |
| @houserules/plugin-design | ships design (a DTCG token set seeded to .claude/design/tokens.json, a path-scoped design rule, a pull-only principles reference, and the design.mjs query script), design-review (a design-diff review pass), and design-game (game-UI specific design guidance), plus opt-in design-tailwind to make the repo's own Tailwind v4 theme the design system instead, and chrome-devtools-mcp (the Chrome DevTools MCP server config, for performance traces, Lighthouse, and heap snapshots) |
| @houserules/plugin-github | ships projects (syncs the backlog and decision ledgers to a GitHub Project, so the durable record survives outside the repo) |
| @houserules/plugin-wireit | ships wireit (a path-scoped wireit rule, plus the .claude/extensions/wireit.json fragment), wireit-lint, and wireit-setup, all off by default |
Installing a plugin opts you into the plugin. Each module inside it still honors its own
default: most default off, so you enable them individually with --modules or through
modules in the interactive prompt.
After install
npx houserules doctor # validate: config vs repo reality, hooks wired, files intact
# --json for a machine-readable report (CI-stable shape)
npx houserules update # refresh houserules files after a new houserules release (your edits are kept, --force overrides)
# --sync is the unattended form the install hooks run: one line, exit 0
# add --next-steps to reprint the post-install to-do list
npx houserules modules # list installed vs available modules, and enable more after init
# --disable=<ids> withdraws a module: prunes its files (your edits
# are kept unless --force) and unwires only the settings entries no
# remaining module still needs
npx houserules report # transcript telemetry for this repo's sessions (read-only)
# --json for a machine-readable report
# --since YYYY-MM-DD drops sessions that started before that day
# --export <file> --label <name> writes a redacted copy to carry elsewhere
# --import <file> (repeatable) renders exports instead of local transcripts,
# one column per label when more than oneTo compare machines, run npx houserules report --since <day> --export report.json --label work
on the other machine and copy the file over. The export holds counts, session ids, skill and hook
names, model ids, and dates. Blocked and denied commands are reduced to their first word (or
first two for git and gh), crash signatures to a script basename, and no path or hostname is
written. Then npx houserules report --import report.json --import home.json renders both side
by side. A resident context section reads each session's first recorded system prompt, which
Claude Code writes from 2.1.300 on, so older transcripts show as not recorded. A Stop hook name
that is not a bare script name is reduced to its first word in an export, the same as a command.
The report has five readouts beyond the per-session token tables:
- Stop hooks. Under
hook health, one row per Stop hook with its runs, p50, p95, and max in milliseconds. A final(per Stop total)row sums the hooks of each Stop, so it shows what one stop cost you. The record carries no timeout marker, sotimeoutscounts runs of 120 s or more, which is the Stop-hook timeout the kit installs. - 1-hour cache writes. The totals split
cache_writeinto 1-hour and 5-minute writes. The cost-weighted input now weighs 1-hour writes at 2x and 5-minute writes at 1.25x. An export made before the split has no 1-hour count, so it printsnot recordedand weighs every write at 1.25x. - List price. One dollar figure for the corpus, split into fresh input, cache read, cache write, and output, priced per model. A model the price table does not list adds no dollars and is named with its share of weighted input. The table is written into the CLI, so it goes stale when prices change. Treat the figure as a ratio between runs, not as a bill.
- Result sizes. Under
friction, how manyReadandBashresults there were, their average size, and how many ran over thetool-output-trimcap of 16,384 bytes. When results ran over and the module is not installed, a hint namesnpx houserules modules. - Artifact episodes. One row per session that called
Artifact, from the first quickstart or publish through the last publish: calls, comment calls, publishes, requests, wall time, output, weighted input, its share of the session, and the model on most requests.
An export made before a readout existed renders without that section, and --import comparisons
show - in its rows, never 0.
doctor also reads npm's latest for @houserules/cli and prints a readout when both the
install and the running CLI are behind it, with the command that updates the CLI and then the
install. It stays quiet when the running CLI is already at latest, when npm cannot be reached,
and under CI, NO_UPDATE_NOTIFIER, or NODE_ENV=test.
Every command takes the target repo as a positional [dir] or via --cwd <dir>, plus a
global --dry-run. Flags are scoped per subcommand, so a flag that doesn't apply is an
error rather than a silent no-op.
Exit codes. doctor is usable as a CI gate:
| Code | Meaning |
| ---- | ------------------------------------------------------------ |
| 0 | success (doctor: no problems) |
| 1 | error, or doctor found a problem / actionable drift |
| 2 | .claude/houserules.config.json does not satisfy the schema |
The installed payload is generated, not source
The files houserules installs are build output, so it ignores them. init and update write a
managed block into .claude/.gitignore, between # houserules:gitignore start and
# houserules:gitignore end. The block lists the manifest and every installed skill, agent, rule,
and hook file under .claude/ by path. A skill of your own beside houserules' skills stays
tracked, because only the installed paths are listed. A houserules upgrade no longer shows up as
a wall of machine-written churn.
.claude/scripts/ and .claude/templates/ ignore themselves with a * rule, so the block skips
them. Seeds and ledger records are never listed. Git still tracks these:
.claude/houserules.config.json.claude/settings.json.claude/.gitignore- the marked block in your instructions file
- seeds
- the per-directory
.gitignorefiles
A fresh clone has settings.json but not the ignored files. The config's modules list records
what to install, and Staying current describes how a clone gets them without
anyone running a command.
Because the hook scripts can be absent on a fresh clone while settings.json is committed, every
hook command is guarded. A missing script on a blocking hook prints
[houserules] changeset-check.mjs: this install's generated files are not synced yet. Run your dependency install (npm install, pnpm install, or yarn), or houserules update for a global CLI. This call is blocked until then.instead of a Node stack trace. A SessionStart hook prints the same notice without the last sentence and exits 0, so Claude reads it as context and your turn does not fail.
If you edit an ignored file, update keeps your edit and doctor reports the file as yours.
The edit stays on your machine, since git does not see the file. To share it with your team, see
Editing an installed file.
Want the committed layout? Set payload.commit: true in .claude/houserules.config.json.
houserules then drops the block, and the payload is committed as before. For the hook scripts
alone, scripts.commit: true skips their gitignore and the migration that untracks them.
Upgrading an install that committed its payload
One plain houserules update converts an install that committed its payload. It ejects each
file you edited, so those stay yours. It removes every other file and the manifest from the
index and leaves them on disk. Then it prints the git add line to run, and you commit that
in the same commit as the staged removals.
After that commit, a teammate's pull deletes those now-untracked files from their working tree.
prepare or the payload-sync hook rebuilds them. Git refuses the pull for a teammate who has an
uncommitted edit to one of those files. They set the edit aside first, then pull. To keep the
committed layout instead, see the payload.commit opt-out.
Drift: stale vs yours
doctor reports every managed file whose contents no longer match what houserules would write,
with a unified diff, and says why they differ:
| Status | Means | Exit 1? |
| ----------- | ------------------------------------------------------------------------ | ------- |
| stale | houserules changed, and your copy is what it last wrote | yes |
| missing | a houserules file is gone (a hook now wired to nothing) | yes |
| no-marker | a managed block's markers were removed | yes |
| orphaned | no enabled module produces it any more | yes |
| yours | you edited it, so it is kept and never overwritten without --force | no |
That distinction is the point. A content-hash lockfile can only say "differs". houserules'
manifest records what it last wrote, so it can tell a kit-side change from one of yours. An
edit you made on purpose never holds the exit code red. Nothing lets you acknowledge one, so
failing on it would leave doctor permanently red on an install working exactly as you intended.
npx houserules doctor --fix # reconcile stale/missing/no-marker, your edits survive
npx houserules doctor --fix --force # also overwrite the files you edited
npx houserules doctor --fix --prune # also delete orphansRules: you own the frontmatter, houserules owns the body
A rule's paths: globs decide when Claude Code loads it, and only your repo knows which
suffixes it actually uses. So a rule file is split down the middle. Everything below the
closing --- is houserules' and stays refreshable forever.
To set a rule's globs, put them in .claude/houserules.config.json, keyed by rule id. The id
is the file's name under .claude/rules/ without .md.
{ "rules": { "testing": { "paths": ["src/**/*.ts"] } } }update renders that value into the rule's frontmatter, every other key unchanged, on a create
as well as a refresh. The config is committed, so a fresh clone gets the trimmed rule while the
rule file itself stays ignored. doctor reports a rules key that names no installed rule.
A config paths value replaces a hand-trimmed frontmatter for that rule, so the config wins
over what the file says. A hand trim is kept only when no rules value is set for the rule.
Then, under payload.commit: true, trim paths: in the file and nothing breaks. It is not
drift, it is not a warning, and the rule body still updates. The only time houserules says
anything is when it ships a new default paths: and yours differ, and then it tells you once and
keeps your version.
Editing an installed file
Ignored files are not shared, so a hand edit to one stays on your machine. To share an edit, eject the file:
npx houserules eject .claude/skills/<name>/SKILL.mdeject adds the file to ejected in .claude/houserules.config.json and rewrites the ignore
block so git sees the file. It then prints Ejected <file>. houserules now leaves it alone. and
a line of the form Share it with: git add <file> .claude/houserules.config.json .claude/.gitignore.
Run that line and commit. A teammate's sync keeps the edit only when the config lists the file.
Ejecting a file that is already ejected prints Already ejected. Nothing changed.
eject refuses these paths, prints Nothing changed., and exits 1:
- a path houserules does not own
- anything under
.claude/scripts/or.claude/templates/, which houserules rewrites on every sync - the manifest and
.claude/settings.json - any file when
payload.commitis true, since git already tracks every installed file - a file
.claude/.gitignoredoes not list - a file git already tracks
Given a directory, eject opens a picker over the files it accepts under that directory. A bare
eject opens the picker over every file it accepts. The picker needs a terminal on both stdin and
stdout. Without one, such as in CI or with piped input, and under --yes, eject never prompts.
It refuses and lists the files instead. A run over several files writes nothing unless every one
succeeds. --dry-run prints Dry run. Would eject: <files> and writes nothing.
npx houserules eject --undo .claude/skills/<name>/SKILL.md--undo removes the entry and rewrites the block, and the file's bytes stay as they are. It
prints <file> is ignored again. for each file. When git tracks the file, --undo stages the
removal, and Commit the staged removal to finish. tells you to commit it. A file that is not
ejected is refused with this file is not ejected. --undo takes a directory or no path and
opens the same picker over the ejected files, and --yes refuses and lists them instead.
When you edit an ignored file you did not eject, update and doctor print two lines beside it:
<file>: to keep your edit, run `npx houserules eject <file>`
<file>: to discard your edit, delete the file and run `npx houserules update`, which recreates itDeleting the file and running update recreates it from the current payload. A committed file
gets neither line, and neither does a file you already ejected.
The formatter
Everything houserules installs under .claude/ is tracked by content hash, so a repo-wide
prettier --write . rewrites those bytes and update then reads your whole install as local
edits and refuses to refresh it. Nothing warns you, because from the manifest's side it looks
exactly like you edited every file.
When prettier is detected, houserules maintains a marker-delimited block in .prettierignore
listing the subtrees it owns. Everything outside the markers is untouched, and a repo with no
prettier never gains the file. eslint flat config is JavaScript, so houserules prints the
ignores entry for you to paste instead of editing it.
Already hit this? npx houserules doctor --fix --force takes houserules' copies back.
houserules.config.json is schema-validated
The config is validated against a schema generated from houserules' own zod definition and
published inside @houserules/cli at schema/houserules.config.schema.json. init seeds a $schema
reference into the file it writes, so editors give you completion and inline errors. A repo
that depends on @houserules/cli gets the local
../node_modules/@houserules/cli/schema/houserules.config.schema.json. One that only ever runs
npx @houserules/cli without installing it has no local copy, so it gets the published URL instead. doctor reports
any problem per field (changesets.baseBranchh is not a known changesets setting) and exits 2.
init and update also refuse a schema-invalid config with exit 2, printing each problem and writing nothing.
Working in manual mode
Manual mode is the Claude Code permission mode where you approve each edit at a prompt. Its
config value is default, and hooks receive it as "default". The fixer, regen, and notice hooks
read that value. The changeset and decision behaviors judge a turn by the edits you kept, in any
mode. In manual mode that changes these behaviors:
- Changeset nudges.
changeset-check.mjsand the changeset gate act only on edits you kept. A rejected edit changes nothing, so it raises no nudge. The changeset trigger in the generatedhouserules.mdsays the same. - Fixer and regen hooks.
lint-fixandregenskip their writes, since a hook write would land without a prompt. Each exits 2 and names the exact commands it skipped, so Claude runs them through a prompt you see. - Dispatch skills. Every edit a subagent makes raises its own prompt in your session. When
you type
/orchestrateor/sweep, themanual-mode-notice.mjsUserPromptSubmit hook prints[houserules] Manual mode: every edit a subagent makes raises its own permission prompt in this session.Both skills then offer to switch mode or run the work in your context before any spawn. - Refused edits.
task-workerand the other writing agents report a refused edit as blocked. They do not retry it or route around it with Bash. - Decisions. The
/decidetrigger records a decision about a change only after you kept it.
Two settings help:
initallows the ledger scripts (changeset-write.mjs,backlog-log.mjs,decision-log.mjs), so ledger writes raise no prompt. It adds no other allow rules.- Switching to accept-edits mode removes the per-worker prompts.
Staying current
The version pinned in your lockfile is the version of record. The installed files follow it, and
nobody has to remember to run update.
- The
preparescript.initandupdateaddhouserules update --syncto thepreparescript in your rootpackage.json. An existingpreparescript keeps its command and gains&& houserules update --syncafter it. Every dependency install then syncs the payload, so a fresh clone, a new worktree, or a bumped pin has its files before any session starts. The script is skipped when@houserules/cliis not a dependency of the rootpackage.json, because the command would fail for any teammate without a global binary. update --sync. The unattended form ofupdate. It prints one line, always exits 0, and never overwrites a file you edited. It refuses--force. When it keeps an edited ignored file, its line ends with, run houserules doctor.- The SessionStart hook.
payload-syncis the backstop for installs thepreparescript did not cover. It compares the manifest with the installed CLI and plugin versions and checks for missing files. On a mismatch it runs the sync, then asks you to restart the session. Skills, rules, and agents written mid-session do not load until the next one. - After pulling a version bump. A teammate runs their usual dependency install, and
preparesyncs. If they skip it, the first session's hook syncs and asks for a restart. - A global CLI with no dependency. There is no
preparescript in this case. The hook runs thehouseruleson yourPATH, or prints the install hint when there is none. - Local edits. A generated file you edited is kept, and
doctorreports it asyours, the same as after a manualupdate.ejectis how you share one. If you edit an ejected file and houserules ships a newer version,doctorreportsyou edited it and houserules shipped a newer version since. It is ejected, so merge by hand. - Worktrees. A new
git worktreeis a fresh checkout without the ignored files, so it takes the fresh-clone path: dependency install, then the hook as the backstop.
doctor reports a missing prepare script, and doctor --fix restores it.
The daily version check
What it does. The payload-sync hook prints [houserules] kit <version> at every session
start. When the registry has a newer @houserules/cli or @houserules/* plugin than the one
installed, it adds one line naming the newer version and the upgrade command. A line for a given
version prints at most once a day. A global CLI gets a global upgrade command, and a dependency
gets one for the project's package manager.
What it sends. One GET per package to the registry in npm_config_registry, or to
registry.npmjs.org when that is unset. The request carries the package name and the client name
houserules. It carries nothing about you or the repo.
Where it caches. .claude/state/version-check.json, which is ignored by git. The hook checks
again only when that file is missing or a day old, so an offline machine tries once a day.
doctor reads the same cache and makes its own lookup only when the cache is missing or stale.
How to turn it off. Set "versionCheck": false in .claude/houserules.config.json, or set
NO_UPDATE_NOTIFIER in your environment. The check also skips itself in CI and when
NODE_ENV=test.
Ledgers: what is committed and what is generated
The backlog and decision modules keep an append-only ledger at
.claude/ledgers/<name>.jsonl. That file is the record and it is committed. The
BACKLOG.md and DECISIONS.md beside it are rendered from it and are gitignored, so a hand
edit does not survive the next write. Rebuild either any time:
node .claude/scripts/backlog-log.mjs render BACKLOG.mdA monorepo separates areas by filename in that one directory, studio.BACKLOG.md, rather than
by nesting a ledger beside each package. Point ledgers.dir in .claude/houserules.config.json
somewhere else if you prefer, though it cannot be the repo root: houserules self-ignores that
directory with *.md, and that rule at the root would hide every document in the project.
Smoke test the backlog ledger, if @houserules/plugin-backlog is installed:
node .claude/scripts/backlog-log.mjs add TEST BACKLOG.md "smoke" "remove me"
node .claude/scripts/backlog-log.mjs listChangesets are the canonical changelog
Shipped by @houserules/plugin-changesets. houserules treats
changesets as the source of truth
for "what shipped": one .changeset/*.md per meaningful change, CHANGELOG.md generated at
release time by changeset version. The module wires the agent side of that:
changeset-write.mjsis a non-interactive changeset author for agents. It validates package names against the actual workspace, then writes via the repo's own@changesets/write, the same writerchangeset adduses. The official library is required. If it isn't resolvable from the repo root, the script exits with install instructions instead of hand-rolling a file. Supports--emptyfor "no release needed".--absorbfolds one or more pending changesets into an amended one, merging every package bump at the highest level any of them named and deleting the absorbed files. Agents never hand-write.changeset/*.md./changesetskill +changeset-writeragent (haiku) inspect the diff, pick patch/minor/major (major always asks first), and record via the script./changeset condensefolds pending changesets that describe one feature into one entry. Everything in.changeset/ships in the same release, so a later changeset that supersedes, extends, or fixes an earlier one otherwise leaves a release note describing something no user ever saw.changeset-check.mjs(Stop hook) nudges once when package source changed with no changeset alongside it. It is branch-aware, so a changeset already committed on the branch counts. The kill-switch ischangesets.stopCheck: falseinhouserules.config.json, it exits silently on any git hiccup, and it exits 0 without running after a turn that used no file-writing tool.- Respects an existing setup. If
.changeset/config.jsonexists it is never touched. If absent, a default is seeded, only with your consent. houserules never installs@changesets/clifor you and prints the right command instead (pnpm-catalog-aware). Authoring does require it as a root devDependency: apnpx/npx-only root script covers versioning and publishing but leaves nothing resolvable for@changesets/write.
Want commit-granular history too? Enable the ledger module. It writes to
.claude/changelogs/<target>.md, never the CHANGELOG.md changesets owns.
Token spend and response style
Only the first of these three reduces token spend. The other two shape how the agent writes, which
is worth having and is not the same thing. output-prose and prose-voice are shipped by
@houserules/plugin-prose.
- Kit-native discipline (free, always): lean CLAUDE.md, grep-don't-read rules, haiku/low subagents, hooks that emit residue not transcripts.
output-prose(opt-in): shorter, denser replies via terse phrasing, at a readability cost. Adapted from caveman (MIT). It is a readability setting, not a cost one. It changes how the agent writes to you, not what it does, and it will not reduce your token bill: the words in a reply are a small part of what a session spends, and the style's own text is added to every request. Exact content, negations, and reported caveats are preserved. What to expect is in@houserules/plugin-prose's README. Activate with/config→ Output style → Prose, or set"outputStyle": "Prose"in.claude/settings.local.json. The value is the exact stylenamefrontmatter field, not theoutput-prosefilename, since this style's frontmatter sets aname:that differs from its slug. A switched output style takes effect from the next message. It also applies to the main thread only, since a subagent runs its own system prompt (a fork is the one exception, since it inherits the parent's).prose-voice(opt-in): a path-scoped rule that holds agent-authored prose to plain sentences, no semicolons, and no em dash where a period works. It shapes changesets, plans, docs, and the sentences inside code comments rather than chat responses, so it composes with any output style. It covers source files as well as markdown, which is what keeps one voice across the repo instead of two.
Writing a plugin
A plugin is a module provider. It contributes ModuleDefs, the same shape core and every
built-in module use, and nothing else: no lifecycle hooks, no way to transform another
module's actions, no path onto disk that isn't a declared action. houserules decides what those
actions mean against the real tree, so a plugin's plan shows up in --dry-run the same as a
built-in module's does. The contract itself now lives in @houserules/api, a standalone
package the CLI depends on rather than defines. See the PluginApi and Plugin TSDoc in
@houserules/api's src/index.ts for the full contract, including what happens when a plugin
throws. This package's own src/plugin.ts re-exports both, so @houserules/cli/plugin is
still the import path a plugin author uses.
Declaring one
A user installs your package as a dependency, then adds it to the plugins array in
.claude/houserules.config.json:
{
"plugins": [{ "name": "@houserules/plugin-prose", "alias": "prose" }],
"targets": []
}name is an npm package name or a repo-relative path to a directory holding a
package.json. alias namespaces every module id your plugin contributes: a module
declaring id prose-voice under alias prose is selected as prose/prose-voice, in
--modules and in moduleOptions keys alike. An optional config object is passed to your
factory verbatim, through PluginApi.config, and houserules never reads inside it.
Building it
Publish it as @houserules/plugin-<name>, with
"peerDependencies": 