Skip to main content

Module host_agent_files

Module host_agent_files 

Source
Expand description

What a host Claude Code agent is given from outside its folder, where a container agent can write the folder.

In a folder the rule of mcp_folder_rule holds for, a host agent’s CLI takes nothing of the folder’s own configuration: it is started with the setting sources limited to the person’s own (agent_mcp_flag), so the folder’s settings, hooks, instruction files, skills, commands, subagents, output styles, workflows and plugins are not loaded, and with its scheduler off (apply_for_spawn), because a scheduled prompt can be kept in the folder. What AgentMux itself gives the agent is written beside its MCP config, in the folder kept for host agents alone, and named to the CLI:

  • settings.json: AgentMux’s hooks, each named by the path of the wrapper that ships with this install, and the agent’s own settings (settings_with_hooks_by_path);
  • instructions/CLAUDE.md: the agent’s startup instructions;
  • plugin/: the agent’s skills and commands, which the CLI lists as agentmux:<name>.

A host launch writes none of these into the folder there ([write]), and the pane is told what of the folder was not loaded, by kind and count (left_out).

What each flag and variable keeps out was checked against a live CLI, per kind of file, with the version named by CHECKED_WITH_CLAUDE_CODE. The check is repeated when the pinned version moves.

Structs§

LeftOut
What of a folder’s own files a host agent there is not given, by kind: how many of each. Counted, never read as configuration.

Constants§

CHECKED_WITH_CLAUDE_CODE
The Claude Code version the flags and variables of this module were last checked against, kind by kind. It follows the pinned version: a test fails when the pin moves until the check has been run again.
PLUGIN_NAME
The plugin AgentMux’s own skills and commands are given as: the CLI lists them as agentmux:<name>.

Functions§

apply_for_spawn
The environment of a host Claude Code agent’s CLI in a folder the rule holds for: its scheduler is off (a scheduled prompt can be kept in the folder, and would run as a turn of this agent), and it reads the startup instructions of the folder AgentMux adds for it. Set over whatever the agent’s own environment says. Every other agent’s environment is left as it is.
dir_of
Where a host agent of work_dir is given its own files, when the rule holds for the folder. Reads the disk and the store.
instructions_dir
The folder that holds the agent’s startup instructions and nothing else, in dir.
instructions_path
The agent’s startup instructions, in dir.
left_out
What of folder’s own files a host agent there is not given, every one counted: the agent is given AgentMux’s own settings, instructions, skills and commands from outside, so none of these is read, a file AgentMux wrote there at an earlier launch included. A file can’t be told for AgentMux’s by what it says, since a container agent can write that too. Only looks at names.
plugin_dir
The plugin folder that holds the agent’s skills and commands, in dir.
refresh_instructions
Write the agent’s startup instructions for work_dir again (a refresh while it runs). Ok(false) when the rule does not hold for the folder, or no launch has written them yet.
refresh_skills
The agent’s skills and commands for work_dir again, as a controller start refreshes them: only the plugin folder outside is rewritten, and nothing is written into the folder. Ok(false) when the rule does not hold.
servers_with_no_path
The agent’s own MCP servers the last launch left out of its config in dir (dir_of), by name: each is set with a bare command that has no path outside the folder on this computer.
settings_path
AgentMux’s settings for the agent, in dir (dir_of).
settings_with_hooks_by_path
settings (the text of the settings AgentMux renders for an agent) as it is given to a host agent of work_dir: each of AgentMux’s own hooks names the wrapper by the absolute path of the one that ships with this install, never by a bare name. Where none ships outside the folder, those hooks are taken out: no hook rather than a command found by name. Text that is not a JSON object is returned as it is.
write
Write a host launch’s files for work_dir, a folder the rule holds for: each goes to the agent’s own folder outside it, and nothing is written into the folder. files are (name, content) as the launch rendered them. The skills and instructions of an earlier launch are removed first. A file with no place outside (another harness’s startup file) is not written: no other harness is started there. Ok(false) when the rule does not hold and the caller writes into the folder as before.