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:
paulandClaude Opus 5.5 committed 2026-09-26 01:59:28 +12:00
1 parent 61dca2c3ca
commit 9aa1abf0e2
7 files changed
+89 -93

No files matched your search

+12 -11
View File
@@ -10,8 +10,8 @@ SSH, and talks to the operator over Matrix (chat.semprini.me).
It is the *unattended driver* for the canonical **stack-support agent**, which lives in the
separate **semprini-core** repo. This project does not reimplement that logic: it notices
events, runs the stack-support agent in-process with **pydantic-ai** on a cloud or local
model, and relays the agent's typed result.
events, runs the stack-support agent in-process with **pydantic-ai** on the workstation's
local model (GLM-4.7-Flash on Ollama), and relays the agent's typed result.
Until 2026-09-26 it ran on the core host itself and drove Claude Code headless;
`docs/architecture.md` records why that changed.
@@ -40,14 +40,15 @@ Until 2026-09-26 it ran on the core host itself and drove Claude Code headless;
- **Hosts** (`hosts.py`, `config.json` → `hosts`): `core` (ssh, one multiplexed
connection), `local` (WSL bash) and `windows` (`powershell.exe` through WSL interop).
The daemon's probes, its git bookkeeping and the agent's tools all run through them.
- **Models** (`agent.py`, `config.json` → `models`, `routing`, `limits`): named profiles
(`anthropic:…` with an API key, `ollama:…` on Windows at `{windows_host}`, any
OpenAI-compatible `base_url`, or anything pydantic-ai infers). Each kind of task tries its
chain in order: an unreachable model hands over at once (`FallbackModel`); a run that
fails as a run (budget spent, no usable result) restarts on the next profile, told what
the failed attempt ran. None usable → `AgentUnavailable`: the task stays queued, the
operator is told once, retries back off from 60s to 15 min. `model local|cloud|auto` in
Matrix pins a room. `--try-model` checks a profile calls tools and *uses their results*.
- **Models** (`agent.py`, `config.json` → `models`, `routing`, `limits`): one profile,
`local` (GLM-4.7-Flash on the Windows host's Ollama, at `{windows_host}`), routed for every
kind of task. The operator decided (2026-09-26) that the local model does all of it,
upgrades included, with no cloud tier. The mechanism stays general: a profile can be
`anthropic:…` with an API key, any OpenAI-compatible `base_url`, or anything pydantic-ai
infers, and a routing list with a second profile hands over when the first is unreachable
(`FallbackModel`) or fails the run. No usable model → `AgentUnavailable`: the task stays
queued, the operator is told once per kind, and that kind backs off from 60s to 15 min.
`--try-model` checks a profile calls tools and *uses their results*.
- **The agent**: tools `shell`, `read_file`, `write_file`, `edit_file` (all on a named
host) and `fetch_url`; result type `Envelope` (status, summary, details, question,
options). Conversations are pydantic-ai message histories in `<state dir>/sessions/`, so a
@@ -81,7 +82,7 @@ Until 2026-09-26 it ran on the core host itself and drove Claude Code headless;
boot time and a pending reboot. Monitors confirmed DOWN over `down_confirmations`
cycles, blips, host anomalies and reboots become **one** health task. Three cycles that
cannot reach core raise 🚨. Scope = Kuma's active monitors, re-read every cycle.
- **Daily report** at `digest_hour_utc` (runs by model, cloud spend); **weekly upgrade**
- **Daily report** at `digest_hour_utc`; **weekly upgrade**
at `upgrade_weekday` / `upgrade_hour_utc` (all images on the core host; a pending reboot
is escalated for approval).
- **One agent run at a time.** The queue is persisted in the state file with priority