协作头脑风暴
brainstorming
在实现前澄清需求、探索设计选择,并形成清晰的开发方向。
frontier-plan-opencode-executor【开发与工程】Use when given a detailed implementation plan from a frontier AI to execute inside OpenCode with non-frontier coding models. Validates the plan against the real repository, breaks it into safe steps, verifies each step, inspects diffs, and prevents destructive changes. Triggers on: receiving a multi-step plan from Claude Opus/GPT-5/etc., executing a …
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
The frontier plan is a strong hypothesis, not ground truth.
Execute the intent of the plan step by step, but validate every instruction against the actual repository before editing code. Frontier AI plans frequently fail on: nonexistent file names, invented imports, unavailable libraries, patterns that don't match the repo, missing tests, idealized architecture, and breaking internal APIs.
Never batch large changes. Never skip verification. Never hide uncertainty. Never perform destructive actions without explicit approval.
Do NOT use for:
Before touching any file, understand the repo state and detect pre-existing failures.
1. git status --short # Is the repo clean?
2. Inspect package.json # Available scripts, dependencies
3. Inspect AGENTS.md, README.md # Project conventions, commands
4. Detect available verification commands from package.json scripts
5. Run the cheapest baseline verification if available (lint or typecheck)
If baseline already fails:
Dangerous state detection:
git status shows uncommitted changes unrelated to the plan, warn the userCheckpoint recommendation:
Auto-commit and auto-push are enabled by default unless the user explicitly disables them.
The agent should commit each verified logical unit of work and push it to the active remote working branch so the user can review the history later.
Before implementation:
main, master, production, release, or another protected/mainline branch, create a new working branch inferred from the plan;If there are pre-existing uncommitted changes:
Commit only after:
Use Conventional Commits:
type(scope): concise imperative summary
Examples:
feat(auth): add session validation helper
fix(api): handle empty webhook payload
refactor(billing): extract invoice mapper
test(auth): cover expired session flow
Read the ENTIRE plan. Extract ordered steps. For each step, run a reality check:
| Check | Question |
|---|---|
| Files | Do referenced files exist in the repo? |
| Libraries | Are referenced libraries in package.json? |
| Patterns | Does the repo already have an equivalent utility/component? |
| Commands | Are the plan's verification commands available? |
| Dependencies | Does this step depend on a previous step? |
| Risk | Low / Medium / High — how likely to break existing behavior? |
If a step references missing files, nonexistent libraries, outdated patterns, or unavailable commands: adapt the step before implementing, preserving the plan's intent.
Use todowrite (OpenCode's task list tool) if available.
If todowrite is unavailable (e.g., in subagents where it's disabled by default):
Each item must include: the implementation action, the verification method, and expected files touched.
Mark the current step as in_progress. Implement ONLY that step.
After each step, run the narrowest meaningful verification. Not "lint everything" every time.
| Change Type | Minimum Verification | Stronger Verification |
|---|---|---|
| New file/component | lint or typecheck | affected typecheck |
| Type/interface change | typecheck | affected tests |
| Logic/function change | targeted unit test | full test suite |
| API/server change | targeted integration test | build + endpoint check |
| UI change | typecheck + build | visual/manual smoke check |
| Config/build change | build | clean install/build if needed |
| Database/schema change | dry-run/check command | user approval required |
If no automated verification exists for a step: perform a manual review and state precisely what you checked.
If verification fails:
First failure — fix and re-verify:
Repeated failures — do not keep patching blindly. See "Repeated Failure Handling" below.
Critical: Never make verification pass by weakening assertions, deleting tests, removing behavior, changing public APIs, suppressing errors, or hiding failures — unless the plan explicitly requires it AND the user approves. Making the alarm stop is not the same as fixing the problem.
After verification passes, inspect what actually changed:
git diff --stat # Which files changed?
git diff # When the diff is small enough to review
Confirm:
If the diff exceeds the expected scope, stop and correct before continuing.
Only when implementation, verification, AND diff inspection are clean:
completedin_progressAfter all steps:
If verification repeatedly fails for the same underlying reason, do not continue applying small blind fixes. The goal is to detect whether you are learning something new between attempts or just thrashing randomly.
When a step fails multiple times:
git diff, read related types, interfaces, functions.Critical rule: Do not repeat the same fix strategy unless new information was discovered from:
If no new strategy emerges after multiple attempts, stop and report the blocker clearly:
Blocker:
- verification command: `npm run build`
- failing file: `src/app/page.tsx`
- root issue hypothesis: React Server Component importing client-only hook
- attempted strategies:
1. moved import to client component
2. isolated hook into separate file
3. checked existing patterns in repo
- reason for stopping:
no consistent pattern in repo to resolve boundary safely
- likely next action:
user review or architectural clarification
A clear blocker report is always better than repeating "still failing" while guessing.
Frontier AI plans frequently conflict with the actual codebase. When they do:
import { X } from 'uninstalled-lib' but it's not in package.json"useToast(), your adaptation should still export useToast(), even if internals differCritical rules:
These commands require the user to say "yes" before running:
Destructive:
rm -rfgit reset --hardgit clean -fdgit push --forceInstallation (changes lockfiles):
npm installpnpm installyarn installbun installnpm audit fixDatabase / Infrastructure:
prisma migrateprisma db pushsupabase db pushdocker compose down -vConfiguration:
.env filesMass changes:
If unsure whether a command is safe, ask before running.
| Mistake | Reality |
|---|---|
| "The frontier AI said it, so it must be right" | Frontier plans are hypotheses. Validate against the real repo. |
| "I'll verify everything at the end" | Errors compound. Verify each step with the right granularity. |
| "I already read the plan, I can implement it all at once" | Batch implementation = batch errors + harder debugging. |
| "I'll fix pre-existing lint errors while I'm here" | Unrelated cleanup masks what your changes actually did. Don't. |
| "This step is simple, I don't need to check git diff" | Simple edits can accidentally delete code or format unintended files. |
| "I'll install the missing library the plan references" | Ask first. The library may be intentionally absent or not approved. |
| "npm run build is the only verification that matters" | Build is slow and broad. Use lint/typecheck for intermediate steps. |
| "If it fails, I'll just tweak and re-run until it passes" | Blind patching without new information is thrashing. Re-read errors. Form a new hypothesis first. |
| "The same error again, let me try a different small change" | Same error + same strategy = same result. Change the strategy, not the patch. |
git diff --stat prevents hours of debugging.| Phase | Action | Tool |
|---|---|---|
| Preflight | git status, detect commands, baseline check | Bash |
| Parse + Reality Check | Read plan, validate each step against repo | Read + Glob |
| Track | Create todowrite or markdown checklist | todowrite |
| Implement | One step, minimal change, existing patterns | Read + Edit/Write |
| Verify | Tiered check per change type | Bash |
| Diff | git diff --stat, confirm scope | Bash |
| Confirm | Mark complete, summarize, next step | todowrite |
| Final | Full verification + summary report | Bash |