fix: make plan command work without planner agent

This commit is contained in:
Affaan Mustafa
2026-04-29 22:11:35 -04:00
committed by Affaan Mustafa
parent 0dcde13384
commit 17aafc4506
2 changed files with 86 additions and 6 deletions

View File

@@ -4,7 +4,9 @@ description: Restate requirements, assess risks, and create step-by-step impleme
# Plan Command # Plan Command
This command invokes the **planner** agent to create a comprehensive implementation plan before writing any code. This command creates a comprehensive implementation plan before writing any code.
Run inline by default. Do not call the Task tool or any subagent by default. This keeps `/plan` usable from plugin installs that ship commands without agent files.
## What This Command Does ## What This Command Does
@@ -24,7 +26,7 @@ Use `/plan` when:
## How It Works ## How It Works
The planner agent will: The assistant will:
1. **Analyze the request** and restate requirements in clear terms 1. **Analyze the request** and restate requirements in clear terms
2. **Break down into phases** with specific, actionable steps 2. **Break down into phases** with specific, actionable steps
@@ -38,7 +40,7 @@ The planner agent will:
``` ```
User: /plan I need to add real-time notifications when markets resolve User: /plan I need to add real-time notifications when markets resolve
Agent (planner): Assistant:
# Implementation Plan: Real-Time Market Resolution Notifications # Implementation Plan: Real-Time Market Resolution Notifications
## Requirements Restatement ## Requirements Restatement
@@ -93,7 +95,7 @@ Agent (planner):
## Important Notes ## Important Notes
**CRITICAL**: The planner agent will **NOT** write any code until you explicitly confirm the plan with "yes" or "proceed" or similar affirmative response. **CRITICAL**: This command will **NOT** write any code until you explicitly confirm the plan with "yes" or "proceed" or similar affirmative response.
If you want changes, respond with: If you want changes, respond with:
- "modify: [your changes]" - "modify: [your changes]"
@@ -109,9 +111,11 @@ After planning:
> **Need deeper planning?** Use `/prp-plan` for artifact-producing planning with PRD integration, codebase analysis, and pattern extraction. Use `/prp-implement` to execute those plans with rigorous validation loops. > **Need deeper planning?** Use `/prp-plan` for artifact-producing planning with PRD integration, codebase analysis, and pattern extraction. Use `/prp-implement` to execute those plans with rigorous validation loops.
## Related Agents ## Optional Planner Agent
This command invokes the `planner` agent provided by ECC. ECC also provides a `planner` agent for manual installs that include agent files. Use it only when the local runtime already exposes that subagent and the user explicitly asks you to delegate planning.
If the `planner` subagent is unavailable, continue planning inline instead of surfacing an "Agent type 'planner' not found" error.
For manual installs, the source file lives at: For manual installs, the source file lives at:
`agents/planner.md` `agents/planner.md`

View File

@@ -0,0 +1,76 @@
'use strict';
const assert = require('assert');
const fs = require('fs');
const path = require('path');
const repoRoot = path.resolve(__dirname, '..', '..');
const planCommandPath = path.join(repoRoot, 'commands', 'plan.md');
let passed = 0;
let failed = 0;
function test(name, fn) {
try {
fn();
console.log(`${name}`);
passed++;
} catch (error) {
console.log(`${name}`);
console.log(` Error: ${error.message}`);
failed++;
}
}
function readPlanCommand() {
return fs.readFileSync(planCommandPath, 'utf8');
}
console.log('\n=== Testing /plan command prompt ===\n');
test('/plan runs inline by default without requiring planner agent installation', () => {
const source = readPlanCommand();
assert.ok(
source.includes('Do not call the Task tool or any subagent by default'),
'Expected /plan to avoid default subagent delegation',
);
assert.ok(
source.includes('If the `planner` subagent is unavailable'),
'Expected /plan to define a planner-unavailable fallback',
);
assert.ok(
!source.includes('This command invokes the **planner** agent'),
'Expected /plan not to claim unconditional planner invocation',
);
assert.ok(
!source.includes('The planner agent will:'),
'Expected /plan to describe inline behavior, not mandatory agent behavior',
);
assert.ok(
!source.includes('Agent (planner):'),
'Expected /plan examples not to imply the planner agent is required',
);
});
test('/plan preserves the explicit confirmation gate before code edits', () => {
const source = readPlanCommand();
assert.ok(
source.includes('WAIT for user CONFIRM before touching any code'),
'Expected frontmatter to preserve the no-code-before-confirmation rule',
);
assert.ok(
source.includes('WAITING FOR CONFIRMATION'),
'Expected example output to preserve the confirmation handoff',
);
assert.ok(
source.includes('will **NOT** write any code until you explicitly confirm'),
'Expected important notes to preserve the confirmation contract',
);
});
console.log(`\nPassed: ${passed}`);
console.log(`Failed: ${failed}`);
process.exit(failed > 0 ? 1 : 0);