Skip to content

How they work

How the person works - the routines they follow before an action and how they write on each surface - as plain lines with the counts and facts behind them.

POST/v2/memory/how_they_workTry it in the Playground
Auth
read key
Cost
free; never refused for your plan

Search finds what was said. How they work is what the person does: the steps they take before an action, such as running the checks before merging a pull request, and how they write in each place, such as short lowercase one-liners in chat. Call it before your agent acts or writes for the person: before it opens a pull request, sends a message in their name or drafts a reply, so it does things their way.

The answer is cards, each a plain line for your model with what it rests on, then the counts in full. Each card carries the refs of the facts it cites, for open. Cards are made over time from what memory holds; a new memory has none yet, and procedures and voice may still answer.

Headers

Authorizationstringrequired

Bearer tm_…. A read key is enough.

X-Alexein-Userstringrequired

The app user whose memory to read. See App users.

X-Request-Idstring

Your id for this request, echoed on the response.

Body

whostring

Someone in this memory, by name, up to 512 characters. Absent, the person. Cards are made for the person alone: for anyone else, cards is empty and the counts answer.

surfacestring

Where the writing is for, such as a channel or a repository, up to 512 characters. Absent, where they write most.

Response

whostring

Whose ways these are.

cardsobject[]

Plain lines on how the person works, each with a kind, text and refs (the facts it cites):

  • routine: what they do before an action, in order. procedures holds that routine's counts: anchor (the action), occurrences, first and last (days), and steps, each {verb, did, total, share}. contexts, when present, says where a step depends on the context: required (the step), anchor, dimension and value (the context), did and total in it, and base_did and base_total in any context.
  • style: how they write on one surface. voice holds the counts it rests on: messages, median_words, and the shares of their messages that are one_line, start in lower case (lowercase_start), use contractions, emoji, questions and greetings, each 0 to 1.

Every number is counted, never written by a model. Each text is a line for your model; don't parse it.

proceduresstring[]

Each routine's counts written out in full, as text for a model.

voicestring | null

How they write on surface, or where they write most, as text for a model. null when memory has too few of their messages to say.

For an app user with no memory yet it answers 200 with cards and procedures empty and voice null.

Errors

400bad request

X-Alexein-User is missing or not a usable id.

401unauthorized

The bearer is not a key this service issued.

403forbidden

The organisation has been closed in the console.

422invalid

A field is out of bounds. detail names the field.

429too many requests

Too many requests in flight, or reads too fast. Retry after Retry-After seconds. See Limits.

503unavailable

The service is busy or briefly unavailable. Retry after Retry-After seconds, or with backoff when there is none.

Request
curl https://api.alexein.ai/v2/memory/how_they_work \
  -H "Authorization: Bearer $ALEXEIN_API_KEY" \
  -H "X-Alexein-User: user_42" \
  -H "Content-Type: application/json" \
  -d '{}'
200 OK (shortened)
{
  "who": "Alice Chen",
  "cards": [
    {
      "kind": "routine",
      "text": "Before merging a pull request: runs the checks, then asks for a review",
      "procedures": [
        {
          "anchor": "merged",
          "occurrences": 41,
          "first": "2026-03-02",
          "last": "2026-10-20",
          "steps": [
            { "verb": "ran", "did": 38, "total": 41, "share": 0.927 },
            { "verb": "requested_review", "did": 33, "total": 41, "share": 0.805 }
          ]
        }
      ],
      "refs": ["mem_8nC3vL6qPz1"]
    },
    {
      "kind": "style",
      "text": "Short lowercase one-liners, rarely a greeting",
      "surface": "slack",
      "voice": {
        "surface": "slack",
        "messages": 412,
        "median_words": 7,
        "one_line": 0.91,
        "lowercase_start": 0.84,
        "contractions": 0.37,
        "emoji": 0.05,
        "questions": 0.22,
        "greetings": 0.03
      },
      "refs": []
    }
  ],
  "procedures": ["…"],
  "voice": "…"
}