Skip to content

Conversation

@BowTiedSwan
Copy link

@BowTiedSwan BowTiedSwan commented Jan 29, 2026

Summary

Integrates BitChat with the Morpheus decentralized AI network, enabling offline AI access through the Bluetooth mesh network.

Related: #1003

Motivation

In regions with restricted internet or during communication blackouts—such as those experienced in Iran, Myanmar, or disaster scenarios—people lose access not just to communication but to critical knowledge. This integration enables:

  • 🌐 Offline AI access: Users without internet can query AI through mesh bridges
  • 🏥 Life-saving information: Access to medical guidance, emergency protocols, and critical knowledge when traditional channels are blocked
  • 🛡️ Censorship resistance: Decentralized AI inference that can't be easily blocked or monitored
  • 🔒 Privacy-preserving: Both public queries and end-to-end encrypted private AI conversations

How It Works

  1. A bridge device with internet connectivity runs the MorpheusAI bot
  2. Users on the mesh (even completely offline) can query the AI through:
    • Public chat: `@MorpheusAI What is Bitcoin?`
    • Encrypted DMs: `/msg @BridgeNick !ai `
  3. Responses route back through the Bluetooth mesh network

Changes

New Files

  • `bitchat/Services/MorpheusAIService.swift` - API client for Morpheus AI Gateway
  • `bitchat/Services/MorpheusVirtualBot.swift` - Virtual bot handling @mentions and !ai DMs
  • `docs/MORPHEUS_AI_FAQ.md` - Comprehensive documentation

Modified Files

  • `bitchat/Services/CommandProcessor.swift` - New `/ai-*` commands
  • `bitchat/ViewModels/ChatViewModel.swift` - Bot integration and private message handling
  • `README.md` - Feature documentation

Usage

For users (no setup required):

Method Command Privacy
Public AI `@MorpheusAI What is Bitcoin?` Visible to all in mesh
Private AI `/msg @BridgeNick !ai What is Bitcoin?` End-to-end encrypted

For bridge operators:
```bash
/ai-key YOUR_API_KEY # Get key at https://app.mor.org
/ai-bridge on # Activate bot
```

Features

  • Backward compatible - Works with unmodified BitChat clients
  • Public and private AI - Choose between visible queries or encrypted conversations
  • Per-user context - Bot maintains conversation history per user
  • Multiple LLM models - Configurable via `/ai-model`
  • Global access - No country restrictions

Testing

  • Public @mention queries working
  • Private !ai DM queries working with encrypted responses
  • Conversation context maintained per user
  • Multiple concurrent users supported
  • Model selection working

🤖 Generated with Claude Code

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 90143cdb65

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

…a mesh network and usage instructions for public and private queries.
@BowTiedSwan BowTiedSwan changed the title Add Morpheus AI Integration Feature: MorpheusAI Integration - Decentralized AI Access for Communication-Denied Regions Jan 29, 2026
let geohash = getCurrentGeohash?() ?? ""

// Only check location restriction if we have a geohash
if !geohash.isEmpty && !MorpheusAIService.shared.isLocationAllowed(geohash: geohash) {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is intentional. Country restrictions have been removed from this implementation - the isLocationAllowed() method now always returns true.

The rationale: one of the primary use cases for this feature is providing AI access to users in communication-denied regions (Iran, Myanmar, disaster scenarios, etc.). Geographic restrictions would undermine this humanitarian purpose.

The geohash check remains in the code structure for potential future use (e.g., if specific deployments want to add restrictions), but by default all locations are allowed.

Addresses review feedback: conversation history was keyed by nickname,
which could cause context leakage if two peers share the same nickname.
Now keyed by PeerID to ensure proper isolation between users.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@BowTiedSwan
Copy link
Author

Addressed the PeerID feedback in commit 80c5088: Conversation context is now keyed by PeerID instead of nickname to prevent cross-user collisions and context leakage when peers share the same nickname.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant