Watch
0
0
Fork
You've already forked hyperhive
0
hyperhive/swarm-review-classifier
Repository files (latest commit first)
Filename Latest commit message Latest commit date
atlas 6d42abb285 review classifier: under ACP the prompt is a real system message
The ACP runtime handed the classifier's system prompt to hive-runtime's
system_prompt_file, which prepends it to the first user message, so the
instructions and the PR text sat in the same user turn.

The rendered opencode.json now defines a review-classifier agent whose
prompt is {file:./system.md} and selects it with default_agent. opencode
1.15.10 sends an agent's prompt as the system-role message (in place of
its per-model default prompt), followed only by its environment block;
the first user message is the PR material alone. The API key runtime
keeps --system-prompt.

The agent carries no permission or tools key, and a test pins its exact
shape: opencode merges an agent's own permission after
OPENCODE_PERMISSION, so a permission there would offer tools again
(checked on real opencode: {"*":"allow"} on the agent offered all ten
tools despite OPENCODE_PERMISSION={"*":"deny"}).

Follow-up to #5214.
2026-10-14 12:49:33 +02:00
..
src review classifier: under ACP the prompt is a real system message 2026-10-14 12:49:33 +02:00
tests review classifier: run on ACP when the swarm settings choose it 2026-10-14 10:14:36 +02:00
Cargo.toml swarm-review-classifier: test that Otel::record exports the run's cost 2026-10-14 10:14:36 +02:00
README.md docs: review-classifier truncation sentences in active voice 2026-10-13 21:23:03 +02:00

swarm-review-classifier

The review classifier's try-out service, in the swarm-review-classifier container on the host that sets deploy.review-classifier.enable. The design is docs/swarm/review-classifier.md.

swarm-controller reads a PR (its head commit, its commits and its diff) and sends it, with the operator's classifications, as a request on the queue. This service asks a small model one classification at a time and answers with the result table and the overall verdict. It writes nothing to the forge and holds no forge credential.

What a run is

  • The shared context first: a system prompt, the PR's commits with their full messages, and the diff with lockfiles collapsed as hive-forge diff does. Every classification's prompt starts with the same bytes.
  • One claude --print per classification, with no session, no tools (--tools ""), no MCP server, its own empty directory and ANTHROPIC_API_KEY in its environment only.
  • An answer is a JSON object with a verdict, a certainty and a reason; the classifier truncates a reason over 500 characters to 499 plus …. A failed run, a timeout or an answer that doesn't validate leaves that row without a verdict, and it doesn't count.
  • A run with no API key, or with no classification answered, fails as a whole: the caller sees an error, never a verdict.

Credentials

The container holds one credential: its own store certificate, which nspawn hands in at start without a copy on disk. With it the service reads its queue client secret at start and the API key at every run, so a key written or removed in the store takes effect on the next run. Its store role reads exactly those two paths.