Skip to content
Agent Orchestration
Hook

Hooks

What autoresearch runs automatically, and when. A hook is a command Claude Code fires at a fixed moment, without you asking for it.

From plugin
autoresearch
3461 skill1 command4 hooks
Install
$ npx -y skills add drivelineresearch/autoresearch-claude-code --agent claude-code

Ships with autoresearch. Installing the plugin gets these hooks.

What fires, and when

Stop

  • "${CLAUDE_PLUGIN_ROOT}"/hooks/autoresearch-stop.sh

PreCompact

  • "${CLAUDE_PLUGIN_ROOT}"/hooks/autoresearch-precompact.sh

SessionStart

Fires once when a session begins, and again after a context compaction. It is where a plugin sets up its environment, or restores state the compaction dropped.

  • Matchesstartup|resume|compact"${CLAUDE_PLUGIN_ROOT}"/hooks/autoresearch-sessionstart.sh

UserPromptSubmit

Fires before Claude sees each prompt you send. A plugin can use it to inject context, so the same instruction reaches the model every turn instead of only at session start.

  • "${CLAUDE_PLUGIN_ROOT}"/hooks/autoresearch-context.sh
Read hooks/hooks.json

Where it lives

  • hooks/autoresearch-context.shRunsGitHub
    Read the script
    #!/usr/bin/env bash
    # Resolve manual-install symlinks and preserve stdin for the event payload.
    set -euo pipefail
    exec python3 -c 'import pathlib,runpy,sys; p=pathlib.Path(sys.argv[1]).resolve().parent.parent/"skills/autoresearch/scripts/ar_state.py"; sys.argv=[str(p),"hook","context"]; runpy.run_path(str(p),run_name="__main__")' "$0"
    
  • hooks/autoresearch-precompact.shRunsGitHub
    Read the script
    #!/usr/bin/env bash
    # Resolve manual-install symlinks and preserve stdin for the event payload.
    set -euo pipefail
    exec python3 -c 'import pathlib,runpy,sys; p=pathlib.Path(sys.argv[1]).resolve().parent.parent/"skills/autoresearch/scripts/ar_state.py"; sys.argv=[str(p),"hook","precompact"]; runpy.run_path(str(p),run_name="__main__")' "$0"
    
  • hooks/autoresearch-sessionstart.shRunsGitHub
    Read the script
    #!/usr/bin/env bash
    # Resolve manual-install symlinks and preserve stdin for the event payload.
    set -euo pipefail
    exec python3 -c 'import pathlib,runpy,sys; p=pathlib.Path(sys.argv[1]).resolve().parent.parent/"skills/autoresearch/scripts/ar_state.py"; sys.argv=[str(p),"hook","sessionstart"]; runpy.run_path(str(p),run_name="__main__")' "$0"
    
  • hooks/autoresearch-stop.shRunsGitHub
    Read the script
    #!/usr/bin/env bash
    # Resolve manual-install symlinks and preserve stdin for the event payload.
    set -euo pipefail
    exec python3 -c 'import pathlib,runpy,sys; p=pathlib.Path(sys.argv[1]).resolve().parent.parent/"skills/autoresearch/scripts/ar_state.py"; sys.argv=[str(p),"hook","stop"]; runpy.run_path(str(p),run_name="__main__")' "$0"
    

Read the script before you install anything that runs on your machine. This is the one part of a plugin that acts without being asked.

Ships withautoresearch

A measured experiment loop for Claude Code and Codex. Define a goal, a fixed benchmark, and files to modify. The agent tries changes, measures results, commits supported improvements, and records failed ideas within a budget. Inspired by pi-autoresearch.

Get the whole plugin
Stats
346
Stars
33
Forks
Maintained
Maintenance
Python
Language
MIT
License
1mo ago
Last commit
7mo ago
Created
3h ago
Added

Repo: drivelineresearch/autoresearch-claude-code