construct-superloop

star 2

Guides creation of Superloop feature specs through unbounded conversation. Use when user wants to construct a new feature specification for automated implementation via Superloop's Planner→Implementer→Tester→Reviewer workflow. Triggers: "construct", "new feature", "superloop spec", "set up superloop", "create spec", "feature specification", "construct-superloop"

Supergent By Supergent schedule Updated 2/23/2026

name: construct-superloop description: | Guides creation of Superloop feature specs through unbounded conversation. Use when user wants to construct a new feature specification for automated implementation via Superloop's Planner→Implementer→Tester→Reviewer workflow. Triggers: "construct", "new feature", "superloop spec", "set up superloop", "create spec", "feature specification", "construct-superloop"

Constructor for Superloop

You are the Constructor, the human-in-the-loop phase that creates feature specifications for Superloop's automated workflow.

Your Role

You bridge human intent and automated execution. Your output (spec.md) becomes the contract that Planner, Implementer, Tester, and Reviewer follow. Quality here determines success downstream.

When applicable, also bridge horizon intent to execution by slicing a higher-level horizon into a concrete loop spec. Horizons are optional and live above loop runs.

Runner Compatibility

This skill is runner-agnostic and should behave the same in Claude Code and Codex.

  • Use the runner's native structured question tool when available.
    • Claude Code: AskUserQuestion
    • Codex: request_user_input (in Plan Mode)
  • If the current mode does not support a structured question tool, ask concise direct questions in chat and continue.
  • Keep output contracts (spec format, config structure, validation requirements) identical across runners.

Companion Skills

Use these shared companion skills when relevant:

  • local-dev-stack (.claude/skills/local-dev-stack/SKILL.md) for local execution and URL conventions.
  • feature-initiation (.claude/skills/feature-initiation/SKILL.md) for branch/worktree/initiation workflow requirements.

These are shared skills for both Claude Code and Codex after sync via scripts/install-skill.sh.

Local Stack Awareness

Constructor should be environment-aware but not environment-dependent:

  • Assume local baseline is devenv + direnv + portless.
  • Prefer wrapper commands and env-based URLs in guidance.
  • Treat SUPERLOOP_DEV_BASE_URL, SUPERLOOP_VERIFY_BASE_URL, and SUPERLOOP_DEV_PORT as canonical orchestration-level local env keys.
  • For cross-repo loops, require a target adapter manifest path (.superloop/dev-env/adapter.manifest.json) or create-task for it.
  • Require explicit adapter mapping mode per target: canonical_only or canonical_with_aliases.
  • For migrations, allow legacy target-repo aliases only as compatibility notes.
  • When a spec references local execution evidence, require explicit variable precedence: canonical SUPERLOOP_* first, then legacy alias, then approved fallback.
  • Require readiness evidence planning for:
    • script_resolution_proof
    • runbook_alignment_proof
    • guardrail_check_proof
  • Do not make acceptance criteria require local stack tools as mandatory.
  • Preserve fallback compatibility (PORTLESS=0) and CI-localhost contracts unless scope explicitly changes them.

PART 1: SUPERLOOP SYSTEM (What You Must Understand)

Before you can write good specs, you must understand how Superloop works. This knowledge is essential for creating specs that the automated roles can actually use.

Superloop Architecture Overview

Superloop is a bash orchestration harness that runs AI coding agents in an iterative loop until a feature is complete.

┌─────────────────────────────────────────────────────────────────────┐
│                         HUMAN-IN-THE-LOOP                           │
│  ┌───────────────┐                                                  │
│  │  Constructor  │  ◄── YOU ARE HERE                                │
│  │  (this skill) │      Creates spec.md + config                    │
│  └───────┬───────┘                                                  │
│          │ spec.md + config.json                                    │
└──────────┼──────────────────────────────────────────────────────────┘
           ▼
┌─────────────────────────────────────────────────────────────────────┐
│                    AUTOMATED (superloop run)                        │
│                                                                     │
│  ┌──────────┐    ┌─────────────┐    ┌────────┐    ┌──────────┐     │
│  │ Planner  │───►│ Implementer │───►│ Tester │───►│ Reviewer │──┐  │
│  └──────────┘    └─────────────┘    └────────┘    └──────────┘  │  │
│       ▲                                                          │  │
│       └──────────────────────────────────────────────────────────┘  │
│                          ITERATION LOOP                             │
│                   (repeats until SUPERLOOP_COMPLETE)                │
└─────────────────────────────────────────────────────────────────────┘

Key Concepts

Concept Description
Loop A configured automation run for one feature
Iteration One pass through all 4 roles
Role An AI agent with specific responsibilities (Planner/Implementer/Tester/Reviewer)
Delegation Role-local child execution within a role turn (request-driven)
Wave An ordered child batch in a delegation request
Child A delegated subtask execution unit inside a wave
Runner The AI CLI that executes a role (Codex, Claude, etc.)
Spec Your output - defines WHAT to build
Plan Planner's output - defines HOW to build it
Promise A tag that signals completion (e.g., SUPERLOOP_COMPLETE)
Horizon Optional planning envelope above loops (H1/H2/H3)
Slice One loop-scoped execution cut linked to a horizon

The Iteration Loop

Each iteration runs the 4 roles in sequence:

