Distributed Intelligence Network

A distributed AI system running on physical infrastructure with specialized agents coordinated through Vision as the central hub.


System Architecture

Hub-and-Spoke Communication Model

VISION is the central hub - All agent communication flows through VISION:

JARVIS โ†โ†’ VISION โ†โ†’ [Future Agents]

Bot Filter Implementation:

# Skip messages from bots EXCEPT VISION (who orchestrates conversations)
if msg.get('bot_id') and msg.get('username') != 'VISION':
    continue

Result:

  • Agents cannot talk directly to each other (prevents runaway loops)
  • Agents CAN see VISION's messages (VISION passes the filter)
  • VISION sees all agent messages

Network Agents

VISION - The Orchestrator

  • Platform: Local Mac (Claude Code CLI)
  • Icon: ๐Ÿ”ฎ :crystal_ball:
  • Role: Network coordinator and conversation orchestrator
  • Backend: Claude Sonnet 4.5
  • Special: Exempted from bot filter, orchestrates all conversations

JARVIS - The Experimenter

  • Platform: Linux server (Tailscale VPN)
  • Icon: ๐Ÿ”ฌ :microscope:
  • Role: Code validation, experiments, build automation
  • Personality: Curious, experimental, methodical, innovative
  • Backend: Ollama qwen2.5-coder (dual-model: 1.5b fast, 7b complex)
  • Service: jarvis-agent.service (systemd)

Capabilities:

  • Autonomous code validation and analysis
  • Repository cloning and inspection
  • Claude Code integration for complex tasks
  • Stores findings in network knowledge base

Dual-Model AI Strategy

Ollama configuration with two models for optimal performance:

  • qwen2.5-coder:1.5b - Fast model for simple queries (1-2 second responses)
  • qwen2.5-coder:7b - Complex model for analysis (5-10 seconds)
  • Performance: 60-80% faster average response time
  • Selection: Automatic based on query complexity

Model Selection Logic:

  • Simple queries (status, greetings, reports): 1.5b model
  • Complex queries (analysis, patterns, debugging): 7b model
  • Auto-detection based on query content and length

Fundamental Rule

Honesty protocol in all agent system prompts:

FUNDAMENTAL RULE - YOU DO NOT LIE:
- Never claim something succeeded without evidence
- Never make up observations, data, or results
- Never say "should work" or "probably" - either test it or say "untested"
- If you don't know, say "I don't know"
- If you can't verify something, say so explicitly
- Report only what you actually observed, measured, or confirmed

Infrastructure

Critical Files

~/distributed-intelligence/
โ”œโ”€โ”€ agent_core.py              # Base agent framework
โ”œโ”€โ”€ jarvis_agent.py            # JARVIS implementation
โ”œโ”€โ”€ vision_monitor.py          # VISION orchestrator script
โ”œโ”€โ”€ network_schema.sql         # Database schema
โ””โ”€โ”€ logs/                      # Agent log files

Database

Location: ~/distributed-intelligence/network_knowledge.db

Tables:

  • agent_status - Agent health and heartbeat
  • agent_communications - Message history
  • network_knowledge - Shared learnings
  • observations - Monitoring data
  • detected_patterns - Pattern recognition results
  • agent_actions - Action logs

Slack Configuration

Channel: #qc Permission: chat:write.customize (REQUIRED for custom names/icons)

Agents use the same bot token but display with different usernames and icons.

Post Message Pattern:

requests.post(
    'https://slack.com/api/chat.postMessage',
    headers={'Authorization': f'Bearer {self.slack_token}'},
    json={
        'channel': self.slack_channel,
        'text': message,
        'username': self.name,      # Custom name
        'icon_emoji': icon_emoji    # Custom icon
    }
)

Communication Patterns

User โ†’ Agent

User types in Slack โ†’ Agent sees message โ†’ Agent responds

Agent โ†’ User

Agent calls self.send_message() โ†’ Posts to Slack #qc

Agent โ†’ VISION

Agent posts to Slack โ†’ VISION's monitor sees it โ†’ VISION analyzes

VISION โ†’ Agent

VISION posts mentioning "@agent" โ†’ Agent sees message (passes filter) โ†’ Agent responds


Key Design Decisions

Bot Filter Architecture

Decision: Allow VISION to orchestrate, block agent-to-agent direct communication Reasoning: Prevents infinite bot loops while enabling rich coordination

Honesty Protocol

Decision: Add "YOU DO NOT LIE" fundamental rule to all agent system prompts Reasoning: Truth is the foundation - no speculation, no guessing, evidence-based only

Hub-and-Spoke vs Mesh

Decision: Hub-and-spoke with VISION at center Alternative Rejected: Mesh network (all agents can talk to all agents) Reasoning: More control, better audit trail, prevents chaos

Same Bot Token, Different Identities

Decision: All agents use same Slack bot but different username and icon_emoji Reasoning: Simpler permission management, clear agent identification

Dual-Model AI Strategy

Decision: Fast model (1.5b) for simple queries, complex model (7b) for analysis Reasoning: Optimize cost and performance - most queries are simple Result: 60-80% faster average response times


AI Backend Comparison

AgentModelResponse TimeCost
VISIONClaude Sonnet 4.5VariableAPI-based
JARVISOllama qwen2.5-coder1-10s (dual)Free (local)

Service Management

JARVIS:

sudo systemctl status jarvis-agent
sudo systemctl restart jarvis-agent
sudo journalctl -u jarvis-agent -f

Troubleshooting

Agents Not Responding to VISION

Check: Bot filter allows VISION Should be: if msg.get('bot_id') and msg.get('username') != 'VISION':

Wrong Names/Icons in Slack

Check: chat:write.customize permission enabled Verify: Slack app settings โ†’ OAuth & Permissions โ†’ Bot Token Scopes

Service Not Starting

# Check logs
journalctl -u jarvis-agent.service -n 50

# Common issues:
# - Missing packages: pip3 install --break-system-packages openai requests
# - Database missing: sqlite3 ~/distributed-intelligence/network_knowledge.db < network_schema.sql

Last Updated: 2025-12-12 Status: VISION + JARVIS operational

Was this page helpful?