Evidence-Grounded Organizational Memory & Institutional Continuity Platform
Preserving institutional truth, detecting operational contradictions, and synthesizing verifiable leadership handovers.π Flip the Switch Hackathon β WeMakeDevs Γ DevTools Academy Γ Switch
π― Target Track: Best Business Workflow
π Submission Date: November 7, 2026
| Operational Continuity Dashboard | Two-Phase Human Conflict Review |
|---|---|
![]() |
![]() |
| Readiness telemetry, indexed triples, and open anomalies | Verbatim claim comparison and Mattermost authentication |
| 9-Chapter Executive Briefing Book | Zero-Hallucination Grounded Q&A |
|---|---|
![]() |
![]() |
| Evidence-grounded transition briefing with 30-day roadmap | Strict citation verification and honest insufficient-evidence refusals |
π Explore the complete 28-image screenshot index in docs/screenshots/README.md.
Watch the complete, evidence-grounded walkthrough of Relay demonstrating institutional document ingestion, proactive contradiction detection, Switch + FastMCP agent integration, cryptographic human approval governance, and executive handover synthesis:
πΉ Click here to watch / download the full 1080p demo video (
docs/demo-video/relay-demo.mp4)
β±οΈ Duration: 2 minutes 50 seconds (1080p @ 30 FPS, H.264/AAC, 9.63 MB)
π Captions: Synchronized burned-in subtitles and standalone English SRT
π Production Dossier: Complete storyboard and voiceover script indocs/demo-video/README.md
| Timestamp | Chapter | Key System Capability Demonstrated |
|---|---|---|
| 00:00 | The Problem | Structural amnesia and operational knowledge loss during executive leadership turnover |
| 00:22 | The Solution | Cryptographic document ingestion with character-level evidence coordinates (char_start, char_end) |
| 00:44 | The Engine | Proactive detection of contradictions (Project Odyssey Nov 15 vs Dec 20) and unassigned Kubernetes cluster Alpha-9 |
| 01:11 | Switch & FastMCP | OpenCode agent executing registered Relay FastMCP tools to inspect evidence and explain discrepancies without guessing |
| 01:40 | Governance Desk | Two-phase human review requiring a single-use 32-byte cryptographic token and authenticated Mattermost reviewer |
| 02:06 | Executive Artifacts | Automatic compilation of an audited 9-Chapter Briefing Book and interactive Continuity Topology Radar |
| 02:29 | Grounded Trust | Honest refusal on insufficient evidence, 229 verified automated tests, and open-source project links |
- Product Demo Video
- Project Introduction
- Problem Statement
- Solution Overview
- Key Features
- System Architecture
- Complete System Workflow
- Conflict Detection Lifecycle
- Human Approval & Security Architecture
- Handover Dossier Structure
- Technology Stack
- Repository Structure
- Installation & Local Setup
- Environment Variables
- API & FastMCP Documentation
- Testing & Quality Assurance
- Screenshots & Product Walkthrough
- Security & Data Integrity
- Limitations & Future Roadmap
- Contribution & License
- Closing Summary
Relay is an evidence-grounded institutional continuity and memory platform designed to solve the structural amnesia that plagues organizations during leadership transitions, restructuring, and rapid operational scaling.
Relay transforms unstructured institutional documentsβproject charters, architecture roadmaps, schedule amendment memos, governance delegations, and meeting minutesβinto an immutable, citation-grounded knowledge graph. When institutional documents contradict one another or leave critical infrastructure unassigned, Relay proactively detects the anomaly, flags the discrepancy, and enforces a Two-Phase Human Approval workflow so AI agents can never unilaterally overwrite institutional truth.
- Cloud Drives & Wikis Rot: Traditional document storage (Google Drive, SharePoint, Notion) functions as passive digital landfills. Documents are filed and forgotten, predecessor decisions remain unflagged when amended, and superseded deadlines silently mislead teams.
- Chat Histories Bury Rationale: Conversations in Slack or Mattermost contain critical decisions, but their searchability is ephemeral. Context is scattered across hundreds of channels and private threads without structured ownership or evidence links.
- Unowned Commitments Slip Through Cracks: Critical infrastructure assets, server clusters, vendor auto-renewals, and regulatory filings frequently lack explicit owners, only surfacing after catastrophic outages or missed deadlines.
- LLM Hallucinations Compound Risk: Unconstrained LLMs summarize text by inventing plausibly sounding facts, smoothing over contradictory dates, and guessing unassigned leadership roles.
Relay bridges human collaboration tools (Switch, Mattermost) and institutional records with strict cryptographic citations, continuous contradiction detection, and automated synthesis of a 9-Chapter Executive Briefing Book paired with a Day 1β30 Operational Roadmap.
Organizational leadership transitions are high-friction, high-risk operational choke points:
- Catastrophic Knowledge Bleed: Departing executives take unwritten operational history, informal agreements, and risk registers with them. Successors spend their first 90 days rediscovering operational context rather than executing strategy.
- Fragmented & Contradictory Decisions: Critical project milestones exist in competing formats across different memos (e.g. Project Odyssey launch dates cited as November 15, 2026 in original charters, but amended to December 20, 2026 in technical review memos). Teams operate against disparate versions of reality.
- Orphaned Infrastructure & Ownership Gaps: Critical assets (e.g. Kubernetes cluster Alpha-9) are mentioned in operational documents without assigned organizational stewards, creating severe compliance and continuity hazards.
- Lack of Verifiable Grounding: Incoming leaders have no verifiable mechanism to validate whether briefing claims originate from ratified decisions or ungrounded assumptions.
Relay introduces an active, continuous intelligence fabric that guarantees institutional continuity across four interconnected operational planes:
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β RELAY OPERATIONAL PLANES β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β 1. INGESTION & GROUNDING: Multimodal document extraction with β
β character-exact coordinates and verbatim source citations. β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β 2. CONTINUOUS INTELLIGENCE: Automated detection of direct contradictions, β
β superseded decisions, ownership gaps, and missing knowledge. β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β 3. GOVERNED HUMAN ADJUDICATION: Two-phase approval requiring authenticated β
β human reviewers (Mattermost/Switch) to resolve organizational conflicts. β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β 4. TRANSITION SYNTHESIS: Compilation of an evidence-backed 9-chapter β
β Executive Briefing Book and chronological Day 1β30 Operational Roadmap. β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
- Deterministic Document Segmentation: Parses raw text, PDFs, and documentation into indexed segments with exact start and end character offsets.
- Multimodal AI Structured Extraction: Leverages Google Gemini multimodal intelligence to extract structured entities, mentions, typed facts, and relationship triples.
- 100% Verbatim Citation Anchoring: Every fact persisted in Relay is permanently linked to an immutable segment ID and verbatim quotation from primary documents.
- Contradiction & Discrepancy Engine: Cross-compares factual claims across the entire repository to detect conflicting dates, mismatched roles, and conflicting mandates.
- Superseded Decision Tracking: Recognizes explicit amendment language (e.g. "amends or supersedes prior decision") to preserve historical decision lineage while recognizing the active policy.
- Ownership & Knowledge Gap Detection: Proactively surfaces high-value infrastructure assets (e.g.
Kubernetes cluster Alpha-9) and unverified claims lacking an assigned steward. - Two-Phase Human Approval Security: AI agents can request conflict resolutions via FastMCP, but only an authenticated human reviewer can review competing claims and authorize updates.
- Cryptographic Single-Use Tokens: Every pending resolution generates a cryptographically random, time-expiring
ConflictApprovalTokenwith replay protection. - Server-to-Server Mattermost Authentication: Reviewer identities are authenticated server-to-server against Mattermost (
/api/v4/users/login) with rate limiting (5 attempts, 300s lockout) and zero token leakage. - Immutable Adjudication Audit Log: Every approval, rejection, and deduplication action is immutably logged with approver identity, auth method, resolution notes, and token hash.
- 9-Chapter Executive Briefing Book: Synthesizes institutional memory across 9 comprehensive operational chapters with zero hallucinated names.
- Day 1β30 Operational Roadmap: 4-phase, 12-action chronological roadmap structured for incoming leadership onboarding.
- Zero-Hallucination Incoming Leader Q&A: Q&A engine queries verified facts and handover dossiers; queries lacking evidence return an honest refusal (
has_sufficient_evidence: false). - FastMCP Agent Integration: 5 registered tools connecting Switch Console and OpenCode agents directly to Relay.
- Multi-Format Export: One-click exports to structured JSON, full Markdown (
.md), and clean print view stylesheets.
- Distributed vector database integration (Qdrant / pgvector) for multi-million document semantic scaling.
- Live audio transcription and meeting minute grounding via Gemini Live API.
- Multi-tenant organizational workspace isolation.
Relay is built on a modular, decoupled architecture connecting frontend interfaces, human chat tools, autonomous agents, and persistent storage.
flowchart TD
subgraph HumanInterfaces["Human & Collaboration Interfaces"]
FE["Next.js Brutalist Web UI\n(Port 3000)"]
SW["Switch Console\n(Port 52066)"]
MM["Mattermost Team Edition\n(Port 52067)"]
end
subgraph AgentLayer["Agent & Orchestration Layer"]
OCA["OpenCode Agent\n(Relay Test Agent)"]
MCP["Relay FastMCP Server\n(Stdio Transport)"]
end
subgraph RelayCore["Relay Backend Core (FastAPI :8000)"]
API["FastAPI REST API Gateway"]
subgraph Services["Core Processing Services"]
DOC["Document Ingestion\n& Segmentation"]
LLM["Gemini Extraction\n& Grounding Provider"]
INT["Intelligence Analyzer\n(Conflict Engine)"]
APP["Two-Phase Human\nApproval Service"]
DOS["9-Chapter Dossier\nSynthesis Service"]
QA["Evidence-Grounded\nQ&A Service"]
end
SEC["Security & Auth Guard\n(Rate Limiter & Operator Secret)"]
end
subgraph StorageLayer["Persistence & Ground Truth"]
DB[("SQLite 3 Database\n(WAL Mode Enabled)\n15 Core Tables")]
BACKUP[("Timestamped Backups\n& Audit Provenance")]
end
%% Wiring
FE -->|REST API Calls| API
SW --> OCA
OCA -->|JSON-RPC Tools| MCP
MCP -->|HTTP REST| API
MM -->|Server-to-Server Auth| APP
API --> SEC
SEC --> Services
DOC --> LLM
LLM --> DB
INT --> DB
APP --> DB
DOS --> DB
QA --> DB
DB --> BACKUP
The end-to-end lifecycle guarantees that no ungrounded claim enters institutional memory and no conflict is resolved without verified human oversight.
flowchart TD
A["1. Document Ingestion\n(PDF, TXT, DOCX)"] --> B["2. Deterministic Segmentation\n(Character Offsets)"]
B --> C["3. Multimodal Fact Extraction\n(Google Gemini)"]
C --> D["4. Entity Resolution &\nCitation Grounding"]
D --> E[("5. Persistent Storage\n(Relay SQLite WAL)")]
E --> F["6. Continuous Intelligence\nAnalyzer Scan"]
F --> G{"Conflict\nDetected?"}
G -- "Corroborated / No Conflict" --> H["Knowledge Graph Updated"]
G -- "Contradiction / Gap / Superseded" --> I["Flag Knowledge Conflict\n(Open Anomaly)"]
I --> J["7. AI Agent Investigation\n(Switch FastMCP Tool)"]
J --> K["8. Agent Requests Resolution\n(relay_request_conflict_resolution)"]
K --> L["Generate Single-Use\nConflictApprovalToken"]
L --> M["9. Human Review Desk\n(/api/v1/intelligence/approvals/review)"]
subgraph HumanApprovalBoundary["Strict Human Approval Boundary"]
M --> N["Human Reviewer Authenticates\n(Mattermost Login / PAT)"]
N --> O{"Reviewer\nDecision"}
O -- "Approve" --> P["Adjudicate Resolution\n(Consume Token & Update Truth)"]
O -- "Reject" --> Q["Reject Proposal\n(Preserve Conflict State)"]
end
P --> R["10. Immutable Audit Log\n(conflict_resolution_audits)"]
R --> S["11. Executive Handover Dossier\n(9 Chapters & 30-Day Roadmap)"]
S --> T["12. Incoming Leader Grounded Q&A\n(Zero-Hallucination Retrieval)"]
Relay classifies organizational knowledge interactions into distinct cognitive categories:
flowchart LR
A["Extracted Fact B"] --> B{"Compare with\nFact A"}
B -- "Same claim &\nsame timeline" --> C["Corroboration\n(Increases Confidence)"]
B -- "Incompatible dates\nor opposing statements" --> D["Direct Contradiction\n(CRITICAL SEVERITY)"]
B -- "Explicit amendment\nof earlier decision" --> E["Superseded Decision\n(MEDIUM SEVERITY)"]
B -- "Asset mentioned\nwithout steward" --> F["Ownership Gap\n(HIGH SEVERITY)"]
B -- "Unverified citation\nor absent source" --> G["Evidence Gap\n(HIGH SEVERITY)"]
D --> H["Queue for Human Review"]
E --> H
F --> H
G --> H
| Conflict Category | Severity | Example from Ingested Data | Resolution Mechanism |
|---|---|---|---|
| Direct Contradiction | CRITICAL |
Odyssey Beta launch: Nov 15, 2026 vs Dec 20, 2026 | Human reviewer ratifies valid date via Mattermost |
| Direct Contradiction | CRITICAL |
Odyssey GA release: Jan 15, 2027 vs Feb 28, 2027 | Human reviewer ratifies production release date |
| Superseded Decision | MEDIUM |
Deployment roadmap amendment supersedes launch memo | Successor amendment adopted while preserving history |
| Superseded Decision | MEDIUM |
Aegis Beta postponed from Dec 15, 2026 to Feb 1, 2027 | Postponement ratified; technical scope confirmed |
| Ownership Gap | HIGH |
Kubernetes cluster Alpha-9 lacks assigned steward |
Incoming leadership assigns responsible architect |
| Knowledge Gap | HIGH |
ACM student chapter role cited without verified documentation | Marked as unverified pending primary record ingestion |
Relay enforces a zero-trust model between AI agents and organizational ground truth:
sequenceDiagram
autonumber
actor Agent as Switch AI Agent (OpenCode)
participant Relay as Relay API Gateway
participant DB as Relay SQLite Database
actor Human as Human Compliance Reviewer
participant MM as Mattermost Auth Service
Agent->>Relay: POST /api/v1/conflicts/{id}/request-resolution
Note over Relay: Validates conflict exists & is open
Relay->>DB: Create ConflictApprovalToken (Status: pending, Expiry: 24h)
Relay-->>Agent: Returns Request ID & Review Link URL
Agent-->>Human: Posts Review Link into Mattermost/Switch Channel
Human->>Relay: Opens Review Screen (GET /approvals/review?request_id=...)
Relay-->>Human: Renders Fact A vs Fact B & Verbatim Citations
Human->>Relay: Submits Credentials (Username/Password or PAT)
Relay->>MM: Server-to-Server Verify (POST /api/v4/users/login)
MM-->>Relay: User Authenticated (human-reviewer)
Note over Relay: Sliding-Window Rate Limiter Enforced (5 max, 300s lockout)
Human->>Relay: Clicks "Approve Resolution" + Justification Notes
Relay->>Relay: Verify Operator Secret & Match Token Hash
Relay->>DB: Update Conflict Status -> resolved
Relay->>DB: Mark ConflictApprovalToken -> consumed
Relay->>DB: Write conflict_resolution_audits (Immutable Provenance)
Relay-->>Human: Adjudication Confirmed & Audit Sealed
Relay establishes clear governance boundaries between public viewers, contributing team members, AI agents, and authorized decision-makers:
| Role | Scope | Permissions & Responsibilities | Institutional Actor |
|---|---|---|---|
| Administrator | System Architecture | Configuration of Docker containers, API environment policies, audit log exports, and storage engine encryption. | System Admin |
| Outgoing Leader | Knowledge Deposition | Uploads departure charters, annotates tacit knowledge, transfers RACI custody of infrastructure assets. | Aman Kumar |
| Contributor | Operational Ingestion | Deposits sprint roadmaps, architecture proposals, and postmortems (Elena Rostova, Dr. Thorne, Priya Sharma). | Engineering Leads |
| Authorized Reviewer | Switch Human Gate | Adjudicates flagged contradictions and approves/rejects conflict resolutions using Mattermost PAT or operator secret. | Compliance Lead |
| Incoming Leader | Continuity Execution | Queries citation-grounded Q&A via Switch, executes the Day 1β30 Roadmap, and exports 9-chapter dossiers. | Marcus Vance |
- Public Portal (
/,/platform,/how-it-works): Read-only architectural overview, interactive methodology demonstrations, and product documentation. - Authenticated Workspace (
/app/*): Local Docker-contained intelligence desk protected by local network boundaries, session tokens, and cryptographic operator secrets. Unilateral resolution by AI agents is blocked at the gateway level.
The Executive Handover Dossier compiles institutional memory into 9 structured chapters without generic placeholders or hallucinated names:
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β 9-CHAPTER EXECUTIVE DOSSIER β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Chapter 1: Organizational Overview & Current Operational State β
β β’ Synthesizes total records, entities, and active organizational streams. β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Chapter 2: Active Projects, Milestones & Timeline Delivery β
β β’ Tracks Project Odyssey, Project Aegis, and Project Nova milestones. β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Chapter 3: Responsibilities, Ownership Matrix & Governance Hierarchy β
β β’ Maps reporting lines and active stewardships across key personnel. β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Chapter 4: Strategic Decisions & Superseded History β
β β’ Chronicles ratified decisions alongside historical amendments. β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Chapter 5: Pending Deliverables, Commitments & Upcoming Deadlines β
β β’ Audits time-sensitive operational commitments and vendor milestones. β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Chapter 6: Open Discrepancies, Adjudication Queue & Ratified Matters β
β β’ Segregates open conflicts from human-adjudicated resolutions. β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Chapter 7: Ownership Gaps, Missing Knowledge & Operational Hazards β
β β’ Highlights unassigned assets (Kubernetes cluster Alpha-9). β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Chapter 8: Institutional Contacts, Stakeholders & System Dependencies β
β β’ Indexes key personnel (Elena Rostova, Dr. Aris Thorne, Priya Sharma). β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Chapter 9: Grounding Source Document Archive & Citation Register β
β β’ Complete bibliographic register of deposited primary sources. β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Accompanying the dossier is a 4-phase chronological guide for the incoming leader:
- Days 1β7 (Immediate Orientation & Bilateral Briefing): Direct handover sessions between outgoing leader (
Marcus Vance) and incoming successor (Aman Kumar). Review technical migration status with Elena Rostova. - Days 8β14 (Discrepancy Adjudication & Infrastructure Stewardship): Formal assignment of
Kubernetes cluster Alpha-9ownership. Two-phase human review on pending schedule conflicts. - Days 15β21 (Stakeholder Alignment & Architecture Review): Review API Gateway to Service Mesh migration with Maya Lin. Align engineering units on postponed Feb 1, 2027 Project Aegis Beta.
- Days 22β30 (Operational Autonomy & Readiness Gate): Pre-flight verification for Project Nova security testing completion. Formal countersigning of the Executive Briefing Book.
Verified against repository dependencies and runtime configurations:
βββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Layer β Technology & Version β
βββββββββββββββββββΌββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Frontend β Next.js 15.1.0 (App Router), React 19.0.0, β
β β Tailwind CSS 3.4.17, Lucide Icons, Framer Motion β
βββββββββββββββββββΌββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Backend API β Python 3.12, FastAPI 0.115+, Uvicorn 0.32+, β
β β Pydantic v2.10, Pydantic-Settings β
βββββββββββββββββββΌββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Database & ORM β SQLite 3 (WAL mode, Foreign Keys ON), SQLAlchemy 2.0, β
β β Alembic 1.14 database migrations β
βββββββββββββββββββΌββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β AI & Grounding β Google GenAI SDK (google-genai 1.4+), β
β β Gemini 2.5 Flash / Gemini 3.5 Flash, deterministic fallbackβ
βββββββββββββββββββΌββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β MCP Protocol β FastMCP (Model Context Protocol) 1.2+ β
β β Stdio JSON-RPC transport with OpenCode runner β
βββββββββββββββββββΌββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Collaboration β Switch Console 0.31, Mattermost Team Edition 11.9 β
βββββββββββββββββββΌββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Infrastructure β Docker Desktop, Docker Compose, Windows WSL2 compatibilityβ
βββββββββββββββββββ΄ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Relay/
βββ .env.example # Environment template with safe placeholders
βββ .gitignore # Git exclusions (credentials, databases, caches)
βββ docker-compose.yml # Production container configuration
βββ README.md # Primary platform documentation
β
βββ backend/ # FastAPI core backend
β βββ .env.example # Backend-specific environment template
β βββ Dockerfile # Python 3.12 container build definition
β βββ requirements.txt # Locked Python backend dependencies
β βββ pytest.ini # Pytest test runner configuration
β βββ relay.db # Live institutional SQLite database
β β
β βββ app/
β β βββ main.py # Application entrypoint & middleware
β β βββ api/
β β β βββ continuity_api.py # Handover, review, & approval endpoints
β β β βββ documents.py # Document deposit & text extraction
β β β βββ endpoints.py # Grounded Q&A endpoints
β β β βββ intelligence.py # Conflict detection triggers
β β βββ core/
β β β βββ config.py # Pydantic BaseSettings & secrets
β β β βββ database.py # SQLAlchemy engine & SQLite pragmas
β β β βββ rate_limiter.py # Sliding-window login rate limiter
β β βββ integrations/
β β β βββ llm/
β β β β βββ gemini_provider.py # Multimodal structured extraction
β β β βββ switch/
β β β βββ approval_handler.py# Switch & Mattermost approval gateway
β β β βββ mcp_server.py # FastMCP server exposing 5 Relay tools
β β β βββ AGENTS.md # AI agent instructions & governance
β β βββ models/
β β β βββ continuity.py # Conflicts, tokens, audits, dossiers
β β β βββ document.py # Documents, segments, entities, facts
β β βββ schemas/
β β β βββ continuity.py # Dossier & approval Pydantic schemas
β β β βββ extraction.py # Extraction & citation schemas
β β βββ services/
β β βββ approval_service.py # Two-phase token lifecycle
β β βββ dossier_service.py # 9-chapter briefing book synthesis
β β βββ intelligence_analyzer.py # Contradiction & gap detection
β β βββ mattermost_auth.py # Server-to-server Mattermost auth
β β βββ qa_service.py # Citation-grounded Q&A engine
β βββ tests/ # Automated test suite (229 tests)
β
βββ frontend/ # Next.js Brutalist web application
β βββ package.json # Node.js dependencies & scripts
β βββ tsconfig.json # TypeScript compiler configuration
β βββ tailwind.config.ts # Visual Brutalist design system tokens
β βββ src/
β βββ app/
β β βββ page.tsx # Public landing & architecture overview
β β βββ app/
β β βββ page.tsx # Executive Continuity Dashboard
β β βββ archive/ # Document Archive & Fact Inspector
β β βββ investigations/ # Conflict Adjudication Desk
β β βββ responsibilities/# Responsibility Matrix
β β βββ map/ # Knowledge Graph & Entity Visualizer
β β βββ agents/ # Agent Pipeline & Grounded Q&A Desk
β β βββ handovers/ # 9-Chapter Dossier Viewer & Exports
β βββ components/ # Brutalist UI components & badges
β βββ lib/
β βββ api.ts # Typed frontend HTTP client
β
βββ docs/
β βββ demo-video/ # 1080p hackathon demo video, subtitles & dossier
β β βββ relay-demo.mp4 # Master 1080p demonstration video (2m 50s)
β β βββ relay-demo.en.srt # Synchronized English captions
β β βββ README.md # Video storyboard, voiceover script, & QA specs
β βββ blog/ # Competition-quality technical build blog
β β βββ relay-technical-build-story.md # DEV Community build story
β β βββ README.md # Blog publishing guide & asset verification
β βββ handover-dossier-v1.json # Real exported dossier in JSON format
β βββ handover-dossier-v1.md # Real exported dossier in Markdown format
β βββ screenshots/ # Organized screenshot gallery (28 images)
β βββ README.md # Screenshot catalog and visual walkthrough
β
βββ scripts/
βββ capture_all_screenshots.js # Automated headless Chrome screenshot runner
βββ export_dossier.py # Handover export generator
- Node.js: v18.0.0 or higher (Node 22 LTS recommended)
- Python: v3.11 or v3.12
- Docker: Docker Desktop with Compose v2+
- Git: v2.30+
git clone https://github.com/your-org/relay.git
cd RelayCopy the template files and insert your API keys:
cp .env.example .env cp backend/.env.example backend/.env
Edit backend/.env to include your Google Gemini API key:
GEMINI_API_KEY=your_gemini_api_key_here SWITCH_OPERATOR_SECRET=generate_a_random_32_character_secret
Run the containerized backend:
docker compose up -d --build
Verify the backend is healthy:
curl http://localhost:8000/health
# Returns: {"status":"ok","database":"connected","environment":"development","version":"0.1.0"}In a separate terminal:
cd frontend
npm install
npm run devThe web dashboard is now accessible at http://localhost:3000.
| Variable Name | Required | Default / Example | Purpose |
|---|---|---|---|
ENVIRONMENT |
Yes | development |
Application runtime environment |
DEBUG |
No | True |
Enables SQL echoing and debug logging |
PORT |
No | 8000 |
Backend API listener port |
DATABASE_URL |
Yes | sqlite:///./relay.db |
SQLAlchemy connection string |
GEMINI_API_KEY |
Yes | AQ... |
Google GenAI API key for structured extraction |
SWITCH_OPERATOR_SECRET |
Yes | [cryptographic-secret] |
Required secret for human adjudication endpoints |
MATTERMOST_URL |
Yes | http://127.0.0.1:52067 |
Base URL of local Mattermost instance |
MATTERMOST_API_URL |
Yes | http://127.0.0.1:52067/api/v4 |
Mattermost REST API v4 endpoint |
RELAY_API_URL |
Yes | http://127.0.0.1:8000 |
Target URL used by FastMCP and frontend |
| Method | Route | Description | Auth / Security |
|---|---|---|---|
GET |
/health |
Liveness & database connection probe | Public |
GET |
/api/v1/continuity/overview |
Readiness score, open anomalies, & metrics | Public |
GET |
/api/v1/conflicts |
Returns active, resolved, or all conflicts | Public |
POST |
/api/v1/conflicts/{id}/request-resolution |
AI agent queues pending resolution | Public (Generates token) |
POST |
/api/v1/conflicts/{id}/adjudicate |
Executes human adjudication | Requires Token + Operator Secret |
POST |
/api/v1/intelligence/approvals/auth/login |
Server-to-server Mattermost auth | Rate-limited (5 attempts) |
GET |
/api/v1/intelligence/approvals/review |
Interactive human review screen | Requires Request UUID |
GET |
/api/v1/handovers |
Lists compiled handover dossiers | Public |
POST |
/api/v1/handovers/generate |
Synthesizes 9-chapter briefing book | Public |
POST |
/api/v1/qa/ask |
Evidence-grounded transition query | Public |
Relay exposes 5 FastMCP tools to autonomous agents via stdio JSON-RPC:
- Purpose: Ingests project charters, memos, or minutes into Relay. Runs deterministic segmentation, triggers Gemini structured extraction, links citations, and scans for conflicts.
- Input: Document title and raw text string.
- Output: JSON string containing document ID, extracted fact count, and new conflict alerts.
- Purpose: Answers user questions strictly grounded in deposited institutional evidence.
- Input: Natural language inquiry string.
- Output: Synthesized answer with confidence score, verbatim quotations, and document segment citations.
- Purpose: Audits institutional contradictions and discrepancies across deposited records.
- Input: Status filter (
open,resolved,dismissed) and optional severity. - Output: Formatted list of conflict pairs with Statement A vs Statement B and source tags.
4. relay_request_conflict_resolution(conflict_id: str, proposed_status: str, resolution_notes: str, requesting_agent: str = "relay-test-agent") -> str
- Purpose: Enforces Two-Phase Human Approval. Creates a cryptographically secured pending approval request and returns a human review URL.
- Input: Target conflict UUID, proposed resolution state, and justification notes.
- Output: Request ID, token expiration timestamp, and human review URL.
- Purpose: Finalizes conflict adjudication. Strictly requires a valid one-time token issued through the human review process.
- Restriction: Direct calls with fake tokens or string names are strictly rejected by the security boundary.
Relay enforces strict test-driven quality assurance across all layers.
# Backend Automated Test Suite (Pytest) pytest backend/tests # Frontend TypeScript Typecheck cd frontend && npx tsc --noEmit # Frontend Optimized Production Build cd frontend && npm run build
============================= test session starts =============================
platform win32 -- Python 3.14.7, pytest-8.4.2, pluggy-1.7.0
rootdir: C:\Users\Aman\Desktop\Relay\backend
configfile: pytest.ini
collected 231 items / 2 deselected / 229 selected
backend\tests\test_api.py ................................... [ 100% ]
backend\tests\test_conflict_detection.py .................... [ 100% ]
backend\tests\test_continuity_intelligence.py .............. [ 100% ]
backend\tests\test_documents.py ............................ [ 100% ]
backend\tests\test_extraction_pipeline.py .................. [ 100% ]
backend\tests\test_extraction_runs.py ...................... [ 100% ]
backend\tests\test_extraction_schemas.py ................... [ 100% ]
backend\tests\test_grounding.py ............................ [ 100% ]
backend\tests\test_handovers.py ............................ [ 100% ]
backend\tests\test_knowledge_models.py ..................... [ 100% ]
backend\tests\test_llm_provider.py ......................... [ 100% ]
backend\tests\test_persistence.py .......................... [ 100% ]
backend\tests\test_qa_grounding.py ......................... [ 100% ]
backend\tests\test_relay_mcp.py ............................ [ 100% ]
backend\tests\test_segmentation.py ......................... [ 100% ]
backend\tests\test_two_phase_approval.py ................... [ 100% ]
================ 229 passed, 2 deselected, 1 warning in 17.62s ================
- Backend Test Suite: 229 passed, 0 failed in 17.62s.
- Frontend TypeScript: 0 errors.
- Next.js Production Build: 17/17 routes successfully prerendered as static content.
Deposit institutional records, review extracted facts, and inspect character-exact citations.
| Document Archive Index | Extracted Evidence & Citations |
|---|---|
![]() |
![]() |
Cross-examine contradictory dates, historical superseded decisions, and unassigned infrastructure assets.
| Direct Contradiction Comparison | Unassigned Ownership Gap |
|---|---|
![]() |
![]() |
AI agents request resolution; human reviewers authenticate with Mattermost to ratify decisions.
| Human Review Screen | Mattermost Reviewer Login |
|---|---|
![]() |
![]() |
Synthesize 9-chapter briefing books and phased roadmaps for incoming leaders.
| 9-Chapter Navigation (Projects) | 30-Day Operational Roadmap |
|---|---|
![]() |
![]() |
Query institutional knowledge with strict evidence citations; unsupported queries trigger honest refusals.
| Evidence-Backed Answer (81%) | Insufficient Evidence Refusal |
|---|---|
![]() |
![]() |
- Anti-Impersonation Boundary: AI agents cannot pass
authorized_byor resolve conflicts directly. The system enforces cryptographic separation between agent inquiry and human adjudication. - Single-Use Approval Tokens: Approval tokens (
ConflictApprovalToken) are 32-byte cryptographically random hex strings with 24-hour expiration. Once consumed or rejected, they cannot be replayed. - Zero Token & Password Leakage: Passwords and session tokens are validated server-to-server and never returned in API response bodies, logged to disk, or exposed in URLs.
- Brute-Force Protection: Sliding-window rate limiting locks out IPs or usernames after 5 failed login attempts for 300 seconds (
HTTP 429 Too Many Requests). - Immutable Provenance: Every conflict modification writes to
conflict_resolution_auditswith approver identity, auth type, resolution notes, and token hash.
- SQLite Storage Concurrency: The current implementation utilizes SQLite with Write-Ahead Logging (WAL). While highly performant for hundreds of documents and single-organization transitions, enterprise multi-tenant deployments require PostgreSQL.
- Synchronous LLM Extraction: Extracting 50+ page PDF documents synchronously may encounter HTTP timeout limits. Asynchronous Celery/Redis background task queues are planned.
- Local Mattermost Instance: The current authentication service targets a local containerized Mattermost instance (
:52067). Production deployments should configure OAuth 2.0 PKCE flow.
- pgvector Vector Concordance: Hybrid dense-sparse retrieval combining BM25 keyword matching with vector embeddings.
- Real-Time WebSocket Conflict Feeds: Pushing immediate contradiction alerts into Mattermost and Switch channels when new documents are deposited.
- Automated Audio Meeting Grounding: Ingesting recorded transition handover meetings and transcribing spoken commitments into verifiable citations.
- Fork the repository.
- Create an isolated feature branch (
git checkout -b feature/governance-enhancement). - Ensure all tests pass (
pytest backend/testsandnpm run build). - Submit a descriptive Pull Request referencing the verified acceptance criteria.
This project is currently distributed as an open-source evaluation and hackathon submission. Standard open-source licensing (MIT License) will be formalized upon public release. All rights reserved by the original contributors.
Modern organizations suffer not from a lack of information, but from a lack of verifiable truth. When leaders transition, institutional knowledge dissolves into fragmented inboxes, unlinked cloud drives, and undocumented assumptions.
Relay changes this paradigm. By enforcing cryptographic citation grounding, continuously cross-examining documents for contradictions, protecting truth behind authenticated human approval, and automatically compiling evidence-backed handover dossiers, Relay ensures that organizations remember what they know.
Built for hackathons, engineered for institutional truth.












