run-execute

star 12

Execute work items based on their assigned mode (autopilot, confirm, validate). Supports single-item and multi-item (batch/wide) runs.

fabriqaai By fabriqaai schedule Updated 1/24/2026

name: run-execute description: Execute work items based on their assigned mode (autopilot, confirm, validate). Supports single-item and multi-item (batch/wide) runs. version: 1.0.0

Execute work items based on their assigned mode (autopilot, confirm, validate). Supports both single-item and multi-item (batch/wide) runs.

Before executing scripts, ensure required dependencies are installed:

Run: npm list yaml --depth=0 2>/dev/null || echo "NOT_FOUND" Installing required dependency: yaml Run: npm install yaml
Package Purpose Install Command
yaml Parse/stringify state.yaml npm install yaml

- Pending work item ready for execution - Resumed from interrupted run - Batch of work items passed from run-plan Before starting execution, check if resuming an interrupted run: Check state.yaml for runs.active[] array
<check if="runs.active is empty">
  <goto step="1">No active run, start fresh</goto>
</check>

<check if="runs.active has entries">
  <action>Load run state from .specs-fire/runs/{runs.active[0].id}/run.md</action>
  <action>Get current_item and its status from state.yaml</action>
  <action>Check for existing artifacts and LOAD if present:</action>

  <substep>design.md → if exists, LOAD from .specs-fire/intents/{intent}/work-items/{id}-design.md</substep>
  <substep>plan.md → if exists, LOAD from .specs-fire/runs/{run-id}/plan.md (skip plan generation)</substep>
  <substep>test-report.md → if exists, tests already passed (skip to Step 6b)</substep>
  <substep>review-report.md → if exists, review done (skip to Step 7)</substep>

  <determine_resume_point>
    | Artifacts Present | Resume At |
    |-------------------|-----------|
    | None | Step 3 (Generate Plan) |
    | plan.md only | Step 5 (Implementation) |
    | plan.md + test-report.md | Step 6b (Code Review) |
    | plan.md + test-report.md + review-report.md | Step 7 (Complete Item) |
  </determine_resume_point>

  <output>
    Resuming run {run-id} for work item {current_item}.
    Mode: {mode}
    Loaded existing artifacts: {artifact_list}
    Resuming at: Step {step_number}
  </output>
</check>
Varies by mode:
  • Autopilot: LOW — Execute standard patterns decisively
  • Confirm: MEDIUM — Present plan, adjust based on feedback
  • Validate: LOW — Follow approved design precisely
USE SCRIPTS — NEVER bypass init-run.cjs or complete-run.cjs ALWAYS CREATE plan.md — Create plan BEFORE implementation starts (ALL modes) ALWAYS CREATE test-report.md — Create test report AFTER tests complete ALWAYS RUN code-review — Invoke code-review skill after tests pass TRACK ALL FILE OPERATIONS — Every create, modify MUST be recorded NEVER skip tests — Tests are mandatory, not optional FOLLOW BROWNFIELD RULES — Read before write, match existing patterns Artifacts MUST be created at these points:
Artifact When Created Created By
run.md Start of run init-run.cjs script
plan.md BEFORE implementation (Step 4) Agent using template
test-report.md AFTER tests pass (Step 6) Agent using template
review-report.md AFTER test report (Step 6b) code-review skill
walkthrough.md After run completes (Step 8) walkthrough-generate skill

For batch runs: Append each work item's section to plan.md and test-report.md.

MUST call init-run.cjs script. DO NOT use mkdir directly. The script creates BOTH the folder AND run.md file.
<action>Prepare work items JSON array:</action>
<code>
  # For single item:
  node scripts/init-run.cjs {rootPath} {workItemId} {intentId} {mode}

  # For batch/wide (multiple items):
  node scripts/init-run.cjs {rootPath} --batch '[
    {"id": "item-1", "intent": "intent-1", "mode": "autopilot"},
    {"id": "item-2", "intent": "intent-1", "mode": "confirm"}
  ]' --scope=batch
</code>

<action>Parse script output for runId and runPath</action>
<action>Verify run.md was created in .specs-fire/runs/{run-id}/</action>

<check if="run.md not found">
  <error>init-run.cjs failed to create run.md. Check script output.</error>
