Skip to content

Conversation

@ammar-agent
Copy link
Collaborator

@ammar-agent ammar-agent commented Dec 31, 2025

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: false to discard base body entirely.

Changes

  • prompt.append frontmatter field (default: true)
  • resolveAgentBody() for recursive body resolution with cycle detection
  • Project-local exec/plan agents now inherit + extend built-in prompts
  • Removed legacy "Mode" sections from AGENTS.md (now handled by agent definitions)

Example

---
name: My Exec
base: exec
---

Project-specific instructions appended to exec's prompt.

To replace instead:

---
name: Custom
base: exec
prompt:
  append: false
---

Completely replaces exec's prompt.

Generated with mux • Model: anthropic:claude-opus-4-5 • Thinking: high

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a 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".

- 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
@ammario ammario merged commit d4606b0 into main Dec 31, 2025
20 checks passed
@ammario ammario deleted the agent-prompt-append branch December 31, 2025 23:43
ammario pushed a commit that referenced this pull request Jan 1, 2026
…#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`_
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants