Files
nixos-setup/.agents/looprails/journal-triage.toml
T
2026-11-17 14:22:28 -05:00

46 lines
2.4 KiB
TOML

name = "journal-triage"
description = "Collect journald warnings, triage them with Claude Opus against this repo, and write an urgency-ranked report with fixes as repo changes."
[inputs.static]
since = { type = "string", description = "How far back to read the journal.", min_length = 1, default = "24 hours ago" }
priority = { type = "enum", description = "Lowest log priority to include.", values = ["err", "warning", "notice"], default = "warning" }
host = { type = "string", description = "Name of the host folder under hosts/ to trace issues to.", min_length = 1, default = "fwbook" }
repo = { type = "string", description = "Path of the NixOS config repo.", min_length = 1, default = "/home/ari/nixos-setup" }
[[step.collect]]
kind = "shell"
description = "Collects journal warnings and failed units into a digest."
cwd = "{{ inputs.repo }}"
run = ["sh .agents/looprails/journal-triage/collect.sh {{ inputs.since }} {{ inputs.priority }}"]
[step.collect.outputs]
raw_log = { type = "string", description = "Path of the full raw journal log." }
digest = { type = "string", description = "Path of the deduplicated digest." }
lines = { type = "int", description = "Number of raw log lines." }
unique = { type = "int", description = "Number of distinct messages." }
[[step.triage]]
kind = "agent"
description = "Has Opus triage the log against the repo and suggest fixes."
needs = ["collect"]
agent = { command = ["claude-agent-acp"], model = "opus" }
cwd = "{{ inputs.repo }}"
brief = "journal-triage/triage.md"
failover = "agent"
[step.triage.outputs]
summary = { type = "string", description = "Markdown report ranked by urgency.", min_length = 1 }
issues = { type = "list", description = "The issues found, with urgency, fix and files.", items = { title = { type = "string" }, urgency = { type = "enum", values = ["critical", "high", "medium", "low", "noise"] }, fix = { type = "string" }, files = { type = "list" } } }
[[step.report]]
kind = "shell"
description = "Writes the report to .tmp/journal-reports."
needs = ["triage"]
run = [
"R={{ inputs.repo }}; mkdir -p \"$R/.tmp/journal-reports\"",
"S={{ steps.triage.outputs.summary }}; H={{ inputs.host }}; R={{ inputs.repo }}; f=\"$R/.tmp/journal-reports/$H-$(date +%Y-%m-%d-%H%M).md\"; printf '%s\\n' \"$S\" > \"$f\"; echo \"report=$f\" >> \"$NBOT_LR_OUTPUTS\"; echo \"Report written to $f\"",
]
[step.report.outputs]
report = { type = "string", description = "Path of the written report." }