sdd-riper-one
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSDD-RIPER-ONE Skill
SDD-RIPER-ONE Skill
全局行为与安全底线 (Global Safeguards)
Global Behaviors and Security Bottom Lines (Global Safeguards)
- 高危操作阻断:永远不要静默或提议执行 (包含任何参数,特别是
git clean),防止用户未提交的工作区数据不可逆丢失。-fdx - 研发纪律:
- :未形成并持久化 Spec 前,不进入代码实现。
No Spec, No Code - :未得到执行许可前,禁止进行环境修改或高风险变更。
No Approval, No Execute - :任何聊天决议或最新改动必须回源到 Spec,Spec 是唯一真相源。
Spec is Truth
- High-risk Operation Blocking: Never silently execute or propose executing (with any parameters, especially
git clean) to prevent irreversible loss of users' uncommitted workspace data.-fdx - R&D Discipline:
- : Do not enter code implementation before the Spec is formed and persisted.
No Spec, No Code - : Environment modifications or high-risk changes are prohibited before execution permission is obtained.
No Approval, No Execute - : Any chat resolution or latest change must be synced back to the Spec, which serves as the only single source of truth.
Spec is Truth
核心定位
Core Positioning
- 先读一次:
references/sdd-riper-one-protocol.md - 总纲:,全程遵循 SDD 并持续维护 Spec
Pre-Research -> RIPER - 三条底线:、
No Spec, No Code、Spec is TruthReverse Sync - /
create_codemap是 Pre-Research 输入准备;build_context_bundle是 RIPER 启动命令(进入 Research 第一步,同时完成 Pre-Research 收口)sdd_bootstrap - RIPER 主流程:
Research -> (Innovate, 可选) -> Plan -> Execute -> Review - 不要在每轮对话里重载整份 Skill / Spec;默认只回读当前阶段需要的小节
- Spec 受众分层与上下文保护:Spec 的第一受众是人类(持久化的任务上下文与组织记忆),第二受众才是模型。协议对模型的核心价值是四件事:注意力聚焦(让模型在当前阶段只关注该关注的)、信息索引(需要时按路径回读,而非全量常驻)、防止上下文腐烂(用落盘的 Spec 对抗长对话中的遗忘与漂移)、辅助 Review(提供 Spec vs 代码的交叉验证基准)。协议绝不应导致上下文被塞满挤爆——RIPER 管流程,Spec 管记录,模型按需取用。
- Read once first:
references/sdd-riper-one-protocol.md - General framework: , follow SDD throughout the process and maintain the Spec continuously
Pre-Research -> RIPER - Three bottom lines: ,
No Spec, No Code,Spec is TruthReverse Sync - /
create_codemapare input preparations for Pre-Research;build_context_bundleis the RIPER startup command (the first step to enter Research, while completing the Pre-Research closure)sdd_bootstrap - RIPER main process:
Research -> (Innovate, optional) -> Plan -> Execute -> Review - Do not reload the entire Skill/Spec in each round of dialogue; by default, only read the sections required for the current phase
- Spec audience stratification and context protection: The primary audience of Spec is humans (persisted task context and organizational memory), and the secondary audience is models. The core value of the protocol for models lies in four aspects: Attention Focusing (let the model only focus on what it should pay attention to in the current phase), Information Indexing (read back according to the path when needed, instead of keeping all content resident), Prevent Context Rot (fight against forgetting and drift in long conversations with the persisted Spec), Auxiliary Review (provide a cross-validation benchmark for Spec vs code). The protocol should never cause the context to be overfilled - RIPER manages the process, Spec manages records, and the model accesses them on demand.
推荐流程(直接执行)
Recommended Process (Direct Execution)
- 标准流(中大型任务):
create_codemap -> build_context_bundle -> sdd_bootstrap -> Research -> (Innovate, 可选) -> Plan -> Execute -> Review
- 快速流(小任务/需求模糊):
sdd_bootstrap -> (按需补)create_codemap/build_context_bundle -> Research -> Plan -> Execute -> Review
- 门禁:
- 首版 spec 落盘前,不进入实现
- 未收到精确字样 ,禁止进入
Plan ApprovedExecute - 不通过,回到
Review修正Research/Plan
- Standard flow (medium and large tasks):
create_codemap -> build_context_bundle -> sdd_bootstrap -> Research -> (Innovate, optional) -> Plan -> Execute -> Review
- Fast flow (small tasks/ambiguous requirements):
sdd_bootstrap -> (supplement on demand) create_codemap/build_context_bundle -> Research -> Plan -> Execute -> Review
- Phase Gates:
- Do not enter implementation before the first version of the spec is persisted to disk
- It is prohibited to enter before receiving the exact text
ExecutePlan Approved - If fails, go back to
Reviewfor correctionResearch/Plan
上下文装配规则
Context Assembly Rules
- 是完整持久化上下文与记忆层:必须完整落盘、持续维护,但不要求每轮整份常驻输入
SDD - 是审批驱动状态机:必须在每轮保持当前
RIPER、当前批准状态与下一步动作清晰可见phase - 裁剪目标是减少重复重放,不是减少约束或弱化门禁
- is the complete persisted context and memory layer: it must be fully persisted to disk and maintained continuously, but it is not required to be fully resident in the input for each round
SDD - is an approval-driven state machine: the current
RIPER, current approval status and next action must be clearly visible in each roundphase - The goal of tailoring is to reduce repeated replay, not to reduce constraints or weaken phase gates
热上下文(每轮必带)
Hot Context (Required for Each Round)
- 当前
phase - 当前
approval status - 当前
spec path - 当前
Goal - 当前
In Scope / Out of Scope - 当前活跃
Checklist - 当前
Open Questions - 当前风险与
Next Action - 热上下文只用于当前轮聚焦,不替代完整 spec;与 spec 冲突时,永远以 spec 为准
- Current
phase - Current
approval status - Current
spec path - Current
Goal - Current
In Scope / Out of Scope - Current active
Checklist - Current
Open Questions - Current risks and
Next Action - Hot context is only used for focusing in the current round, and does not replace the complete spec; in case of conflict with the spec, the spec shall always prevail
温上下文(切阶段或高风险动作前加载)
Warm Context (Loaded Before Phase Switch or High-risk Actions)
- :
Research -> Plan、关键事实、方案结论Research Findings - :
Plan -> Execute、File Changes、原子SignaturesChecklist - :
Execute -> Review、实际改动摘要、偏差说明Validation - 执行 /
review_spec时,回读对应评审区块review_execute
- :
Research -> Plan, key facts, scheme conclusionsResearch Findings - :
Plan -> Execute,File Changes, atomicSignaturesChecklist - :
Execute -> Review, actual change summary, deviation descriptionValidation - When executing /
review_spec, read back the corresponding review sectionreview_execute
冷上下文(默认不带,命中再加载)
Cold Context (Not Included by Default, Loaded Only When Hit)
- 全量
Change Log - 历史 细节
Research - 完整
codemap - 完整
context bundle - /
MULTI/DEBUG的完整扩展规则ARCHIVE - 长示例、长模板、长 quick reference
- Full
Change Log - Historical details
Research - Complete
codemap - Complete
context bundle - Complete extension rules for /
MULTI/DEBUGARCHIVE - Long examples, long templates, long quick references
硬门禁(不可因裁剪而削弱)
Hard Phase Gates (Cannot Be Weakened Due to Tailoring)
- 没有 spec,不进入代码实现
- 与
phase必须是显式状态,不允许根据语气、倾向或不完整表述推断approval status - 没有精确字样 ,不进入
Plan ApprovedExecute - phase 切换前,必须回读对应 spec 区块;不能只靠热上下文跨阶段推进
- 时必须基于 plan 与 validation,而不是只看聊天摘要
Review - 发现冲突、字段缺失、摘要过期或记忆不确定时,立即回读完整 spec 或相关原文区块
- Do not enter code implementation without a spec
- and
phasemust be explicit states, and inference based on tone, tendency or incomplete statements is not allowedapproval status - Do not enter without the exact text
ExecutePlan Approved - Before phase switching, the corresponding spec section must be read back; phase advancement cannot be carried out only by relying on hot context across phases
- must be based on plan and validation, not just chat summaries
Review - When conflicts, missing fields, expired summaries or uncertain memory are found, immediately read back the complete spec or relevant original sections
回读触发规则
Read-back Trigger Rules
- 每轮必带:、
phase、approval status、spec path、当前活跃Goal、ChecklistNext Action - 切阶段时:回读目标阶段对应的 spec 区块(Research Findings / File Changes / Validation 等)
- 执行 review 时:回读 Plan 区块,
review_spec回读 Plan + Validation + Review 区块review_execute - 触发全量回读:阶段切换有争议、摘要与 spec 冲突、长对话出现遗忘迹象、高风险改动
- 禁止:不能用热上下文替代 spec 原文跨阶段推进,不能根据模糊语气推断
Plan Approved
- Required for each round: ,
phase,approval status,spec path, current activeGoal,ChecklistNext Action - When switching phases: Read back the spec section corresponding to the target phase (Research Findings / File Changes / Validation, etc.)
- When performing review: reads back the Plan section,
review_specreads back the Plan + Validation + Review sectionsreview_execute - Trigger full read-back: Disputes in phase switching, conflict between summary and spec, signs of forgetting in long conversations, high-risk changes
- Prohibited: Hot context cannot be used to replace the original spec for cross-phase advancement, and cannot be inferred based on vague tone
Plan Approved
多项目协作(自动发现 + 作用域隔离)
Multi-project Collaboration (Auto-discovery + Scope Isolation)
- 目标:多项目场景下保持"局部理解 + 局部执行 + 显式边界",用户零额外配置。
- 详细协议:→
references/sdd-riper-one-protocol.md段MULTI-PROJECT PROTOCOL - Spec 模板:→ 多项目模板
references/spec-template.md
- Goal: Maintain "local understanding + local execution + explicit boundaries" in multi-project scenarios, zero additional configuration for users
- Detailed protocol: →
references/sdd-riper-one-protocol.mdsectionMULTI-PROJECT PROTOCOL - Spec template: → multi-project template
references/spec-template.md
自动发现(Auto-Discovery)
Auto-Discovery
- 触发:或触发词
sdd_bootstrap: mode=multi_projectMULTI / 多项目 - Agent 自动扫描 下子目录,通过标志文件识别子项目:
workdir- JS/TS: | Java/Kotlin:
package.json,pom.xml| Go:build.gradle| Python:go.mod,pyproject.toml| Rust:setup.py| 通用:Cargo.toml.git - Monorepo: 额外检查 、
workspaces、settings.gradlepnpm-workspace.yaml
- JS/TS:
- 产出 (
Project Registry),报告给用户确认后继续§0.1 - 用户也可显式提供 跳过自动发现
projects=[...] - 智能降级:仅 1 个子项目 → 自动降级为单项目模式;0 个子项目 → workdir 本身作为单项目
- Trigger: or trigger words
sdd_bootstrap: mode=multi_projectMULTI / 多项目 - Agent automatically scans subdirectories under and identifies subprojects through flag files:
workdir- JS/TS: | Java/Kotlin:
package.json,pom.xml| Go:build.gradle| Python:go.mod,pyproject.toml| Rust:setup.py| General:Cargo.toml.git - Monorepo: Additional check for ,
workspaces,settings.gradlepnpm-workspace.yaml
- JS/TS:
- Generate (
Project Registry), report to the user for confirmation before proceeding§0.1 - Users can also explicitly provide to skip auto-discovery
projects=[...] - Intelligent downgrade: Only 1 subproject → automatically downgrade to single-project mode; 0 subprojects → treat workdir itself as a single project
自动 Codemap
Automatic Codemap
- 发现项目后,自动为每个子项目检查/生成
create_codemap(project) - 产物路径:
mydocs/codemap/YYYY-MM-DD_hh-mm_<project_id>项目总图.md
- After discovering projects, automatically check/generate for each subproject
create_codemap(project) - Output path:
mydocs/codemap/YYYY-MM-DD_hh-mm_<project_id>项目总图.md
作用域隔离规则(必须)
Scope Isolation Rules (Mandatory)
- 每轮先声明 与
active_projectactive_workdir - 默认 ,只允许修改
change_scope=local下的文件active_project - 仅在显式 (或触发词
change_scope=cross)时允许跨项目改动CROSS / 跨项目 - 始终 :切换到任何项目前,必须先加载该项目的 codemap/context
codemap-first - 跨项目执行后,在 spec 记录改动项目、文件、原因
§6.1 Touched Projects
- Declare and
active_projectfirst in each roundactive_workdir - Default , only allow modification of files under
change_scope=localactive_project - Cross-project changes are allowed only when explicitly setting (or trigger words
change_scope=cross)CROSS / 跨项目 - Always follow : Before switching to any project, the codemap/context of the project must be loaded first
codemap-first - After cross-project execution, record the changed projects, files and reasons in spec
§6.1 Touched Projects
跨项目依赖与契约
Cross-project Dependencies and Contracts
- 跨项目改动时,必须在 spec 记录:Provider → Interface → Consumer → 是否 Breaking Change → 迁移方案
§4.4 Contract Interfaces - 跨项目 Plan 的 checklist 按项目分组,Provider 优先于 Consumer 执行
- 修改前检查目标项目是否有活跃 Spec,有冲突则 STOP 等待用户决策
- When making cross-project changes, must record in spec : Provider → Interface → Consumer → Whether it is a Breaking Change → Migration scheme
§4.4 Contract Interfaces - The checklist of cross-project Plan is grouped by project, and Provider is executed prior to Consumer
- Check whether the target project has an active Spec before modification, STOP and wait for user decision if there is a conflict
多项目 Review(扩展)
Multi-project Review (Extension)
- 校验跨项目契约一致性(Provider 与 Consumer 接口匹配)
- 校验 Touched Projects 完整性
- 校验无孤立改动(所有改动文件都在已注册项目内)
- 按项目分别评估回归风险
- Verify the consistency of cross-project contracts (matching of Provider and Consumer interfaces)
- Verify the integrity of Touched Projects
- Verify that there are no isolated changes (all changed files are within registered projects)
- Evaluate regression risk by project respectively
触发词
Trigger Words
- → 进入多项目模式,运行自动发现
MULTI / 多项目 - → 当前轮
CROSS / 跨项目change_scope=cross - → 切换
SWITCH <project_id> / 切换 <project_id>,自动加载 codemapactive_project - → 显示当前 Project Registry
REGISTRY / 项目列表 - → 重置为
SCOPE LOCAL / 回到本地change_scope=local
- → Enter multi-project mode, run auto-discovery
MULTI / 多项目 - → Current round
CROSS / 跨项目change_scope=cross - → Switch
SWITCH <project_id> / 切换 <project_id>, automatically load codemapactive_project - → Display current Project Registry
REGISTRY / 项目列表 - → Reset to
SCOPE LOCAL / 回到本地change_scope=local
最小启动示例
Minimum Startup Example
text
sdd_bootstrap: mode=multi_project, task=<任务名>, goal=<目标>, requirement=<需求文档或描述>- 无需手动列项目,Agent 自动发现并确认。
- 也可显式指定:
projects=[{id:web-console,path:./web-console},{id:api-service,path:./api-service}]
text
sdd_bootstrap: mode=multi_project, task=<task name>, goal=<goal>, requirement=<requirement document or description>- No need to list projects manually, Agent automatically discovers and confirms.
- You can also explicitly specify:
projects=[{id:web-console,path:./web-console},{id:api-service,path:./api-service}]
原生命令动作(可直接输入)
Native Command Actions (Can Be Entered Directly)
1) create_codemap
create_codemap1) create_codemap
create_codemap- 用途:生成代码索引地图,支持 /
feature(默认project)feature - 本质:CodeMap 是代码上下文索引,用于后续按需加载,而不是每轮全仓扫描。
- 输入:(建议明确);
scope可选;mode可选goal - 输出:
- :
featuremydocs/codemap/YYYY-MM-DD_hh-mm_<feature>功能.md - :
projectmydocs/codemap/YYYY-MM-DD_hh-mm_<project>项目总图.md
- 要点:
- 关注入口、核心链路、依赖、风险
feature - 关注架构层、核心模块、跨模块流程、外部依赖;图示建议优先 Mermaid(受限可降级为结构化文字图)
project
- Purpose: Generate code index map, support /
feature(defaultproject)feature - Essence: CodeMap is a code context index for subsequent on-demand loading, instead of full repository scanning in each round.
- Input: (recommended to be clear);
scopeoptional;modeoptionalgoal - Output:
- :
featuremydocs/codemap/YYYY-MM-DD_hh-mm_<feature>功能.md - :
projectmydocs/codemap/YYYY-MM-DD_hh-mm_<project>项目总图.md
- Key points:
- focuses on entry, core link, dependency, risk
feature - focuses on architecture layer, core modules, cross-module processes, external dependencies; Mermaid is preferred for diagrams (can be downgraded to structured text diagrams if limited)
project
2) build_context_bundle
build_context_bundle2) build_context_bundle
build_context_bundle- 用途:整理需求上下文,替用户读资料并提炼细节
- 输入:目录路径
- 解析策略:best effort,支持文本/文档/图片;不可解析文件进入 ,不阻塞产出
Unparsed Sources - 输出:
mydocs/context/YYYY-MM-DD_hh-mm_<task>_context_bundle.md - 输出级别:
- :
Lite、Source Index、Requirement Snapshot、Open QuestionsNext Actions - :
Standard、Requirement Facts、Business Rules、Acceptance Criteria、Constraints等Conflicts & Ambiguities
- Purpose: Organize requirement context, read materials for users and extract details
- Input: Directory path
- Parsing strategy: best effort, support text/document/image; unparseable files enter and do not block output
Unparsed Sources - Output:
mydocs/context/YYYY-MM-DD_hh-mm_<task>_context_bundle.md - Output levels:
- :
Lite,Source Index,Requirement Snapshot,Open QuestionsNext Actions - :
Standard,Requirement Facts,Business Rules,Acceptance Criteria,Constraints, etc.Conflicts & Ambiguities
3) sdd_bootstrap
sdd_bootstrap3) sdd_bootstrap
sdd_bootstrap- 用途:RIPER 启动命令(进入 Research 第一步,并产出第一版 spec)
- 输入:只要是“有意义且真实的需求”即可(口述/文档/聊天记录/context bundle 均可)
- 执行动作:
- 汇总用户输入 + 代码事实 + 历史资产(codemap/context/spec)
- 冲突处理:先落首版 spec 标记冲突,再给 和推荐决策
Option A/B - 形成首版研究结论与下一步动作
- 输出:
mydocs/specs/YYYY-MM-DD_hh-mm_<TaskName>.md - 首版最小内容:、
Context Sources、Codemap Used、Research Findings、Open QuestionsNext Actions
- Purpose: RIPER startup command (the first step to enter Research, and generate the first version of spec)
- Input: Any "meaningful and real requirement" is acceptable (oral/document/chat record/context bundle are all allowed)
- Execution actions:
- Summarize user input + code facts + historical assets (codemap/context/spec)
- Conflict handling: First persist the first version of spec to mark conflicts, then provide and recommended decision
Option A/B - Form the first version of research conclusions and next actions
- Output:
mydocs/specs/YYYY-MM-DD_hh-mm_<TaskName>.md - Minimum content of the first version: ,
Context Sources,Codemap Used,Research Findings,Open QuestionsNext Actions
4) review_spec
review_spec4) review_spec
review_spec- 用途:在 完成后、
Plan前进行 spec 质量评审(建议性,不阻塞执行)Execute - 输入:
- :spec 文件路径(可选,默认当前活跃 spec)
spec - :
scope(默认)或plan_onlyfull
- 评审重点:
- 目标/范围/验收标准是否清晰且可验证
- 是否可执行(文件、签名、checklist 是否原子化)
Plan - 风险、回滚、跨项目契约(如有)是否充分
- 分阶段原则:
- 仅评审“当前阶段应当具备”的章节,不要求一次性覆盖全 spec
- 对尚未到阶段的章节只做 ,不计入
ReminderNO-GO
- 输出:
- (逐项
Spec Review Matrix+ 证据)PASS/FAIL/PARTIAL - :
Readiness Verdict(建议性结论)GO/NO-GO - (若继续执行需关注项)
Risks & Suggestions - (按阶段待补齐项)
Phase Reminders
- 约束:
- 不构成硬阻塞;若用户坚持执行,允许继续
NO-GO - 用户选择继续时,必须在 spec 记录
User Decision: Proceed despite NO-GO
- Purpose: Conduct spec quality review after is completed and before
Plan(advisory, does not block execution)Execute - Input:
- : spec file path (optional, default current active spec)
spec - :
scope(default) orplan_onlyfull
- Review focus:
- Whether the goal/scope/acceptance criteria are clear and verifiable
- Whether is executable (whether files, signatures, checklist are atomic)
Plan - Whether risks, rollback, cross-project contracts (if any) are sufficient
- Phased principle:
- Only review the chapters that "should be available in the current phase", do not require full spec coverage at one time
- Only give for chapters that have not reached the phase, and do not count as
ReminderNO-GO
- Output:
- (item by item
Spec Review Matrix+ evidence)PASS/FAIL/PARTIAL - :
Readiness Verdict(advisory conclusion)GO/NO-GO - (items to note if you continue execution)
Risks & Suggestions - (items to be completed by phase)
Phase Reminders
- Constraints:
- does not constitute a hard block; if the user insists on execution, it is allowed to continue
NO-GO - When the user chooses to continue, must record in the spec
User Decision: Proceed despite NO-GO
5) review_execute
review_execute5) review_execute
review_execute- 用途:在 后执行结构化评审,输出可回写 spec 的审查结论
Execute - 输入:
- :spec 文件路径(可选,默认当前活跃 spec)
spec - :
scope(默认)或changed_only(全量评审)full
- 评审三轴(必须全部输出):
- Spec 质量与目标达成:spec 是否写清目标、范围、验收标准;需求是否完成
- Spec-代码一致性:代码是否忠实执行 (文件、签名、checklist、行为)
Plan - 代码自身质量:脱离 spec 后,代码在正确性、鲁棒性、可维护性、测试、风险上的质量
- 输出:
- (三轴逐项
Review Matrix+ 证据)PASS/FAIL/PARTIAL - (
Overall Verdict)与PASS/FAILBlocking Issues - (偏差与原因)
Plan-Execution Diff
- 门禁:
- 轴 1 或轴 2 任一 ->
FAIL,回到Review FAILResearch/Plan - 轴 3 存在高风险问题 -> ,回到
Review FAILPlan
- 轴 1 或轴 2 任一
- Purpose: Perform structured review after , output review conclusions that can be written back to the spec
Execute - Input:
- : spec file path (optional, default current active spec)
spec - :
scope(default) orchanged_only(full review)full
- Three review axes (must all be output):
- Spec quality and goal achievement: Whether the spec clearly states the goal, scope, acceptance criteria; whether the requirement is completed
- Spec-code consistency: Whether the code faithfully executes the (files, signatures, checklist, behavior)
Plan - Code quality itself: The quality of the code in terms of correctness, robustness, maintainability, testing, and risk after脱离 the spec
- Output:
- (item by item
Review Matrixfor three axes + evidence)PASS/FAIL/PARTIAL - (
Overall Verdict) andPASS/FAILBlocking Issues - (deviations and reasons)
Plan-Execution Diff
- Phase Gates:
- Any in axis 1 or axis 2 ->
FAIL, go back toReview FAILResearch/Plan - High-risk problems exist in axis 3 -> , go back to
Review FAILPlan
- Any
6) archive
archive6) archive
archive- 用途:对指定 spec/codemap(或目录)做归档沉淀,将“中间产物”提炼为可复用知识
- 输入:
- :文件或目录路径(支持多个)
targets - :
kind/spec/codemapmixed - :
audience/human/llm(默认both)both - :
mode(单任务归档,默认)/snapshot(跨任务主题归档)thematic - :归档主题名(可选,默认从 targets 推断)
topic
- 输出:
- :
human(汇报视角)mydocs/archive/YYYY-MM-DD_hh-mm_<topic>_human.md - :
llm(后续开发参考视角)mydocs/archive/YYYY-MM-DD_hh-mm_<topic>_llm.md - 每个归档文档必须包含 (结论 -> 来源文件)避免失真
Trace to Sources
- 门禁:
- 有活跃执行中的 spec(未完成 Review)时,禁止归档该 spec
- 默认只归档不删除原文件;删除/移动需用户显式授权
- 自动化脚本(推荐):
python3 scripts/archive_builder.py --targets mydocs/specs mydocs/codemap --kind mixed --audience both --mode thematic --topic <主题>- 如需强制归档活跃 spec:追加 (仅在用户明确确认后使用)
--allow-active-spec
- Purpose: Archive and precipitate specified spec/codemap (or directory), refine "intermediate products" into reusable knowledge
- Input:
- : file or directory paths (support multiple)
targets - :
kind/spec/codemapmixed - :
audience/human/llm(defaultboth)both - :
mode(single task archive, default) /snapshot(cross-task thematic archive)thematic - : archive topic name (optional, default inferred from targets)
topic
- Output:
- :
human(report perspective)mydocs/archive/YYYY-MM-DD_hh-mm_<topic>_human.md - :
llm(subsequent development reference perspective)mydocs/archive/YYYY-MM-DD_hh-mm_<topic>_llm.md - Each archived document must include (conclusion -> source file) to avoid distortion
Trace to Sources
- Phase Gates:
- When there is an actively executing spec (Review not completed), archiving this spec is prohibited
- By default, only archive without deleting original files; deletion/movement requires explicit user authorization
- Automation script (recommended):
python3 scripts/archive_builder.py --targets mydocs/specs mydocs/codemap --kind mixed --audience both --mode thematic --topic <topic>- If you need to force archive active spec: append (only used after explicit user confirmation)
--allow-active-spec
阶段约束(最小集合)
Phase Constraints (Minimum Set)
- 每轮先同步 spec 再推进阶段
- 默认不在每轮对话中重载整份 spec;优先回读当前阶段区块、活跃 checklist、、最近一次
Open QuestionsChange Log / Validation - 仅在切换阶段、执行 、发现冲突或明显遗忘时,全量回读 spec
review_spec/review_execute - /
codemap按需读取,不作为每轮固定输入context bundle - 可选:复杂任务建议 2-3 方案;小任务可跳过但要写原因
Innovate - 必须可执行:文件路径 + 签名 + 原子 checklist
Plan - 后建议执行
Plan;其review_spec为建议项,不是强制门禁NO-GO - 必须按三轴评审并回写结论:
Review、Review Matrix、Overall VerdictPlan-Execution Diff - 任务闭环后建议执行 ,沉淀 human/llm 双视角知识
archive
- Sync the spec first before advancing the phase in each round
- Do not reload the entire spec in each round of dialogue by default; prioritize reading back the current phase section, active checklist, , latest
Open QuestionsChange Log / Validation - Only read back the full spec when switching phases, executing , finding conflicts or obvious forgetting
review_spec/review_execute - /
codemapare read on demand, not as fixed input for each roundcontext bundle - is optional: 2-3 schemes are recommended for complex tasks; small tasks can be skipped but the reason should be written
Innovate - must be executable: file path + signature + atomic checklist
Plan - It is recommended to execute after
review_spec; itsPlanis an advisory item, not a mandatory phase gateNO-GO - must be carried out according to the three axes and the conclusions should be written back:
Review,Review Matrix,Overall VerdictPlan-Execution Diff - It is recommended to execute after the task is closed to precipitate dual-perspective knowledge for human/llm
archive
Debug 模式(日志驱动排查与功能验证)
Debug Mode (Log-driven Troubleshooting and Function Verification)
- 用途:基于日志 + Spec + 代码三角定位 Bug,或用全链路日志验证功能是否正常
- 触发词:
DEBUG / 排查 / 日志分析 / 验证功能 - 输入:
- :日志文件或日志目录路径(必须)
log_path - :发现的问题描述 / 报错信息(可选,排查模式时建议提供)
issue - :关联的 Spec 文件路径(可选,验证模式时建议提供)
spec
- 两种子模式:
- 排查模式(默认):用户提供日志 + 问题描述,Agent 结合 Spec 和代码定位可能的 Bug 根因
- 验证模式:用户提供全链路日志 + Spec,Agent 逐条比对 Spec 中的预期行为与日志中的实际行为,确认功能是否正常
- 工作流:
- 读取日志文件/目录,提取关键错误、异常、调用链信息
- 加载关联的 Spec 和 CodeMap(如有),建立"预期行为 vs 实际行为"的对照
- 定位代码中的可疑逻辑(结合 CodeMap 索引精准跳转)
- 输出结论:Bug 根因分析 / 功能验证报告
- 如需修复,自动进入 RIPER 流程(Research → Plan → Execute → Review)
- 约束:
- Debug 模式本身不直接改代码,只做分析和定位
- 需要改代码时,必须走 RIPER 流程(或 FAST 通道处理小修复)
- 分析结论回写到 Spec 的 段(如有活跃 Spec)
§ Debug Log
- Purpose: Locate bugs based on the triangulation of log + Spec + code, or verify whether the function is normal with full-link logs
- Trigger words:
DEBUG / 排查 / 日志分析 / 验证功能 - Input:
- : log file or log directory path (mandatory)
log_path - : discovered problem description / error message (optional, recommended when in troubleshooting mode)
issue - : associated Spec file path (optional, recommended when in verification mode)
spec
- Two sub-modes:
- Troubleshooting mode (default): The user provides logs + problem description, and the Agent combines Spec and code to locate possible root causes of bugs
- Verification mode: The user provides full-link logs + Spec, and the Agent compares the expected behavior in the Spec with the actual behavior in the logs one by one to confirm whether the function is normal
- Workflow:
- Read log files/directories, extract key errors, exceptions, call chain information
- Load associated Spec and CodeMap (if any), establish a comparison of "expected behavior vs actual behavior"
- Locate suspicious logic in the code (precise jump combined with CodeMap index)
- Output conclusion: Bug root cause analysis / function verification report
- If repair is needed, automatically enter the RIPER process (Research → Plan → Execute → Review)
- Constraints:
- Debug mode itself does not directly modify code, only does analysis and positioning
- When code modification is required, must follow the RIPER process (or FAST channel for small fixes)
- Analysis conclusions are written back to the section of the Spec (if there is an active Spec)
§ Debug Log
触发词
Trigger Words
- ->
MAP / Code Map / 链路梳理 / 只看代码create_codemap(feature) - ->
PROJECT MAP / 全局地图 / 项目总图 / MAP ALLcreate_codemap(project) - -> 多项目轻量模式(父目录 workdir + 局部执行)
MULTI / 多项目 - -> 允许跨项目改动(强制记录
CROSS / 跨项目)Touched Projects - -> 小改快速通道(改后同步 spec)
FAST / 快速 / >> - -> 执行
REVIEW SPEC / 评审规格 / 计划评审(建议性预审)review_spec - -> 执行
REVIEW EXECUTE / 代码评审 / 实现复盘(三轴审查)review_execute - -> 执行
ARCHIVE / 归档 / 沉淀(总结、合并、精炼)archive - -> Debug 模式(日志驱动排查与功能验证)
DEBUG / 排查 / 日志分析 / 验证功能 - -> 退出状态机
EXIT SDD / 退出协议
- ->
MAP / Code Map / 链路梳理 / 只看代码create_codemap(feature) - ->
PROJECT MAP / 全局地图 / 项目总图 / MAP ALLcreate_codemap(project) - -> Multi-project lightweight mode (parent directory workdir + local execution)
MULTI / 多项目 - -> Allow cross-project changes (mandatory recording of
CROSS / 跨项目)Touched Projects - -> Small change fast channel (sync spec after modification)
FAST / 快速 / >> - -> Execute
REVIEW SPEC / 评审规格 / 计划评审(advisory pre-review)review_spec - -> Execute
REVIEW EXECUTE / 代码评审 / 实现复盘(three-axis review)review_execute - -> Execute
ARCHIVE / 归档 / 沉淀(summary, merge, refine)archive - -> Debug mode (log-driven troubleshooting and function verification)
DEBUG / 排查 / 日志分析 / 验证功能 - -> Exit the state machine
EXIT SDD / 退出协议
命名规则(统一时间前缀)
Naming Rules (Unified Time Prefix)
- 时间前缀:
YYYY-MM-DD_hh-mm_ - :
create_codemap(feature)mydocs/codemap/YYYY-MM-DD_hh-mm_<feature>功能.md - :
create_codemap(project)mydocs/codemap/YYYY-MM-DD_hh-mm_<project>项目总图.md - :
build_context_bundlemydocs/context/YYYY-MM-DD_hh-mm_<task>_context_bundle.md - :
sdd_bootstrapmydocs/specs/YYYY-MM-DD_hh-mm_<TaskName>.md - :
archive(human)mydocs/archive/YYYY-MM-DD_hh-mm_<topic>_human.md - :
archive(llm)mydocs/archive/YYYY-MM-DD_hh-mm_<topic>_llm.md
- Time prefix:
YYYY-MM-DD_hh-mm_ - :
create_codemap(feature)mydocs/codemap/YYYY-MM-DD_hh-mm_<feature>功能.md - :
create_codemap(project)mydocs/codemap/YYYY-MM-DD_hh-mm_<project>项目总图.md - :
build_context_bundlemydocs/context/YYYY-MM-DD_hh-mm_<task>_context_bundle.md - :
sdd_bootstrapmydocs/specs/YYYY-MM-DD_hh-mm_<TaskName>.md - :
archive(human)mydocs/archive/YYYY-MM-DD_hh-mm_<topic>_human.md - :
archive(llm)mydocs/archive/YYYY-MM-DD_hh-mm_<topic>_llm.md
参考
References
references/sdd-riper-one-protocol.mdreferences/spec-template.mdreferences/workflow-quickref.mdreferences/usage-examples.mdreferences/archive-template.md- (多项目协作详细规则)
references/multi-project.md - (原生命令动作详细参数)
references/commands.md
references/sdd-riper-one-protocol.mdreferences/spec-template.mdreferences/workflow-quickref.mdreferences/usage-examples.mdreferences/archive-template.md- (detailed rules for multi-project collaboration)
references/multi-project.md - (detailed parameters of native command actions)
references/commands.md