Documentation
¶
Overview ¶
Package agent holds the agent runtime and its supporting subsystems.
The hub is the runtime package (internal/agent/runtime), which owns the Session: the agent loop, tool dispatch, plan-mode lifecycle, cost ledger, and introspection. Supporting sub-packages are leaves below it:
- acceptance — reconciles prior agent work against git (did edits survive?).
- compaction — summarizes old turns when the context window fills.
- edit — anchored search/replace edit application + hashing.
- focus — tracks the active subsystem focus for context scoping.
- input — parses user input routing (steer/queue/interrupt/shell).
- jobs — detached background agent jobs.
- mood — the session's mood (display state derived from turn history).
- permissions — the bash-command risk classifier and permission modes.
- protocol — the stream-json machine control protocol adapter.
- room — the room reducer (aggregates events into display state).
- secrets — redaction of secrets before model calls.
- tools — tool definitions and dispatch table.
The dependency graph is a clean DAG: runtime is the hub; the leaves depend on it (or on nothing), never the reverse.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package acceptance closes memcode's interaction loop by reading the room AFTER the work: did the agent's changes survive contact with the human? Git is the objective evidence most agents never look at — a commit is the strongest "yes", a revert the strongest "no", a manual edit a "close, but".
|
Package acceptance closes memcode's interaction loop by reading the room AFTER the work: did the agent's changes survive contact with the human? Git is the objective evidence most agents never look at — a commit is the strongest "yes", a revert the strongest "no", a manual edit a "close, but". |
|
Package personal implements the domain-general durable state and runtime primitives for autonomous agents.
|
Package personal implements the domain-general durable state and runtime primitives for autonomous agents. |
|
Package compaction is the PURE, testable core of in-session context compaction: deciding WHERE to cut a running conversation and rendering the cut-off part into a plain transcript for an Anthropic summarizer.
|
Package compaction is the PURE, testable core of in-session context compaction: deciding WHERE to cut a running conversation and rendering the cut-off part into a plain transcript for an Anthropic summarizer. |
|
Package continuation is the ONE durable suspend/resume mechanism for an agent turn that stops mid-flight to wait for a human.
|
Package continuation is the ONE durable suspend/resume mechanism for an agent turn that stops mid-flight to wait for a human. |
|
Package edit implements the safe edit transaction used by the agent: read → verify the anchor is unique → patch → re-read → show the diff.
|
Package edit implements the safe edit transaction used by the agent: read → verify the anchor is unique → patch → re-read → show the diff. |
|
Package focus is memcode's COGNITIVE / attention axis — what the human is attending to — the complement of package room (the emotional / interaction axis).
|
Package focus is memcode's COGNITIVE / attention axis — what the human is attending to — the complement of package room (the emotional / interaction axis). |
|
Package gitporcelain holds small shared helpers for parsing git's porcelain output.
|
Package gitporcelain holds small shared helpers for parsing git's porcelain output. |
|
Package input routes a raw interactive line — coalesce / steer / queue / interrupt — so the agent collaborates the way people actually type instead of treating every Enter as a new task.
|
Package input routes a raw interactive line — coalesce / steer / queue / interrupt — so the agent collaborates the way people actually type instead of treating every Enter as a new task. |
|
Package introspect is memcode's read-only intelligence surface — the commands the agent reaches through the single `memcode` tool (overview, map, context, why, recall, next, recap, memories, sources, session, acceptance, doctor, jobs) and the TUI's "orient me" slash shortcuts, plus the two ambiguity classifiers (plan-intent, follow-up steer-vs-queue) and the personality greeting.
|
Package introspect is memcode's read-only intelligence surface — the commands the agent reaches through the single `memcode` tool (overview, map, context, why, recall, next, recap, memories, sources, session, acceptance, doctor, jobs) and the TUI's "orient me" slash shortcuts, plus the two ambiguity classifiers (plan-intent, follow-up steer-vs-queue) and the personality greeting. |
|
Package jobs is memcode's background-job layer — the async extension of the shell lanes.
|
Package jobs is memcode's background-job layer — the async extension of the shell lanes. |
|
Package ledger holds the cost-accounting readout types and pure aggregation logic carved off the agent Session god-object.
|
Package ledger holds the cost-accounting readout types and pure aggregation logic carved off the agent Session god-object. |
|
Package mood detects interaction *friction* — how a user is engaging with the agent — from their terminal input, using a deterministic, dependency-free lexical heuristic.
|
Package mood detects interaction *friction* — how a user is engaging with the agent — from their terminal input, using a deterministic, dependency-free lexical heuristic. |
|
Package permissions classifies the risk of an action and decides — given the active mode — whether it may run, needs approval, or is blocked.
|
Package permissions classifies the risk of an action and decides — given the active mode — whether it may run, needs approval, or is blocked. |
|
Package plan holds the plan-mode lifecycle as a real state machine.
|
Package plan holds the plan-mode lifecycle as a real state machine. |
|
Package protocol drives an interactive memcode session over the stream-json control protocol (newline-delimited JSON on stdio) — the machine-facing twin of the TUI.
|
Package protocol drives an interactive memcode session over the stream-json control protocol (newline-delimited JSON on stdio) — the machine-facing twin of the TUI. |
|
Package room reads the *room* — the current state of the human↔agent interaction — and turns it into a runtime policy.
|
Package room reads the *room* — the current state of the human↔agent interaction — and turns it into a runtime policy. |
|
Package runtime: this file is the thin seam to the read-only intelligence Engine (internal/agent/introspect).
|
Package runtime: this file is the thin seam to the read-only intelligence Engine (internal/agent/introspect). |
|
Package secrets keeps the agent from leaking credentials.
|
Package secrets keeps the agent from leaking credentials. |
|
Admin toolset — the `memcode admin` session's ONLY tools (plus ask_user).
|
Admin toolset — the `memcode admin` session's ONLY tools (plus ask_user). |
Click to show internal directories.
Click to hide internal directories.