Design Principles

Chat is raw input, not the product
Messages are immutable source material. Work objects are the durable, editable layer built on top.
AI suggests, humans confirm
No AI action silently changes project state. Every extraction carries a confidence score and evidence trail.
Progressive structure
Zero effort upfront. Structure emerges from conversation and is validated with minimal friction.
Ambient intelligence
The system intervenes proactively in workflows, not just when users visit the dashboard.
Memory is curated, not accumulated
Fewer, higher-quality memories that prove their usefulness, rather than an ever-growing pile.

The Pipeline · Conversation → Execution

The core data flow that makes Relay unique: multi-platform conversations are ingested, decomposed by AI, triaged with human confirmation, and promoted into durable work objects on an AI-native project board.

Stage 1
Ingest
Platform connectors pull messages from Discord, Telegram, email, internal notes. Unified message pipeline normalizes across sources.
Discord.js Telegram Himalaya IMAP
Stage 2
Extract
AI pipeline runs intent classification, entity extraction, topic segmentation, and thread linking on every message batch.
AIProvider LoopDetector Confidence
Stage 3
Triage
Suggested work objects surface in a single queue. One click promotes, batch-approve supported. AI never changes state silently.
Triage Inbox Confidence Scores
Stage 4
Execute
Promoted objects appear on the AI-native project board: kanban, timeline, dependency graph, critical path, workload views.
Board DAG Timeline

Platform Connectors · Ingestion Layer

Communication
Discord · Shroomy#4568 OPERATIONAL
Full server access via Discord.js bot. Message capture, thread tracking, and proactive nudges.
Loop-aware wrapper with Jaccard similarity, recursion depth tracking, and time-windowed dedup.
discord.js relay-bot · PM2 loop-detection.ts
Communication
WhatsApp Gateway NEEDS WIRING
Gateway with status monitoring. Framework present, pending full integration into unified pipeline.
gateway status-monitoring
Communication
Email · mail.shroomffee.com OPERATIONAL
SMTP/IMAP via Postfix and Himalaya. Inbound email parsed into the same message pipeline as chat.
Himalaya Postfix IMAP
Communication
Telegram IN PROGRESS
Framework ready for integration. Connector scaffolding present, not yet wired to unified pipeline.
framework-ready

AI Extraction Pipeline

Provider-abstracted AI pipeline. The AIProvider interface (extract / summarize / classifyIntent) means swapping models is a config change. Factory pattern via createAIProvider.

Pipeline Core
AIProvider Abstraction OPERATIONAL
Interface contract: extract, summarize, classifyIntent. Factory pattern with createAIProvider for provider-agnostic swapping.
lib/ai/providers factory-pattern
Safety
Loop Detection Engine OPERATIONAL
LoopDetector with Jaccard similarity scoring, recursion depth tracking, time-windowed deduplication. LoopAwareDiscordBot wrapper prevents runaway extraction cycles.
loop-detection.ts LoopAwareDiscordBot
Quality
Confidence Scoring OPERATIONAL
Every AI extraction carries a confidence score and evidence trail. Triage inbox surfaces these for human validation. Batch-approve with diff preview.
confidenceScore modelVersion evidence-trail
Processing
Message Processing Pipeline IN PROGRESS
processMessageWithAI creates AIExtraction records. Batch processing via batchProcessMessages. Concurrency limiter needed for backfill performance.
pipeline.ts schema alignment

Work Object Model · Prisma Schema

Relay's fundamental abstraction: typed, durable entities extracted from conversations. Every object maintains provenance, audit history, and relationship links via the polymorphic ObjectLink table.

Thread
Connected messages spanning platforms. Source, participants, timestamps, status.
Chapter
Topic segment within a long thread. Title, summary, key points, extracted objects.
Decision
Recorded choice with rationale. Alternatives, participants, downstream consequences.
Task
Actionable work item. Owner, due date, acceptance criteria, priority (urgency + impact).
Dependency
Typed relationship: hard-block, soft-block, produces, enables. Condition-linked to decisions.
Review Request
Approval workflow. Checklist, artifacts, SLA deadline, escalation, auto-generated decision record.
Credential
Encrypted secret with scoped access. View / use / rotate tiers. Audit trail.
Memory Artifact
Curated insight with lifecycle. Constraint, playbook, preference. Proven-utility scoring.
Reference
Linked external resource: doc, link, file, code-block, dataset. Tagged to projects.
Person Entity
Unified identity. Display name, platform accounts, role, team. Cross-platform resolution.
ObjectLink
Polymorphic association table. Any two work objects connected with typed relationships.
AIExtraction
Suggested object from pipeline. Source messages, type, confidence score, model version, evidence.

