Skip to content

Commit 1a2a3ad

Browse files
committed
feat(error-handling): add error escalation protocol to agent templates
Add standardized error escalation protocol across all agent templates to ensure consistent error handling Include new error-escalation.md shared instruction file Update placeholder configuration to include error escalation template path
1 parent 3dc5f7e commit 1a2a3ad

17 files changed

+76
-4
lines changed

config/placeholders.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,6 @@ module.exports = {
2222
smart_anchor: path.join('prompts', 'templates', 'codemachine', 'shared-instructions', 'smart-anchor.md'),
2323
command_constraints: path.join('prompts', 'templates', 'codemachine', 'shared-instructions', 'command-constraints.md'),
2424
atomic_generation: path.join('prompts', 'templates', 'codemachine', 'shared-instructions', 'atomic-generation.md'),
25+
error_escalation: path.join('prompts', 'templates', 'codemachine', 'shared-instructions', 'error-escalation.md'),
2526
}
2627
};

prompts/templates/codemachine/main-agents/00-init.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,6 @@
1616
.codemachine/template.json
1717
```
1818
19-
**Constraint:** All commands must be safe to run in any repository state, including a newly initialized repository with no commits (an "unborn branch") or a repository in a "detached HEAD" state.
19+
**Constraint:** All commands must be safe to run in any repository state, including a newly initialized repository with no commits (an "unborn branch") or a repository in a "detached HEAD" state.
20+
21+
{error_escalation}

prompts/templates/codemachine/main-agents/01-principal-analyst.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,4 +124,6 @@ The generated artifact **MUST** adhere to the specified assertions count range f
124124
- Each assertion block should be 15-40 lines.
125125
- Always include: Observation, Architectural Impact, Default Assumption & Required Action.
126126
- Solution paths should be presented as clear, mutually exclusive alternatives (Path A, Path B, Tier 1, etc.).
127-
- The focus must remain on architecturally significant variables.
127+
- The focus must remain on architecturally significant variables.
128+
129+
{error_escalation}

prompts/templates/codemachine/main-agents/02-blueprint-orchestrator.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,17 @@ Your primary directive is successful execution. If anomalies occur, you must fol
104104
* **Specific Edge Cases:**
105105
* **File System Errors:** If any `ls` command or file system check returns a permission error or other system-level failure, **STOP** immediately and escalate. Report the system error you received.
106106
107+
* **Command Execution Failures:**
108+
* If the `codemachine run` command fails to execute (command not found, syntax errors, shell errors), do **NOT** attempt to debug or try alternative approaches.
109+
* **STOP IMMEDIATELY** and use the error escalation protocol. Write to behavior.json with action "error" and include the exact error message.
110+
107111
<br>
108112
109113
**6. Constraints**
110114
111115
* **No Complex Debugging:** Do not analyze the content of files or attempt to debug *why* an agent failed. Your role is to execute, check for files, read summaries, and follow the failure protocol.
112116
* **Speed and Specificity:** Your reactions must be fast and limited to the scope of this protocol. Do not introduce any steps not explicitly mentioned.
113-
* **Cost Efficiency:** Your purpose is to avoid unnecessary costs. Adhere strictly to the "Resilience Protocol" and the single-retry limit.
117+
* **Cost Efficiency:** Your purpose is to avoid unnecessary costs. Adhere strictly to the "Resilience Protocol" and the single-retry limit.
118+
* **No Alternative Behaviors:** If commands fail, escalate immediately via the error protocol. Do not attempt workarounds, alternative commands, or creative solutions.
119+
120+
{error_escalation}

prompts/templates/codemachine/main-agents/03-planning-agent.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ The plan must follow this specific structure and include all the detailed fields
6464
6565
{command_constraints}
6666
67+
{error_escalation}
68+
6769
{atomic_generation}
6870
6971
## 5. Iteration Plan

prompts/templates/codemachine/main-agents/04-task-breakdown-agent.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ You MUST follow these steps in the exact order specified. Do not proceed to the
99

1010
{command_constraints}
1111

12+
{error_escalation}
13+
1214
---
1315

1416
### **Workflow**

prompts/templates/codemachine/main-agents/05-context-manager-agent.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,6 @@ You are an **AI Technical Lead Analyst**. Your purpose is to act as a senior dev
5656

5757
### **Output Specification for `context.md`**
5858

59-
{context_output_format}
59+
{context_output_format}
60+
61+
{error_escalation}

prompts/templates/codemachine/main-agents/06-code-generation-agent.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ You are an expert developer working collaboratively on a project. Given the foll
7474
6. Follow the design instructions.
7575
7. After completing the implementation, update any relevant documentation (README files, API docs, inline comments, etc.) to reflect the changes made.
7676

77+
{error_escalation}
78+
7779
## Contextual Information:
7880

7981
{context}

prompts/templates/codemachine/main-agents/07-task-validation-agent.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ Your Verification and Correction Process:
7373

7474
**Do not simply report issues - take action to resolve them until the code fully meets all acceptance criteria.**
7575

76+
{error_escalation}
77+
7678
## Contextual Information:
7779

7880
{context}

prompts/templates/codemachine/main-agents/08-runtime-preparation-agent.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ Follow the detailed instructions for each script:
7676

7777
---
7878

79+
{error_escalation}
80+
7981
## Contextual Information:
8082

8183
Codebase

0 commit comments

Comments
 (0)