Auto Research
Turns an ambiguous research or engineering task into a confirmed plan, maintains durable state in ./auto_research, advances work through explicit checkpoints, and validates progress against agreed success criteria.
Core Rules
- Treat
/autoresearch <TaskDescription>as the workflow trigger, not as a shell command. - Do not rely only on conversation memory for critical facts.
- Persist goals, plans, findings, decisions, validation status, blockers, and handoff notes under
./auto_research. - Reread persistent state before every major step.
- Ask the user to confirm unclear goals, scope changes, architectural decisions, destructive actions, and git commits.
- Continue iterating until the Definition of Done is satisfied, the task is blocked, or the user stops the workflow.
- Use git commits only at meaningful checkpoints and only after explicit user authorization unless the session contract pre-approves checkpoint commits.
State Files
Session directory: ./auto_research/sessions/<YYYY-MM-DD>-<task-slug>/
| File | Purpose |
|------|---------|
| contract.md | confirmed goal, Definition of Done, scope, constraints, validation requirements, commit policy |
| plan.md | decomposed phases, task breakdown, ordering, dependencies, active workstream |
| state.md | current status, next action, blockers, open questions, last checkpoint |
| findings.md | evidence from code, docs, commands, web, issues, PRs, logs, or experiments |
| decisions.md | user-confirmed decisions, tradeoffs, rejected options, rationale |
| validation.md | tests, checks, reproduction steps, acceptance evidence, final verification |
| handoff.md | final summary, remaining risks, follow-ups, useful references |
| artifacts/ | optional supporting outputs too large for main notes |
Also maintain ./auto_research/index.md listing active and completed sessions.
[Entrypoint: agentlang]
def: ParseRequest(task)
- extract primary objective from task description
- identify expected deliverable, target repo/system, constraints, deadlines, and non-goals
- determine whether code changes are expected
- determine whether commits are allowed during the workflow
- identify what evidence will prove success
- if any item is unclear: confirm: clarify ambiguous items before proceeding
def: CreateState(task_slug)
- create session directory
./auto_research/sessions/<YYYY-MM-DD>-<task_slug>/ - initialize contract.md, plan.md, state.md, findings.md, decisions.md, validation.md, handoff.md
- update
./auto_research/index.mdwith new session entry - return session path
def: ConfirmContract
- write contract.md with goal, Definition of Done, scope, constraints, validation, and git policy
- confirm: please review and confirm the research contract
- if user corrects: update contract.md with corrections
- return confirmed contract
def: DecomposeTask
- read contract.md for goal and scope
- create plan.md with phased task breakdown:
- Phase 1: Context Gathering — identify relevant files, docs, APIs, issues
- Phase 2: Approach Selection — list viable approaches, risks, decision points
- Phase 3: Execution — perform highest-value research or implementation steps
- Phase 4: Validation — run agreed checks, record evidence
- Phase 5: Handoff — summarize outcome, document remaining risks
- return plan
def: ThinkBeforeCoding
- state assumptions explicitly
- if multiple interpretations exist: present them to user, don't pick silently
- if a simpler approach exists: say so and push back when warranted
- if something is unclear: confirm: name what's confusing and ask
- comprehensively decompose the problem to resolve the root cause
def: Rehydrate
- read contract.md
- read plan.md
- read state.md
- read decisions.md
- compare intended next action against the Definition of Done
- if there is drift: stop and correct the plan before continuing
- return current context
def: ExecuteStep
- select the next highest-value task from plan.md
- call ThinkBeforeCoding: ensure clarity before action
- perform only the next bounded action
- record evidence or output in the appropriate state file
- update state.md with status, next action, and blockers
- update decisions.md only for user-confirmed decisions
- compare progress against the Definition of Done
- if path or scope is unclear: confirm: how should we proceed?
- return progress status
def: GitCheckpoint
- call Rehydrate: ensure current state is fresh
- inspect git status, staged and unstaged diffs
- exclude unrelated files, secrets, local config, and noisy artifacts
- run relevant validation if available
- draft concise commit message focused on why the change matters
- confirm: approve this commit?
- create commit
- return commit result
def: Complete
- verify Definition of Done is satisfied
- record evidence in validation.md
- document important findings and decisions
- document open risks
- write handoff.md with final summary, remaining risks, follow-ups
- update index.md with completion status
- return final summary in format: Result, Evidence, Decisions, Remaining Risks
Main
- call ParseRequest: parse the
/autoresearch <TaskDescription>input - call CreateState: create persistent state directory for this session
- call ConfirmContract: write and confirm the research contract with user
- call DecomposeTask: decompose task into actionable plan
- repeat until Definition of Done is satisfied or user stops:
- call Rehydrate: reread persistent state
- call ExecuteStep: execute next bounded action
- if same gap remains after 2 attempts: confirm: blocked — how to proceed?
- if checkpoint reached and commits allowed: call GitCheckpoint
- call Complete: finalize workflow and deliver summary
- return final result
微信扫一扫