Skip to content

user-hash/Lifeblood

Repository files navigation

Lifeblood

Compiler-as-a-service for AI agents.

Lifeblood gives AI agents direct access to what compilers know. Type resolution, call graphs, diagnostics, reference finding, code execution. All over a standard MCP connection. No IDE required. Load a project, ask the compiler, get verified answers. Compilers already know everything about your code, just pipe that truth to AI agents instead of letting them grep and guess.

Roslyn (C#)    ──┐                              ┌──  Execute code against project types
TypeScript     ──┤  ┌────────────────────────┐  ├──  Diagnose / compile-check
JSON graph     ──┼→ │    Semantic Graph      │ →┤──  Find references / rename / format
               ──┤  │  (symbols / edges /    │  ├──  Blast radius / file impact
  community    ──┘  │   evidence / trust)    │  └──  Context packs / architecture rules
  adapters          └────────────────────────┘

Born from shipping a 400k LOC Unity project with AI assistance and realizing that AI writes code but does not verify what it wrote.


Quick Start

Install (30 seconds)

dotnet tool install --global Lifeblood
dotnet tool install --global Lifeblood.Server.Mcp

Requires .NET 8 SDK.

Connect to Claude Code, Cursor, or any MCP client

Add to your project's .mcp.json:

{
  "mcpServers": {
    "lifeblood": {
      "command": "lifeblood-mcp",
      "args": []
    }
  }
}

See MCP Setup Guide for Claude Desktop, VS Code, Cursor, and raw stdio configs.

Use

lifeblood_analyze projectPath="/path/to/your/project"   → load semantic graph
lifeblood_blast_radius symbolId="type:MyApp.AuthService" → what breaks if I change this?
lifeblood_file_impact filePath="src/AuthService.cs"      → what files are affected?
lifeblood_find_references symbolId="type:MyApp.IRepo"    → every caller, every consumer
lifeblood_execute code="typeof(MyApp.Foo).GetMethods()"  → run C# against your types

After the first analysis, use incremental: true for fast re-analysis (seconds instead of minutes).

CLI (for CI and scripting)

lifeblood analyze --project /path/to/your/project
lifeblood analyze --project /path/to/your/project --rules hexagonal
lifeblood context --project /path/to/your/project
lifeblood export  --project /path/to/your/project > graph.json

Build from source

git clone https://github.com/user-hash/Lifeblood.git
cd Lifeblood
dotnet build
dotnet test

17 Tools

Connect an MCP client. Load a project. The AI agent gets 17 tools: 7 read, 10 write.

Tools
Read Analyze, Context, Lookup, Dependencies, Dependants, Blast Radius, File Impact
Write Execute, Diagnose, Compile-check, Find References, Find Definition, Find Implementations, Symbol at Position, Documentation, Rename, Format

Full tool reference


Architecture

Hexagonal. Pure domain core with zero dependencies. Language adapters on the left, AI connectors on the right.

LEFT SIDE                     CORE                     RIGHT SIDE
(Language Adapters)        (The Pipe)               (AI Connectors)

Roslyn (C#)       ──┐                            ┌──  MCP Server (17 tools)
TypeScript        ──┼→  Domain  →  Application  →┤──  Context Pack Generator
JSON graph        ──┘       ↑                     ├──  Instruction File Generator
                      Analysis (optional)         └──  CLI / CI

14 port interfaces, all wired. Boundaries enforced by architecture invariant tests and 11 frozen ADRs.

Architecture Diagram

Full architecture | Interactive diagram


Three Languages, One Graph

Adapter How it works Confidence
C# / Roslyn Compiler-grade semantic analysis. Cross-module resolution. Bidirectional: analysis + code execution. Proven
TypeScript Standalone Node.js. ts.createProgram + TypeChecker. High
Python Standalone ast module. Zero dependencies. Structural
Any language Output JSON conforming to schemas/graph.schema.json. Adapter guide. Varies

Unity Integration

Lifeblood runs as a sidecar alongside Unity MCP. All 17 tools available in the Unity Editor via [McpForUnityTool] discovery. Runs as a separate process, so no assembly conflicts, no domain reload interference.

Unity setup guide


Dogfooding

Self-analysis: 1,148 symbols, 3,196 edges, 11 modules, 150 types, 0 violations.

Production-verified on a 75-module Unity project: 43,800 symbols, 70,600+ edges, 2,404 types.

Six sessions found 45 real bugs invisible to unit tests.


Roadmap

  • Community adapters: contribution guides for Go and Rust. Contract and checklist ready, no implementation code yet.
  • REST / LSP bridge: expose the graph to IDE extensions and web services.

Documentation

Page Description
Tools All 17 tools with descriptions, symbol ID format, incremental usage
MCP Setup Copy-paste configs for Claude Code, Cursor, VS Code, Claude Desktop, Unity
Unity Integration Sidecar architecture, setup guide, incremental, memory
Architecture Hexagonal structure, dependency flow, port interfaces, invariants
Architecture Decisions 11 frozen ADRs
Status Component table, test counts, self-analysis, production stats
Adapters How to build a language adapter (13-item checklist)
Dogfood Findings 45 bugs found by self-analysis

Related

License

AGPL v3