Skip to content

Commit ff12d73

Browse files
Brian MadisonBrian Madison
authored andcommitted
fix: decouple critical_actions from hasSidecar configuration
critical_actions is for ANY activation behavior (loading files, startup tasks, data fetches), not just for agents with sidecars. Key changes: - Template: Changed `has_sidecar` to `has_critical_actions` condition - Validation: Agents WITHOUT sidecar CAN have critical_actions - Validation: Agents WITH sidecar MUST have critical_actions (for loading) - critical-actions.md: Clarified both configurations with examples - agent-compilation.md: Updated with both patterns - Edit flow: When removing sidecar, conditionally keep critical_actions - understanding-agent-types.md: Added comparison table row for critical_actions This corrects the misconception that only agents with sidecars have critical_actions - in reality, any agent may have activation behaviors.
1 parent b114905 commit ff12d73

11 files changed

Lines changed: 94 additions & 35 deletions

src/workflows/agent/data/agent-architecture.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,8 +323,8 @@ Two forms:
323323

324324
- [ ] Under ~250 lines
325325
- [ ] No external dependencies
326-
- [ ] No `critical_actions` section
327326
- [ ] No sidecar path references
327+
- [ ] If critical_actions present, no sidecar file references
328328

329329
### WITH Sidecar (hasSidecar: true)
330330

@@ -345,7 +345,7 @@ Two forms:
345345
4. **Sensible defaults** in install_config (if using)
346346
5. **Numbered steps** in multi-step prompts
347347
6. **Keep under ~250 lines** for agents without sidecar
348-
7. **critical_actions MANDATORY** for agents with sidecar
348+
7. **critical_actions** for any activation behavior (sidecar or other)
349349
8. **Enforce domain restrictions** for agents with sidecar
350350
9. **Reference past naturally** - Don't dump memory
351351
10. **Design for growth** - Structure for accumulation (with sidecar)

src/workflows/agent/data/agent-compilation.md

Lines changed: 32 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ agent:
4040
principles:
4141
- "Core belief or methodology"
4242

43-
critical_actions: # Optional - for Expert agents only
44-
- "Load ./sidecar/memories.md"
45-
- "Load ./sidecar/instructions.md"
46-
- "ONLY access ./sidecar/"
43+
critical_actions: # Optional - for any agent with activation behavior
44+
- "Load COMPLETE file {project-root}/_bmad/_memory/journal-sidecar/memories.md"
45+
- "Load COMPLETE file {project-root}/_bmad/_memory/journal-sidecar/instructions.md"
46+
- "ONLY read/write files in {project-root}/_bmad/_memory/journal-sidecar/"
4747

4848
prompts: # Optional - for Simple/Expert agents
4949
- id: prompt-name
@@ -220,34 +220,52 @@ When building agent YAML, **DO NOT:**
220220
**DO:**
221221
- [ ] Define metadata (id, name, title, icon, module)
222222
- [ ] Define persona (role, identity, communication_style, principles)
223-
- [ ] Define critical_actions (Expert agents only)
223+
- [ ] Define critical_actions (if agent has activation behavior)
224224
- [ ] Define prompts with IDs (Simple/Expert agents only)
225225
- [ ] Define menu with your custom items only
226226
- [ ] Use proper trigger format: `XX or fuzzy match on command-name`
227227
- [ ] Use proper description format: `[XX] Description text`
228228

229229
---
230230

231-
## Expert Agent: critical_actions
231+
## Agent critical_actions
232232

233-
For Expert agents with sidecars, your `critical_actions` become activation steps:
233+
For any agent with activation behavior, your `critical_actions` become activation steps.
234+
235+
### Agents with sidecar (hasSidecar: true):
234236

