Expand description
The activity stream of LeanCTX | OSS: one host-neutral, bounded event log
per agent session (session id, agent, project root), fed by host hooks,
LeanCTX MCP calls and ACP client callbacks, read by lean-ctx activity list --json (Local Read v1, docs/contracts/local-read-v1.md).
The crate never depends on the engine: the engine’s facade
(core::activity) supplies the data directory and the secret redaction.
Structs§
- Client
Session - One MCP server session of a client: its process and start second identify
it,
callscounts received tool calls (at least 1 after the first call),endedis the exit second once the server wrote it. - Client
Sessions - The ledger file under one data directory.
- Draft
- What a producer reports; the store adds
seqandat, redacts and bounds. - Empty
Streak - A client whose last
SESSIONS_PER_CLIENTsessions all were empty. - 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. - Setup
Target - What
lean-ctx init --agentcan do for a client. - Steering
- How LeanCTX steers a client’s agent, as the caller’s config sees it.
- Store
- The activity store under one root directory.
Enums§
- Kind
- What happened.
- Mark
- What a session reports.
- Outcome
- How a tool call, shell command or permission prompt ended.
- Source
- Who reported the event.
Constants§
- CLIENT_
SESSIONS_ FILE - The file under the data directory.
- 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.
- MIN_
SESSION_ SECS - A session that ends sooner without a call is not kept at all: health
checks (
claude mcp list), settings pages, reconnects and config reloads start the server, complete the handshake and exit within seconds. - SESSIONS_
PER_ CLIENT - Sessions kept per client; a streak needs this many empty ones in a row.
- 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§
- 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. - setup_
target - The
init --agenttarget of a handshake client id (core::client_capabilities).Nonefor clients without one: they are not recorded, since there is no concrete fix to name.