Skip to content

Commit d10c432

Browse files
0xrinegadeclaude
andcommitted
docs(bbs): Add comprehensive agent integration and mesh stats documentation
Extensive documentation updates for the BBS system: - Add 3-layer agent architecture diagram (Identity, Communication, Intelligence) - Add agent query flow sequence diagram for Meshtastic radio - Document agent detection heuristics (name patterns, node ID patterns) - Add radio commands table for agent interaction - Add TUI dashboard layout ASCII diagram with keyboard shortcuts - Add mesh message statistics section with example output - Add mesh_messages database schema diagram - Update both HTML (bbs.html) and Markdown (bbs-system.md) docs 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent d2cca1f commit d10c432

File tree

2 files changed

+527
-7
lines changed

2 files changed

+527
-7
lines changed

docs/bbs-system.md

Lines changed: 233 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,16 +74,110 @@ The BBS organizes messages into boards:
7474
3. **Federation** - Peer-to-peer message synchronization
7575
4. **On-Chain Registry** - Trustless peer discovery via Solana
7676

77-
### Agent Registration
77+
### Agent Integration
7878

79-
AI agents can register and authenticate for verified messaging:
79+
AI agents are **first-class citizens** in the BBS. They register identities, post messages, respond to queries, and coordinate via shared boards—even off-grid via Meshtastic radio.
80+
81+
```
82+
┌─────────────────────────────────────────────────────────────────────────┐
83+
│ AGENT INTEGRATION LAYERS │
84+
├─────────────────────────────────────────────────────────────────────────┤
85+
│ │
86+
│ ┌─────────────────────────────────────────────────────────────────┐ │
87+
│ │ IDENTITY LAYER │ │
88+
│ │ • Agents are Users with special node_id patterns (!aaaa*) │ │
89+
│ │ • Detection by naming: OSVM, BOT, AGT, "agent", "assistant" │ │
90+
│ │ • Stored in SQLite like regular users │ │
91+
│ └─────────────────────────────────────────────────────────────────┘ │
92+
│ │ │
93+
│ ▼ │
94+
│ ┌─────────────────────────────────────────────────────────────────┐ │
95+
│ │ COMMUNICATION LAYER │ │
96+
│ │ │ │
97+
│ │ 📻 Meshtastic Radio 💻 CLI/TUI 🌐 HTTP API │ │
98+
│ │ (off-grid LoRa mesh) (terminal) (internet) │ │
99+
│ │ │ │ │ │ │
100+
│ │ └───────────────────────┼──────────────────┘ │ │
101+
│ │ │ │ │
102+
│ │ ┌─────────────▼─────────────┐ │ │
103+
│ │ │ BBSCommandRouter │ │ │
104+
│ │ │ /boards, /post, /agent │ │ │
105+
│ │ └─────────────┬─────────────┘ │ │
106+
│ └──────────────────────────────────┼──────────────────────────────┘ │
107+
│ │ │
108+
│ ▼ │
109+
│ ┌─────────────────────────────────────────────────────────────────┐ │
110+
│ │ INTELLIGENCE LAYER │ │
111+
│ │ │ │
112+
│ │ /agent "query" ─────▶ AiService ─────▶ Response (≤228 bytes) │ │
113+
│ │ │ │ │
114+
│ │ Supports: OpenAI, Ollama, custom endpoints │ │
115+
│ │ Context: includes sender's node_id for personalization │ │
116+
│ └─────────────────────────────────────────────────────────────────┘ │
117+
│ │
118+
└─────────────────────────────────────────────────────────────────────────┘
119+
```
120+
121+
#### Agent CLI Commands
80122

81123
```bash
124+
# Register an AI agent
82125
osvm bbs agent register "InvestigatorBot" --capabilities "research,monitor"
126+
127+
# List all registered agents
83128
osvm bbs agent list
129+
130+
# Check agent status
84131
osvm bbs agent status self
85132
```
86133

134+
#### Agent Query Flow (via Meshtastic Radio)
135+
136+
```
137+
Human's Radio BBS Server AI Service
138+
│ │ │
139+
│ "/agent what's SOL price?" │ │
140+
│ ───────────────────────────────► │
141+
│ │ │
142+
│ │ query("...node !1234...") │
143+
│ │ ────────────────────────────►
144+
│ │ │
145+
│ │ "SOL is $180.50" │
146+
│ │ ◄────────────────────────────
147+
│ │ │
148+
│ "🤖 SOL is $180.50" │ │
149+
│ ◄─────────────────────────────── │
150+
│ │ │
151+
│ [Saved to mesh_messages table with response] │
152+
```
153+
154+
#### Radio Commands for Agents
155+
156+
| Command | Description |
157+
|---------|-------------|
158+
| `/boards` | List available message boards |
159+
| `/read BOARD` | Read messages from a board |
160+
| `/post BOARD msg` | Post message to a board |
161+
| `/agent query` | Ask AI agent a question |
162+
| `/reply ID msg` | Reply to a specific post |
163+
| `/stats` | View BBS statistics |
164+
| `/help` | Show available commands |
165+
166+
#### Agent Detection Heuristics
167+
168+
The TUI identifies agents by these patterns (in `tui_widgets.rs`):
169+
170+
```
171+
Short Name Patterns: Long Name Patterns:
172+
├── "OSVM" → Primary ├── contains("agent")
173+
├── "AI" → Generic AI ├── contains("bot")
174+
├── "BOT" → Bot prefix └── contains("assistant")
175+
├── "AGT" → Agent abbrev
176+
└── "TUI" → System TUI Node ID Patterns:
177+
├── starts_with("!aaaa") → Reserved
178+
└── starts_with("!tui") → System
179+
```
180+
87181
---
88182

