Brain API
Conversational AI chat interface powered by Claude CLI.
Brain API
The Brain API provides a conversational AI interface powered by Claude CLI. It maintains conversation history, injects context from memory and active workflows, and isolates chats per user.
Endpoints
Send Message
Send a message to the Brain and receive an AI response.
Request:
Response:
How it works:
- Retrieves the user's conversation history
- Injects context from hierarchical memory (org, team, worker scopes)
- Sends the full context + message to Claude CLI
- Stores the response in conversation history
- Returns the AI response
:::note Chat history is per-user isolated. Each authenticated user has their own conversation thread. :::
Get History
Retrieve the authenticated user's conversation history.
Response:
Clear History
Clear the authenticated user's conversation history.
Response:
Context Injection
The Brain doesn't just answer from the model's training data. Before each response, it loads:
| Context Source | Scope | Example |
|---|---|---|
| Organization memory | Global | ICP definition, pipeline totals |
| Team memory | Team-scoped | Territory assignments, campaigns |
| Active workflows | Real-time | Running workflow statuses |
| Conversation history | Per-user | Previous messages in this thread |
This means the Brain can answer questions like "What's Sarah working on right now?" by checking active workflows and worker status.