This checkout now includes a Codex-driven research runner for long-form web research jobs. The original prepare.py / train.py demo from the upstream repo is still here, but the added workflow in this repo is aimed at prompts like large equipment inventories, consular directories, industry datasets, and similar structured research tasks.
program.md- reusable research instructions that every run prepends to your specscripts/run_research.py-doctor, one-shotrun, and queuedqueueexecutionspecs/heavy_construction_industrial_equipment.md- your heavy construction example as a reusable templatejob_templates/*.json- example queue jobs you can drop intoqueue/pending/
The idea: give an AI agent a small but real LLM training setup and let it experiment autonomously overnight. It modifies the code, trains for 5 minutes, checks if the result improved, keeps or discards, and repeats. You wake up in the morning to a log of experiments and (hopefully) a better model. The training code here is a simplified single-GPU implementation of nanochat. The core idea is that you're not touching any of the Python files like you normally would as a researcher. Instead, you are programming the program.md Markdown files that provide context to the AI agents and set up your autonomous research org. The default program.md in this repo is intentionally kept as a bare bones baseline, though it's obvious how one would iterate on it over time to find the "research org code" that achieves the fastest research progress, how you'd add more agents to the mix, etc. A bit more context on this project is here in this tweet and this tweet.
- Python 3.10+
- Codex CLI on
PATH - Working Codex auth
- Web search enabled at run time for research-heavy jobs
Run this once from the repo root:
python scripts/run_research.py doctor --searchThat verifies Python, codex, and a live web-enabled codex exec call.
Example using the tracked heavy-equipment template:
python scripts/run_research.py run `
--spec specs/heavy_construction_industrial_equipment.md `
--phase "1: Heavy Equipment" `
--depth seed `
--tag heavy-equipment-phase1-seedFor a deeper pass:
python scripts/run_research.py run `
--spec specs/heavy_construction_industrial_equipment.md `
--phase "1: Heavy Equipment" `
--depth exhaustive `
--tag heavy-equipment-phase1-exhaustiveYou can also inject any template value with repeated --var KEY=VALUE.
This runs the heavy-equipment template phase by phase, then exports merged CSV, JSON, manifest, and combined markdown files under results\datasets\.
The default path is intentionally fast and shallow: --depth seed plus the script default model (gpt-5.4-mini) is good for getting a structured inventory quickly, not for maximizing image coverage.
python scripts/build_heavy_equipment_dataset.py --depth seedIf you want the builder to revisit only unresolved image rows after the first pass, enable the targeted recovery loop:
python scripts/build_heavy_equipment_dataset.py `
--depth seed `
--image-followup `
--image-followup-rounds 2 `
--max-unconfirmed-images 150Use --max-unconfirmed-images when you want the script to fail loudly instead of treating a partially covered dataset as success.
This repo now includes a lightweight run-history dashboard that reads the existing results\ artifacts directly. It does not require pi, a web framework, or extra build steps.
Print a terminal summary:
python scripts/research_dashboard.py summaryExport the HTML dashboard:
python scripts/research_dashboard.py export-htmlServe it locally from the repo root:
python scripts/research_dashboard.py serveBy default that writes results/dashboard/index.html and serves the repo at http://127.0.0.1:8765/results/dashboard/index.html.
This repo also includes a commit-bundle planner for reviewable PRs. It looks at commits on the current branch that are not in the base ref, ignores metadata-heavy paths like results/ and .vscode/, and groups selected commits into:
consolidated- one PR with all selected commits plus required dependenciesstacked- one PR per selected commit, subtracting commits already emitted in earlier PRsindividual- one independent PR bundle per selected commit
List branch-only commits:
python scripts/research_pr_plan.py listPlan a consolidated PR from all branch-only commits:
python scripts/research_pr_plan.py plan --allPlan stacked PRs from specific commits:
python scripts/research_pr_plan.py plan `
--hash abc1234 `
--hash def5678 `
--mode stackedTo make the PR planner useful before you manually commit changes, there is also a worktree snapshot helper. It groups the current dirty tree into reviewable buckets such as scripts, specs, job_templates, and docs, while ignoring metadata-heavy paths like results/ and .history/ by default.
Preview the proposed groups:
python scripts/research_snapshot.py planPreview the commits for a subset of groups:
python scripts/research_snapshot.py commit `
--group scripts `
--group docsActually create the snapshot commits:
python scripts/research_snapshot.py commit --yesThe helper refuses to run if you already have staged changes, so it does not trample a manual commit in progress.
To turn a PR plan into real local review branches, use the review-branch generator. It creates fresh branches from the base ref in temporary worktrees and cherry-picks exactly the bundle commits, so the branch contents match the planner output instead of inheriting unrelated local history.
Dry-run a consolidated branch:
python scripts/research_review_branches.py --allCreate stacked review branches:
python scripts/research_review_branches.py `
--all `
--mode stacked `
--yesBy default the branches use a review/<repo-name>/... prefix. Use --prefix to override that, and --force if you need to recreate an existing review branch set.
- Create
queue\pending\if it does not exist. - Drop JSON job files into it using the same shape as
job_templates\*.json. - Start the worker:
python scripts/run_research.py queue --watchProcessed jobs are moved to:
queue\completed\queue\failed\
Each run creates a timestamped folder under results\ containing:
prompt.txt- full prompt sent to Codexresolved_spec.md- spec after${var}substitutionfinal_report.md- last Codex message, intended as the deliverablecodex.log- streamed CLI output for debuggingrun.json- metadata, paths, and exit code
results/ and queue/ are already ignored by git.
- Edit
program.mdto change the baseline research behavior. - Add new templates under
specs/. - Create queue jobs that point to those specs and inject variables through the
varsobject.
- The runner uses
codex --search execso the model can browse during research. - The default model is
gpt-5.4, but you can override it with--model. - The repo's original ML training files were left untouched, so you can still use the upstream experiment loop if needed.