Skip to content

installer re-registers the unconditional codedb-block-legacy.sh hook, overriding user removal #658

Description

@edouard-andrei

The installer writes codedb-block-legacy.sh into ~/.claude/hooks/ and merges it into ~/.claude/settings.json PreToolUse on every run (install/install.sh, the merge_hook("PreToolUse", ...) call around L299).

Problems:

  • The hook hard-blocks (exit 2) grep/rg/cat/head/tail/sed/awk/find unconditionally whenever the codedb binary exists — including outside git repos and on files codedb has never indexed.
  • It fires before Claude Code's permission evaluation, so it overrides the user's own permissions.allow.
  • Removing the settings entry does not stick — any reinstall/update run silently re-adds it. Removed it three times now.

Suggestions (either would fix it):

  • Scope the hook: only block when the cwd's repo toplevel is actually codedb-indexed (~/.codedb/projects/*/project.txt) and every path argument resolves inside that repo. I run a scoped variant locally and it works well — happy to PR it.
  • And/or respect an opt-out: skip the hook merge when e.g. CODEDB_NO_HOOKS=1, or do not re-add an entry the user has removed.

Related: #344 documented the hook setup, but the unconditional blocking + re-registration behavior is not covered there.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions