---
type: "Source File"
title: "CopeCheck Codex"
description: "# CopeCheck Codex Unified CopeCheck site plus a tiny scoring queue API. Open locally: ```bash cd copecheck-codex python3 codex_server.py --host 127.0.0.1 --port 8105 ``` Then visit: ```text http://localhost:8105 ```."
resource: "https://codex.copecheck.com/README.md"
tags: ["copecheck", "codex", "source-file", "md"]
timestamp: "2026-08-25T11:56:05Z"
site: "codex"
source_path: "copecheck-codex/README.md"
---

# CopeCheck Codex

Source path: `copecheck-codex/README.md`  
Index snapshot generated: `2026-11-24T13:27:52Z`  
File modified: `2026-08-25T11:56:05Z`

```md
# CopeCheck Codex

Unified CopeCheck site plus a tiny scoring queue API.

Open locally:

```bash
cd copecheck-codex
python3 codex_server.py --host 127.0.0.1 --port 8105
```

Then visit:

```text
http://localhost:8105
```

Key files:

- `index.html` - public network control plane
- `codex_server.py` - static server plus `/api/jobs` queue endpoints
- `canonical_identity.py` - channel-neutral URL and evidence identity
- `story_state.py` - cross-process state locking, aliases, and provenance
- `assets/styles.css` - design system and layout
- `assets/app.js` - rendering and live queue interaction
- `data/seed.js` - stable network descriptions and source-site links
- `data/stories.js` - generated Google RSS story feed
- `data/doom-markets.json` - generated prediction-market, ONS, and curated polling signal feed
- `data/doom-markets.js` - ES module copy of the same signal feed for static fallback rendering
- `tools/fetch_rss_stories.py` - RSS story refresher used by the VPS timer
- `tools/migrate_story_identities.py` - conservative exact-URL state migration
- `tools/fetch_doom_markets.py` - no-auth Manifold/Polymarket/ONS signal refresher
- `fixtures/scoring-smoke.html` - noindex smoke-test fixture for the worker loop
- `openclaw/score-url-job.json` - OpenClaw worker contract
- `docs/ARCHITECTURE.md` - deployment and backend plan

VPS prototype:

```text
/home/ben/infra/copecheck-codex
systemd: copecheck-codex.service
local port: 127.0.0.1:8105
public URL: https://codex.copecheck.com
```

The Cloudflare tunnel ingress and DNS record for `codex.copecheck.com` are
active.

Live queue contract:

```text
POST /api/jobs                     public URL submission
GET  /api/jobs/{job_id}            public status/result polling
GET  /api/jobs/pending             private Mac worker polling
POST /api/jobs/{job_id}/result     private Mac worker callback
```

[redacted secret-like line]
outbound, so the local OpenClaw/worker stack does not need to be exposed.

RSS automation:

```text
systemd timer: copecheck-codex-stories.timer
script: tools/fetch_rss_stories.py
feeds: feeds/main-rss_feeds.json, feeds/uk-rss_feeds.json, feeds/layoffs-rss_feeds.json
public API: GET /api/stories
```

The timer refreshes the visible story grid, keeps at least five visible stories
from each active channel where available, and auto-queues a throttled batch for
scoring. Exact publisher URLs resolve immediately to one channel-neutral job.
Once a title or attributed excerpt exists, conservative event matching uses a
seven-day fuzzy window; identical sufficiently specific statements remain the
same event. Publisher and discovery-channel observations are retained as
provenance. Queueing is route-tagged and capped per run so `main`, `uk`, and
`layoffs` all get processed without a single feed monopolising the worker.

The web service, RSS timer, and migration coordinate JSON updates through the
same file lock and atomic writer. Historic duplicate job IDs remain resolvable
through aliases after migration.

Doom market automation:

```text
systemd timer: copecheck-codex-doom-markets.timer
script: tools/fetch_doom_markets.py
sources: Manifold search, Polymarket public-search, ONS labour time series, curated YouGov links
public API: GET /api/doom-markets
static feed: data/doom-markets.json
```

This layer does not trade or expose betting functionality. It treats prediction
markets as a public forecast signal, combines them with official UK labour data,
and keeps YouGov as an attributed watchlist because public polling reuse is
non-commercial and scraping-sensitive.

Oracle publishing:

```text
GET /api/oracle                  public published-entry list
GET /api/oracle/{job_id}         public published-entry JSON
GET /oracle/{channel}/{job_id}   fallback Codex Oracle page
```

`complete` scores auto-publish when the claim is not marked for review,
confidence is at least `0.78`, attribution is direct/named/institutional, and
the source URL, excerpt, and evidence list are present. The public page shows a
short Oracle summary, score, attribution context, a short excerpt, evidence
bullets, and a link back to the original source. Review, failed, and discarded
jobs remain visible through their job-status URLs but do not get permanent
Oracle pages.

Published entries are written into the real channel destinations and Codex
links out to those URLs:

- `main` -> `https://www.copecheck.com/v/<slug>`
- `uk` -> `https://uk.copecheck.com/analysis/<slug>`
- `layoffs` -> `https://layoffs.copecheck.com/oracle/<job_id>/`

Main publishing uses Main's canonical database API. A resource already found
through RSS or another channel receives the Codex verdict on its existing
article row, and the Codex discovery is added to provenance instead of creating
a channel-prefixed duplicate.
```
