@damphuquy/agent-init 1.4.4 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/README.md +10 -4
  2. package/README.vi.md +10 -4
  3. package/package.json +1 -1
  4. package/templates/en/.agents/behavior.md +34 -2
  5. package/templates/en/.agents/guardrails.md +2 -1
  6. package/templates/en/AGENTS.md +15 -8
  7. package/templates/en/process/README.md +14 -10
  8. package/templates/en/process/_seeds/_GUIDE.md +10 -6
  9. package/templates/en/process/_seeds/decision-template.md.seed +7 -6
  10. package/templates/en/process/_seeds/plan-template.md.seed +2 -2
  11. package/templates/en/process/_seeds/review-template.md.seed +1 -1
  12. package/templates/en/process/_seeds/task-template.md.seed +18 -9
  13. package/templates/en/process/context/all-context.md +1 -1
  14. package/templates/en/process/context/planning/all-planning.md +72 -16
  15. package/templates/en/process/context/tests/all-tests.md +87 -30
  16. package/templates/en/process/development-protocols/implementation-standards.md +103 -14
  17. package/templates/en/process/development-protocols/orchestration.md +88 -11
  18. package/templates/vi/.agents/behavior.md +34 -2
  19. package/templates/vi/.agents/guardrails.md +2 -1
  20. package/templates/vi/AGENTS.md +15 -8
  21. package/templates/vi/process/README.md +14 -10
  22. package/templates/vi/process/_seeds/_GUIDE.md +10 -6
  23. package/templates/vi/process/_seeds/decision-template.md.seed +7 -6
  24. package/templates/vi/process/_seeds/plan-template.md.seed +2 -2
  25. package/templates/vi/process/_seeds/review-template.md.seed +1 -1
  26. package/templates/vi/process/_seeds/task-template.md.seed +18 -9
  27. package/templates/vi/process/context/all-context.md +1 -1
  28. package/templates/vi/process/context/planning/all-planning.md +72 -16
  29. package/templates/vi/process/context/tests/all-tests.md +87 -30
  30. package/templates/vi/process/development-protocols/implementation-standards.md +104 -15
  31. package/templates/vi/process/development-protocols/orchestration.md +89 -12
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # agent-instructions (@damphuquy/agent-init)
2
2
 
3
- > **AI Coding Agent Scaffolding & Orchestration System (RIPER-5 Framework)**
3
+ > **AI Coding Agent Scaffolding & Orchestration System v2.0 (RIPER-5 Framework)**
4
4
 
5
5
  <p align="center">
6
6
  <b>English</b> • <a href="README.vi.md">Tiếng Việt</a>
@@ -8,7 +8,13 @@
8
8
 
9
9
  ---
10
10
 
11
- A structured scaffolding framework for AI Coding Agents following the **RIPER-5 Framework** — cleanly separated into three layers: `AGENTS.md` (project configuration), `.agents/` (agent behavioral controls), and `process/` (task execution and verification workflow).
11
+ A structured scaffolding framework for AI Coding Agents following the **RIPER-5 Framework v2.0** — cleanly separated into three layers: `AGENTS.md` (project configuration), `.agents/` (agent behavioral controls), and `process/` (task execution and verification workflow).
12
+
13
+ Featuring four core **v2.0 Engineering Protocols**:
14
+ * **Subagent Orchestration v2.0:** Parallel vertical slicing with zero write collision and reactive wakeup.
15
+ * **Implementation Standards v2.0:** Strict typing (zero `any`), domain purity, fail-fast boundary validation, and deterministic teardown.
16
+ * **Planning & Slicing Standards v2.0:** INVEST-compliant vertical slices (2–5 per task) with mandatory automated verifiers.
17
+ * **Testing Standards & Harness v2.0:** Deterministic test pyramid with frozen clocks, fixture factories, and strict mocking boundaries.
12
18
 
