Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 61 additions & 7 deletions docs/BUNDLE_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ bundle:

includes:
- bundle: git+https://github.com/microsoft/amplifier-foundation@main
- bundle: my-capability:behaviors/my-capability # Behavior pattern
- bundle: "@my-capability:behaviors/my-capability" # Behavior pattern

---

Expand Down Expand Up @@ -100,7 +100,7 @@ bundle:

includes:
- bundle: git+https://github.com/microsoft/amplifier-foundation@main
- bundle: recipes:behaviors/recipes
- bundle: "@recipes:behaviors/recipes"
---

# Recipe System
Expand Down Expand Up @@ -164,7 +164,7 @@ Include a behavior in your bundle:
```yaml
includes:
- bundle: foundation
- bundle: my-capability:behaviors/my-capability # From same bundle
- bundle: "@my-capability:behaviors/my-capability" # From same bundle
- bundle: git+https://github.com/org/bundle@main#subdirectory=behaviors/foo.yaml # External
```

Expand Down Expand Up @@ -249,7 +249,7 @@ bundle:
name: my-capability
includes:
- bundle: foundation
- bundle: my-capability:behaviors/my-capability
- bundle: "@my-capability:behaviors/my-capability"
---

# My Capability
Expand Down Expand Up @@ -390,7 +390,7 @@ bundle:

includes:
- bundle: git+https://github.com/microsoft/amplifier-foundation@main
- bundle: my-capability:behaviors/my-capability
- bundle: "@my-capability:behaviors/my-capability"
---

# My Capability
Expand Down Expand Up @@ -553,7 +553,7 @@ bundle:

includes:
- bundle: foundation # Inherit from other bundles
- bundle: my-bundle:behaviors/x # Include behaviors
- bundle: "@my-bundle:behaviors/x" # Include behaviors

# Only declare tools NOT inherited from includes
tools:
Expand Down Expand Up @@ -612,14 +612,68 @@ includes:
- bundle: foundation # Well-known bundle name
- bundle: git+https://github.com/... # Git URL
- bundle: ./bundles/variant.yaml # Local file
- bundle: my-bundle:behaviors/foo # Behavior within same bundle
- bundle: "@my-bundle:behaviors/foo" # Behavior within same bundle
```

**Merge rules**:
- Later bundles override earlier ones
- `session`, `providers`, `tools`, `hooks` are deep-merged by module ID
- `agents` are merged by agent name
- `spawn` is deep-merged (later overrides earlier)

### Namespace Resolution Rules

**Critical**: Bundle namespace references in YAML frontmatter MUST start with `@`.

#### Context File Includes

✅ **Correct**:
```yaml
context:
include:
- "@foundation:context/shared/common-agent-base.md"
- "@my-bundle:context/instructions.md"
```

❌ **Incorrect** (will fail with "file not found"):
```yaml
context:
include:
- foundation:context/shared/common-agent-base.md # Missing @
```

#### Bundle Includes with Namespace References

✅ **Correct**:
```yaml
includes:
- bundle: foundation # Well-known name
- bundle: git+https://github.com/org/repo@main # Git URI
- bundle: "@my-bundle:behaviors/feature" # Namespace reference (needs @)
```

❌ **Incorrect**:
```yaml
includes:
- bundle: my-bundle:behaviors/feature # Missing @
```

#### Agents Include

✅ **Correct**:
```yaml
agents:
include:
- "@my-bundle:my-agent"
```

#### Markdown @mentions

In markdown body:
- Use `@bundle:path` for eager loading (loaded immediately)
- Use `bundle:path` (no `@`) for soft references (loaded on-demand by AI)

**Why the `@` prefix matters**: The `@` symbol triggers namespace resolution. Without it, the system treats the path as a literal string and fails to resolve it to the actual bundle resource.
- Markdown instructions replace entirely (later wins)

---
Expand Down