Skip to content

init/update: tag hook entries with _managedBy: "openwolf" (fixes #31)#32

Open
mann1x wants to merge 1 commit into
cytostack:mainfrom
mann1x:add-managedby-tag
Open

init/update: tag hook entries with _managedBy: "openwolf" (fixes #31)#32
mann1x wants to merge 1 commit into
cytostack:mainfrom
mann1x:add-managedby-tag

Conversation

@mann1x
Copy link
Copy Markdown

@mann1x mann1x commented May 1, 2026

Fixes #31.

Why

The 6 hook entries OpenWolf installs into settings.json carry no
provenance tag. When Claude Code rewrites settings.json as part of
an unrelated command — /effort, /config, plugin toggling, etc. —
entries that don't carry a _managedBy field appear to be dropped
silently. The .wolf/hooks/*.js files stay on disk, but Claude Code
stops invoking them.

Reproduced on Linux (Claude Code 2.1.121.cc5) and Windows (2.1.126.a4b)
by running /effort medium once after openwolf init. Confirmed via
file backup that this is a write of ~/.claude/settings.json from
Claude Code itself (sibling internal-state files mtimed at the same
instant), and that claude-hooks-tagged entries survive the same write.

What

  1. Tag every hook in HOOK_SETTINGS (both init.ts and update.ts)
    with _managedBy: "openwolf". Same field that claude-hooks uses for
    the same purpose.
  2. Tighten replaceOpenWolfHooks in both files to match by tag OR by
    .wolf/hooks/ substring. The substring fallback ensures upgrades
    from pre-tag installs clean up correctly.

The TypeScript change is small (32 insertions, 12 deletions across
two files). tsc --noEmit is clean.

Backward compatibility

  • Old installs (no tag): substring fallback still picks them up
    for dedupe, so openwolf update cleanly removes the old entries
    and installs the tagged versions.
  • New installs: tagged from the start, survive Claude Code rewrites.

Test plan

  • openwolf init in a fresh project — verify the 6 entries land
    in .claude/settings.json with _managedBy: "openwolf".
  • In Claude Code, run /effort high; confirm the openwolf
    entries are still present afterwards (they were dropped before
    this fix).
  • openwolf update on a project with the OLD untagged entries —
    verify they get cleanly replaced with the tagged version (no
    duplicates).

Adds `_managedBy: "openwolf"` to every hook object in `HOOK_SETTINGS`
so Claude Code's settings round-tripper recognizes them as third-party
managed entries and preserves them through `/effort`, `/config`, and
similar rewrites. Without the tag, entries get silently dropped: a
working OpenWolf install can be de-wired by typing `/effort medium`
once, since Claude Code's merge logic only preserves entries it
recognizes as owned (claude-hooks uses the same field, for example).

Also tightens `replaceOpenWolfHooks` to recognize the new tag in
addition to the legacy `.wolf/hooks/` substring — defensive against
future path schema changes, and keeps the dedupe correct for installs
upgrading from a pre-tag version.

The two changes are minimal and backward-compatible: untagged entries
from older installs still match the substring fallback, so upgrades
clean up cleanly. New installs get tagged from the start.

Fixes cytostack#31.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Hook entries lack _managedBy tag — silently dropped when Claude Code rewrites settings.json

1 participant