Expand description
Facade of lean-ctx-activity: the per-session activity stream under
<data dir>/activity, with this Instance’s secret redaction. Producers
(hooks, MCP calls, ACP client callbacks) call record; it never fails
the caller.
Structs§
- Draft
- What a producer reports; the store adds
seqandat, redacts and bounds. - Event
- One stored event: one line of a session’s log, and one item of
activity.list(Local Read v1). - Filter
- What a listing selects.
sessionandproject_rootnarrow, both may be given; with neither the listing is empty. - Listing
- A listing: the newest
limitmatches, sorted oldest → newest. - Store
- The activity store under one root directory.
Enums§
- Kind
- What happened.
- Outcome
- How a tool call, shell command or permission prompt ended.
- Source
- Who reported the event.
Constants§
- DEFAULT_
LIMIT - Events returned when no
limitis given. - MAX_
LABEL_ BYTES - Longest label kept (session id, agent, tool name), in bytes.
- MAX_
LIMIT - The largest
limita listing accepts. - MAX_
ROOT_ BYTES - Longest project root kept, in bytes.
- MAX_
SESSIONS_ PER_ PROJECT - Sessions kept per project (most recently written).
- MAX_
SESSION_ BYTES - A session log larger than this keeps its newest half.
- MAX_
SESSION_ ID_ BYTES - Longest accepted id.
- MAX_
SESSION_ NAME_ CHARS - Longest accepted session name, in characters.
- MAX_
TARGET_ BYTES - Longest target kept (path, redacted shell command, URL, query), in bytes.
- MAX_
TEXT_ BYTES - Longest message text kept (user or agent message, permission prompt, error), in bytes; longer text is cut at a char boundary.
- SESSION_
ENV - Environment variable naming the app’s session (
LEAN_CTX_SESSION_ID). - SESSION_
HEADER - Request header naming the app’s session at the proxy.
- SESSION_
NAME_ ENV - Environment variable naming the app’s session for people
(
LEAN_CTX_SESSION_NAME, e.g. “LeanCTX · Contracts”): shown on the bus presence, never used to attribute or authorize anything.
Functions§
- project_
root - The project root a stream is kept under: normalized and promoted to its
git root, so a hook’s
cwdin a subdirectory, the MCP session’s root and a reader’s--project-rootname the same project. - record
- Record
draftnow: secrets masked (core::redaction, the shell’s redaction), text bounded. Fail-open: an event that cannot be stored is dropped with a debug log. - session_
id rawas a session id: trimmed, 1–128 bytes of[A-Za-z0-9._:-]; anything else is no id (ignored, never an error).- session_
id_ from_ env - The app session id of this process (
SESSION_ENV), if valid. - session_
name rawas a session name: trimmed, 1–128 characters, no control characters; anything else is no name (ignored, never an error).- session_
name_ from_ env - The app session name of this process (
SESSION_NAME_ENV), if valid. - store
- The store of this Instance.