235237
```yaml
236238
critical_actions:
237-
- "Load COMPLETE file ./agent-sidecar/memories.md"
238-
- "Load COMPLETE file ./agent-sidecar/instructions.md"
239-
- "ONLY read/write files in ./agent-sidecar/"
239+
- "Load COMPLETE file {project-root}/_bmad/_memory/journal-sidecar/memories.md"
240+
- "Load COMPLETE file {project-root}/_bmad/_memory/journal-sidecar/instructions.md"
241+
- "ONLY read/write files in {project-root}/_bmad/_memory/journal-sidecar/"
240242
```
241243
242244
The compiler injects these as steps 4, 5, 6 in the activation block:
243245
244246
```xml
245-
<step n="4">Load COMPLETE file ./agent-sidecar/memories.md</step>
246-
<step n="5">Load COMPLETE file ./agent-sidecar/instructions.md</step>
247-
<step n="6">ONLY read/write files in ./agent-sidecar/</step>
247+
<step n="4">Load COMPLETE file {project-root}/_bmad/_memory/journal-sidecar/memories.md</step>
248+
<step n="5">Load COMPLETE file {project-root}/_bmad/_memory/journal-sidecar/instructions.md</step>
249+
<step n="6">ONLY read/write files in {project-root}/_bmad/_memory/journal-sidecar/</step>
248250
<step n="7">ALWAYS communicate in {communication_language}</step>
249251
```
250252

253+
### Agents without sidecar (hasSidecar: false):
254+
255+
```yaml
256+
critical_actions:
257+
- "Give user an inspirational quote before showing menu"
258+
- "Review {project-root}/finances/ for most recent data file"
259+
```
260+
261+
The compiler injects these as steps 4, 5 in the activation block:
262+
263+
```xml
264+
<step n="4">Give user an inspirational quote before showing menu</step>
265+
<step n="5">Review {project-root}/finances/ for most recent data file</step>
266+
<step n="6">ALWAYS communicate in {communication_language}</step>
267+
```
268+
251269
---
252270

253271
## Division of Responsibilities
@@ -269,5 +287,5 @@ The compiler injects these as steps 4, 5, 6 in the activation block:
269287
- **Focus on:** Clean YAML structure, persona definition, custom menu items
270288
- **Ignore:** What happens after compilation—that's the compiler's job
271289
- **Remember:** Every agent gets MH, CH, PM, DA automatically—don't add them
272-
- **Expert agents:** Use `critical_actions` for sidecar file loading
290+
- **critical_actions:** Use for activation behavior (loading files, greetings, data fetches)
273291
- **Module agents:** Use `workflow:` or `exec:` references, not inline actions

src/workflows/agent/data/agent-validation.md

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,20 @@ Validate agents meet BMAD quality standards. The validation approach depends on
8282

8383
- [ ] `agent.metadata.hasSidecar` is `false`
8484
- [ ] Single .agent.yaml file (no sidecar folder)
85-
- [ ] All content contained in YAML (no external file dependencies)
86-
- [ ] No `critical_actions` section
85+
- [ ] No `{project-root}/_bmad/_memory/` paths to sidecar folders
8786
- [ ] Total size under ~250 lines (unless justified)
8887

88+
### critical_actions Validation (OPTIONAL)
89+
90+
- [ ] If present, `critical_actions` contains activation behaviors
91+
- [ ] No references to sidecar files (no sidecar exists)
92+
- [ ] No placeholder text in critical_actions
93+
- [ ] No compiler-injected steps (Load persona, Load config, greeting, etc.)
94+
8995
### Path Validation
9096

9197
- [ ] No sidecar paths present
92-
- [ ] No `{project-root}/_bmad/_memory/` paths
98+
- [ ] No `{project-root}/_bmad/_memory/` paths to sidecar folders
9399

94100
### Reference Comparison
95101

@@ -102,7 +108,7 @@ Validate agents meet BMAD quality standards. The validation approach depends on
102108
### Structure Validation
103109

104110
- [ ] `agent.metadata.hasSidecar` is `true`
105-
- [ ] `agent.critical_actions` exists (MANDATORY)
111+
- [ ] `agent.metadata.sidecar-folder` is specified
106112
- [ ] Sidecar folder exists: `{agent-name}-sidecar/`
107113
- [ ] Folder name matches agent name
108114
- [ ] `instructions.md` exists in sidecar (recommended)
@@ -113,7 +119,7 @@ Validate agents meet BMAD quality standards. The validation approach depends on
113119
- [ ] **communication_style** includes memory reference patterns
114120
- [ ] Memory references feel natural: "Last time you mentioned..." or "I've noticed patterns..."
115121