13
19
  ```bash
14
20
  # Bootstrap immediately into your project (takes 30 seconds)
@@ -23,11 +29,11 @@ Designed for minimal overhead, practical focus, and zero fluff:
23
29
 
24
30
  ### 1. For Daily Development (Start Here)
25
31
  * **[01 · Hands-on Walkthrough from A–Z](docs/en/01-getting-started.md)**: **The core guide to get started in 10–15 minutes**. Step-by-step instructions with **2 practical examples** (Task 1 Strict Track $\rightarrow$ Handoff $\rightarrow$ Task 2 Fast-Track with knowledge inheritance), prompt templates, and quality gate sign-offs.
26
- * **[02 · Daily Cheat Sheet](docs/en/02-cheat-sheet.md)**: Copy-paste prompt templates for each phase, quality gates summary (Gates G0–G3), and file ownership matrix (Human vs Agent).
32
+ * **[02 · Daily Cheat Sheet](docs/en/02-cheat-sheet.md)**: Copy-paste prompt templates for each phase, quality gates summary (Gates G0–G3), subagent delegation prompts, and v2.0 protocol matrix.
27
33
  * **[03 · Advanced Workflows & Production Edge Cases](docs/en/03-advanced-workflows.md)**: Complex real-world scenarios: Epics in `process/features/`, multi-developer concurrency, git rebase conflicts, P0 emergency hotfixes, secret scanning, model switching, complex test harnesses, and task parking (`paused.md`).
28
34
 
29
35
  ### 2. In-Depth Reference (For Tech Leads & Maintainers)
30
- * **[3-Layer Architecture & Context Router](docs/en/reference/architecture.md)**: Deep dive into the 3-layer decoupled architecture and Minimum Sufficient Context principles (No Full-Repo Scan).
36
+ * **[3-Layer Architecture & Context Router (v2.0)](docs/en/reference/architecture.md)**: Deep dive into the 3-layer decoupled architecture, the 11-seed catalog, and the v2.0 Engineering Protocols.
31
37
  * **[DevOps & Release Automation](docs/en/reference/devops-release.md)**: CI/CD release lifecycle, automated Semantic Versioning, and NPM package publishing.
32
38
 
33
39
  ---
package/README.vi.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # agent-instructions (@damphuquy/agent-init)
2
2
 
3
- > **Hệ thống điều phối và khởi tạo AI Coding Agent theo chuẩn RIPER-5**
3
+ > **Hệ thống điều phối và khởi tạo AI Coding Agent v2.0 theo chuẩn RIPER-5**
4
4
 
5
5
  <p align="center">
6
6
  <a href="README.md">English</a> • <b>Tiếng Việt</b>
@@ -8,7 +8,13 @@
8
8
 
9
9
  ---
10
10
 
11
- Hệ thống mẫu (scaffold) điều phối AI Coding Agent theo chuẩn **RIPER-5 Framework** — phân tách thành ba layer rõ ràng: `AGENTS.md` (cấu hình dự án), `.agents/` (quy chuẩn hành vi của Agent), và `process/` (quy trình thực thi task và kiểm thử).
11
+ Hệ thống mẫu (scaffold) điều phối AI Coding Agent theo chuẩn **RIPER-5 Framework v2.0** — phân tách thành ba layer rõ ràng: `AGENTS.md` (cấu hình dự án), `.agents/` (quy chuẩn hành vi của Agent), và `process/` (quy trình thực thi task và kiểm thử).
12
+
13
+ Tích hợp 4 **Giao thức Kỹ thuật v2.0** cốt lõi:
14
+ * **Điều phối Subagent v2.0:** Chia lát cắt song song, không xung đột ghi (zero write collision) và đánh thức phản ứng.
15
+ * **Quy chuẩn Hiện thực Mã nguồn v2.0:** Kiểm soát kiểu nghiêm ngặt (không `any`), domain thuần khiết, fail-fast tại ranh giới và dọn dẹp tài nguyên xác định.
16
+ * **Quy chuẩn Lập kế hoạch & Cắt lát v2.0:** Lát cắt dọc theo chuẩn INVEST (2–5 slice/task) với lệnh kiểm chứng tự động bắt buộc.
17
+ * **Quy chuẩn Kiểm thử & Test Harness v2.0:** Kim tự tháp kiểm thử xác định với đóng băng thời gian (frozen clocks), fixture factories và mock có kiểm soát.
12
18
 
13
19
  ```bash
14
20
  # Khởi tạo ngay vào project của bạn (chỉ mất 30 giây)
@@ -23,11 +29,11 @@ Tài liệu được thiết kế tối giản, tập trung vào thực hành, k
23
29
 
24
30
  ### 1. Dành cho công việc hằng ngày (Bắt đầu tại đây)
25
31
  * 📘 **[01 · Hướng dẫn Thực chiến từ A–Z](docs/vi/01-getting-started.md)**: **Tài liệu cốt lõi để bắt đầu trong 10–15 phút**. Hướng dẫn từng bước với **2 ví dụ thực tế liên hoàn** (Task 1 Strict Track $\rightarrow$ Bàn giao $\rightarrow$ Task 2 Fast-Track kế thừa tri thức), prompt mẫu và cách duyệt qua các cổng.
26
- * ⚡ **[02 · Sổ tay Tra cứu Nhanh (Cheat Sheet)](docs/vi/02-cheat-sheet.md)**: Bảng copy-paste prompt mẫu cho từng giai đoạn, bảng 4 cổng kiểm soát (Gates G0–G3), và ma trận quyền hạn file (Human vs Agent).
32
+ * ⚡ **[02 · Sổ tay Tra cứu Nhanh (Cheat Sheet)](docs/vi/02-cheat-sheet.md)**: Bảng copy-paste prompt mẫu cho từng giai đoạn, bảng 4 cổng kiểm soát (Gates G0–G3), prompt ủy quyền subagent và ma trận giao thức v2.0.
27
33
  * 🚀 **[03 · Quy trình Nâng cao & Tình huống Thực chiến](docs/vi/03-advanced-workflows.md)**: Các kịch bản production phức tạp: Epic trong `process/features/`, đa lập trình viên đồng thời, xử lý xung đột rebase, hotfix P0 khẩn cấp, quét secret bảo mật, đổi model chat, và đóng băng task dài hạn (`paused.md`).
28
34
 
29
35
  ### 2. Tài liệu Chuyên sâu & Tham khảo (Dành cho Lead / Maintainer)
30
- * 🏛️ **[Kiến trúc 3 Tầng & Cơ chế Context Router](docs/vi/reference/architecture.md)**: Giải thích sâu về thiết kế tách rời 3 layer chế nạp ngữ cảnh tối thiểu (No Full-Repo Scan).
36
+ * 🏛️ **[Kiến trúc 3 Tầng & Cơ chế Context Router (v2.0)](docs/vi/reference/architecture.md)**: Giải thích sâu về thiết kế tách rời 3 layer, danh mục 11 seed template 4 Giao thức Kỹ thuật v2.0.
31
37
  * 🚢 **[Cẩm nang DevOps & Tự động hóa Phát hành](docs/vi/reference/devops-release.md)**: Quy trình CI/CD tự động tính Semantic Versioning và publish package lên NPM.
32
38
 
33
39
  ---
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@damphuquy/agent-init",
3
- "version": "1.4.4",
3
+ "version": "2.1.0",
4
4
  "description": "Scaffolding CLI to bootstrap RIPER-5 Coding Agents & Operational Workspace",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -25,9 +25,41 @@ first line. The declared mode must match the current phase recorded in `task.md`
25
25
  Omit the mode declaration only for pure conversational exchanges that do not
