Skip to main content
Glama
forensic-contracts

forensic-contracts

forensic-contracts

CI License: Apache-2.0

Make AI-generated code explain itself in hours, not weeks — and mechanically block any function that escapes its declared @blast-radius cage.

forensic-contracts terminal demo

forensic-contracts is the 5th flagship in the open-source Agent Governance suite (alongside casebook, dual-brain-guard, autonomy-ladder, and governed-browser). It compiles the forensic code-archaeology doctrine from jfranco-forensic-contracts and the literal sourcePin verifier from jfranco-apices into a zero-dependency Node.js CLI, stdio MCP Server, and portable plugin.


What forensic-contracts Enforces

  1. The 5-Line Forensic Contract (@forensic-contract): Every critical function carries @id, @origin, @invariant, @blast-radius, and @golden-test. Missing tags trigger FORENSIC-CONTRACT-INCOMPLETE.

  2. The Blast-Radius Cage Enforcer (FORENSIC-CAGE-*): Scans the function body below each contract and exits 2 (CRITICAL_BLOCKER) if a function declared pure or zero-network calls fetch()/requests.get(), if a read-only/no-fs function mutates the filesystem, or if a no-shell function spawns a subprocess.

  3. Dangerous-Primitive Gate (FORENSIC-SEC-*): Blocks eval(), new Function(), nodeIntegration: true, contextIsolation: false, and raw shell execution.

  4. Literal sourcePin Verifier (RED_PARAPHRASE): Verifies character-by-character that any quote cited by an AI agent exists literally in the target source document. Paraphrases exit 2 (RED).


Related MCP server: platao

30-Second Quickstart

git clone https://github.com/JavierFrancoLeal/forensic-contracts.git
cd forensic-contracts
npm test

# 1. Audit a file or directory for @forensic-contract completeness and blast-radius cages
node src/cli.mjs scan src/

# 2. Verify a literal quote character-by-character against a source document (sourcePin)
node src/cli.mjs source-pin --file skills/forensic-contracts/SKILL.md --quote "Never Sign a Paraphrase"

MCP Server Integration (Claude Code / Cursor / Gemini CLI / Antigravity)

{
  "mcpServers": {
    "forensic-contracts": {
      "command": "node",
      "args": ["/absolute/path/to/forensic-contracts/src/mcp-server.mjs"]
    }
  }
}

Exposed MCP tools:

  • forensic_audit_codebase — audits files/directories for @forensic-contract completeness, @blast-radius cage compliance, and dangerous primitives

  • forensic_verify_source_pin — verifies character-by-character literal quotes (GREEN vs RED_PARAPHRASE)

  • forensic_generate_contract_stub — generates a canonical 5-line @forensic-contract header for JS/TS or Python


Technical Essay

Read the full engineering rationale in Code Archaeology for AI-Written Software: Why Comments Must Become Executable Cages.


Open-Source Agent Governance Suite

Repository

Role

Status

casebook

Bounded-entropy 4-tier constitutional memory, Open Symptoms Radar & 5-to-1 compaction oracle

v1.0.1 Live

dual-brain-guard

Harness-agnostic mechanical Proposer != Verifier cross-model guard (CLI + MCP + hooks)

v1.1.1 Live

autonomy-ladder

Evidence-based Traffic-Light autonomy grader (🟢 / ⚑ / 🟡 / 🔴 & A/B/C/D trust scores)

v1.0.2 Live

governed-browser

Constitutional commit-click brake (🛑 RED on Send/Pay/Delete) & SHA-256 hash-chained audit trail

v1.0.1 Live

forensic-contracts

5-line @forensic-contract linter, @blast-radius cage enforcer & literal sourcePin verifier

v1.0.1 Live

agent-governance

Complete 26-plugin DeepSeek Harness governance suite (mother repository)

v1.0.0 Live

best-security-governance-architects

CPU-first pre-merge security & governance suite (ECOSYSTEM_CONTRACT v1.2.0)

v1.2.0 Live

best-ui-ux-designers

Adversarial UI/UX design judgment suite — 12 Barbell design minds & 4 Via Negativa auditors

v1.2.0 Live


License

Apache-2.0 — see LICENSE.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables coding agents to run deterministic completeness audits on code before declaring 'done'—catching unwired modules, placebo tests, swallowed errors, and stubs via AST analysis, entirely offline and free.
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      Enables compatible AI coding agents to inspect authorized software artifacts, analyze JavaScript/TypeScript and native binaries, optionally perform Ghidra decompilation, and produce verifiable evidence-linked technical reports.
      11
      MIT