Enterprise automation with exact guarantees. Zero drift. Deterministic workflows.
๐ Platform: constraint-theory-web.pages.dev
# Your financial spreadsheet:
total = 0.1 + 0.2
print(total) # 0.30000000000000004
# At 1 billion transactions:
# $0.00000000000004 ร 1,000,000,000 = $40,000 unaccountedConstraint Flow eliminates an entire class of financial bugs.
A business automation platform combining spreadsheet interface, multi-agent orchestration, and constraint-based workflow guarantees. Built on Constraint Theory for exact financial calculations and deterministic agent coordination.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ
โ Traditional: =A1 * 1.1 โ floating-point drift โ
โ Constraint: =CT_MUL(A1, 1.1) โ EXACT. Forever. โ
โ โ
โ $0.00000000000004 error ร 1B transactions = $40K gone โ
โ โ
โ Constraint Flow: Every cent accounted for. Audit-ready. โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Prerequisites: Node.js 18+, npm 9+, Docker (optional)
# Install CLI globally
npm install -g @constraint-flow/cli
# Create new workflow project
constraint-flow init invoice-processing
# Start local development server
cd invoice-processing && constraint-flow dev
# Open http://localhost:3000Alternative: Use without global install
# Using npx (no global install needed)
npx @constraint-flow/cli init invoice-processing
cd invoice-processing
npx constraint-flow devVerify installation:
constraint-flow doctor
# โ Node.js 18+ installed
# โ npm 9+ installed
# โ Docker available (optional)
# โ Ready to flow!Common Issues:
# Port 3000 in use?
constraint-flow dev --port 3001
# Permission issues on macOS/Linux?
sudo npm install -g @constraint-flow/cli
# Node version too old?
nvm install 18
nvm use 18# Traditional spreadsheets
=A1 * 1.1 // Floating-point errors accumulate
=SUM(B1:B10000) // Cumulative rounding errors
# Constraint Flow
=CT_MUL(A1, 1.1) // Exact multiplication
=CT_FINANCIAL_SUM(B1:B10000) // Zero cumulative error
=CT_ROUND(value, "cents") // Regulatory-compliant rounding
const workflow = defineWorkflow({
name: "Invoice Processing",
steps: [
{ agent: "cattle-extract", action: "extract_invoice_data" },
{ agent: "duck-validate", action: "validate_with_accounting" },
{ agent: "sheep-approve", action: "consensus_approval" }
],
constraints: [
{ type: "amount_limit", max: 10000 }, // Invariant
{ type: "approval_required", when: { ">": 5000 } }, // Conditional
{ type: "sla", maxHours: 24 }, // SLA
{ type: "audit_trail", required: true } // Compliance
]
});
// Every step validated against constraints
// Invalid states impossible by constructionโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ CONSTRAINT ROUTING ENGINE โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ
โ Incoming Task โโโโโบ Constraint Solver โ
โ โ โ
โ โโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโ โ
โ โ โ โ โ
โ ๐ง Email Tasks ๐ API Tasks ๐ Data Tasks โ
โ โ โ โ โ
โ โผ โผ โผ โ
โ ๐ Cattle Agent ๐ฆ Duck Agent ๐ด Horse Agentโ
โ โ
โ Deterministic routing: Same input โ Same agent โ
โ Explainable decisions: Why this agent? Constraints โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Do you process financial data?โ
โโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ โ
โโโโโโผโโโโโ โโโโโโผโโโโโ โโโโโโผโโโโโ
โ FINTECH โ โ HEALTH โ โ MFG โ
โโโโโโฌโโโโโ โโโโโโฌโโโโโ โโโโโโฌโโโโโ
โ โ โ
โผ โผ โผ
โโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโ
โ โ Exact โ โ โ HIPAA โ โ โ Supply โ
โ amounts โ โ audit โ โ chain โ
โโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโ
// Invoice processing with exact amounts
const invoiceWorkflow = {
steps: [
{ agent: "cattle-extract", action: "parse_invoice" },
{ agent: "sheep-validate", action: "three_way_match" },
{ agent: "cattle-approve", action: "approve_if_valid" }
],
constraints: [
{ type: "exact_amount", precision: "cents" },
{ type: "three_way_match", required: true },
{ type: "approval_chain", minSignatures: 2 }
]
};
// Every cent accounted for. Audit-ready.// Patient data routing with privacy constraints
const patientWorkflow = {
constraints: [
{ type: "hipaa_compliant", required: true },
{ type: "data_locality", region: "US" },
{ type: "access_log", immutable: true }
]
};
// Privacy constraints enforced. Zero data leakage.// Supply chain coordination
const supplyChain = {
constraints: [
{ type: "inventory_exact", precision: "units" },
{ type: "lead_time", maxDays: 30 },
{ type: "quality_threshold", minScore: 0.95 }
]
};
// Exact inventory counts. No floating-point discrepancies.โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ CONSTRAINT FLOW โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ USER INTERFACE โ โ
โ โ Spreadsheet โ Workflow Builder โ Dashboard โ CLI โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ โ
โ โผ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ CONSTRAINT LAYER โ โ
โ โ โ โ
โ โ โข Exact Arithmetic (Constraint Theory) โ โ
โ โ โข Workflow Invariants โ โ
โ โ โข Routing Constraints โ โ
โ โ โข Compliance Rules โ โ
โ โ โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ โ
โ โผ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ AGENT LAYER โ โ
โ โ โ โ
โ โ ๐ Reasoning โ ๐ฆ APIs โ ๐ Debug โ ๐ Consensus โ โ
โ โ ๐ด Pipelines โ ๐ฆ
Sync โ ๐ Monitor โ ๐ Hardware โ โ
โ โ โ โ
โ โ Orchestrated by Border Collie with geometric routing โ โ
โ โ โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ โ
โ โผ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ DATA LAYER โ โ
โ โ Spreadsheet Engine โ CRDT Memory โ Exact Snapshots โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Constraint Flow uses exact arithmetic powered by constraint-theory-core to eliminate floating-point errors in financial calculations.
// Basic operations - no floating-point drift
CT_ADD(a, b): ExactNumber // Exact addition: CT_ADD(0.1, 0.2) = 0.3 (exact!)
CT_SUB(a, b): ExactNumber // Exact subtraction
CT_MUL(a, b): ExactNumber // Exact multiplication: CT_MUL(0.1, 3) = 0.3 (exact!)
CT_DIV(a, b): ExactNumber // Exact division with remainder tracking
// Aggregations - zero cumulative error
CT_SUM(range): ExactNumber // Sum without accumulating errors
CT_AVERAGE(range): ExactNumber // Precise average
CT_FINANCIAL_SUM(range): ExactNumber // Regulatory-compliant sum
// Rounding - auditor-approved
CT_ROUND(value, precision): ExactNumber // Round to specified precision
CT_ROUND_TO_CENTS(value): ExactNumber // Round to 2 decimal places
CT_ROUND_TO_UNITS(value): ExactNumber // Round to whole units
CT_ROUND_HALF_EVEN(value, precision): ExactNumber // Banker's roundingWhy this matters:
// Traditional JavaScript
const total = 0.1 + 0.2; // 0.30000000000000004 โ
// Constraint Flow exact arithmetic
const total = CT_ADD(0.1, 0.2); // 0.3 EXACTLY โ
// Large aggregations
const sum = CT_SUM([0.1, 0.1, 0.1, 0.1, 0.1]); // 0.5 EXACTLY โ
// vs JavaScript: 0.49999999999999994 โ| Type | Description | Example |
|---|---|---|
amount_limit |
Maximum value constraint | { type: 'amount_limit', max: 10000 } |
amount_range |
Min/max value bounds | { type: 'amount_range', min: 100, max: 50000 } |
exact_precision |
Force exact arithmetic | { type: 'exact_precision', precision: 'cents' } |
time_limit |
SLA time constraint | { type: 'time_limit', maxHours: 24 } |
business_hours |
Only execute 9-5 | { type: 'business_hours' } |
weekdays_only |
No weekend execution | { type: 'weekdays_only' } |
approval_required |
Always need approval | { type: 'approval_required' } |
conditional_approval |
Approval based on condition | { type: 'conditional_approval', when: { '>': 5000 } } |
multi_approval |
Multiple approvers needed | { type: 'multi_approval', count: 2 } |
balanced_workload |
Distribute work evenly | { type: 'balanced_workload' } |
no_cycles |
Prevent circular dependencies | { type: 'no_cycles' } |
min_parallelism |
Minimum parallel tasks | { type: 'min_parallelism', n: 3 } |
max_latency |
Maximum response time | { type: 'max_latency', ms: 5000 } |
audit_trail |
Immutable audit log | { type: 'audit_trail', required: true } |
hipaa_compliant |
HIPAA data handling | { type: 'hipaa_compliant', required: true } |
data_locality |
Regional data storage | { type: 'data_locality', region: 'US' } |
defineWorkflow(config: WorkflowConfig): Workflow
validateStep(workflow, step): ValidationResult
getConstraintStatus(workflow): ConstraintStatus[]
routeTask(task: Task): AgentAssignment# Docker
docker run -d -p 3000:3000 constraint-flow/server
# Kubernetes
kubectl apply -f https://constraint-flow.ai/k8s.yaml
# Binary
constraint-flow server --port 3000constraint-flow deploy --provider=aws
constraint-flow deploy --provider=gcp
constraint-flow deploy --provider=azure| Feature | Startup | Enterprise |
|---|---|---|
| Exact Arithmetic | โ | โ |
| Multi-Agent Routing | โ | โ |
| Workflow Builder | โ | โ |
| SSO/SAML | โ | โ |
| Audit Logs | 7 days | Forever |
| SLA Guarantee | 99% | 99.99% |
| Support | Community | Priority |
| Custom Agents | โ | โ |
| SOC 2 Compliance | โ | โ |
| HIPAA Compliance | โ | โ |
| Repo | What It Does | Key Features |
|---|---|---|
| constraint-theory-core | ๐ฆ Rust crate | ~100ns snap, SIMD batch, 82 tests |
| constraint-theory-python | ๐ Python bindings | NumPy integration, PyTorch compatible |
| constraint-theory-web | ๐ Interactive demos | 50 visualizations, zero setup |
| constraint-theory-research | ๐ Mathematical foundations | arXiv paper, proofs, open problems |
| constraint-ranch | ๐ฎ Gamified learning | Puzzle games, agent breeding |
| constraint-flow | ๐ผ This repo | Exact financial calculations, workflow orchestration |
| constraint-theory-agent | ๐ค Implementation agent | Code audit, refactoring, expert explanations |
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ CONSTRAINT ECOSYSTEM INTEGRATION โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ
โ constraint-theory-core (Rust) โ
โ โ โ
โ โ Exact arithmetic, Pythagorean snapping, holonomy checking โ
โ โผ โ
โ constraint-theory-python โโโโโบ constraint-flow โ
โ โ โ โ
โ โ PyTorch integration โ TypeScript workflows โ
โ โ ML quantization โ Business automation โ
โ โผ โผ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ constraint-ranch โ โ
โ โ Gamified training for constraint-aware agents โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
| What You Need | Where to Go |
|---|---|
| Exact arithmetic | CT_ADD(), CT_SUM() from constraint-theory-core |
| Agent training | constraint-ranch |
| ML integration | constraint-theory-python |
| Workflow patterns | WORKFLOW_PATTERNS.md |
| Enterprise features | ENTERPRISE.md |
| Ecosystem guide | ECOSYSTEM.md |
Using constraint-theory-core from Constraint Flow:
import { PythagoreanManifold, snap } from '@constraint-flow/core';
// These are powered by constraint-theory-core under the hood
const manifold = new PythagoreanManifold(200);
const [exact, noise] = manifold.snap([0.577, 0.816]);
// exact = [0.6, 0.8] = (3/5, 4/5) - EXACT PYTHAGOREAN TRIPLEGood First Issues ยท CONTRIBUTING.md ยท ONBOARDING.md
Enterprise-grade contributions welcome:
- ๐ Integrations - SAP, Salesforce, QuickBooks
- ๐ Connectors - More data sources
- ๐ Reports - Compliance templates
- ๐ Translations - Global business
- ๐งช Test Coverage - Edge cases, integration tests
- ๐ Documentation - Tutorials, API reference
git clone https://github.com/SuperInstance/constraint-flow.git
cd constraint-flow
npm install
npm run build
npm testMIT โ see LICENSE.
Regulatory compliance requires exact arithmetic.