RABS System Independence Model
This document explains the rationale for separating the RABS “Operations” server from the autonomous assistant “Reggie,” ensuring the platform remains reliable even when one process is unavailable.
1. Architecture Overview
RABS is built as two independent long-running processes that share the same codebase and database:
operations.js– Human-driven API server. Handles rostering, scheduling, transport, billing, etc., and exposes REST/GraphQL endpoints for web and mobile front-ends.reggie.js– Autonomous AI assistant. Listens for natural-language requests, runs LLM-powered reasoning, and executes business logic by importing the same feature modules used by Operations.- Shared feature modules – Pure, deterministic functions (e.g.,
leaverequest.js,rostercalc.js). No I/O, so they can be called by either process. - PostgreSQL + pgvector – Single source of truth for state, events, and vector embeddings; also acts as an implicit message bus between the two servers.
2. Process Behaviour & Communication
System Independence
- If Operations is offline, Reggie can still act by writing to the database through shared modules, giving staff a read-only “AI mirror” of current data.
- If Reggie is offline, Operations and its front-ends continue to work; AI features are simply disabled.
API vs Logic Layer
- Public APIs live only in
operations.js; they are intended for browsers, mobile apps, and external integrations. - Reggie never calls these APIs. Instead, it imports the same shared feature modules, avoiding unnecessary network hops and keeping privilege boundaries clear.
Database as Messaging Layer
- Reggie records intents directly in domain tables (for example, inserting a leave request with
status = 'PENDING'). - Operations watches those tables and applies validation, policy checks, and side-effects (emails, notifications) in its normal workflow.
- This pattern works even if the two processes are deployed on separate machines or updated on different cadences.
3. Function Ownership & Execution Model
“Every function is a tool. Operations and Reggie are just users with different hands.”
All business rules live in /features/** and are pure functions with no external side-effects. Both servers import them:
- Encourages 100 % unit test coverage without stubbing HTTP.
- Guarantees consistent behaviour whether a human clicks a button or Reggie triggers the same action.
- Makes it trivial to add more processes (batch jobs, cron workers, CLI tools) that reuse the same logic.
By keeping AI and human workflows decoupled yet code-shared, RABS achieves reliability, testability, and the freedom to iterate on either side without breaking the other.