26
26
  advance a task (e.g., answering a factual question, clarifying scope).
27
27
 
28
+ In continuous autonomous execution (DELEGATED / Fast-Track), the agent opens with the starting phase's mode. When transitioning across phases within a single turn, emit an explicit transition marker:
29
+ `>>> [PHASE TRANSITION: <OLD_PHASE> -> <NEW_PHASE>]` and proceed under the new mode immediately without pausing.
30
+
31
+ ---
32
+
33
+ ## 2. Working Modes & Phase Transition Protocol
34
+
35
+ <working_modes_protocol>
36
+ Execution posture is determined by `<working_mode>` in `task.md` or user prompt instruction:
37
+
38
+ ### PAIR Mode (Default — Step-by-Step Collaboration):
39
+ - The agent works on one phase at a time.
40
+ - Upon completing a phase, it updates the corresponding artifact and **HALTS** to let the human engineer inspect, discuss, and sign off the Gate (G1, G2, G3).
41
+ - Waits for user prompt (e.g., "Start next phase") before updating `<current_phase>` in `task.md` and continuing.
42
+
43
+ ### DELEGATED Mode (Autonomous / Fast-Track / Skip Permissions):
44
+ - **Activation:** `<working_mode>DELEGATED</working_mode>` in `task.md` OR explicit prompt directive ("fast-track", "skip permissions", "run automatically", "auto-advance", "autonomous").
45
+ - **Core Rule:** **DO NOT HALT AFTER EACH PHASE TO WAIT FOR USER PROMPT "NEXT".**
46
+ - **Continuous Transition Workflow:**
47
+ 1. When the current phase meets its exit criteria/checklist, the agent checks `- [x]`.
48
+ 2. Populates auto-approval into the artifact: `approved_by: [AUTO: DELEGATED]` with timestamp and technical rationale (in INNOVATE: adopts the optimal Recommendation; in PLAN: locks the scope contract).
49
+ 3. Immediately updates `<current_phase>` in `task.md` to the next phase (`RESEARCH` → `INNOVATE` → `PLAN` → `EXECUTE` → `REVIEW`).
50
+ 4. Instantiates the next phase seed artifact (Copy-On-Demand) and **CONTINUES EXECUTION IMMEDIATELY** within the same session/turn.
51
+ - **Sole Stop Conditions in DELEGATED:**
52
+ - Task is 100% COMPLETE (Gate 3 PASS, housekeeping cleaned, `handoff.md` generated, moved to `completed/`).
53
+ - OR a true Escalation Trigger is tripped (retry budget exhausted after 3 attempts, destructive command, or unresolvable invariant conflict).
54
+
55
+ ### MANUAL & DIAGNOSE-ONLY Modes:
56
+ - `MANUAL`: Human leads command-by-command; agent provides scoped assistance.
57
+ - `DIAGNOSE-ONLY`: Runs Research & Review for root-cause audit without mutating source code.
58
+ </working_modes_protocol>
59
+
28
60
  ---
29
61
 
30
- ## 2. Session Startup Protocol
62
+ ## 3. Session Startup Protocol
31
63
 
32
64
  Before continuing any in-progress task, reload persistent state in this order:
33
65
 
@@ -45,7 +77,7 @@ file-based artifacts listed above.
45
77
 
46
78
  ---
47
79
 
48
- ## 3. Context Navigation Rules
80
+ ## 4. Context Navigation Rules
49
81
 
50
82
  <context_rules>
51
83
  <rule id="minimum_context">
@@ -39,10 +39,11 @@
39
39
  not declared in the approved plan.
40
40
  3. Required change touches a file outside the scope defined in `plan.md`.
41
41
  4. A business or policy decision is needed that is not in `<approved_decisions>`.
42
+ (Exception: Under DELEGATED / Fast-Track mode, the agent is authorized to select the recommended technical option evaluated in `decision.md` without triggering escalation, provided it preserves `<invariants>` and `<out_of_scope>`).
42
43
  5. Scope expansion is needed beyond `<out_of_scope>` in `task.md`.
43
44
 
44
45
  Exception: Do NOT halt if the change was explicitly authorized by the user
45
- in the prompt/spec, or if it is a mandatory accompanying test or import update.
46
+ in the prompt/spec (under DELEGATED, fast-track, or skip permissions), or if it is a mandatory accompanying test or import update.
46
47
  </escalation_triggers>
47
48
 
48
49
  ---
@@ -69,6 +69,12 @@
69
69
 
70
70
  <riper5_protocol>
71
71
 
72
+ <!-- ─────────────────── WORKING MODES ─────────────────── -->
73
+ <working_modes>
74
+ <mode id="PAIR" default="true">Step-by-step collaboration. Halts after each phase for human engineer review and gate sign-off.</mode>
75
+ <mode id="DELEGATED" alias="fast-track,autonomous,skip-permissions">Autonomous delegation. When task.md has working_mode=DELEGATED or the user specifies fast-track / skip permissions, the agent auto-certifies qualifying gates ([AUTO: DELEGATED]), advances task.md current_phase, and executes continuously without pausing for "next phase" prompts.</mode>
76
+ </working_modes>
77
+
72
78
  <!-- ─────────────────── PHASE CONSTRAINTS ─────────────────── -->
73
79
 
74
80
  <phase name="RESEARCH" order="1">
@@ -76,15 +82,16 @@
76
82
  <constraint>No implementation decisions.</constraint>
77
83
  <constraint>No architectural choices.</constraint>
78
84
  <output>Produce/update `research.md`. Classify evidence as Confirmed / Observed / Hypothesized.</output>
79
- <gate id="G0">All Research Exit Criteria in `research.md` checked before advancing.</gate>
85
+ <gate id="G0">All Research Exit Criteria in `research.md` checked before advancing. In DELEGATED / Fast-Track, the agent auto-certifies and advances to INNOVATE immediately.</gate>
80
86
  </phase>
