Native memory tools + MCP server + distill agent improvements

Tools:
- Add native memory_render, memory_write, memory_search,
  memory_links, memory_link_set, memory_link_add, memory_used
  tools to poc-agent (tools/memory.rs)
- Add MCP server (~/bin/memory-mcp.py) exposing same tools
  for Claude Code sessions
- Wire memory tools into poc-agent dispatch and definitions
- poc-memory daemon agents now use memory_* tools instead of
  bash poc-memory commands — no shell quoting issues

Distill agent:
- Rewrite distill.agent prompt: "agent of PoC's subconscious"
  framing, focus on synthesis and creativity over bookkeeping
- Add {{neighborhood}} placeholder: full seed node content +
  all neighbors with content + cross-links between neighbors
- Remove content truncation in prompt builder — agents need
  full content for quality work
- Remove bag-of-words similarity suggestions — agents have
  tools, let them explore the graph themselves
- Add api_reasoning config option (default: "high")
- link-set now deduplicates — collapses duplicate links
- Full tool call args in debug logs (was truncated to 80 chars)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Kent Overstreet 2026-03-19 22:58:54 -04:00
parent d9b56a02c3
commit 6d22f70192
8 changed files with 290 additions and 87 deletions

View file

@ -38,15 +38,16 @@ pub async fn call_api_with_tools(
// Set up a minimal UI channel (we just collect messages, no TUI)
let (ui_tx, _ui_rx) = poc_agent::ui_channel::channel();
// Build tool definitions — just bash for poc-memory commands
// Build tool definitions — memory tools for graph operations
let all_defs = tools::definitions();
let tool_defs: Vec<ToolDef> = all_defs.into_iter()
.filter(|d| d.function.name == "bash")
.filter(|d| d.function.name.starts_with("memory_"))
.collect();
let tracker = ProcessTracker::new();
// Start with the prompt as a user message
let mut messages = vec![Message::user(prompt)];
let reasoning = crate::config::get().api_reasoning.clone();
let max_turns = 50;
for turn in 0..max_turns {
@ -57,7 +58,7 @@ pub async fn call_api_with_tools(
Some(&tool_defs),
&ui_tx,
StreamTarget::Autonomous,
"none",
&reasoning,
).await.map_err(|e| format!("API error: {}", e))?;
if let Some(u) = &usage {
@ -76,7 +77,7 @@ pub async fn call_api_with_tools(
for call in msg.tool_calls.as_ref().unwrap() {
log(&format!("tool: {}({})",
call.function.name,
crate::util::first_n_chars(&call.function.arguments, 80)));
&call.function.arguments));
let args: serde_json::Value = serde_json::from_str(&call.function.arguments)
.unwrap_or_default();