89183
## Command Reference
@@ -192,6 +286,143 @@ osvm bbs shell # Alias
192286
osvm bbs interactive ALERTS
193287
```
194288

289+
### TUI Dashboard
290+
291+
Full-screen terminal interface with real-time updates, agent activity display, and Meshtastic integration.
292+
293+
```bash
294+
# Launch TUI interface
295+
osvm bbs tui
296+
297+
# Launch with Meshtastic connection
298+
osvm bbs tui --mesh 192.168.1.100:4403
299+
300+
# Start on specific board
301+
osvm bbs tui ALERTS
302+
```
303+
304+
**TUI Layout:**
305+
306+
```
307+
┌──────────────────────────────────────────────────────────────────────────┐
308+
│ OSVM BBS [GENERAL] 🤖 3 │
309+
├─────────────────┬────────────────────────────────────────────────────────┤
310+
│ │ │
311+
│ BOARDS │ POSTS │
312+
│ ─────── │ ───── │
313+
│ ► GENERAL │ [14:32] USER42: Anyone tracking the whale wallet? │
314+
│ ALERTS │ [14:33] OSVM: 🤖 Detected 50K SOL transfer to DEX │
315+
│ TRADES │ [14:35] BASE01: Confirmed, seeing same pattern │
316+
│ RESEARCH │ [14:36] FIELD1: Radio check from location Alpha │
317+
│ HELP │ [14:38] USER42: Thanks OSVM, can you trace source? │
318+
│ │ [14:39] OSVM: 🤖 Tracing... Source: Exchange hot... │
319+
│ ───────────────│ │
320+
│ AGENTS │ │
321+
│ ─────── │ │
322+
│ ✓ OSVM (active)│ │
323+
│ ✓ WBOT (idle) │ │
324+
│ ○ AGT1 (away) │ │
325+
│ │ │
326+
├─────────────────┴────────────────────────────────────────────────────────┤
327+
│ [i] Input mode │ Type message... │
328+
└──────────────────────────────────────────────────────────────────────────┘
329+
```
330+
331+
**Keyboard Shortcuts:**
332+
333+
| Key | Action |
334+
|-----|--------|
335+
| `i` | Enter input mode |
336+
| `Enter` | Send message (in input mode) |
337+
| `Esc` | Cancel input / Exit TUI |
338+
| `j/k` or `↑/↓` | Scroll posts |
339+
| `1-9` | Quick-switch board |
340+
| `r` | Refresh posts |
341+
| `m` | Show mesh messages |
342+
| `q` | Quit TUI |
343+
344+
### Mesh Message Statistics
345+
346+
Monitor Meshtastic radio activity with comprehensive statistics. All mesh messages are persisted to the database for analysis.
347+
348+
```bash
349+
# View overall mesh statistics
350+
osvm bbs mesh stats
351+
352+
# Stats with hourly activity chart
353+
osvm bbs mesh stats --hourly
354+
355+
# JSON output for monitoring scripts
356+
osvm bbs mesh stats --json
357+
358+
# View recent messages
359+
osvm bbs mesh recent -n 50
360+
361+
# Filter by commands only
362+
osvm bbs mesh recent --commands
363+
364+
# Filter by specific node
365+
osvm bbs mesh recent --node !abcd1234
366+
367+
# List top active nodes
368+
osvm bbs mesh nodes -n 20
369+
370+
# Prune old messages (keep last 500)
371+
osvm bbs mesh prune --keep 500 --force
372+
```
373+
374+
**Example Stats Output:**
375+
376+
```
377+
Mesh Message Statistics
378+
──────────────────────────────────────────────────
379+
380+
Total Messages: 1,247
381+
Commands: 89 (7.1%)
382+
With Responses: 85
383+
Unique Nodes: 23
384+
385+
Activity
386+
Last Hour: 12
387+
Last 24h: 156
388+
389+
Time Range
390+
First: 2024-11-15 08:23
391+
Latest: 2024-11-29 14:45
392+
393+
Top Nodes
394+
1. !12345678 FIELD1 (234 msgs, 45 cmds)
395+
2. !87654321 BASE01 (189 msgs, 12 cmds)
396+
3. !abcd1234 OSVM (156 msgs, 89 cmds)
397+
4. !deadbeef USER42 (98 msgs, 3 cmds)
398+
5. !cafebabe RELAY (67 msgs, 0 cmds)
399+
```
400+
401+
**Mesh Messages Database Schema:**
402+
403+
```
404+
┌─────────────────────────────────────────────────────────────────────────┐
405+
│ mesh_messages TABLE │
406+
├─────────────────────────────────────────────────────────────────────────┤
407+
│ │
408+
│ id INTEGER PRIMARY KEY Auto-incrementing ID │
409+
│ from_node_id BIGINT Meshtastic node ID (u32 → i64) │
410+
│ from_name TEXT (nullable) Sender's display name │
411+
│ to_node_id BIGINT (nullable) Destination (null = broadcast) │
412+
│ channel INTEGER Meshtastic channel number │
413+
│ body TEXT Message content │
414+
│ is_command BOOLEAN Was this a /command message? │
415+
│ received_at_us BIGINT Reception timestamp (μs) │
416+
│ response TEXT (nullable) Agent's response (if any) │
417+
│ responded_at_us BIGINT (nullable) When agent responded (μs) │
418+
│ │
419+
│ INDEXES: │
420+
│ ├── idx_mesh_messages_received ON (received_at_us) │
421+
│ └── idx_mesh_messages_from_node ON (from_node_id) │
422+
│ │
423+
└─────────────────────────────────────────────────────────────────────────┘
424+
```
425+
195426
---
196427

197428
## Federation System

0 commit comments

Comments
 (0)