enhancement: A runner for the intelligence pipeline, with OpenClaw for the model stages
Back to our planProblem
intelligence/README.md says the scout and submit stages are code and that "the runtime is OpenClaw, on the owner's side", but no code runs the pipeline: nothing fetches the sources, validates each stage's answer against its schema, routes items, or calls the MCP tools. Without it, a run would be a model improvising from the prompts, which defeats the schemas, the evals and the "deterministic steps first" design.
Owner decision (2026-10-25, Claude session): yes, build it: a small runner in this repo does fetching, schema checks and submitting, and holds the CMS key; OpenClaw only runs the model stages through a sandboxed, tool-less agent on the owner's ChatGPT subscription (his rule: flat subscriptions, not pay-per-token APIs); OpenClaw's own cron starts it daily.
Proposed fix
A Node runner in intelligence/runner/ (plain ESM, no build step; it is not site code and the site never imports it):
- Native and established first:
ajv(JSON Schema 2020-12) for validation, the YAML parser and feed/ICS parsers already in the tree or well-established ones, Node'sfetchwith ETag/Last-Modified, the official MCP SDK client (already a dependency through the Payload MCP plugin) for/api/mcp. - Stages: scout (direct fetch per
sources.yaml, parse,externalIdandcontentHashperprovenance.schema.json) → known lookup through the MCP find tool → verify, curate, draft through a pluggable model adapter → validate → submit (submitSuggestion,reportItem) → run log inagent-runs. - Model adapter:
openclaw agent exec --agent sprecher-east --jsonby default; the adapter is one function, so tests use a fake and any other runtime can be plugged in. - Safety: honors
pipeline.yaml(kill switch, budgets, routes); the model never sees the key; the key comes from an environment variable only;--dry-runwrites the calls and the digest without touching the CMS. - Tests: unit tests for routing, hashing, validation retries, budgets and the adapter contract, run in CI with no network and no model.
Playwright fallback (#352) stays out of the first version: the pilot sources are direct; the runner logs fetchStrategy: direct and skips a source that needs the fallback, with a follow-up issue.
Acceptance criteria
- Not done:
node intelligence/runner/run.mjs --dry-runruns the pilot against fixtures with a fake model and produces valid stage outputs and a valid run log. - Not done: Every stage answer is validated against its schema; one retry, then review, as the README says.
- Not done: Budgets and the kill switch stop a run as
pipeline.yamlsays. - Not done: No secret in the repo, logs or digest; the key is read from
SPRECHER_EAST_MCP_KEYonly. - Not done: README's "How a runtime loads it" describes the runner and the OpenClaw adapter.
Area
tooling, cms
Priority
high