LoopCode is an autonomous software engineering orchestrator built on top of OpenCode. It acts as the planning, state machine, knowledge, and verification layer that guides OpenCode through executing complex, multi-task software goals.
Disclaimer: This project is not affiliated with, sponsored by, or endorsed by the OpenCode/Anomaly team.
- Shared Memory Engine: All multi-agent communication is centralized through a unified SQLite persistence layer. Agents (Planner, Engineer, Reviewer, Verifier) pass structured contracts (Task Plans, Executions, Reviews) asynchronously without direct coupling.
- Semantic Knowledge & Code Graph: Fast local semantic embeddings using
fastembedandsqlite-vec. Incremental codebase indexing parses classes, functions, and variables viatree-sitter, augmented by a JSON-RPC Language Server Protocol (LSP) client. - Parallel Task Scheduling: Decomposes natural language goals into a Directed Acyclic Graph (DAG) of tasks. The
GitWorktreeSchedulerperforms a topological sort based on filewriteAllowlistpermissions and runs independent batches concurrently in isolated Git worktrees. - 5-Layer Verification Engine: Validates task correctness via:
- Layer 1: Compilation (Syntax/Type Checks)
- Layer 2: Lint & Style validation
- Layer 3: Unit Testing (e.g. Jest, bun:test)
- Layer 4: Security Scanning (
semgrep/trivywith regex fallbacks) - Layer 5: Independent LLM Review Agent
- Failure Evidence Re-planning: If a task exhausts its execution retries, compilation errors, test failures, and reviewer notes are injected directly back into the Planner Agent to self-correct the task DAG.
- Cost & Budget Limits: Enforces Monthly ➔ Goal ➔ Task spend caps. If breached, the system executes a
git reset --hardto rollback changes and terminates with exit code 77. - Loop/Oscillation Prevention: Hashes state signatures (phase, task index, modified files, and retry attempts) to detect infinite loops. Pauses execution and prompts the user for manual guidance if oscillation occurs.
- Dynamic Cascading Model Router: Maps tasks to optimal models (e.g., Claude Opus, Sonnet, Gemini Flash, DeepSeek Pro) based on task complexity overrides, budget caps, and caching adjustments.
You can install LoopCode globally using the standard installer, the npm global package fallback, or build it locally.
1. Standalone Binary Installer (Recommended)
curl -fsSL https://github.com/ghraw/arjun-vegeta/loopCode/main/install.sh | bash2. Global NPM Fallback (For environments without curl/bash access)
npm install -g loopcode3. Local Development Build
bun install
bun run build
bun run package # Compiles standalone binary via bun buildDecompose a natural language goal, plan, execute, and verify:
bun run src/index.ts "Add a new endpoint for user profile retrieval"If a task execution was interrupted (e.g., by a system crash or intentional pause), resume it by passing the task ID:
bun run src/index.ts --resume "<task-uuid>"-d, --db <path>: Path to the SQLite database (default:loopcode.db).-r, --resume <taskId>: UUID of the task to resume.
LoopCode checks for overrides in ~/.loopcode/config.toml:
[model]
default = "anthropic/claude-5-sonnet"
planning = "anthropic/claude-4.8-opus"
verification = "anthropic/claude-5-sonnet"
[budgets]
# Hard limits on USD spend
monthly = 100.0
goal = 10.0
task = 2.0Run all unit and integration test suites:
bun run testFor linting and styling check:
bun run lint
bun run formatThis project is licensed under the MIT License - see the LICENSE file for details.