Skip to content

self-improving-agent: PostToolUse hook path is cwd-relative — error-capture never runs #924

Description

@acdigitalclarity

Affected file: engineering-team/self-improving-agent/hooks/hooks.json

Observed behaviour: every Bash tool call in any Claude Code session whose working directory is not the plugin root emits:

/bin/sh: ./hooks/error-capture.sh: No such file or directory

The error-capture feature therefore never executes (its whole purpose — learning from failed commands — silently doesn't happen), and every session's tool output is spammed with the failure line.

Root cause: hooks.json registers the PostToolUse hook with a cwd-relative path:

"command": "./hooks/error-capture.sh"

Hook commands run from the session's cwd, not the plugin directory, so the relative path can never resolve in normal use.

Fix (one line):

"command": "\"${CLAUDE_PLUGIN_ROOT}/hooks/error-capture.sh\""

${CLAUDE_PLUGIN_ROOT} is the documented variable for plugin hook paths; quoting handles plugin roots containing spaces. Verified working locally with exactly this change.

Secondary: the same relative-path pattern appears in the plugin's settings.json install example ("hooks/error-capture.sh") and in the script's own header comment (./skills/self-improving-agent/hooks/error-capture.sh) — worth updating for consistency.

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