Repository navigation
Reference CLI
Start the HTTP server:
claudegqlConfiguration is via environment variables. Prints the listening addresses on startup:
server: http://localhost:8765/graphql
playground: http://localhost:8765/playground
hook: POST http://localhost:8765/hook
docs: http://localhost:8765/docs
Read hook JSON from stdin and forward to the server:
claudegql recordThis is the command Claude Code calls for each hook event. It silently exits on any error (network failure, server not running, etc.) so it never blocks Claude Code.
Run a GraphQL query against the local server/store and print JSON:
claudegql query '{ sessions(limit:5) { id status cwd model lastSeenAt } }'Useful session-intelligence examples:
# Skills actually used by recent sessions
claudegql query '{ sessions(limit:10) { id skillsUsed { name count } } }'
# Subagents spawned and their assignments
claudegql query '{ sessions(limit:5) { id subagents { agentType description } } }'
# Edited files and user prompts
claudegql query '{ sessions(limit:5) { id editedFiles prompts } }'
# Search captured prompts, tool inputs, and tool outputs
claudegql query '{ search(query:"webhook", limit:5) { matchField snippet hook { sessionId toolName recordedAt } } }'Print the compact GraphQL schema:
claudegql schemaThe schema output omits descriptions and is designed for quick terminal inspection or pasting into an LLM context before asking it to design queries.
Write hook configuration into ~/.claude/settings.json:
claudegql install-hooksWith a custom binary path (useful after moving the binary):
claudegql install-hooks --binary /path/to/claudegqlRegisters hooks for: PreToolUse, PostToolUse, Stop, SubagentStop, Notification, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, PostCompact.
Running it again is safe — already-registered hooks are skipped.
| Target | Description |
|---|---|
make build |
Build bin/claudegql
|
make run |
Build + run in foreground |
make run-bg |
Build + run in background (logs → claudegql.log) |
make stop |
Kill the server on port 8765 |
make install-hooks |
Build + register hooks in ~/.claude/settings.json
|
make generate |
Regenerate gqlgen code after schema changes |
make record-test |
Send a test hook event to the running server |