codex-autoresearch
GitHub用于管理本地项目的重复测量实验循环。通过路由判断直接执行或建立受控的实验契约,支持基准测试、指标评估和自动迭代改进。
Trigger Scenarios
Install
npx skills add TheGreenCedar/codex-autoresearch --skill codex-autoresearch -g -y
SKILL.md
Frontmatter
{
"name": "codex-autoresearch",
"description": "Triage improvement work and run or resume accepted measured loops in a local project. Architecture, documentation, UX, product study, open research, taste, and one-shot fixes stay direct unless the user explicitly requests repeated measurement with a complete experiment contract."
}
Codex Autoresearch
Decide fit before exploring the repository. Autoresearch governs repeated measured experiments; it does not take over every task that mentions research, quality, or improvement.
Use this as the only Codex-facing Autoresearch skill. Do not route to retired subskills, slash commands, or MCP surfaces.
Route before discovery
Make one read-only fit call before benchmark discovery, recipe lookup, repository scanning, default inference, or setup:
node scripts/autoresearch.mjs prompt-plan --cwd <project> --prompt "<request>"
Follow its typed disposition:
continue-direct: use the direct evidence capsule below. Create no Autoresearch files, packets, commits, dashboards, research folders, or finalization state. Leave an unrelated session untouched.needs-user: ask only for the reported missing fields or conflicts. Do not fill them from plausible repository files or inferred defaults.run-loop: treat the returned contract as an in-memory candidate. Only now inspect the owning repository and establish or resume the accepted contract through setup or an explicit segment transition.
An existing session is matching only when repository, checkout, goal, metric semantics, evaluator, checks, and scope are compatible. Shared words are not evidence of a match. Replacing or abandoning a session requires explicit user intent.
An explicit loop request with an incomplete contract is needs-user, never a half-configured loop.
Continue directly when the loop does not fit
Use this evidence capsule:
- State the requested outcome.
- Identify the main uncertainty.
- Gather the cheapest evidence that can resolve it.
- Perform the direct task.
- Verify the result and bound the claim.
Direct work may finish an implementation, explanation, review, or ordinary correctness check. It may not claim measured improvement or authorize a keep without accepted evaluator and checks evidence.
Architecture, documentation, UX, product study, open-ended research, taste, bugs, quality, delight, and generic improvement language do not independently select a loop. A qualitative gap loop is appropriate only when the user explicitly wants repeated evaluation against a stable, accepted checklist.
Establish the accepted experiment
Once fit is run-loop:
- Identify the repository and child package that own the work.
- Run
git status --short --branchand preserve unrelated changes. - Establish one complete contract: goal, repository and worktree identity, metric semantics, evaluator, independent checks, editable and protected scope, noise model, keep rule, stop rule, and enforceable budgets.
- Use
setupfor a new session or an explicit segment transition for a replacement contract. Do not execute a packet untilstate --reportshows an accepted contract. - Configure
commitPathsbefore a keep may commit changes.
The accepted evaluator and checks are the only execution authority. CLI, config, wrapper, separator, command-file, or environment-file overrides may run only when they reproduce the accepted execution digest exactly. Otherwise stop and transition the contract explicitly.
Metric names carry no semantics. A name containing quality, score, precision, or similar text does not imply a direction, threshold, target, or perfect value.
Unknown noise permits qualification baselines. It does not permit a keep until the required repeats establish a valid comparison. Estimated model tokens or calls are advisory unless trusted host telemetry makes them enforceable.
Resume from one canonical decision
For an existing matching session, run one bounded read:
node scripts/autoresearch.mjs state --cwd <project> --report
Do not reread raw session files and separately ask state, recommendation, doctor, watchdog, portfolio advice, and finalization to vote on the next step. The report projects one DecisionPlan with:
- phase and canonical action
- blocker code and capability-scoped diagnostics
- loop and parent dispositions
- contract digest and evaluator identity
- required evidence
Follow that decision. Use doctor only when the decision asks for a diagnostic or when the user explicitly requests one. If terminal and dashboard semantic fields disagree, stop mutation and diagnose the projection.
Read loop operations only when the canonical action requires packet, recovery, budget, Git-scope, or segment detail.
Run one bounded packet
The usual accepted loop is:
setup -> state -> next -> log -> state -> finalize-preview
next may execute only the accepted evaluator and accepted checks, using their accepted execution specifications. After it returns:
- Inspect the metric, checks, artifacts, diff, and Git state.
- Log with
--from-last; do not retype parsed metrics. - Record the real hypothesis and learning assessment. Learning defaults to
none;causalordiscriminatingrequires evidence and a concrete changed belief. - Read the resulting decision before doing more work.
| Status | Use it for |
|---|---|
measure |
Baselines, qualification repeats, no-change checks, and diagnostics. Never authorize a keep. |
keep |
A candidate evaluated by the accepted contract, with all checks, metric comparison, and noise qualification satisfied. |
discard |
A finite candidate result that is not worth keeping. |
crash |
Evaluation failed before usable metric evidence existed. Do not invent a sentinel metric. |
checks_failed |
A metric exists, but accepted correctness checks failed. |
Baselines and accepted candidate packets consume packet budget. Manual observations and read-only diagnostics do not. An imported commit can authorize a keep only after the accepted evaluator and checks evaluate that commit.
Run at most one packet per decision. Remaining budget is never a reason to run another. Two eligible no-learning candidates pause packet work. Two failures in the same registered layer pause packet work unless that failure class's relevant preconditions changed. A pause hands control back to direct work; it does not trigger fanout, diversification, or an automatic segment transition.
Recover logging exactly once
log is a staged transaction. If it is interrupted, rerun the same log arguments. Do not reconstruct the transaction by hand or change the status, description, candidate, or evidence while its receipt is pending.
The retry verifies completed Git and ledger stages, resumes unfinished tracked and untracked cleanup independently, and converges to at most one commit and one ledger event. A pending or inconsistent transaction blocks unsafe mutation, finalization, and session-dependent final claims.
Evidence outputs must stay under the approved artifact root, outside editable and protected scope, and resolve without symlink or junction escape.
Keep execution boundaries intact
- Packet processes receive the minimal environment by default. Inherit the caller environment only when the accepted contract requires it.
- A configured working directory stays inside
--cwdunless the user explicitly authorizes otherwise. - Protected evaluator, check, fixture, parser, dataset, environment-file, or runner drift blocks packet execution and keep authorization.
benchmark-lintchecks parsing; it does not prove the benchmark represents the product.- The dashboard is read-only. It may redact executable commands, but its decision ID, phase, action kind, blocker code, parent disposition, contract digest, and evaluator identity must agree with the terminal.
- Direct handback after a pause may finish ordinary work, but it must not make a measured-improvement claim outside accepted evidence.
Use dashboard and trust for runtime drift, protected paths, redaction, and dashboard semantics.
Finalize accepted work
Run finalize-preview --cwd <project> only when the canonical decision permits finalization. Normal finalization includes accepted current keeps and excludes session artifacts. finalize-current-tree remains a separate recovery contract for an explicitly reviewed clean non-session diff.
Ask before creating branches unless the user already approved finalization. Report preview, local branch creation, push or PR, CI, merge, merge verification, and cleanup as separate states.
Read research, lanes, and finalization only when an accepted loop explicitly requires qualitative gap work, parallel lanes, or branch finalization.
Load only what the decision requires
- first accepted loop: Start
- packet, recovery, or resume detail: Operate
- safety and runtime trust: Trust
- review branches: Finish
- symptom lookup: Troubleshooting
- cross-surface disagreement: Control plane
Before claiming plugin work complete, run from plugins/codex-autoresearch:
npm run check
Dashboard-visible changes also require a served or exported visual inspection and npm run test:dashboard:browser. Run git diff --check for every change.
Version History
-
6b25354
Current 2026-09-03 04:03
新增前置路由检查(prompt-plan),区分直接执行与实验循环;强化契约完整性验证,禁止半配置循环。
- b8f12dc 2026-07-24 11:45


