Skip to main content

Module startup_files

Module startup_files 

Source
Expand description

The files a Claude Code session reads by itself at startup, listed for the “Given to the agent” card (SPEC_LAUNCH_CONTEXT_WORKSPACE_RULE_AND_STARTUP_FILES_2026_09_30.md §4, phase LC2). Before this the card showed only what the SessionStart hook carried, while the CLI had also loaded the user’s CLAUDE.md, every CLAUDE.md up the folder tree (the hand-maintained ~/.agentmux/agents/CLAUDE.md among them), their @imports, the skill listing and the MCP servers.

This mirrors Claude Code’s documented loading rules: it is what the CLI should have read, not proof that it did.

Structs§

StartupFile
One startup item.

Enums§

Owner
Who writes a file: AgentMux, the user (a file in the agent’s own workspace that AgentMux doesn’t manage), or someone else (outside the workspace and not written by AgentMux, e.g. the hand-maintained shared agents/CLAUDE.md).

Constants§

MAX_IMPORT_DEPTH 🔒
Claude Code follows @imports this many hops deep.

Functions§

add_instructions 🔒
claude_startup_files
Claude’s startup files for a session in cwd, in the order the CLI loads them: the user’s CLAUDE.md (in config_dir, else ~/.claude), then each folder from the filesystem root down to cwd (its CLAUDE.md, .claude/CLAUDE.md, CLAUDE.local.md), each file followed by what it imports; then the skill listing and the MCP servers of cwd.
contains 🔒
display_name 🔒
~/x/y for a path under home, else the path; forward slashes.
imports_of 🔒
@path imports in text, resolved against the importing file’s folder (~/ against the home dir), skipping fenced and inline code, which Claude Code doesn’t evaluate. Only files that exist.
mcp_item 🔒
The MCP servers in cwd/.mcp.json, by name only: the file carries the agent’s signing keys, so its text never leaves this function.
owner_of 🔒
skills_item 🔒
The skill listing Claude Code builds from .claude/commands/*.md and .claude/skills/*/SKILL.md: one item with a count, no text (the CLI lists each by name and description).