Move poc-agent into workspace, improve agent prompts
Move poc-agent (substrate-independent AI agent framework) into the memory workspace as a step toward using its API client for direct LLM calls instead of shelling out to claude CLI. Agent prompt improvements: - distill: rewrite from hub-focused to knowledge-flow-focused. Now walks upward from seed nodes to find and refine topic nodes, instead of only maintaining high-degree hubs. - distill: remove "don't touch journal entries" restriction - memory-instructions-core: add "Make it alive" section — write with creativity and emotional texture, not spreadsheet summaries - memory-instructions-core: add "Show your reasoning" section — agents must explain decisions, especially when they do nothing - linker: already had emotional texture guidance (kept as-is) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
0a62832fe3
commit
57fcfb472a
89 changed files with 16389 additions and 51 deletions
47
poc-agent/src/tools/write.rs
Normal file
47
poc-agent/src/tools/write.rs
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
// tools/write.rs — Write file contents
|
||||
|
||||
use anyhow::{Context, Result};
|
||||
use serde_json::json;
|
||||
use std::path::Path;
|
||||
|
||||
use crate::types::ToolDef;
|
||||
|
||||
pub fn definition() -> ToolDef {
|
||||
ToolDef::new(
|
||||
"write_file",
|
||||
"Write content to a file. Creates the file if it doesn't exist, \
|
||||
overwrites if it does. Creates parent directories as needed.",
|
||||
json!({
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"file_path": {
|
||||
"type": "string",
|
||||
"description": "Absolute path to the file to write"
|
||||
},
|
||||
"content": {
|
||||
"type": "string",
|
||||
"description": "The content to write to the file"
|
||||
}
|
||||
},
|
||||
"required": ["file_path", "content"]
|
||||
}),
|
||||
)
|
||||
}
|
||||
|
||||
pub fn write_file(args: &serde_json::Value) -> Result<String> {
|
||||
let path = args["file_path"]
|
||||
.as_str()
|
||||
.context("file_path is required")?;
|
||||
let content = args["content"].as_str().context("content is required")?;
|
||||
|
||||
// Create parent directories if needed
|
||||
if let Some(parent) = Path::new(path).parent() {
|
||||
std::fs::create_dir_all(parent)
|
||||
.with_context(|| format!("Failed to create directories for {}", path))?;
|
||||
}
|
||||
|
||||
std::fs::write(path, content).with_context(|| format!("Failed to write {}", path))?;
|
||||
|
||||
let line_count = content.lines().count();
|
||||
Ok(format!("Wrote {} lines to {}", line_count, path))
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue