Skip to main content
Glama

Witnis

An engineering witness for AI coding agents.

Map the repo. Trace the blast radius. Verify with evidence — not vibes.

Witnis pairs with Harnis: the harness limits what an agent can do; the witness grounds what an agent can claim.

CI License Python Rust Release


Why it exists

Agents can edit files, run tests, and sound sure of themselves. They still often:

  • treat a text hit as a typed symbol

  • miss call, inherit, and override edges that define real blast radius

  • equate “tests passed once” with proof — without a gated verify path

  • answer without a machine-checkable evidence status

Grep and RAG find strings. They do not witness claims.

Witnis is local-first: index the tree into SQLite, answer through shared contracts, and keep Core facts free of any LLM.

Piece

Role

Index

Symbols and relations on disk — no cloud

Evidence envelope

Every reply carries status, evidence, limitations

Impact

Callers, related tests, change radius

Gated verify

Runs only with --execute and WITNIS_ALLOW_VERIFY=1

One Core

Same behavior on CLI · MCP · SDK · Studio

flowchart LR
  Repo[Repository] --> Index[SQLite index]
  Index --> Search[search / LSP]
  Index --> Trace[trace / impact]
  Trace --> Plan[plan-verify]
  Plan --> Gate{authorized?}
  Gate -->|no| Blocked[blocked]
  Gate -->|yes| Verify[verify]
  Index --> Studio[Studio]
  Index --> MCP[MCP]

Related MCP server: roam-code

Quick start

git clone https://github.com/L00PLeGeNd/Witnis.git
cd Witnis
pip install -e ".[dev,lsp]"

witnis demo                 # index sample + witness card
witnis index .              # or index your own repo
witnis look login           # search · trace · impact · tests · plan
witnis studio login --open  # HTML dashboard

Deeper cuts when you need them:

witnis search login
witnis trace login --plain
witnis plan login
witnis verify login          # blocked until authorized
WITNIS_ALLOW_VERIFY=1 witnis verify login --execute
witnis bench --suite public

Extras: .[lsp] (Jedi), .[rust] (maturin), or .[all].


How agents should use it

witnis index .
witnis look <symbol>
witnis plan <symbol>
WITNIS_ALLOW_VERIFY=1 witnis verify <symbol> --execute
witnis studio <symbol> --open

look is the short path: one card instead of four separate JSON dumps.
Playbook: examples/agent-playbook.md

Envelope shape

CLI, MCP, and SDK share the same JSON shape:

{
  "status": "success",
  "repository": { "name": "mini_py", "root_path": "..." },
  "result": {},
  "evidence": [
    {
      "type": "symbol",
      "status": "observed",
      "path": "auth.py",
      "line": 12,
      "name": "AuthService.login"
    }
  ],
  "limitations": ["Search is name/path FTS+LIKE, not embeddings"],
  "generated_at": "2026-11-03T12:00:00Z"
}

Statuses encode uncertainty: observed · derived · verified · unverified · contradicted · stale · …

Contracts: docs/contracts-v1.md


Surfaces

Layer

What you get

CLI

demo, look, index, search, trace, impact, plan, verify, studio, lsp, bench, …

MCP

repo_search, trace_symbol, analyze_impact, run_verification, query_lsp, render_studio, …

SDK

from witnis.sdk import index_repository, repo_search, trace_symbol, …

Studio

Static HTML (graph / evidence / report), en zh pt fr ru

Languages

Python (AST) · JS/TS · Go · Java (shallow)

LSP

Jedi · index fallback · optional Pyright diagnostics

Against simple baselines

Approach

Typed symbols

Call / impact

Evidence

Gated verify

git grep / naive scan

—

—

—

—

Regex def / class

shallow

—

—

—

Witnis

yes

yes

yes

yes

witnis baselines fixtures/mini_py

MCP (any compatible client)

Same Core over MCP for any compatible host or coding agent. Index the repo, then register the server:

{
  "mcpServers": {
    "witnis": {
      "command": "witnis",
      "args": ["mcp"],
      "env": {
        "WITNIS_DB": "/ABS/PATH/TO/repo/.witnis/index.sqlite"
      }
    }
  }
}

Sample: examples/mcp.example.json

Clients differ in config file layout; the important bits are the witnis mcp command and WITNIS_DB. Agents should call list_capabilities before assuming tool names.


Security posture

Read-only by default.

  • Paths sandboxed to the indexed root (symlink escapes rejected)

  • Sensitive names (.env, *.pem, *.key, …) skipped or flagged

  • Secret-like values redacted in previews

  • Verify stays blocked until you authorize it

  • Repo prose is untrusted input (prompt-injection aware)

More: SECURITY.md


Benchmarks

CI keeps the public suite green:

witnis bench --suite local
witnis bench --suite public

Suite

Scope

Local

fixtures/mini_py regressions

Public

mini_py + Go / JS / Java smokes + polyglot fixtures/public_svc

Public score (v1.8.0): 21 / 21.
Method: docs/benchmarks/PUBLIC.md · History: docs/benchmarks/public-scoreboard.md


Layout

adapters   CLI · MCP · SDK · Studio
    │
core       index · search · trace · impact · verify · evidence · LSP
    │
native     optional witnis._native (PyO3) → witnis-core (Rust)
    │
store      SQLite + FTS5 (symbols, relations, snapshots)

Python adapters install with plain pip. Rust speeds discover, digests, RustPython AST, and SQLite index/search. If _native is missing, Python paths still work.

Optional Rust tools

cargo test -p witnis-core
cargo run -p witnis-cli -- discover fixtures/mini_py
cargo run -p witnis-cli -- index fixtures/mini_go --db .witnis/rust-go.sqlite --full
cargo run -p witnis-cli -- search Login --db .witnis/rust-go.sqlite
cargo run -p witnis-cli -- overview --db .witnis/rust-go.sqlite

maturin build -m crates/witnis-py/Cargo.toml --release --out dist-native
pip install dist-native/witnis-*.whl

Env

Meaning

WITNIS_RUST_INDEX=1

Always use the Rust indexer

WITNIS_RUST_INDEX=auto

Rust indexer when _native is loaded

(default)

Rust for non-.py trees; Python AST for .py

WITNIS_ALLOW_VERIFY=1

Allow verify --execute

See docs/rust-migration.md.


Docs

Doc

Contents

docs/contracts-v1.md

Stable CLI / MCP / envelope

docs/rust-migration.md

Rust migration phases

docs/benchmarks/PUBLIC.md

Public bench method

SECURITY.md

Security defaults

CONTRIBUTING.md

Dev loop and PR expectations

CHANGELOG.md

Releases

examples/agent-playbook.md

Agent usage


Status

Ready for local Python-first agent work:

index → search / trace / impact → gated verify → Studio / MCP

Still ahead: a single Rust witnis binary, stronger language servers, larger third-party corpora.

Latest: v1.8.0


Contributing

See CONTRIBUTING.md. Keep pytest and witnis bench --suite public green.

License

Apache-2.0 — LICENSE.

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    C
    maintenance
    Enables AI clients to perform local code search, indexing, and analysis across Java, JavaScript/TypeScript, .NET/C#, and Python projects through the MCP protocol.
    1
    Apache 2.0
  • A
    license
    Not graded
    quality
    A
    maintenance
    Provides local codebase intelligence as an MCP server, enabling AI agents to query dependencies, assess change impact, and produce tamper-evident change evidence packets.
    323 PyPI
    516
    Apache 2.0
  • A
    license
    Not graded
    quality
    A
    maintenance
    Provides bounded repository context and edit-grant MCP tools to coding agents such as Codex, indexing local repositories and enabling fingerprint-checked patch application.
    23
    Apache 2.0
  • A
    license
    Not graded
    quality
    A
    maintenance
    Enables proof-backed code audit via MCP tools for AST-based code maps, symbol lookup, callers, audit commands, and persistent verdict memory.
    MIT