Skip to content

feat(agents): prompt hooks, MCP instructions and native Claude Code install - #754

Merged
ajianaz merged 6 commits into
developfrom
feat/agent-hooks
Nov 16, 2026
Merged

ajianaz merged 6 commits into
developfrom
feat/agent-hooks

Conversation

@ajianaz

@ajianaz ajianaz commented Nov 16, 2026

Copy link
Copy Markdown
Collaborator

What

  • cora hook context reads an agent's prompt (Claude Code / Hermes hook JSON on stdin, or --prompt), searches the project's index (keyword + meaning + call graph) and prints a short block of matching symbols plus the cora tools to use. It never downloads the model, is time-boxed, stays silent for chit-chat and unindexed projects, and always exits 0.
  • cora hook session prints a one-line reminder at session start.
  • The MCP server now sends instructions saying when to use each tool.
  • cora install sets up Claude Code natively: UserPromptSubmit and SessionStart hooks merged into ~/.claude/settings.json, MCP registration with alwaysLoad, the cora-code skill and a managed block in ~/.claude/CLAUDE.md. Idempotent, --dry-run, --remove, --no-instructions; a settings file that is not JSON is never overwritten.
  • Integration framework in src/commands/agents/ for the other agents, plus the research notes in docs/design/agent-integration-research.md.

Why

Agents only use code search when the model remembers a tool exists. Injecting results at prompt time, and telling the model how to use the tools, makes the index used by default. Refs #753 (Hermes, pi/omp and opencode follow in separate PRs).

Testing

  • cargo fmt --all -- --check, cargo clippy --all-targets --features tree-sitter -- -D warnings, cargo test --features tree-sitter pass locally.
  • New unit tests for hook merge/remove, managed blocks, backups and dry runs; tests/hook_context.rs runs the real binary with the tiny fixture model (code question, chit-chat, unindexed project, garbage stdin, Hermes envelope, --prompt).
  • Not yet verified: a live Claude Code session calling the hook (needs the agent installed).

Generated by Claude Code

…nstall

cora hook context/session inject code-search results into agent prompts.
cora install now sets up Claude Code natively (hooks, MCP alwaysLoad,
cora-code skill, CLAUDE.md block). The MCP server sends instructions.

Refs #753.
…ess MCP permissions

Verified against Claude Code 2.1.325: both hooks run and inject context, and
the model calls the alwaysLoad MCP tool directly.

Refs #753.
…ttings.json

Indexing a serde_json Value mutably inserts null for a missing key; use
get_mut. Found by Cora Review on the pull request.

Refs #753.
Only a missing file counts as empty; permission, encoding and I/O errors
stop the install before it can overwrite the user's settings or instruction
file. Found by Cora Review on the pull request.

Refs #753.
…instead of panicking

Found by Cora Review on the pull request.

Refs #753.
@ajianaz
ajianaz merged commit 2ebd334 into develop Nov 16, 2026
13 checks passed
@ajianaz
ajianaz deleted the feat/agent-hooks branch November 17, 2026 00:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant