cURL Quickstart
Call the Unison brain directly from the terminal — recall context and persist new memory with two curl commands.
The fastest way to verify your token and explore the API. No dependencies; just curl and a terminal.
Prerequisites
Get a token at app.unisonlabs.ai and export it:
export UNISON_TOKEN=usk_live_...Recall — fetch prompt-ready context
curl -G "https://brain.unisonlabs.ai/v1/brain/context" \
--data-urlencode "q=payment service architecture" \
-d "k=5" \
-d "mode=auto" \
-H "Authorization: Bearer $UNISON_TOKEN"Response shape:
{
"weakEvidence": false,
"contextMd": "## Relevant context\n...",
"hits": [...]
}Inject contextMd into your prompt. When weakEvidence is true the brain has nothing confident — skip injection or prompt the model to answer without prior context.
Persist — save a conversation to the brain
curl -s -X POST "https://brain.unisonlabs.ai/v1/brain/remember" \
-H "Authorization: Bearer $UNISON_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"dump": {
"turns": [
{ "role": "user", "content": "What queue library should we use?" },
{ "role": "assistant", "content": "Switched to pgmq — simpler ops than Redis." }
]
},
"sourceRef": "session-1"
}'Response:
{ "jobId": "job_..." }remember runs the save-or-skip curation pipeline in the background — dedupe, curated notes, entity facts. The jobId tracks that job; poll GET /v1/brain/jobs/{jobId} for status. Recall queries reflect the new memory within seconds.
To write a document directly (no curation, full control over path and tags), use POST /v1/brain/ingest with type: "document" — see Ingest.
Build a coding agent with memory
A practical architecture for a coding agent that gets smarter every session: the recall → act → verify → write-back loop, what to store, and the code per surface — with what the research actually shows.
Node.js Quickstart
Call the Unison brain from Node.js using the built-in fetch API — no extra dependencies required.