Business rules should not live in folklore, stale PDFs, and three different implementations. DomainForge turns domain meaning into readable, executable structure that can move across languages, runtimes, and governance surfaces.
Every organization has domain truth: the rules, entities, flows, policies, metrics, and relationships that define how the business actually works.
The problem is that this meaning usually gets scattered.
- Analysts describe it in documents.
- Developers reimplement it in services.
- Frontends rebuild parts of it again.
- Architects model it somewhere else.
- Auditors ask where it is enforced.
- Agents receive fragments and improvise.
That is not governance. That is a scavenger hunt.
DomainForge gives teams a semantic source of truth for domain structure: human-readable, machine-executable, versionable, and projectable into the systems that need to use it.
Analysts can read it. Developers can bind to it. Agents can reason over it. Governance systems can inspect it. Architecture tools can project it.
Not documentation hoping to be obeyed. Executable meaning with receipts.
| What You Get | Why It Matters |
|---|---|
| One model, every language | Python validation and TypeScript validation can use the same declared domain structure. |
| Fast rule checking | Current benchmarks include validation of 10,000 entities in under 100 milliseconds. |
| Business-readable, machine-executable structure | Analysts can read the rules. Systems can parse, validate, and enforce them. |
| Architecture-as-Code projection | Export to FINOS CALM for enterprise architecture and governance workflows. |
| Structured validation and deterministic projection surfaces | Not just documentation β rules that can be parsed, checked, projected, and tested. |
import domainforge
graph = domainforge.Graph()
# Define WHO does the work
warehouse = domainforge.Entity("Warehouse", "logistics")
assembly_line = domainforge.Entity("Assembly Line A", "manufacturing")
graph.add_entity(warehouse)
graph.add_entity(assembly_line)
# Define WHAT moves between them
cameras = domainforge.Resource("Camera", "units")
graph.add_resource(cameras)
# Define HOW much moves
flow = domainforge.Flow(
cameras.id(),
assembly_line.id(),
warehouse.id(),
1000.0
)
graph.add_flow(flow)
# Validate everything
print(f"Entities: {graph.entity_count()}")
print(f"Flows: {graph.flow_count()}")That's it. You just created an executable domain model that:
- Defines entities, resources, and flows as a typed graph
- Uses the same Rust-backed core semantics across Python, TypeScript, Rust, and browser/WASM surfaces
- Exports to FINOS CALM for architecture governance
- Becomes a source of truth teams can inspect, test, version, and govern
# Python
pip install domainforge
# TypeScript / Node.js
npm install domainforge
# Rust
cargo add domainforge-core
# Verify it works
python -c "import domainforge; print('β
Ready:', domainforge.__version__)"π‘ Pre-built packages for PyPI, npm, and Crates.io. Build from source if pre-built wheels/binaries are not yet available for your platform.
DomainForge is stack-agnostic.
It does not require the GodSpeed AI ecosystem. It does not require SEA-Forge, SWE_SEED, GodSpeed-Agent, a specific agent runtime, a specific cloud, or a specific governance platform.
You can use DomainForge as a standalone Apache 2.0 semantic/domain layer in:
- internal tools
- backend services
- frontend validation
- architecture repositories
- agent runtimes
- policy engines
- knowledge graphs
- compliance workflows
- browser/WASM applications
- Python, TypeScript, and Rust systems
DomainForge's value is self-contained: it makes domain meaning readable, executable, portable, and testable.
Within the broader GodSpeed AI stack, DomainForge can also serve as the semantic layer:
DomainForge defines the domain.
SEA-Forge governs the work.
SWE_SEED proves the change.
GodSpeed-Agent compounds the capability.
That stack is optional. DomainForge stands on its own.
|
"I can finally model our processes without waiting for every rule to become custom code."
|
"We can make business architecture executable and projectable."
|
|
"Type-safe domain models that work across our stack."
|
"Policies can become executable, auditable structures."
|
DomainForge starts with six core concepts:
| Concept | What It Represents | Example |
|---|---|---|
| π’ Entity | Actors and locations in your system | Assembly Line, Customer, Warehouse |
| π¦ Resource | Things of value that move | Products, Money, Information |
| π Flow | Movement between entities | Shipments, Payments, Work Orders |
| π Instance | Specific, trackable items | Camera #SN12345, Invoice #INV-2024 |
| π Pattern | Reusable validation patterns | Email format, SKU codes |
| π Policy | Business rules and constraints | "All shipments must be inspected" |
That is the starting vocabulary. More advanced declarations β roles, relations, dimensions, units, metrics, mappings, projections, and concept changes β extend the model when the domain needs more structure.
No magic syntax. No framework lock-in. Just executable domain meaning.
Write models directly in .sea files β human-readable, version-controllable, and parseable by all bindings.
// Define entities (who/where)
Entity "Warehouse" in logistics
Entity "Factory" in manufacturing
// Define resources (what moves)
Resource "Camera" units in inventory
// Define flows (how things move)
Flow "Camera" from "Warehouse" to "Factory" quantity 100
// Define validation patterns
Pattern "SKU" matches "^[A-Z]{3}-[0-9]{4}$"
// Define business rules
Policy min_shipment as: quantity >= 10
// Versioned entities with evolution tracking
Entity "Vendor" v2.0.0
@replaces "Supplier" v1.0.0
@changes ["renamed", "added_fields"]
// Roles and relations
Role "Approver" in governance
Relation "Payment"
subject: "Buyer"
predicate: "pays"
object: "Seller"
via: flow "Money"
// Typed instances
Instance acme_corp of "Vendor" {
name: "Acme Corporation",
credit_limit: 50000 "USD"
}
// Quantified policy expressions
Policy all_shipments_inspected as:
forall s in flows: (s.inspected = true)
| Declaration | Syntax |
|---|---|
| Entity | Entity "Name" [vX.Y.Z] [in domain] |
| Resource | Resource "Name" [unit] [in domain] |
| Flow | Flow "Resource" from "A" to "B" [quantity N] |
| Pattern | Pattern "Name" matches "regex" |
| Role | Role "Name" [in domain] |
| Relation | Relation "Name" subject: ... predicate: ... object: ... |
| Instance | Instance id of "Entity" { field: value } |
| Policy | Policy name as: expression |
| Dimension | Dimension "Name" |
| Unit | Unit "Name" of "Dimension" factor N base "Base" |
| Metric | Metric "Name" as: expression |
| Mapping | Mapping "Name" for format { ... } |
| Projection | Projection "Name" for format { ... } |
| ConceptChange | ConceptChange "Name" @from_version ... @to_version ... |
π Manufacturing: Assembly Line Control (click to expand)
import domainforge
graph = domainforge.Graph()
# Define the supply chain
supplier = domainforge.Entity("Component Supplier", "supply")
assembly = domainforge.Entity("Assembly Line A", "manufacturing")
quality_control = domainforge.Entity("QC Department", "quality")
finished_goods = domainforge.Entity("Finished Goods Warehouse", "logistics")
graph.add_entity(supplier)
graph.add_entity(assembly)
graph.add_entity(quality_control)
graph.add_entity(finished_goods)
# Define what's being built
pcb_board = domainforge.Resource("PCB Board", "pieces")
camera_module = domainforge.Resource("Camera Module", "units")
graph.add_resource(pcb_board)
graph.add_resource(camera_module)
# Define the flow of components
component_delivery = domainforge.Flow(
pcb_board.id(),
supplier.id(),
assembly.id(),
500.0
)
graph.add_flow(component_delivery)Result: Inventory constraints can be checked before they turn into production delays.
π° Finance: Payment Fraud Detection (click to expand)
import { Graph, Entity, Resource, Flow } from "domainforge";
const graph = new Graph();
const customer = new Entity("Customer Account");
const merchant = new Entity("Merchant Account");
const gateway = new Entity("Payment Gateway");
graph.addEntity(customer);
graph.addEntity(merchant);
graph.addEntity(gateway);
const money = new Resource("USD", "dollars");
graph.addResource(money);
// Track payment flows
const payment = new Flow(money.id, customer.id, merchant.id, 100);
graph.addFlow(payment);Result: The same domain model can support policy checks before downstream action.
π Logistics: Cross-Border Compliance (click to expand)
import domainforge
graph = domainforge.Graph()
# Multi-location warehouses
warehouse_us = domainforge.Entity("US Distribution Center", "logistics")
warehouse_us.set_attribute("location", "USA")
warehouse_eu = domainforge.Entity("EU Distribution Center", "logistics")
warehouse_eu.set_attribute("location", "Germany")
retail_store = domainforge.Entity("Retail Store", "logistics")
retail_store.set_attribute("location", "France")
graph.add_entity(warehouse_us)
graph.add_entity(warehouse_eu)
graph.add_entity(retail_store)
product = domainforge.Resource("Widget", "boxes")
graph.add_resource(product)
# Create cross-border flow
shipment = domainforge.Flow(
product.id(),
warehouse_eu.id(),
retail_store.id(),
250.0
)
graph.add_flow(shipment)Result: Cross-border requirements can be modeled as enforceable policy instead of scattered checklist logic.
β‘ Performance Characteristics
- Rust core for performance-critical validation
- FFI overhead < 1ms per operation
- Streaming validation for large models
See benchmarks for measured results.
π Language Bindings
Python (PyO3):
import domainforge
d = domainforge.Dimension.parse("currency")
u = domainforge.Unit("USD", "US Dollar", "Currency", 1.0, "USD")TypeScript (napi-rs):
import { Dimension, Unit } from "domainforge";
const d = Dimension.parse("currency");
const u = new Unit("USD", "US Dollar", "Currency", 1.0, "USD");WASM (browser):
import init, { Dimension, Unit } from "./domainforge_core.js";
await init();
const d = new Dimension("currency");
const u = new Unit("USD", "US Dollar", "Currency", 1.0, "USD");
// Programmatic Expression Building & Normalization
const expr = Expression.binary(
BinaryOp.And,
Expression.variable("b"),
Expression.variable("a")
);
console.log(expr.normalize().toStringRepr()); // "(a AND b)"Bindings are designed to preserve the same core semantics across runtimes, with conformance tests guarding against behavioral drift.
ποΈ Architecture
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Your Application β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Python API β TypeScript β WASM β
β (PyO3) β (napi-rs) β (wasm-bindgen) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Rust Core Engine (domainforge-core) β
β βββββββββββββββ¬βββββββββββββββ¬ββββββββββββββββββ β
β β Primitives β Graph Store β Policy Engine β β
β β Parser β Validator β CALM Export β β
β β Authority β Fact Store β Provenance β β
β βββββββββββββββ΄βββββββββββββββ΄ββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Design Principles:
- Rust core is canonical. Bindings wrap core behavior instead of duplicating logic.
- Deterministic behavior. Stable ordering supports repeatable outputs across runs.
- Standards-aware projection. SBVR-aligned expressions and FINOS CALM export help domain models travel into enterprise architecture workflows.
π§ CLI Usage
# Install the CLI
cargo install --path domainforge-core --features cli
# Validate a model
domainforge validate model.sea
# Export to FINOS CALM
domainforge project --format calm model.sea architecture.json
# Import from Knowledge Graph
domainforge import --format kg model.ttl
# Normalize Expressions
domainforge normalize "b AND a" # -> "(a AND b)"
# Evaluate authority decisions
domainforge authority config.json request.json --facts facts.json --jsonπ‘οΈ Policy Authority
DomainForge includes a Policy Authority system that makes business authority executable, deterministic, fact-grounded, and traceable.
Key capabilities:
- Four policy modalities: Permission, Prohibition, Obligation, Override
- Trusted fact provenance: Caller-supplied facts are untrusted by default
- Three-valued logic: True, False, and Unknown with modality-aware unknown handling
- Deterministic conflict resolution: Modality precedence β priority β specificity vector dominance
- Replayable audit traces: Every decision produces a complete
AuthorityTrace
from domainforge import AuthorityEnvironment
# Create environment from config
env = AuthorityEnvironment(config_json)
env.validate()
# Evaluate an authority request
trace_json, decision_json = env.evaluate(request_json, facts_json)import { evaluateAuthority } from 'domainforge';
const result = evaluateAuthority(configJson, requestJson, factsJson);
console.log(result.decisionJson);Decision outcomes: Allow, Deny, Escalate, NotApplicable, Reject
Safety guarantees:
- No authority without declared semantics
- No decision without trusted facts
- No trust upgrade through derivation
- No allow from unknown permission
- No weakened prohibition from omitted facts
- No scalar specificity shortcuts
π Error Diagnostics
Comprehensive error handling with fuzzy matching suggestions:
Error[E001]: Undefined Entity: 'Warehous' at line 1
--> 1:23
|
1 | Flow "Materials" from "Warehous" to "Factory"
| ^^^^^^^^^^
|
hint: Did you mean 'Warehouse'?
- 30+ structured error codes with detailed descriptions
- Multiple output formats: JSON, human-readable, LSP
- Native error types for Python, TypeScript, and WASM
# Clone and set up
git clone https://github.com/GodSpeedAI/DomainForge.git
cd DomainForge
pip install maturin
maturin develop
# Run your first model
python examples/camera_factory.py# Per-language tests
just rust-test # Rust core
just python-test # Python bindings
just ts-test # TypeScript bindings
# All tests at once
just all-tests# Python bindings
pip install maturin && maturin build --release
# TypeScript bindings
npm install && npm run build
# WebAssembly
./scripts/build-wasm.sh| Resource | Description |
|---|---|
| π Copilot Instructions | Essential guide for AI coding agents |
| π Product Requirements | PRD with success metrics |
| π System Design | Technical specifications |
| ποΈ Architecture Decisions | Key architectural choices |
| πΊοΈ CALM Mapping | SEA β CALM conversion |
| π Error Codes | Validation error reference |
| π§ CLI Reference | CLI commands and usage |
We welcome contributions. Please see Contributing Guide for developer notes on building the CLI, TypeScript bindings, and WASM.
DomainForge is open source under the Apache-2.0 License.
Built on foundational work from:
- ERP5 Unified Business Model β Foundational primitive design
- SBVR Standard (OMG) β Semantic business vocabulary
- FINOS CALM β Architecture-as-Code integration
- Rust Community β High-performance core runtime
Make business meaning executable.