debim logo

A minimal, Git-native, declarative BIM engine & Model Context Protocol (MCP) Server for AI agents and humans.

PyPI Version Release v1.1.0 WinGet Package (Pending Review) Homebrew Tap Glama MCP Server Score MCP Server Docker GHCR License: MIT Python: 3.11+ BIM: IFC4 Tests: 822 Passed Visual Fidelity: 85.5% Median Live 3D Demo

Open Live 3D Demo

---

πŸ’» Modern CLI, QTO & Costing Engine
debim Terminal CLI - Farnsworth House
🌐 Zero-Install 3D Web Viewer (Try Live Demo)
debim 3D HTML Viewer - Farnsworth House (1951)
πŸ›οΈ Showcase: Ludwig Mies van der Rohe's iconic Farnsworth House (1951) β€” compiled from declarative .debim (examples/farnsworth_house/project.debim) into standard IFC4 and rendered in real-time in a lightweight 3D web viewer.

> [!TIP] > **πŸ€– Authored 100% by AI Agent (Antigravity powered by Gemini 3.8 Flash):** > This iconic architectural masterpiece was **not coded by hand line-by-line!** Instead, an **autonomous AI Coding Agent (Google Antigravity powered by Gemini 3.8 Flash)** researched historical blueprints, structural grids, and architectural dimensions of the Farnsworth House, synthesized the declarative .debim specification (`project.debim`), computed material quantities (QTO), and compiled standard IFC4 building models in seconds β€” proving that **humans don't need to manually code YAML when assisted by AI agents!** --- ## 🎯 Why debim? > *"debim originated from a simple desire: to make AI calculate accurate Bills of Quantities (BOQ). Asking an LLM to guess building dimensions directly in text leads to fatal hallucinations. An exact mathematical model (BIM) is essential, yet traditional IFC files are bloated and overwhelm AI context windows. The solution is Declarative YAML β€” but the resulting Building-as-Code engine proved far more transformative than our initial goal."* Traditional BIM tools (like Revit or Archicad) were conceived over 25 years ago for humans clicking with computer mice. They lock architectural data inside heavy, proprietary gigabyte files (`.rvt`), charge thousands of dollars in annual licenses, and remain completely opaque to modern automation and AI agents. **debim** is built on **6 Core Architectural Tenets**: 1. **Building-as-Code & Git-Native:** Buildings are software. Expressed as compact YAML/`.debim` (Kilobytes, not Gigabytes) for transparent Version Control, line-by-line Git diffs, and branching. 2. **Deterministic Code Compliance:** Building codes and engineering regulations are treated as automated Unit Tests (`pytest`), catching setback violations and structural errors in 0.01 seconds before ground is broken. 3. **Zero-License & Zero-Friction Visualization:** Instant geometric verification through lightweight 3D HTML viewers that load in any browser or mobile device in 2 seconds without expensive licenses. 4. **Universal Bridge & Dual Representation:** Seamlessly connects 2D drafts, 3D DCC tools (Blender/SketchUp), and open IFC standards using a dual approach: 90% geometric primitives for engineering/BOQ + 10% baked GLB assets for architectural refinement. 5. **Human & AI Super-Collaboration:** Designed with explicit uncertainty flags (`review_status: needs_review`), enabling humans and autonomous AI agents to co-author and verify building models without friction. 6. **"The Mermaid.js of BIM" (Zero-Dependency & Air-Gapped Sandboxes):** Operates seamlessly inside secure enterprise environments, air-gapped VMs, and LLM Code Interpreters (ChatGPT, Claude Artifacts, Gemini Code Execution) using 100% Python Standard Library with **zero pip dependencies**. > [!NOTE] > **πŸ”’ The "Mermaid.js" Philosophy for Isolated VMs & Sandboxes:** > Just as **Markdown** freed documentation from MS Word and **Mermaid.js** freed diagramming from Visio, **debim** frees building design from 20GB closed CAD suites. An AI agent in an offline, air-gapped VM without internet access can analyze requirements and generate an exact `.debim` file in 0.01 seconds. Downstream systems and community compilers outside the sandbox then turn that file into IFC4, AutoCAD DXF, or full bills of quantities! --- ## πŸ€– Autonomous AI-Agent Setup If you use an AI coding assistant (like **Antigravity, Cursor, Claude Code, Jules, or ChatGPT/Copilot**), you don't even need to install it manually! Just copy and send this prompt to your AI: > *"Please read https://github.com/PRIDA-TAKON/debim and `AGENTS.md`, install debim in my environment, and run `debim --help` to verify."* Your agent will inspect the repository, install the dependencies, and verify everything automatically. --- ## πŸ”Œ Model Context Protocol (MCP) Server [![Start MCP server over stdio on AI Agents Listing](https://aiagentslisting.com/start-mcp-server-over-stdio/badge.svg?claim=f00d0960b82d5893768a8a2b8596df32)](https://aiagentslisting.com/mcp/start-mcp-server-over-stdio) `debim` natively implements the official **[Model Context Protocol (MCP)](https://modelcontextprotocol.io/)** via `FastMCP` (Python SDK). It provides LLMs and AI Agents (such as Claude Desktop, Cursor, Cline, Windsurf, Devin, and Antigravity) with deterministic tools to model, inspect, calculate, compile, and visualize buildings directly via function calling. ### Connecting to Claude Desktop / Cursor / Cline Add `debim` to your MCP configuration (`claude_desktop_config.json` or `.cursor/mcp.json`): ```json { "mcpServers": { "debim": { "command": "debim", "args": ["mcp"] } } } ``` Or run via Docker: ```json { "mcpServers": { "debim": { "command": "docker", "args": ["run", "-i", "--rm", "ghcr.io/prida-takon/debim:latest"] } } } ``` ### Exposed MCP Tools | MCP Tool | Description | Input Parameters | |---|---|---| | `debim_validate` | Validates YAML manifest syntax, structural grid alignments, storey heights, and material references. | `manifest_yaml: str` | | `debim_qto` | Computes deterministic Quantitative Take-Off (concrete vol, formwork area, rebar kg, structural steel, timber, masonry). | `manifest_yaml: str` | | `debim_cost_template` | Extracts materials used by the building model and generates a minimal project-scoped price catalog template. | `manifest_yaml: str` | | `debim_cost` | Maps QTO quantities against unit prices, calculates total project cost, and optionally exports BOQ to CSV. | `manifest_yaml: str`, `prices_yaml?: str`, `export_csv_path?: str` | | `debim_compile_ifc` | Compiles declarative YAML into an open, standardized buildingSMART IFC4 model (`.ifc`). | `manifest_yaml: str`, `output_ifc_path: str` | | `debim_generate_viewer` | Generates a standalone, zero-dependency interactive 3D WebGL HTML viewer with section cut and layer tree. | `manifest_yaml: str`, `output_html_path: str` | | `debim_urban_ingest` | Ingests OpenStreetMap Overpass BBox or GeoJSON into native .debim urban manifest YAML. | `bbox?: List[float]`, `geojson_str?: str`, `crs_epsg?: int` | ### Running the MCP Server Locally ```bash # Start MCP server over stdio debim mcp ``` --- ## πŸš€ Quickstart ### 1. Installation `debim` is officially available on **[PyPI](https://pypi.org/project/debim/)** and requires **Python 3.11+**. Choose your operating system and preferred terminal: #### πŸͺŸ Windows (PowerShell / Command Prompt) ```powershell # Option A: Isolated CLI (Recommended via pipx or uv tool) pipx install "debim[all]" # or: uv tool install "debim[all]" # Option B: Standard pip python -m pip install --upgrade pip pip install "debim[all]" # Option C: Windows Package Manager (Zero-Python / One-Click Native) # Note: Manifest is currently pending upstream review on microsoft/winget-pkgs # winget install debim # Verify installation debim --help ``` #### 🍎 macOS (Terminal / zsh) ```bash # Option A: Native Homebrew Tap (Recommended on macOS) brew install PRIDA-TAKON/debim/debim # Option B: Isolated CLI (via pipx) brew install pipx pipx ensurepath pipx install "debim[all]" # Option C: uv tool uv tool install "debim[all]" # Option D: Virtual Environment python3 -m venv .venv source .venv/bin/activate pip install "debim[all]" # Verify installation debim --help ``` #### 🐧 Linux (Ubuntu / Debian / Fedora / Arch) ```bash # Option A: Isolated CLI (Recommended on Ubuntu 23.04+ / Debian 12+) sudo apt update && sudo apt install -y python3-pip python3-venv pipx pipx ensurepath pipx install "debim[all]" # Option B: Virtual Environment python3 -m venv .venv source .venv/bin/activate pip install "debim[all]" # Option C: uv tool uv tool install "debim[all]" # Verify installation debim --help ``` #### πŸ“¦ Package Extras Summary | Package Target | Command | Included Capabilities | |---|---|---| | **Core** | `pip install debim` | Fast CLI, Declarative YAML engine, 3D WebGL viewer generator, QTO, Thai CGD ΰΈ§480 BOQ (ΰΈ›ΰΈ£.4/ΰΈ›ΰΈ£.5), Modular replication, Pure-Python STEP export | | **All (Recommended)** | `pip install "debim[all]"` | Full suite: Core + IFC4 Compiler (`ifcopenshell`) + FastMCP Server + DOCX Specification Builder | | **IFC only** | `pip install "debim[ifc]"` | Core + buildingSMART IFC4/IFC4X3 compiler (`ifcopenshell`) | | **MCP only** | `pip install "debim[mcp]"` | Core + Model Context Protocol server for Claude / Cursor / Antigravity | | **DOCX only** | `pip install "debim[docx]"` | Core + Specification Book compiler to Microsoft Word (`python-docx`) | #### 🐳 Docker Container (Zero-Install & Sandbox) If you prefer not to install Python locally or want to run `debim` in an isolated sandbox for AI agents: ```bash # Pull official pre-built image from GitHub Container Registry (GHCR) docker pull ghcr.io/prida-takon/debim:latest # Run debim MCP Server over stdio for AI Agents / Claude Desktop docker run -i --rm ghcr.io/prida-takon/debim:latest # Or execute CLI commands in your current directory docker run --rm -v "${PWD}:/workspace" -w /workspace ghcr.io/prida-takon/debim:latest debim --help # Alternatively, build the container image locally from source docker build -t debim . ``` #### πŸ”’ Air-Gapped Sandboxes & Zero-Dependency Execution (Pure Standard Library) In highly secured enterprise environments, air-gapped VMs, or LLM Code Interpreter sandboxes (e.g., **ChatGPT Advanced Data Analysis, Claude Artifacts, Gemini Code Execution, Kaggle**) where internet access and `pip install` are restricted: ```bash # Run standalone zero-dependency engine (Pure Python Standard Library: math, json, re, argparse) # Requires ZERO pip packages: python skills/debim/scripts/debim_zero.py validate -m model.debim python skills/debim/scripts/debim_zero.py qto -m model.debim ``` #### πŸ› οΈ Install from Source (Development) ```bash git clone https://github.com/PRIDA-TAKON/debim.git cd debim pip install -e ".[all,dev]" ``` ### 2. Basic Commands (v1.0.0) ```bash # Initialize a new project debim init my-project # Validate schema syntax, structural continuity & bounding-box clash detection debim validate -m examples/farnsworth_house/project.debim # Run automated building code compliance checks (pytest) debim test # Calculate Quantitative Take-Off (Concrete m3, formwork m2, rebar kg) debim qto -m examples/farnsworth_house/project.debim # Generate official Thai Government BOQ (CGD ΰΈ§480 with Factor F & steel density) debim boq --rules cg-v480 --province nakhon_ratchasima -m project.debim -o dist/boq_v480.csv # Generate project-scoped price template with international classifications debim cost template -m examples/farnsworth_house/project.debim -o prices.template.yaml # Estimate project budget & export commercial BOQ to CSV debim cost -m examples/farnsworth_house/project.debim -p examples/farnsworth_house/prices.yaml -o dist/boq.csv # Scaffold a new BIM element class boilerplate debim scaffold element IfcRailing # Preview 3D model in your browser (Three.js with Hierarchical Layer Explorer) debim view -m examples/farnsworth_house/project.debim # Compile declarative YAML to standard IFC4 building model debim compile -m examples/farnsworth_house/project.debim -o dist/farnsworth_house.ifc # Ingest Open GIS (Overpass BBox or GeoJSON) into native .debim urban model debim urban ingest --bbox "13.734,100.558,13.742,100.566" -o dist/asoke.debim debim urban ingest --geojson road.geojson --crs 32647 -o dist/road.debim # Compile urban & civil infrastructure to ISO 19650 IFC4.3 debim compile -m dist/asoke.debim -o dist/asoke.ifc # Launch Model Context Protocol (MCP) server over stdio debim mcp ``` --- ## πŸ—οΈ Example `project.yaml` ```yaml schema: IFC4-Minimal project: id: PRJ-2026-001 name: "Townhouse-Feasibility" units: { length: METER, area: SQUARE_METER, volume: CUBIC_METER } # 1. Spatial Structure spatial_structure: storeys: - id: L1 name: "Level 1" elevation: 0.00 height: 3.50 - id: L2 name: "Level 2" elevation: 3.50 height: 3.20 # 2. Reference Grid Axes grids: axes_x: { A: 0.00, B: 4.00, C: 8.00 } axes_y: { 1: 0.00, 2: 5.00, 3: 10.00 } # 3. Materials materials: - id: CONC_240 name: "Concrete 240 ksc" category: concrete unit_cost_ref: "MAT-CONC-01" - id: AAC_75 name: "AAC Block 7.5cm" category: masonry unit_cost_ref: "MAT-AAC-01" # 4. Elements elements: # Column placed at grid intersection [A, 1] - class: IfcColumn tag: C-A1 material: CONC_240 profile: { shape: BOX, width: 0.20, depth: 0.20 } placement: grid: [A, 1] base_storey: L1 top_storey: L2 reinforcement: main: "4-DB16" stirrups: "RB6 @ 0.15m" # Beam spanning between [A, 1] and [B, 1] - class: IfcBeam tag: B-A1_B1 material: CONC_240 profile: { shape: BOX, width: 0.20, depth: 0.40 } placement: from_grid: [A, 1] to_grid: [B, 1] storey: L2 reinforcement: main_top: "2-DB16" main_bottom: "3-DB20" stirrups: "RB9 @ 0.15m" # Wall with door host-child relationship - class: IfcWall tag: W-A1_A2 material: AAC_75 thickness: 0.075 height: 3.10 placement: from_grid: [A, 1] to_grid: [A, 2] storey: L1 children: - class: IfcDoor tag: D1 dimensions: { width: 0.90, height: 2.00 } offset_distance: 1.20 ``` --- ## πŸ”¬ Empirical Research & Benchmark debim prioritizes engineering precision and reproducible open science on our **Kaggle Cloud Multi-Core Benchmark Suite**: ### 1. βš–οΈ 3D Visual Regression & Alignment Benchmark (255 Real-World Buildings)

