Source Compile Automation Setup

How to set up the source-compile automation in Codex and Cursor Automations.

What It Does

The source-compile automation closes the loop between raw data collection and knowledge compilation:

  1. Syncs X bookmarks and indexes Codex, Cursor, and Claude conversations in place
  2. Enriches X bookmarks with resolved links, linked READMEs/articles/transcripts, author self-threads, author artifact replies, and demo media
  3. Researches promoted bookmark entities online before writing durable pages
  4. Audits recent agent sessions for friction patterns and skill opportunities
  5. Proposes exact stable-owner, skill, workflow, and router changes through Daily Brief
  6. Defers writeback to a separate exact-approval apply/verify path

The local runner can index and selectively replay the actual Codex, Cursor, and Claude stores; the cloud runner cannot access those private local paths and must not claim session coverage. Source: automations/source-compile.md; automations/source-compile.cursor-automation.md

Runner Decision

Runner Use when Limitation
Local Codex / local agent Need local transcripts, local skills, X bookmark sync, or direct filesystem access Must run on Kevin's machine
Cursor cloud automation Raw/enriched repository sources are already committed and task can use GitHub/Firecrawl Cannot read local ~/.cursor, ~/.codex, ~/.claude, browser profiles, private session analyses, or uncommitted files
Manual supervised run Source quality or filing decisions need Kevin review Slower but safer for new source classes

If the run discovers a repeated compile pattern, update or create the relevant skill. Source compile is not only ingestion; it is also skill maintenance.

Manual Trigger

In any agent session (Cursor, Codex, Claude Code):

Run the source-compile automation.

The agent reads automations/source-compile.md and follows the 5-phase pipeline.

Recover a missing task or project month

For one completed Codex task, paste its full task URL or native ID:

npm run brain -- sessions index
npm run brain -- replay sessions --id <task-url-or-id>
npm run brief -- compile-analysis .brain/analyses/<analysis_id>.json

For the month when the wiki was absent, select by provider, project/workspace, and exact dates before replaying bounded batches:

npm run brain -- sessions list --since <start-ISO> --until <end-ISO> --workspace <project> --limit 100 --json
npm run brain -- replay sessions --since <start-ISO> --until <end-ISO> --workspace <project> --limit 25

If the task appears in the Codex app but no local provider JSONL exists, export or otherwise authorize a private capture and add it with sessions index --path <export> --provider codex. Task-catalog metadata proves discovery only; the captured turns and their repository/test artifacts are the evidence. Replayed signals remain private candidates until review and verified owner writeback.

Cursor Automations (Cloud Cron)

  1. Go to cursor.com/automations
  2. Create new automation
  3. Name: Source Compile
  4. Schedule: Daily-compatible for cloud, or on push to raw/
  5. Repo: kevin-wiki
  6. MCPs: GitHub
  7. Instructions: Copy the text inside the code block from automations/source-compile.cursor-automation.md

Limitation: Cloud sandbox cannot access local paths (~/.cursor/, ~/.codex/, ~/.claude/) or .brain/. It can process committed raw sources and validated redacted review receipts, but agent-session replay stays local.

Codex Automation (Local Cron)

Codex runs the local connector every four hours. Register and update it through the Codex automation API/UI; never mutate the scheduler database directly. The live job is wiki-source-compile, and its prompt begins with AUTOMATION_ID: source-compile so npm run audit:automations can bind the scheduler entry to the canonical V2 definition.

Because the Codex project registry currently points at the main checkout, the prompt also says Work only in /Users/kevinliu/repos/Kevin-Wiki-v3. The audit fails readiness if that exact checkout pin disappears. The canonical task logic remains in automations/source-compile.md; the scheduler prompt is only a thin wrapper.

The job is proposal-only. It may sync, enrich, index, replay bounded cohorts, research, create validated source-review receipts, and deliver Daily Brief proposals. It may not update wiki owners, skills, routing, absorption markers, indexes, state change/verification clocks, commits, or merges. Those belong to a separate approved-mutation path consuming Kevin's exact durable approval receipt.

Verifying It Works

After the first automated run, check:

npm run audit:automations
npm run brief -- list
npx tsx scripts/doctor.ts --only automations --verbose

Done Criteria

A source-compile run is complete only when:

  • output file exists under outputs/<date>/source-compile/
  • source revisions and replay fingerprints are content-bound
  • every accepted candidate has a validated source-review receipt
  • every proposal names stable owners, exact source revisions, patch hash, proof, strongest objection, authority, and rollback
  • the Daily Brief delivery receipt exists
  • only the research/run clock advances; changed/verified clocks remain untouched
  • blocked/no-op runs preserve evidence and a concrete reopening condition
  • a later approved apply runs the affected owner doctors, index/projection/QMD refresh, absorption markers, and canonical change log

Timeline