81
87
 
82
88
  <phase name="INNOVATE" order="2">
83
89
  <constraint>READ-ONLY. No source-code modifications.</constraint>
84
- <constraint>Present 2–3 viable options with trade-off matrix. Do NOT decide unilaterally.</constraint>
85
- <constraint>Never decide public API / DB schema / security policy / business policy without human approval.</constraint>
86
- <output>Produce `decision.md`. Leave `<engineer_decision>` blank human fills it.</output>
87
- <gate id="G1">Gate 1 in `decision.md` checked and signed by engineer before advancing to Plan.</gate>
90
+ <constraint>Present 2–3 viable options with trade-off matrix.</constraint>
91
+ <constraint>PAIR mode: Leave `<engineer_decision>` blank for the human engineer to review and complete.</constraint>
92
+ <constraint>DELEGATED / Fast-Track mode: Automatically adopt the optimal Recommendation, record rationale with `[AUTO: DELEGATED]`, sign Gate 1, and immediately advance to PLAN.</constraint>
93
+ <output>Produce `decision.md`.</output>
94
+ <gate id="G1">Gate 1 in `decision.md` signed by engineer (PAIR) or auto-certified by agent with `[AUTO: DELEGATED]` (DELEGATED/Fast-Track) before advancing to Plan.</gate>
88
95
  </phase>
89
96
 
90
97
  <phase name="PLAN" order="3">
@@ -92,7 +99,7 @@
92
99
  <constraint>Every slice must have a defined verifier, expected evidence, and rollback point.</constraint>
93
100
  <constraint>Scope contract (allowed / forbidden files) must be explicit.</constraint>
94
101
  <output>Produce `plan.md`. Populate Verification Matrix headers.</output>
95
- <gate id="G2">Gate 2 in `plan.md` checked and signed by engineer before advancing to Execute.</gate>
102
+ <gate id="G2">Gate 2 in `plan.md` signed by engineer (PAIR) or auto-certified by agent with `[AUTO: DELEGATED]` (DELEGATED/Fast-Track) before advancing to Execute.</gate>
96
103
  </phase>
97
104
 
98
105
  <phase name="EXECUTE" order="4">
@@ -100,7 +107,7 @@
100
107
  <constraint>One slice at a time. Run verifier after each slice. Inspect diff after each slice.</constraint>
101
108
  <constraint>No unrelated refactoring. No changes to forbidden files.</constraint>
102
109
  <constraint>Update `state.md` after every slice.</constraint>
103
- <output>Source code + tests + updated `state.md` with verification evidence.</output>
110
+ <output>Source code + tests + updated `state.md` with verification evidence. When all slices pass, advance directly to REVIEW.</output>
104
111
  </phase>
105
112
 
106
113
  <phase name="REVIEW" order="5">
@@ -108,7 +115,7 @@
108
115
  <constraint>No code fixes during review. Log findings in `review.md` instead.</constraint>
109
116
  <constraint>Cover: behavior, architecture, data, security, regression.</constraint>
110
117
  <output>Produce `review.md` with findings classified by category/severity/type and Gate 3 checklist.</output>
111
- <gate id="G3">Gate 3 in `review.md` checked before handoff. Review decision must be PASS.</gate>
118
+ <gate id="G3">Gate 3 in `review.md` must PASS before handoff. In DELEGATED mode, the agent performs full audit, creates `handoff.md`, moves task to `completed/`, and reports completion.</gate>
112
119
  </phase>
113
120
 
114
121
  <!-- Behavior rules (mode declaration, retry, escalation, completion gate) →
@@ -24,6 +24,7 @@ process/
24
24
  │ ├── review-template.md.seed # Review phase artifact (Gate 3)
25
25
  │ ├── handoff-template.md.seed # Final projection (short)
26
26
  │ ├── cancellation-template.md.seed # Knowledge-preserving cancellation record
27
+ │ ├── pause-template.md.seed # Task pause & parking record (temporary blockages)
27
28
  │ ├── results-template.tsv.seed # Benchmark & quantitative metrics tracker
28
29
  │ └── program-template.md.seed # Multi-phase program blueprint
29
30
  ├── context/ # Durable knowledge base & context routers
@@ -45,6 +46,7 @@ process/
45
46
  │ │ ├── review.md # Review phase output
46
47
  │ │ ├── handoff.md # Final projection
47
48
  │ │ ├── results.tsv # (Optional) Benchmark & metric iteration tracking
49
+ │ │ ├── paused.md # (If paused) Parking record & resumption criteria
48
50
  │ │ └── cancelled.md # (If aborted) Cancellation findings & rollback status
49
51
  │ ├── completed/ # Archived task workspaces
50
52
  │ └── backlog/ # Backlog notes: {note_slug}_NOTE_{dd-mm-yy}.md
@@ -69,16 +71,16 @@ flowchart TD
69
71
  Task --> Res["research.md"] --> G0{"Gate G0 (Auto)"}
70
72
  end
71
73
  subgraph I2["2. INNOVATE (Read-Only)"]
72
- G0 --> Dec["decision.md (2-3 Options)"] --> G1{"Gate G1 (Human Approval)"}
74
+ G0 --> Dec["decision.md (2-3 Options)"] --> G1{"Gate G1 (Engineer or Auto-DELEGATED)"}
73
75
  end
74
76
  subgraph P3["3. PLAN (Plan-Only)"]
75
- G1 --> Plan["plan.md (Vertical Slices)"] --> G2{"Gate G2 (Human Sign-off)"}
77
+ G1 --> Plan["plan.md (Vertical Slices)"] --> G2{"Gate G2 (Engineer or Auto-DELEGATED)"}
76
78
  end
