Skip to main content
Glama
SlugThugLabs

slugaudit-mcp

by SlugThugLabs

🐌 SlugAudit

High-performance, zero-bloat repository intelligence for AI coding agents.

Release Rust 2024 Safety Tests Coverage MCP License

Stop burning 80% of your AI agent's context window on repetitive file scans.
SlugAudit indexes your codebase once, verifies freshness in sub-milliseconds on every keystroke, and arms your AI agent with queryable SQL and Tree-sitter AST tools. Your agent spends zero tokens on file rediscovery and 100% of its context on deep reasoning.


⚡ The Problem: Why AI Code Audits Fail

When you ask an AI coding agent to inspect or audit a codebase, it typically resorts to brute force:

  1. It lists directories and reads 40+ entire files looking for symbol definitions and call sites.

  2. It burns 100,000+ context tokens before writing a single line of analysis.

  3. As the context window fills up, the agent hits compaction, forgets earlier files, hallucinates stale paths, and enters paranoid re-validation loops.

Audit Metric

Without SlugAudit ❌

With SlugAudit ⚡

Context Cost

50,000–150,000+ tokens burned reading whole files

~400 tokens (returns only relevant symbols & AST spans)

Search Latency

15–60 seconds of slow disk I/O & file reading

< 2 ms directly from SQLite WAL & Tree-sitter

Freshness Guarantee

Stale caches; agent hallucinations on edited files

100% Guaranteed Fresh: Synchronous atomic reconcile on every read

Safety & Integrity

Script execution risks, unbounded write surfaces

Hardened Read-Only: SQLITE_OPEN_READ_ONLY + engine authorizers

Session Isolation

Old agent notes contaminate future runs

Zero Contamination: Session-scoped findings auto-purged on restart


Related MCP server: Code Expert MCP Server

🏗️ How It Works

SlugAudit acts as an invisible, high-speed telemetry and evidence layer between your filesystem and your AI agent over the standard Model Context Protocol (MCP):

graph LR
    subgraph Host ["Your Machine"]
        Repo["Source Code"]
        Watcher["File Watcher (inotify/kqueue)"]
    end

    subgraph SlugAudit ["SlugAudit MCP Engine"]
        TS["Tree-Sitter AST & BLAKE3 Hasher"]
        CAS["Atomic CAS Publishing"]
        DB[("Disposable SQLite Index\n.planning/slugaudit/project.db")]
        Guards["Read-Only Authorizer & Subquery Wrappers"]
    end

    subgraph Agent ["AI Coding Agent"]
        Client["Claude Code · Cursor · Codex · Hermes · Windsurf · Bob · Grok"]
    end

    Repo --> Watcher
    Repo --> TS
    TS --> CAS --> DB
    DB --> Guards --> Client
  1. Discovery & Hash: Respects .gitignore and .ignore recursively, walks the repo in milliseconds, and hashes files with BLAKE3.

  2. Deep AST Extraction: Runs Tree-sitter across 300+ languages to index functions, methods, imports, call hierarchies, comments, and syntax diagnostics.

  3. Atomic CAS Publish: Commits the entire index into an ephemeral SQLite database in .planning/slugaudit/project.db using compare-and-swap (CAS) concurrency control.

  4. Sub-millisecond Reconcile: Background watcher detects file edits. Every tool call verifies freshness synchronously before returning results—zero chance of stale data.

  5. Precise SQL & AST Tools: The AI agent queries exact facts (files, evidence, revisions) without ever touching the disk.


🎯 The Division of Labor

  • SlugAudit gathers facts: indexes, extracts, synchronizes, and searches.

  • The AI does the audit: interprets evidence, spots logic bugs, judges security implications, and refactors code.

SlugAudit does not judge code, assign arbitrary "scores", or tell your AI what to think. It provides ground truth so your AI can do real engineering.


🚀 Quick Start

1. Fast Install

# One-line universal installer (Linux x86_64 or builds via cargo):
curl -fsSL https://raw.githubusercontent.com/SlugThugLabs/slugaudit/main/install.sh | bash

# Or build locally from source with Cargo:
cargo install --path .

# Or run the interactive setup menu:
slugaudit menu

2. Connect Your AI Agent (One-Click)

SlugAudit automatically configures your favorite AI coding assistant:

slugaudit connect agy       # Antigravity (agy mcp add)
slugaudit connect gemini    # Gemini CLI (gemini mcp add)
slugaudit connect claude    # Claude Code (~/.claude.json)
slugaudit connect cursor    # Cursor IDE (~/.cursor/mcp.json)
slugaudit connect codex     # Codex CLI (~/.codex/config.toml)
slugaudit connect hermes    # Hermes Agent

(Run slugaudit connect without arguments to auto-detect installed agents interactively from your terminal).

