You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add Runtime abstraction support for reading AGENTS.md from workspaces,
with graceful fallback to project root when workspace file doesn't exist.
Problem:
- SSH workspaces are on remote machines, can't use local fs.readFile()
- AGENTS.md may not be cloned into SSH workspace yet
- Need to support both local worktrees and remote SSH workspaces
Solution:
- Add runtime parameter to buildSystemMessage()
- Read workspace AGENTS.md using Runtime.readFile() (works for SSH)
- Fall back to project root AGENTS.md if workspace doesn't have one
- Preserves branch-specific instructions for local workspaces
- Provides sensible defaults for SSH workspaces during clone
Changes:
- buildSystemMessage() now accepts Runtime parameter
- New readInstructionSetFromRuntime() uses runtime to read workspace files
- Instruction priority: global → workspace (if exists) → project (fallback)
- Mode section priority: workspace → project → global
- Updated docs/instruction-files.md to reflect fallback behavior
- Updated all tests to pass runtime parameter
- Updated aiService.ts to pass runtime to buildSystemMessage()
This preserves existing test behavior (workspace-specific instructions work)
while adding robustness for SSH workspaces where files may not exist yet.
Priority within each location: `AGENTS.md` → `AGENT.md` → `CLAUDE.md` (first match wins). If the base file is found, cmux also appends `AGENTS.local.md` from the same directory when present.
11
12
12
-
**Note**: Instructions are read from the project root (where the main repository is located), not from individual workspace directories. This ensures consistent instructions across all workspaces for a project.
13
+
**Fallback behavior**: If a workspace doesn't have its own AGENTS.md, the project root's AGENTS.md is used as a fallback. This is particularly useful for SSH workspaces where files may not be fully cloned yet.
13
14
14
15
## Mode Prompts
15
16
@@ -21,7 +22,7 @@ cmux reads mode context from sections inside your instruction files. Add a headi
21
22
22
23
Rules:
23
24
24
-
-Project instructions are checked first, then global instructions
25
+
-Workspace instructions are checked first, then project, then global instructions
25
26
- The first matching section wins (at most one section is used)
26
27
- The section's content is everything until the next heading of the same or higher level
0 commit comments