# Bootstrapping Honcho with Existing Knowledge

When you self-host Honcho for the first time, the knowledge base is empty. This recipe injects everything you already know about a user (from `USER.md`, `MEMORY.md`, AGENTS.md, and session history) as a batch of initial facts.

## Steps

### 1. Create workspace and peer

```bash
BASE="http://localhost:8000/v3"
WS="hermes-user"

# Create workspace
curl -s -X POST "$BASE/workspaces" -H 'Content-Type: application/json' \
  -d "{\"name\": \"$WS\"}"

# Create peer (names must match ^[a-zA-Z0-9_-]+$, no spaces)
curl -s -X POST "$BASE/workspaces/$WS/peers" -H 'Content-Type: application/json' \
  -d '{"name": "ahmed-zeyd-aytac", "display_name": "Ahmed Zeyd Aytac"}'

# Create session
curl -s -X POST "$BASE/workspaces/$WS/sessions" -H 'Content-Type: application/json' \
  -d '{"name": "knowledge-bootstrap"}'
```

### 2. Build batch payload from known facts

```python
import json

facts = [
    "Ahmed Zeyd Aytac lives in Wien (Vienna), Austria.",
    "Ahmed prefers to be addressed as Boss or Chef.",
    # ... add all known facts, one per string
]

messages = [{"role": "user", "content": fact, "peer_id": PEER_ID} for fact in facts]
payload = {"messages": messages}

with open("/tmp/honcho_batch.json", "w") as f:
    json.dump(payload, f)
```

### 3. Inject batch via API

```bash
curl -s -X POST "$BASE/workspaces/$WS/sessions/$SESSION/messages" \
  -H 'Content-Type: application/json' \
  -d @/tmp/honcho_batch.json
```

Honcho supports up to 100 messages per batch. Each message is enqueued for background processing by the Deriver.

### 4. Wait for Deriver to process

The Deriver runs asynchronously. Check its progress:

```bash
journalctl -u honcho-deriver.service --no-pager -l --since "5 minutes ago"
```

Look for log lines about summary creation, representation tasks, and observation extraction.

### 5. Verify conclusions were extracted

```bash
curl -s -X POST "$BASE/workspaces/$WS/conclusions/list" \
  -H 'Content-Type: application/json' \
  -d '{"observer_id": "ahmed-zeyd-aytac", "observed_id": "ahmed-zeyd-aytac", "limit": 10}'
```

The Deriver extracts explicit conclusions (direct facts) and deductive conclusions (inferences) from the injected messages. This may take several minutes depending on batch size.

## Pitfalls

- Peer names cannot contain spaces — use hyphens, then set `display_name` for the human-readable version.
- The global `LLM_BASE_URL` env var in Honcho's `.env` may not propagate to all submodules. Set per-module `*_MODEL_CONFIG__OVERRIDES__BASE_URL` explicitly.
- Embeddings default to `text-embedding-3-small` via OpenAI transport. If your proxy doesn't support embeddings (e.g., many Ollama setups), the Deriver will fail silently. Check container or service logs.
