Loki Mode: Agent Swarms
Relevant source files
The following files were used as context for generating this wiki page:
Loki Mode is a multi-agent autonomous startup system designed to transform a Product Requirements Document (PRD) into a fully deployed, revenue-generating product with zero human intervention. It operates by orchestrating specialized AI agents organized into distinct swarms, ensuring that every phase of the Software Development Life Cycle (SDLC)—from discovery to growth—is handled by domain-specific experts.
The system utilizes a dynamic scaling approach, spawning only the necessary agents based on project complexity. For simple tasks, it may deploy 5-10 agents, while complex startups can trigger a swarm of over 100 agents working in parallel. This orchestration is governed by the RARV (Reason-Act-Reflect-Verify) cycle, ensuring high-quality output through continuous self-verification and autonomous error recovery.
Sources: bundled-skills/loki-mode/README.md:1-20, bundled-skills/loki-mode/SKILL.md:1-15, bundled-skills/loki-mode/CONTEXT-EXPORT.md:9-15
Swarm Architecture and Specialization
Loki Mode organizes 37 specialized agent types into seven functional swarms. Each swarm has a specific domain of responsibility within the project lifecycle.
Swarm Classifications
| Swarm | Agent Count | Responsibilities |
|---|---|---|
| Engineering | 8 | Frontend, Backend, Database, Mobile, API, QA, Performance, Infrastructure |
| Operations | 8 | DevOps, SRE, Security, Monitoring, Incident, Release, Cost, Compliance |
| Business | 8 | Marketing, Sales, Finance, Legal, Support, HR, Investor, Partnerships |
| Data | 3 | ML, Data Engineering, Analytics |
| Product | 3 | Project Management, Design, Technical Writing |
| Growth | 4 | Growth Hacking, Community, Success, Lifecycle |
| Review | 3 | Code, Business, and Security Reviews |
Sources: bundled-skills/loki-mode/SKILL.md:323-335, bundled-skills/loki-mode/README.md:200-220
Hierarchy and Coordination
The system employs a hierarchical reasoning structure where a high-level planner (typically powered by the Opus model) selects specialized skills and dispatches them to local executors.
This diagram illustrates the hierarchical dispatch mechanism from the master Orchestrator down to specific specialist agents within a swarm.
Sources: bundled-skills/loki-mode/SKILL.md:135-145, bundled-skills/loki-mode/autonomy/CONSTITUTION.md:50-70
The RARV Execution Cycle
Every agent within a swarm follows the Reason-Act-Reflect-Verify (RARV) cycle to ensure autonomous progress and quality control.
- Reason: Agents read the
.loki/CONTINUITY.mdworking memory and "Mistakes & Learnings" log to identify the next priority task. - Act: The agent executes the task (e.g., writing code or configuring infrastructure) and creates a git checkpoint.
- Reflect: The agent updates
CONTINUITY.mdwith progress and evaluates if the completion promise was fulfilled. - Verify: The agent runs automated tests (unit, integration, or E2E) and checks against the
.loki/specs/openapi.yamlsource of truth.
The RARV cycle ensures that failures result in updated memory and retries rather than system halts.
Sources: bundled-skills/loki-mode/SKILL.md:95-120, bundled-skills/loki-mode/README.md:120-145
Model Selection Strategy
Agents are assigned different LLM models based on the complexity and nature of their tasks to optimize for cost and performance.
- Opus (Planning & Architecture): Used for high-level system design, security audits, and complex refactoring decisions.
- Sonnet (Development): Used for feature implementation, API development, and functional testing.
- Haiku (Operations): Used extensively for unit tests, documentation, bash commands, and monitoring.
Parallelization Strategy
Haiku agents are often deployed in parallel (e.g., 10+ agents) to run unit test suites or generate documentation simultaneously, significantly reducing wall-clock time.
Sources: bundled-skills/loki-mode/SKILL.md:148-185, bundled-skills/loki-mode/CLAUDE.md:25-30
Agent Behavioral Contracts
All agents operate under a "Constitution" that defines their responsibilities and prohibitions to prevent context drift and ensure safety.
Engineering Swarm Contract
- Responsibilities: Implement features per OpenAPI spec, write contract tests before implementation, and create git commits for every task.
- Prohibitions: Cannot implement code without an existing spec or skip tests.
- Context Obligation: Must log all decisions to
.agent/sub-agents/${agent_id}.md.
Review Swarm Contract
Every implementation is subjected to a Parallel Blind Review System involving three specialized reviewers:
- Code Reviewer (Opus): Checks patterns and best practices.
- Business Logic Reviewer (Opus): Validates against PRD requirements.
- Security Reviewer (Opus): Scans for vulnerabilities.
The Parallel Blind Review prevents sycophancy and ensures multiple perspectives on every code change.
Sources: bundled-skills/loki-mode/autonomy/CONSTITUTION.md:85-110, bundled-skills/loki-mode/README.md:255-270, bundled-skills/loki-mode/SKILL.md:275-285
Memory and State Management
Agents share a multi-tiered memory system to maintain continuity across swarm interactions.
| Tier | Directory | Purpose |
|---|---|---|
| Episodic | .loki/memory/episodic/ | Specific interaction traces and interaction history. |
| Semantic | .loki/memory/semantic/ | Generalized patterns and learned domain knowledge. |
| Continuity | .loki/CONTINUITY.md | Active working memory and current session status. |
| Ledgers | .loki/memory/ledgers/ | Append-only logs of agent-specific checkpoints. |
Sources: bundled-skills/loki-mode/SKILL.md:365-385, bundled-skills/loki-mode/autonomy/CONSTITUTION.md:150-170, bundled-skills/loki-mode/CLAUDE.md:38-42
Summary
Agent swarms in Loki Mode represent a shift from sequential code generation to a parallel, domain-specific organizational structure. By combining model-optimized task assignment with a strict behavioral constitution and the RARV verification cycle, the system maintains high autonomy while ensuring production-grade quality. The use of specialized swarms for Engineering, Operations, and Business allows Loki Mode to handle the entire lifecycle of a startup beyond mere implementation.
Sources: bundled-skills/loki-mode/README.md:70-90, bundled-skills/loki-mode/CONTEXT-EXPORT.md:9-25