Logging overhaul: per-task log files, daemon.log drill-down

Switch from jobkit-daemon crate to jobkit with daemon feature.
Wire up per-task log files for all daemon-spawned agent tasks.

Changes:
- Use jobkit::daemon:: instead of jobkit_daemon::
- All agent tasks get .log_dir() set to $data_dir/logs/
- Task log path shown in daemon status and TUI
- New CLI: poc-memory agent daemon log --task NAME
  Finds the task's log path from status or daemon.log, tails the file
- LLM backend selection logged to daemon.log via log_event
- Targeted agent job names include the target key for debuggability
- Logging architecture documented in doc/logging.md

Two-level logging, no duplication:
- daemon.log: lifecycle events with task log path for drill-down
- per-task logs: full agent output via ctx.log_line()

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Kent Overstreet 2026-03-19 11:17:07 -04:00
parent f2c2c02a22
commit 49f72cdac3
7 changed files with 192 additions and 54 deletions

View file

@ -447,6 +447,9 @@ enum DaemonCmd {
Log {
/// Job name to filter by
job: Option<String>,
/// Tail a task's log file (drill down from daemon log)
#[arg(long)]
task: Option<String>,
/// Number of lines to show
#[arg(long, default_value_t = 20)]
lines: usize,
@ -1043,7 +1046,13 @@ fn cmd_daemon(sub: DaemonCmd) -> Result<(), String> {
match sub {
DaemonCmd::Start => daemon::run_daemon(),
DaemonCmd::Status => daemon::show_status(),
DaemonCmd::Log { job, lines } => daemon::show_log(job.as_deref(), lines),
DaemonCmd::Log { job, task, lines } => {
if let Some(ref task_name) = task {
daemon::show_task_log(task_name, lines)
} else {
daemon::show_log(job.as_deref(), lines)
}
}
DaemonCmd::Install => daemon::install_service(),
DaemonCmd::Consolidate => daemon::rpc_consolidate(),
DaemonCmd::Run { agent, count } => daemon::rpc_run_agent(&agent, count),