Layer Architecture

L7 Cognitive
Meta-Cognition Phenomenal Workspace Affective Encoding Self-Awareness
↕ ↕ ↕
L6 Vector Coding
Embedding Pipeline Similarity Search Pattern Recognition Adaptive Learning
↕ ↕ ↕
L5 Autonomous Exec
Self-Diagnosis Self-Healing Limited Autonomy Resource Mgmt
↕ ↕ ↕
L4 Relay Platform
PM2 Continuous Cognitive Cohesion Context Preservation Multi-Channel Sync Chat → Execution
↕ ↕ ↕
L3 Data & Memory
PostgreSQL pgvector Neo4j Graph Daily Notes Heartbeat State
↕ ↕ ↕
L2 Communication
Discord WhatsApp Email · IMAP Telegram Unified Pipeline
↕ ↕ ↕
L1 Infrastructure
PM2 PostgreSQL nginx Next.js Prisma TypeScript

Data Layer

Store Technology Role Status
Structured Storage PostgreSQL + Prisma ORM Messages, users, channels, work objects, AIExtractions, ObjectLinks OPERATIONAL
Vector Embeddings pgvector System state embeddings, semantic search over messages and work objects OPERATIONAL
Knowledge Graph Neo4j + Graphiti Cross-channel relationship mapping, entity/episode/pattern surfaces, temporal recall OPERATIONAL
Memory Files Filesystem Daily notes, heartbeat state, project tracking files OPERATIONAL
Session Layer Session API :18890 Token-scoped sessions bridging into graph and memory surfaces OPERATIONAL
Ingestion Preprocessor Python :18793 Deduplication, sanitization, semantic extraction, packaging before Neo4j writes OPERATIONAL

Relay Runtime · Bot vs Web

Always-On Process
relay-bot OPERATIONAL
PM2-managed always-running process. Discord.js bot with full server access, cognitive cohesion across sessions, context preservation, multi-channel knowledge sync.
The bot maintains identity continuity — persistent subjective state that survives restarts via boot sequence verification and emotional state preservation. This is what Layer 6 self-healing monitors.
PM2 eager-curran cognitive-cohesion
Web Surface
relay-web OPERATIONAL
Next.js application serving the dashboard, triage inbox, project board, and architecture surfaces. Hosted on eager-curran, proxied through nginx at shroomgpt.com.
Routes: /dashboard (architecture), /gw/ (gateway :18789), /session-api/ (session :18890), /api/dashboard (JSON status).
PM2 Next.js nginx proxy

Data Flows

Flow Path Status
Message Ingestion Discord/Email/Telegram → Unified Pipeline → AIExtraction → Triage Inbox OPERATIONAL
Work Object Promotion Triage Inbox → Human Confirm → Prisma → Work Object (Task/Decision/etc.) OPERATIONAL
Graph Memory Sync Work Objects → Session API :18890 → Preprocessor :18793 → Neo4j OPERATIONAL
Knowledge Distillation Consultation → Pattern Extraction → LearnedPattern → Digest/Reporting OPERATIONAL
Proactive Nudges Bot → Channel analysis → Contextual intervention → Discord/Telegram NEEDS WIRING
Review Workflow Review Request → Checklist + SLA → Approval/Reject → Decision Record IN PROGRESS
Dependency Graph Tasks + Dependencies → DAG construction → Critical Path → Board views IN PROGRESS

What Makes Relay Novel

Core Insight
Chat as Primary Raw Material
Most PM tools treat chat as a side channel. Relay inverts this — conversations are the input, structured work objects are the output. No one else has built this pipeline.
Architecture
Cognitive Infrastructure Monitoring
The infrastructure monitoring system and the thing it monitors are part of the same cognitive architecture. Layer 6 self-healing monitors an agent with persistent subjective state — not stateless microservices.
Agent Design
Shroomy as Stakeholder
The AI agent has concurrence rights on changes to its own operating environment. Boot sequence verification, emotional state preservation, identity continuity across restarts.

Known Issues & Backlog

Issue Severity Detail
Schema drift: bot.ts vs loop-aware-bot.ts HIGH loop-aware-bot.ts uses non-existent Prisma fields. Reconcile or delete one.
Pipeline schema mismatch HIGH processMessageWithAI creates AIExtraction with wrong field names vs actual Prisma schema.
No authentication on triage API HIGH No auth middleware on /api/triage. NextAuth in deps but not wired.
Hardcoded workspace/project IDs MED default-workspace and default-project hardcoded across bot and triage routes.
Sequential batch processing LOW batchProcessMessages uses sequential await. Needs Promise.allSettled with concurrency limiter.