AI Agent Integration — OCB Group
Integrated OpenAI, Gemini & Anthropic agents into internal retail ops, automating core workflows across nationwide branches.
OCB Group ran 40 retail outlets and 150+ staff across Kalimantan entirely on paper: attendance in notebooks, KPIs scored by gut feel, deposits reported over WhatsApp with no reconciliation, and payroll hand-computed over three days at month-end with a 5–8% error rate. The hard constraint was integrity — employee identity had to stay consistent across every system, or payroll would pay the wrong person.
Designed a distributed monolith: five apps, each owning its own database, joined by read-only cross-database references and a single server-to-server roster sync — one writer for employee identity, everyone else reads. An AI layer handles receipt OCR (vision model → validated JSON → reconciled against IPOS) and KPI scoring across 34 weighted SOP tracks. Deployed on one VM over Tailscale behind a Cloudflare Tunnel, with Telegram alerting instead of a dashboard nobody opens.
A distributed monolith, on purpose
Five apps, each owning its own database, joined only by read-only cross-database references and a single server-to-server roster sync. One writer for employee identity; everyone else reads. Not microservices — clear ownership boundaries without the operational tax.
Clients
40 outlets · 150+ users
- Cashier / PICweb
- Supervisorweb
- Field staffPWA · .apk
- Telegram botdeposit audit
Applications
5 systems · own DB each
- AttendanceNode · Express — source of truth
- KPIBun · TS
- DepositsBun · Svelte 5
- PayrollBun · 3 pools
- AssetsExpress · PWA
AI layer
validated at the boundary
- Receipt OCRvision → JSON
- KPI scoring34 SOP tracks
- Schema validationbefore persist
Data
read-only by contract
- identity DBread/write — 1 writer
- kpi DBread-only to payroll
- payroll DBread/write
- asset DBPostgreSQL
- POS systemreconciliation source
Infrastructure
deliberately boring
- Single VMHyper-V
- Tailscaleprivate mesh
- Cloudflare Tunnelingress
- PM2zero-downtime reload
- Telegram alerts~5s to phone
- One writer for employee identity. Every other system reads it and never writes back — integrity is structural, not a code-review convention.
- Payroll's upstream pools are read-only by contract, so it can physically never corrupt data other systems depend on.
- AI output is validated at a boundary before it touches the database; the model assists, a human decides.
- Roster sync is server-to-server with a shared key — eventual consistency on the roster in exchange for zero write contention.
- Alerting lands where the on-call already is (Telegram), not on a dashboard nobody opens.
- 01Shipped 5 interconnected production systems (attendance, KPI, deposits, payroll, assets) in two months.
- 02Single-writer employee identity + read-only pools by contract — zero cross-system corruption in months of operation.
- 03AI receipt OCR cut deposit entry from 10 minutes to 2 per cashier (~320 minutes/day network-wide).
- 04Payroll went from 3 days at 5–8% error to ~1 hour at 0.3%.
- 05Optimized iPos 5 queries (PostgreSQL/MySQL) — collapsed N+1 fan-out to enable real-time inventory across all stores.