Repository navigation
Description
Summary
sequant sync copies templates/settings.json over a project's
.claude/settings.json wholesale. Any hook matcher group the project added
is deleted — silently, with no warning and no error. A deleted hook is
indistinguishable from a hook with nothing to say, so the loss is invisible in
normal use.
This has now happened twice to the same guard in the same downstream project,
five days apart:
| Date | Sync | What was deleted |
|---|---|---|
| 2026-09-12 | 2.10.0 → 2.15.0 | the guard's logic, inlined in pre-tool.sh (827 → 1612 lines) |
| 2026-09-15 | 2.15.0 → 2.15.1 | the guard's registration in .claude/settings.json |
Why the documented mitigation doesn't work
After the first loss, the downstream fix was to move the project's hook out of
the vendored pre-tool.sh and register it as its own matcher group in
.claude/settings.json, on the stated understanding that a sync only rewrites
the vendored hook scripts. That understanding is wrong:
$ diff templates/settings.json <(git -C <project> show <sync-commit>:.claude/settings.json)
$ echo $?
0The post-sync project file is byte-identical to the template. The file is
replaced, not merged, so no placement inside .claude/settings.json survives
a sync. Sequant's own docs point users toward .claude/.local/ for overrides,
but that mechanism covers skills only — there is no hook extension point.
Impact
Downstream projects lose safety hooks with no signal. In this case the guard
that asks for confirmation before a commit lands on main was inactive for
some period after each sync. The only thing that caught either loss was a
project-authored integration test asserting the registration exists — the diff
review did not, because "a JSON file changed after a version bump" reads as
expected.
Repro
- In a sequant-initialized project, add a second
PreToolUsematcher group to
.claude/settings.jsonpointing at a project-owned hook script. - Run any
npx sequantcommand that triggers a sync. git diff .claude/settings.json— the added group is gone. Exit status 0,
no warning printed.
Suggested direction
Merge rather than overwrite. Some options, roughly in order of preference:
- Merge hook arrays by command path. Ensure sequant's own entries are
present; leave every other matcher group untouched. This is the behavior the
file's structure already implies. - Provide a real hook extension point — e.g.
.claude/hooks/project/is
auto-registered, or.claude/.local/settings.jsonis merged in — so projects
have a location that is theirs by contract rather than by luck. - At minimum, refuse to clobber silently. If the project's
.claude/settings.jsoncontains entries the template doesn't, print them and
require--force. A loud failure is recoverable; this one wasn't.
Acceptance criteria
- A sync against a project with an extra
PreToolUsematcher group leaves
that group intact. - Sequant's own hook entries are still guaranteed present after the sync.
- A test covers the extra-group case specifically (the existing
settings-template tests all assert on a pristine project). - If a merge is not feasible for some field, the sync reports what it is
about to discard instead of discarding it silently.
Context
Both occurrences were observed in the same downstream project, tracked
privately. Happy to supply further detail on request.
Activity
admarble commentedon Sep 17, 2026
Closing — this was filed on a wrong premise, and
docs/guides/customization.md:167already answers it:The issue claimed there is no hook extension point. There is one, it is documented, and #711 has a test enforcing it. The project that hit this had registered its hook in the package-managed
.claude/settings.jsoninstead, so the overwrite atsrc/lib/templates.ts:828was doing exactly what it is designed to do.The one thing possibly worth keeping:
.claude/settings.jsonis Claude Code's canonical user-editable path, so a user can reasonably assume it is theirs to edit, and the overwrite carries no warning and leaves no marker in the file. That is a docs/UX papercut rather than the data-loss bug described here. Happy to open a narrower issue for it if that seems useful — not reopening this one.fix(#1090): one ownership rule for project files across init, sync an…
test(#1097): writer state-matrix — init/sync/update × every destinati…