To disconnect: slugaudit disconnect <agent> or pick from slugaudit disconnect.

3. Ask Your Agent Anything

Start a normal session with your agent and ask:

"Audit our authentication flow. Are token expiration checks enforced on every endpoint?"

Your agent will call report, query, and structure in the background—answering with exact line ranges in milliseconds without flooding your context.


🔌 Supported AI Agents & Editors

AI Client / Editor

Setup Command / Config

Scope

Status

Antigravity (agy)

slugaudit connect agy

Native CLI (agy mcp add)

✅ Native

Gemini CLI

slugaudit connect gemini

Native CLI (gemini mcp add)

✅ Native

Claude Code

slugaudit connect claude

Global (~/.claude.json)

✅ Native

Cursor

slugaudit connect cursor

Global (~/.cursor/mcp.json)

✅ Native

Windsurf

slugaudit connect windsurf

Global (mcp_config.json)

✅ Native

Trae AI IDE

slugaudit connect trae

Global (~/.trae/mcp.json)

✅ Native

OpenCode

slugaudit connect opencode

User config (opencode.json)

✅ Native

Hermes Agent

slugaudit connect hermes

Global CLI (hermes mcp add)

✅ Native

Codex

slugaudit connect codex

Global (~/.codex/config.toml)

✅ Native

GitHub Copilot CLI

slugaudit connect copilot

Global CLI (copilot mcp add)

✅ Native

Bob

slugaudit connect bob

Global (--scope global)

✅ Native

Grok

slugaudit connect grok

User Scope (~/.grok/config.toml)

✅ Native

Zed Editor

slugaudit connect zed

User settings (settings.json)

✅ Native

Pi / Oh My Pi

slugaudit connect pi / omp

User config (mcp.json)

✅ Native

1MCP / OpenHands

slugaudit connect 1mcp

Native CLI

✅ Native

Other MCP Clients

slugaudit menu (Option 4)

JSON snippet for any client

✅ Standard


🛠️ The 7 Native MCP Tools

Tool

Capability

Example AI Query

report

High-level project shape, file counts, language distribution, and syntax diagnostics.

report(path: ".")

query

High-speed read-only SQL queries against the indexed repository.

SELECT f.path, e.start_line, e.payload FROM evidence e JOIN files f ON e.file_id = f.id WHERE e.kind = 'Symbol'

structure

Tree-sitter AST queries across 300+ languages (supports single-file or multi-file search with lean snippets).

structure(language: "rust", query: "(function_item name: (identifier) @fn)")

finding

Store AI-reviewed conclusions bound to the file content hash.

Auto-invalidates if the underlying source lines change.

finding_read

Session-gated finding retrieval (prevents cross-session hallucination).

Read only findings created by the current agent.

project_control

Project enable/disable and cache management.

project_control(action: "on", path: ".")

health

Real-time watcher status, sync latency (last_sync_duration_ms), and counters.

Operational snapshot without side effects.

🎯 Context Optimization: Lean Results vs. Full Output

SlugAudit follows a "Results First, Full Code On-Demand" model to prevent burning the agent's context window while ensuring no data is ever hidden from an audit:

  • AST Pattern Search (structure):

    • Multi-File Search: Omit file to search across all files of a given language (optionally filtered by pattern, e.g. "src/**/*.rs"). Defaults to lean 1-line preview snippets (full_text: false, max 120 bytes) with exact start_line/end_line and column coordinates.

    • Single-File Search: Specify file to inspect a targeted file. Defaults to full AST code blocks (full_text: true, up to 1 MiB / 1,000,000 bytes).

    • Explicit Control: The agent can pass "full_text": false for compact coordinate-only sweeps across any scope, or "full_text": true to pull complete code blocks.

  • SQL Queries (query):

    • Selective Projection: The agent queries only what it needs (e.g. SELECT path, line_number FROM evidence WHERE ...) to stay lean, or SELECT content when full source text is required.

    • Paging with next_offset: Results are capped at 500 rows and up to 256 MiB+ per page (dynamically scaled to host RAM). When truncated: true, next_offset is provided so the agent can page through the entire dataset without context overflow.

🎛️ Profiles & Adaptive Host Memory

SlugAudit never imposes artificial barriers on codebases. Following the design standards of CodeQL and Semgrep, it dynamically scales resource limits to match the host hardware:

  • Adaptive (Default): Automatically detects physical and available host RAM (/proc/meminfo on Linux, sysctl on macOS). Dynamically scales import caches and per-file caps (up to 1 GiB single-file limit, half of available RAM for total project imports).

  • Audit: Deep audit mode for massive enterprise repos (256 MiB per-file cap, 32 GiB total import budget, 60s execution budgets).

  • Lean: Lightweight mode for resource-constrained environments (32 MiB per-file cap, 2 GiB total import budget, 10s execution budgets).

