@tianhai/pi-workflow-kit 0.15.0 → 0.17.1
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.
- package/README.md +23 -13
- package/docs/plans/2026-06-03-karpathy-guidelines-ab-comparison.md +166 -0
- package/docs/plans/completed/2026-05-22-agentic-agile-enhancements-design.md +77 -0
- package/docs/plans/completed/2026-05-22-agentic-agile-enhancements-implementation.md +473 -0
- package/docs/plans/completed/2026-05-25-design-review-split-implementation.md +622 -0
- package/docs/plans/completed/2026-05-25-design-review-split-progress.md +16 -0
- package/docs/plans/completed/2026-05-25-pr5-improvements-implementation.md +273 -0
- package/docs/plans/completed/2026-05-25-pr5-improvements-progress.md +17 -0
- package/docs/plans/completed/2026-06-03-add-verify-skill-design.md +51 -0
- package/docs/plans/completed/2026-06-03-add-verify-skill-implementation.md +111 -0
- package/docs/plans/completed/2026-06-03-add-verify-skill-progress.md +11 -0
- package/docs/plans/completed/2026-06-03-verify-skill-design.md +176 -0
- package/extensions/workflow-guard.ts +174 -185
- package/package.json +1 -1
- package/skills/brainstorming/SKILL.md +6 -1
- package/skills/design-review/SKILL.md +113 -0
- package/skills/executing-tasks/SKILL.md +17 -8
- package/skills/finalizing/SKILL.md +5 -3
- package/skills/verify/SKILL.md +170 -0
- package/skills/writing-plans/SKILL.md +121 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# pi-workflow-kit
|
|
2
2
|
|
|
3
|
-
> Stop AI agents from rushing to code. Enforce a structured brainstorm→plan→execute→finalize workflow with TDD discipline.
|
|
3
|
+
> Stop AI agents from rushing to code. Enforce a structured brainstorm→plan→execute→verify→finalize workflow with TDD discipline.
|
|
4
4
|
|
|
5
5
|
AI coding agents tend to skip design and jump straight into implementation, producing over-engineered or misaligned code. **pi-workflow-kit** solves this by hard-blocking write operations during brainstorm and planning phases — the agent *literally cannot modify your source files* until you approve the design.
|
|
6
6
|
|
|
@@ -33,21 +33,21 @@ Enforces phase-appropriate tool access — not just guidelines, but hard blocks:
|
|
|
33
33
|
|
|
34
34
|
The agent can read code and discuss design with you during brainstorm/plan, but it physically cannot modify source files or run mutating commands.
|
|
35
35
|
|
|
36
|
-
### 🧠
|
|
36
|
+
### 🧠 7 Workflow Skills
|
|
37
37
|
|
|
38
38
|
Guide the agent through a disciplined development process:
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
diagnose (anytime)
|
|
44
|
-
```
|
|
40
|
+
brainstorm → design-review → plan → execute → verify → finalize
|
|
41
|
+
↕
|
|
42
|
+
diagnose (anytime)
|
|
45
43
|
|
|
46
44
|
| Phase | Trigger | What Happens |
|
|
47
45
|
|-------|---------|--------------|
|
|
48
46
|
| **Brainstorm** | `/skill:brainstorming` | Explore approaches, debate tradeoffs, produce a design doc |
|
|
49
|
-
| **
|
|
47
|
+
| **Design Review** | `/skill:design-review` | Audit design for production risks (security, scalability, fault tolerance) |
|
|
48
|
+
| **Plan** | `/skill:writing-plans` | Break design into bite-sized TDD tasks with acceptance criteria and concrete code |
|
|
50
49
|
| **Execute** | `/skill:executing-tasks` | Implement tasks one-by-one with TDD discipline and pre-commit checkpoint review gates |
|
|
50
|
+
| **Verify** | `/skill:verify` | Three expert review passes (security, optimization, traceability) on implemented code |
|
|
51
51
|
| **Finalize** | `/skill:finalizing` | Archive plan docs, update README/CHANGELOG, create PR |
|
|
52
52
|
| **Diagnose** | `/skill:diagnose` | 6-phase debugging loop: reproduce → hypothesize → instrument → fix → verify |
|
|
53
53
|
|
|
@@ -57,12 +57,12 @@ brainstorm → plan → execute → finalize
|
|
|
57
57
|
|
|
58
58
|
You control each phase — the agent never advances on its own. Invoke a skill to move forward:
|
|
59
59
|
|
|
60
|
-
```
|
|
61
60
|
/skill:brainstorming → discuss and design
|
|
61
|
+
/skill:design-review → audit for production risks (non-trivial designs)
|
|
62
62
|
/skill:writing-plans → break into tasks
|
|
63
63
|
/skill:executing-tasks → implement with TDD
|
|
64
|
+
/skill:verify → review code for security, optimization, and traceability issues
|
|
64
65
|
/skill:finalizing → ship it
|
|
65
|
-
```
|
|
66
66
|
|
|
67
67
|
### TDD Three-Scenario Model
|
|
68
68
|
|
|
@@ -116,15 +116,23 @@ pi install npm:@tianhai/pi-workflow-kit
|
|
|
116
116
|
# (agent explores approaches, writes design doc)
|
|
117
117
|
# (write/edit are blocked — your code is safe)
|
|
118
118
|
|
|
119
|
+
> /skill:design-review
|
|
120
|
+
|
|
121
|
+
# (agent audits for security, scalability, fault tolerance)
|
|
122
|
+
# (trivial changes can skip this step)
|
|
123
|
+
|
|
119
124
|
> /skill:writing-plans
|
|
120
125
|
|
|
121
|
-
# (agent breaks design into TDD tasks)
|
|
126
|
+
# (agent breaks design into TDD tasks with acceptance criteria)
|
|
122
127
|
> /skill:executing-tasks
|
|
123
128
|
|
|
124
|
-
# (agent implements with TDD, all tools unlocked)
|
|
129
|
+
# (agent implements with TDD, cognitive persona shifts, all tools unlocked)
|
|
130
|
+
> /skill:verify
|
|
131
|
+
|
|
132
|
+
# (agent runs security, optimization, and traceability reviews on implemented code)
|
|
125
133
|
> /skill:finalizing
|
|
126
134
|
|
|
127
|
-
# (agent archives docs,
|
|
135
|
+
# (agent archives docs, curates lessons, creates PR)
|
|
128
136
|
```
|
|
129
137
|
|
|
130
138
|
## Why?
|
|
@@ -142,8 +150,10 @@ pi-workflow-kit/
|
|
|
142
150
|
│ └── workflow-guard.ts # Write blocker during brainstorm/plan
|
|
143
151
|
├── skills/
|
|
144
152
|
│ ├── brainstorming/SKILL.md
|
|
153
|
+
│ ├── design-review/SKILL.md
|
|
145
154
|
│ ├── writing-plans/SKILL.md
|
|
146
155
|
│ ├── executing-tasks/SKILL.md
|
|
156
|
+
│ ├── verify/SKILL.md
|
|
147
157
|
│ ├── finalizing/SKILL.md
|
|
148
158
|
│ └── diagnose/SKILL.md
|
|
149
159
|
├── tests/
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
# A/B Comparison: Writing Plans — Karpathy Behavioral Guidelines
|
|
2
|
+
|
|
3
|
+
## Setup
|
|
4
|
+
- **Same design doc** (bookmarks: CRUD + search)
|
|
5
|
+
- **Same Go project scaffold**
|
|
6
|
+
- **Same prompt** (no questions, full plan with concrete code)
|
|
7
|
+
- **Variant A** (WITHOUT guidelines): 292-line SKILL.md — original writing-plans skill
|
|
8
|
+
- **Variant B** (WITH guidelines): 354-line SKILL.md — with Behavioral Guidelines section appended
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Structural Comparison
|
|
13
|
+
|
|
14
|
+
| Dimension | A (Without) | B (With) |
|
|
15
|
+
|---|---|---|
|
|
16
|
+
| **Total tasks** | 4 | 6 |
|
|
17
|
+
| **Lines in plan** | ~1,054 | ~1,019 |
|
|
18
|
+
| **New files per plan** | 7 files in Task 1 alone | 1-2 files per task |
|
|
19
|
+
| **External dependency** | None (stdlib only) | `github.com/google/uuid` |
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Task Decomposition
|
|
24
|
+
|
|
25
|
+
### A (Without) — 4 tasks
|
|
26
|
+
| Task | Scope | Files touched |
|
|
27
|
+
|---|---|---|
|
|
28
|
+
| 1 | Bookmark + ALL infrastructure (model, store interface, mem store with full CRUD, service, handler, errors, route, tests) | 7 files |
|
|
29
|
+
| 2 | Delete bookmark | 3 files |
|
|
30
|
+
| 3 | List bookmarks (paginated, cursor) | 3 files |
|
|
31
|
+
| 4 | Search bookmarks (keyword + pagination) | 3 files |
|
|
32
|
+
|
|
33
|
+
### B (With) — 6 tasks
|
|
34
|
+
| Task | Scope | Files touched |
|
|
35
|
+
|---|---|---|
|
|
36
|
+
| 1 | Scaffold (go.mod + model only) | 2 files |
|
|
37
|
+
| 2 | Bookmark a message (store + handler + test + route) | 4 files |
|
|
38
|
+
| 3 | List bookmarks (offset/limit pagination) | 4 files |
|
|
39
|
+
| 4 | Remove a bookmark | 4 files |
|
|
40
|
+
| 5 | Search bookmarks (keyword) | 4 files |
|
|
41
|
+
| 6 | Final wiring + integration lifecycle test | 2 files |
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## Detailed Analysis by Guideline
|
|
46
|
+
|
|
47
|
+
### Simplicity First
|
|
48
|
+
|
|
49
|
+
**A (Without):** ⚠️ **Overbuilt in Task 1.** Task 1 creates a `BookmarkStore` interface with 4 methods (Create, Delete, ListByUser, SearchByUser) — methods that won't be used until Tasks 2-4. It also creates the full `MemoryStore` implementation with all 4 methods, an `errors.go` file, a `Service` struct, AND the handler — all in a single task. The store interface is the full contract upfront before any task exercises most of it.
|
|
50
|
+
|
|
51
|
+
**B (With):** ✅ **Minimal per task.** Task 1 only creates `go.mod` + the `Bookmark` struct. Task 2 introduces `Store` with only `Create`, and `MemStore` with only `Create`. `List` is added to the interface in Task 3, `Delete` in Task 4, `Search` in Task 5 — each method appears when it's needed, not before.
|
|
52
|
+
|
|
53
|
+
**Verdict:** Guidelines had a clear positive effect. Plan B builds only what each task needs.
|
|
54
|
+
|
|
55
|
+
### Surgical Changes
|
|
56
|
+
|
|
57
|
+
**A (Without):** ⚠️ Task 1 touches 7 files in one go (model, store interface, store mem, errors, service, handler, main.go). The Task 1 description says "create the full vertical slice" which bundles infrastructure that isn't tested yet.
|
|
58
|
+
|
|
59
|
+
**B (With):** ✅ Each task touches 1-2 files for new code. Task 1 creates 2 files (go.mod, model.go). Task 2 adds 3 new files + modifies main.go. No task creates more than 4 files.
|
|
60
|
+
|
|
61
|
+
**Verdict:** Guidelines had a clear positive effect. Plan B has tighter blast radius per task.
|
|
62
|
+
|
|
63
|
+
### Think Before Coding (surface assumptions)
|
|
64
|
+
|
|
65
|
+
**A (Without):** ❌ Silent assumptions throughout:
|
|
66
|
+
- Used cursor-based pagination without noting the design just said "paginated" — didn't surface that offset-based vs cursor-based is a choice
|
|
67
|
+
- Added `sync.RWMutex` and concurrent safety without the design mentioning concurrency
|
|
68
|
+
- Created a `Service` layer between handler and store without justification
|
|
69
|
+
|
|
70
|
+
**B (With):** ⚠️ Still has assumptions but more defensible:
|
|
71
|
+
- Used offset/limit pagination (simpler, matches "paginated" literally)
|
|
72
|
+
- No concurrency concerns added (store uses `sync.Mutex` only, no RWMutex overhead)
|
|
73
|
+
- No `Service` layer — handler calls store directly
|
|
74
|
+
- Did add `github.com/google/uuid` dependency without asking — minor assumption
|
|
75
|
+
|
|
76
|
+
**Verdict:** Marginal positive effect. Plan B is less presumptuous but both plans made assumptions. Neither explicitly surfaced tradeoffs to the user.
|
|
77
|
+
|
|
78
|
+
### Goal-Driven Execution
|
|
79
|
+
|
|
80
|
+
**A (Without):** ✅ Good acceptance criteria with Given/When/Then. Has a `checkpoint: test` on 3/4 tasks and `checkpoint: done` on the last task.
|
|
81
|
+
|
|
82
|
+
**B (With):** ✅ Good acceptance criteria. Has `checkpoint: test` on 3 tasks, `checkpoint: done` on 1, and no checkpoint on 2 simpler tasks. Added a full lifecycle integration test in Task 6 that wasn't in A.
|
|
83
|
+
|
|
84
|
+
**Verdict:** Roughly equivalent. Both plans have strong acceptance criteria (required by the base skill). The lifecycle test in B is a nice bonus that catches integration issues.
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## Unrelated Observations (noise, not guidelines)
|
|
89
|
+
|
|
90
|
+
| Observation | A (Without) | B (With) |
|
|
91
|
+
|---|---|---|
|
|
92
|
+
| Pagination style | Cursor-based (more complex) | Offset-based (simpler) |
|
|
93
|
+
| External deps | None | `google/uuid` |
|
|
94
|
+
| Handler method naming | `Create`, `Delete`, `List`, `Search` | `CreateBookmark`, `DeleteBookmark`, `ListBookmarks`, `SearchBookmarks` |
|
|
95
|
+
| Test structure | Single `TestXxx` with `t.Run` subtests | Separate top-level test functions |
|
|
96
|
+
| `make([]T, 0, len)` usage | Yes (mem store candidates) | Yes (list handler, search handler) |
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## Overall Assessment
|
|
101
|
+
|
|
102
|
+
| Guideline | Effect | Evidence |
|
|
103
|
+
|---|---|---|
|
|
104
|
+
| **Simplicity First** | ✅ Strong positive | B builds incrementally; A front-loads the full store interface |
|
|
105
|
+
| **Surgical Changes** | ✅ Positive | B touches fewer files per task (1-4 vs 7 in Task 1) |
|
|
106
|
+
| **Think Before Coding** | ⚠️ Marginal | B made fewer silent assumptions but neither surfaced tradeoffs explicitly |
|
|
107
|
+
| **Goal-Driven Execution** | ≈ Neutral | Both strong; base skill already enforces acceptance criteria |
|
|
108
|
+
|
|
109
|
+
**Bottom line (iteration 1):** The guidelines measurably improved the plan. The biggest win is **Simplicity First** — Plan B's incremental interface growth (adding methods to `Store` as each task needs them) is clearly better than Plan A's upfront full-contract approach. This is exactly the kind of thing "no abstractions for single-use code" catches.
|
|
110
|
+
|
|
111
|
+
**Weakness:** Neither plan explicitly called out assumptions or asked clarifying questions — the "Think Before Coding" guideline had the weakest signal. The guidelines alone may not be enough to overcome the model's tendency to fill gaps silently.
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
## Iteration 2: Revised Guidelines
|
|
116
|
+
|
|
117
|
+
### What changed
|
|
118
|
+
|
|
119
|
+
The guidelines were reworked from 4 generic coding rules to 3 planning-specific principles:
|
|
120
|
+
|
|
121
|
+
| v1 (Generic) | v2 (Planning-Specific) | Why |
|
|
122
|
+
|---|---|---|
|
|
123
|
+
| Think Before Coding | **Surface Assumptions** | v1 said "ask" — the agent ignores this when told not to ask. v2 says "annotate in the plan" with a concrete `> **Assumption:** ...` format and examples of what to annotate. |
|
|
124
|
+
| Simplicity First | **Build Only What Each Task Needs** | Kept the same core principle but added the specific anti-pattern from the v1 A/B test: "don't define interface methods that no task exercises yet." |
|
|
125
|
+
| Surgical Changes | **One Task, One Change** | Reframed from "don't touch adjacent code" to "each task should trace to exactly one user-facing behavior" with a concrete guardrail (max 4 new files). |
|
|
126
|
+
| Goal-Driven Execution | *(removed)* | Redundant — the base skill already enforces Given/When/Then acceptance criteria. |
|
|
127
|
+
|
|
128
|
+
### Iteration 2 Plan (v2 guidelines) vs Iteration 1 Plans
|
|
129
|
+
|
|
130
|
+
| Dimension | A (No guidelines) | B1 (v1 guidelines) | B2 (v2 guidelines) |
|
|
131
|
+
|---|---|---|---|
|
|
132
|
+
| **Total tasks** | 4 | 6 | 4 |
|
|
133
|
+
| **Max files/task** | 7 (Task 1) | 4 | 4 |
|
|
134
|
+
| **Assumptions annotated** | 0 | 0 | **4** (header below) |
|
|
135
|
+
| **External deps** | None | `google/uuid` | None |
|
|
136
|
+
| **Store interface** | 4 methods upfront in Task 1 | 1 method per task | 1 method per task |
|
|
137
|
+
| **Service layer** | Yes (unjustified) | No | No |
|
|
138
|
+
|
|
139
|
+
### The big win: Surface Assumptions
|
|
140
|
+
|
|
141
|
+
Plan B2 opens with four explicit assumption annotations:
|
|
142
|
+
|
|
143
|
+
```
|
|
144
|
+
> **Assumption:** User identification via X-User-ID request header since
|
|
145
|
+
> no auth system exists in the project.
|
|
146
|
+
|
|
147
|
+
> **Assumption:** Bookmarks include a Note field so users can annotate
|
|
148
|
+
> bookmarks. The design says "search by keyword" but doesn't specify
|
|
149
|
+
> the field.
|
|
150
|
+
|
|
151
|
+
> **Assumption:** Offset/limit pagination (not cursor-based).
|
|
152
|
+
|
|
153
|
+
> **Assumption:** In-memory store behind a Store interface.
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
None of the previous plans (A or B1) did this. The v1 "Think Before Coding" guideline was completely invisible in output. The v2 "Surface Assumptions" guideline produced visible, reviewable annotations on the first run.
|
|
157
|
+
|
|
158
|
+
### Iteration 2 Assessment
|
|
159
|
+
|
|
160
|
+
| Guideline | v1 Effect | v2 Effect | Improvement |
|
|
161
|
+
|---|---|---|---|
|
|
162
|
+
| **Surface Assumptions** (was Think Before Coding) | ⚠️ Invisible | ✅ 4 explicit annotations | Complete turnaround — concrete format + examples fixed the weakest signal |
|
|
163
|
+
| **Build Only What's Needed** (was Simplicity First) | ✅ Strong | ✅ Strong | Maintained — interface still grows incrementally |
|
|
164
|
+
| **One Task, One Change** (was Surgical Changes) | ✅ Positive | ✅ Positive | Maintained — max 4 files/task |
|
|
165
|
+
|
|
166
|
+
**Bottom line (iteration 2):** The v2 guidelines fixed the weakest signal from v1. "Surface Assumptions" went from invisible to producing 4 explicit, reviewable annotations. The other two principles maintained their positive effect. The removal of "Goal-Driven Execution" (redundant) reduced noise without losing signal.
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# Design: Agentic Agile & Architectural Rigor Enhancements
|
|
2
|
+
|
|
3
|
+
Enforcing rigorous Agile engineering discipline within `pi-workflow-kit` by introducing Behavioral Acceptance Criteria, Cognitive Persona Shifts, automated Lessons Curation, strict Multi-Pillar Architectural Reviews, and High-Risk Operation Safeguards.
|
|
4
|
+
|
|
5
|
+
## Context & Objectives
|
|
6
|
+
Based on industry standards and modern agentic development templates (such as Microsoft's Agentic Agile model), autonomous coding agents succeed most when operating under tight behavioral boundaries, specialized cognitive roles, and continuous retro/learning loops.
|
|
7
|
+
|
|
8
|
+
We are enhancing `pi-workflow-kit` by mapping out distinct engineering "Hats" and rigorous check-gates directly into our existing phase-based skills without adding repository clutter or introducing flaky external file lookups:
|
|
9
|
+
1. **The QA Engineer Hat** (in `writing-plans`): Defines rigid, testable `Given/When/Then` Acceptance Criteria for both happy and edge paths during planning.
|
|
10
|
+
2. **The Pragmatic Developer & Senior Refactorer Hats** (in `executing-tasks`): Guides the execution loop through clear cognitive phases (Green Light → Polish / Software Craftsmanship).
|
|
11
|
+
3. **The Agile Scrum Master Hat** (in `finalizing`): Cleans up, de-duplicates, and categorizes persistent lessons to prevent context-bloat and maximize the utility of future sprints.
|
|
12
|
+
4. **Architectural Review & Audit Gates**: Formally audits both the design (brainstorming) and the plan (writing-plans) against the 6 core pillars of production-grade software (Robustness, Atomicity, Security, Scalability, Compatibility, and Testability) before allowing the agent to move forward.
|
|
13
|
+
5. **High-Risk Operation Safeguards**: Auto-detects critical execution hazards (unbounded Redis scans, in-memory OOM loops, unthrottled concurrency, long-running transactions, etc.) and mandates strict mitigation steps and verification checkpoints.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Architecture & Detailed Design
|
|
18
|
+
|
|
19
|
+
Because agent workspaces default tool execution and file-reading relative to the user's project directory, external files bundled in NPM global modules are not reliably reachable. Therefore, all guidelines are **inlined directly within the respective `SKILL.md` prompts**. This guarantees 100% reliability, zero repository pollution, and zero runtime performance overhead.
|
|
20
|
+
|
|
21
|
+
### Slice 1: Multi-Pillar Design Review & Risk Detection (`brainstorming`)
|
|
22
|
+
Before concluding a brainstorm and generating a design doc, the agent must put on its **Architect Hat** and evaluate the proposed system against the **6 Pillars of Production-Grade Design**:
|
|
23
|
+
1. **Robustness & Fault Tolerance**: How expected failures are handled, subsystem isolation, and graceful degradation.
|
|
24
|
+
2. **Atomicity & Consistency**: Database transactions, state rollback on error, and endpoint idempotency.
|
|
25
|
+
3. **Security & Access Control**: Input validation/sanitization and authorization checks at the boundary.
|
|
26
|
+
4. **Scalability & Performance**: Connection pooling, closing resource leaks, and preventing N+1 queries.
|
|
27
|
+
5. **Backwards Compatibility**: Schema migration safety, zero-downtime deployment, and API versioning.
|
|
28
|
+
6. **Testability**: Injection seams for external dependencies (APIs, system clocks, randomizers) to keep tests 100% deterministic.
|
|
29
|
+
|
|
30
|
+
#### ⚠️ High-Risk Hazard Auditing
|
|
31
|
+
The agent must proactively audit the design for the **8 High-Risk Production Hazards**:
|
|
32
|
+
1. **Unbounded Redis Deletions / Operations**: Multi-key deletion or scans (e.g. `KEYS` or raw `SCAN` loops) that block single-threaded performance.
|
|
33
|
+
2. **In-Memory OOM Loops**: Fetching complete database datasets into server memory (e.g., raw `select *`) to filter, sort, or map in runtime heap.
|
|
34
|
+
3. **Unbounded Concurrency Spikes**: Running concurrent network requests (e.g. unthrottled `Promise.all`) without strict batch limits (e.g., `p-limit`).
|
|
35
|
+
4. **Missing High-Frequency Indexes**: Running queries on unindexed columns, forcing expensive table-scans under load.
|
|
36
|
+
5. **Nested/Long-Running Transactions**: Holding database connections and locks open while awaiting slow external HTTP, disk, or cryptographic tasks.
|
|
37
|
+
6. **Unrestricted Uploads & Temp Flooding**: Writing uploaded data directly to local temporary paths without validation limits or explicit `finally` cleanup blocks.
|
|
38
|
+
7. **Raw Query String Interpolation**: Merging raw variables into SQL queries or shell command inputs (susceptible to injection).
|
|
39
|
+
8. **Silent Swallowing loops**: Background workers or cron tasks silently catching and suppressing exceptions without logging, back-offs, or alerts.
|
|
40
|
+
|
|
41
|
+
#### 🔍 Discovering Unknown & Contextual Risks (Socratic Heuristics)
|
|
42
|
+
To identify novel or domain-specific risks that fall outside the standard checklist, the agent must put on its **SRE Hat** and audit the proposed logic against the **3 Socratic Heuristics**:
|
|
43
|
+
* **The "Scale to 100x" Heuristic (Resource Exhaustion)**: If this operation is run 100x/sec or on 100k items, what breaks? (Memory, CPU, Disk I/O, sockets, database connection limits).
|
|
44
|
+
* **The "Hostile World" Heuristic (Security & Malice)**: If a malicious actor has complete control over these inputs (headers, payloads, IDs), how can they exploit, crash, or extract data?
|
|
45
|
+
* **The "Silent Error" Heuristic (Observability & Partitioning)**: If this downstream dependency or query hangs or fails silently, how does our server react? Is there a timeout, a back-off, or logging?
|
|
46
|
+
|
|
47
|
+
If any of the standard hazards or Socratic risks are identified, the design document **must** include a dedicated `⚠️ High-Risk Operations & Mitigations` section detailing the exact safety protocols applied.
|
|
48
|
+
|
|
49
|
+
### Slice 2: Behavioral Acceptance Criteria & Plan Audit (`writing-plans`)
|
|
50
|
+
The planning process is enhanced to mandate behavior-driven specifications and an automated plan verification step.
|
|
51
|
+
|
|
52
|
+
- **Role**: QA Engineer Hat.
|
|
53
|
+
- **Specification Format**: Mandatory `Given/When/Then` blocks covering the Happy Path and Edge/Error Paths.
|
|
54
|
+
- **Plan Acceptance Audit**: Before presenting the plan to the user, the agent must verify:
|
|
55
|
+
- Every task is a complete vertical slice.
|
|
56
|
+
- Sizing is correct (no monolithic tasks).
|
|
57
|
+
- Checkpoint gates are placed on the most critical/risky tasks.
|
|
58
|
+
- **Risk Enforcement**: Any task containing any of the **8 High-Risk Hazards** or **Socratic Heuristics risks** is strictly required to have a mandatory `checkpoint: done` gate and explicit verification guidelines.
|
|
59
|
+
|
|
60
|
+
### Slice 3: Cognitive Persona Shifts (`executing-tasks`)
|
|
61
|
+
The implementation execution loop is updated to divide the cognitive workload of a single task into three distinct phases.
|
|
62
|
+
|
|
63
|
+
- **Phase 1: QA Test Phase**: Translate the Given/When/Then specs into failing test cases.
|
|
64
|
+
- **Phase 2: Pragmatic Developer Phase**: Implement the simplest, raw code to green the tests.
|
|
65
|
+
- **Phase 3: Senior Refactoring Phase**: Refactor and polish using software craftsmanship principles (Shallow Modules, Deletion Test, Duplication, Seam Discipline).
|
|
66
|
+
|
|
67
|
+
### Slice 4: Lessons Curation & Caching (`finalizing`)
|
|
68
|
+
The finalizing phase is upgraded to run a structured retrospective on our persistent learning files.
|
|
69
|
+
|
|
70
|
+
- **Role**: Agile Scrum Master Hat.
|
|
71
|
+
- **Curating Rules**: De-duplicate, validate against the Generalization Test, and categorize rules under distinct headers (e.g., `# Tool Usage`, `# Testing Patterns`, `# Architecture Rules`).
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## Verification & Testing Plan
|
|
76
|
+
- **Manual Verification**: Run a mock `/skill:writing-plans` and `/skill:executing-tasks` to verify the generated implementation plan matches our QA template and the task-running agent correctly segments its progress through the three cognitive hats.
|
|
77
|
+
- **Automated Tests**: Confirm existing Vitest suites run successfully without side-effects.
|