twin memory

CLI

A command-line tool for twin memory is planned. Until it ships, curl and a shell function do the same job.

A twin command-line tool is coming Soon. It is not published yet, and nothing on this page can be installed today. The API is plain HTTP and JSON, so curl works now.

Planned shape

This is the shape we plan, so you can see where it is going. It may change before release.

planned, not published
twin add --user user_42 --session onboarding --role user "I just moved to Lisbon."
twin search --user user_42 "Where does Alice live?"
twin forget --user user_42 --items msg-001

Use plain HTTP today

Put this function in your shell profile. It posts a JSON body to one route for one end user.

~/.zshrc or ~/.bashrc
# twin <end user> <route> '<json body>'
twin() {
  local user="$1" route="$2" body="${3:-}"
  [ -n "$body" ] || body='{}'
  curl --silent --show-error \
    --write-out '\n%{http_code}\n' \
    "https://api.twinmemory.dev/v1/memory/$route" \
    -H "Authorization: Bearer $TWIN_MEMORY_API_KEY" \
    -H "X-Twin-Account: $user" \
    -H "Content-Type: application/json" \
    -d "$body"
}
use
export TWIN_MEMORY_API_KEY="tm_..."

twin user_42 add '{"items": [{"id": "msg-001", "session": "onboarding", "role": "user",
  "text": "I just moved to Lisbon from Berlin for the new job at Acme."}]}'

twin user_42 search '{"query": "Where does Alice live?"}'

twin user_42 forget '{"items": ["msg-001"]}'

twin user_42 overview

The last line of each answer is the HTTP status. A 404 on a read means the end user has no memory yet. Pipe the body through jq to read it, for example twin user_42 search '{"query": "rent"}' | sed '$d' | jq.

Every route has the same shape: a POST to /v1/memory/<name> with a JSON body. See the API reference.

On this page