// CREATE/REPLAN Stories for Epic (5-10 Stories). Delegates ln-221-standards-researcher for standards research. Decompose-First Pattern. Auto-discovers team/Epic.
| name | ln-220-story-coordinator |
| description | CREATE/REPLAN Stories for Epic (5-10 Stories). Delegates ln-221-standards-researcher for standards research. Decompose-First Pattern. Auto-discovers team/Epic. |
Universal Story management coordinator that delegates CREATE/REPLAN operations to specialized workers after building IDEAL Story plan.
Use when:
Key principle: Build IDEAL Story plan FIRST, THEN check existing Stories to determine mode:
Rationale: Ensures consistent Story decomposition based on current Epic requirements, independent of existing Story structure (may be outdated).
Rule: Stories start from Story 1 (US001), NO Story 0 reserved.
Rationale:
Numbering within Epic:
Next Story Number: Incremented sequentially across ALL Epics (read from kanban_board.md Epic Story Counters table)
Objective: Gather context for Story planning (Epic details, planning questions, frontend context, fallback docs, user input)
Step 1: Discovery (Automated)
Auto-discovers from docs/tasks/kanban_board.md:
get_project(query="Epic N") → Fetch full Epic documentStep 2: Extract Planning Information (Automated)
Parses Epic structure for Story planning questions:
| Question | Extraction Source |
|---|---|
| Q1 - User/Persona | Epic Goal ("Enable [persona]...") + Scope In (user roles) |
| Q2 - What they want | Epic Scope In (capabilities) + functional requirements |
| Q3 - Why it matters | Epic Success Criteria (metrics) + Goal (business value) |
| Q4 - Which Epic | Already from Step 1 |
| Q5 - Main AC | Derive from Epic Scope In features → testable scenarios |
| Q6 - Application type | Epic Technical Notes (UI/API mentioned) → Default: API |
Step 3: Frontend Research (Optional)
Trigger: If Q2 (capabilities) OR Q5 (AC) missing after Step 2
Process:
Glob **/*.html, src/**/*.html<form id="login"> → "Given valid credentials, When submit, Then login success")<button id="register"> → "User registration")minlength="8" → "Given password <8 chars, Then error")Fallback: If no HTML → Skip to Step 4
Step 4: Fallback Search Chain
Objective: Fill missing Q1-Q6 BEFORE asking user.
For each question with no answer from Step 2-3:
| Question | Fallback Search |
|---|---|
| Q1 (User/Persona) | Search requirements.md for "User personas", "Actors" → Default "User" if not found |
| Q3 (Why it matters) | Search requirements.md for "Business objectives", "Goals" → Infer from Epic Success Criteria |
| Q6 (Application type) | Search tech_stack.md for "Frontend", "Backend", "API" → Default "API" |
Skip: Q2, Q5 (Epic + HTML are sources of truth), Q4 (already known)
Step 5: User Input (Only if Missing)
If still missing after Step 2 + 3 + 4:
If all questions answered from Epic OR HTML OR fallback: Skip user prompts, proceed to Phase 2
Output: Complete context (Epic details, next Story number, Q1-Q6 answers)
Objective: Research industry standards/patterns BEFORE Story generation to ensure implementation follows best practices.
Why: Prevents outdated patterns or RFC violations (e.g., OAuth without PKCE).
Process:
Skill(skill: "ln-221-standards-researcher", epic_description="[Epic full description]", story_domain="[domain]")Output: Standards Research stored for ALL Stories in Epic
Skip conditions:
Time-box: 15-20 minutes (handled by ln-221)
Note: Research done ONCE per Epic, results reused for all Stories (5-10 Stories benefit from single research)
Objective: Build IDEAL Story plan, determine execution mode
Story Grouping Guidelines:
Each Story = ONE vertical slice of user capability (end-to-end: UI → API → Service → DB).
✅ GOOD Story Grouping (1 Story = 1 user journey):
❌ BAD Story Grouping (horizontal slices):
Rule: 1 Story = 1 user capability = 3-5 AC = 6-20 hours = 10-28 tests
Build IDEAL Plan (Automated):
Analyze Epic Scope: Review features in Epic Scope In, identify user capabilities
Determine Story Count:
Story Size Guidelines:
| Criterion | Min | Max | Under-decomposed | Over-decomposed |
|---|---|---|---|---|
| AC | 3 | 5 | >5 AC (split) | <3 AC (merge) |
| Duration | 6h | 20h | >20h (split) | <6h (merge) |
| Tests | 10 | 28 | >28 tests (split) | <10 tests (merge) |
Over-decomposition indicators:
INVEST Checklist:
| Criterion | Check | ✅ GOOD | ❌ BAD |
|---|---|---|---|
| Independent | Can develop/deploy without blocking others | "Request OAuth token" (independent) | "Validate token" depends on "Request token" (merge or ensure API contract) |
| Negotiable | AC focus on WHAT, not HOW | "User gets valid token" (what) | "Use authlib 1.3.0, store in Redis" (how) |
| Valuable | Clear business value | "User refreshes expired token to maintain session" | "Add token_refresh table" (no user value) |
| Estimable | Can estimate 6-20h | Clear scope, known patterns, researched standards | "Implement authentication" (too vague) |
| Small | Fits 1-2 sprints | 3-5 AC, 6-20h | "Full OAuth flow" (>5 AC, >20h) |
| Testable | AC measurable | "Given valid refresh token, Then receive token <200ms" | "Token refresh should be fast" (not measurable) |
Output: IDEAL Story plan (5-10 Stories) with titles, statements, core AC, ordering
Objective: Determine execution mode based on existing Stories AND user intent
Process:
Query Linear for existing Stories in Epic:
list_issues(project=Epic.id, label="user-story")
Mode Detection:
Analyze user request for keywords:
Decision matrix:
| Condition | Mode | Delegate To |
|---|---|---|
| Count = 0 | CREATE | Phase 5a: ln-222-story-creator |
| Count ≥ 1 AND ADD keywords | ADD | Phase 5c: ln-222-story-creator (appendMode) |
| Count ≥ 1 AND REPLAN keywords | REPLAN | Phase 5b: ln-223-story-replanner |
| Count ≥ 1 AND ambiguous | ASK USER | "Add new Story or revise the plan?" |
Important: Orchestrator loads metadata ONLY (ID, title, status). Workers load FULL descriptions (token efficiency).
Output: Execution mode determined + existingCount for workers
Trigger: Epic has no Stories yet (first decomposition)
Delegation:
Call ln-222-story-creator via Skill tool:
Skill(
skill: "ln-222-story-creator",
epicData: {id, title, description},
idealPlan: [ /* 5-10 Stories from Phase 3 */ ],
standardsResearch: "Standards Research from Phase 2",
teamId: "team-id",
autoApprove: false // or true for automation
)
Worker handles:
Output: Created Story URLs + summary from worker
Trigger: Epic already has Stories (requirements changed)
Delegation:
Call ln-223-story-replanner via Skill tool:
Skill(
skill: "ln-223-story-replanner",
epicData: {id, title, description},
idealPlan: [ /* 5-10 Stories from Phase 3 */ ],
standardsResearch: "Standards Research from Phase 2",
existingCount: N,
teamId: "team-id",
autoApprove: false // or true for automation
)
Worker handles:
Output: Operation results + warnings + affected Story URLs from worker
Trigger: Epic has Stories, user wants to ADD more (not replan existing)
Delegation:
Call ln-222-story-creator via Skill tool with appendMode:
Skill(
skill: "ln-222-story-creator",
appendMode: true, // ADD to existing, don't replace
epicData: {id, title, description},
newStoryDescription: userRequestedStory, // Single Story from user request
standardsResearch: "Standards Research from Phase 2",
teamId: "team-id",
autoApprove: false
)
Key differences from CREATE MODE:
appendMode: true → Skip full IDEAL plan, create only requested StorynewStoryDescription → User's specific request (e.g., "add authorization Story")Worker handles:
Output: Created Story URL + summary from worker
TodoWrite format (mandatory): Add phases to todos before starting:
- Phase 1: Context Assembly (in_progress)
- Phase 2: Standards Research via ln-221 (pending)
- Phase 3: Build IDEAL Story Plan (pending)
- Phase 4: Check Existing Stories (pending)
- Phase 5: Delegate to ln-222/ln-223 (pending)
- Wait for worker result (pending)
Mark each as in_progress when starting, completed when done.
Calls:
Called by:
Upstream:
Downstream:
✅ Phase 1: Context Assembly Complete:
✅ Phase 2: Standards Research Complete:
✅ Phase 3: Planning Complete:
✅ Phase 4: Check Existing Complete:
✅ Phase 5: Delegation Complete:
CREATE MODE (First Time):
"Create stories for Epic 7: OAuth Authentication"
Process:
REPLAN MODE (Requirements Changed):
"Replan stories for Epic 7 - removed custom token formats, added scope management"
Process:
Story Content:
Story Decomposition:
User Interaction:
Delegation:
Version: 4.0.0 (BREAKING: Decomposed to Orchestrator-Worker pattern. Phase 4a/4b removed, replaced with Phase 5a/5b delegation to ln-222-story-creator/ln-223-story-replanner. Orchestrator loads metadata only, workers load full descriptions for token efficiency. Progressive Loading now handled by ln-223-story-replanner, not orchestrator. Story execution logic moved to workers, orchestrator focuses on context assembly, standards research, planning, mode determination, delegation.) Last Updated: 2025-11-20