Skip to content
Monolithic-DevPublic

Repository files navigation

RuleFork — Decision Release Lab

Turn policy ambiguity into reviewable, reproducible decisions.

Test the consequences of competing business-policy interpretations before release, with deterministic evidence a human can inspect and approve.


CI Python Next.js React TypeScript

FastAPI PostgreSQL Docker Status


Python FastAPI Next.js React TypeScript PostgreSQL Docker

BUILD 2036 | Frontier 01: Applied AI & Agentic Intelligence
The Deterministic Verification & Release Lab for 2036 Autonomous Agent Swarms.

RuleFork answers the existential challenge of enterprise AI in 2036: When autonomous multi-agent systems interpret human policies, which edge-cases trigger silent divergence, which single clarification collapses decision entropy most, and what exact cryptographic decision contract did human operators freeze?

RuleFork produces immutable decision contracts and reproducible regression fixtures. It does not issue refunds, certify legal compliance, or make unverified production decisions.


Architecture · User flow · API · Quick start · Verification · Roadmap

Contents

  1. What it is
  2. Technology
  3. How it works
  4. Current implementation status
  5. Quick start
  6. API surface
  7. Verification
  8. Repository map
  9. Security and privacy
  10. Roadmap
  11. Documentation and contribution

Technology

The icons below link to the corresponding TechIcons pages. TechIcons documents the icon source and provides SVG/PNG downloads; the direct SVG assets are hosted by IcePanel’s Devicon mirror.

Layer Stack
Web Next.js React TypeScript Tailwind CSS
API and reasoning Python FastAPI SQLAlchemy
Data and delivery PostgreSQL Docker GitHub Actions

How it works

Policy source + typed cases → immutable draft version
          → proposal validation → bounded replay
          → independent witness verification → weighted impact
          → exact clarification ranking → human approval
          → rulefork-release/v1 artifact and reproducible fixtures

The model proposes interpretations only. The deterministic evaluator is the source of outcome data, and a separate reference interpreter checks every displayed witness. Unknown values remain unknown; incomplete search is reported as incomplete; approval requires an exact active candidate and acknowledged scope.

Core capabilities

Capability Outcome Evidence boundary
Policy interpretation Source-linked candidate proposals with strict schema and citation checks Live provider calls remain disabled under the free-only direction
Decision reasoning Typed three-valued evaluation, bounded search, witness minimization, independent replay Results are scoped to declared fields, constraints, cases, and search limits
Clarification planning Exact weighted minimax ranking of valid question partitions Planning is a one-step heuristic, not a global optimum
Release control Human approval blockers, fixture freezing, comparison matrix, portable ZIP artifact No automatic refunds, legal certification, or production approvals
Reproducibility Version hashes, evaluator versions, OpenAPI snapshots, locked dependencies, CI Public deployment and external submission are not complete

Architecture

flowchart LR
    browser["Browser / Next.js"] --> api["FastAPI API"]
    api --> auth["Session + CSRF"]
    api --> db[("PostgreSQL 18")]
    api --> domain["Pure reasoning domain"]
    domain --> replay["Deterministic replay"]
    domain --> oracle["Independent reference evaluator"]
    domain --> release["Release artifact"]
    api -. optional .-> provider["Structured provider adapter"]
Loading

The browser talks to the local API over loopback in development. PostgreSQL stores immutable source, case, and version records when configured. The reasoning domain has no network or database dependency; provider use is an explicit adapter boundary.

Current implementation status

Phases 00–10 contain working offline slices and focused verification. The current repository state is an offline verified prototype, not a production deployment.

Implemented and verified:

  • bounded typed rule evaluation, reference evaluation, witness search, impact buckets, and exact question ranking;
  • PostgreSQL 18 migrations and scoped demo sessions with CSRF and origin checks;
  • persisted demo principals/projects, source versions, imported case sets/cases, project reads, and draft version snapshots when DATABASE_URL is configured;
  • deterministic release comparison, approval blockers, fixture freezing, ZIP export, quotas, circuit breaking, deletion ledger, safe logging, reproducibility manifests, benchmark tooling, and submission validation;
  • locked Python and pnpm dependencies, Docker images, OpenAPI snapshot checks, GitHub Actions, Gitleaks, and Trivy checks.

Known limits are deliberate and recorded in PROJECT_STATUS.md: live provider evaluation is blocked by the free-only direction, heldout benchmark data is not authored, and public deployment/submission has not occurred. Phase acceptance is evidence-based; an implementation document alone does not mark a phase complete.

Quick start

Prerequisites

  • Python 3.12 and uv.
  • Node.js 24.x and pnpm 11.3.0.
  • Docker Desktop with the Linux engine for PostgreSQL and Compose checks.

Local synthetic preview

Run powershell -ExecutionPolicy Bypass -File scripts/preflight.ps1 to see toolchain, service, database, auth, and provider presence without printing secret values. The current repository exposes the synthetic fixture and persistence primitives. Full private auth, worker dispatch, and model configuration remain blocked until the values listed in .env.example are provisioned.