How to Configure:

  1. In-Repo Project Config: Add .planning/slugaudit/config.json to the audited repository:

    {
      "profile": "audit"
    }
  2. MCP Tool Control: Agents can select or change profiles on the fly:

    {
      "name": "project_control",
      "arguments": {
        "action": "on",
        "profile": "audit"
      }
    }
  3. Environment Overrides: Set SLUGAUDIT_PROFILE=audit or tune granular variables (e.g. SLUGAUDIT_MAX_FILE_BYTES=536870912).


⚡ Performance Benchmarks

Measured on standard development hardware (AMD Ryzen 9 / Linux kernel 6.x):

Operation

Benchmark / Metric

Latency / RSS

Repository Discovery

Walk & BLAKE3 hash 200 files

4.2 ms

Cold Tree-Sitter AST Parse

Full syntax extraction (Rust grammar)

370 µs

SQL Query Latency

General query + subquery authorizer

< 1.0 ms

Incremental Reconcile

Hot reload dirty file on keystroke

< 8.0 ms

Memory Footprint

Peak RSS during heavy repository sync

26.9 MiB

Code Safety

Crate-wide #![forbid(unsafe_code)]

0 unsafe blocks


📖 Query Cookbook & Recipes

Ready-to-run queries for AI agents and security auditors in examples/queries/:


Product boundary

The single end-user product is the slugaudit binary. Users install and configure it with their AI agent, and the binary operates on the user's own projects.

For each enabled user project, SlugAudit owns only this derived-data directory:

<user-project>/.planning/slugaudit/project.db

The surrounding .planning/ directory belongs to the user's project workflow. Its other files are ordinary user project data and may be indexed normally. SlugAudit excludes its own .planning/slugaudit/ directory from discovery.

The database is disposable derived data — delete it and any tool call rebuilds it from source.

Repository scope

See DEVELOPMENT_SCOPE.md for the distinction between this repository's development materials and the runtime behavior of SlugAudit inside a user's project.

Repository Structure & The .planning/ Directory

All architectural blueprints, design decisions, and runtime index data live inside .planning/:

  • Source of Truth: .planning/ARCHITECTURE.md is the canonical, authoritative source of truth for the codebase. It details the complete module map, data flow, process lifecycle, security boundaries, and the 10 core architectural invariants governing SlugAudit.

  • Design & Planning History: .planning/archive/ preserves historical planning records, architectural decision logs, and dependency inventories.

  • Disposable Runtime Cache: .planning/slugaudit/project.db houses the SQLite index and evidence tables. This is derived data that SlugAudit automatically creates and synchronizes—it can be deleted at any time and any tool call will rebuild it from source.

Keeping these artifacts organized inside .planning/ keeps the repository root uncluttered while providing both human developers and AI coding agents a dedicated, structured home for all architecture and design documentation.

Documentation

  • Architecture — the authoritative architectural specification (module map, data flow, security model, design FAQ)

  • Connection guides — agent-specific setup for Bob, Claude Code, Grok, and Codex

  • Archive — historical planning docs, decision log, dependency inventory

Development

Requires Rust 1.97.1+ (edition 2024) on Linux or macOS. Run the same gates CI uses:

cargo fmt --all -- --check
cargo clippy --all-targets --all-features -- -D warnings
cargo test --lib --bins --tests --all-features
cargo run --quiet --bin check_source_limits --locked
cargo run --quiet --bin check_docs_drift --locked
cargo run --quiet --bin check_no_duplicates --locked

#![forbid(unsafe_code)] is enforced crate-wide. Zero unsafe in src/.

Structured Logging

Diagnostics log to stderr with ANSI colors disabled by default. For automated log aggregators (e.g. Datadog, Grafana Loki, CloudWatch), set:

export SLUGAUDIT_LOG_FORMAT=json

All stderr events will be formatted as single-line JSON while stdout remains strictly JSON-RPC.

License

SlugAudit is free to use — including for your own commercial software. Use it to develop, audit, test, and maintain whatever you build, and you may sell the software you create with it. Software you make using SlugAudit (and the results it produces) does not become subject to SlugAudit's license just because the tool was used. The only thing you need to contact us about (admin@slugthuglabs.dev) is distributing SlugAudit itself — for example embedding, bundling, redistributing, sublicensing, or selling the tool as part of another product or service. That includes a company wanting to make SlugAudit a branded part of something they sell — we'd love to talk. Internal team and dev use is always free.

See the complete LICENSE for the binding terms.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

No tool schema history has been recorded yet.

Maintenance

ActivityActive
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/SlugThugLabs/slugaudit'

If you have feedback or need assistance with the MCP directory API, please join our Discord server