diff --git a/.agents/looprails/journal-triage.toml b/.agents/looprails/journal-triage.toml index 64bcd88..91692ce 100644 --- a/.agents/looprails/journal-triage.toml +++ b/.agents/looprails/journal-triage.toml @@ -1,5 +1,27 @@ +[metadata] 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." +spec_version = "0.3.0" + +[config] +enable_nix = true + +[agents.operator] +lifetime = "run" +llm = [ + { + provider = "claude", + model = "claude-haiku-5-5" + }, + { + provider = "grok", + model = "grok-4.5" + }, +] + +[operator] +agent = { name = "operator" } + [inputs.static] since = { type = "string", description = "How far back to read the journal.", min_length = 1, default = "24 hours ago" } @@ -38,7 +60,7 @@ 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\"", + "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\" >> \"$LOOPRAILS_OUTPUTS\"; echo \"Report written to $f\"", ] [step.report.outputs] diff --git a/.agents/looprails/journal-triage/collect.sh b/.agents/looprails/journal-triage/collect.sh index 2580714..0447305 100755 --- a/.agents/looprails/journal-triage/collect.sh +++ b/.agents/looprails/journal-triage/collect.sh @@ -2,7 +2,7 @@ # Collect journald warnings+ and failed units into the run folder, plus a deduplicated digest. set -eu since="$1"; priority="$2" -dir="$NBOT_LR_RUN_DIR" +dir="$LOOPRAILS_RUN_DIR" raw="$dir/journal-raw.log"; digest="$dir/journal-digest.txt" journalctl -p "$priority" --since "$since" --no-pager -q -o short-iso > "$raw" || true @@ -23,4 +23,4 @@ journalctl -p "$priority" --since "$since" --no-pager -q -o short-iso > "$raw" | lines=$(wc -l < "$raw") uniq=$(grep -c '^ *[0-9]' "$digest" || true) -printf 'raw_log=%s\ndigest=%s\nlines=%s\nunique=%s\n' "$raw" "$digest" "$lines" "$uniq" >> "$NBOT_LR_OUTPUTS" +printf 'raw_log=%s\ndigest=%s\nlines=%s\nunique=%s\n' "$raw" "$digest" "$lines" "$uniq" >> "$LOOPRAILS_OUTPUTS" diff --git a/.agents/skills/looprail/SKILL.md b/.agents/skills/looprail/SKILL.md new file mode 100644 index 0000000..ef8a34d --- /dev/null +++ b/.agents/skills/looprail/SKILL.md @@ -0,0 +1,21 @@ +--- +name: looprail +description: When anything to do with looprails comes up, use the looprail MCP tools; if they are not available, run looprail install and restart the session. +--- + +When anything to do with looprails comes up, use the looprail MCP tools; if they are not available, run `looprail install` and restart the session. + +The `get_looprail_guide` tool explains how to find, run, watch, answer, stop, resume, write and update a looprail. + +Before you call a `looprail` command you have not used, read its schema first: call `get_looprail_cli` with that command (the resource `looprail://cli` holds every command), or run `looprail help --json ` when the MCP tools are not available. It gives the command's arguments, flags, exit codes and the shape of its `--json` output. + +## Report progress while a run goes + +`start_looprail` returns after a few seconds, long before the run ends, so the run is yours to follow and report. Do not go quiet until it ends. Every status answer starts with `## Show the user`, the part to show the user after each call, and ends with `## Next`, the one call to make next: follow it. + +- Tell the user the run started: the looprail, its `run_id` and its inputs. +- Follow it with the call `## Next` gives: `get_looprail_status` with `wait_seconds` 60 to 120 (5 when left out, at most 300), not a quick polling loop. After each wait, show the user the steps as a table copied from the status's `Steps:` table: Step, Status, Elapsed, Model (which model runs an agent step), Tokens (input and output tokens spent, and the context of a running turn), Brief (a link to its brief file), Input and Output (the one-line summaries), with `-` where a step has none, and the `Tokens spent:` total line and the `Changes:` line (the lines the run's agents added and removed, and how many files they read) under it. Under it, say in a line or two what changed: the steps that finished, the step now running and any output that matters. +- In Claude Code, `looprail install` adds a status line and a PostToolUse hook that show the user each run's progress after every looprail tool call. With the hook installed you may leave out the full table after a wait and say only what changed; show the final table when the run ends. +- When the state is `needs_input` or `awaiting_inputs`, say what the run asks and answer with `provide_looprail_input` only if the user has already given you the answer; otherwise ask them. +- When it ends, report the state (`passed`, `failed`, `cancelled` or `interrupted`), the table with the outcome of each step and, on a failure, the step that failed and its last output. For `limited`, say when to resume. +- Report what the status says; never guess at a step's result. diff --git a/.agents/skills/nbot-wf/SKILL.md b/.agents/skills/nbot-wf/SKILL.md deleted file mode 100644 index 36e729b..0000000 --- a/.agents/skills/nbot-wf/SKILL.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -name: nbot-wf -description: When anything to do with workflows comes up, use the nbot-wf MCP tools; if they are not available, run nbot-wf install and restart the session. ---- - -When anything to do with workflows comes up, use the nbot-wf MCP tools; if they are not available, run `nbot-wf install` and restart the session. - -The `get_workflow_guide` tool explains how to find, run, watch, answer, stop, resume, write and update a workflow. diff --git a/.codex/config.toml b/.codex/config.toml index 2aa988e..6fcffc3 100644 --- a/.codex/config.toml +++ b/.codex/config.toml @@ -1,3 +1,7 @@ [mcp_servers.nbot-wf] command = "nbot-wf" args = ["mcp"] + +[mcp_servers.looprail] +command = "looprail" +args = ["mcp"] diff --git a/.grok/config.toml b/.grok/config.toml new file mode 100644 index 0000000..bdf2ed0 --- /dev/null +++ b/.grok/config.toml @@ -0,0 +1,3 @@ +[mcp_servers.looprail] +command = "looprail" +args = ["mcp"] diff --git a/.grok/skills/looprail/SKILL.md b/.grok/skills/looprail/SKILL.md new file mode 100644 index 0000000..ef8a34d --- /dev/null +++ b/.grok/skills/looprail/SKILL.md @@ -0,0 +1,21 @@ +--- +name: looprail +description: When anything to do with looprails comes up, use the looprail MCP tools; if they are not available, run looprail install and restart the session. +--- + +When anything to do with looprails comes up, use the looprail MCP tools; if they are not available, run `looprail install` and restart the session. + +The `get_looprail_guide` tool explains how to find, run, watch, answer, stop, resume, write and update a looprail. + +Before you call a `looprail` command you have not used, read its schema first: call `get_looprail_cli` with that command (the resource `looprail://cli` holds every command), or run `looprail help --json ` when the MCP tools are not available. It gives the command's arguments, flags, exit codes and the shape of its `--json` output. + +## Report progress while a run goes + +`start_looprail` returns after a few seconds, long before the run ends, so the run is yours to follow and report. Do not go quiet until it ends. Every status answer starts with `## Show the user`, the part to show the user after each call, and ends with `## Next`, the one call to make next: follow it. + +- Tell the user the run started: the looprail, its `run_id` and its inputs. +- Follow it with the call `## Next` gives: `get_looprail_status` with `wait_seconds` 60 to 120 (5 when left out, at most 300), not a quick polling loop. After each wait, show the user the steps as a table copied from the status's `Steps:` table: Step, Status, Elapsed, Model (which model runs an agent step), Tokens (input and output tokens spent, and the context of a running turn), Brief (a link to its brief file), Input and Output (the one-line summaries), with `-` where a step has none, and the `Tokens spent:` total line and the `Changes:` line (the lines the run's agents added and removed, and how many files they read) under it. Under it, say in a line or two what changed: the steps that finished, the step now running and any output that matters. +- In Claude Code, `looprail install` adds a status line and a PostToolUse hook that show the user each run's progress after every looprail tool call. With the hook installed you may leave out the full table after a wait and say only what changed; show the final table when the run ends. +- When the state is `needs_input` or `awaiting_inputs`, say what the run asks and answer with `provide_looprail_input` only if the user has already given you the answer; otherwise ask them. +- When it ends, report the state (`passed`, `failed`, `cancelled` or `interrupted`), the table with the outcome of each step and, on a failure, the step that failed and its last output. For `limited`, say when to resume. +- Report what the status says; never guess at a step's result. diff --git a/.mcp.json b/.mcp.json index f054c79..ab283fb 100644 --- a/.mcp.json +++ b/.mcp.json @@ -1,7 +1,7 @@ { "mcpServers": { - "nbot-wf": { - "command": "nbot-wf", + "looprail": { + "command": "looprail", "args": [ "mcp" ] diff --git a/flake.lock b/flake.lock index f51dc04..b767beb 100644 --- a/flake.lock +++ b/flake.lock @@ -2143,11 +2143,11 @@ ] }, "locked": { - "lastModified": 1795219795, - "narHash": "sha256-UWkSni5iiZrFCnqLTLaK8dg289YVwYnHd0NJKFS7xBI=", + "lastModified": 1795379170, + "narHash": "sha256-VBoiHtImOCLASYXn9t0XK2R2jA3RK8kijhxIXTWEfYw=", "ref": "refs/heads/main", - "rev": "637faaa418da6b01ba8d0c51dac3c8a4937e7a4f", - "revCount": 288, + "rev": "b9d5a98fcdde3c44388d5420b1a6cb4770230b5f", + "revCount": 466, "type": "git", "url": "ssh://git@github.com/SkyG-Org/LoopRail.git" }, @@ -2167,12 +2167,12 @@ "rev": "3ea535838ab125160c049d795dce625dec49396c", "revCount": 265, "type": "git", - "url": "ssh://git@github.com/SkyG-Org/LoopRail.git" + "url": "https://github.com/SkyG-Org/LoopRail.git" }, "original": { "rev": "3ea535838ab125160c049d795dce625dec49396c", "type": "git", - "url": "ssh://git@github.com/SkyG-Org/LoopRail.git" + "url": "https://github.com/SkyG-Org/LoopRail.git" } }, "mcp-servers-nix": { @@ -2244,11 +2244,11 @@ ] }, "locked": { - "lastModified": 1795308743, - "narHash": "sha256-YU5VXLKti6rBDzzzNaGqJ3uaUsk2g4FIzcLHMcMDQrE=", + "lastModified": 1795322438, + "narHash": "sha256-pCPpUEmdDfgoyXDOWPJ7u4zQY38Tzq7NFZ8ZX1Ay7Vg=", "ref": "refs/heads/main", - "rev": "02631ef7dcdbe64b0d3cb9666a564a0026e8d625", - "revCount": 1712, + "rev": "ecdb1b3bb784d5e2d178b9d3552e13bc1ee3a115", + "revCount": 1714, "type": "git", "url": "ssh://git@github.com/SkyG-Org/nBot.git" }, diff --git a/hosts/hl-minipc3/services/Caddyfile b/hosts/hl-minipc3/services/Caddyfile index d7cb3ec..e2f22c2 100644 --- a/hosts/hl-minipc3/services/Caddyfile +++ b/hosts/hl-minipc3/services/Caddyfile @@ -92,6 +92,8 @@ looprails.skyg.ca { handle { root * /srv/looprails + # Store files are dated 1970; make browsers re-check. + header Cache-Control "no-cache" redir /looprail.html / permanent file_server }