# Kit for AI — agent setup

You are configuring access to Kit for AI (https://kitforai.com): persistent memory
for AI agents — remember/recall, knowledge bases with hybrid RAG search and cited
chat, and document→Markdown/JSON conversion. Available over MCP
and REST with the same API key.

## 1. Get an API key

Ask the user to create one at https://kitforai.com/app/settings (API keys section,
free account works) and give it to you. Keys look like `kfa_…`.

## 2a. Connect via MCP (recommended)

Claude Code:

```bash
claude mcp add --transport http kit-for-ai https://kitforai.com/api/mcp --header "x-api-key: YOUR_API_KEY"
```

Or add to `.mcp.json` / any MCP client config:

```json
{
  "mcpServers": {
    "kit-for-ai": {
      "type": "http",
      "url": "https://kitforai.com/api/mcp",
      "headers": { "x-api-key": "YOUR_API_KEY" }
    }
  }
}
```

MCP tools you get: `remember`, `recall`, `remember_conversation`, `memory_profile`, `search_knowledge_base`,
`read_knowledge_base`, `write_knowledge_base`, `append_knowledge_base`,
`list_knowledge_bases`, `convert_url`, `crawl`,
`list_recent_conversions`.

## 2b. Or REST

Base URL `https://kitforai.com/api/v1`, auth header `x-api-key: YOUR_API_KEY`.

```bash
# Remember a fact (deduped automatically)
curl -X POST https://kitforai.com/api/v1/memory \
  -H "x-api-key: YOUR_API_KEY" -H "content-type: application/json" \
  -d '{"content":"The user prefers concise answers.","tags":["preference"]}'

# Recall relevant memories
curl "https://kitforai.com/api/v1/memory/search?q=user%20preferences" -H "x-api-key: YOUR_API_KEY"

# Multi-tenant apps: give each of YOUR end users an isolated memory namespace
# by adding end_user_id (1-128 chars: letters, digits, . _ : @ -). Same param
# on the remember/recall MCP tools. Omit it for the account's own memory.
curl -X POST https://kitforai.com/api/v1/memory \
  -H "x-api-key: YOUR_API_KEY" -H "content-type: application/json" \
  -d '{"content":"Prefers metric units.","end_user_id":"user_42"}'
curl "https://kitforai.com/api/v1/memory/search?q=units&end_user_id=user_42" -H "x-api-key: YOUR_API_KEY"

# Or skip manual fact-picking: POST a whole conversation and durable facts are
# extracted, deduped, and stored automatically (transient chit-chat is dropped).
curl -X POST https://kitforai.com/api/v1/memory/messages \
  -H "x-api-key: YOUR_API_KEY" -H "content-type: application/json" \
  -d '{"messages":[{"role":"user","content":"btw we switched the staging DB to read-only"},{"role":"assistant","content":"Noted — I will treat staging as read-only."}],"end_user_id":"user_42"}'
```

Also on REST (all take optional `end_user_id`):
`GET /api/v1/memory/profile` — synthesized user profile from the memories;
`GET /api/v1/memory/log` — memory timeline incl. superseded/consolidated entries;
`GET /api/v1/memory/graph` — entity graph (tags as nodes, co-mention as edges).

Full API reference: https://kitforai.com/reference · Docs: https://kitforai.com/docs

## 3. Verify

```bash
curl -s https://kitforai.com/api/v1/health   # → 200
curl -s "https://kitforai.com/api/v1/memory/search?q=test" -H "x-api-key: YOUR_API_KEY"   # → 200 []
```

## 4. How to use memory well

- `remember` one focused fact per call (preferences, project facts, decisions) —
  near-duplicates are skipped server-side.
- `recall` at the start of tasks to recover prior context.
- Memories live in an auto-created "Memory" knowledge base the user can review,
  edit, and revert at https://kitforai.com/app/kbs.
