Skip to main content

Module agents

Module agents 

Source

Modules§

friction
Friction signals of agent coordination, counted locally for the retro loop: <data>/agents/friction.jsonl, one {"at", "signal", "agent"?, "root"?} line per event (fixed keys and ids, never message text), summed by lean-ctx agent friction [--since <dur>] and per hour, worker and vault by the Hive connector’s friction counter for the vault bus (V16.1).
host_mirror
Mirror of a host’s own agent-to-agent message (Claude Code SendMessage) onto the local bus scratchpad, so ctx_agent read and the dashboard see direct traffic the host delivers outside lean-ctx.

Structs§

AgentDiary
AgentEntry
AgentRegistry
ContextDepthConfig
DiaryEntry
FileLock
LogicalSessionPresence
ProcessIdentityIndex
Compatibility store for process identities.
ScratchpadEntry
TransportClient
The host behind an MCP transport, from the initialize handshake.

Enums§

AgentRole
AgentStatus
DiaryEntryType
RoleSource

Constants§

ACQUIRE_TIMEOUT
How long FileLock::acquire waits without progress. Threads of this process queue for a crate::core::file_lock::Turn first, and that wait restarts at every handover, so a moving queue never times out; the file lock itself is then polled (25 ms steps) for at most this long, which bounds other processes. Before (GitLab #1295) a waiter behind writers that took it back to back could pass the former 750 ms and fail its tool call. A dead holder’s lock is released by the OS, so waiting longer never makes a stale lock permanent; it only lets a contended call through.
BINDING_METADATA_KEY
Metadata key under which a bus message carries its admission binding. The on-disk shape of ScratchpadEntry is unchanged: metadata already is a string map, and an entry written before bindings existed simply has no such key (the legacy rule of context_admission::stored applies to it).
HIVE_INBOUND_KEY_PREFIX
Idempotency-key prefix of bus entries another machine’s worker delivered through Hive (the relay writes them with it).
MAX_ROLE_ID_BYTES
Longest role id, in bytes.

Functions§

declared_session_role
The session role stated through the environment (LEAN_CTX_ROLE, then LEAN_CTX_AGENT_ROLE). Anything else an MCP session gets is assumed.
register_announce
Register the announce request; the first registration wins.
request_id_conflict
The refusal of a key reused with another request; content-free.
role_id
raw as a role id (coder, reviewer, docs-writer, …): trimmed and lower-cased, 1–48 bytes of [a-z0-9_-] starting with a letter. Free text (a session or display name such as “LeanCTX · Contracts”) is no role id: None, and the caller names it a display name instead.
take_renewed
Whether agent_id’s registration had expired and was renewed since the last call (each renewal is reported once).