Skip to main content

Module startup_refresh

Module startup_refresh 

Source
Expand description

Keeps a running Claude agent’s AgentMux-owned startup file current (docs/specs/SPEC_MEMORY_DELIVERY_INDEX_NOT_FULL_TEXT_2026_11_17.md section 3.1). The file is written when the agent is launched, and the CLI reads it again after a compaction or /clear; without a refresh it holds the Global Memory of the day of the launch, and the delivery that follows has to send every changed entry again.

Global Memory has no single place where a change commits (the RPC handlers, the Memory tool, a revert, the fleet sync and the Operator Config seed all write it), so this does not hook the writers: every CHECK_EVERY it compares a fingerprint of the Global sections and, when it moved, re-renders the startup file of each running Claude pane. The refresh is not tied to a compaction or to the hook: one made after the CLI has reloaded the old file would hide the changed sections from the delivery’s per-section check and leave the agent with the old copy.

Structs§

Watch 🔒
What the last check saw. The first check records a baseline: a file older than this srv is covered by the delivery’s per-section check, and refreshing every agent at boot would only add a write burst to it.

Enums§

Refresh 🔒
How a pane’s startup file fared.

Constants§

CHECK_EVERY 🔒

Functions§

fingerprint 🔒
A fingerprint of every Global section (a section’s id and text). Operator Config entries that target another kind of agent are in it too: a change to one refreshes agents that do not carry it, which rewrites their file with the same text.
has_an_agentmux_startup_file 🔒
Whether dir holds a startup file AgentMux wrote: a CLAUDE.md with its marker, or the memory file a user’s own CLAUDE.md imports. A folder with neither is not given one by a refresh.
pane_cwd 🔒
The pane’s folder as a path that exists on this machine. agent.open stores a default folder as ~/.agentmux/agents/<slug>, unexpanded, and the launch expands it when it writes the file.
refresh_pane 🔒
Re-renders the pane’s startup file from the agent’s definition, the way its launch did, through the writer that never touches a file AgentMux does not own.
refresh_panes 🔒
Refreshes the startup file of each pane in turn, once per folder, and returns how many it wrote. A folder counts as done only after a Claude pane has been looked at in it: a pane of another provider that comes first must not use it up and leave a Claude pane in the same folder with a stale file.
refresh_running 🔒
Refreshes the startup file of every running agent pane, once per folder.
start 🔒
Starts the watcher.
startup_file_key 🔒
What names the startup file a pane’s agent reads: its folder, and whether the file is kept outside it (a host agent in a folder a container agent can write, host_agent_files). A container agent’s pane on the same folder reads the folder’s own file, which is another one.