116-
### critical_actions Validation (MANDATORY)
122+
### critical_actions Validation (MANDATORY for hasSidecar: true)
117123

118124
- [ ] `critical_actions` section exists
119125
- [ ] Contains at minimum 3 actions
@@ -206,6 +212,15 @@ critical_actions:
206212
- 'ONLY read/write files in {project-root}/_bmad/_memory/{sidecar-folder}/'
207213
```
208214
215+
### Issue: critical_actions for hasSidecar: false
216+
217+
**Note:** Agents without sidecar can have critical_actions for other activation behaviors:
218+
```yaml
219+
critical_actions:
220+
- 'Give user an inspirational quote before showing menu'
221+
- 'Review {project-root}/finances/ for most recent data file'
222+
```
223+
209224
### Issue: Communication Style Missing Memory References (hasSidecar: true)
210225
211226
**Fix:** Add memory reference patterns: "I reference past naturally: 'Last time you mentioned...'"

src/workflows/agent/data/critical-actions.md

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,20 @@ Numbered steps that execute FIRST when an agent activates.
1414
- Startup behavior (greeting enhancement, data fetch, state init)
1515
- Any MUST-do activation behavior
1616

17-
**Applies to:** BOTH Simple and Expert agents
17+
**Applies to:** BOTH agents with and without sidecar
1818

1919
---
2020

21-
## Expert Agent Pattern
21+
## Agent WITH Sidecar Pattern (hasSidecar: true)
22+
23+
Agents with sidecars use `critical_actions` to:
24+
1. Load sidecar memory files (memories.md, instructions.md)
25+
2. Set file access boundaries (restrict to sidecar folder only)
26+
3. Optionally write to memory during activation if needed
27+
4. Add any other startup behaviors specific to the agent
2228

2329
```yaml
24-
# ✅ CORRECT Expert Agent
30+
# ✅ CORRECT Agent with sidecar
2531
critical_actions:
2632
- 'Load COMPLETE file {project-root}/_bmad/_memory/journal-keeper-sidecar/memories.md'
2733
- 'Load COMPLETE file {project-root}/_bmad/_memory/journal-keeper-sidecar/instructions.md'
@@ -34,15 +40,20 @@ critical_actions:
3440
- Sidecar created next to agent.yaml during BUILD, then copied to `_memory/` during BMAD INSTALLATION
3541
- Use `{project-root}/_bmad/_memory/{sidecar-folder}/` format for RUNTIME paths in agent YAML
3642

43+
**MANDATORY for hasSidecar: true:** At minimum 3 actions for loading memories, instructions, and restricting file access.
44+
3745
---
3846

39-
## Simple Agent Pattern
47+
## Agent WITHOUT Sidecar Pattern (hasSidecar: false)
48+
49+
Agents without sidecars may use `critical_actions` for other activation behaviors:
4050

4151
```yaml
42-
# ✅ CORRECT Simple Agent with activation behavior
52+
# ✅ CORRECT Agent without sidecar, with activation behavior
4353
critical_actions:
4454
- 'Give user an inspirational quote before showing menu'
4555
- 'Review {project-root}/finances/ for most recent data file'
56+
- 'Fetch latest stock prices before displaying menu'
4657
```
4758

4859
**Note:** Agents without activation needs can omit `critical_actions` entirely.
@@ -53,8 +64,8 @@ critical_actions:
5364

5465
| Type | Pattern |
5566
|------|---------|
56-
| Expert sidecar | `{project-root}/_bmad/_memory/{sidecar-folder}/file.md` |
57-
| Simple data | `{project-root}/finances/data.csv` |
67+
| Sidecar memory | `{project-root}/_bmad/_memory/{sidecar-folder}/file.md` |
68+
| Other data | `{project-root}/finances/data.csv` |
5869
| Output folders | `{output_folder}/results/` |
5970

6071
---

src/workflows/agent/data/understanding-agent-types.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ agent-name.agent.yaml (~250 lines max)
7070
- Motivational Gym Bro (hype up your workout)
7171
- Sassy Fortune Teller (mystical snark)
7272

73+
**Optional critical_actions:**
74+
- Can have critical_actions for activation behaviors (quotes, data fetches, etc.)
75+
- Must NOT reference sidecar files (no sidecar exists)
76+
7377
**Reference:** `./data/reference/simple-examples/commit-poet.agent.yaml`
7478

