ln-222-story-replanner
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseStory Replanner
Story 重规划器
Universal replanner worker for updating Stories in Epic when requirements change. Invoked by ln-220-story-coordinator (count ≥ 1).
一款通用的重规划服务,用于在Epic需求变更时更新其中的Story。由ln-220-story-coordinator调用(调用次数≥1)。
When Invoked
调用时机
ln-220-story-coordinator REPLAN MODE (Phase 5b):
- Epic has existing Stories (Linear query count ≥ 1)
- IDEAL plan generated (Phase 3)
- Standards Research completed by ln-001 (Phase 2, may be updated)
- Epic requirements changed (AC modified, features added/removed, standards updated)
- Parameters: ,
epicData,idealPlan,standardsResearch,existingStoryIds,teamIdautoApprove
ln-220-story-coordinator 重规划模式(阶段5b):
- Epic中已存在Story(Linear查询结果数量≥1)
- 已生成IDEAL方案(阶段3)
- ln-001已完成标准调研(阶段2,可能已更新)
- Epic需求发生变更(验收准则修改、功能增删、标准更新)
- 参数:,
epicData,idealPlan,standardsResearch,existingStoryIds,teamIdautoApprove
Input Parameters
输入参数
From ln-220-story-coordinator:
javascript
{
epicData: {id, title, description},
idealPlan: [{number, title, statement, ac, technicalNotes, estimatedHours, testCounts}],
standardsResearch: "OAuth 2.0 (RFC 6749)...", // May differ from existing
existingStoryIds: ["STORY-123", "STORY-124"], // Metadata only
teamId: "team-id",
autoApprove: true
}来自ln-220-story-coordinator:
javascript
{
epicData: {id, title, description},
idealPlan: [{number, title, statement, ac, technicalNotes, estimatedHours, testCounts}],
standardsResearch: "OAuth 2.0 (RFC 6749)...", // 可能与现有内容不同
existingStoryIds: ["STORY-123", "STORY-124"], // 仅元数据
teamId: "team-id",
autoApprove: true
}Workflow
工作流
Phase 1: Load Existing Stories
阶段1:加载现有Story
Progressive Loading for token efficiency:
Step 1: Orchestrator provides Story metadata (ID, title, status)
Step 2: Load FULL descriptions ONE BY ONE
javascript
for each story_id:
get_issue(id=story_id) // ~5,000 tokens per StoryToken Rationale: 10 Stories × 5,000 = 50,000 tokens. Load sequentially to manage context.
Step 3: Parse 8 sections for each Story
- Story Statement (persona, capability, value)
- Context
- Acceptance Criteria (3-5 GWT)
- Test Strategy
- Technical Notes (Standards Research in Library Research subsection)
- Definition of Done
- Dependencies
Step 4: Extract metadata
- ID, number, title, status
- Persona, capability, value
- AC scenarios
- Standards Research (from Technical Notes)
Output: Array of N existing Story structures ready for comparison.
为提升Token效率的渐进式加载:
步骤1: 协调器提供Story元数据(ID、标题、状态)
步骤2: 逐个加载完整描述
javascript
for each story_id:
get_issue(id=story_id) // 每个Story约5000 TokenToken使用说明: 10个Story × 5000 = 50000 Token。按顺序加载以管理上下文。
步骤3: 解析每个Story的8个部分
- Story 描述(角色、能力、价值)
- 上下文
- 验收准则(3-5个GWT格式)
- 测试策略
- 技术说明(标准调研位于“库调研”子部分)
- 完成定义
- 依赖关系
步骤4: 提取元数据
- ID、编号、标题、状态
- 角色、能力、价值
- 验收准则场景
- 标准调研(来自技术说明)
输出: 包含N个现有Story结构的数组,可用于对比。
Phase 2: Compare IDEAL vs Existing
阶段2:对比IDEAL方案与现有方案
Algorithm: See replan_algorithm_stories.md
Match by goal, persona, capability:
For EACH Story in IDEAL:
- Extract: Title, Persona, Capability
- Search existing: Fuzzy match title, check persona/capability overlap
- Result: Match → KEEP/UPDATE | No match → CREATE
For EACH existing Story:
- Extract: Title, Persona, Capability (from Story Statement)
- Search IDEAL: Fuzzy match
- Result: Match → KEEP/UPDATE | No match → OBSOLETE
Categorize operations:
| Operation | Criteria | Status Constraint | Action |
|---|---|---|---|
| KEEP | Goal + Persona + Capability + AC + Standards Research same | Any | None |
| UPDATE | Match + (AC OR Standards Research OR Technical Notes changed) | Backlog/Todo ✅<br>In Progress/Review ⚠️<br>Done ❌ | |
| OBSOLETE | No match + Feature removed | Backlog/Todo ✅<br>In Progress/Review ⚠️<br>Done ❌ | |
| CREATE | In IDEAL + No match + New requirement | N/A | Generate doc + |
Edge Cases:
| Case | Action |
|---|---|
| In Progress OBSOLETE | ⚠️ NO auto-cancel, show warning |
| Done conflicts | Preserve Done, CREATE follow-up |
| Story Split (1 → 2+) | ⚠️ UPDATE first + CREATE new |
| Story Merge (2+ → 1) | ⚠️ UPDATE first + OBSOLETE rest |
| Ambiguous match (>70% similarity) | Show all, select highest |
Details: replan_algorithm_stories.md
算法: 参见 replan_algorithm_stories.md
按目标、角色、能力匹配:
针对IDEAL方案中的每个Story:
- 提取:标题、角色、能力
- 在现有Story中搜索:标题模糊匹配,检查角色/能力重叠
- 结果:匹配 → 保留/更新 | 不匹配 → 创建
针对每个现有Story:
- 提取:标题、角色、能力(来自Story描述)
- 在IDEAL方案中搜索:模糊匹配
- 结果:匹配 → 保留/更新 | 不匹配 → 废弃
操作分类:
| 操作 | 判定条件 | 状态约束 | 动作 |
|---|---|---|---|
| 保留 | 目标+角色+能力+验收准则+标准调研均一致 | 任意 | 无 |
| 更新 | 匹配 +(验收准则/标准调研/技术说明发生变化) | 待办/待处理 ✅<br>进行中/评审中 ⚠️<br>已完成 ❌ | |
| 废弃 | 不匹配 + 功能已移除 | 待办/待处理 ✅<br>进行中/评审中 ⚠️<br>已完成 ❌ | |
| 创建 | 存在于IDEAL方案 + 无匹配 + 新需求 | N/A | 生成文档 + |
边缘情况:
| 场景 | 动作 |
|---|---|
| 进行中的Story需要废弃 | ⚠️ 不自动取消,显示警告 |
| 已完成Story存在冲突 | 保留已完成内容,创建后续Story |
| Story拆分(1个拆分为2个及以上) | ⚠️ 先更新原Story + 创建新Story |
| Story合并(2个及以上合并为1个) | ⚠️ 先更新目标Story + 废弃其余Story |
| 模糊匹配(相似度>70%) | 显示所有匹配项,选择相似度最高的 |
详情: replan_algorithm_stories.md
Phase 3: Show Operations Summary
阶段3:显示操作汇总
REPLAN SUMMARY for Epic 7: OAuth Authentication
IDEAL PLAN:
1. US004: Register OAuth client (Persona: Third-party developer)
2. US005: Request access token ← AC5 ADDED! ← RFC 7636 PKCE ADDED!
3. US006: Validate access token
4. US009: Token scope management (NEW!)
EXISTING STORIES:
✓ US004 - Status: Done - KEEP
⚠ US005 - Status: Todo - UPDATE
Changes: Add AC5, Add RFC 7636 to Technical Notes, Add 2 Integration tests
Diff (AC): + AC5 "Given public client, When request with PKCE..."
Diff (Technical Notes): + RFC 7636 (PKCE)
✗ US008 - Status: Todo - OBSOLETE (feature removed)
+ US009 - NEW (14h, 20 tests, OAuth 2.0 Scope standard)
OPERATIONS: 2 keep, 1 update, 1 cancel, 1 create
WARNINGS:
- ⚠️ US005 (Todo): AC changed, Standards Research updated
- ⚠️ US008 (Todo): Feature removed - check dependencies
Type "confirm" to execute.Diffs show:
- AC changes (line-by-line)
- Standards Research changes (added/removed RFCs)
- Test Strategy changes (test counts)
Warnings for:
- Status conflicts (In Progress/Review affected)
- Story Split/Merge detected
- Ambiguous matches
Epic 7:OAuth认证 重规划汇总
IDEAL方案:
1. US004:注册OAuth客户端(角色:第三方开发者)
2. US005:请求访问令牌 ← 新增AC5! ← 新增RFC 7636 PKCE!
3. US006:验证访问令牌
4. US009:令牌范围管理(新增!)
现有Story:
✓ US004 - 状态:已完成 - 保留
⚠ US005 - 状态:待处理 - 更新
变更:新增AC5、在技术说明中添加RFC 7636、新增2个集成测试
差异(验收准则):+ AC5 "给定公开客户端,当使用PKCE请求时..."
差异(技术说明):+ RFC 7636 (PKCE)
✗ US008 - 状态:待处理 - 废弃(功能已移除)
+ US009 - 新增(14小时,20个测试,OAuth 2.0范围标准)
操作统计:2个保留,1个更新,1个取消,1个创建
警告:
- ⚠️ US005(待处理):验收准则变更,标准调研已更新
- ⚠️ US008(待处理):功能已移除 - 请检查依赖关系
输入"confirm"以执行。差异展示内容:
- 验收准则变更(逐行对比)
- 标准调研变更(新增/移除的RFC)
- 测试策略变更(测试数量)
警告场景:
- 状态冲突(影响进行中/评审中的Story)
- 检测到Story拆分/合并
- 模糊匹配
Phase 4: User Confirmation
阶段4:用户确认
If autoApprove=true: Skip → Phase 5
Otherwise: Wait for "confirm"
Adjustment: User can request changes → Recategorize → Show updated summary → Loop until "confirm"
若autoApprove=true: 跳过 → 阶段5
否则: 等待用户输入"confirm"
调整: 用户可请求变更 → 重新分类 → 显示更新后的汇总 → 循环直至用户输入"confirm"
Phase 5: Execute Operations
阶段5:执行操作
Sequence: UPDATE → OBSOLETE → CREATE → Update kanban
UPDATE operations:
- Generate new Story document (load via Template Loading logic)
- Validate INVEST (same as ln-221-story-creator Phase 2)
update_issue(id, description=new_description)- Add comment: "Story updated: AC changed (AC5 added), Standards Research updated (RFC 7636)"
OBSOLETE operations:
update_issue(id, state="Canceled")- Add comment: "Story canceled: Feature removed from Epic Scope In. Reason: [details]"
CREATE operations:
- Generate Story document (same as ln-221-story-creator Phase 1)
- Validate INVEST
create_issue({title, description, project=Epic, team, labels=["user-story"], state="Backlog"})
Update kanban_board.md:
DELETE (OBSOLETE): Remove canceled Story lines, remove task lines if any, remove Epic header if empty
CREATE (NEW): Find → Search Epic group → Add Stories (2-space indent)
### BacklogUPDATE Epic Story Counters: Last Story, Next Story
Return:
REPLAN EXECUTED for Epic 7
OPERATIONS SUMMARY:
✓ Kept: 2 Stories
✓ Updated: 1 Story (AC/Standards Research changed)
✓ Canceled: 1 Story (feature removed)
✓ Created: 1 Story (new requirement)
UPDATED: [ID: US005](url) - AC5 added, RFC 7636 PKCE added
CANCELED: US008 Custom token formats
NEW: [ID: US009](url) - Token scope management
WARNINGS: US005 (Todo) AC changed
✓ kanban_board.md updated
✓ Standards Research updates: RFC 7636 PKCE added to US005
NEXT STEPS:
1. Review warnings
2. Run ln-310-story-validator on updated/created Stories
3. Use ln-300-task-coordinator to create/replan tasks顺序: 更新 → 废弃 → 创建 → 更新看板
更新操作:
- 生成新的Story文档(通过模板加载逻辑加载)
- 验证INVEST准则(与ln-221-story-creator阶段2一致)
update_issue(id, description=new_description)- 添加评论:"Story已更新:验收准则变更(新增AC5),标准调研已更新(RFC 7636)"
废弃操作:
update_issue(id, state="Canceled")- 添加评论:"Story已取消:功能已从Epic范围中移除。原因:[详情]"
创建操作:
- 生成Story文档(与ln-221-story-creator阶段1一致)
- 验证INVEST准则
create_issue({title, description, project=Epic, team, labels=["user-story"], state="Backlog"})
更新kanban_board.md:
删除(废弃): 移除已取消的Story行,若有任务行也一并移除,若Epic标题下无内容则移除该标题
创建(新增): 找到 → 搜索Epic分组 → 添加Story(缩进2个空格)
### Backlog更新Epic Story计数器: 最后一个Story编号、下一个Story编号
返回结果:
Epic 7 重规划已执行
操作汇总:
✓ 保留:2个Story
✓ 更新:1个Story(验收准则/标准调研变更)
✓ 取消:1个Story(功能已移除)
✓ 创建:1个Story(新需求)
已更新:[ID: US005](url) - 新增AC5,新增RFC 7636 PKCE
已取消:US008 自定义令牌格式
新增:[ID: US009](url) - 令牌范围管理
警告:US005(待处理)验收准则变更
✓ kanban_board.md已更新
✓ 标准调研更新:US005中新增RFC 7636 PKCE
下一步:
1. 查看警告
2. 对已更新/创建的Story运行ln-310-story-validator
3. 使用ln-300-task-coordinator创建/重规划任务Critical Rules
核心规则
| Rule | Description |
|---|---|
| Status Constraints | UPDATE/OBSOLETE: Backlog/Todo ✅, In Progress/Review ⚠️, Done ❌ |
| Preserve Done | Never update/cancel Done Stories (CREATE follow-up if conflicts) |
| Story Split/Merge | Detect 1→2+ OR 2+→1, show warnings (complex, impacts Tasks) |
| Clear Diffs | Show before/after for UPDATE (AC, Standards Research, Technical Notes) |
| Meaningful Comments | Explain why updated/canceled (reference removed capabilities) |
| Conservative Updates | Prefer CREATE over UPDATE when in doubt |
| Progressive Loading | Load Stories ONE BY ONE (not all at once, token efficiency) |
| 规则 | 描述 |
|---|---|
| 状态约束 | 更新/废弃:待办/待处理 ✅,进行中/评审中 ⚠️,已完成 ❌ |
| 保留已完成内容 | 绝不更新/取消已完成的Story(若有冲突则创建后续Story) |
| Story拆分/合并 | 检测到1→2+或2+→1的情况,显示警告(逻辑复杂,影响任务) |
| 清晰的差异展示 | 为更新操作展示变更前后的内容(验收准则、标准调研、技术说明) |
| 有意义的评论 | 说明更新/取消的原因(引用已移除的能力) |
| 保守更新 | 存疑时优先选择创建而非更新 |
| 渐进式加载 | 逐个加载Story(而非一次性加载全部,提升Token效率) |
Definition of Done
完成定义
✅ Phase 1:
- Existing Story IDs queried
- FULL descriptions fetched ONE BY ONE
- 8 sections parsed
- Metadata extracted (persona, capability, AC, Standards Research)
✅ Phase 2:
- Stories matched by goal/persona/capability
- Operations categorized (KEEP/UPDATE/OBSOLETE/CREATE)
- Edge cases detected (Split/Merge, Ambiguous)
✅ Phase 3:
- Operations summary shown
- Diffs shown for UPDATE (AC, Standards Research, Technical Notes)
- Warnings shown
✅ Phase 4:
- autoApprove=true OR user confirmed
✅ Phase 5:
- All operations executed (UPDATE/OBSOLETE/CREATE)
- kanban_board.md updated
- Summary returned (URLs + warnings)
✅ 阶段1:
- 已查询现有Story ID
- 已逐个获取完整描述
- 已解析8个部分
- 已提取元数据(角色、能力、验收准则、标准调研)
✅ 阶段2:
- 已按目标/角色/能力匹配Story
- 已对操作进行分类(保留/更新/废弃/创建)
- 已检测到边缘情况(拆分/合并、模糊匹配)
✅ 阶段3:
- 已显示操作汇总
- 已展示更新操作的差异(验收准则、标准调研、技术说明)
- 已显示警告
✅ 阶段4:
- autoApprove=true 或已获得用户确认
✅ 阶段5:
- 所有操作已执行(更新/废弃/创建)
- kanban_board.md已更新
- 已返回汇总结果(链接+警告)
Template Loading
模板加载
MANDATORY READ: Load for template copy workflow.
shared/references/template_loading_pattern.mdTemplate:
Local copy: (in target project)
story_template.mddocs/templates/story_template.md必读: 加载以了解模板复制工作流。
shared/references/template_loading_pattern.md模板:
本地副本: (位于目标项目中)
story_template.mddocs/templates/story_template.mdReference Files
参考文件
- Template loading:
shared/references/template_loading_pattern.md - Linear creation workflow:
shared/references/linear_creation_workflow.md - Replan algorithm:
shared/references/replan_algorithm.md
- 模板加载:
shared/references/template_loading_pattern.md - Linear创建工作流:
shared/references/linear_creation_workflow.md - 重规划算法:
shared/references/replan_algorithm.md
replan_algorithm_stories.md
replan_algorithm_stories.md
Location: (owned by this skill)
Purpose: Detailed comparison logic for REPLAN mode (Story level)
Contents: KEEP/UPDATE/OBSOLETE/CREATE rules, Match criteria, Status constraints, Edge cases, Examples
Usage: Applied in Phase 2
references/位置: (本工具所属)
用途: 重规划模式下的详细对比逻辑(Story级别)
内容: 保留/更新/废弃/创建规则、匹配条件、状态约束、边缘情况、示例
使用: 应用于阶段2
references/story_template.md
story_template.md
Location: (centralized)
Local Copy: (in target project)
Purpose: Universal Story template (8 sections)
Usage: Load via Template Loading logic when generating updated Story documents for UPDATE/CREATE operations
shared/templates/story_template.mddocs/templates/story_template.md位置: (集中存储)
本地副本: (位于目标项目中)
用途: 通用Story模板(8个部分)
使用: 在为更新/创建操作生成Story文档时,通过模板加载逻辑加载
shared/templates/story_template.mddocs/templates/story_template.mdIntegration
集成
Called by: ln-220-story-coordinator (Phase 5b, count ≥ 1)
Returns:
- Success: Operations summary + URLs + warnings
- Error: "Story USXXX violates INVEST: [details]"
Worker does NOT:
- Query Linear for Epic (already in context)
- Analyze Epic complexity (orchestrator Phase 3)
- Research standards (orchestrator Phase 2)
- Build IDEAL plan (receives from orchestrator)
Version: 3.0.0
Last Updated: 2025-12-23
调用方: ln-220-story-coordinator(阶段5b,调用次数≥1)
返回结果:
- 成功:操作汇总+链接+警告
- 错误:"Story USXXX 违反INVEST准则:[详情]"
本服务不执行:
- 查询Linear中的Epic(已在上下文中)
- 分析Epic复杂度(协调器阶段3)
- 调研标准(协调器阶段2)
- 构建IDEAL方案(从协调器接收)
版本: 3.0.0
最后更新: 2025-12-23