From 825b3a609b3a4dd97435a0a44be4bdafbb914355 Mon Sep 17 00:00:00 2001 From: Sallvainian Date: Wed, 18 Mar 2026 21:13:25 -0400 Subject: [PATCH] fix: restore deleted agent-component fragments that break CIS compilation PR #2050 deleted src/utility/agent-components/ during the phase-based refactor, but tools/cli/lib/activation-builder.js still references these fragment files via loadFragment(). This causes agent compilation to fail with "Fragment not found: activation-steps.txt" for any agent that uses the ActivationBuilder pipeline. Restores all 10 fragment files from their pre-deletion state. Co-Authored-By: Claude Opus 4.6 (1M context) --- .../agent-components/activation-rules.txt | 6 +++ .../agent-components/activation-steps.txt | 14 +++++++ .../agent-components/agent-command-header.md | 1 + .../agent.customize.template.yaml | 41 +++++++++++++++++++ .../agent-components/handler-action.txt | 4 ++ src/utility/agent-components/handler-data.txt | 5 +++ src/utility/agent-components/handler-exec.txt | 6 +++ .../agent-components/handler-multi.txt | 13 ++++++ src/utility/agent-components/handler-tmpl.txt | 5 +++ .../agent-components/menu-handlers.txt | 6 +++ 10 files changed, 101 insertions(+) create mode 100644 src/utility/agent-components/activation-rules.txt create mode 100644 src/utility/agent-components/activation-steps.txt create mode 100644 src/utility/agent-components/agent-command-header.md create mode 100644 src/utility/agent-components/agent.customize.template.yaml create mode 100644 src/utility/agent-components/handler-action.txt create mode 100644 src/utility/agent-components/handler-data.txt create mode 100644 src/utility/agent-components/handler-exec.txt create mode 100644 src/utility/agent-components/handler-multi.txt create mode 100644 src/utility/agent-components/handler-tmpl.txt create mode 100644 src/utility/agent-components/menu-handlers.txt diff --git a/src/utility/agent-components/activation-rules.txt b/src/utility/agent-components/activation-rules.txt new file mode 100644 index 000000000..a67ae4993 --- /dev/null +++ b/src/utility/agent-components/activation-rules.txt @@ -0,0 +1,6 @@ + + ALWAYS communicate in {communication_language} UNLESS contradicted by communication_style. + Stay in character until exit selected + Display Menu items as the item dictates and in the order given. + Load files ONLY when executing a user chosen workflow or a command requires it, EXCEPTION: agent activation step 2 config.yaml + \ No newline at end of file diff --git a/src/utility/agent-components/activation-steps.txt b/src/utility/agent-components/activation-steps.txt new file mode 100644 index 000000000..726be3e06 --- /dev/null +++ b/src/utility/agent-components/activation-steps.txt @@ -0,0 +1,14 @@ + Load persona from this current agent file (already in context) + 🚨 IMMEDIATE ACTION REQUIRED - BEFORE ANY OUTPUT: + - Load and read {project-root}/_bmad/{{module}}/config.yaml NOW + - Store ALL fields as session variables: {user_name}, {communication_language}, {output_folder} + - VERIFY: If config not loaded, STOP and report error to user + - DO NOT PROCEED to step 3 until config is successfully loaded and variables stored + + Remember: user's name is {user_name} + {AGENT_SPECIFIC_STEPS} + Show greeting using {user_name} from config, communicate in {communication_language}, then display numbered list of ALL menu items from menu section + Let {user_name} know they can invoke the `bmad-help` skill at any time to get advice on what to do next, and that they can combine it with what they need help with Invoke the `bmad-help` skill with a question like "where should I start with an idea I have that does XYZ?" + STOP and WAIT for user input - do NOT execute menu items automatically - accept number or cmd trigger or fuzzy command match + On user input: Number → process menu item[n] | Text → case-insensitive substring match | Multiple matches → ask user to clarify | No match → show "Not recognized" + When processing a menu item: Check menu-handlers section below - extract any attributes from the selected menu item (exec, tmpl, data, action, multi) and follow the corresponding handler instructions diff --git a/src/utility/agent-components/agent-command-header.md b/src/utility/agent-components/agent-command-header.md new file mode 100644 index 000000000..d4f9b5d6a --- /dev/null +++ b/src/utility/agent-components/agent-command-header.md @@ -0,0 +1 @@ +You must fully embody this agent's persona and follow all activation instructions, steps and rules exactly as specified. NEVER break character until given an exit command. diff --git a/src/utility/agent-components/agent.customize.template.yaml b/src/utility/agent-components/agent.customize.template.yaml new file mode 100644 index 000000000..b8cc648b4 --- /dev/null +++ b/src/utility/agent-components/agent.customize.template.yaml @@ -0,0 +1,41 @@ +# Agent Customization +# Customize any section below - all are optional + +# Override agent name +agent: + metadata: + name: "" + +# Replace entire persona (not merged) +persona: + role: "" + identity: "" + communication_style: "" + principles: [] + +# Add custom critical actions (appended after standard config loading) +critical_actions: [] + +# Add persistent memories for the agent +memories: [] +# Example: +# memories: +# - "User prefers detailed technical explanations" +# - "Current project uses React and TypeScript" + +# Add custom menu items (appended to base menu) +# Don't include * prefix or help/exit - auto-injected +menu: [] +# Example: +# menu: +# - trigger: my-workflow +# workflow: "{project-root}/custom/my.yaml" +# description: My custom workflow + +# Add custom prompts (for action="#id" handlers) +prompts: [] +# Example: +# prompts: +# - id: my-prompt +# content: | +# Prompt instructions here diff --git a/src/utility/agent-components/handler-action.txt b/src/utility/agent-components/handler-action.txt new file mode 100644 index 000000000..db31f4852 --- /dev/null +++ b/src/utility/agent-components/handler-action.txt @@ -0,0 +1,4 @@ + + When menu item has: action="#id" → Find prompt with id="id" in current agent XML, follow its content + When menu item has: action="text" → Follow the text directly as an inline instruction + \ No newline at end of file diff --git a/src/utility/agent-components/handler-data.txt b/src/utility/agent-components/handler-data.txt new file mode 100644 index 000000000..14036fa58 --- /dev/null +++ b/src/utility/agent-components/handler-data.txt @@ -0,0 +1,5 @@ + + When menu item has: data="path/to/file.json|yaml|yml|csv|xml" + Load the file first, parse according to extension + Make available as {data} variable to subsequent handler operations + diff --git a/src/utility/agent-components/handler-exec.txt b/src/utility/agent-components/handler-exec.txt new file mode 100644 index 000000000..1c8459a64 --- /dev/null +++ b/src/utility/agent-components/handler-exec.txt @@ -0,0 +1,6 @@ + + When menu item or handler has: exec="path/to/file.md": + 1. Read fully and follow the file at that path + 2. Process the complete file and follow all instructions within it + 3. If there is data="some/path/data-foo.md" with the same item, pass that data path to the executed file as context. + \ No newline at end of file diff --git a/src/utility/agent-components/handler-multi.txt b/src/utility/agent-components/handler-multi.txt new file mode 100644 index 000000000..e05be2390 --- /dev/null +++ b/src/utility/agent-components/handler-multi.txt @@ -0,0 +1,13 @@ + + When menu item has: type="multi" with nested handlers + 1. Display the multi item text as a single menu option + 2. Parse all nested handlers within the multi item + 3. For each nested handler: + - Use the 'match' attribute for fuzzy matching user input (or Exact Match of character code in brackets []) + - Process based on handler attributes (exec, action) + 4. When user input matches a handler's 'match' pattern: + - For exec="path/to/file.md": follow the `handler type="exec"` instructions + - For action="...": Perform the specified action directly + 5. Support both exact matches and fuzzy matching based on the match attribute + 6. If no handler matches, prompt user to choose from available options + \ No newline at end of file diff --git a/src/utility/agent-components/handler-tmpl.txt b/src/utility/agent-components/handler-tmpl.txt new file mode 100644 index 000000000..a190504b7 --- /dev/null +++ b/src/utility/agent-components/handler-tmpl.txt @@ -0,0 +1,5 @@ + + 1. When menu item has: tmpl="path/to/template.md" + 2. Load template file, parse as markdown with {{mustache}} style variables + 3. Make template content available as {template} to action/exec/workflow handlers + \ No newline at end of file diff --git a/src/utility/agent-components/menu-handlers.txt b/src/utility/agent-components/menu-handlers.txt new file mode 100644 index 000000000..3dd1ae9c7 --- /dev/null +++ b/src/utility/agent-components/menu-handlers.txt @@ -0,0 +1,6 @@ + + {DYNAMIC_EXTRACT_LIST} + + {DYNAMIC_HANDLERS} + +