77
79
  subgraph E4["4. EXECUTE (Scoped R/W)"]
78
80
  G2 --> Code["Implement Slice"] --> Test["Run Verifiers"] --> State["state.md (Memory)"]
79
81
  end
80
82
  subgraph R5["5. REVIEW (Read-Only)"]
81
- State --> Rev["review.md (Audit)"] --> G3{"Gate G3 (Human Approval)"}
83
+ State --> Rev["review.md (Audit)"] --> G3{"Gate G3 (Engineer or Auto-DELEGATED)"}
82
84
  end
83
85
  subgraph Done["6. COMPLETE"]
84
86
  G3 --> Arch["Move to completed/"] --> Handoff["handoff.md"]
@@ -88,10 +90,10 @@ flowchart TD
88
90
  ```text
89
91
  task.md ← (always) Master contract, RIPER phase/gate state, AC, decisions
90
92
  research.md ← (Research) Execution flow, evidence, boundaries
91
- decision.md ← (Innovate) Options, trade-offs, Gate 1 engineer must approve
92
- plan.md ← (Plan) Slices, verifiers, scope contract, Gate 2 engineer must approve
93
+ decision.md ← (Innovate) Options, trade-offs, Gate 1 (Engineer approval or Auto-DELEGATED)
94
+ plan.md ← (Plan) Slices, verifiers, scope contract, Gate 2 (Engineer sign-off or Auto-DELEGATED)
93
95
  state.md ← (Execute) Per-slice progress, failure memory, retry budget
94
- review.md ← (Review) Findings, verification matrix, Gate 3
96
+ review.md ← (Review) Findings, verification matrix, Gate 3 (PASS)
95
97
  handoff.md ← (Complete) Short final projection
96
98
  ```
97
99
 
@@ -107,8 +109,10 @@ handoff.md ← (Complete) Short final projection
107
109
  | Execute | source code + tests + `state.md` |
108
110
  | Review | `review.md` |
109
111
  | Handoff | `handoff.md` |
112
+ | Pause / Park | `paused.md` (clean freeze & resumption criteria upon temporary block) |
110
113
  | Cancellation | `cancelled.md` (knowledge preservation upon abort) |
111
114
  | Benchmark / Metrics | `results.tsv` (performance and eval metrics) |
115
+ | Program | `program.md` (multi-phase umbrella epic blueprint) |
112
116
  | Gate 1 | `decision.md` approval |
113
117
  | Gate 2 | `plan.md` approval |
114
118
  | Gate 3 | `review.md` approval |
@@ -126,14 +130,14 @@ handoff.md ← (Complete) Short final projection
126
130
  </phase>
127
131
 
128
132
  <phase order="2" name="Innovate">
129
- READ-ONLY. Present 2–3 options with trade-off matrix. Do not decide unilaterally.
130
- Produce `decision.md`. Engineer approves Gate 1.
133
+ READ-ONLY. Present 2–3 options with trade-off matrix.
134
+ Produce `decision.md`. Gate 1: Engineer approves (PAIR mode) or Agent auto-certifies optimal recommendation [AUTO: DELEGATED] (DELEGATED/Fast-Track mode).
131
135
  </phase>
132
136
 
133
137
  <phase order="3" name="Plan">
134
138
  Plan artifacts only — no source changes.
135
139
  Decompose into vertical slices with verifiers, rollback points, and scope contract.
136
- Produce `plan.md`. Engineer approves Gate 2.
140
+ Produce `plan.md`. Gate 2: Engineer approves (PAIR mode) or Agent auto-certifies scope contract [AUTO: DELEGATED] (DELEGATED/Fast-Track mode).
137
141
  </phase>
138
142
 
139
143
  <phase order="4" name="Execute">
@@ -143,7 +147,7 @@ handoff.md ← (Complete) Short final projection
143
147
 
144
148
  <phase order="5" name="Review">
145
149
  READ-ONLY. May run verification commands. No code fixes.
146
- Produce `review.md` with findings. Gate 3 must pass before handoff.
150
+ Produce `review.md` with findings. Gate 3 must pass before handoff. Under DELEGATED mode, Agent auto-completes housekeeping and creates `handoff.md`.
147
151
  </phase>
148
152
  </operational_phases>
149
153
 
@@ -12,7 +12,7 @@
12
12
  ### Seeds Architectural Rationale: Understanding "Why" & "How"
13
13
  * **Why the `.seed` extension? (Why):** The `.seed` suffix acts as an immutable boundary. It prevents automated AI discovery tools (`find`, `grep`) from confusing archetype templates with active `*.md` task files. This guarantees agents will never accidentally overwrite master blueprints during execution.
14
14
  * **Why separate seeds per phase? (Why):** Each phase of RIPER-5 requires a distinct cognitive posture and permission boundary (Research vs Innovate vs Plan vs Execute vs Review). Splitting archetypes prevents context window bloat (Anti-Context Saturation), avoids hallucinations, and anchors each Quality Gate (G1–G3) to an auditable physical artifact.
15
- * **Copy-On-Demand Protocol (How):** Never bulk-copy all seeds into a task directory. Start exclusively with `task.md`. Sequentially instantiate subsequent artifacts (`research.md` $\rightarrow$ `decision.md` $\rightarrow$ `plan.md` $\rightarrow$ `state.md` $\rightarrow$ `review.md` $\rightarrow$ `handoff.md`) only as the task progresses into each phase.
15
+ * **Copy-On-Demand Protocol (How):** Never bulk-copy all seeds into a task directory. Start exclusively with `task.md`. Sequentially instantiate subsequent artifacts (`research.md` $\rightarrow$ `decision.md` $\rightarrow$ `plan.md` $\rightarrow$ `state.md` $\rightarrow$ `review.md` $\rightarrow$ `handoff.md`) only as the task progresses into each phase. In PAIR mode, the agent pauses for human gate approvals; in DELEGATED / Fast-Track mode, the agent auto-instantiates subsequent seeds, auto-certifies gates, and executes continuously without interruptions.
16
16
  </architectural_rationale>
