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

# Context Hub

> Central coordination daemon for memory, events, and context

The Context Hub is a local HTTP daemon that coordinates all TENET subsystems. It runs on your machine, manages the memory database, serves context to agents, and coordinates events.

## Starting the Hub

```bash theme={null}
# Start (or ensure running)
tenet context-hub ensure

# Check health
curl http://localhost:4360/health
# {"status":"ok","port":4360}
```

The hub starts automatically when you run any TENET command. It persists across sessions.

## What It Does

| Feature              | Description                                                              |
| -------------------- | ------------------------------------------------------------------------ |
| **Memory DB**        | SQLite database with indexed memories, embeddings, graph edges           |
| **Periodic Indexer** | Indexes journal entries (60s), code headers (5min), backfills embeddings |
| **Event Bus**        | MAP events for agent coordination and flow triggers                      |
| **Context API**      | Serves project context to agents (journals, knowledge, code)             |
| **Session Tracking** | Manages active sessions and branches                                     |

## API Endpoints

| Endpoint             | Method   | Description                     |
| -------------------- | -------- | ------------------------------- |
| `/health`            | GET      | Health check                    |
| `/api/context`       | POST     | Query project context           |
| `/api/memory/search` | POST     | Search memories                 |
| `/api/memory/add`    | POST     | Add a memory                    |
| `/api/memory/status` | GET      | Memory system stats             |
| `/api/memory/index`  | POST     | Trigger reindex + backfill      |
| `/api/memory/link`   | POST     | Add graph edge between memories |
| `/api/events`        | GET/POST | Query or publish MAP events     |

## Configuration

The hub reads from `.tenet/config.json`:

```json theme={null}
{
  "contextHub": {
    "port": 4360
  }
}
```

Port and auth token are written to:

* `.tenet/context-hub.port`
* `.tenet/context-hub.token`

## Logs

```bash theme={null}
tail -f .tenet/logs/context-hub.log
```

## Doctor Check

```bash theme={null}
tenet doctor
```

Reports hub health, memory DB size, journal count, and agent registrations.
