Skip to content

Commit 20ae926

Browse files
authored
feat: add graph-aware recall, auto-linking, and multi-tool hooks (#91)
- Auto-link memories by embedding similarity (>0.75 cosine) with bidirectional backrefs at store time (auto_link.rs) - Graph-aware recall: expand results 1-hop via related_ids with 0.5× score discount - Add hooks support for Gemini CLI (SessionStart, BeforeTool, AfterTool, PreCompress, BeforeAgent) in ~/.gemini/settings.json - Add hooks support for Codex CLI (SessionStart, PreToolUse, PostToolUse, UserPromptSubmit) in ~/.codex/hooks.json - Add hooks + MCP support for Copilot CLI (~/.copilot/mcp-config.json + .github/hooks/icm.json) - Adapt hook handlers for cross-tool field names (run_shell_command, prompt, input) - Rename inject_claude_hook → inject_settings_hook (generic) - expand_with_neighbors() in store for graph traversal
1 parent 6b8f1a5 commit 20ae926

File tree

8 files changed

+1222
-35
lines changed

8 files changed

+1222
-35
lines changed

.github/hooks/icm.json

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"version": 1,
3+
"hooks": {
4+
"sessionStart": [
5+
{
6+
"type": "command",
7+
"bash": "/Users/patrick/dev/rtk-ai/icm/target/release/icm hook start",
8+
"timeoutSec": 10
9+
}
10+
],
11+
"preToolUse": [
12+
{
13+
"type": "command",
14+
"bash": "/Users/patrick/dev/rtk-ai/icm/target/release/icm hook pre",
15+
"timeoutSec": 5
16+
}
17+
],
18+
"postToolUse": [
19+
{
20+
"type": "command",
21+
"bash": "/Users/patrick/dev/rtk-ai/icm/target/release/icm hook post",
22+
"timeoutSec": 10
23+
}
24+
],
25+
"userPromptSubmitted": [
26+
{
27+
"type": "command",
28+
"bash": "/Users/patrick/dev/rtk-ai/icm/target/release/icm hook prompt",
29+
"timeoutSec": 10
30+
}
31+
]
32+
}
33+
}

AGENTS.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<!-- icm:start -->
2+
## Persistent memory (ICM) — MANDATORY
3+
4+
This project uses [ICM](https://github.com/rtk-ai/icm) for persistent memory across sessions.
5+
You MUST use it actively. Not optional.
6+
7+
### Recall (before starting work)
8+
```bash
9+
icm recall "query" # search memories
10+
icm recall "query" -t "topic-name" # filter by topic
11+
icm recall-context "query" --limit 5 # formatted for prompt injection
12+
```
13+
14+
### Store — MANDATORY triggers
15+
You MUST call `icm store` when ANY of the following happens:
16+
1. **Error resolved**`icm store -t errors-resolved -c "description" -i high -k "keyword1,keyword2"`
17+
2. **Architecture/design decision**`icm store -t decisions-{project} -c "description" -i high`
18+
3. **User preference discovered**`icm store -t preferences -c "description" -i critical`
19+
4. **Significant task completed**`icm store -t context-{project} -c "summary of work done" -i high`
20+
5. **Conversation exceeds ~20 tool calls without a store** → store a progress summary
21+
22+
Do this BEFORE responding to the user. Not after. Not later. Immediately.
23+
24+
Do NOT store: trivial details, info already in CLAUDE.md, ephemeral state (build logs, git status).
25+
26+
### Other commands
27+
```bash
28+
icm update <id> -c "updated content" # edit memory in-place
29+
icm health # topic hygiene audit
30+
icm topics # list all topics
31+
```
32+
<!-- icm:end -->

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)