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 — write memory to the brain
curl -s -X POST "https://brain.unisonlabs.ai/v1/brain/ingest" \
-H "Authorization: Bearer $UNISON_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"items": [
{
"type": "conversation",
"turns": [
{ "role": "user", "content": "What queue library should we use?" },
{ "role": "assistant", "content": "Switched to pgmq — simpler ops than Redis." }
],
"sourceRef": "session-1",
"visibility": "private"
}
]
}'Response:
{
"items": [
{ "type": "conversation", "jobId": "job_..." }
]
}The jobId tracks async indexing. Recall queries will reflect the new memory within seconds.
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.