Skip to content

Hooks

CLI

Hooks are how Archcore injects project context into an agent session before you type anything. One hook, one event: session start.

At session start, the agent invokes:

Terminal window
archcore hooks <agent-id> session-start

Archcore responds with:

  • An index of every document in .archcore/ — path, type, title, status.
  • A summary of relations (which documents reference which).
  • Any drift signals detected since the last run.

This output goes straight into the agent’s working context, so the agent already “knows” about your ADRs, rules, guides, and plans on turn one.

Hooks are installed automatically during archcore init. To install them manually for all detected agents:

Terminal window
archcore hooks install

Or for a single agent:

Terminal window
archcore hooks install --agent claude-code

Four agents support hooks today:

AgentHook file
Claude Code.claude/settings.json
Cursor.cursor/settings.json
GitHub Copilot.vscode/settings.json
Gemini CLI.gemini/settings.json

OpenCode, Codex CLI, Roo Code, and Cline do not support session hooks yet. You can still use MCP with them — just ask the agent to list documents when you want context.

{
"hooks": {
"SessionStart": [
{
"matcher": "",
"hooks": [
{
"type": "command",
"command": "archcore hooks claude-code session-start"
}
]
}
]
}
}

Installed automatically by archcore init and archcore hooks install.

Useful for debugging:

Terminal window
archcore hooks claude-code session-start

The output is the same as what the agent sees at session start.

  • You always start conversations by asking the agent to list documents.
  • Your agent doesn’t support hooks (MCP alone still works).
  • You want explicit control over when context gets loaded.