> ## Documentation Index
> Fetch the complete documentation index at: https://docs.openbunny.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Service overview

> The core engine that processes messaging channels and manages tasks.

The service is OpenBunny's core component. It connects to messaging channels, processes conversations with an LLM agent, and manages tasks, contacts, and reminders through a REST API.

## What it does

* **Listens** to 5 messaging channels: Slack, WhatsApp, iMessage, Telegram, Gmail
* **Processes** conversations using a multi-turn LLM agent with tool use
* **Manages** tasks with priorities, labels, requesters, and reminders
* **Tracks** contacts across channels with identity linking
* **Searches** tasks using hybrid search (BM25 + semantic embeddings + LLM reranking)
* **Exposes** a REST API on port 3100 and an MCP server

## Tech stack

| Component | Technology          |
| --------- | ------------------- |
| Runtime   | Node.js 22+         |
| Framework | Hono                |
| Database  | SQLite 3 (WAL mode) |
| LLM       | OpenRouter API      |
| Search    | QMD (hybrid search) |
| Build     | esbuild + tsx       |

## How processing works

The service uses a **scheduler** that runs on a configurable interval (default: 60 seconds). Each tick:

1. Scans for conversations that have been quiet for the **debounce period** (default: 5 minutes)
2. Claims conversations atomically to prevent double-processing
3. Sends conversation context to the **LLM agent**
4. The agent uses tools to create tasks, update tasks, manage contacts, or ignore the conversation
5. Results are persisted to the configured backend

The agent can make up to 10 tool-use iterations per conversation before finalizing its decision.

## Project structure

```
service/
├── src/
│   ├── index.ts              # Startup orchestration
│   ├── cli.ts                # CLI for channel management
│   ├── agent/                # LLM agent loop and tools
│   ├── api/                  # Hono REST API + MCP server
│   ├── channels/             # Channel listeners
│   ├── contacts/             # Contact backend abstraction
│   ├── tasks/                # Task backend abstraction
│   ├── db/                   # SQLite + migrations
│   ├── llm/                  # OpenRouter client
│   ├── search/               # QMD search client
│   ├── scheduler/            # Conversation processing loop
│   ├── reminders/            # Decision + schedule engines
│   ├── prompts/              # Agent system prompts
│   ├── lib/                  # Logger, utilities
│   └── types/                # TypeScript interfaces
├── data/                     # SQLite DB, contacts, policies
└── scripts/                  # Setup and maintenance
```

## Startup sequence

When the service starts, it runs these steps in order:

1. Validate environment variables
2. Initialize SQLite database and run migrations
3. Initialize QMD search index
4. Start enabled channel listeners
5. Start SSE bridge for remote email notifications
6. Start the conversation processing scheduler
7. Start the reminder decision engine (if enabled)
8. Start the task-level schedule poller
9. Start the REST API server on port 3100
