Skip to content

Solution for long term memory for agent coding CLIs and to facilitate handoff between different agent vendors

Rust

Update routing snippet refresh guidance

Thiago Silva69ec6c3b6182
diff --git a/crates/ai-memory-core/src/routing_snippet.rs b/crates/ai-memory-core/src/routing_snippet.rs
index e830fb9f..f76f464c 100644
--- a/crates/ai-memory-core/src/routing_snippet.rs
+++ b/crates/ai-memory-core/src/routing_snippet.rs
@@ -9,9 +9,9 @@
//! - `ai-memory-cli`'s `install-instructions` subcommand — writes the
//! block into `./CLAUDE.md` directly from the host.
//! - `ai-memory-mcp`'s `memory_install_self_routing` MCP tool — returns
-//! the block to the agent, which then uses its own Write/Edit tool
-//! to land it in the target file (the MCP server can't reach the
-//! agent's host filesystem).
+//! the block plus managed skill files to the agent, which then uses its
+//! own Write/Edit tool to update the target file and skill root (the MCP
+//! server can't reach the agent's host filesystem).
//!
//! Keeping the snippet in one constant means "what gets written" stays
//! consistent across both paths; updating it once propagates.
@@ -69,8 +69,11 @@ latest binary's recommended copy:
- **From the agent** (no terminal needed): ask "refresh the ai-memory
routing in this project". The agent calls `memory_install_self_routing`,
picks the right filename for itself (Claude Code -> `CLAUDE.md`; Codex /
- OpenCode / Cursor / Gemini -> `AGENTS.md`), and uses its Write / Edit
- tool to land the block.
+ OpenCode / Cursor / Gemini -> `AGENTS.md`), uses its Write / Edit tool
+ to replace or append the returned `markered_block` while preserving
+ non-ai-memory user content, then writes or updates each returned
+ `managed_skills` item under the selected skill root from `target_hints`
+ using its `relative_path`.
- **From the CLI**: `ai-memory install-instructions` (defaults to
`CLAUDE.md`; pass `--target AGENTS.md` for non-Claude agents or projects
that use `AGENTS.md` as the canonical instruction file).
diff --git a/crates/ai-memory-mcp/src/server.rs b/crates/ai-memory-mcp/src/server.rs
index 71e4d3ed..703c3801 100644
--- a/crates/ai-memory-mcp/src/server.rs
+++ b/crates/ai-memory-mcp/src/server.rs
@@ -2616,6 +2616,16 @@ mod tests {
&& snippet.contains("ai-memory install-instructions"),
"snippet must preserve refresh/install guidance"
);
+ let refresh_guidance = snippet
+ .split("### Refreshing this snippet")
+ .nth(1)
+ .expect("snippet must keep refresh guidance");
+ assert!(
+ refresh_guidance.contains("managed_skills")
+ && refresh_guidance.contains("target_hints")
+ && refresh_guidance.contains("relative_path"),
+ "snippet must tell agents to refresh managed skill files"
+ );
assert!(
snippet.contains(ai_memory_core::MARKER_START)
&& snippet.contains(ai_memory_core::MARKER_END),