Skip to content
SprecherEast
Issue 364

enhancement: A runner for the intelligence pipeline, with OpenClaw for the model stages

Back to our plan
Done
enhancementcmstoolingpriority: high

Problem

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):

  1. 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's fetch with ETag/Last-Modified, the official MCP SDK client (already a dependency through the Payload MCP plugin) for /api/mcp.
  2. Stages: scout (direct fetch per sources.yaml, parse, externalId and contentHash per provenance.schema.json) → known lookup through the MCP find tool → verify, curate, draft through a pluggable model adapter → validate → submit (submitSuggestion, reportItem) → run log in agent-runs.
  3. Model adapter: openclaw agent exec --agent sprecher-east --json by default; the adapter is one function, so tests use a fake and any other runtime can be plugged in.
  4. Safety: honors pipeline.yaml (kill switch, budgets, routes); the model never sees the key; the key comes from an environment variable only; --dry-run writes the calls and the digest without touching the CMS.
  5. 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-run runs 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.yaml says.
  • Not done: No secret in the repo, logs or digest; the key is read from SPRECHER_EAST_MCP_KEY only.
  • Not done: README's "How a runtime loads it" describes the runner and the OpenClaw adapter.

Area

tooling, cms

Priority

high

See it on GitHub, opens in a new tab