agent logging: single log file, --debug prints to stdout

Consolidate agent logging to one file per run in llm-logs/{agent}/.
Prompt written before LLM call, response appended after. --debug
additionally prints the same content to stdout.

Remove duplicate eprintln! calls and AgentResult.prompt field.
Kill experience_mine and fact_mine job functions from daemon —
observation.agent handles all transcript mining.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Kent Overstreet 2026-03-16 20:44:09 -04:00
parent d7436b8b9c
commit 03310dafa4
3 changed files with 27 additions and 60 deletions

View file

@ -39,29 +39,7 @@ fn run_job(ctx: &ExecutionContext, name: &str, f: impl FnOnce() -> Result<(), St
jobkit_daemon::Daemon::run_job(&crate::config::get().data_dir, ctx, name, f)
}
fn job_experience_mine(ctx: &ExecutionContext, path: &str, segment: Option<usize>) -> Result<(), TaskError> {
let path = path.to_string();
run_job(ctx, &format!("experience-mine {}", path), || {
ctx.log_line("loading store");
let mut store = crate::store::Store::load()?;
ctx.log_line("mining");
let count = super::enrich::experience_mine(&mut store, &path, segment)?;
ctx.log_line(format!("{count} entries mined"));
Ok(())
})
}
fn job_fact_mine(ctx: &ExecutionContext, path: &str) -> Result<(), TaskError> {
let path = path.to_string();
run_job(ctx, &format!("fact-mine {}", path), || {
ctx.log_line("mining facts");
let p = std::path::Path::new(&path);
let progress = |msg: &str| { ctx.set_progress(msg); };
let count = super::fact_mine::mine_and_store(p, Some(&progress))?;
ctx.log_line(format!("{count} facts stored"));
Ok(())
})
}
// experience_mine and fact_mine removed — observation.agent handles all transcript mining
/// Run a single consolidation agent (replay, linker, separator, transfer, health).
fn job_consolidation_agent(
@ -100,7 +78,7 @@ fn job_rename_agent(
ctx.log_line(&format!("running rename agent (batch={})", batch));
let log = |msg: &str| ctx.log_line(msg);
let result = super::knowledge::run_one_agent(&mut store, "rename", batch, "consolidate", &log)?;
let result = super::knowledge::run_one_agent(&mut store, "rename", batch, "consolidate", &log, false)?;
// Parse RENAME actions from response (rename uses its own format, not WRITE_NODE/LINK/REFINE)
let mut applied = 0;
@ -898,12 +876,7 @@ pub fn run_daemon() -> Result<(), String> {
log_event("extract", "queued", &task_name);
let path = path_str.clone();
let seg = *segment;
choir_sw.spawn(task_name)
.resource(&llm_sw)
.retries(2)
.init(move |ctx| {
job_experience_mine(ctx, &path, seg)
});
// experience_mine killed — observation.agent handles transcript mining
extract_queued += 1;
}
@ -922,12 +895,7 @@ pub fn run_daemon() -> Result<(), String> {
let task_name = format!("fact-mine:{}", filename);
log_event("fact-mine", "queued", path_str);
let path = path_str.clone();
choir_sw.spawn(task_name)
.resource(&llm_sw)
.retries(1)
.init(move |ctx| {
job_fact_mine(ctx, &path)
});
// fact_mine killed — observation.agent handles transcript mining
fact_queued += 1;
}
} else {