17
17
 
18
18
  ---
@@ -23,7 +23,7 @@
23
23
 
24
24
  <seed type="task" path="task-template.md.seed">
25
25
  Master contract and state record for the full RIPER-5 lifecycle.
26
- Contains: Task Control metadata, Spec, Context Boundaries, Verification Strategy,
26
+ Contains: Task Control metadata (working_mode PAIR/DELEGATED), Spec, Context Boundaries, Verification Strategy,
27
27
  Decisions, RIPER-5 Execution Plan (with Gates G0–G3), and Guardrails.
28
28
  </seed>
29
29
 
@@ -38,7 +38,7 @@
38
38
  <seed type="decision" path="decision-template.md.seed">
39
39
  Innovate phase artifact. Gate 1 memory.
40
40
  Contains: Decision question, Options (A/B/C) with trade-off matrix,
41
- Recommendation, Engineer Decision (must be filled by human), Constraints Created,
41
+ Recommendation, Implementation Decision (filled by engineer in PAIR, or auto-selected in DELEGATED), Constraints Created,
42
42
  Evidence Still Required, and Gate 1 checklist.
43
43
  </seed>
44
44
 
@@ -121,9 +121,13 @@ handoff.md ← Final projection (short)
121
121
  | Execute | source code + tests + `state.md` |
122
122
  | Review | `review.md` |
123
123
  | Handoff | `handoff.md` |
124
- | Gate 1 | `decision.md` approval |
125
- | Gate 2 | `plan.md` approval |
126
- | Gate 3 | `review.md` approval |
124
+ | Pause / Park | `paused.md` (clean freeze & resumption checklist) |
125
+ | Cancellation | `cancelled.md` (knowledge preservation upon abort) |
126
+ | Benchmark / Metrics | `results.tsv` (performance and eval metrics) |
127
+ | Program | `program.md` (multi-phase umbrella epic blueprint) |
128
+ | Gate 1 | `decision.md` approval (Engineer or Auto-DELEGATED) |
129
+ | Gate 2 | `plan.md` approval (Engineer or Auto-DELEGATED) |
130
+ | Gate 3 | `review.md` approval (Engineer or Auto-DELEGATED) |
127
131
 
128
132
  ---
129
133
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  <technical_decision task_id="[TASK-ID]" dec_id="[DEC-ID]" version="1.0" framework="RIPER-5">
4
4
 
5
- <!-- READ-ONLY PHASE. Present options. Do not decide without engineer approval. -->
5
+ <!-- READ-ONLY PHASE. Present options. PAIR: engineer decides. DELEGATED: agent auto-selects optimal recommendation and advances. -->
6
6
  <decision_status>
7
7
  <phase>INNOVATE</phase>
8
8
  <mode>READ-ONLY</mode>
@@ -98,9 +98,11 @@
98
98
 
99
99
  ---
100
100
 
101
- ## 6. Engineer Decision
101
+ ## 6. Implementation Decision
102
102
 
103
- <!-- This section must be completed by the engineer before Gate 1 passes -->
103
+ <!-- PAIR mode: Completed by engineer before Gate 1 passes.
104
+ DELEGATED / Fast-Track mode: Agent automatically populates Recommendation
105
+ into <selected_option>, documents rationale, signs Gate 1 with [AUTO: DELEGATED], and proceeds. -->
104
106
  <engineer_decision>
105
107
  <selected_option></selected_option>
106
108
  <rationale></rationale>
@@ -133,10 +135,9 @@
133
135
 
134
136
  <gate id="G1">
135
137
  - [ ] All options presented and trade-offs analyzed.
136
- - [ ] Engineer reviewed options.
137
- - [ ] Engineer selected option recorded above.
138
+ - [ ] Selected option recorded above.
138
139
  - [ ] No blocking business / schema / security decision remains open.
139
- <approved_by></approved_by>
140
+ <approved_by></approved_by> <!-- Engineer name (PAIR) or [AUTO: DELEGATED] (DELEGATED/Fast-Track) -->
140
141
  <approved_date></approved_date>
141
142
  </gate>
142
143
 
@@ -127,8 +127,8 @@
127
127
  - [ ] Stop conditions defined per slice.
128
128
  - [ ] Rollback point defined per slice.
129
129
  - [ ] Allowed commands listed.
130
- - [ ] Engineer approved.
131
- <approved_by></approved_by>
130
+ - [ ] Plan approved.
131
+ <approved_by></approved_by> <!-- Engineer name (PAIR) or [AUTO: DELEGATED] (DELEGATED/Fast-Track) -->
132
132
  <approved_date></approved_date>
133
133
  </gate>
134
134
 
@@ -142,7 +142,7 @@
142
142
  - [ ] Residual risk explicitly accepted.
143
143
  - [ ] Review decision: PASS.
144
144
  - [ ] Ready for handoff.
145
- <approved_by></approved_by>
145
+ <approved_by></approved_by> <!-- Engineer name (PAIR) or [AUTO: DELEGATED] (DELEGATED/Fast-Track) -->
146
146
  <approved_date></approved_date>
147
147
  </gate>
148
148
 
@@ -6,10 +6,12 @@
6
6
  SECTION 0 — TASK CONTROL (master state record)
7
7
  ════════════════════════════════════════════ -->
8
8
  <task_control>
