remoting/tools/magi-mode/README.md
Welcome to MAGI Mode, an advanced multi-agent protocol designed to tackle complex, high-stakes, or highly ambiguous architectural problems in large codebases.
When you encounter a problem where standard AI agents get stuck, face conflicting platform requirements, or need to make critical security and performance trade-offs, MAGI Mode triggers a Multi-Agent Consensus System within your local workspace.
Unlike a standard chat interface where a single AI tries to do everything (often losing context or hallucinating), MAGI utilizes a "Verification Loop" of specialized technical modules. It follows a "Lean" architecture that eliminates management overhead and focuses on high-efficiency execution.
Think of it as a multi-threaded validation pipeline:
Stochastic LLMs are powerful generators, but they lack the deterministic verification and domain specialization necessary to maintain high engineering standards in large, complex codebases. Left unguided, they frequently introduce regressions, memory safety bugs, or threading violations.
MAGI solves this by bringing systematic engineering rigor to LLM-driven coding:
true for all checklist items.To trigger the MAGI workflow, describe your task—especially if it is complex, multi-platform, or security-sensitive—and request the skill. For example:
"I have a complex IPC issue in the Windows service that's causing deadlocks. Please invoke the magi-mode skill to investigate and fix it."
The Orchestrator will handle the rest, keeping you informed at every major milestone.
personas/: The catalog of specialized expert definitions (Core, Domain,
Auxiliary, Languages, OS).magi_schema.json: The strict JSON data contracts that agents use to
communicate.SKILL.md: The core execution logic and protocol rules.ROUTING.md: The routing catalog for the Orchestrator..temp/: A transient directory used by agents to store drafts and reviews
without dirtying your git tree.To ensure the protocol's logic and the experts' capabilities remain reliable, MAGI includes a comprehensive testing suite:
SKILL_TEST_PLAN.md: The high-level strategy for testing the protocol,
including the use of mock harnesses and "flawed file" detection tests.SKILL_TEST.md: Contains the specific unit tests and verification logic for
the MAGI state machine.run_magi_tests.py: The primary script to execute the MAGI test suite.PRESUBMIT.py & PRESUBMIT_test.py: Ensure that any changes to MAGI files
(schemas, personas) adhere to the protocol's strict standards before they are
committed.The tests/ directory contains structured data used to validate each stage of
the protocol:
tests/magi_stage_specify_tests.json: Scenarios for requirement gathering and
scoping.tests/magi_stage_generate_tests.json: Scenarios for scaffolding, TDD, and
implementation.tests/magi_stage_refine_tests.json: Scenarios for review, consolidation, and
the verification loop.tests/testdata/: A collection of files with intentional flaws (e.g.,
Use-After-Free, Deadlocks, Memory Leaks) used to verify that the Domain
Experts can accurately detect real-world issues.