---
type: "Source File"
title: "CopeCheck Codex Prototype"
description: "# CopeCheck Codex Prototype This folder is a dependency-free prototype for `codex.copecheck.com`. The intended product is a unified CopeCheck operating layer that folds the existing eight subdomains into one data."
resource: "https://codex.copecheck.com/docs/ARCHITECTURE.md"
tags: ["copecheck", "codex", "source-file", "md"]
timestamp: "2026-05-15T07:52:56Z"
site: "codex"
source_path: "copecheck-codex/docs/ARCHITECTURE.md"
---

# CopeCheck Codex Prototype

Source path: `copecheck-codex/docs/ARCHITECTURE.md`  
Index snapshot generated: `2026-11-24T13:27:52Z`  
File modified: `2026-05-15T07:52:56Z`

```md
# CopeCheck Codex Prototype

This folder is a dependency-free prototype for `codex.copecheck.com`.

The intended product is a unified CopeCheck operating layer that folds the
existing eight subdomains into one data model:

- `copecheck.com`
- `uk.copecheck.com`
- `countries.copecheck.com`
- `eu.copecheck.com`
- `policy.copecheck.com`
- `data.copecheck.com`
- `careers.copecheck.com`
- `quiz.copecheck.com`
- `layoffs.copecheck.com`

## Deployment Position

Codex can build the site and backend here.

Prototype deployment state as of 8 May 2026:

- Local workspace prototype exists in `copecheck/`.
- VPS prototype deployed to `/home/ben/infra/copecheck-codex`.
- `copecheck-codex.service` runs `codex_server.py` on `127.0.0.1:8105`.
- `/etc/cloudflared/config.yml` contains an ingress rule for
  `codex.copecheck.com -> http://localhost:8105`.
- Cloudflare DNS contains a proxied `codex.copecheck.com` CNAME pointing to
  the tunnel target.
- Public URL: `https://codex.copecheck.com`.

The live DNS record in the `copecheck.com` Cloudflare zone is:

```text
Type: CNAME
Name: codex
Target: 6b861c04-84fb-48ea-88c8-d72feaae48c8.cfargotunnel.com
Proxy: enabled
```

[redacted secret-like line]

Use OpenClaw as the scoring worker, not the public endpoint.

Flow now implemented:

1. Public site accepts a URL and creates a job.
2. VPS backend stores the job as `queued`.
3. The always-on Mac polls `/api/jobs/pending` over HTTPS.
4. The Mac worker opens the URL, extracts source text and candidate claims. Feed jobs
   can originate from Google Alerts RSS, Brave/GNews fallback, or direct user
   submissions.
5. The local worker scores through MiniMax/NVIDIA/Ollama/local model routes and
   returns strict JSON to `/api/jobs/{job_id}/result`.
6. The backend stores a sanitized public result.
7. Clean, high-confidence claims auto-publish.
8. Weak, spicy, ambiguous, or low-confidence claims go to review.

The Codex front page also includes a doom-market signal layer. It is a cheap,
no-auth data pass rather than an LLM scoring pass:

```text
Manifold search API
Polymarket Gamma public-search
ONS labour time series
curated YouGov public polling links
  -> tools/fetch_doom_markets.py
  -> data/doom-markets.json and data/doom-markets.js
  -> GET /api/doom-markets
  -> Codex "Doom Market Signals" section
```

Prediction markets are treated as radar, not proof. They surface priced
questions around AI jobs, unemployment, AGI capability, UBI, automation, and UK
labour pressure. The official ONS indicators anchor the page in observed UK
labour data, while YouGov remains a curated, attributed watchlist rather than a
blind scraper.

[redacted secret-like line]
local Mac worker. OpenClaw runs on the same machine and can invoke the same
worker API, while the public site never receives provider keys.

Current queue endpoints:

```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
```

## Suggested Backend Tables

```sql
create table channels (
  id text primary key,
  name text not null,
  hostname text not null,
  description text not null
);

create table source_jobs (
  id text primary key,
  submitted_url text not null,
  channel_id text references channels(id),
  status text not null default 'pending',
  created_at timestamptz not null default now(),
  completed_at timestamptz
);

create table sources (
  id text primary key,
  job_id text references source_jobs(id),
  canonical_url text not null,
  publisher text,
  title text,
  date_published date,
  raw_excerpt text
);

create table claims (
  id text primary key,
  source_id text references sources(id),
  channel_id text references channels(id),
  person text not null,
  role text,
  party_or_org text,
  claim_summary text not null,
  attributed_claim text not null,
  attribution_strength text not null,
  cope_score integer not null,
  band text not null,
  primary_mode text not null,
  secondary_modes jsonb not null default '[]',
  scapegoat_target text,
  structural_issue_ignored text,
  evidence_used jsonb not null default '[]',
  rationale_short text not null,
  confidence numeric not null,
  needs_review boolean not null default true,
  review_reason text,
  publication_status text not null default 'draft',
  created_at timestamptz not null default now()
);
```

## Subdomain Strategy

The app should use one codebase and one database. Each hostname maps to a
channel filter. `codex.copecheck.com` can expose the combined cockpit and admin
surface, while the existing hostnames continue to show their filtered public
views.

## Next Build Steps

1. Replace seed data with scraped current CopeCheck entries.
2. Promote reviewed queue results into the public signal panels.
3. Add SQLite locally, Postgres only if the unified network needs it.
4. Add admin auth before exposing review actions.
5. Add a scheduled RSS ingestion pass that submits feed URLs into the same queue.
6. Promote high-confidence doom-market items into `data.copecheck.com` and
   `capabilities.copecheck.com` when they materially update the thesis.

## Feed And Layoffs Layer

Current live feed sources:

- `copecheck/rss_feeds.json`: main AI displacement and workforce cope alerts.
- `copecheck-uk/rss_feeds.json`: UK employment, automation, and political cope alerts.
- `copecheck-layoffs/data/rss_feeds.json`: layoffs, redundancies, job cuts, and
  AI-replacement alerts.

The layoffs service also has:

- `scanner.py`: daily scanner using Google Alerts RSS plus Brave/GNews fallback.
- `layoff_oracle.py`: MiniMax M2.7 verdict scoring for layoff entries.
- `data/layoffs.json`: event ledger and summary metrics.

Codex should show layoffs as a first-class channel and treat RSS intake as the
front edge of the scoring factory.
```