Start the API:

cd apps/backend
uv sync --locked
$env:RULEFORK_DEV_SLICE_ENABLED = 'true'
uv run uvicorn rulefork.api:app --host 127.0.0.1 --port 8000

In a second terminal, start the web app:

cd apps/web
pnpm install --frozen-lockfile
pnpm dev --hostname 127.0.0.1 --port 3000

Open http://127.0.0.1:3000. The local preview uses synthetic fixtures and is disabled unless RULEFORK_DEV_SLICE_ENABLED=true.

PostgreSQL-backed local stack

docker compose -f infra/compose.yaml up -d db
$env:DATABASE_URL = 'postgresql+psycopg://rulefork:local_only@127.0.0.1:55432/rulefork'
$env:MIGRATION_DATABASE_URL = $env:DATABASE_URL
cd apps/backend
uv run alembic upgrade head
uv run uvicorn rulefork.api:app --host 127.0.0.1 --port 8000

The database is bound to loopback on port 55432. Use a local secret override for RULEFORK_LOCAL_DB_PASSWORD; never commit credentials.

Verification

Backend checks:

cd apps/backend
uv run ruff format --check .
uv run ruff check .
uv run pyright
uv run pytest -q

Web checks:

cd apps/web
pnpm install --frozen-lockfile
pnpm lint
pnpm typecheck
pnpm test
pnpm build

Repository checks include scripts/validate-benchmark.py --split dev, scripts/freeze-benchmark.py --check, scripts/release-manifest.py --verify, and scripts/validate-submission.py --manifest docs/07-submission/SUBMISSION_MANIFEST.json --mode draft. Run the disposable PostgreSQL smoke and migrations only against the local database described above.

API surface

The current versioned routes are intentionally small and scoped:

Method Route Purpose Auth
POST /api/v1/demo/sessions Create an isolated demo principal and project Allowed local origin
GET /api/v1/projects List projects owned by the session Session cookie
POST /api/v1/projects/{id}/sources Normalize and persist a source version Session + CSRF
GET /api/v1/projects/{id}/sources Read owned source versions Session cookie
POST /api/v1/projects/{id}/cases/import Validate and persist bounded CSV cases Session + CSRF
GET /api/v1/projects/{id}/case-sets Read owned case-set summaries Session cookie
POST /api/v1/projects/{id}/versions Persist a draft version snapshot Session + CSRF
GET /health/live Liveness check None

The generated contract is contracts/dev-slice.openapi.json. Malformed and cross-project requests fail closed; response errors use safe codes and do not echo policy or case values.

Repository map

apps/backend/src/rulefork/   FastAPI, domain, application, infrastructure
apps/backend/tests/          unit, property, integration, security, benchmark
apps/web/                     Next.js interface and browser tests
contracts/                    JSON Schema and generated OpenAPI snapshots
benchmarks/                   synthetic dev data and offline evaluation tools
docs/04-product/              approved product, architecture, intelligence, security, UX
docs/06-validation/           phase evidence and known blockers
infra/                        Docker Compose and container configuration
scripts/                      verification, benchmark, release, and submission commands

Roadmap

Stage Focus Current evidence
00–03 Foundation, technical validation, persistence and bounded import Offline and PostgreSQL-backed slices verified
04–06 Draft versions, approval/release artifacts, comparison workflow Domain slices verified; end-to-end analysis integration continues
07 Benchmark and evaluation Dev fixtures and offline tooling verified; heldout corpus not authored
08–09 Security hardening and reproducibility Offline checks verified; public deployment blocked
10 Final verification and submission packaging Draft manifest verified; external submission blocked

The next engineering gate is to persist and expose analysis runs and connect the Phase 04/05 reasoning result to the version and release workflow. See PROJECT_STATUS.md for the current gate register and blockers.

Security and privacy

Keep secrets in environment variables or an approved secret store. Do not commit provider keys, policy or case data, raw model responses, hidden reasoning, or credentials. Provider payloads exclude case facts and weights. Demo mutations require a capability cookie, CSRF token, and allowed origin. Production configuration rejects demo bypasses and debug mode. See SECURITY.md and THIRD_PARTY_NOTICES.md.

Documentation and contribution

Start with PROJECT_STATUS.md, CLAUDE.md, and the approved idea specification. The five canonical design documents define requirements and architecture. Phase specifications are execution contracts, not proof of implementation.

Use a focused branch and Conventional Commit, preserve generated contracts, run the relevant checks, and open a PR with actual evidence, limitations, rollback notes, and acceptance IDs. Do not claim a benchmark, deployment, provider call, or production readiness without recorded execution evidence. See CONTRIBUTING.md.

License and attribution

See LICENSE. Technology icon links use TechIcons pages and their documented Devicon-derived assets. Product, benchmark, and competition claims remain subject to the source documents and the evidence ledger.

Links

Releases

Packages

Contributors

Languages