Run everything on the local model; no cloud tier
GLM-4.7-Flash can reach core over SSH, check, diagnose and upgrade, so operator messages, alert triage, health findings and the weekly upgrade all route to the one local profile. The Anthropic profile and its cloud-first routing go, and with them the API key and metered billing the first draft needed. The local profile's context_tokens rises to 131072, the window Ollama loads GLM with, so long runs are not trimmed early. Profiles and routing stay in configuration: a second model can still be added, with hand-over when the first is unreachable or fails the run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
61dca2c3ca
commit
9aa1abf0e2
7 files changed
+89
-93
No files matched your search
+22
-20
@@ -8,7 +8,7 @@ Revised 2026-09-15 for the move to AWS Lightsail: the daemon ran on the stack ho
|
||||
to Matrix events instead of polling, and kept the repo equal to what runs.
|
||||
|
||||
Revised 2026-09-26: the daemon moved to the operator's workstation, and from Claude Code to
|
||||
pydantic-ai with configurable cloud and local models. Decisions that changed say so below.
|
||||
pydantic-ai on the workstation's local model. Decisions that changed say so below.
|
||||
|
||||
## Purpose
|
||||
|
||||
@@ -34,7 +34,7 @@ relays its results.
|
||||
| Post-mortem | Kuma DOWN→UP between checks | Agent finds the cause in logs; changes nothing healthy | Report in Stack Maintenance |
|
||||
| Host checks | 5-min timer on core: disk ≥ 85%, memory < 400 MB, OOM kill, restart loop, Kuma stale, reboot | Agent investigates (12h cooldown per finding) | Report in Stack Maintenance |
|
||||
| Core unreachable | 3 health checks in a row cannot reach core over SSH | No agent: nothing it could do from here | 🚨, delivered once Matrix is back |
|
||||
| Daily report | 21:00 UTC | No agent: monitors, downtime, alerts, runs by model, cloud spend, commits, pending reboot or decision | 📋 in Stack Maintenance |
|
||||
| Daily report | 21:00 UTC | No agent: monitors, downtime, alerts, agent runs, commits, pending reboot or decision | 📋 in Stack Maintenance |
|
||||
| Weekly upgrade | Sat 22:00 UTC (Sun 08:00 AEST) | Agent upgrades every image and host packages on core; pins, commits, pushes; escalates majors and reboots | Report + decisions |
|
||||
| Service desk | Every minute | `service-desk.py poll` on core, over SSH | 🙋 / ⛔ / 📨 / ✅ |
|
||||
| Self-update | Hourly | Fast-forward this checkout, `uv sync` if needed, `--check`, re-exec | 🔄 notice |
|
||||
@@ -63,20 +63,24 @@ relays its results.
|
||||
semprini-core's rule ("on the host, commit what you apply") unchanged. Files are written in
|
||||
place, never renamed over, because core's configs are bind-mounted single files.
|
||||
- **Runner = pydantic-ai in the daemon's process** (2026-09-26; reverses Claude Code
|
||||
headless, `claude -p`). What it gains: any model, cloud or local, per kind of task, with
|
||||
fallback; a typed result instead of a JSON block fished out of prose; cancellation that
|
||||
headless, `claude -p`). What it gains: any model pydantic-ai supports, local or cloud, with
|
||||
fallback between them when more than one is configured; a typed result instead of a JSON
|
||||
block fished out of prose; cancellation that
|
||||
stops the command in flight; one Python process instead of a CLI per run. What it gives
|
||||
up: Claude Code's large tool set, automatic `CLAUDE.md` loading, compaction and web search.
|
||||
The agent now has five tools (`shell`, `read_file`, `write_file`, `edit_file` on a named
|
||||
host, and `fetch_url`); the instructions tell it to grep the runbook and `CLAUDE.md` on core
|
||||
for what it needs, and old tool output is shortened when a conversation nears a model's
|
||||
window.
|
||||
- **Models are profiles, routed per kind of task.** Defaults: operator messages and health
|
||||
findings try the cloud first, alert triage tries the local model first, the weekly upgrade
|
||||
is cloud only. Triage is the most frequent run and mostly reading, so it is the one worth
|
||||
keeping local; the upgrade is the most consequential. An unreachable model hands over at
|
||||
once (`FallbackModel`); a run that fails as a run restarts on the next profile, told what
|
||||
the failed attempt ran. Each reply says which model answered.
|
||||
- **One local model does everything** (2026-09-26, the operator's decision). Operator
|
||||
messages, alert triage, health findings and the weekly upgrade all run on GLM-4.7-Flash:
|
||||
the operator judged it able to reach core over SSH, check, diagnose and upgrade, and saw
|
||||
no reason for a second tier. It replaced a first design, the same day, that sent operator
|
||||
messages, health findings and the upgrade to Claude through the API. So there is no
|
||||
metered billing and no API key to hold. The mechanism is kept general in configuration:
|
||||
models are profiles, and `routing` lists the profiles each kind of task tries; a second
|
||||
profile in a list takes over when the first is unreachable (`FallbackModel`) or fails the
|
||||
run, told what the failed attempt ran. Each reply says which model answered.
|
||||
- **Local model = GLM-4.7-Flash on Ollama, on Windows** (tested 2026-09-26). The one test
|
||||
that matters is whether a model uses what a tool returns: `--try-model` gives it a value it
|
||||
cannot guess. GLM-4.7-Flash and qwen3.5:35b passed; qwen3-coder called the tool and then
|
||||
@@ -84,11 +88,9 @@ relays its results.
|
||||
Ollama runs on the Windows host, not in WSL: its models, its GPU driver and its app are
|
||||
there. The app's *Expose Ollama to the network* setting lets WSL reach it (through WSL's
|
||||
gateway to Windows); it also opens it to the home LAN, and Ollama has no authentication.
|
||||
- **Credential = an API key per cloud profile** (2026-09-26; reverses the `claude
|
||||
setup-token` subscription token). pydantic-ai calls the Anthropic API, which is billed per
|
||||
token; the subscription token is for Claude Code only. Mitigations: the instructions, tool
|
||||
list and conversation are prompt-cached; `limits.cost_usd` caps each run by kind; the
|
||||
footer and the daily report show the spend; the most frequent work is routed local.
|
||||
- **No model credential** (2026-09-26; retires the `claude setup-token` subscription token,
|
||||
which is for Claude Code only). A cloud profile added later would need an API key, billed
|
||||
per token; `limits.cost_usd` caps each run on a priced model.
|
||||
- **Event-driven via long-poll `/sync`, not a Synapse application service.** The
|
||||
homeserver holds a `/sync` request open and answers the moment an event lands, so
|
||||
messages are handled within about a second. An appservice would push over HTTP instead,
|
||||
@@ -150,12 +152,12 @@ access — and a smaller local model is likely to resist such text less well tha
|
||||
- **When core dies, the warning cannot get out.** The daemon now notices, but Matrix lives on
|
||||
core, so the 🚨 waits in the outbox. A second channel that does not depend on core (ntfy,
|
||||
or mail through SES directly) would close it.
|
||||
- **A local model acts on production.** Alert triage runs local first by default. It can
|
||||
change things (demote log lines, restart containers); a weaker model may judge worse.
|
||||
Watch the footers, and move `alerts` to cloud first if its work disappoints.
|
||||
- **One local model runs production alone.** GLM-4.7-Flash does every task, upgrades
|
||||
included, with no stronger model behind it. Its commits are in Gitea and its replies say
|
||||
what it did; a second profile in `routing` is the lever if its judgement disappoints.
|
||||
- **Ollama down means no agent.** With one profile there is nothing to hand over to: tasks
|
||||
wait, and the operator is told once per kind of task.
|
||||
- **Gitea lives on the host it describes.** vol-backup copies its volume to S3 nightly, and
|
||||
workstation clones exist. A push mirror to GitHub would make a rebuild independent of S3.
|
||||
- **Cloud runs are metered.** A runaway run is capped by `limits`; a runaway *schedule* (an
|
||||
alert storm past the cooldowns) is not, beyond the one-run-at-a-time queue.
|
||||
- **Health checks pause during an agent run.** A 30-minute upgrade delays the next Kuma
|
||||
check by up to that long; alerts and operator messages still queue and are acknowledged.
|
||||
Reference in new issue
Block a user