How kukomoo/globis-edge works
1. Repository shape
- This is an offline, edge-deployed humanitarian intake system with two major runtime surfaces:
- a Python backend under src/globis_edge
- a React/Vite operator UI under globis-edge-ui
- The code is structured for a single-device Raspberry Pi deployment with local inference, encrypted local storage, and no required cloud services.
2. Primary user workflow
- The product flow is an intake wizard: collect audio testimony, document images, and caseworker notes; normalize and compare them; generate a synthesized case summary; run safety/audit checks; then present a human-reviewable result.
- The UI screen names make this explicit: NewIntake, Ingest, Synthesise, Explainer, DignityLoop, and Commit.
3. Frontend subsystem
- globis-edge-ui/src is a single-page app with reusable layout and screen components.
- SessionContext and services/api.ts indicate the UI keeps session state locally and talks to the backend API for processing.
- The UI has dedicated components for audit visibility and trust cues such as provenance pins, conflict chips, glossary/help, override actions, synthetic-watermark/test-data indicators, and an auditor panel.
4. Backend API boundary
- src/globis_edge/api is the backend entry point, with main.py and routes.py defining the HTTP surface.
- The backend appears to act as the orchestrator: accept intake payloads, trigger model/capability pipelines, return structured results, and expose status or review artifacts to the UI.
- quarantine_badge.py suggests the API can mark or route cases that fail checks into a quarantine / review state rather than silently accepting them.
5. Core processing pipeline
- src/globis_edge/capabilities contains the business logic that transforms raw intake artifacts into a case dossier:
- coordinator.py likely sequences the end-to-end workflow
- dossier.py assembles the final structured case record
- sanitiser.py strips or masks sensitive content
- translation.py handles language normalization for multilingual intake and read-back
- This is the main data-processing boundary between raw inputs and validated output.
6. Model adapters and multimodal inference
- src/globis_edge/models and src/globis_edge/asr are the adapter layer around local AI capabilities.
- Named modules suggest the system uses:
- whisper_wrapper.py for speech-to-text
- ocr.py for document/image text extraction
- audio.py for audio-related preprocessing or metadata
- gemma_wrapper.py for local LLM / multimodal reasoning
- scout.py for lighter-weight classification or routing
- Architecturally, these are the device-local inference boundaries that feed the coordinator.
7. Auditing and constitutional controls
- src/globis_edge/auditor contains the safety gate:
- constitution.py defines policy constraints
- rules.py implements rule-based checks
- prompt.py defines the reasoning prompt for the model-based audit pass
- The README indicates a two-pass, fail-closed auditor: hard rules first, then model reasoning, with violations logged and withheld from final commit if checks fail.
8. Persistence and audit trail
- src/globis_edge/store is the local storage layer.
- sqlcipher.py and schema.sql show the system uses encrypted local persistence.
- audit_log.py and outbox.py imply two important data flows:
- an append-only audit trail for traceability
- an outbox-style queue for deferred or ordered writes/sync-like processing, even though the system is designed to stay offline
9. Runtime and device startup
- src/globis_edge/runtime contains bootstrapping for the edge device:
- start_api.py starts the backend service
- start_ui.py starts the frontend service
- hotspot.py supports the local network / hotspot mode described in the docs
- Deployment assets under deployment/systemd and scripts under deployment/scripts show the system is meant to auto-start as services on the device.
10. Offline network deployment model
- The repo includes hotspot setup scripts and systemd units for API, UI, hotspot, and PSK rotation.
- That means the intended deployment boundary is a self-contained local network: caseworkers connect to the device over a private Wi‑Fi hotspot, and the app runs entirely on the Pi without internet dependency.
11. Scenario data and demo assets
- synthetic_cases, demo_artifacts, and REAL_GEMMA4_RESULTS.json are the evidence/demo layer.
- These are used to validate the architecture against synthetic intake scenarios and to document measured outcomes such as latency, conflict detection, and auditor behavior.
- assets/images and globis-edge-ui/src/data support the demo UX and glossary/translations.
12. Evaluation and testing boundary
- The tests tree is broad: unit, integration, adversarial, and multimodal-coordinator tests.
- eval/runners/run_latency.py and run_auditor.py indicate separate benchmark harnesses for performance and safety behavior.
- This matters architecturally because the system treats latency and safety as first-class constraints, not afterthoughts.
13. Governance and policy artifacts
- CONSTITUTION.md, ETHICS.md, PRD.md, and the governance/ YAML files are not just docs; they define the operational policy envelope for the system.
- The auditor, data-minimization behavior, and logging model all appear to be derived from those governance boundaries.
14. High-level boundary diagram you should draw
- Left side: operator/caseworker UI collecting multimodal intake.
- Center: FastAPI orchestration layer calling ASR/OCR/LLM/translation modules and the constitutional auditor.
- Lower center: encrypted local SQLCipher storage with audit/outbox.
- Right side: offline deployment/runtime services on Raspberry Pi with hotspot access.
- Surrounding it: governance, tests, and eval harnesses that constrain and verify the behavior of the whole system.
Main entry points: coordinator.py Coordinator · rules.py Auditor · Screen1_NewIntake.tsx Intake Screens · routes.py Routes
Components 29
Operator UI
React/Vite intake interface for caseworkers and reviewers.
- App Shell · Top-level React entry and navigation host for the operator experience.
globis-edge-ui/src/App.tsx - Layout · Shared chrome for sidebar, topbar, and screen framing.
globis-edge-ui/src/components/Layout/MainLayout.tsx - Intake Screens · Wizard flow for new intake, ingest, synthesis, explanation, dignity loop, and commit.
globis-edge-ui/src/components/Screens/Screen1_NewIntake.tsx - Trust UI · Provenance, conflicts, overrides, glossary, synthetic-data, and auditor-facing cues.
globis-edge-ui/src/components/UI/AuditorPanel.tsx - Session State · Local session context for intake progress and operator state.
globis-edge-ui/src/store/SessionContext.tsx - API Client · Browser-side service layer for backend calls and structured results.
globis-edge-ui/src/services/api.ts
Backend API
FastAPI orchestration boundary for intake processing and review artifacts.
- API Entry · Backend bootstrap and HTTP application wiring.
src/globis_edge/api/main.py - Routes · Intake, status, and review-facing request handlers.
src/globis_edge/api/routes.py - Quarantine Badge · Marks cases that fail checks for restricted handling or review.
src/globis_edge/api/quarantine_badge.py
Processing Core
Multimodal normalization, dossier assembly, and policy enforcement.
- Coordinator · Sequences the end-to-end intake pipeline across models and policy gates.
src/globis_edge/capabilities/coordinator.py - Dossier Builder · Assembles the final structured case summary and review artifact.
src/globis_edge/capabilities/dossier.py - Sanitiser · Masks or strips sensitive content before downstream handling.
src/globis_edge/capabilities/sanitiser.py - Translation · Normalizes multilingual intake and read-back content.
src/globis_edge/capabilities/translation.py - Auditor · Two-pass rules-plus-reasoning safety check before commit.
src/globis_edge/auditor/rules.py - Speech to Text · Local speech transcription wrapper for audio testimony.
src/globis_edge/asr/whisper_wrapper.py - OCR · Document and image text extraction for scanned intake artifacts.
src/globis_edge/models/ocr.py - Local LLM · Local reasoning and synthesis adapter for multimodal case analysis.
src/globis_edge/models/gemma_wrapper.py - Scout · Lightweight classification and routing helper for fast decisions.
src/globis_edge/models/scout.py
Local Storage
Encrypted persistence and traceable write paths on the device.
- SQLCipher Store · Encrypted local persistence for device-bound case data.
src/globis_edge/store/sqlcipher.py - Audit Log · Traceable record of system actions and policy-relevant events.
src/globis_edge/store/audit_log.py - Outbox · Deferred or ordered write path for local processing and sync-like staging.
src/globis_edge/store/outbox.py
Edge Runtime
Pi startup, hotspot access, and service supervision.
- API Start · Runtime entrypoint that launches the backend service on-device.
src/globis_edge/runtime/start_api.py - UI Start · Runtime entrypoint that launches the operator UI on-device.
src/globis_edge/runtime/start_ui.py - Hotspot · Local private Wi-Fi access for the edge device deployment.
src/globis_edge/runtime/hotspot.py
Governance & Eval
Policy documents, prompts, scenarios, and benchmarks that constrain behavior.
- Constitution · Policy envelope defining permitted behavior and safety constraints.
src/globis_edge/auditor/constitution.py - Auditor Prompt · Reasoning prompt used by the model-based audit pass.
src/globis_edge/auditor/prompt.py - Synthetic Cases · Scenario data used to exercise and validate the intake workflow.
synthetic_cases/aisha/case.json - Latency Eval · Performance harness for end-to-end pipeline timing.
eval/runners/run_latency.py - Auditor Eval · Safety and auditor behavior harness for policy validation.
eval/runners/run_auditor.py
Connections 28
- App Shell → Layout: uses · The SPA is wrapped in shared layout chrome.
- Layout → Intake Screens: hosts · Layout frames the wizard screens.
- Intake Screens → Trust UI: renders · Workflow screens surface provenance and review cues.
- Intake Screens → Session State: reads/writes · Screens persist local intake progress and state.
- API Client → Routes: calls · Client sends intake and review requests to backend endpoints.
- API Entry → Routes: mounts · Application bootstrap registers HTTP routes.
- Routes → Coordinator: orchestrates · Requests are handed to the core workflow coordinator.
- Routes → Quarantine Badge: flags · Failed checks can be marked for quarantine or review.
- Coordinator → Speech to Text: transcribes · Audio testimony is converted to text locally.
- Coordinator → OCR: extracts · Document images are OCR-processed for text.
- Coordinator → Translation: normalizes · Multilingual content is standardized for processing.
- Coordinator → Sanitiser: redacts · Sensitive content is masked before synthesis or storage.
- Coordinator → Scout: routes · Lightweight classification helps direct workflow decisions.
- Coordinator → Local LLM: synthesises · Local LLM produces case reasoning and summary output.
- Coordinator → Auditor: checks · Workflow output is validated against policy and reasoning gates.
- Auditor → Constitution: enforces · Hard policy constraints are derived from the constitution.
- Auditor → Auditor Prompt: guides · Model-based audit pass is steered by an auditor prompt.
- Coordinator → Dossier Builder: assembles · Validated inputs are assembled into the final dossier.
- Dossier Builder → SQLCipher Store: persists · Case records are written to encrypted local storage.
- Auditor → Audit Log: logs · Violations and checks are recorded for traceability.
- SQLCipher Store → Outbox: queues · Ordered writes or deferred actions pass through the outbox.
- API Start → API Entry: launches · Device boot starts the backend service.
- UI Start → App Shell: launches · Device boot starts the operator UI service.
- Hotspot → App Shell: exposes · Local network access connects operators to the UI.
- Synthetic Cases → Intake Screens: drives · Demo scenarios are used to exercise the intake flow.
- Synthetic Cases → Coordinator: validates · Synthetic cases are used to validate multimodal coordination.
- Latency Eval → Coordinator: benchmarks · Latency harness measures end-to-end pipeline performance.
- Auditor Eval → Auditor: benchmarks · Auditor harness evaluates safety behavior and refusal quality.