-
Notifications
You must be signed in to change notification settings - Fork 38
🤖 feat: add prompt.append for agent body inheritance #1389
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
bfc6a6f to
7c5788e
Compare
f5c5f66 to
8e61aff
Compare
8e61aff to
a4cff63
Compare
a4cff63 to
1d4f565
Compare
1d4f565 to
6cb99dc
Compare
6cb99dc to
345867a
Compare
345867a to
bbbdf1e
Compare
bbbdf1e to
8ca5361
Compare
- Add prompt.append field to agent schema (default: false = replace) - When true, child agent's body is appended to base agent's body - Add resolveAgentBody() to handle inheritance chain resolution - Deprecate Mode sections in AGENTS.md → project-local agents - Add .mux/agents/exec.md and plan.md with prompt.append: true - Update docs with inheritance behavior explanation - Add tests for resolveAgentBody
- When inheriting from a base agent, child body is now appended by default - Set prompt.append: false to explicitly replace the base body - Updated docs to reflect new default behavior - Removed now-redundant prompt.append: true from project-local agents
8ca5361 to
336ebf5
Compare
…#1402) ## Problem After the agent definitions merge (#1389), Mux broke when project-local agents tried to extend built-in agents of the same name. For example: ```md # .mux/agents/exec.md --- name: Exec base: exec # Tries to extend built-in exec --- Project-specific additions. ``` This caused either: - An infinite loop (readAgentDefinition kept finding the same project file) - False cycle detection (since both project/exec and built-in/exec have ID "exec") ## Solution 1. **Add `skipScopesAbove` option to `readAgentDefinition`**: When resolving a base agent with the same ID as the current agent, skip the current scope and look at lower-priority scopes (global, then built-in). 2. **Track visited packages by `(id:scope)` tuple**: This allows the same agent ID to appear at multiple scopes in the inheritance chain without triggering false cycle detection. A real cycle would still be detected (same id AND same scope). 3. **Update both resolution paths**: - `resolveAgentBody()` for system prompt inheritance - `resolveAgentInheritanceChain()` for tool policy inheritance ## Testing - Added test: "same-name override: project agent with base: self extends built-in/global, not itself" - Added test: "readAgentDefinition with skipScopesAbove skips higher-priority scopes" - All existing agent tests pass ## Documentation Added new section "Extending Built-in Agents" in docs/agents.mdx explaining the pattern. --- _Generated with `mux` • Model: `anthropic:claude-opus-4-5` • Thinking: `high`_
Summary
Adds control over how agent body prompts compose during inheritance.
Default (append): Child body is appended to base body—intuitive for project-local agents extending built-ins.
Explicit replace: Set
prompt.append: falseto discard base body entirely.Changes
prompt.appendfrontmatter field (default: true)resolveAgentBody()for recursive body resolution with cycle detectionExample
To replace instead:
Generated with
mux• Model:anthropic:claude-opus-4-5• Thinking:high