Plan — bahalaka + Nous Integration

Nous IS the backend. Every feature is triples. Every message is an atom. Firebase goes away.

The Insight

Everything Is a Triple

Nous stores facts as {subject, predicate, object}. Every bahalaka feature — chat, status, schedule, finances, agreements, stories — is just triples in a store. The wire protocol moves them. The journal makes them permanent. The reasoning engine detects patterns across them.

No new database. No new protocol. No new auth. Nous already has all of it.

Data Model — Everything as Triples

Chat

{msg:a1b2, from, user:joey} {msg:a1b2, to, user:maria} {msg:a1b2, text, "kumusta ka?"} {msg:a1b2, time, 1712345678} {msg:a1b2, sig, ed25519:abc123...}

Forward-only: no delete triple. Edits create new triples with {msg:a1b2, edit:1, "kumusta ka na?"} — original preserved.

Status

{user:maria, status, at_home} {user:maria, status_time, 1712345678} {user:maria, location:home, geo:14.5995,120.9842}

GPS auto-matches registered locations. Status transitions journal-logged.

Finances

{allowance:001, recipient, user:maria} {allowance:001, amount, 5000} {allowance:001, cycle, weekly} {allowance:001, withholding, 1000} {disbursement:042, allowance, allowance:001} {disbursement:042, net, 4000} {disbursement:042, date, 2026-04-04} {disbursement:042, sig, ed25519:def456...}

Balance = computed sum of all disbursement + withdrawal triples. The ledger is the truth — no mutable balance field.

Agreements

{agree:001, her_ask, template:1} {agree:001, his_dec_1, template:III} {agree:001, his_dec_2, template:A} {agree:001, sig_her, ed25519:aaa...} {agree:001, sig_him, ed25519:bbb...} {agree:001, signed_at, 1712345678} {agree:001, cooling_start, 1712259278}

Dual-signed, 48-hour cooling period enforced by timestamp math. Forward-only — new agreement supersedes, old stays.

Concern Detection — reason.c

{concern:c01, type, promise_ratio} {concern:c01, user, user:maria} {concern:c01, kept, 2} {concern:c01, total, 6} {concern:c01, confidence, 0.78}

The nous reasoning engine walks the journal graph, counts patterns, scores confidence. Same engine that reasons over knowledge — now pointed at relationship data.

Architecture

The Flow

What Changes on Nous

What Dies

C → WASM Strategy

What Compiles to WASM

What Stays Server-Side C

Emscripten Build

Build Phases

Phase 1 — WASM Foundation ~2 weeks

Prove C runs in the browser via nous modules.

Phase 2 — Relay WebSocket + Prime /bahalaka ~2 weeks

Server-side changes to accept browser clients and handle app atoms.

Phase 3 — Chat ~3 weeks

Forward-only messaging over nous wire protocol.

Phase 4 — Status + Schedule ~2 weeks

Asymmetric visibility. Geo-verified presence.

Phase 5 — Finances ~3 weeks

Allowance, savings, sponsorships. Ledger = journal triples.

Phase 6 — Agreements + Concern Detection ~3 weeks

Templates, promises, dual signatures. reason.c for pattern detection.

Phase 7 — Stories + Ship ~2 weeks

Field guide. Onboarding. App store. Friends-first launch.

Summary

What This Means