</check>
For batch runs, repeat steps 2-6b for each work item
<action>Get current_item from state.yaml runs.active[0]</action>
<action>Load work item from .specs-fire/intents/{intent}/work-items/{id}.md</action>
<action>Read intent brief for broader context</action>
<action>Load project standards using hierarchical resolution:</action>

<standards_resolution critical="true">
  <substep n="2a" title="Discover Standards Locations">
    <action>Scan repository for: **/.specs-fire/standards/</action>
    <action>Build list sorted by path depth (root = depth 0)</action>
    <example>
      depth 0: .specs-fire/standards/
      depth 2: packages/api/.specs-fire/standards/
      depth 2: apps/mobile/.specs-fire/standards/
    </example>
  </substep>

  <substep n="2b" title="Load Constitution (Root Only)">
    <action>Load .specs-fire/standards/constitution.md from ROOT</action>
    <critical>IGNORE any constitution.md in nested directories</critical>
    <critical>Constitution is ALWAYS inherited, NEVER overridden</critical>
    <note>If constitution.md doesn't exist, skip gracefully</note>
  </substep>

  <substep n="2c" title="Resolve Module Standards">
    <action>For each discovered standards location (excluding root):</action>

    <resolution_algorithm>
      FOR each standard_file IN [tech-stack.md, coding-standards.md,
                                  testing-standards.md, system-architecture.md]:

        IF {location}/standards/{standard_file} EXISTS:
          → USE this file for scope {location.parent_path}/**
        ELSE:
          → Walk UP to find nearest ancestor with this file
          → USE ancestor's file (ultimately root if none found)
    </resolution_algorithm>
  </substep>

  <substep n="2d" title="Present Standards with Scoping">
    <action>Present loaded standards with clear path-based scoping:</action>

    <output_format>
      ## Constitution (applies to ALL files)
      [content of root constitution.md]

      ## Standards for {module_path}/** files
      When editing files under {module_path}/, apply:
      - Tech Stack: [resolved tech-stack.md for this scope]
      - Coding Standards: [resolved coding-standards.md for this scope]
      - Testing Standards: [resolved testing-standards.md for this scope]

      ## Default Standards (paths without specific scope)
      For all other files, apply root standards.
    </output_format>
  </substep>
</standards_resolution>

<action>Determine execution mode from work item</action>
Executing in Autopilot mode (0 checkpoints). Work item: {title} Generate implementation plan Save plan IMMEDIATELY using template: templates/plan.md.hbs Write to: .specs-fire/runs/{run-id}/plan.md Plan saved to: .specs-fire/runs/{run-id}/plan.md
<checkpoint>
  <template_output section="plan">
    ## Implementation Plan for "{title}"

    ### Approach
    {describe approach}

    ### Files to Create
    {list files}

    ### Files to Modify
    {list files}

    ### Tests
    {list test files}

    ---
    Approve plan? [Y/n/edit]
  </template_output>
</checkpoint>

<check if="response == edit">
  <ask>What changes to the plan?</ask>
  <action>Adjust plan</action>
  <action>Update plan.md with changes</action>
  <goto step="3b"/>
</check>
<goto step="5"/>
Load design doc from .specs-fire/intents/{intent}/work-items/{id}-design.md Generate implementation plan based on design Save plan IMMEDIATELY using template: templates/plan.md.hbs Write to: .specs-fire/runs/{run-id}/plan.md Include reference to design doc in plan Plan saved to: .specs-fire/runs/{run-id}/plan.md
<checkpoint>
  <template_output section="plan">
    ## Implementation Plan for "{title}"

    Based on approved design document.

    ### Implementation Checklist
    {from design doc}

    ### Files to Create
    {list files}

    ### Files to Modify
    {list files}

    ---
    This is Checkpoint 2 of Validate mode.
    Approve implementation plan? [Y/n/edit]
  </template_output>
</checkpoint>

<check if="response == edit">
  <ask>What changes to the plan?</ask>
  <action>Adjust plan</action>
  <action>Update plan.md with changes</action>
  <goto step="3c"/>
</check>
<goto step="5"/>
Confirm and Validate modes already saved plan in Step 3b/3c
<batch_handling critical="true">
  <check if="batch/wide run AND plan.md already exists">
    <action>Read existing plan.md content</action>
    <action>Append new section for current work item:</action>
    <format>
      ---

      ## Work Item: {work_item_id}

      ### Approach
      {describe approach for this specific work item}

      ### Files to Create
      {list files}

      ### Files to Modify
      {list files}

      ### Tests
      {list test files}
    </format>
    <action>Write updated plan.md (preserving previous sections)</action>
  </check>

  <check if="plan.md does not exist OR single run">
    <action>Generate implementation plan</action>
    <action>Save plan using template: templates/plan.md.hbs</action>
    <action>Write to: .specs-fire/runs/{run-id}/plan.md</action>
  </check>
</batch_handling>

<output>
  Plan saved to: .specs-fire/runs/{run-id}/plan.md
  (Autopilot mode - continuing without checkpoint)
</output>
<note>No checkpoint in autopilot - human can review plan.md while agent works</note>
For each planned change: Implement the change Track file operation (create/modify) Record decisions made
<standards_application critical="true">
  When editing a file at path X:
  1. Find the LONGEST matching standards scope (most specific)
  2. Apply those standards to the file
  3. If no specific scope matches, apply root standards

  <example>
    Editing packages/api/src/handler.go
    → Apply "Standards for packages/api/**"

    Editing scripts/deploy.sh
    → Apply "Default Standards" (root)
  </example>
</standards_application>

<brownfield_rules>
  <rule>READ existing code before modifying</rule>
  <rule>MATCH existing naming conventions</rule>
  <rule>FOLLOW existing patterns in the codebase</rule>
  <rule>PRESERVE existing tests</rule>
  <rule>USE module-specific standards when editing module files</rule>
</brownfield_rules>
Load testing standards from .specs-fire/standards/testing-standards.md Write tests following testing standards: Unit tests for new/modified functions Integration tests for API endpoints or workflows Follow test naming and structure conventions
<action>Run test suite</action>
<check if="tests fail">
  <output>Tests failed. Fixing issues...</output>
  <action>Fix failing tests</action>
  <action>Re-run tests</action>
</check>

<action>Validate acceptance criteria from work item</action>

<critical>Create test report AFTER tests pass</critical>

<batch_handling critical="true">
  <check if="batch/wide run AND test-report.md already exists">
    <action>Read existing test-report.md content</action>
    <action>Append new section for current work item:</action>
    <format>
      ---

      ## Work Item: {work_item_id}

      ### Test Results
      - Passed: {passed_count}
      - Failed: {failed_count}
      - Skipped: {skipped_count}

      ### Acceptance Criteria Validation
      {validation_results}
    </format>
    <action>Write updated test-report.md (preserving previous sections)</action>
  </check>

  <check if="test-report.md does not exist OR single run">
    <action>Generate test report using template: templates/test-report.md.hbs</action>
    <action>Write to: .specs-fire/runs/{run-id}/test-report.md</action>
  </check>
</batch_handling>

<action>Include in test report:</action>
<substep>Test results summary (passed/failed/skipped)</substep>
<substep>Code coverage percentage</substep>
<substep>Acceptance criteria validation results</substep>
<substep>Any test warnings or notes</substep>
<output>Test report saved to: .specs-fire/runs/{run-id}/test-report.md</output>
ALWAYS run code review after tests pass Running code review...
<action>Invoke code-review skill with context:</action>
<code>
  invoke-skill: code-review
  context:
    files_created: {files_created}
    files_modified: {files_modified}
    run_id: {run_id}
    intent_id: {intent_id}
</code>

<invoke_skill>code-review</invoke_skill>

<note>
  Code review skill will:
  1. Review all files created/modified in this work item
  2. Auto-fix no-brainer issues (unused imports, console.log, etc.)
  3. Present suggestions requiring approval
  4. Create review-report.md artifact
</note>

<check if="code-review returns suggestions">
  <note>User interaction happens within code-review skill</note>
  <action>Wait for code-review skill to complete</action>
</check>

<check if="code-review applied fixes">
  <action>Re-run tests to verify fixes didn't break anything</action>
  <check if="tests fail">
    <output>Code review fixes caused test failure. Reverting...</output>
    <action>Revert code review changes</action>
    <action>Re-run tests to confirm passing</action>
  </check>
</check>

<output>
  Code review complete.
  Review report: .specs-fire/runs/{run-id}/review-report.md
</output>
BATCH RUNS: You MUST loop until ALL items are done NEVER call --complete-run until ALL items have artifacts ALWAYS check pending count BEFORE deciding which flag to use
<substep n="7a" title="Check Batch Status">
  <action>Read state.yaml runs.active[{runId}]</action>
  <action>Get scope value: single, batch, or wide</action>
  <action>Count work_items where status == "pending"</action>
  <action>Store pending_count for decision</action>
</substep>

<substep n="7b" title="Route Based on Batch Status">
  <check if="scope in [batch, wide] AND pending_count > 0">
    <critical>DO NOT call --complete-run yet - more items remain!</critical>
    <action>Call complete-run.cjs with --complete-item flag:</action>
    <code>
      node scripts/complete-run.cjs {rootPath} {runId} --complete-item
    </code>
    <action>Parse output JSON for nextItem and remainingItems</action>
    <output>
      Completed: {current_item}
      Next item: {nextItem}
      Remaining: {remainingItems} items
    </output>
    <goto step="2">MUST continue with next work item - loop back NOW</goto>
  </check>

  <check if="scope == single OR pending_count == 0">
    <action>All items complete - finalize the run</action>
    <action>Call complete-run.cjs with --complete-run flag:</action>
    <code>
      node scripts/complete-run.cjs {rootPath} {runId} --complete-run \
        --files-created='[{"path":"...","purpose":"..."}]' \
        --files-modified='[{"path":"...","changes":"..."}]' \
        --tests=5 --coverage=85
    </code>
    <goto step="8"/>
  </check>
</substep>
walkthrough-generate Run {run-id} completed.
  Work items completed: {count}
  Files created: {count}
  Files modified: {count}
  Tests added: {count}

  Artifacts:
  - Run Log: .specs-fire/runs/{run-id}/run.md
  - Plan: .specs-fire/runs/{run-id}/plan.md
  - Test Report: .specs-fire/runs/{run-id}/test-report.md
  - Code Review: .specs-fire/runs/{run-id}/review-report.md
  - Walkthrough: .specs-fire/runs/{run-id}/walkthrough.md
</output>

Script Purpose Usage
scripts/init-run.cjs Initialize run record and folder Creates run.md with all work items
scripts/complete-run.cjs Finalize run and update state --complete-item or --complete-run

files_created:
  - path: src/auth/login.ts
    purpose: Login endpoint handler

files_modified:
  - path: src/routes/index.ts
    changes: Added login route

decisions:
  - decision: Use JWT for tokens
    rationale: Stateless, works with load balancer
After init-run.cjs creates a run:
.specs-fire/runs/run-001/
├── run.md           # Created by init-run.cjs, updated by complete-run.cjs
├── plan.md          # Created BEFORE implementation (ALL modes - required)
├── test-report.md   # Created AFTER tests pass (required)
├── review-report.md # Created by code-review skill (Step 6b)
└── walkthrough.md   # Created by walkthrough-generate skill
1. `run.md` — Created at run start by init-run.cjs 2. `plan.md` — Created BEFORE implementation begins (Step 4) 3. `test-report.md` — Created AFTER tests pass (Step 6) 4. `review-report.md` — Created by code-review skill (Step 6b) 5. `walkthrough.md` — Created after run completes (Step 8)

The run.md contains:

  • All work items with their statuses
  • Current item being executed
  • Files created/modified (after completion)
  • Decisions made (after completion)
  • Summary (after completion)
Run initialized via init-run.cjs script Standards loaded with hierarchical resolution Constitution loaded from root (if exists) Module-specific standards applied to module files plan.md created BEFORE implementation All work items implemented All tests pass test-report.md created AFTER tests pass code-review skill invoked and completed review-report.md created Run completed via complete-run.cjs script walkthrough.md generated
Install via CLI
npx skills add https://github.com/fabriqaai/claude-code-logs --skill run-execute
Repository Details
star Stars 12
call_split Forks 4
navigation Branch main
article Path SKILL.md
More from Creator