AI Decision System
Replayable, offline-verifiable records for AI-assisted go/no-go decisions: experiment promotions, typed model answers and human-approved actions.
Schemap compiles deterministic schema context for Cursor (.mdc), Claude Code (CLAUDE.md), and Codex (AGENTS.md). Stop hallucinated JOINs and cut token costs by 89%.
Developer toolsPython · TypeScriptGitHub @alansyahmiOnlineOwner unconfirmed
Have you tried it? One tap is enough. No sign-in needed.
No updates detected yet. GitHub releases will appear here.
Owners of public repositories under a personal GitHub account can sign in to verify ownership and manage the introduction themselves. No administrator approval is needed.
Sign in, generate a verification file, and commit it to this repository’s default branch within 30 minutes. Files on other branches or forks do not count. Then check the file below to manage the project without administrator approval. Keep the file to retain your access.
If needed, you will go to sign-in. After signing in, return here and press your chosen verification button again.
Run /nomorevibe verify in your project folder to verify ownership and manage the introduction yourself.
Verify in one minuteAsk about other verification options
Make your database understandable to AI coding agents. Schemap analyzes schemas, detects issues, maps relationships, and generates compact AI-ready context files for Claude Code, Codex, Cursor, and other AI tools.
Taken from the repository README
Loading the full README. The saved excerpt is shown below.
Schemap
The local semantic compiler for AI agents working with real databases.
Compile schema semantics, relationships, and database invariants into deterministic agent context. Verify generated SQL before it executes.
⚡ The Architecture: Grounding → Generation → Verification
AI coding assistants (Cursor, Claude Code, Windsurf, Codex) are fluent in SQL syntax, but fail at production relational databases because raw schema DDL omits implicit operational invariants:
🛑 The Problem: The Hidden Traps of Naked Schema PromptsRead the full README ↗AI coding assistants (Cursor, Claude Code, Windsurf, Codex) are fluent in SQL syntax, but fail at production relational databases because raw schema DDL omits implicit operational invariants:
SCHEMAP 4.0
┌─────────────────┐
│ Database Schema │
└────────┬────────┘
│ (Introspect tables, FKs, types)
▼
┌─────────────────────┐
│ Semantic Compiler │
│ │
│ • Entity Roles │
│ • Measure Units │
│ • Join Graphs │
│ • Tenant Invariants │
│ • Lifecycle Rules │
│ • Provenance Tags │
└─────────┬───────────┘
│
▼
GroundedPlan
│ (Provided to LLM via MCP or CLI)
▼
┌─────────────────────┐
│ AI Coding Agent │
│ (Claude, Cursor, │
│ Gemini, Codex) │
└─────────┬───────────┘
│
▼
Generated SQL
│
▼
┌─────────────────────┐
│ AST Policy Engine │
│ │
│ • Mutation blocking │
│ • Tenant validation │
│ • Soft-delete check │
│ • Cartesian hazard │
└─────────┬───────────┘
│
ALLOW / REJECT / RE-VALIDATE
│
▼
Database Execution
In production databases, queries fail not from syntax errors, but from missing invariants:
amount_cents), reporting $19,900.00 instead of $199.00 ($100\times$ metric distortion).deleted_at IS NOT NULL or is_deleted = TRUE) are counted as active data.org_id), leaking neighboring customer records.FROM invoices, plans) produce accidental Cartesian products.DELETE or DROP TABLE queries without execution safeguards.Schemap exposes three native MCP tools for Cursor, Claude Code, and Windsurf.
Add Schemap to your claude_desktop_config.json or .cursor/mcp.json:
{
"mcpServers": {
"schemap": {
"command": "uvx",
"args": ["schemap-tool", "mcp"],
"env": {
"DATABASE_URL": "postgresql://user:password@localhost:5432/production_db"
}
}
}
}
Zero YAML required. Schemap inspects the database connection locally and provides three tools:
| Tool | Phase | Function |
|---|---|---|
schemap_ground | Before writing SQL | Resolves target tables, foreign-key join paths, monetary measures, and tenant invariants with explicit provenance ([DECLARED] vs [INFERRED]). |
schemap_verify | Before executing SQL | Deny-by-default AST policy circuit breaker that blocks mutations (DELETE, DROP, UPDATE), Cartesian products, and tenant omissions. |
schemap_patch | Remediating SQL | Injects missing tenant and soft-delete filters, then re-validates the patched AST to ensure no hazards remain. |
For terminal workflows, scripts, and local pair-programming:
# 1. Ground an analytical question before writing SQL
schemap ground "What was Org 42's revenue last month?" --db "$DATABASE_URL" --tenant-id 42
# 2. Verify SQL before executing against production
schemap verify "SELECT * FROM orders" --db "$DATABASE_URL" --tenant-id 42
# 3. Patch missing invariants with safety re-verification
schemap patch "SELECT * FROM orders" --db "$DATABASE_URL" --tenant-id 42
Schemap maintains three canonical evaluation documents separating live model reasoning, controlled policy verification, and domain generalization:
schemap_verify blocked 2/2.DECLARED: Explicit constraints defined in DDL or configuration.INFERRED: Recovered via structural conventions (e.g. _cents, _id, timestamps).UNKNOWN: Flagged ambiguities (e.g., dual foreign keys between the same tables) requiring human declaration.Beyond real-time MCP grounding, Schemap includes tools for local repo maintenance:
schemap context compiles a token-compressed schemap_database_context.md.schemap agents generates synchronized CLAUDE.md, AGENTS.md, and .cursorrules.schemap doctor audits missing foreign keys, orphan tables, and naming consistency.Schemap is licensed under the MIT License.