Loki Mode: System Overview
Relevant source files
The following files were used as context for generating this wiki page:
Loki Mode is an autonomous, multi-agent startup system designed to transform a Product Requirements Document (PRD) into a fully deployed production application with zero human intervention. It operates as a specialized skill within the Claude Code environment, leveraging a distributed architecture of specialized agents to handle the end-to-end Software Development Life Cycle (SDLC), from initial architectural design to final cloud deployment and growth loops.
The system dynamically orchestrates 37 specialized agent types organized into six functional swarms: Engineering, Operations, Business, Data, Product, and Growth. By utilizing a "Reason-Act-Reflect-Verify" (RARV) cycle, Loki Mode ensures high-quality output through self-correcting logic, automated testing, and comprehensive memory management that persists learnings across sessions.
Sources: bundled-skills/loki-mode/CONTEXT-EXPORT.md:8-15, bundled-skills/loki-mode/SKILL.md:14-25
Core Architecture and Orchestration
Loki Mode employs a hierarchical orchestration model where a high-level planner selects appropriate skills and dispatches tasks to local executors. The system is designed to scale dynamically based on project complexity, spawning anywhere from a few agents for simple tasks to over 100 for complex startups.
The RARV Cycle
Every iteration within the system follows the RARV (Reason-Act-Reflect-Verify) cycle to ensure deterministic outcomes and high quality.
The cycle emphasizes self-verification, where the AI tests its own work through automated unit, integration, and E2E browser tests before marking a task as complete.
Sources: bundled-skills/loki-mode/SKILL.md:145-171, bundled-skills/loki-mode/CONTEXT-EXPORT.md:10-14
SDLC Phase Flow
The system progresses through a linear but feedback-enabled pipeline of development phases.
| Phase | Description | Key Artifacts |
|---|---|---|
| Bootstrap | Initial environment and project setup | .loki/ directory, basic config |
| Discovery | PRD analysis and requirement extraction | Task queues, feasibility reports |
| Architecture | System design and API specification | openapi.yaml, C4 diagrams |
| Infrastructure | Cloud and database provisioning | Terraform/Pulumi scripts, DB schemas |
| Development | Functional code implementation | Source code, unit tests |
| QA | Comprehensive testing and verification | Test reports, E2E suites |
| Deployment | Production release | CI/CD pipelines, live URLs |
Sources: bundled-skills/loki-mode/SKILL.md:52-62, bundled-skills/loki-mode/CONTEXT-EXPORT.md:113-125
Agent Swarms and Model Selection
Loki Mode utilizes a multi-model strategy to optimize for cost, speed, and intelligence. Tasks are routed to specific Anthropic Claude models based on the complexity and nature of the work.
Model Utilization Matrix
| Model | Tier | Primary Use Cases |
|---|---|---|
| Opus 4.5 | Intelligence | High-level planning, architecture design, security audits |
| Sonnet 4.5 | Performance | Implementation, API development, integration testing |
| Haiku 4.5 | Efficiency | Unit tests, documentation, bash commands, monitoring |
Sources: bundled-skills/loki-mode/SKILL.md:175-195
Specialized Swarms
Agents are grouped into functional swarms to handle domain-specific logic:
- Engineering Swarm: Focuses on frontend, backend, and database implementation.
- Operations Swarm: Handles SRE, security, and cloud infrastructure.
- Review Swarm: Employs a "Blind Review System" where three agents independently critique code to reduce sycophancy.
Sources: bundled-skills/loki-mode/SKILL.md:286-296, bundled-skills/loki-mode/SKILL.md:323-330
State Management and Persistence
The system maintains its "working memory" and execution state within a hidden .loki/ directory. This ensures continuity even if a session is interrupted or rate-limited.
Critical State Files
.loki/CONTINUITY.md: The primary source of truth for the current session. It contains the current objective, recent progress, and a "Mistakes & Learnings" section used to avoid repeating errors..loki/state/orchestrator.json: Tracks overall phase progress and system metrics..loki/queue/: Containspending.json,in-progress.json, andcompleted.jsonto manage the distributed task queue.
Sources: bundled-skills/loki-mode/SKILL.md:27-40, bundled-skills/loki-mode/CONTEXT-EXPORT.md:88-100
Autonomous Execution and Safety
The system is designed for autonomous operation via a dedicated runner script (autonomy/run.sh).
Execution Protocol
The runner script performs the following sequence:
- Prerequisite Checks: Verifies Claude CLI, Python, Git, and necessary skills.
- Status Monitoring: Updates
.loki/STATUS.txtevery 5 seconds for human observation. - Auto-Resume: Handles rate limits with exponential backoff and continues until the completion promise is fulfilled.
- Guardrails: Implements severity-based blocking where "Critical" or "High" issues found during verification halt the pipeline.
Sources: bundled-skills/loki-mode/CONTEXT-EXPORT.md:73-86, bundled-skills/loki-mode/SKILL.md:330-335
Safety Mechanisms
Loki Mode utilizes "Circuit Breakers" for per-agent failure handling and "Tripwires" that trigger when validation fails. If a task exceeds its retry budget (typically 3 attempts) or consumes excessive tokens, it is moved to a dead-letter.json queue for manual intervention.
Sources: bundled-skills/loki-mode/CONTEXT-EXPORT.md:12-14, bundled-skills/loki-mode/SKILL.md:412-425
Summary
Loki Mode provides a robust framework for autonomous software creation by combining modular agent swarms with a disciplined state-management system. By enforcing a "Spec-First" and "Test-First" philosophy, it ensures that generated products—such as the verified Todo application—are production-ready and technically sound. The system's ability to learn from its own mistakes via the memory system makes it a self-optimizing engine for rapid application development.
Sources: bundled-skills/loki-mode/examples/todo-app-generated/TESTING_DOCUMENTATION.md:76-85, bundled-skills/loki-mode/SKILL.md:168-171