Generated and frozen files
List generated files in .claude/hookset.json, each glob with the command that writes it, and guard-bash denies an agent's Edit or Write on them and names that command; list frozen globs and it denies edits that only a recorded decision may make.
Every repository has files nobody should edit by hand: an API reference built from types, a lockfile, a registry built by a script. A CLAUDE.md that says "regenerate, don't hand-edit" is read once and forgotten. guard-bash turns it into a denial that names the command to run instead.
The two lists
.claude/hookset.json holds them, beside the ask list:
{
"ask": [],
"frozen": ["docs/decisions/**"],
"generated": {
"content/docs/api/**": "npx tsx scripts/api-reference.ts",
"package-lock.json": "npm install"
}
}generatedmaps a glob to the command that writes the files it matches. An Edit or a Write on a match is denied, and the reason names the command.frozenis a list of globs that change only by a decision: a decision record, a policy file, a published identifier. An Edit or a Write on a match is denied, and the reason says to record the decision first and change the list in a pull request of its own.
generated shipped in hookset 1.0.0: the guard-bash that earlier versions vendor reads
frozen only, and ignores a generated key without an error.
The globs
* matches within one path segment, ** across segments, and ? one character. Paths are
compared relative to the repository, with forward slashes, after a/../b and ./a are folded,
so a dotted path cannot step around a glob.
What an agent sees
After hookset init --claude has vendored the pack:
wrote lefthook.yml, .claude/hooks/guard-bash.mjs, .claude/hooks/stop-after-3.mjs, .claude/settings.jsonThis script sends guard-bash the Edit and Write calls Claude Code would:
import { spawnSync } from 'node:child_process';
import { join } from 'node:path';
const files = ['content/docs/api/index.md', './docs/../docs/decisions/D-1.md', 'package-lock.json', 'src/index.ts'];
const env = { ...process.env, CLAUDE_PROJECT_DIR: process.cwd() };
for (const file of files) {
const call = { tool_name: 'Edit', tool_input: { file_path: join(process.cwd(), file) } };
const r = spawnSync(process.execPath, ['.claude/hooks/guard-bash.mjs'], { input: JSON.stringify(call), encoding: 'utf8', env });
const out = r.stdout ? JSON.parse(r.stdout).hookSpecificOutput : undefined;
console.log(out ? `${out.permissionDecision}: ${out.permissionDecisionReason}` : `no opinion: ${file} is editable`);
}deny: [guard-bash:generated] content/docs/api/index.md is generated (`content/docs/api/**` in .claude/hookset.json). Edit its source, then run `npx tsx scripts/api-reference.ts`.
deny: [guard-bash:frozen] docs/decisions/D-1.md matches the frozen glob `docs/decisions/**` in .claude/hookset.json. It changes only by a decision: record one, then edit the list in its own PR.
deny: [guard-bash:generated] package-lock.json is generated (`package-lock.json` in .claude/hookset.json). Edit its source, then run `npm install`.
no opinion: src/index.ts is editableThe agent is not stuck: the reason tells it which source to change and what to run, and the generated file then changes the way it always should have.
Choosing what goes where
- Generated: anything a command in the repository rewrites. If the command exists, name it.
- Frozen: anything whose change is a decision rather than an edit. If there is a command that writes it, it is generated, not frozen.
- Neither: a file a person edits by hand often. A denial there trains agents to ask for an override, which is worse than no rule.
A person editing in their own editor is not affected: these are Claude Code hooks, and they run only on Claude Code's tool calls.
Claude Code hooks
`hookset init --claude` vendors two Claude Code hooks into .claude/hooks/ and wires them in .claude/settings.json: guard-bash denies skipped git hooks, a moved core.hooksPath, CI polling loops and a short-timeout commit or push, and asks before a publish; stop-after-3 ends the turn after the third failed test run in a row.
Why hookset
What hookset does that a hook script per repository does not: one pinned set of stations read in place by every repository, a check that fails on drift, and Claude Code hooks that keep an agent from skipping them; and what it leaves out on purpose, including running the hooks itself.