Skip to content
Allay

WikiAllay Server

Memory and traces

The backend keeps three things about players: a session, a lasting memory, and traces of runs. Each lives only as long as it needs to, and each belongs to one server: the same player on another server is someone else (see Security and privacy).

#The session

Each player has a session in Redis, kept 24 hours after the last question (CHAT_TTL_SECONDS).

  • It holds whole exchanges: the question, the tool calls with their results, and the answer. A follow-up like “how many were in that chest?” needs no second call.
  • Once a session passes about 32 000 tokens or 100 exchanges, everything but the newest 12 000 tokens (at least 2 exchanges, at most 30) folds into a summary of up to 3000 characters. The fold runs after the answer, so the player doesn't wait.
  • Only a session past 42 000 tokens folds before the answer.
  • A player who left gets no summary: the session simply expires.
  • Between folds the session only grows at the end, so the provider's prompt cache keeps it.
  • /askx requests land in the session as one line: what was asked and which commands came out.

The v1 and v2 APIs share the session.

#Other threads

  • Public questions have their own thread, one per server. Each question starts with the asker's name, so a friend's follow-up makes sense. It keeps the answers but not the tool results, which only the asker may see. It lives 2 hours after the last question.
  • Automation agents each have a thread apart from the player's session, for 2 hours after their last wake.

#The lasting memory

The lasting memory sits in MongoDB until the player clears it, or 365 days after their last question. It holds up to 30 short facts: where the base is, what the player works on, how they like answers. The agent saves them itself and says so.

Players manage it with the plugin's commands:

  • /allay new starts a fresh session; memories stay.
  • /allay memory lists the facts; with text, it saves one by hand.
  • /allay forget deletes them.

An operator gets a copy of everything about a player, or erases it, with /allay privacy.

#Traces

The backend traces runs into its MongoDB through Mastra's observability: each run, each model step (prompt, output, tokens), and each tool call with its arguments and result. Mastra Studio reads them.

  • Every run is traced by default, since 6.4 on hosted backends too (TRACE_SAMPLE).
  • Traces go after 7 days (TRACE_DAYS). A trace holds players' questions, so it lives no longer than it needs to.
  • Keys are redacted. A run takes about 150 KB.
  • The admin panel shows only a trace's shape: steps, models, tools and whether they worked, tokens, and timings.
  • Erasing a player deletes the traces of their runs at once.

Next: Troubleshooting