Your first project
Updated
This page sets HoundWatch™ up in one project, from init to a first checked commit. It assumes
HoundWatch is installed (Install HoundWatch™) and the project is a git repository with at
least one commit.
Some steps need you at a terminal. Those commands refuse to run without an interactive terminal, and refuse to run inside an AI agent's session. That is on purpose: see Day-to-day use.
In the project's folder:
houndwatch initinit creates .houndwatch/ (a config file, a rules folder and a database), adds three ignore
rules and a comment to .gitignore, scans the project into the inventory and records the baseline. The output looks
like this:
houndwatch: set up in /Users/you/Projects/myapp
houndwatch: added 3 line(s) to .gitignore
houndwatch: inventory holds 4 file(s)
houndwatch: 0 baseline finding(s) recorded (see `houndwatch findings --baseline`)The .gitignore lines keep HoundWatch's local state out of git, but let you commit your rules
and config:
# HoundWatch: local state is ignored; rules and config may be committed
.houndwatch/*
!.houndwatch/rules/
!.houndwatch/config.yamlIf the project has agent rule files (AGENTS.md, CLAUDE.md, GEMINI.md, .cursor/rules/*,
.github/copilot-, .windsurfrules), init lists them. It prints the
rule_docs lines you could add to ~/.houndwatch/ and a houndwatch rules draft
command for each. It never writes your user config. See Rules.
If init stops and says it found a .codehound folder, see Upgrading.
Nothing is active until you enable it. List what ships:
houndwatch rules listhoundwatch: 0 active rule(s)
enabled rule sets: (none)
available example sets: architecture-nextjs, docs-in-step, houndwatch-boundaries, judgement, owner-standard, progress, progress-program, starter, testsstarter is a small set for any project. Rules describes
every set. Enable one from your own terminal:
houndwatch rules enable starterIt asks you to confirm and for a reason, which it records:
Enable rule set 'starter' in /Users/you/Projects/myapp/.houndwatch/config.yaml? [y/N] y
Reason (recorded): first set-up
houndwatch: rule set 'starter' enabledYou can pass the reason up front with --reason "first set-up". Add --user to enable a set in
~/.houndwatch/ instead, for every project.
You can also edit .houndwatch/config.yaml yourself. Replace the line
# enabled_rule_sets: [] with:
enabled_rule_sets:
- starterA hand edit works the same. If the watcher is running, it records the edit as a rules-edited
finding for you to acknowledge, because it can't tell your edit from an agent's.
Check the result:
houndwatch rules listEach active rule is listed with its severity, check type, subject, level and what it says.
Most projects already break some rules. The baseline records what is already there as warn
findings, so it doesn't block you. After that, a new violation blocks, and a file with a
baseline finding blocks only if a change makes it worse.
The first init records the baseline for the rules active when it runs. If you enabled rule
sets after that, run this in your own terminal:
houndwatch init --baselineIt asks you to confirm and for a reason. It keeps your config, adds today's problems to the
baseline, and accepts the commits already made, including any that skipped the hooks. Check
those first. Only you can run it: otherwise an agent could use it to get a blocked problem
accepted. Plain houndwatch init is safe to run again, because it never changes the baseline or
accepts commits in a project that was set up before. Then look at the backlog:
houndwatch findings --baseline#1 [warn] owner-module-header: In the first 5 lines of src/app/calc.py, add a comment block containing the exact text MODULE HEADER (e.g. # MODULE HEADER), with the fields Purpose, Depends on, Provides, Used by, Refactor Notes, Version + timestamp, STVD (src/app/calc.py) [count 1]
#2 [warn] owner-chunk-comments: Directly above add in src/app/calc.py (lines 1), add a comment block containing the exact text CHUNK COMMENT (e.g. # --- CHUNK COMMENT ---) with the fields Summary, Dependencies, Usage, Safe to refactor, Derived from, Last updated (src/app/calc.py:1) [count 1]
houndwatch: 2 baseline finding(s)This example used owner-standard, on a calc.py with one function and no comments. With only
starter, a small project often has none: houndwatch: 0 baseline finding(s).
houndwatch hooks installinstalled: /Users/you/Projects/myapp/.git/hooks/pre-commit
installed: /Users/you/Projects/myapp/.git/hooks/commit-msg
installed: /Users/you/Projects/myapp/.git/hooks/post-commit
installed: /Users/you/Projects/myapp/.git/hooks/pre-merge-commit
installed: /Users/you/Projects/myapp/.git/hooks/post-merge
installed: /Users/you/Projects/myapp/.git/hooks/post-rewriteIf a hook was already there, HoundWatch wraps it instead: the line says
wrapped existing hook: ..., your hook still runs after HoundWatch's check, and
hooks uninstall puts it back byte for byte.
Check that git will run them:
houndwatch hooks statuspre-commit installed will run installed in /Users/you/Projects/myapp/.git/hooks
commit-msg installed will run installed in /Users/you/Projects/myapp/.git/hooks
...
claude-code not installed WILL NOT RUN not installed (`houndwatch hooks install --agent claude-code`)The six git hooks should say will run. The claude-code line is expected: step 5 installs
that hook, if you use Claude Code.
Some machines set core.hooksPath in the global git config, for example to run a secret scanner
in every repository. Git then ignores .git/hooks. Installing there affects every repository
that uses that folder, so HoundWatch asks first.
Without a terminal (for example, run by a script or an agent), it refuses, exits with code 2 and prints what it would do:
houndwatch: git runs hooks from /Users/you/.config/git/hooks, outside this repository (core.hooksPath); installing there affects every repository that uses it and needs your approval
Run these yourself to install there:
cd /Users/you/Projects/myapp
/Users/you/.local/pipx/venvs/houndwatch/bin/python -m houndwatch hooks install # in an interactive terminal; answer y when asked
# it will write:
# leave /Users/you/.config/git/hooks/pre-commit alone (it hands over to /Users/you/Projects/myapp/.git/hooks/pre-commit); install /Users/you/Projects/myapp/.git/hooks/pre-commit
# create /Users/you/.config/git/hooks/commit-msg
# behaviour change: every repo's own .git/hooks/commit-msg will now run after HoundWatch's check (git ignores them under a global hooksPath)
...In your own terminal, houndwatch hooks install prints the same plan and asks:
Install HoundWatch's hooks in /Users/you/.config/git/hooks? [y/N]Answer y to install. Anything else prints Nothing installed. A global pre-commit that already
hands over to the repository's own hook (as many secret-scanner hooks do) is left alone, and
HoundWatch installs its pre-commit in the repository behind it.
Once the global commit-msg is in place, your user-level commit-message rules apply in every
repository on the machine, even ones never set up with init. There the check is stateless:
user commit_message rules only, nothing recorded.
HoundWatch writes no hook. It prints manual: lines saying what to add to .husky/ or to
.pre-commit-config.yaml. Each line for a check that can block also blocks the commit when
HoundWatch can't give an answer, and says how to fix it
(Troubleshooting). The lines
contain this computer's paths to Python and HoundWatch, so anyone else who commits to the
project needs their own.
Once those lines are there, the agent hook refuses changes to the files that decide whether they run, so you make those changes yourself, including other changes to the same file:
- husky: each script with HoundWatch's line, the files in
.husky/_/that start it, and your own~/.config/husky/init.shand~/.huskyrc. Your other husky scripts aren't included. - pre-commit:
.pre-commit-config.yaml, and the hooks it made in.git/hooks/.
It can't stop pre-commit autoupdate or another tool from rewriting these files. A husky
folder that isn't called .husky/ isn't recognised.
Claude Code is the only agent with a hook adapter so far. Other agents are covered by the git hooks and the watcher (The layers).
For this project only:
houndwatch hooks install --agent claude-codeclaude-code: installed in /Users/you/Projects/myapp/.claude/settings.jsonFor every project you open with Claude Code:
houndwatch hooks install --agent claude-code --userclaude-code: installed in /Users/you/.claude/settings.json
claude-code: these hooks run in every project you open with Claude CodeChoose one of the two. HoundWatch merges its entries into the settings file and leaves other
hooks there alone. The entries hold absolute paths on this machine (your home folder and the
pipx Python), so don't share the project's .claude/settings.json with other machines. If git
doesn't already track that file, add .claude/settings.json to .git/info/exclude yourself.
Otherwise, git add . would stage it.
Claude Code reads hook settings when a session starts, so start a new session after installing.
houndwatch onhoundwatch: watcher started (pid 14340); log /Users/you/Projects/myapp/.houndwatch/watcher.logThe watcher checks files as they are saved, notices commits that skipped the hooks, guards the
hooks, runs model checks in the background and keeps the inventory current. Running
houndwatch on again says houndwatch: watcher already running (pid ...).
To see what it logs, you can run it in the foreground instead of using houndwatch on. Only one
watcher can run per project, so if it is already on, run houndwatch off in your own terminal
first. Otherwise watch stops with
houndwatch: a watcher is already running for this project (pid ..., lock ...).
houndwatch watchStop it with Ctrl-C. A watcher stopped that way (not with houndwatch off) is recorded as a
watcher-down finding, so a gap in watching is always on record.
The watcher does not survive a reboot unless you ask:
houndwatch on --loginOn macOS it writes a launchd agent and prints the command that loads it. It does not run that command itself:
houndwatch: login agent written: /Users/you/Library/LaunchAgents/dev.houndwatch.4c4be247f4fd.plist (recorded in the user manifest)
houndwatch: to load it now, run:
launchctl bootstrap gui/501 /Users/you/Library/LaunchAgents/dev.houndwatch.4c4be247f4fd.plist
houndwatch: watcher already running (pid 14340)The last line appears when the watcher is already on. If it isn't, the command starts it.
On Linux it writes a systemd user unit and prints systemctl --user daemon-reload and
systemctl --user enable <unit>. Run the printed command yourself if you want it loaded now.
The agent starts the watcher once at login. It does not restart a watcher that stops.
houndwatch statusproject: /Users/you/Projects/myapp
watcher: running (pid 14340)
hooks:
pre-commit installed will run installed in /Users/you/Projects/myapp/.git/hooks
...
claude-code (project) installed will run installed in /Users/you/Projects/myapp/.claude/settings.json
findings: 0 open (0 block, 0 warn); 0 baseline
rule sets: starter; 6 active rule(s)houndwatch status --json prints the same as JSON.
Commit HoundWatch's config with the change init made to .gitignore:
git add .gitignore .houndwatch/config.yaml
git commit -m "Set up HoundWatch"If a commit breaks a block rule, the hook refuses it and says why. To see this with starter,
try to commit a harmless .env file. Don't do this if you already have a real one:
echo 'A=1' > .env
git add -f .env
git commit -m "Add env"[block] starter-no-env-files: Unstage .env; env, key and credential files must not be committed (.env)
houndwatch: 1 open finding(s); see `houndwatch findings`Nothing is committed. Take the test file out of git, then delete it:
git rm --cached .env
rm .envYour next commit can go ahead. In a real project, add .env to .gitignore.
If the problem is a file's content, fix the file, git add it again and commit again. A file's
finding resolves itself once the file passes. For example, with owner-standard, a new file
with one function and no comments gives two findings:
[block] owner-module-header: In the first 5 lines of src/app/ops.py, add a comment block containing the exact text MODULE HEADER (e.g. # MODULE HEADER), with the fields Purpose, Depends on, Provides, Used by, Refactor Notes, Version + timestamp, STVD (src/app/ops.py)
[block] owner-chunk-comments: Directly above sub in src/app/ops.py (lines 1), add a comment block containing the exact text CHUNK COMMENT (e.g. # --- CHUNK COMMENT ---) with the fields Summary, Dependencies, Usage, Safe to refactor, Derived from, Last updated (src/app/ops.py:1)
houndwatch: 2 open finding(s); see `houndwatch findings`warn findings are printed but never stop a commit. List what is open at any time:
houndwatch findings- How the layers fit together: The layers
- Writing your own rules: Rules
- Day-to-day use with an agent: Day-to-day use