CLI command
jeden chat-memory
Read an agent's never-ending chat, laid out as the operator's OptChat design — the append-only log of every message of every session of the chat, the binary tree of one-line summaries over it, and the view each turn is given, with the same zoom(id, n) and date(id) the model has through recall_conversation — and bring an earlier session into a chat.
Exact invocation#
jeden chat-memory list | jeden chat-memory show <chat-or-session> | jeden chat-memory zoom <chat-or-session> <id> <n> | jeden chat-memory date <chat-or-session> <id> | jeden chat-memory import <chat> <session> [--json]Inputs and options#
- The memory is on in a workspace whose configuration names
chatMemorywithsummaryModel(a concrete direct-provider model or Brama route or alias that writes the lines). A chat outlives its sessions: every session of an agent appends to the same chat, so a new session,/reset, a resume,/forkand/branchgo on from everything the agent was told before. A new session's chat is named byJEDEN_CHAT(what a launcher sets for each agent it starts), else bychatMemory.chat, else it is the workspace's own chat,workspace-<directory>-<SHA-256 of its path>; named chats live inchats/<name>/beside the session root. A session keeps the chat it started in: a resumed session, and a session made from another, goes on in the chat its record (<session>/chat-memory.json) or its parent's names, whateverJEDEN_CHATnames for new sessions. A delegated task keeps its own chat in its session directory, and an intake or acceptance inspection or a Pursuit stage writes to none. The line size, the view's high and low sizes, the tool output clip and the retry count are the operator's numbers, declared with his words inrust/chat_memory/numeric-provenance.json; compactions run side by side, as many at a time as the operating system says the machine runs threads. listprints every chat: its name, how many messages it holds, the workspace and moment it was started in, and whether a running process writes it now.<chat-or-session>is a chat's name, or a session id or directory, asjeden sessionslists them, naming the chat that session wrote to (itschat-memory.json).showprints the chat, how many messages the log holds, the view's size between the high and low sizes, how many compactions run at a time, its lines (id+n|text) and, with--json, its[l, i]pairs and every node of the tree.zoom <id> <n>opens lineid+ninto the two lines it was made from (a line not built yet prints as(not summarized yet: zoom it)), and forn= 1 prints messageidwhole as#i kind dateand its text.date <id>prints when messageidwas said.import <chat> <session>appends every message of the session's conversation to the chat as anotestarting[imported from session <id>]and the message's kind, creating the chat when it has never been written, so an agent that starts a chat does not start from nothing. The chat keeps which sessions it imported inimports.json.- A
/rewindkeeps the log as it is and appends anotenaming the messages taken back; what is said after it follows the note.
Output and state effect#
list, show, zoom and date read <chat>/chat.json, main/YYYY-MM-DD.jsonl ({i, kind, text, size, date} per message), tree/YYYY-MM-DD.jsonl ({l, i, text, size} per node) and view.json (the view's [l, i] pairs) and write nothing. import appends to the log and imports.json while it holds the chat's owner.lock. In a session each new message appends its line to the view; once the view passes the high size, one batch merges the most due sibling pairs, due = (T - last) / 2^l, oldest first among equals, until it is at most the low size. The view is saved and loaded, never rebuilt from the log. Each turn is sent the system messages, the view of the whole chat before it inside <chat> tags and the turn from the user's message on. Jeden RPC answers the same as chat-memory/list, chat-memory/show {target}, chat-memory/zoom {target, id, n}, chat-memory/date {target, id} and chat-memory/import {chat, session, cwd}.
Refusals and boundaries#
- Any other verb is refused, exit 2, with the five invocations. A target that is no chat and no session that wrote to one is refused:
`<target>` is neither a chat under <chats> nor a session that wrote to a chat (<session>/chat-memory.json records none). Anid+nthat is no line of the view (nnot a power of two, oridnot a multiple of it) is refused naming what a line looks like; a message the log does not hold is refused naming the log. import:the import names the chat `<name>`, which is not a chat name: …; a session that cannot be found is refused with the session store's own sentence;the chat `<name>` imported the session <dir> on <date> already, as messages <first> to <end>; it is not imported twice;the session <dir> holds no conversation message to import; and a chat another process writes is refused as below.- An unreadable or malformed log, tree, view, chat record, session record or import list is refused naming the file and where it broke, never read as an empty memory.
- Each message the log keeps is stamped with the moment it entered it, read through
jeden.clocklike every other record Jeden stamps: a clock before 1970 isbefore-epoch, a clock past what the C library'stime_tholds istime-unrepresentable, a timegmtime_rcannot place on the UTC calendar iscalendar-unplaced, and a datestrftimewrites nothing for or writes as bytes that are not UTF-8 isdate-unwrittenordate-not-text. Each names the seconds since the epoch it was given and leaves the log as it was;jeden errors show jeden.clocklists them. - In a session:
chatMemory.summaryModel is required: …,chatMemory.viewBytes is no longer read: …,chatMemory.chat names the chat `<name>`, which is not a chat name: use letters, digits, `-`, `_` and `.`, not starting with a dot(orJEDEN_CHAT names the chat …, refused for a resumed session too),the workspace <dir> is a filesystem root, which names no chat; set JEDEN_CHAT or chatMemory.chat,the chat `<name>` is written by another process now (it holds <chat>/owner.lock); one process writes a chat, so give this agent its own with JEDEN_CHAT=<name> or chatMemory.chat,chatMemory.summaryModel `<model>` cannot write the chat memory's summaries: <Brama's cause>,message <n> could not be compressed: …andnode <id+n> could not be merged: …stop the turn with that cause. JEDEN_BIN=… JEDEN_TEST_SOURCE_REVISION=… JEDEN_TEST_STADO=… JEDEN_TEST_BATCHES=… node tests/chat_memory/journey.mjsis the real journey of the sawtooth: the two configuration refusals, then one real RPC session until the view has gone through the asked number of batches, checking that no view a turn was given passed the high size and each batch brought it to at most the low size, the day files of the log and tree, the[l, i]pairs ofview.json, a zoom from the view's first line down to the first message word for word and its date, a next process continuing the kept view, and a rewind's note. Its model and summary model are played through Stado's attestation alternative under the run's own HOME: each turn answers its paragraph back, each summary states one line that fits the summary size, and the whole journey is one pass run again from empty chats until every request it asks is answered.JEDEN_BIN=… JEDEN_TEST_SOURCE_REVISION=… JEDEN_TEST_MODEL=… JEDEN_TEST_SUMMARY_MODEL=… JEDEN_MODEL_ENDPOINT=… node tests/chat_memory/chats.mjsis the real journey of one chat across sessions: a session is told a code word and a new session of the chat answers it, a second writer is refused while a running session holds the chat andlistsays it is written now, a resumed session stays in its own chat whateverJEDEN_CHATnames,showfinds a session's chat,importbrings a session into a new chat once and that chat's next session answers the code word, and the name refusals. It needs the OpenAI-compatible providerJEDEN_MODEL_ENDPOINTnames (withJEDEN_MODEL_KEY), because holding a chat puts a gate in front of that provider's HTTP route, which a request handed to Stado never passes; its reports are under.build/chat-memory/.- A command line of the wrong form (an unknown command or option, a missing, unexpected or invalid argument, a missing confirmation) prints the error and the usage and exits
2; a refusal that retrying unchanged can help (a dependency down or not answering, a rate limit) exits69; any other refusal or failure exits1. A refusal a functionality declares ends withfix: …andcause: <operation>.<cause>, andjeden errors show <operation>lists every cause of that functionality.