feat: planning improvements — PRD express path, interface-first planning, living retrospective (#644)

Cherry-pick from @smledbetter with conflict resolution and project-specific reference removed.

Co-Authored-By: Stevo <smledbetter@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Lex Christopherson
2026-02-23 14:00:42 -06:00
parent 2fc9b1d6ae
commit 3fddd62d50
8 changed files with 302 additions and 2 deletions

View File

@@ -200,6 +200,16 @@ Each task: **15-60 minutes** Claude execution time.
**Combine signals:** One task sets up for the next, separate tasks touch same file, neither meaningful alone.
## Interface-First Task Ordering
When a plan creates new interfaces consumed by subsequent tasks:
1. **First task: Define contracts** — Create type files, interfaces, exports
2. **Middle tasks: Implement** — Build against the defined contracts
3. **Last task: Wire** — Connect implementations to consumers
This prevents the "scavenger hunt" anti-pattern where executors explore the codebase to understand contracts. They receive the contracts in the plan itself.
## Specificity Examples
| TOO VAGUE | JUST RIGHT |
@@ -445,6 +455,69 @@ After completion, create `.planning/phases/XX-name/{phase}-{plan}-SUMMARY.md`
Wave numbers are pre-computed during planning. Execute-phase reads `wave` directly from frontmatter.
## Interface Context for Executors
**Key insight:** "The difference between handing a contractor blueprints versus telling them 'build me a house.'"
When creating plans that depend on existing code or create new interfaces consumed by other plans:
### For plans that USE existing code:
After determining `files_modified`, extract the key interfaces/types/exports from the codebase that executors will need:
```bash
# Extract type definitions, interfaces, and exports from relevant files
grep -n "export\|interface\|type\|class\|function" {relevant_source_files} 2>/dev/null | head -50
```
Embed these in the plan's `<context>` section as an `<interfaces>` block:
```xml
<interfaces>
<!-- Key types and contracts the executor needs. Extracted from codebase. -->
<!-- Executor should use these directly — no codebase exploration needed. -->
From src/types/user.ts:
```typescript
export interface User {
id: string;
email: string;
name: string;
createdAt: Date;
}
```
From src/api/auth.ts:
```typescript
export function validateToken(token: string): Promise<User | null>;
export function createSession(user: User): Promise<SessionToken>;
```
</interfaces>
```
### For plans that CREATE new interfaces:
If this plan creates types/interfaces that later plans depend on, include a "Wave 0" skeleton step:
```xml
<task type="auto">
<name>Task 0: Write interface contracts</name>
<files>src/types/newFeature.ts</files>
<action>Create type definitions that downstream plans will implement against. These are the contracts — implementation comes in later tasks.</action>
<verify>File exists with exported types, no implementation</verify>
<done>Interface file committed, types exported</done>
</task>
```
### When to include interfaces:
- Plan touches files that import from other modules → extract those module's exports
- Plan creates a new API endpoint → extract the request/response types
- Plan modifies a component → extract its props interface
- Plan depends on a previous plan's output → extract the types from that plan's files_modified
### When to skip:
- Plan is self-contained (creates everything from scratch, no imports)
- Plan is pure configuration (no code interfaces involved)
- Level 0 discovery (all patterns already established)
## Context Section Rules
Only include prior plan SUMMARY references if genuinely needed (uses types/exports from prior plan, or prior plan made decision affecting this one).
@@ -954,6 +1027,16 @@ For phases not selected, retain from digest:
- `patterns`: Conventions to follow
**From STATE.md:** Decisions → constrain approach. Pending todos → candidates.
**From RETROSPECTIVE.md (if exists):**
```bash
cat .planning/RETROSPECTIVE.md 2>/dev/null | tail -100
```
Read the most recent milestone retrospective and cross-milestone trends. Extract:
- **Patterns to follow** from "What Worked" and "Patterns Established"
- **Patterns to avoid** from "What Was Inefficient" and "Key Lessons"
- **Cost patterns** to inform model selection and agent strategy
</step>
<step name="gather_phase_context">