agentd: improve agentd logs with filtering and recency options

t-768·WorkTask·
·
·
Created1 week ago·Updated4 days ago·pipeline runs →

Description

Edit

agentd logs currently dumps the entire conversation history as one blob. No filtering by recency, no tail-N, no way to get 'just the last message.' Piping through tail sometimes cuts mid-message.

Needs careful design — should be fast and intuitive. Some options to consider:

  • agentd logs <name> --last N (last N messages)
  • agentd logs <name> --since TIMESTAMP
  • agentd logs <name> --tail (last message only)
  • Message boundary awareness so truncation doesn't split mid-message
  • Maybe a compact format (role + first line) vs full format

This is a UX-sensitive tool — worth thinking about what the most common access patterns are before implementing. The primary consumer right now is ava checking on agent progress during heartbeats.

Timeline (6)

🔄[human]Open → InProgress4 days ago
💬[human]4 days ago

Implemented log filtering for persistent session JSONL logs. Added flags: , (RFC3339), , , , while keeping . Persistent logs now stream via JSONL with filters applied (including follow mode). Added validation for invalid and non-positive . Added pure filter logic + unit tests in Omni/Agentd/Daemon.hs for --last/--since/type+role and invalid timestamp handling. Updated SPEC logging docs to describe persistent session log path and filtering flags. Verified with typecheck/lint and bild tests (, 7[10000;10000H) and manual CLI checks on sd-coder.

💬[human]4 days ago

Follow-up (clean comment):

  • Added persistent log filtering flags to agentd logs: --last N, --since TIMESTAMP (RFC3339), --type TYPE, --role ROLE, --contains TEXT, plus existing --follow.
  • Filtering now runs against persistent session JSONL entries and is applied in both one-shot log reads and follow mode.
  • Added validation errors for invalid --since and non-positive --last.
  • Added unit tests in Omni/Agentd/Daemon.hs for --last, --since, --type+--role, and invalid timestamp handling.
  • Updated Omni/Agentd/SPEC.md logging section with persistent session JSONL path and new filtering flags.
  • Verified with typecheck, lint, bild tests (Omni/Agentd/Daemon.hs and Omni/Agentd.hs), and manual CLI checks against sd-coder.
🔄[human]InProgress → Review4 days ago