Kaggle Benchmark

Evaluating blind 3D geometric fidelity against ground-truth IFC models using **Geometry Variant Deduplication + Balanced Macro-Averaging** across 4,695 representative building elements: - **🎯 85.50% Median Visual Fidelity:** Surpassing the international standard benchmark ($\ge 85\%$) across the majority of test suites. - **πŸ—οΈ 89.07% Structural Match:** Primary load-bearing elements (columns, beams, slabs, foundations) maintain Grade-A+ geometric alignment. - **⚑ 82.64% MEP System Match:** Ductwork, drainage, piping, and electrical fixtures align accurately in 3D coordinate planes. #### πŸ“ˆ Progression Across Waves: | Global Metric | V1 (Baseline) | V2 (Wave 1-2) | V3 (Round 3 / Latest) | Cumulative Improvement | |---|:---:|:---:|:---:|:---:| | **🎯 Median Visual Match** | 80.90% | 84.90% | **85.50%** | πŸ† **+4.60% (Exceeded 85%)** | | **βš–οΈ Macro Average Visual Match** | 70.57% | 77.60% | **77.71%** | 🟒 **+7.14%** | | **πŸ“Š Micro Average Visual Match** | 72.24% | 80.35% | **80.46%** | 🟒 **+8.22%** | | **Passing Elements ($\ge 85\%$)** | 2,865 | 3,140 | **3,135 (66.8%)** | 🟒 **+270 elements** | | **Top Performing Disciplines** | | | | | | β€’ *Cable Trays (`IfcCableCarrierSegment`)* | - | - | **99.1%** | πŸ† **Near-perfect alignment** | | β€’ *Structural Beams (`IfcBeam`)* | 92.1% | 94.5% | **95.0%** | 🟒 **Grade-A+ Framing** | | β€’ *Bracing Members (`IfcMember`)* | 91.8% | 91.6% | **94.2%** | 🟒 **+2.4% (3D Vector Pitch)** | | β€’ *Railings (`IfcRailing`)* | 85.0% | 91.2% | **93.0%** | 🟒 **+8.0% (Passing)** | | β€’ *Structural Plates (`IfcPlate`)* | 10.2% | 88.9% | **87.8%** | 🟒 **+77.6% (Passing)** | | β€’ *Ceilings (`IfcCovering`)* | 11.4% | 89.0% | **86.4%** | 🟒 **+75.0% (Passing)** | | β€’ *Valves & Piping (`IfcValve`)* | 0.0% | 82.2% | **81.9%** | 🟒 **+81.9% (Zero-shot lift)** | πŸ‘‰ *Want to inspect raw visual data or reproduce tests yourself? Explore the full dataset and code on the [Kaggle Benchmark Notebook](https://www.kaggle.com/code/pridatakon/debim-3d-visual-balanced-benchmark).* --- ### 2. πŸ“¦ Roundtrip Retention & Storage Reduction Study (407 Real-World OpenBIM Models) Rigorously benchmarked against **407 real-world projects** across architectural, structural, and complex hospital MEP domains: - **🎯 100.0% Median Retention Rate:** Extract and re-compile back to standard IFC4 without element loss. - **πŸ“Š 85.0% Mean Retention Rate:** +26.1% retention gain across diverse real-world models (up from 58.9% in Round 1). - **πŸ“¦ 88.4% Average Storage Reduction:** Compresses raw IFC files by an average of 88.4% into compact declarative YAML. - **⚑ 558M+ LLM Tokens Saved:** Prevented **558,629,804 tokens** from cluttering agent context windows. - **πŸ›‘οΈ 100.0% Modern Schema Crash-Resilience:** Zero fatal crashes or unhandled exceptions across standard IFC2X3, IFC4, and IFC4X3 datasets. #### πŸ“ˆ Round 1 vs. Round 2 Stress Test Evolution: | Key Performance Indicator | Round 1 Baseline (192 Models) | Round 2 Enhanced (407 Models) | Improvement / Evolution | |---|:---:|:---:|:---| | **Total Models Evaluated** | 192 models | **407 models** | πŸ“ˆ **+112% (Scaled 2.1x dataset)** | | **🎯 Median Element Retention** | 79.0% | **100.0%** | πŸ† **+21.0% (Reached 100%)** | | **πŸ“Š Mean Element Retention** | 58.9% | **85.0%** | 🟒 **+26.1% retention gain** | | **πŸ“¦ Mean Storage Compression** | 94.0% | **88.4%** | High-fidelity declarative YAML | | **πŸ›‘οΈ Modern Schema Crash-Resilience** | 100.0% | **100.0%** | Zero fatal crashes on IFC2X3, IFC4, IFC4X3 | πŸ“– **Read Full Research Paper:** [debim: An Empirical Study of Declarative Building-as-Code on 407 Heterogeneous Real-World OpenBIM Models](docs/research/2026_empirical_study_407_ifc_models.md) πŸ“¦ **Kaggle Public Benchmark Dataset:** [debim-5000-ifc-benchmark](https://www.kaggle.com/datasets/pridatakon/debim-5000-ifc-benchmark) ⚑ **Kaggle Automated Stress Test:** [debim-ifc-stress-test](https://www.kaggle.com/code/pridatakon/debim-ifc-stress-test) --- ## ❓ Frequently Asked Questions (FAQ)
Why YAML instead of JSON, Python, or Excel?
YAML is clean, concise, supports nested hierarchies, and allows comments (essential for architectural notes). Unlike JSON, it has no noisy braces. Unlike Excel, it is 100% Git-friendly, diffable, and conflict-resolvable. It serves as a pure declarative DSL (Domain-Specific Language)β€”just like Kubernetes, Docker Compose, and GitHub Actions.
How do I place off-grid items (internal partitions, cantilever beams)?
Use relative offsets: `placement: { grid: [A, 1], offset: [1.20, 0.50] }`. Just like pulling a tape measure on site from the nearest grid line.
Does this replace Revit or AutoCAD?
No, it complements them. debim handles the early-stage upstream workload: rapid feasibility, parametric sizing, AI generation, instant QTO/costing, and automated building law validation. Once validated, run debim compile to export standard IFC4 and load it directly into BlenderBIM, FreeCAD, or Revit for 2D drafting and detail annotations.
--- ## πŸ“„ License & Attribution - **Software Code:** Licensed under the [MIT License](LICENSE) β€” Copyright (c) 2026 Prida Takon. - **Research & Technical Reports:** Licensed under [Creative Commons Attribution 4.0 International (CC BY 4.0)](https://creativecommons.org/licenses/by/4.0/). - **Benchmark Datasets & Sample Models:** Test fixtures in `tests/fixtures/` originate from [buildingSMART International](https://github.com/buildingSMART) and the Open IFC Model Repository under CC BY 4.0 / CC-BY-3.0.