7579
---
@@ -124,6 +128,7 @@ critical_actions:
124128
| ----------------- | ------------------------ | ------------------------------ |
125129
| File structure | Single YAML (~250 lines) | YAML + sidecar/ (files) |
126130
| Persistent memory | No | Yes |
131+
| critical_actions | Optional (other behaviors) | MANDATORY (load sidecar files) |
127132
| Custom workflows | Inline prompts | Sidecar workflows (on-demand) |
128133
| File access | Project/output | Restricted to sidecar domain |
129134
| Session state | Stateless | Remembers across sessions |

src/workflows/agent/steps-c/step-06-activation.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,12 +165,21 @@ Ask user:
165165
- Each action should be clear and scoped
166166
- Document rationale for each
167167

168-
**For agents WITH sidecar, critical_actions typically include:**
168+
**For agents WITH sidecar, critical_actions MUST include:**
169169
```
170170
- "Load COMPLETE file {project-root}/_bmad/_memory/{sidecar-folder}/memories.md"
171171
- "Load COMPLETE file {project-root}/_bmad/_memory/{sidecar-folder}/instructions.md"
172172
- "ONLY read/write files in {project-root}/_bmad/_memory/{sidecar-folder}/ - private space"
173173
```
174+
Plus any additional activation behaviors the agent needs.
175+
176+
**For agents WITHOUT sidecar, critical_actions are OPTIONAL and can include:**
177+
```
178+
- "Give user an inspirational quote before showing menu"
179+
- "Fetch latest data from {project-root}/finances/ before displaying menu"
180+
- "Display a quick status summary on activation"
181+
```
182+
Agents without sidecar omit critical_actions entirely if no activation behavior is needed.
174183

175184
**If omitting:**
176185
- State clearly: "This agent will not have critical_actions"

src/workflows/agent/steps-e/e-04-sidecar-metadata.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ If user wants metadata changes:
5757
**For sidecar conversion:**
5858
- "Converting from hasSidecar: {current} to {target}"
5959
- Explain implications:
60-
- false → true: Need to create sidecar folder, add critical_actions
61-
- true → false: Remove sidecar fields, remove critical_actions
60+
- false → true: Need to create sidecar folder, add critical_actions with sidecar file loading
61+
- true → false: Remove sidecar fields; if critical_actions only has sidecar references, remove section; otherwise keep non-sidecar critical_actions
6262
- Update editPlan with conversion
6363

6464
**For metadata field changes:**

src/workflows/agent/steps-e/e-08-edit-agent.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,8 @@ For each planned edit:
104104
**true → false (Removing sidecar):**
105105
- Set `hasSidecar: false`
106106
- Remove `metadata.sidecar-folder` and `metadata.sidecar-path`
107-
- Remove `critical_actions` section
107+
- If critical_actions contains only sidecar references, remove the section
108+
- If critical_actions contains non-sidecar activation behaviors, keep and clean sidecar references
108109
- Remove sidecar references from menu actions
109110
- Optionally archive sidecar folder
110111

src/workflows/agent/steps-v/v-02d-validate-structure.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ Perform these checks systematically - validate EVERY rule specified in agentComp
7979
**For Agents WITHOUT Sidecar (hasSidecar is false):**
8080
- [ ] No sidecar requirements
8181
- [ ] No sidecar-folder path in metadata
82-
- [ ] No critical_actions section
82+
- [ ] If critical_actions present, no sidecar file references
8383
- [ ] Menu handlers use only internal references (#) or inline prompts
8484
- [ ] Total size under ~250 lines (unless justified)
8585

src/workflows/agent/steps-v/v-02e-validate-sidecar.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ For each sidecar path reference in agent YAML:
8989
**IF hasSidecar = false:**
9090
- [ ] Mark sidecar validation as N/A
9191
- [ ] Confirm no sidecar-folder path in metadata
92-
- [ ] Confirm no critical_actions section
92+
- [ ] Confirm no sidecar references in critical_actions (if present)
9393
- [ ] Confirm no sidecar references in menu handlers
9494

9595
### 3. Append Findings to Report

0 commit comments

Comments
 (0)