Spec library · open

The spec is canonical.

Every piece of Najim's architecture, published openly. Code is bound to these documents — not the other way around. If code disagrees with the spec, the spec wins.

html
The Najim Brain — architecture + deploy runbook
Canonical spec. Architecture diagram, bootstrap procedure, per-tenant provisioning, integration points, verification, rollback. Spec v1.0.0.
563 lines · ~41 KB
json
Versions · pinned
Every container tag, gbrain SHA, port, env var, model name. Single source of truth — drift is a git diff.
md
Implementation checklist
5-phase tracker — pre-flight, bootstrap, engineering scaffolding, first-tenant provisioning, cutover & hand-off. Done when grep returns nothing.
sh
bootstrap.sh — one-time VPS install
Executable §5 of the spec. Idempotent, fail-fast, [ok]/[skip]/[fatal] markers map 1:1 to numbered sub-steps.
258 lines
sh
provision-tenant.sh — replicable per-tenant deploy
Executable §6. Four args (tenant_id, slug, name, owner_email), 7 verified steps, ≈ 10 min per tenant.
193 lines
py
gbrain.py — Python integration module
Locked function signatures for prompt-builder. get_context(), append_fact(), format_context_for_prompt(). Implementation fills bodies; cannot invent surface.
155 lines
sql
021_clients_gbrain.sql — schema migration
Real migration file. Adds clients.gbrain_token, gbrain_source_slug, gbrain_provisioned_at + two indexes. IF NOT EXISTS throughout.
38 lines
py
test_najim_brain.py — verification suite
§10 as pytest. Health, stats, retrieval relevance, p95 latency, Dream Cycle. Green tests are the only legitimate "done" signal.
154 lines
Hardwiring rules. If the doc, versions.json, and code disagree — doc wins, then JSON, then code. Never edit bootstrap.sh or provision-tenant.sh without updating §5 or §6 of the spec in the same commit. Green pytest is the only legitimate “done.”