feature/pi-refactor

Daneel - XMPP Research Bot

An AI-powered research assistant accessible via XMPP, built with the Pi AI toolkit.

Features

  • Multi-model support: Gemini, Claude, GPT, and more (20+ providers via Pi)
  • Autonomous tool use: The agent decides when to use tools
  • Web search: Search the web via SearXNG or DuckDuckGo
  • Research: Comprehensive topic research with source synthesis
  • System status: Check bot health and resource usage
  • Model switching: Use prefixes like g:, opus:, gpt: to switch models
  • Slash commands: /clear, /status, /help, /stats, /model

Quick Start

# Set required environment variables
export DANEEL_XMPP_JID="bot@xmpp.example.com"
export DANEEL_XMPP_PASSWORD="..."
export DANEEL_OWNER_JID="you@xmpp.example.com"
export GEMINI_API_KEY="..."  # or ANTHROPIC_API_KEY or OPENAI_API_KEY

# Optional
export SEARXNG_URL="https://search.example.com"  # For web search
export DANEEL_DEBUG="true"

# Run
npm install
npm run build
npm start

NixOS Module

# In your NixOS configuration
{
  imports = [ ./path/to/daneel/nix/module.nix ];

  services.daneel = {
    enable = true;
    xmppJid = "bot@xmpp.example.com";
    xmppPasswordFile = config.age.secrets.xmpp-bot-password.path;
    ownerJid = "you@xmpp.example.com";
    geminiApiKeyFile = config.age.secrets.gemini-api-key.path;
    searxngUrl = "https://search.example.com";
    debug = true;
  };
}

Architecture

src/
├── main-pi.ts              # Entry point
├── xmpp/
│   ├── client.ts           # XMPP client (connection, auth, messaging)
│   └── types.ts            # XMPP message types
└── pi/
    ├── agent-wrapper.ts     # Pi Agent ↔ XMPP bridge
    ├── config.ts            # Model configuration and prefix mapping
    └── tools/
        ├── status.ts        # System status (uptime, memory, load)
        ├── websearch.ts     # Web search (SearXNG → ddgr → DuckDuckGo API)
        ├── research.ts      # Research synthesis (search + LLM)
        └── logging.ts       # Tool execution logging wrapper

Tools

Tool Description
status System uptime, memory usage, CPU load
web_search Search the web (SearXNG preferred, ddgr fallback)
research Research a topic: web search + LLM synthesis

Model Prefixes

Prefix Model
g: Gemini 2.0 Flash
gp: Gemini 2.5 Pro
sonnet: Claude Sonnet 4
opus: Claude Opus 4
gpt: GPT-4o

Example: g: What is TypeScript? uses Gemini Flash.

Development

npm test          # Run tests
npm run build     # Build TypeScript
npm start         # Start the bot

License

Apache-2.0