Skip to content
| Marketplace
Sign in
Visual Studio Code>Machine Learning>LegionNew to Visual Studio Code? Get it now.
Legion

Legion

thenotoriousllama

|
3 installs
| (0) | Free
| Sponsor
The top tool for AI augmented development — a full AI agent army for any codebase. Deploys wiki-guardian (entity-graph wiki with [[backlinks]], ADR detection, contradiction protocol), library-guardian (module narrative + PRD authorship), mind-guardian (cognitive layer: RAG, coach routing, memory, ev
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info
Legion

Legion

Built for Cursor. Works in VS Code. A full AI agent army for any codebase.

Compounding entity-graph wiki. Module narrative docs. Cognitive-layer reviews.
Auth, DB, DevOps, payments, security, UX, design-system, SEO/AEO audits.
Fourteen guardians. One sidebar.

The God Protocol's flagship extension — engineered around Cursor's subagent model first, packaged for the VS Code Marketplace so it installs in either editor.


VS Code Marketplace Release pipeline Last commit GitHub stars License


Install in Cursor  ·  Install in VS Code  ·  Source  ·  Sponsor  ·  Linktree



Why Legion

Wiki Guardian

The cartographer. Builds and maintains a compounding entity-graph wiki with [[backlinks]], ADR detection, and a contradiction protocol that surfaces drift before it ships.

Library Guardian

The narrator. Writes per-module narrative documentation and PRDs the way a senior engineer would explain it on a whiteboard — what, why, how, and what could break.

Mind Guardian

The cognitive layer. RAG retrieval, coach routing, persistent memory, and evaluation across every other guardian. The brain behind the army.

Auth · DB · DevOps · Payments

Domain-specialist guardians that audit your authentication flows, database schemas, infrastructure, and billing pipelines for the patterns that actually break in production.

Quality · Security · React

Continuous review for code quality, security posture, and React patterns. Not a one-shot lint — a recurring agent that learns your codebase.

UX/UI · Design System · SEO/AEO · Asset

The frontline guardians for everything users actually see. Plus an asset guardian to keep media, fonts, and bundles in line.


What it does

Command What happens
Initialize Repository Scaffolds library/, .legion/, and .cursor/ (with selected guardians) in your repo. Writes a default .legionignore. Idempotent — safe to re-run.
Document Repository Walks the repo, chunks by module boundary, pre-computes git context per chunk, invokes guardians in parallel, reconciles wiki global state.
Update Documentation Same as Document, but only re-scans files whose hashes changed since the last scan. Cheap.
Scan Directory… Document/Update applied to a single directory you pick. Useful for focused work.
Lint Wiki Per-chunk validation — frontmatter, in-chunk wikilink resolution, pairing integrity, atomic-page-rule violations, ADR chain integrity.
Find Entity… Semantic search across the wiki (Cohere embeddings, TF-IDF fallback). Score badges, instant jump.
Autoresearch… Multi-round synthesis pass over the wiki + optional web grounding (Exa, Firecrawl, Context7).
Open Analytics Dashboard Coverage trends, contradiction rate, entity growth — rendered as live SVG charts.
Export Wiki… One-click export to Docusaurus, static HTML, or a flat Markdown bundle.
Install PR Review Bot 4-step wizard installs a GitHub Action that posts wiki-aware PR comments.
View Entity Graph Mermaid graph of your entity relationships, generated from the wiki.
Explain Why This Was Built Code-archaeology pass on the active file — surfaces the ADRs, commits, and decisions that produced it.

Quickstart

In Cursor (recommended)

  1. Open Cursor → Extensions panel (Ctrl/Cmd + Shift + X)
  2. Search for Legion (publisher: thenotoriousllama)
  3. Click Install — Cursor reads the same VS Code Marketplace, so the extension you see is this one
  4. Open the Command Palette (Ctrl/Cmd + Shift + P) → Legion: Initialize Repository → then Legion: Document Repository

Why Cursor first? Legion's guardians are subagents that talk to each other through Cursor's native subagent runtime. They run in VS Code too (via the same cursor agent CLI bridge or direct Anthropic API mode), but Cursor is where the architecture lights up — fan-out, parallel reasoning, and shared chat context all just work.

In VS Code

  1. Install from the Marketplace (or ext install thenotoriousllama.legion from the Command Palette)
  2. Set legion.agentInvocationMode to direct-anthropic-api and add your legion.anthropicApiKey (or set LEGION_ANTHROPIC_API_KEY) — this bypasses the Cursor CLI requirement
  3. Same Command Palette flow: Legion: Initialize Repository → Legion: Document Repository

That's it. The wiki lives at library/knowledge-base/wiki/. Commit it. Your future self thanks you.


Output structure

The shape Legion writes into your repo on first Initialize:

your-repo/
├── .legionignore                      # gitignore-style patterns to skip
├── .legion/                            # extension state (do not commit)
│   ├── config.json
│   ├── file-hashes.json               # hash manifest for delta tracking
│   ├── queue/                          # invocation queue (queue-file mode)
│   ├── git-cache/                      # cached git log/blame outputs
│   └── chunks/                         # in-progress scan state
├── .cursor/
│   ├── agents/
│   │   ├── wiki-guardian.md            # the entity cartographer
│   │   └── library-guardian.md         # the module-narrative author
│   └── skills/
│       ├── wiki-weapon/
│       └── library-weapon/
└── library/                            # the wiki itself (commit this)
    ├── knowledge-base/
    │   ├── <module>/                   # library-guardian writes module narratives here
    │   └── wiki/                       # wiki-guardian writes entity stubs here
    │       ├── index.md
    │       ├── hot.md
    │       ├── log.md
    │       ├── overview.md
    │       ├── entities/
    │       ├── concepts/
    │       ├── decisions/
    │       ├── comparisons/
    │       ├── questions/
    │       └── meta/
    ├── notes/
    ├── qa/
    └── requirements/
        ├── issues/
        └── features/

Companion plugins

Legion for Obsidian

Legion for Obsidian

Brings Legion's wiki operational state into Obsidian — status panel, contradiction inbox, human annotations, entity color coding, and a one-click trigger for incremental scans. Built for the non-developers on your team.

Read the Obsidian docs →


Settings

Most-used configuration (full list in package.json)
Setting Default Purpose
legion.agentInvocationMode cursor-sdk How agents are invoked. cursor-sdk (default, requires legion.cursorApiKey), direct-anthropic-api (requires legion.anthropicApiKey), queue-file (manual via Cursor slash command), or cursor-cli (deprecated alias for cursor-sdk)
legion.cursorApiKey (empty) Cursor API key for cursor-sdk mode. Get one at cursor.com/dashboard/cloud-agents. Prefer setting via CURSOR_API_KEY env var
legion.cursorSdkModel composer-2 Model ID for cursor-sdk mode. Use auto to let the server pick
legion.apiProvider anthropic LLM provider for direct-anthropic-api mode and Autoresearch — anthropic or openrouter
legion.model claude-sonnet-4-5 Claude model when using direct Anthropic API
legion.maxParallelAgents 3 Concurrency limit for parallel agent invocations
legion.installPostCommitHook false Install a post-commit git hook that queues Update on every commit
legion.semanticSearchEnabled true Enable semantic Find Entity (Cohere or TF-IDF)
legion.researchProvider model-only Web grounding for Autoresearch — model-only, exa, firecrawl, context7
legion.injectClaudeContext true Auto-update CLAUDE.md so Claude Code loads wiki context every session
legion.injectCursorContext true Auto-write .cursor/rules/wiki-hot-context.md for Cursor
legion.exportTarget html Default format for legion.exportWiki — docusaurus, html, or markdown

About the author

Mario Aldayuz

Mario Aldayuz

Marine Corps veteran. Creative-Director-turned-AI-founder. Automation architect.

After ~10 years as Creative Director at Blue Ridge Media Company, I traded calibration tools and brand systems for code — building intelligent systems that help businesses operate at peak performance.

Today I'm the founder of OllieBot.ai (omnichannel AI customer-service agent) and ManageN8N (the ultimate N8N instance manager), and I run elite automation consulting through Wise Guys Consulting. Legion is the tool I wish I'd had every time I dropped into a new codebase cold.

Off the clock — fine bourbon, a good cigar, and Harley the dog.

marioaldayuz.com  ·  Linktree  ·  GitHub


Support

If Legion saved you a weekend, buy me a coffee — or a finger of bourbon.

Buy Me a Coffee

Connect

  • Linktree — linktr.ee/marioaldayuz
  • Website — marioaldayuz.com
  • GitHub — @thenotoriousllama
  • Issues — github.com/thenotoriousllama/legion/issues

License

Legion is distributed under the Legion Source-Available License v1.0 (LSAL). Copyright (c) 2026 Mario Aldayuz. All rights reserved.

TL;DR — what you can do

  • Install, run, and use Legion for personal use or for your own organization's internal operations, on any number of devices you own or control.
  • Read and modify the source for your own internal use.
  • Publish, share, and distribute the Output Legion generates (wiki pages, exports, PR comments, dashboards, etc.) — anywhere, in any medium.

Attribution is required. Every published Output must keep a visible attribution and link, and any blog post, talk, demo, video, or screenshot featuring Legion must credit it. Use this string (or its functional equivalent in your medium):

Built with Legion by Mario Aldayuz

What you can't do — redistribute the Software (modified or unmodified), host it as a service for third parties, build a competing product on top of it, remove attribution, or use the Legion name and logo beyond reasonable nominative use.

Read the full terms in LICENSE. For commercial licensing, OEM redistribution, hosted offerings, or any permissions beyond the LSAL, reach out.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft