Skip to content

Respecting agent hooks #102

Open
Open

Description

@slipset

In my project where I use Claude, we have some hooks. It doesn't seem like eco reads or honors these hooks.
I understand there's bound to be some conflicts between my Claude hooks and my eca hooks

Activity

  1. ericdallo commented on Nov 18, 2025

    @ericdallo
    Member

    @slipset can you give an example of what is not working?
    @zikajk is doing some improvements to hooks feature in editor-code-assistant/eca#201 to be as compatible with claude, but I wanna understand your case.

  2. slipset commented on Nov 18, 2025

    @slipset
    Author

    In our project, in .claude/settings.json we have the following:

    {
      "hooks": {
        "PostToolUse": [
          {
            "matcher": "Edit|MultiEdit|Write",
            "hooks": [
              {
                "type": "command",
                "command": "jq -r '.tool_input.file_path' | { read file_path; pnpm prettier --ignore-unknown --no-error-on-unmatched-pattern --write \"$file_path\"; }"
              },
              {
                "type": "command",
                "command": "jq -r '.tool_input.file_path' | { read file_path; if [[ \"$file_path\" =~ \\.(js|jsx|ts|tsx)$ ]]; then pnpm eslint --fix \"$file_path\" 2>/dev/null || true; fi; }"
              }
            ]
          }
        ]
      }
    }

    I see that this is not run when I use eca, because I'm getting prettier errors in CI :)

  3. ericdallo commented on Nov 18, 2025

    @ericdallo
    Member

    @slipset I'm not entirely sure what you bash does, but you can have access to the path the same way like this (ref):

        "hooks": {
            "lint": {
                "type": "postToolCall",
                "actions": [
                    {
                        "type": "shell",
                        "shell": "jq -r '.arguments.path' | { read path; pnpm prettier --ignore-unknown --no-error-on-unmatched-pattern --write \"$path\"; }"
                    },
                    {
                        "type": "shell",
                        "shell": "jq -r '.arguments.path' | { read path; if [[ \"$path\" =~ \\.(js|jsx|ts|tsx)$ ]]; then pnpm eslint --fix \"$path\" 2>/dev/null || true; fi; }"
                    }
                ]
            }
        }

    WDYT?

  4. slipset commented on Nov 18, 2025

    @slipset
    Author

    I guess, and I fully appreciate that it might be out of scope, that I'd expect the Claude I invoke through eca to pick up these hooks?

    I'd rather not have to replicate these settings for eca.

  5. ericdallo commented on Nov 18, 2025

    @ericdallo
    Member

    ah yes, the hooks are not fully compatible between eca and claude, but it should look similar tho.

  6. zikajk commented on Dec 3, 2025

    @zikajk
    Member

    @slipset I am going to write a documentation how to handle CC hooks. Yours are good example, stay tuned.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions