# Schemap — AI Database Context & Intelligence Layer > Schemap is the Database Intelligence Layer for AI Coding Agents. It compiles database schemas into compact, deterministic context maps (`schemap_database_context.md`, `CLAUDE.md`, `AGENTS.md`, `.cursor/rules/schemap.mdc`) for Claude Code, Cursor, Codex, and GitHub Copilot. ## Key Features & Capabilities - **AI Safety & Anti-Hallucination Guardrails (`schemap agents`)**: Injects negative safety rules into agent config files to prevent broken JOINs, credential leaks (`password_hash`), and financial record mutation. - **Role-Scoped Context Profiles (`schemap context --scope`)**: Filters schema compilation to role-specific views (`analytics`, `backend`, `core`, `all`), saving 80% on LLM prompt token costs. - **Monetary Cost & Token Inspector (`schemap benchmark --cost`)**: Calculates tokens saved per prompt and estimated monthly dollar savings per developer. - **Canonical Reference Query Generator (`schemap examples`)**: Auto-generates standard SQL JOIN queries derived from foreign key graphs. - **Git Pre-Commit Automation (`schemap hook install`)**: One-command Git pre-commit hook installer to sync context maps on migration commits. - **AI Readiness Diagnostics (`schemap doctor`)**: Diagnoses schema clarity (0-100 score), detects missing foreign keys, unmapped abbreviations, and un-commented tables. - **Shortest JOIN Path Solver (`schemap join`)**: Resolves multi-hop relationship paths across foreign key graphs. ## Supported Databases - PostgreSQL - SQLite - MySQL - Turso / libSQL - Oracle ## Quickstart & Installation ```bash # Install globally via pipx (recommended) pipx install schemap-tool # Or using uv uv tool install schemap-tool # Onboarding pipeline schemap quickstart # Compile AI context map schemap context --scope analytics ``` ## Competitor Comparisons & Technical Guides - Schemap vs LLMSchema & DbSketch: https://schemap-tool.pages.dev/vs-llmschema.html - Schemap vs tbls (Human Documentation vs AI Context): https://schemap-tool.pages.dev/vs-tbls.html - Schemap vs Raw pg_dump SQL DDL: https://schemap-tool.pages.dev/vs-pg-dump.html - Schemap vs Model Context Protocol (MCP) Servers: https://schemap-tool.pages.dev/vs-mcp-sql.html - Technical Guide: Stop AI Coding Agents from Hallucinating SQL JOINs: https://schemap-tool.pages.dev/blog-preventing-ai-sql-hallucinations.html - Technical Guide: Cutting AI API Token Costs by 80% on Production Schemas: https://schemap-tool.pages.dev/blog-token-optimization-db-context.html ## Licensing & Links - Website: https://schemap-tool.pages.dev/ - Documentation: https://schemap-tool.pages.dev/docs.html - GitHub Repository: https://github.com/alansyahmi/Schemap - PyPI Package: https://pypi.org/project/schemap-tool/ - Pricing: Free tier ($0 up to 100 tables) / Pro ($7.99/mo or $79.99 lifetime for unlimited tables & CI/CD)