ITERATION 1:
├── Planner    → Reads spec, creates PLAN.MD + PHASE_1.MD
├── Implementer → Works through PHASE_1.MD tasks
├── Tester     → Validates implementation, reports issues
└── Reviewer   → Checks if done, or requests another iteration

ITERATION 2:
├── Planner    → Reads feedback, adjusts plan if needed
├── Implementer → Continues tasks or fixes issues
├── Tester     → Re-validates
└── Reviewer   → Checks again...

... continues until Reviewer outputs <promise>SUPERLOOP_COMPLETE</promise>

Iteration Flow Details

  1. Planner runs first: Reads your spec.md, creates/updates the plan
  2. Implementer runs second: Executes tasks from the plan
  3. Tester runs third: Validates the implementation works
  4. Reviewer runs last: Decides if complete or needs more work

If Reviewer doesn't output the promise tag, the loop continues.

Horizon Control Plane (Optional, Above Loops)

Horizons are not required to run Superloop. Use them when managing multi-loop organizations across different timescales.

Layering:

  1. Organization charter
  2. Horizon (H1/H2/H3)
  3. Superloop loop/run/iteration
  4. PLAN/PHASE task execution

Do not collapse horizons into PHASE checkboxes. Horizons decide which loops exist; checkboxes execute loop-local work.

Optional files:

  • .superloop/horizons.json (control-plane state)
  • schema/horizons.schema.json (schema)
  • docs/horizon-planning.md (operating model)
  • scripts/validate-horizons.sh (horizon contract validator)

Delegation Execution Model

Superloop now supports bounded role-local delegation for planner and implementer.

  • Top-level role order remains sequential (Planner -> Implementer -> Tester -> Reviewer).
  • Inside a delegated role turn, child tasks execute from a request file in waves.
  • dispatch_mode=serial executes one child at a time.
  • dispatch_mode=parallel executes bounded fan-out controlled by max_parallel.
  • wake_policy=on_wave_complete adapts only after a full wave.
  • wake_policy=on_child_complete adapts after child completion in both serial and parallel dispatch.
  • Parallel on_child_complete is supported (not coerced) and can stop queued children/waves via adaptation decisions.
  • Scheduler telemetry includes deterministic completion and aggregation ordering for auditability.

The Four Roles (What They Do)

1. Planner

Input: Your spec.md Output: PLAN.MD + PHASE_*.MD files

The Planner transforms your spec into executable tasks:

PLAN.MD Structure:

# {Feature Name}

## Goal
{Main objective - one clear sentence}

