Views
No views yet
model.py — Trident architecture (backbone + 3 heads + RAG gate)rag.py — Python chunk store + P2P RAG node (aiortc)rag_client.js — Browser P2P RAG client (WebRTC DataChannel)signal_server.py— Minimal WebSocket signaling (handshake only, ~50 lines)mcp_server.py — FastMCP server exposing all tools to Claude/any LLMtrain.py — Training loop (toy data → real data)1# Install
2pip install -r requirements.txt
3
4# Test model architecture
5python model.py
6
7# Train on toy data (CPU, ~1 min)
8python train.py
9
10# Run MCP server (connect to Claude Desktop)
11python mcp_server.py
12
13# Run signaling server for P2P
14python signal_server.pyDevice A (your phone)
└─ TRIDENT_P2P.query("fibonacci")
└─ WebRTC DataChannel → Device B (iPad)
└─ Device B searches local chunks
└─ Returns top-K matches
└─ Device A merges local + peer results
└─ Top-K embeddings → RAGFusionGate → model generates| Tool | What it does |
|---|---|
trident_generate | Generate text, pick head, optionally RAG |
trident_add_chunk | Add knowledge to RAG store |
trident_search_rag | Search chunks without generating |
trident_router | Predict which head fits a query |
trident_list_chunks | List all stored knowledge chunks |
Input → [Embedding + PositionalEncoding]
→ [Backbone: 4x TransformerBlock] ← shared
→ [HeadRouter] → softmax weights
→ ┌─────────────────────────────┐
│ RAGFusionGate (cross-attn) │ ← per head
│ 1x TransformerBlock │
│ LM Head → logits │
└─────────────────────────────┘ × 3 heads
→ weighted ensemble OR forced single head