Hooks
What autoresearch runs automatically, and when. A hook is a command Claude Code fires at a fixed moment, without you asking for it.
$ npx -y skills add drivelineresearch/autoresearch-claude-code --agent claude-codeShips 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.
- Matches
startup|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
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.
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.

