thegreencedar/codex-autoresearch
Run or resume a measured improvement loop in a local project. Use for benchmark-driven optimization, qualitative quality-gap research, packet logging, dashboard readouts, recovery, and review-branch finalization backed by autoresearch session files.
npx skills add https://github.com/TheGreenCedar/codex-autoresearch --skill codex-autoresearch
Turn an improvement request into a measured, resumable loop. Report the metric, decision, evidence, next action, and real publication state. Do not replace them with a generic claim that the project is "better."
setup -> doctor -> next -> log -> state -> finalize-preview
Use this as the only Codex-facing Autoresearch skill. Do not route to retired subskills, slash commands, or MCP surfaces.
git status --short --branch; preserve unrelated changes.node plugins/codex-autoresearch/scripts/autoresearch.mjs ...node scripts/autoresearch.mjs ...For a new session:
prompt-plan or setup-plan when one of those is unclear. Both are read-only.setup only after the contract is clear enough to create files.commitPaths before a keep may commit source changes.doctor --cwd <project> --check-benchmark --explain before trusting the first packet.next, then log --from-last --status measure.For an existing session:
autoresearch.md, autoresearch.jsonl, autoresearch.ideas.md, and the active autoresearch.research/<slug>/ folder when present.state --report, recommend-next --compact --operator-checklist, and doctor --explain.These defaults are bounded and share one resolvedDecision; use state --json-full or doctor --json-full only for complete machine diagnostics.
goalFrame.authoritativeGoal authoritative unless the user deliberately replaces it. If a new request would change the benchmark, metric, edit scope, or final claim, treat it as a possible replacement and resolve that choice before packet work.Happy path from the package root:
node scripts/autoresearch.mjs setup --cwd <project> --name "<session>" --metric-name <metric> --direction lower --benchmark-command "<command>" --checks-command "<checks>"
node scripts/autoresearch.mjs config --cwd <project> --commit-paths "<editable-paths>"
node scripts/autoresearch.mjs doctor --cwd <project> --check-benchmark --explain
node scripts/autoresearch.mjs next --cwd <project>
node scripts/autoresearch.mjs log --cwd <project> --from-last --status measure --description "Baseline measurement"
node scripts/autoresearch.mjs state --cwd <project> --report
After the baseline, implement one bounded hypothesis inside the configured paths, then run and log one packet:
node scripts/autoresearch.mjs next --cwd <project>
node scripts/autoresearch.mjs log --cwd <project> --from-last --status keep --description "<what changed>" --asi-json-file <path>
node scripts/autoresearch.mjs state --cwd <project> --report
The ASI file must contain the real hypothesis, evidence, rollback reason when rejected, and next action. Use discard, crash, or checks_failed instead of keep when the evidence requires it. Run finalize-preview only when canonical state routes to finalization.
Use next for a reusable packet. Use benchmark-inspect for a bounded diagnostic probe; the old run name fails fast with that migration and is scheduled for removal after 2026-10-01.
After next:
--from-last; do not copy parsed metrics back into the command.--asi-json-file <path> when inline JSON would be fragile in the current shell.When accepted work was committed outside Autoresearch, verify the commit and log the keep with --commit <hash> so finalization retains real commit evidence.
| Status | Use it for |
| --- | --- |
| measure | Baselines, no-change checks, environment probes, and diagnostics. Never stage, commit, revert, or finalize it. |
| keep | A finite primary metric, passing required checks, and a change worth preserving inside safe Git scope. |
| discard | A finite metric and a change not worth keeping; logging may clean the configured or explicit experiment paths. |
| crash | A benchmark that failed before usable metric evidence existed. Do not invent a sentinel value; logging may clean the configured or explicit experiment paths. |
| checks_failed | A metric exists, but the required correctness proof failed; logging may clean the configured or explicit experiment paths. |
Obey these brakes:
--packet-env-mode inherit only when the benchmark genuinely needs the caller's full environment.termination_failed as a hard stop. Preserve partial packet evidence, verify the reported PID and descendants are absent, then remove only the retained progress marker before another next.process_lifecycle blockers as process truth: verify absence before recording a later terminal row. Never infer active residue from historical prose, and never repair a malformed lifecycle row by weakening validation.--cwd; require the user's explicit intent before passing --allow-outside-workdir.doctor runs must not refresh remote catalogs. Use doctor --revalidate-catalog only for an explicit public-HTTPS provenance check; internal catalogs stay local files.continuation.shouldContinue=true, but run a packet only when loopContract.canRunNextPacket=true; do not report completion when continuation.forbidFinalAnswer=true.benchmark-lint as a parser check, not proof that the benchmark represents the product.review_required results provisional until the structured note records the review.Use loop operations for partial results, failed checks, ledger repair, budgets, Git scope, and segment changes. Use dashboard and trust for fixed controls, runtime drift, protected paths, redaction, and promotion claims.
Use a quality-gap loop for docs, UX, product study, architecture, or research:
node scripts/autoresearch.mjs research-start --cwd <project> --slug <slug> --goal "<goal>"
Keep dated claims in sources.md, judgment in synthesis.md, and accepted work in quality-gaps.md. Preview additions with gap-candidates, then log implementation or rejection with ASI.
Each gap has a stable ID. A checked Markdown box is only a provisional candidate; record the evidence-bearing outcome with gap-decide --gap-id <id> --decision implemented|rejected --evidence <ref> --validation <result>. The append-only decision ledger is the acceptance authority.
If the project already has an executable outcome metric, research-start preserves it as primary and uses quality_gap as secondary acceptance evidence. Treat quality_gap=0 as closure of the accepted checklist for this round only after its decisions are accepted. Read researchIntegrity and its missing-proof warnings before deciding whether the wider question is finished or needs another discovery round.
Read research, lanes, and finalization before fanout, parallel implementation, or review-branch work.
node scripts/autoresearch.mjs serve --cwd <project>
Verify the server and give the user its http://127.0.0.1:<port>/ URL. Use export for a portable snapshot.
Keep both forms read-only. Run setup, packets, logging, gap work, export, and finalization through the CLI. A static export cannot prove current packet freshness.
finalize-preview --cwd <project> before branch creation.current-tree-finalization, treat it as a separate recovery contract: review the entire clean non-session branch diff, exact file set, exclusions, claim evidence, and generated plan, then use finalize-current-tree --cwd <project> --exclude-session-artifacts.Report the real runway: preview, approved, branches created, locally verified, pushed or PR, CI, merged, merge verified, then cleanup. Do not collapse those stages or suggest cleanup before the merge is verified.
Run codex-goal-brief and inspect top-level canMarkCodexGoalComplete and completionBlocker before the parent calls update_goal(status="complete"). Use --enforce-completion when an invalid completion claim must fail the command. Keep Goal state in Codex; use Autoresearch only for the evidence.
When subagents are explicitly used, give every lane a scope, evidence source, decision, artifact, and test. Scout commands must match lane-runner's strict Git read-only argv allowlist; do not use shell or interpreter escapes. Treat Git porcelain and write-scope checks as best-effort detection, not process/filesystem containment, and use disposable worktrees for implementation lanes. Do not nest subagents or overlap write scopes. Keep the benchmark, packet decision, integration, and final verification in the parent.
Before claiming plugin work is done, run from plugins/codex-autoresearch:
npm run check
For docs-only work, also inspect the rendered Markdown and command text, then run git diff --check. The package gate checks local Markdown links.
Take thegreencedar/codex-autoresearch from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.