9
- <status>BACKLOG</status> <!-- BACKLOG | ACTIVE | BLOCKED | REVIEW | COMPLETED -->
9
+ <status>BACKLOG</status> <!-- BACKLOG | ACTIVE | BLOCKED | PAUSED | REVIEW | COMPLETED | CANCELLED -->
10
10
  <spec_level>S1</spec_level> <!-- S0=sketch | S1=defined | S2=verified | S3=locked -->
11
+ <priority>P2</priority> <!-- P0=urgent | P1=high | P2=normal | P3=low -->
11
12
  <risk>MEDIUM</risk> <!-- LOW | MEDIUM | HIGH -->
12
- <working_mode>PAIR</working_mode> <!-- MANUAL | PAIR | DELEGATED | DIAGNOSE-ONLY -->
13
+ <estimated_story_points>2</estimated_story_points> <!-- 1 SP 2-4 focused engineering hours -->
14
+ <working_mode>PAIR</working_mode> <!-- PAIR (default: halts at each gate for review) | DELEGATED (fast-track: continuous autonomous run) | MANUAL | DIAGNOSE-ONLY -->
13
15
  <current_phase>RESEARCH</current_phase> <!-- RESEARCH | INNOVATE | PLAN | EXECUTE | REVIEW -->
14
16
  <owner>@engineer</owner>
15
17
  <decision_owner>@engineer</decision_owner>
@@ -63,6 +65,11 @@
63
65
  - `tests/[path/to/test_file]` — [Target assertions and test fixtures]
64
66
  </target_files>
65
67
 
68
+ <context_groups>
69
+ <!-- References to registered context groups from process/context/all-context.md -->
70
+ - [planning | tests | protocols | domain-specific-group]
71
+ </context_groups>
72
+
66
73
  <source_of_truth>
67
74
  <requirement>[Link to requirement or spec]</requirement>
68
75
  <architecture>[Link to architecture doc or ADR]</architecture>
@@ -117,18 +124,19 @@
117
124
  - [ ] Current behavior understood and documented.
118
125
  - [ ] Execution flow traced.
119
126
  - [ ] No unresolved research blocker.
127
+ <!-- In DELEGATED / Fast-Track mode: Agent auto-certifies and advances to Innovate immediately -->
120
128
  </gate>
121
129
  </phase>
122
130
 
123
131
  <phase name="Innovate" order="2">
124
- <!-- READ-ONLY. Present 2-3 viable options. Do not decide unilaterally. -->
132
+ <!-- READ-ONLY. Present 2-3 viable options. PAIR: engineer selects. DELEGATED: agent auto-selects optimal option. -->
125
133
  - [ ] Generate 2–3 alternative approaches with trade-off matrix.
126
134
  - [ ] Produce `decision.md` artifact.
127
135
  <gate id="G1" label="Gate 1 — Decision Approved">
128
- - [ ] Options reviewed by engineer.
136
+ - [ ] Options reviewed and trade-offs analyzed.
129
137
  - [ ] Selected option recorded in `decision.md`.
130
138
  - [ ] No blocking business/schema/security decision remains open.
131
- <approved_by></approved_by>
139
+ <approved_by></approved_by> <!-- Engineer name (PAIR) or [AUTO: DELEGATED] (DELEGATED/Fast-Track) -->
132
140
  <approved_date></approved_date>
133
141
  </gate>
134
142
  </phase>
@@ -142,8 +150,8 @@
142
150
  - [ ] Allowed/forbidden file scope is defined.
143
151
  - [ ] Rollback point defined per slice.
144
152
  - [ ] Stop conditions defined.
145
- - [ ] Engineer approved.
146
- <approved_by></approved_by>
153
+ - [ ] Plan approved.
154
+ <approved_by></approved_by> <!-- Engineer name (PAIR) or [AUTO: DELEGATED] (DELEGATED/Fast-Track) -->
147
155
  <approved_date></approved_date>
148
156
  </gate>
149
157
  </phase>
@@ -154,6 +162,7 @@
154
162
  - [ ] Run verifier after each slice.
155
163
  - [ ] Inspect diff after each slice.
156
164
  - [ ] Update `state.md` after each slice.
165
+ - [ ] (Optional) Record quantitative metric deltas in `results.tsv` if tracking benchmarks/performance.
157
166
  </phase>
158
167
 
159
168
  <phase name="Review" order="5">
@@ -163,9 +172,9 @@
163
172
  <gate id="G3" label="Gate 3 — Review Passed">
164
173
  - [ ] All AC verified with evidence.
165
174
  - [ ] Residual risk accepted.
166
- - [ ] Review decision: PASS | CHANGES_REQUIRED | BLOCKED.
175
+ - [ ] Review decision: PASS.
167
176
  - [ ] Ready for handoff.
168
- <approved_by></approved_by>
177
+ <approved_by></approved_by> <!-- Engineer name (PAIR) or [AUTO: DELEGATED] (DELEGATED/Fast-Track) -->
169
178
  <approved_date></approved_date>
170
179
  </gate>
171
180
  </phase>
@@ -26,7 +26,7 @@
26
26
  <group id="seeds">
27
27
  <title>Seeds & Archetypes Guide</title>
28
28
  <path>[`../_seeds/_GUIDE.md`](../_seeds/_GUIDE.md)</path>
29
- <scope>Scaffolding seeds for tasks, research, decisions, plans, state, reviews, handoffs, and programs. Full artifact chain and instantiation commands.</scope>
29
+ <scope>Scaffolding seeds for tasks, research, decisions, plans, state, reviews, handoffs, pause, cancellation, benchmarks, and programs. Full artifact chain and instantiation commands.</scope>
30
30
  </group>
31
31
 
32
32
  <group id="tests">
@@ -1,31 +1,87 @@
1
1
  # Planning Standards & Calibration Context
2
2
 
3
- <planning_context version="1.0">
3
+ <planning_context version="2.0">
4
4
 
5
5
  <overview>
6
- Guidelines for story point estimation, vertical slicing, and capacity calibration.
6
+ Engineering guidelines for story point estimation, vertical slicing, rollback checkpointing, and capacity calibration.
7
7
  </overview>
8
8
 
9
- ## 1. Quality Standards
9
+ ---
10
+
11
+ ## 1. Quality Standards (INVEST Criteria)
12
+
10
13
  <quality_standards>
11
14
  <standard name="INVEST">
12
- - **Independent:** Deliverable without cross-story blockers.
13
- - **Negotiable:** Implementation details are flexibly refined.
14
- - **Valuable:** Delivers measurable user or business value.
15
- - **Estimable:** Scoped clearly to estimate effort.
16
- - **Small:** Fits within 1-3 engineering days.
17
- - **Testable:** Concrete Acceptance Criteria defined.
18
- </standard>
19
-
20
- <standard name="Vertical Slicing">
21
- Avoid horizontal silos. Deliver end-to-end vertical slices across API, logic, and persistence.
15
+ - **Independent:** Deliverable and verifiable without cross-story circular blockers.
16
+ - **Negotiable:** Implementation details and technical approaches can be flexibly evaluated during the Innovate phase.
17
+ - **Valuable:** Delivers demonstrable capability or verifiable engineering progress.
18
+ - **Estimable:** Scoped tightly enough that effort and file touchpoints can be calculated.
19
+ - **Small:** Sized to fit comfortably within 13 engineering days (or 1–3 Story Points).
20
+ - **Testable:** Accompanied by unambiguous, verifiable Acceptance Criteria (`- [ ]`).
22
21
  </standard>
23
22
  </quality_standards>
24
23
 
25
- ## 2. Capacity Calibration
24
+ ---
25
+
26
+ ## 2. Vertical Slicing Discipline
27
+
28
+ <vertical_slicing>
29
+ ### Vertical Slice vs Horizontal Silo
30
+ - **The Vertical Slice Rule:** Each slice must cut through all required technical layers (e.g. Domain Model $\rightarrow$ Service/Logic $\rightarrow$ Port Adapter/API $\rightarrow$ Automated Test) to deliver one complete, verifiable increment of behavior.
31
+ - **The Horizontal Silo Anti-Pattern:** Never slice horizontally (e.g., Slice 1: create all database tables, Slice 2: create all services, Slice 3: create all endpoints). Horizontal layers cannot be verified independently, leaving the system in a broken or unprovable state until the final slice.
32
+
33
+ ### Vertical Slicing Workflow
34
+ ```text
35
+ [Slice 1: Thin End-to-End Core] ──► Domain Entity + In-Memory Repo + Minimal Endpoint + Passing Test
36
+ [Slice 2: Persistence & Boundary] ──► Real Database Adapter + Migration + Integration Verifier
37
+ [Slice 3: Edge Cases & Validation] ──► Strict Input Sanitization + Error Handlers + Boundary Tests
38
+ ```
39
+ </vertical_slicing>
40
+
41
+ ---
42
+
43
+ ## 3. Slice Sizing, Atomic Verifiability & Checkpoints
44
+
45
+ <slice_sizing>
46
+ <rule id="slice_cardinality">
47
+ A standard task should contain between **2 and 5 vertical slices**. If a task requires more than 5 slices, it has high blast radius and must be decomposed into a Multi-Phase Program (`program-template.md.seed`).
48
+ </rule>
49
+
50
+ <rule id="autonomous_verifier">
51
+ Every single slice in `plan.md` must have an explicit, executable `<verifier>` command (e.g. `npm run test -- test/path/test.js` or `pytest tests/unit/test_slice.py`). A slice is NOT complete until its verifier exits with code 0.
52
+ </rule>
53
+
54
+ <rule id="atomic_checkpoint">
55
+ Commit or checkpoint each slice atomically upon verification passing. This guarantees clean git history and enables instant rollback if subsequent slices encounter irrecoverable regressions.
56
+ </rule>
57
+ </slice_sizing>
58
+
59
+ ---
60
+
61
+ ## 4. Rollback Strategy per Slice
62
+
63
+ <rollback_strategy>
64
+ Every slice in `plan.md` MUST specify a concrete `<rollback_point>`:
65
+ - **Git Checkpoint:** `git checkout -- <allowed_files>` or revert commit hash.
66
+ - **Stash Checkpoint:** `git stash pop` or dedicated WIP branch.
67
+ - **Data/Schema Rollback:** Down-migration script or drop ephemeral test container.
68
+
69
+ If the agent exhausts its 3-attempt retry budget on a slice, it must execute the rollback point before halting and escalating to human guidance.
70
+ </rollback_strategy>
71
+
72
+ ---
73
+
74
+ ## 5. Story Point Capacity Calibration
75
+
26
76
  <capacity_calibration>
27
- <unit>1 Story Point ≈ 2-4 focused engineering hours</unit>
28
- <max_task_size>3-5 Story Points (larger tasks must be decomposed)</max_task_size>
77
+ <unit>1 Story Point (SP) ≈ 24 focused engineering hours</unit>
78
+ <scale>
79
+ - **1 SP:** Straightforward change with clear scope (1-3 files touched, 1-2 slices).
80
+ - **2 SP:** Standard feature or refactoring (3-5 files touched, 2-3 slices).
81
+ - **3 SP:** Moderately complex task touching domain contracts and persistence (4-7 files, 3-4 slices).
82
+ - **5 SP:** Maximum size for a single active task in `process/features/active/`.
83
+ - **> 5 SP:** Oversized. Must be split into multiple standalone tasks or organized under `program-template.md.seed`.
84
+ </scale>
29
85
  </capacity_calibration>
30
86
 
31
87
  </planning_context>