How anhe2021212-spec/tidal_echo works
Companion Channel is a private, single-user messaging system connecting a phone PWA to an AI companion through a self-hosted relay. The main workflow is PWA message → relay persistence and SSE delivery → AI reply through the relay → PWA display or lock-screen push. The relay can route messages to either the Claude Code channel or the optional API-based model loop. README statements support the major unsampled PWA and API-loop capabilities; edges reflect documented or excerpted relationships rather than inferred imports.
Main entry points: app.py Message relay · server.ts Channel MCP plugin · api_loop.py Model and tool loop · index.html Chat PWA
Components 14
Phone PWA
- Chat PWA
web/index.html - Offline and push
web/sw.js
Relay Backend
- Message relay
backend/app.py - Message database
backend/app.py - Attachment storage
backend/app.py
Claude Channel
- Channel MCP plugin
channel/server.ts - Local attachment inbox
channel/server.ts
API Body
- Model and tool loop
examples/api_loop.py - Alternate LLM bridge
examples/bridge_any_llm.py
Other components
- Phone user
- Web Push service
- Claude Code session
- OpenAI-compatible model
- MCP servers
Connections 19
- Phone user → Chat PWA: sends messages
README.md - Chat PWA → Message relay: sends messages
README.md - Message relay → Message database: persists messages
README.md - Message relay → Channel MCP plugin: streams messages
README.md - Channel MCP plugin → Message relay: posts replies
channel/server.ts - Message relay → Chat PWA: streams replies
README.md - Message relay → Offline and push: sends push
web/sw.js - Offline and push → Phone user: shows notifications
web/sw.js - Chat PWA → Message relay: uploads attachments
README.md - Message relay → Attachment storage: stores attachments
README.md - Channel MCP plugin → Local attachment inbox: saves attachments
channel/server.ts - Channel MCP plugin → Claude Code session: delivers channel blocks
channel/server.ts - Claude Code session → Channel MCP plugin: invokes reply tools
README.md - Message relay → Model and tool loop: routes messages
README.md - Model and tool loop → OpenAI-compatible model: requests completions
README.md - Model and tool loop → MCP servers: calls tools
README.md - Model and tool loop → Message relay: posts replies
- Alternate LLM bridge → Message relay: bridges SSE
README.md - Message relay → Web Push service: sends notifications