forked from kent/consciousness
digest: split into focused modules, externalize prompts
digest.rs was 2328 lines containing 6 distinct subsystems. Split into:
- llm.rs: shared LLM utilities (call_sonnet, parse_json_response, semantic_keys)
- audit.rs: link quality audit with parallel Sonnet batching
- enrich.rs: journal enrichment + experience mining
- consolidate.rs: consolidation pipeline + apply
Externalized all inline prompts to prompts/*.md templates using
neuro::load_prompt with {{PLACEHOLDER}} syntax:
- daily-digest.md, weekly-digest.md, monthly-digest.md
- experience.md, journal-enrich.md, consolidation.md
digest.rs retains temporal digest generation (daily/weekly/monthly/auto)
and date helpers. ~940 lines, down from 2328.
Co-Authored-By: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
3f644609e1
commit
50da0b7b26
13 changed files with 1642 additions and 1582 deletions
|
|
@ -189,14 +189,14 @@ pub fn schema_assimilation(store: &Store, key: &str) -> (f32, &'static str) {
|
|||
}
|
||||
|
||||
/// Prompt template directory
|
||||
fn prompts_dir() -> std::path::PathBuf {
|
||||
pub(crate) fn prompts_dir() -> std::path::PathBuf {
|
||||
// Check for prompts relative to binary, then fall back to ~/poc/memory/prompts/
|
||||
let home = std::env::var("HOME").unwrap_or_default();
|
||||
std::path::PathBuf::from(home).join("poc/memory/prompts")
|
||||
}
|
||||
|
||||
/// Load a prompt template, replacing {{PLACEHOLDER}} with data
|
||||
fn load_prompt(name: &str, replacements: &[(&str, &str)]) -> Result<String, String> {
|
||||
pub(crate) fn load_prompt(name: &str, replacements: &[(&str, &str)]) -> Result<String, String> {
|
||||
let path = prompts_dir().join(format!("{}.md", name));
|
||||
let mut content = std::fs::read_to_string(&path)
|
||||
.map_err(|e| format!("load prompt {}: {}", path.display(), e))?;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue