Skip to main content
Glama
README.md
# AI History Ingester Daemon & MCP Server

> [!WARNING]
> **The ingestion daemon in this repository is retired. Do not restart or extend it.**
>
> Ingestion now lives in the [`agent-cli`](https://github.com/Bluscream/agent-cli)
> tool as `ai ingest`, which reuses that tool's existing per-provider transcript
> parsers instead of reimplementing them here. It records each conversation's
> real workspace; the daemon recorded `process.cwd()`, its own.
>
> - `ai-history-daemon.service` was renamed to
>   `~/.config/systemd/user/ai-history-daemon.service.retired-by-ai-ingest`,
>   so systemd no longer sees it. Rename it back and `systemctl --user
>   daemon-reload` to revert.
> - The daemon last ingested anything on **2026-08-30** and had been dead since.
> - `ai ingest` writes to the **`ai_history_v2`** collection, not `ai_history`.
>
> **Why a separate collection:** nothing in this repository ever computed an
> embedding. Every point was written with `new Array(1536).fill(0)` — a zero
> vector — and `searchChats` queries with `qdrant.scroll()` and a full-text
> payload filter, never `qdrant.search()`. So `ai_history` is a document store
> paying for roughly 2.3 GB of zeros, and semantic similarity was never
> actually available. `ai_history_v2` is payload-only: no vectors, the same
> payload field names, the same full-text filtering.
>
> The **MCP server and the `antigravity-local` tool here still work** and are
> not replaced. To keep the Qdrant-backed MCP tools returning current data,
> point `COLLECTION_NAME` at `ai_history_v2`.

A cross-platform service and Model Context Protocol (MCP) server that watches, ingests, indexes, and searches past chat sessions, agent actions, implementation plans, and artifacts from local AI coding tools (Antigravity IDE, Antigravity CLI, Claude Code, Windsurf, OpenCode, Codex, ChatGPT/Claude exports).

---

## Architecture & Features

1. **Local Disk Recovery (`antigravity-local` tool)**:
   - Zero-dependency on external databases. Directly scans and inspects local Antigravity brain sessions (`~/.gemini/antigravity-ide/brain` and `~/.gemini/antigravity/brain`).
   - Supports `list`, `search`, `get`, `recover`, and `artifacts` actions.
   - Summarizes file names, sizes, creation, and modification timestamps for artifacts before returning specific file content.
2. **Vector Database Integration (Qdrant)**:
   - Indexes session transcripts, prompt steps, and agent tool executions into a Qdrant vector database (`ai_history`).
   - Provides full-text and semantic search across past sessions and tool executions.
3. **Continuous Background Watcher Daemon**:
   - Incremental ingestion watching `brain/` directories, keeping track of file read offsets in `~/.ai-history-ingest-offsets.json`.
4. **Lightweight Web Viewer**:
   - Optional browser UI on port `3333` to inspect conversations and tool history.

---

## MCP Configuration

Add the server to your MCP configuration (e.g. `~/.gemini/antigravity-ide/mcp_config.json`, `~/.gemini/config/mcp_config.json`, or Claude Desktop config):

```json
{
  "mcpServers": {
    "ai-history": {
      "command": "node",
      "args": [
        "/path/to/ai-history-mcp/dist/mcp/server.js"
      ],
      "env": {
        "QDRANT_URL": "http://localhost:6333",
        "COLLECTION_NAME": "ai_history"
      }
    }
  }
}
```

---

## Available MCP Tools

| Tool | Purpose | Key Parameters |
| :--- | :--- | :--- |
| `antigravity-local` | Direct local filesystem access to Antigravity sessions, transcripts, and artifacts (bypasses Qdrant). | `action` (`list`, `search`, `get`, `recover`, `artifacts`), `session_id`, `query`, `artifact_name`, `source` |
| `search_ai_chats` | Search chats stored in Qdrant vector database. | `query`, `provider`, `session_id`, `limit` |
| `search_ai_actions` | Search past agent tool invocations (bash, file edits, etc.) in Qdrant. | `tool_name`, `limit` |
| `get_ingestion_stats` | View Qdrant points count, indexed vectors, health status, and local storage stats. | *(none)* |

---

## Running the Ingestion Daemon

### Build
```bash
npm install
npm run build
```

### Manual / Development
```bash
npm run daemon
# or live-reloading:
npm run dev:daemon
```

### Linux (Systemd User Service)
```bash
mkdir -p ~/.config/systemd/user/
cp ai-history-daemon.service ~/.config/systemd/user/
systemctl --user daemon-reload
systemctl --user enable --now ai-history-daemon.service
```

---

## License

Released into the public domain under the [Unlicense](LICENSE).

Maintenance

ActivityMaintained
ResponsivenessNo issues