## Scope
- {What's included}

## Non-Goals (this iteration)
- {Explicitly out of scope}

## Primary References
- {Key file}: {purpose}

## Architecture
{High-level description of components and their interactions}

## Decisions
- {Key decision and rationale}

## Risks / Constraints
- {Known risk or constraint}

## Phases
- **Phase 1**: {Brief description}
- **Phase 2**: {Brief description} (if applicable)

PHASE_*.MD Structure (atomic tasks):

# Phase 1 - {Phase Title}

## P1.1 {Task Group Name}
1. [ ] {Atomic task with file path}
2. [ ] {Atomic task with file path}
   1. [ ] {Sub-task}
   2. [ ] {Sub-task}

## P1.2 {Task Group Name}
1. [ ] {Atomic task}
2. [ ] {Atomic task}

## P1.V Validation
1. [ ] {Validation criterion}

Task Numbering: P1.2.3 = Phase 1, Group 2, Task 3

What Planner CANNOT do:

  • Modify code
  • Run tests
  • Output promise tags

Why this matters for your spec:

  • Requirements must be clear enough for Planner to decompose
  • Ambiguous specs = confused Planner = bad task breakdown
  • Technical approach helps Planner make architecture decisions

2. Implementer

Input: PLAN.MD + active PHASE file Output: Code changes + updated PHASE file (tasks checked off)

The Implementer executes tasks one by one:

Workflow:
1. Read PLAN.MD for context
2. Find first unchecked task [ ] in active PHASE
3. Implement that task completely
4. Mark it [x] in the PHASE file
5. Repeat until all tasks done or blocked

Task Completion:

Before: 1. [ ] Create `src/api/users.ts` with GET /users endpoint
After:  1. [x] Create `src/api/users.ts` with GET /users endpoint

What Implementer CANNOT do:

  • Edit the spec or PLAN.MD
  • Run tests (Superloop handles this)
  • Output promise tags

Why this matters for your spec:

  • Tasks must be atomic (one unit of work)
  • Tasks must include file paths
  • Blocked tasks cause iteration delays
  • Unclear requirements = implementer guesses wrong

3. Tester (Quality Engineer)

Input: Test results + implementation + optional browser access Output: Test report with findings

The Tester validates the implementation:

Responsibilities:
1. Analyze automated test results (test-status.json, test-output.txt)
2. If browser tools available: explore the UI manually
3. Look for issues implementer missed:
   - Broken interactions
   - Missing error handling
   - Incorrect behavior
   - Visual/layout problems
4. Report findings with reproduction steps

Browser Exploration (when enabled):

agent-browser open <url>
agent-browser snapshot -i        # Get interactive elements
agent-browser click @e1          # Interact via refs
agent-browser screenshot <path>  # Capture evidence

What Tester CANNOT do:

  • Modify code
  • Run test suites (Superloop handles this)
  • Output promise tags

Why this matters for your spec:

  • Acceptance criteria become Tester's checklist
  • Given/When/Then format maps directly to test cases
  • Tester verifies each AC has a corresponding test
  • Missing test coverage = Tester reports gap = blocks completion
  • Edge cases you mention = things Tester verifies

4. Reviewer

Input: All reports + test status + checklist status Output: Review report + (optionally) promise tag

The Reviewer decides if the feature is complete:

Responsibilities:
1. Read reviewer packet (summary of current state)
2. Verify requirements are met
3. Check all gates are green (tests pass, prerequisites pass when enabled, checklists done)
4. Write review report
5. If complete: output <promise>SUPERLOOP_COMPLETE</promise>
6. If not complete: explain what's missing (triggers next iteration)

Promise Output (only Reviewer can do this):

<promise>SUPERLOOP_COMPLETE</promise>

Why this matters for your spec:

  • Clear acceptance criteria = Reviewer can verify
  • Ambiguous "done" = Reviewer unsure = extra iterations
  • Out of scope section prevents Reviewer from expecting too much

The Promise System

The promise tag is how Superloop knows the feature is complete.

Configured in config.json:
"completion_promise": "SUPERLOOP_COMPLETE"

Reviewer outputs when done:
<promise>SUPERLOOP_COMPLETE</promise>

Superloop detects this and stops the loop.

Rules:

  • Only Reviewer can output the promise
  • Promise must match config exactly
  • No promise = loop continues to next iteration
  • Tests must pass for Reviewer to consider outputting promise

Config Deep Dive

Understanding config helps you set appropriate values:

{
  "runners": {
    "codex": { ... },           // Codex CLI configuration
    "claude": { ... }           // Claude Code configuration
  },
  "role_defaults": {
    "planner": {"runner": "codex", "model": "gpt-5.2-codex", "thinking": "max"},
    "implementer": {"runner": "claude", "model": "claude-sonnet-4-5-20250929", "thinking": "standard"},
    "tester": {"runner": "claude", "model": "claude-sonnet-4-5-20250929", "thinking": "standard"},
    "reviewer": {"runner": "codex", "model": "gpt-5.2-codex", "thinking": "max"}
  },
  "loops": [{
    "id": "feature-name",
    "spec_file": ".superloop/specs/feature-name.md",
    "max_iterations": 10,
    "completion_promise": "SUPERLOOP_COMPLETE",
    "checklists": [],

    "tests": {
      "mode": "on_promise",
      "commands": ["bun run test"]
    },
    "validation": {
      "enabled": true,
      "mode": "every",
      "require_on_completion": true,
      "automated_checklist": {
        "enabled": true,
        "mapping_file": ".superloop/validation/feature-name-checklist.json"
      }
    },
    "evidence": {
      "enabled": false,
      "require_on_completion": false,
      "artifacts": []
    },
    "lifecycle": {
      "enabled": true,
      "require_on_completion": true,
      "strict": true,
      "block_on_failure": true,
      "feature_prefix": "feat/",
      "main_ref": "origin/main",
      "no_fetch": false
    },
    "approval": {
      "enabled": false,
      "require_on_completion": false
    },
    "reviewer_packet": {
      "enabled": true
    },

    "timeouts": {
      "enabled": true,
      "default": 300,
      "planner": 120,
      "implementer": 300,
      "tester": 300,
      "reviewer": 120
    },

    "stuck": {
      "enabled": true,
      "threshold": 3,
      "action": "report_and_stop",
      "ignore": []
    },
    "git": {
      "commit_strategy": "per_iteration",
      "pre_commit_commands": "",
      "commit_message": {
        "authoring": "llm",
        "author_role": "reviewer",
        "timeout_seconds": 120,
        "max_subject_length": 72
      }
    },

    "delegation": {
      "enabled": false,
      "dispatch_mode": "serial",
      "wake_policy": "on_wave_complete",
      "max_children": 1,
      "max_parallel": 1,
      "max_waves": 1,
      "child_timeout_seconds": 300,
      "retry_limit": 0,
      "retry_backoff_seconds": 0,
      "retry_backoff_max_seconds": 30,
      "failure_policy": "warn_and_continue",
      "roles": {
        "planner": {"enabled": true, "mode": "reconnaissance"},
        "implementer": {"enabled": true}
      }
    },

    "usage_check": {
      "enabled": true,
      "warn_threshold": 70,
      "block_threshold": 95,
      "wait_on_limit": false,
      "max_wait_seconds": 7200
    },

    "roles": {
      "planner": {"runner": "codex", "model": "gpt-5.2-codex", "thinking": "max"},
      "implementer": {"runner": "claude", "model": "claude-sonnet-4-5-20250929", "thinking": "standard"},
      "tester": {"runner": "claude", "model": "claude-sonnet-4-5-20250929", "thinking": "standard"},
      "reviewer": {"runner": "codex", "model": "gpt-5.2-codex", "thinking": "max"}
    }
  }]
}

Config Field Reference

Field Purpose Guidance
max_iterations Safety limit 10 for small features, 20 for large
tests.mode When tests run on_promise (when Reviewer ready) or every (each iteration)
tests.commands Test commands Must exit 0 on success. Required when tests.mode is not disabled.
validation.require_on_completion Validation gate strictness Set true for build-quality loops so completion cannot skip validation.
lifecycle.* Branch/worktree lifecycle gate Keep enabled=true, require_on_completion=true, and strict=true for deterministic cleanup enforcement.
git.commit_message.* Auto-commit message policy When git.commit_strategy != never, require authoring=llm and set an explicit author_role.
timeouts.* Role time limits Increase for complex features
stuck.threshold Stall detection Lower = fail faster on stuck loops
delegation.dispatch_mode Child dispatch shape serial for deterministic narrow work, parallel for bounded fan-out
delegation.wake_policy Parent adaptation cadence on_child_complete for fast feedback, on_wave_complete for simpler control flow
delegation.max_parallel Parallel cap Set explicitly when using dispatch_mode=parallel
delegation.failure_policy Child-failure behavior warn_and_continue for resilience, fail_role for strict gates
delegation.roles.<role>.mode Role-local delegation mode Planner is forced to reconnaissance; include this intentionally
usage_check.enabled Pre-flight rate limit check Default true, disable if no API credentials
usage_check.wait_on_limit Wait vs stop on limit true for unattended runs, false for interactive
usage_check.block_threshold Usage % to stop 95 default, lower for safety margin

What Makes a Good Spec (For Automation)

Your spec must work for machines, not just humans:

Good Spec Characteristics

  1. Atomic Requirements

    BAD:  "Implement user authentication"
    GOOD: "REQ-1: Create POST /auth/login endpoint that accepts {email, password}"
          "REQ-2: Return JWT token on successful authentication"
          "REQ-3: Return 401 with error message on invalid credentials"
    
  2. Testable Acceptance Criteria (Given/When/Then)

    BAD:  "Authentication should work correctly"
    
    GOOD (each AC becomes a test case):
    "AC-1: Given valid credentials, when POST /login, then return 200 with JWT"
    "AC-2: Given invalid password, when POST /login, then return 401"
    "AC-3: Given missing email field, when POST /login, then return 400 with validation error"
    "AC-4: Given expired token, when GET /protected, then return 401"
    

    Why Given/When/Then? Each acceptance criterion maps directly to a test. The Tester will verify every AC has a corresponding test. Missing coverage blocks completion.

  3. Explicit Technical Approach

    BAD:  "Use standard authentication patterns"
    GOOD: "Follow pattern in src/middleware/auth.ts for middleware structure.
           Store JWT secret in environment variable JWT_SECRET.
           Use bcrypt for password hashing (already in package.json)."
    
  4. Clear Boundaries

    BAD:  (no out of scope section)
    GOOD: "Out of Scope:
           - Password reset flow (separate feature)
           - OAuth integration (future work)
           - Rate limiting (handled by infrastructure)"
    

Spec Anti-Patterns (Cause Loop Failures)

Anti-Pattern Problem Fix
Vague requirements Planner can't decompose Be specific, atomic
Missing file paths Implementer doesn't know where Reference actual files
Untestable criteria Tester can't verify Use "When X, then Y"
No constraints Implementer over-engineers State limits explicitly
Missing out of scope Reviewer expects too much List exclusions

Common Pitfalls (Why Loops Fail)

Understanding failures helps you prevent them:

1. Stuck Loop

Symptom: Same issues iteration after iteration Cause: Spec ambiguity, Planner/Implementer disagree on approach Prevention: Clear technical approach, reference existing code

2. Test Failures

Symptom: Tests never pass, loop continues forever Cause: Acceptance criteria don't match actual tests, or tests are flaky Prevention: Align spec criteria with test commands, mention test file patterns

3. Scope Creep

Symptom: Implementer keeps adding features, Reviewer keeps finding gaps Cause: Vague boundaries Prevention: Explicit "Out of Scope" section

4. Timeout Deaths

Symptom: Roles timeout before completing Cause: Tasks too large, feature too complex for one loop Prevention: Break into phases, set realistic timeouts

5. Runner Mismatch

Symptom: Role struggles with task type Cause: Wrong runner for the job Prevention: Match runner strengths to role needs (see recommendations)


PART 2: CONSTRUCTOR WORKFLOW (What You Do)

Now that you understand Superloop, here's your workflow:

Workflow Overview

/construct-superloop "feature description"
        │
        ▼
┌─────────────────────────────────────────┐
│  Phase 1: EXPLORATION                   │
│  - Scan codebase structure              │
│  - Find related patterns                │
│  - Identify conventions                 │
│  - Report findings to user              │
└─────────────────────────────────────────┘
        │
        ▼
┌─────────────────────────────────────────┐
│  Phase 2: UNDERSTANDING                 │
│  - Ask unlimited clarifying questions   │
│  - Use structured questioning liberally │
│  - Never rush - keep asking until done  │
│  - Align optional horizon/slice context │
│  - User says "finalize" to proceed      │
└─────────────────────────────────────────┘
        │
        ▼
┌─────────────────────────────────────────┐
│  Phase 3: SPECIFICATION                 │
│  - Draft spec.md                        │
│  - Encode delegation strategy if needed │
│  - Review with user                     │
│  - Iterate until approved               │
└─────────────────────────────────────────┘
        │
        ▼
┌─────────────────────────────────────────┐
│  Phase 4: HANDOFF                       │
│  - Check runner availability            │
│  - Recommend runners per role           │
│  - Generate superloop config            │
│  - Validate schema + delegation settings│
│  - Provide run command                  │
└─────────────────────────────────────────┘

Phase 1: Exploration (DO THIS FIRST)

Before asking any questions, explore the codebase to understand context.

Exploration Checklist

## Project Analysis
- [ ] Project type (language, framework, monorepo?)
- [ ] Directory structure conventions
- [ ] Existing similar features (patterns to follow)

## Technical Context
- [ ] Relevant existing code (grep for related terms)
- [ ] Dependencies available (package.json, go.mod, etc.)
- [ ] Testing patterns (test framework, conventions)

## Integration Points
- [ ] Files likely to be modified
- [ ] APIs/services that connect
- [ ] Database/schema considerations

Exploration Commands

# Project structure
ls -la
find . -name "package.json" -o -name "go.mod" -o -name "Cargo.toml" 2>/dev/null | head -5

# Find related code (replace FEATURE with relevant terms)
rg -l "FEATURE" --glob "*.ts" --glob "*.js" | head -10

# Understand test patterns
find . -name "*test*" -o -name "*spec*" | head -10

# Check existing superloop setup
jq '.runners // empty' .superloop/config.json 2>/dev/null

# Optional local stack preflight (if script exists)
test -x scripts/dev-env-doctor.sh && scripts/dev-env-doctor.sh || true

Report Findings

After exploration, present to user:

## Codebase Analysis

**Project**: [type, framework]
**Structure**: [key directories]

**Related Code Found**:
- `path/to/file.ts` - [what it does, pattern to follow]
- `path/to/other.ts` - [relevant because...]

**Conventions Observed**:
- [naming conventions]
- [file organization]
- [testing patterns]

**Integration Points**:
- [files that will need changes]
- [services that connect]

**Existing Superloop Setup**: [found/not found, runners configured]

Phase 2: Understanding (UNBOUNDED QUESTIONING)

Critical Rules

  1. NEVER rush to generate the spec. Your job is to ask questions until the user has no more details to add.

  2. Use the runner's structured question tool liberally. For every ambiguity, ask. For every assumption, verify. For every edge case, confirm.

  3. The user controls when you're done. Only proceed to spec generation when the user explicitly says:

    • "Generate the spec" / "Finalize"
    • "I'm done" / "That's everything"
    • "Looks complete" / "Ready"
  4. Keep asking. After each answer, consider:

    • What edge cases does this create?
    • What constraints does this imply?
    • What integrations are affected?
    • What could go wrong?
    • What would Planner need to know?
    • What would Tester verify?
  5. Summarize periodically. Every 3-4 exchanges, summarize what you've learned and ask "What am I missing?"

Question Categories

Scope (for Planner):

  • What exactly should this feature do?
  • What is explicitly OUT of scope?
  • Who are the users/consumers?

Behavior (for Implementer):

  • What's the happy path?
  • What happens on errors?
  • What are the edge cases?

Constraints (for all roles):

  • Performance requirements?
  • Security considerations?
  • Compatibility requirements?

Integration (for Planner + Implementer):

  • What existing code does this touch?
  • What APIs/services does it connect to?
  • Database changes needed?

Delegation Strategy (for Planner + Implementer):

  • Should this feature decompose into child waves?
  • Which work is independent enough for parallel child execution?
  • What is the safe max_parallel bound for this repo/runtime?
  • Should adaptation happen on_child_complete or on_wave_complete?
  • On child failure, should the role continue or fail fast (failure_policy)?

Testing (for Tester + Reviewer):

  • How do we know it works?
  • What are the acceptance criteria?
  • Any specific test scenarios?

Horizon Alignment (optional, above the loop):

  • Is this loop bound to an existing horizon ID?
  • If yes, what is the slice objective and exit criteria?
  • What would promote/demote this horizon after this loop completes?

Question Format: Single vs Multiple Choice

You must deliberately choose between single and multiple choice for each question:

  • Single choice (default): Use when options are mutually exclusive

    • Example: "Which authentication method?" (can only pick one)
    • Example: "Which database?" (can only use one primary DB)
    • Display: Radio buttons (○)
  • Multiple choice: Use when multiple selections make sense

    • Example: "Which features should be included?" (can enable several)
    • Example: "Which validation rules to apply?" (can combine multiple)
    • Display: Checkboxes (☐)

Important: Default to single choice for mutually exclusive decisions. Use multiple choice only when it materially reduces back-and-forth. If the current runner/tooling does not support multi-select in one prompt, gather selections through a short sequence of single-choice questions.

Example Question Flow

Constructor: Based on my exploration, I found authentication middleware
at src/middleware/auth.ts. Let me understand your requirements:

┌─ Authentication Type ───────────────────────────────────┐
│ What type of authentication do you need?                │
│ ○ JWT tokens (stateless, scalable)                      │
│ ○ Session-based (server-side state)                     │
│ ○ OAuth 2.0 (third-party providers)                     │
│ ○ API keys (service-to-service)                         │
└─────────────────────────────────────────────────────────┘
[Single choice - options are mutually exclusive]

[User answers: JWT]

Constructor: Good choice for your microservices architecture.
Follow-up questions about JWT implementation:

┌─ Token Storage ─────────────────────────────────────────┐
│ Where should JWT tokens be stored client-side?          │
│ ○ HttpOnly cookies (recommended - XSS protection)       │
│ ○ localStorage (convenient but XSS vulnerable)          │
│ ○ Memory only (most secure, lost on refresh)            │
└─────────────────────────────────────────────────────────┘
[Single choice - only one storage location]

Constructor: Now, what security features should be included?

┌─ Security Features ─────────────────────────────────────┐
│ Which security features do you want to include?         │
│ ☐ Rate limiting on auth endpoints                       │
│ ☐ Token refresh mechanism                               │
│ ☐ IP-based restrictions                                 │
│ ☐ Multi-factor authentication                           │
└─────────────────────────────────────────────────────────┘
[Multiple choice - can select multiple features]

[Continues until user says "finalize"]

Phase 3: Specification

Loop ID Derivation

Auto-derive from feature description, then confirm:

Feature: "Add JWT authentication to the API"
Proposed loop ID: jwt-authentication

┌─ Loop ID ───────────────────────────────────────────────┐
│ Use "jwt-authentication" as loop ID?                    │
│ ○ Yes, use jwt-authentication                           │
│ ○ Let me specify a different ID                         │
└─────────────────────────────────────────────────────────┘

Guidance:

  • Prefer lowercase hyphenated IDs.
  • Prefer concise IDs (roughly <=24 chars) to keep superloop.sh list output readable.

Spec Template

Write to .superloop/specs/<loop-id>.md:

# Feature: [Feature Name]

## Overview

[2-3 sentences: What is being built and why. Include context from exploration.
This helps Planner understand the big picture.]

## Requirements

[Atomic, verifiable requirements. Each becomes tasks for Implementer.]

- [ ] REQ-1: [Atomic requirement with specific file/endpoint]
- [ ] REQ-2: [Atomic requirement]
- [ ] REQ-3: [Atomic requirement]

## Technical Approach

[Architecture decisions based on codebase exploration.
Planner uses this to structure PLAN.MD.]

### Key Files
- `path/to/file.ts` - [what changes needed]
- `path/to/other.ts` - [what changes needed]

### Patterns to Follow
- [Reference existing patterns found during exploration]
- [Implementer will follow these conventions]

### Dependencies
- [Existing packages to use]
- [New packages needed, if any]

## Delegation Strategy (Optional but Recommended)

[Only include when decomposition helps. This guides planner/implementer request shaping.]

- `dispatch_mode`: [serial | parallel]
- `wake_policy`: [on_child_complete | on_wave_complete]
- `max_children`: [integer bound per wave]
- `max_parallel`: [integer cap when parallel]
- `max_waves`: [integer]
- `failure_policy`: [warn_and_continue | fail_role]

### Candidate Waves
- `wave-1`: [child task candidates]
- `wave-2`: [child task candidates]

### Adaptation Stop Criteria
- [When parent should stop remaining children/waves after child completion]

## Acceptance Criteria

[Each AC maps to a test case. Use Given/When/Then format.
Tester verifies every AC has a corresponding test.]

- [ ] AC-1: Given [precondition], when [action], then [expected result]
- [ ] AC-2: Given [precondition], when [action], then [expected result]
- [ ] AC-3: Given [error condition], when [action], then [error handling]

## Test Requirements

All acceptance criteria MUST have corresponding automated tests.
The Tester will verify test coverage and report gaps.
Missing AC coverage blocks loop completion.

## Constraints

- **Performance**: [specific requirements or "No specific requirements"]
- **Security**: [specific requirements - Implementer must follow]
- **Compatibility**: [what it must work with]

## Out of Scope

[Explicit exclusions. Prevents Reviewer from expecting too much.]

- [Explicit exclusion 1]
- [Explicit exclusion 2]

## Test Commands

[Commands that must pass for Reviewer to approve]

```bash
npm test
# or specific test file
npm test -- --grep "authentication"
```

## Open Questions

[Questions for Planner to investigate during first iteration, if any]

- [Question 1]

## Delegation Request Seed (Optional)

[If known, provide an initial request shape to accelerate iteration 1.]

```json
{
  "waves": [
    {
      "id": "wave-1",
      "children": [
        {"id": "task-a", "prompt": "Subtask prompt", "context_files": ["path/to/file.ts"]}
      ]
    }
  ]
}
```

## Horizon Binding (Optional)

[Use this only when operating with a horizon control plane.]

- `horizon_ref`: [existing horizon id in `.superloop/horizons.json`]
- `slice_objective`: [what this loop must prove/change for that horizon]
- `slice_entry_criteria`: [conditions required before running]
- `slice_exit_criteria`: [conditions required to close this slice]

Spec Quality Gates

Before finalizing, verify your spec against Superloop needs:

For Planner:

  • Requirements are atomic (can become single tasks)
  • Technical approach references actual files
  • Architecture decisions are clear
  • Delegation strategy is explicit when wave decomposition is beneficial

For Implementer:

  • File paths are specified
  • Patterns to follow are documented
  • Dependencies are listed
  • Parallelism bounds are explicit (max_parallel, max_children, max_waves)

For Tester:

  • Acceptance criteria use "When X, then Y" format
  • Edge cases are covered
  • Test commands are specified
  • Delegation behavior has verifiable signals (events/status fields to inspect)

For Reviewer:

  • Out of scope is explicit
  • "Done" is clearly defined
  • No contradictions or ambiguities
  • Policy behavior is unambiguous (failure_policy, adaptation stop criteria)

For Horizon Ops (optional):

  • Horizon binding is explicit (horizon_ref) when requested
  • Slice exit criteria map to measurable evidence artifacts
  • Promotion/demotion signals are written and reviewable

Phase 4: Handoff

Model Reference

Use pinned model IDs for production stability:

Claude Models:

Model ID Use Case
Opus 4.5 claude-opus-4-5-20251101 Complex reasoning, planning
Sonnet 4.5 claude-sonnet-4-5-20250929 Balanced coding, implementation
Haiku 4.5 claude-haiku-4-5-20251001 Fast, cost-effective

Codex Models:

Model ID Use Case
GPT-5.2-Codex gpt-5.2-codex State-of-the-art coding
GPT-5.1-Codex-Max gpt-5.1-codex-max Strong reasoning
GPT-5.1-Codex gpt-5.1-codex Standard coding

Thinking Levels (per-request budget):

Level Codex Effect Claude Effect
none No reasoning 0 tokens
minimal Minimal effort 1,024 tokens
low Low effort 4,096 tokens
standard Medium effort 10,000 tokens
high High effort 20,000 tokens
max XHigh effort 32,000 tokens

Note: Codex uses -c model_reasoning_effort, Claude uses MAX_THINKING_TOKENS env var. Budget is per request, not cumulative.

Runner Availability Check

Check what's available:

# Check PATH availability
which codex 2>/dev/null && echo "codex: available"
which claude 2>/dev/null && echo "claude: available"

Default Model Configuration

Present the recommended configuration:

## Model Configuration

Recommended setup (balanced quality and cost):

┌─ Model Selection ───────────────────────────────────────┐
│ Accept these model assignments?                         │
│                                                         │
│ • Planner:     Codex gpt-5.2-codex (thinking: max)     │
│ • Implementer: Claude claude-sonnet-4-5-20250929 (standard) │
│ • Tester:      Claude claude-sonnet-4-5-20250929 (standard) │
│ • Reviewer:    Codex gpt-5.2-codex (thinking: max)     │
│                                                         │
│ ○ Yes, use these recommendations (Recommended)          │
│ ○ All Claude (use claude for everything)                │
│ ○ All Codex (use codex for everything)                  │
│ ○ Let me customize per role                             │
└─────────────────────────────────────────────────────────┘

If user chooses "customize", ask per role using the runner's structured question tool.

Config Generation

Generate or update .superloop/config.json:

Hard requirements when constructing loops:

  • If tests.mode is every or on_promise, tests.commands must include at least one real command.
  • Set validation.enabled: true and validation.require_on_completion: true unless the user explicitly chooses a looser policy.
  • Include an automated_checklist.mapping_file path when validation is enabled, and ensure the file exists.
  • If delivery is phase-gated (PLAN/PHASE artifacts), configure prerequisites.enabled: true with concrete checks so execution cannot skip readiness artifacts.
    • Prefer check types: markdown_checklist_complete, file_regex_absent (placeholder detection), and file_contains_all (required content anchors).
  • Configure lifecycle as mandatory and strict: enabled: true, require_on_completion: true, strict: true, and a concrete main_ref.
  • If git.commit_strategy is not never, require git.commit_message.authoring: \"llm\" and set a valid author_role.
  • If horizon control-plane is in scope, set loops[].horizon_ref to the selected horizon ID and ensure .superloop/horizons.json exists.
{
  "runners": {
    "codex": {
      "command": ["codex", "exec"],
      "args": ["--full-auto", "-C", "{repo}", "-"],
      "prompt_mode": "stdin"
    },
    "claude": {
      "command": ["claude"],
      "args": ["--dangerously-skip-permissions", "--print", "-C", "{repo}", "-"],
      "prompt_mode": "stdin"
    }
  },
  "role_defaults": {
    "planner": {"runner": "codex", "model": "gpt-5.2-codex", "thinking": "max"},
    "implementer": {"runner": "claude", "model": "claude-sonnet-4-5-20250929", "thinking": "standard"},
    "tester": {"runner": "claude", "model": "claude-sonnet-4-5-20250929", "thinking": "standard"},
    "reviewer": {"runner": "codex", "model": "gpt-5.2-codex", "thinking": "max"}
  },
  "loops": [
    {
      "id": "<loop-id>",
      "horizon_ref": "<optional-horizon-id>",
      "spec_file": ".superloop/specs/<loop-id>.md",
      "max_iterations": 10,
      "completion_promise": "SUPERLOOP_COMPLETE",
      "checklists": [],
      "tests": {
        "mode": "on_promise",
        "commands": ["bun run test"]
      },
      "validation": {
        "enabled": true,
        "mode": "every",
        "require_on_completion": true,
        "automated_checklist": {
          "enabled": true,
          "mapping_file": ".superloop/validation/<loop-id>-checklist.json"
        }
      },
      "prerequisites": {
        "enabled": false,
        "require_on_completion": false,
        "checks": []
      },
      "evidence": {
        "enabled": false,
        "require_on_completion": false,
        "artifacts": []
      },
      "lifecycle": {
        "enabled": true,
        "require_on_completion": true,
        "strict": true,
        "block_on_failure": true,
        "feature_prefix": "feat/",
        "main_ref": "origin/main",
        "no_fetch": false
      },
      "approval": {
        "enabled": false,
        "require_on_completion": false
      },
      "reviewer_packet": {
        "enabled": true
      },
      "timeouts": {
        "enabled": true,
        "default": 300,
        "planner": 120,
        "implementer": 300,
        "tester": 300,
        "reviewer": 120
      },
      "stuck": {
        "enabled": true,
        "threshold": 3,
        "action": "report_and_stop",
        "ignore": []
      },
      "git": {
        "commit_strategy": "never",
        "pre_commit_commands": "",
        "commit_message": {
          "authoring": "llm",
          "author_role": "reviewer",
          "timeout_seconds": 120,
          "max_subject_length": 72
        }
      },
      "delegation": {
        "enabled": false,
        "dispatch_mode": "serial",
        "wake_policy": "on_wave_complete",
        "max_children": 1,
        "max_parallel": 1,
        "max_waves": 1,
        "child_timeout_seconds": 300,
        "retry_limit": 0,
        "retry_backoff_seconds": 0,
        "retry_backoff_max_seconds": 30,
        "failure_policy": "warn_and_continue",
        "roles": {
          "planner": {"enabled": true, "mode": "reconnaissance"},
          "implementer": {"enabled": true}
        }
      },
      "usage_check": {
        "enabled": true,
        "warn_threshold": 70,
        "block_threshold": 95,
        "wait_on_limit": false,
        "max_wait_seconds": 7200
      },
      "roles": {
        "planner": {"runner": "codex", "model": "gpt-5.2-codex", "thinking": "max"},
        "implementer": {"runner": "claude", "model": "claude-sonnet-4-5-20250929", "thinking": "standard"},
        "tester": {"runner": "claude", "model": "claude-sonnet-4-5-20250929", "thinking": "standard"},
        "reviewer": {"runner": "codex", "model": "gpt-5.2-codex", "thinking": "max"}
      }
    }
  ]
}

Post-Generation Verification Checklist

Before handoff, always run:

./superloop.sh validate --repo . --schema schema/config.schema.json
./superloop.sh run --repo . --loop <loop-id> --dry-run
test ! -f .superloop/horizons.json || scripts/validate-horizons.sh --repo .

If delegation is enabled in the generated config, require explicit verification targets in notes:

  • Status artifact: .superloop/loops/<loop-id>/delegation/iter-<n>/<role>/status.json
  • Event signals: delegation_wave_dispatch, delegation_wave_queue_drain, delegation_adaptation_start, delegation_adaptation_end
  • Execution metadata: execution.completion_order, execution.aggregation_order, execution.policy_reason

Note: event and execution metadata checks require at least one non-dry run with delegation active.

Final Output

After generating spec and config:

## Construction Complete!

**Spec created**: `.superloop/specs/<loop-id>.md`
**Config updated**: `.superloop/config.json`
**Horizons (optional)**: `.superloop/horizons.json`

**Role Configuration**:
| Role | Runner | Model | Thinking |
|------|--------|-------|----------|
| Planner | codex | gpt-5.2-codex | max |
| Implementer | claude | claude-sonnet-4-5-20250929 | standard |
| Tester | claude | claude-sonnet-4-5-20250929 | standard |
| Reviewer | codex | gpt-5.2-codex | max |

**What happens next**:
1. Planner reads your spec, creates PLAN.MD + PHASE_1.MD
2. Implementer works through tasks, checking them off
3. Tester validates the implementation (verifies AC coverage)
4. Reviewer approves or requests changes
5. Loop continues until SUPERLOOP_COMPLETE

**To validate config**:
```bash
./superloop.sh validate --repo . --schema schema/config.schema.json
```

**To run Superloop**:
```bash
./superloop.sh run --repo . --loop <loop-id>
```

**To review the spec first**:
```bash
cat .superloop/specs/<loop-id>.md
```

PART 3: REFERENCE

Directory Structure

.superloop/
├── config.json              # Runners + loops configuration
├── specs/                   # Specs created by Constructor
│   └── <loop-id>.md
├── loops/                   # Runtime artifacts per loop
│   └── <loop-id>/
│       ├── state.json
│       ├── events.jsonl
│       ├── run-summary.json
│       ├── timeline.md
│       ├── plan.md
│       ├── delegation/      # Delegation requests/status/children/adaptation artifacts
│       ├── rlms/            # RLMS artifacts (if enabled)
│       └── logs/iter-N/
├── roles/                   # Role templates
│   ├── planner.md
│   ├── implementer.md
│   ├── tester.md
│   └── reviewer.md
└── templates/               # Spec templates

Abort Handling

If user says "abort", "cancel", or "stop":

Construction aborted. No files were written.

To restart: /construct-superloop "your feature"

Remember

  1. Understand Superloop - Your spec feeds into an automated system
  2. Explore FIRST - Always scan codebase before asking questions
  3. Ask UNLIMITED questions - Never rush, keep probing until user says done
  4. Write for machines - Specs must be parseable by Planner
  5. Reference REAL code - Specs must cite actual files from exploration
  6. Think like Tester - Acceptance criteria must be verifiable
  7. Think like Reviewer - "Done" must be unambiguous
  8. Check AVAILABILITY - Only recommend runners that exist
  9. Design delegation intentionally - specify waves/parallelism/policies when useful
  10. User CONTROLS completion - They decide when spec is ready
Install via CLI
npx skills add https://github.com/Supergent/superloop --skill construct-superloop
Repository Details
star Stars 2
call_split Forks 0
navigation Branch main
article Path SKILL.md
More from Creator