en un clic
comet-build
// Comet Phase 3: Plan and Build. Invoke with /comet-build. Create plans and select execution method (subagent or direct) for implementation.
// Comet Phase 3: Plan and Build. Invoke with /comet-build. Create plans and select execution method (subagent or direct) for implementation.
| name | comet-build |
| description | Comet Phase 3: Plan and Build. Invoke with /comet-build. Create plans and select execution method (subagent or direct) for implementation. |
Execute entry verification:
COMET_ENV="${COMET_ENV:-$(find . "$HOME"/.*/skills "$HOME/.config" "$HOME/.gemini" -path '*/comet/scripts/comet-env.sh' -type f -print -quit 2>/dev/null)}"
if [ -z "$COMET_ENV" ]; then
echo "ERROR: comet-env.sh not found. Ensure the comet skill is installed." >&2
return 1
fi
. "$COMET_ENV"
bash "$COMET_STATE" check <name> build
Proceed to Step 1 after verification passes. The script outputs specific failure reasons when verification fails.
Idempotency: All build phase operations can be safely re-executed. Read .comet.yaml phase field to confirm still in build, read plan header base-ref, then read tasks.md to find the first unchecked task. Already-committed tasks must not be re-committed.
Immediately execute: Use the Skill tool to load the superpowers:writing-plans skill. Skipping this step is prohibited.
After the skill loads, follow its guidance to create a plan. Plan requirements:
docs/superpowers/plans/YYYY-MM-DD-<feature>.md---
change: <openspec-change-name>
design-doc: docs/superpowers/specs/YYYY-MM-DD-<topic>-design.md
base-ref: <git rev-parse HEAD before implementation>
---
base-ref is used during verification to measure committed changes across the full implementation range. Record the current commit when creating the plan:
git rev-parse HEAD
Record plan path:
bash "$COMET_STATE" set <name> plan docs/superpowers/plans/YYYY-MM-DD-feature.md
No manual phase update needed — guard auto-transitions when exit conditions are met.
Plan has been written to the current branch. Before starting execution, ask the user to choose both workspace isolation and execution method in a single interaction:
Workspace Isolation:
| Option | Method | Description |
|---|---|---|
| A | Create branch | Create a new branch in the current repo, simple and fast |
| B | Create Worktree | Isolated workspace, fully independent, suitable for parallel development |
Recommendation rules:
Execution Method:
| Option | Skill | Applicable Scenario |
|---|---|---|
| A | superpowers:subagent-driven-development | Independent tasks, high complexity, requires two-phase review |
| B | superpowers:executing-plans | Simple tasks, no subagent environment, lightweight and fast |
Execution method recommendation rules:
This is a user decision point. Must use the AskUserQuestion tool to pause and wait for the user to explicitly choose both isolation method and execution method. Must not choose branch or worktree based on recommendation rules, and must not choose the execution method based on recommendation rules. Recommendation rules are for suggestion only, not a substitute for user confirmation. Must not just output a text prompt and then continue executing.
After user selection, update isolation and build_mode fields:
bash "$COMET_STATE" set <name> isolation <branch|worktree>
bash "$COMET_STATE" set <name> build_mode <subagent-driven-development|executing-plans|direct>
isolation is a script-enforced hard constraint. Full workflow init may temporarily leave it as null, but only before this step. If it remains null, both the build → verify guard and comet-state transition build-complete will fail.
build_mode defaults to direct only for hotfix/tweak presets. Full workflow must not default to direct. Use it only when the user explicitly asks to bypass the plan execution skills and you record an explicit override:
bash "$COMET_STATE" set <name> direct_override true
bash "$COMET_STATE" set <name> build_mode direct
Without direct_override: true, build_mode=direct in full workflow is blocked by both guard and state transition.
Execute isolation:
git checkout -b <change-name>, subsequent work on the new branchsuperpowers:using-git-worktrees skill to create isolated workspace. Do not bypass this skill with plain shell commands or native tools; if the skill is unavailable, stop the process and prompt to install or enable Superpowers skills.After creating isolation, confirm plan file is accessible (naturally accessible with branch method; for worktree method, confirm plan has been committed).
Load execution skill: Use the Skill tool to load the corresponding skill. Skipping this step is prohibited.
If the selected Superpowers skill is unavailable, stop the process and prompt to install or enable the corresponding skill. Do not substitute this step with normal conversation.
After the skill loads, follow its guidance to execute:
- [ ] → - [x])When the initial spec is found incomplete during implementation, handle by scale:
| Scale | Trigger Conditions | Approach |
|---|---|---|
| Small | Missing acceptance scenarios, edge cases | Directly edit delta spec + design.md, append tasks.md tasks |
| Medium | Interface changes, new components, data flow changes | Must use the AskUserQuestion tool to pause and wait for the user to explicitly confirm, then must use Skill tool to load superpowers:brainstorming to update Design Doc + delta spec |
| Large | Brand-new capability requirements | Must use the AskUserQuestion tool to pause and wait for the user to explicitly confirm the split; after user confirms, create independent change through /comet-open |
50% Threshold Determination: Using initial task count in tasks.md as baseline, if new tasks exceed half of that total, it's considered outside original plan scope, must use the AskUserQuestion tool to pause and wait for the user to decide whether to split into a new change. Must not just output a text prompt and then continue executing.
When creating an independent change, must invoke /comet-open, not /opsx:new directly. /comet-open creates both OpenSpec artifacts and .comet.yaml, preventing the new change from leaving the Comet state machine.
Principles:
Build is the longest phase and may span many tasks. To support resume after context compaction:
.comet.yaml and file state are durablebash "$COMET_STATE" check <change-name> build --recover — the script outputs structured recovery context (isolation/build_mode status, plan path, task progress, recovery action). Follow the Recovery action to determine next step.comet/reference/dirty-worktree.md. That protocol defines checks, attribution, and prohibitions. Build-specific handling:
isolation has been written as branch or worktreebuild_mode has been written as subagent-driven-development, executing-plans, or direct with explicit overridebash "$COMET_GUARD" <change-name> build --apply; after all PASS, state advances to phase: verifyGuard reads project command configuration first:
build_command: <build command>
verify_command: <verify command>
Configuration can live in the change .comet.yaml, or in repo-root .comet.yaml / comet.yaml / .comet.yml / comet.yml.
Only when no command is configured does guard fall back to npm run build, Maven, or Cargo auto-detection. When a command fails, guard prints the command output as evidence for debugging.
Before exit, run guard to auto-transition:
bash "$COMET_GUARD" <change-name> build --apply
State file is automatically updated to phase: verify, verify_result: pending.
After exit conditions are met (including user selecting workflow configuration), auto-transition to next phase:
REQUIRED NEXT SKILL: Invoke
comet-verifyskill to enter the verification and completion phase.
Comet Phase 2: Deep Design. Invoke with /comet-design. Produce Design Doc and delta spec through brainstorming.
Comet preset path: Bug fix / hotfix. Skip brainstorming, directly open → build → verify → archive. Applicable for behavior fixes, scenarios not involving new capability design.
Comet Phase 1: Open. Invoke with /comet-open. Explore ideas through OpenSpec, create change structure (proposal + design + tasks).
Comet — OpenSpec + Superpowers dual-star development workflow. Start with /comet for automatic phase detection and dispatch to subcommands. Five phases: open → design → build → verify → archive.
Comet preset path: Non-bug small changes (tweak). Skip brainstorming and full plan, directly open → lightweight build → light verify → archive. Applicable for copy, configuration, documentation or prompt local optimization.
Comet Phase 4: Verify and Close. Invoke with /comet-verify. Verify implementation matches design, handle development branch.