Skip to content

Autonomous coding loops CLI - Orchestrate AI coding agents in iterative, PRD-driven development cycles

License

Notifications You must be signed in to change notification settings

matheus3301/loopforge

Repository files navigation

LoopForge

LoopForge

Autonomous coding loops CLI

Orchestrate AI coding agents in iterative, PRD-driven development cycles.

Release Go Report Card License CI


Installation

brew install matheus3301/tap/loopforge

πŸ“¦ Other methods (Go install, binary download, build from source): INSTALLATION.md

See It In Action πŸ”¨

Build with LoopForge

Quick Start

1. Initialize & Create PRD πŸ“

loopforge init
loopforge prd generate "Build a REST API with user authentication"

Initialize LoopForge

2. Run the Build Loop

loopforge build

3. Done! ✨

Project Complete


Features

AI coding agents like Claude Code, Codex, and OpenCode are powerful, but they work best with focused, single-task prompts. LoopForge orchestrates these agents in structured, iterative loops β€” one story at a time.

  • πŸ“‹ PRD-driven β€” Structured requirements with stories and dependencies
  • πŸ”„ One story per iteration β€” Clean context, focused execution
  • πŸ“ Granular commits β€” Easy to review and rollback
  • πŸ›‘οΈ Guardrails β€” Persistent rules that improve over time

How It Works

flowchart LR
    A[πŸ“‹ Select Story] --> B[πŸ€– Execute Agent]
    B --> C[βœ… Run Quality Gates]
    C --> D{Passed?}
    D -->|Yes| E[πŸ’Ύ Commit Changes]
    D -->|No| F[πŸ”„ Reset & Retry]
    E --> G{More Stories?}
    F --> A
    G -->|Yes| A
    G -->|No| H[πŸŽ‰ Done!]
    
    style A fill:#6366f1,color:#fff
    style B fill:#8b5cf6,color:#fff
    style C fill:#f59e0b,color:#fff
    style E fill:#22c55e,color:#fff
    style H fill:#22c55e,color:#fff
Loading

Each iteration:

  1. Selects the next available story (respecting dependencies)
  2. Executes your configured coding agent with full context
  3. Validates via quality gates (tests, linting, etc.)
  4. Commits on success, or resets and logs on failure
  5. Repeats until all stories are done

Core Concepts

PRD (Product Requirements Document)

A structured JSON file that defines your project:

graph TD
    PRD[πŸ“„ PRD] --> M[Metadata]
    PRD --> S[Stories]
    PRD --> G[Quality Gates]
    
    M --> M1[Project Name]
    M --> M2[Overview]
    M --> M3[Stack]
    
    S --> S1[US-001: Setup]
    S --> S2[US-002: Feature A]
    S --> S3[US-003: Feature B]
    S2 -.->|depends on| S1
    S3 -.->|depends on| S1
    
    G --> G1[go build]
    G --> G2[go test]
    G --> G3[go vet]
    
    style PRD fill:#6366f1,color:#fff
    style S fill:#8b5cf6,color:#fff
    style G fill:#f59e0b,color:#fff
Loading

Stories

The unit of work. Each story has:

  • ID β€” Unique identifier (US-001)
  • Dependencies β€” Other stories that must complete first
  • Status β€” open β†’ in_progress β†’ done

Guardrails

Persistent rules that guide the agent across all iterations:

Guardrail Description
Read Before Write Always read a file before modifying it
Test Before Commit Run tests before marking complete
One Task Per Iteration Focus on a single story
Handle Errors Don't ignore errors, handle them
Atomic Commits Keep commits focused and reviewable

Commands

Command Description
loopforge init Initialize LoopForge in current directory
loopforge build [n] Run the build loop (optionally n iterations)
loopforge prd generate Generate PRD from description
loopforge prd show Display current PRD status
loopforge agent list List available agents
loopforge agent set <name> Set default agent
loopforge guardrail list List all guardrails
loopforge watch Watch PRD for changes

Supported Agents

graph LR
    LF[LoopForge] --> C[Claude Code]
    LF --> X[Codex CLI]
    LF --> O[OpenCode]
    LF --> U[Custom Agent]
    
    style LF fill:#6366f1,color:#fff
    style C fill:#8b5cf6,color:#fff
    style X fill:#22c55e,color:#fff
    style O fill:#f59e0b,color:#fff
    style U fill:#64748b,color:#fff
Loading

Set your preferred agent:

loopforge agent set claude    # Anthropic Claude Code
loopforge agent set codex     # OpenAI Codex
loopforge agent set opencode  # OpenCode

Configuration

Configuration lives in .loopforge/config.yaml:

agent:
  name: claude
  timeout: 30m

build:
  maxIterations: 25
  autoCommit: true

guardrails:
  enabled: true

Project Structure

.loopforge/
β”œβ”€β”€ config.yaml      # Configuration
β”œβ”€β”€ prd.json         # Your PRD (track in git)
β”œβ”€β”€ progress.md      # Build progress log
β”œβ”€β”€ guardrails.md    # Custom guardrails
└── templates/       # Custom prompt templates

Documentation

Contributing

Contributions are welcome! See CONTRIBUTING.md for guidelines.

git clone https://github.com/matheus3301/loopforge.git
cd loopforge
go test ./...

Acknowledgments

Inspired by Ralph by @iannuttall.

License

MIT Β© Matheus Monteiro

About

Autonomous coding loops CLI - Orchestrate AI coding agents in iterative, PRD-driven development cycles

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

Languages