@leing2021/super-pi 0.14.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.
- package/README.md +372 -0
- package/extensions/.gitkeep +0 -0
- package/extensions/ce-core/index.ts +528 -0
- package/extensions/ce-core/tools/artifact-helper.ts +73 -0
- package/extensions/ce-core/tools/ask-user-question.ts +53 -0
- package/extensions/ce-core/tools/brainstorm-dialog.ts +167 -0
- package/extensions/ce-core/tools/parallel-subagent.ts +54 -0
- package/extensions/ce-core/tools/pattern-extractor.ts +139 -0
- package/extensions/ce-core/tools/plan-diff.ts +136 -0
- package/extensions/ce-core/tools/review-router.ts +95 -0
- package/extensions/ce-core/tools/session-checkpoint.ts +212 -0
- package/extensions/ce-core/tools/session-history.ts +117 -0
- package/extensions/ce-core/tools/subagent.ts +59 -0
- package/extensions/ce-core/tools/task-splitter.ts +122 -0
- package/extensions/ce-core/tools/workflow-state.ts +80 -0
- package/extensions/ce-core/tools/worktree-manager.ts +131 -0
- package/extensions/ce-core/utils/artifact-paths.ts +23 -0
- package/extensions/ce-core/utils/name-utils.ts +8 -0
- package/package.json +53 -0
- package/skills/.gitkeep +0 -0
- package/skills/01-brainstorm/SKILL.md +120 -0
- package/skills/01-brainstorm/references/builder-mode.md +39 -0
- package/skills/01-brainstorm/references/handoff.md +8 -0
- package/skills/01-brainstorm/references/premise-challenge.md +23 -0
- package/skills/01-brainstorm/references/requirements-template.md +25 -0
- package/skills/01-brainstorm/references/startup-diagnostic.md +108 -0
- package/skills/02-plan/SKILL.md +77 -0
- package/skills/02-plan/references/ceo-review-mode.md +130 -0
- package/skills/02-plan/references/handoff.md +8 -0
- package/skills/02-plan/references/implementation-unit-template.md +25 -0
- package/skills/02-plan/references/plan-template.md +21 -0
- package/skills/03-work/SKILL.md +65 -0
- package/skills/03-work/references/handoff.md +8 -0
- package/skills/03-work/references/progress-update-format.md +17 -0
- package/skills/04-review/SKILL.md +72 -0
- package/skills/04-review/references/findings-schema.md +17 -0
- package/skills/04-review/references/handoff.md +20 -0
- package/skills/04-review/references/qa-test-mode.md +134 -0
- package/skills/04-review/references/reviewer-selection.md +24 -0
- package/skills/05-compound/SKILL.md +32 -0
- package/skills/05-compound/assets/solution-template.md +27 -0
- package/skills/05-compound/references/category-map.md +9 -0
- package/skills/05-compound/references/overlap-rules.md +7 -0
- package/skills/05-compound/references/solution-schema.yaml +27 -0
- package/skills/05-compound/references/solution-search-strategy.md +60 -0
- package/skills/06-next/SKILL.md +37 -0
- package/skills/06-next/references/recommendation-logic.md +46 -0
- package/skills/07-worktree/SKILL.md +35 -0
- package/skills/07-worktree/references/worktree-lifecycle.md +22 -0
- package/skills/08-status/SKILL.md +41 -0
- package/skills/08-status/references/artifact-locations.md +10 -0
- package/skills/09-help/SKILL.md +37 -0
- package/skills/09-help/references/workflow-sequence.md +9 -0
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
# CEO Review Mode
|
|
2
|
+
|
|
3
|
+
After the plan is produced, offer the user an optional CEO-style review. This adds strategic depth without changing the core planning flow.
|
|
4
|
+
|
|
5
|
+
## When to offer
|
|
6
|
+
|
|
7
|
+
After the plan artifact is written to `docs/plans/`, ask the user:
|
|
8
|
+
|
|
9
|
+
> Plan ready. How do you want to review it?
|
|
10
|
+
>
|
|
11
|
+
> - **Just go** — trust the plan, skip review (existing behavior)
|
|
12
|
+
> - **CEO Review** — challenge premises, check for better alternatives, dream-state mapping
|
|
13
|
+
> - **Strict Review** — full CEO Review plus error maps, failure modes, test diagrams
|
|
14
|
+
|
|
15
|
+
If the user picks "Just go", proceed directly to the `03-work` handoff.
|
|
16
|
+
|
|
17
|
+
## CEO Review steps
|
|
18
|
+
|
|
19
|
+
### 1. Premise Challenge
|
|
20
|
+
|
|
21
|
+
Re-examine the plan's assumptions:
|
|
22
|
+
- Is this the right problem to solve? Could a different framing yield a simpler solution?
|
|
23
|
+
- What is the actual user/business outcome? Is the plan the most direct path?
|
|
24
|
+
- What happens if we do nothing? Real pain or hypothetical?
|
|
25
|
+
|
|
26
|
+
Present findings as premises the user must agree with. Use `ask_user_question` for each.
|
|
27
|
+
|
|
28
|
+
### 2. Dream State Mapping
|
|
29
|
+
|
|
30
|
+
Describe the ideal end state 12 months from now. Does this plan move toward it?
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
CURRENT STATE THIS PLAN 12-MONTH IDEAL
|
|
34
|
+
[describe] ---> [describe delta] ---> [describe target]
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### 3. Implementation Alternatives (MANDATORY)
|
|
38
|
+
|
|
39
|
+
Produce 2-3 distinct approaches. This is NOT optional.
|
|
40
|
+
|
|
41
|
+
For each approach:
|
|
42
|
+
```
|
|
43
|
+
APPROACH A: [Name]
|
|
44
|
+
Summary: [1-2 sentences]
|
|
45
|
+
Effort: [S/M/L/XL]
|
|
46
|
+
Risk: [Low/Med/High]
|
|
47
|
+
Pros: [2-3 bullets]
|
|
48
|
+
Cons: [2-3 bullets]
|
|
49
|
+
Reuses: [existing code/patterns leveraged]
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Rules:
|
|
53
|
+
- At least 2 approaches required.
|
|
54
|
+
- One must be "minimal viable" (fewest files, smallest diff).
|
|
55
|
+
- One must be "ideal architecture" (best long-term trajectory).
|
|
56
|
+
- Recommend one and explain why.
|
|
57
|
+
|
|
58
|
+
### 4. Temporal Interrogation
|
|
59
|
+
|
|
60
|
+
Think ahead to implementation. What decisions should be resolved NOW?
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
HOUR 1 (foundations): What does the implementer need to know?
|
|
64
|
+
HOUR 2-3 (core logic): What ambiguities will they hit?
|
|
65
|
+
HOUR 4-5 (integration): What will surprise them?
|
|
66
|
+
HOUR 6+ (polish/tests): What will they wish they'd planned for?
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Surface these as questions NOW, not "figure it out later."
|
|
70
|
+
|
|
71
|
+
## Strict Review additions
|
|
72
|
+
|
|
73
|
+
If the user chose "Strict Review", add these on top of CEO Review:
|
|
74
|
+
|
|
75
|
+
### 5. Error and Rescue Map
|
|
76
|
+
|
|
77
|
+
For every new method/codepath that can fail:
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
METHOD/CODEPATH | WHAT CAN GO WRONG | EXCEPTION CLASS
|
|
81
|
+
-------------------|-----------------------|-----------------
|
|
82
|
+
ExampleService#call| API timeout | TimeoutError
|
|
83
|
+
| Malformed response | JSONParseError
|
|
84
|
+
|
|
85
|
+
EXCEPTION CLASS | RESCUED? | RESCUE ACTION | USER SEES
|
|
86
|
+
-------------------|----------|--------------------|------------------
|
|
87
|
+
TimeoutError | Y | Retry 2x, then raise | "Temporarily unavailable"
|
|
88
|
+
JSONParseError | N (GAP) | - | 500 error (BAD)
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### 6. Failure Modes Registry
|
|
92
|
+
|
|
93
|
+
```
|
|
94
|
+
CODEPATH | FAILURE MODE | RESCUED? | TEST? | USER SEES? | LOGGED?
|
|
95
|
+
---------|----------------|----------|-------|-------------|--------
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Any row with RESCUED=N, TEST=N, USER SEES=Silent is a **CRITICAL GAP**.
|
|
99
|
+
|
|
100
|
+
### 7. Test Diagram
|
|
101
|
+
|
|
102
|
+
Map every new thing the plan introduces:
|
|
103
|
+
- New UX flows
|
|
104
|
+
- New data flows
|
|
105
|
+
- New codepaths
|
|
106
|
+
- New error/rescue paths
|
|
107
|
+
|
|
108
|
+
For each: what test covers it? Happy path? Failure path? Edge case?
|
|
109
|
+
|
|
110
|
+
## Cognitive patterns
|
|
111
|
+
|
|
112
|
+
These shape your perspective throughout the review. Don't enumerate them; internalize them:
|
|
113
|
+
|
|
114
|
+
1. **Classification instinct** — categorize by reversibility x magnitude (Bezos)
|
|
115
|
+
2. **Inversion reflex** — for every "how do we win?" also ask "what would make us fail?" (Munger)
|
|
116
|
+
3. **Focus as subtraction** — primary value-add is what to NOT do (Jobs)
|
|
117
|
+
4. **Speed calibration** — fast is default. Only slow down for irreversible + high-magnitude (Bezos)
|
|
118
|
+
5. **Proxy skepticism** — are our metrics still serving users? (Bezos Day 1)
|
|
119
|
+
6. **Temporal depth** — think in 5-10 year arcs, regret minimization (Bezos)
|
|
120
|
+
7. **Courage accumulation** — confidence comes FROM making hard decisions, not before (Horowitz)
|
|
121
|
+
8. **Leverage obsession** — find inputs where small effort creates massive output (Altman)
|
|
122
|
+
9. **Edge case paranoia** — what if the name is 47 chars? Zero results? Network fails?
|
|
123
|
+
10. **Subtraction default** — "as little design as possible" (Rams)
|
|
124
|
+
|
|
125
|
+
## Handoff
|
|
126
|
+
|
|
127
|
+
After CEO/Strict Review:
|
|
128
|
+
1. Update the plan artifact with any changes the user approved.
|
|
129
|
+
2. Note the review mode and key decisions in the plan.
|
|
130
|
+
3. Proceed to the `03-work` handoff via `references/handoff.md`.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Implementation unit
|
|
2
|
+
|
|
3
|
+
## Goal
|
|
4
|
+
|
|
5
|
+
Describe the concrete outcome of this unit.
|
|
6
|
+
|
|
7
|
+
## Files
|
|
8
|
+
|
|
9
|
+
List create/modify/test files for this unit.
|
|
10
|
+
|
|
11
|
+
## Patterns to follow
|
|
12
|
+
|
|
13
|
+
Point to nearby implementation examples or repo conventions.
|
|
14
|
+
|
|
15
|
+
## Test scenarios
|
|
16
|
+
|
|
17
|
+
List happy-path, edge-case, error-path, and integration scenarios when applicable.
|
|
18
|
+
|
|
19
|
+
## Verification
|
|
20
|
+
|
|
21
|
+
Name the exact command(s) that prove this unit is complete.
|
|
22
|
+
|
|
23
|
+
## Dependencies
|
|
24
|
+
|
|
25
|
+
List prerequisite units or blockers.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Plan
|
|
2
|
+
|
|
3
|
+
## Problem summary
|
|
4
|
+
|
|
5
|
+
Summarize the problem and the relevant requirements.
|
|
6
|
+
|
|
7
|
+
## Relevant learnings
|
|
8
|
+
|
|
9
|
+
List the relevant prior artifacts from `docs/solutions/`.
|
|
10
|
+
|
|
11
|
+
## Scope boundaries
|
|
12
|
+
|
|
13
|
+
Define what is in and out of scope.
|
|
14
|
+
|
|
15
|
+
## Implementation units
|
|
16
|
+
|
|
17
|
+
Break the work into execution-ready units.
|
|
18
|
+
|
|
19
|
+
## Verification strategy
|
|
20
|
+
|
|
21
|
+
List the targeted and broader verification steps.
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: 03-work
|
|
3
|
+
description: Execute plan-driven work in a controlled Phase 1 workflow.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Work
|
|
7
|
+
|
|
8
|
+
Use this skill when there is a plan path or a tightly scoped bare prompt ready for execution.
|
|
9
|
+
|
|
10
|
+
## Core rules
|
|
11
|
+
|
|
12
|
+
- Distinguish between a **plan path** input and a **bare prompt** input before doing work.
|
|
13
|
+
- Prefer deriving execution tasks from plan **implementation units**.
|
|
14
|
+
- Use **serial subagents** for tasks with dependencies.
|
|
15
|
+
- Use **`parallel_subagent`** for independent tasks that can run concurrently.
|
|
16
|
+
- Use **`session_checkpoint`** to track plan execution progress. On start, load the checkpoint and skip completed units. After each unit, save the checkpoint.
|
|
17
|
+
- On execution failure, use `session_checkpoint` `fail` to record the error, then `retry` to get a retry strategy. Follow the suggested strategy to recover.
|
|
18
|
+
- Use **`task_splitter`** to analyze implementation units for file-level dependencies before execution. Run independent units via `parallel_subagent` and dependent units serially.
|
|
19
|
+
- If inside a **worktree** (created via `07-worktree`), execute within it. Otherwise, consider recommending `07-worktree` for isolation.
|
|
20
|
+
- End by recommending `04-review`.
|
|
21
|
+
|
|
22
|
+
## Hard gates — TDD enforcement
|
|
23
|
+
|
|
24
|
+
Every execution step must follow **RED → GREEN → REFACTOR**:
|
|
25
|
+
- No production code before a verified failing test.
|
|
26
|
+
- No skipping RED or GREEN verification.
|
|
27
|
+
- No completion claim without command output evidence.
|
|
28
|
+
- Evidence before assertions — always.
|
|
29
|
+
|
|
30
|
+
**Blocking violations** — stop and ask if:
|
|
31
|
+
- code is written before the RED test
|
|
32
|
+
- a RED step fails for the wrong reason
|
|
33
|
+
- missing evidence that the test failed before implementation
|
|
34
|
+
- missing evidence that the test passed after implementation
|
|
35
|
+
- tests added only after code
|
|
36
|
+
|
|
37
|
+
## Workflow
|
|
38
|
+
|
|
39
|
+
1. Detect whether the input is a plan path or a bare prompt.
|
|
40
|
+
2. If it is a plan path, read the implementation units and execute from them.
|
|
41
|
+
3. If it is a bare prompt, do a small scope scan before deciding whether to proceed.
|
|
42
|
+
4. Use `session_checkpoint` to load progress and skip completed units.
|
|
43
|
+
5. Use `task_splitter` to identify parallel-safe vs dependent units.
|
|
44
|
+
6. Execute in inline mode, serial subagents, or parallel subagents depending on task dependencies.
|
|
45
|
+
7. For each unit, follow strict TDD:
|
|
46
|
+
a. Run the RED test and confirm expected failure.
|
|
47
|
+
b. Apply minimal implementation.
|
|
48
|
+
c. Run the GREEN test and confirm pass.
|
|
49
|
+
d. Refactor only while tests stay green.
|
|
50
|
+
e. Run unit-level verification.
|
|
51
|
+
8. Record progress using `references/progress-update-format.md`.
|
|
52
|
+
9. After each unit, save `session_checkpoint`.
|
|
53
|
+
10. On failure, use `session_checkpoint` `fail` then `retry`.
|
|
54
|
+
11. Provide a **completion report** when done.
|
|
55
|
+
12. Hand off to `04-review` using `references/handoff.md`.
|
|
56
|
+
|
|
57
|
+
## Completion report
|
|
58
|
+
|
|
59
|
+
When all units are done, provide:
|
|
60
|
+
|
|
61
|
+
- **Completed units**: list of unit names
|
|
62
|
+
- **Files changed**: all files created or modified
|
|
63
|
+
- **Commands run**: all verification commands executed
|
|
64
|
+
- **Verification results**: pass/fail status for each
|
|
65
|
+
- **Follow-up work**: any remaining risks or open questions
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Progress update
|
|
2
|
+
|
|
3
|
+
## Completed
|
|
4
|
+
|
|
5
|
+
List the task or implementation unit that was completed.
|
|
6
|
+
|
|
7
|
+
## Files changed
|
|
8
|
+
|
|
9
|
+
List the files touched during this slice.
|
|
10
|
+
|
|
11
|
+
## Verification
|
|
12
|
+
|
|
13
|
+
List the command(s) that were run and whether they passed.
|
|
14
|
+
|
|
15
|
+
## Remaining
|
|
16
|
+
|
|
17
|
+
List the next execution slice or blocker.
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: 04-review
|
|
3
|
+
description: "Review code with structured findings. Optional browser QA and regression tests."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Review
|
|
7
|
+
|
|
8
|
+
Use this skill after implementation to review changes against the diff, the relevant plan, and prior learnings.
|
|
9
|
+
|
|
10
|
+
## Core rules
|
|
11
|
+
|
|
12
|
+
- Determine the **diff scope** before selecting reviewers.
|
|
13
|
+
- Use the **`review_router`** tool to automatically select reviewer personas based on diff metadata.
|
|
14
|
+
- Read the relevant **plan** artifact when one exists.
|
|
15
|
+
- Search solutions with grep-first strategy: extract keywords from the task → `bash grep -rl "tags:.*keyword" docs/solutions/ ~/.pi/agent/docs/solutions/` → read only frontmatter (first 15 lines) of matching files → score by severity + tag relevance → fully read top 3. Search both project-level (`docs/solutions/`) and global-level (`~/.pi/agent/docs/solutions/`). If no matches, report "No relevant solutions found" and proceed.
|
|
16
|
+
- Produce **structured findings** using `references/findings-schema.md`.
|
|
17
|
+
- When findings are **autofixable**, apply fixes and re-review (max 3 iterations).
|
|
18
|
+
- End with a handoff that can point toward fixes, re-review, or `05-compound`.
|
|
19
|
+
|
|
20
|
+
## Review discipline — technical evaluation
|
|
21
|
+
|
|
22
|
+
Code review is **technical evaluation**, not social performance:
|
|
23
|
+
- **Verify before implementing** any suggestion — check against codebase reality.
|
|
24
|
+
- **YAGNI check**: if a suggestion adds a feature nothing uses, question whether it's needed.
|
|
25
|
+
- **No performative agreement** — do not agree with findings without technical verification.
|
|
26
|
+
- **Push back with reasoning** when a finding is technically incorrect for this codebase.
|
|
27
|
+
- **Evidence before assertions** — every finding must cite specific code, not general principles.
|
|
28
|
+
|
|
29
|
+
## Handling findings
|
|
30
|
+
|
|
31
|
+
When processing review findings:
|
|
32
|
+
1. **Read** — complete all findings without reacting.
|
|
33
|
+
2. **Verify** — check each finding against codebase reality.
|
|
34
|
+
3. **Evaluate** — is it technically sound for THIS codebase?
|
|
35
|
+
4. **Act** — fix confirmed issues, push back on incorrect ones with reasoning.
|
|
36
|
+
5. **Test** — verify each fix individually, no regressions.
|
|
37
|
+
|
|
38
|
+
## Workflow
|
|
39
|
+
|
|
40
|
+
1. Determine diff scope from the current branch or explicit review target.
|
|
41
|
+
2. Collect diff stats (files changed, insertions, deletions) and call `review_router`.
|
|
42
|
+
3. Read the matching plan artifact when one exists.
|
|
43
|
+
4. Execute the solution search strategy: extract keywords → grep frontmatter fields (tags, title) in `docs/solutions/` and `~/.pi/agent/docs/solutions/` → read frontmatter of candidates only → score and rank → fully read top 3.
|
|
44
|
+
5. Apply each reviewer persona returned by `review_router`.
|
|
45
|
+
6. Merge the results into structured findings.
|
|
46
|
+
7. Verify each finding against the codebase before acting.
|
|
47
|
+
8. If any findings are autofixable, apply fixes, re-run tests, and re-review.
|
|
48
|
+
|
|
49
|
+
## Optional: QA Test Mode
|
|
50
|
+
|
|
51
|
+
After step 8 (code review complete), offer browser-based QA testing:
|
|
52
|
+
|
|
53
|
+
> Code review complete. Want me to also run the app through browser-based QA?
|
|
54
|
+
>
|
|
55
|
+
> - **A) Just code review** — done here
|
|
56
|
+
> - **B) Run browser QA** — use agent-browser to test the live app, find visual/functional bugs
|
|
57
|
+
> - **C) Browser QA + write regression tests** — find bugs, fix them, add regression tests
|
|
58
|
+
|
|
59
|
+
If the user picks B or C, read `references/qa-test-mode.md` and execute the QA workflow.
|
|
60
|
+
|
|
61
|
+
After QA:
|
|
62
|
+
1. Include QA findings in the review handoff alongside code review findings.
|
|
63
|
+
2. If bugs were fixed, note the fix commits.
|
|
64
|
+
3. If regression tests were written, note the test files.
|
|
65
|
+
|
|
66
|
+
## Handoff
|
|
67
|
+
|
|
68
|
+
After review (and optional QA) is complete, hand off using `references/handoff.md`:
|
|
69
|
+
1. Summarize all findings (code review + QA if run).
|
|
70
|
+
2. Note fix commits if any were applied.
|
|
71
|
+
3. Recommend `05-compound` if learnings are worth capturing.
|
|
72
|
+
4. Recommend `03-work` if fixes need further implementation.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Findings schema
|
|
2
|
+
|
|
3
|
+
Each structured finding must include:
|
|
4
|
+
|
|
5
|
+
- `severity` — one of: `high`, `moderate`, `low`
|
|
6
|
+
- `summary` — one-line description of the issue
|
|
7
|
+
- `evidence` — code reference, diff excerpt, or file path
|
|
8
|
+
- `recommended action` — what should be done to address the finding
|
|
9
|
+
|
|
10
|
+
Optional fields:
|
|
11
|
+
|
|
12
|
+
- `related plan unit` — which implementation unit this relates to
|
|
13
|
+
- `related learning` — link to a `docs/solutions/` artifact
|
|
14
|
+
- `reviewer` — which reviewer persona flagged this
|
|
15
|
+
- `autofixable` — whether this finding can be automatically fixed
|
|
16
|
+
- `autofix applied` — whether the autofix was applied
|
|
17
|
+
- `autofix summary` — description of what was changed
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Handoff from 04-review
|
|
2
|
+
|
|
3
|
+
When the review is complete:
|
|
4
|
+
|
|
5
|
+
1. Summarize the highest-priority structured findings.
|
|
6
|
+
2. State whether fixes or re-review are needed.
|
|
7
|
+
3. If findings are **autofixable**, apply the fixes and re-review the changes.
|
|
8
|
+
4. After autofix, report what was changed and whether re-review confirms the fix.
|
|
9
|
+
5. Recommend `05-compound` when the review surfaced a reusable learning or newly solved problem.
|
|
10
|
+
6. Mention any relevant plan or solution artifacts referenced during review.
|
|
11
|
+
|
|
12
|
+
## Autofix loop
|
|
13
|
+
|
|
14
|
+
When findings have `autofixable: true`:
|
|
15
|
+
|
|
16
|
+
1. Apply the fix for each autofixable finding.
|
|
17
|
+
2. Re-run affected tests.
|
|
18
|
+
3. Re-review only the changed lines.
|
|
19
|
+
4. If re-review produces new findings, repeat (max 3 iterations).
|
|
20
|
+
5. Report final state: fixed, partially fixed, or needs manual intervention.
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
# QA Test Mode
|
|
2
|
+
|
|
3
|
+
After code review is complete, offer the user browser-based QA testing using `agent-browser`. This catches visual, functional, and UX bugs that code review alone cannot find.
|
|
4
|
+
|
|
5
|
+
## When to offer
|
|
6
|
+
|
|
7
|
+
After the review findings are produced and any autofixes applied, ask the user:
|
|
8
|
+
|
|
9
|
+
> Code review complete. Want me to also run the app through browser-based QA?
|
|
10
|
+
>
|
|
11
|
+
> - **A) Just code review** — done, no browser testing (existing behavior)
|
|
12
|
+
> - **B) Run browser QA** — use agent-browser to test the live app, find visual/functional bugs
|
|
13
|
+
> - **C) Browser QA + write regression tests** — find bugs, fix them, and add regression tests
|
|
14
|
+
|
|
15
|
+
If the user picks A, proceed directly to the handoff.
|
|
16
|
+
|
|
17
|
+
## Prerequisites
|
|
18
|
+
|
|
19
|
+
Before starting QA, ensure:
|
|
20
|
+
1. The app is running locally (check common ports: 3000, 4000, 8080, 5173)
|
|
21
|
+
2. `agent-browser` is available: `which agent-browser`
|
|
22
|
+
3. If the app isn't running, ask the user to start it and tell you the URL
|
|
23
|
+
|
|
24
|
+
## QA tiers
|
|
25
|
+
|
|
26
|
+
| Tier | What gets fixed | Time |
|
|
27
|
+
|------|----------------|------|
|
|
28
|
+
| Quick | Critical + high severity | ~2 min |
|
|
29
|
+
| Standard | + medium severity | ~5-10 min |
|
|
30
|
+
| Exhaustive | + low/cosmetic severity | ~15-20 min |
|
|
31
|
+
|
|
32
|
+
Default is Standard unless the user specifies otherwise.
|
|
33
|
+
|
|
34
|
+
## Workflow
|
|
35
|
+
|
|
36
|
+
### Phase 1: Orient
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
agent-browser open <target-url>
|
|
40
|
+
agent-browser snapshot -i
|
|
41
|
+
agent-browser console --errors
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Map the application structure. Note framework (Next.js, Rails, SPA, etc.).
|
|
45
|
+
|
|
46
|
+
### Phase 2: Explore
|
|
47
|
+
|
|
48
|
+
Visit pages systematically. At each page:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
agent-browser open <page-url>
|
|
52
|
+
agent-browser snapshot -i
|
|
53
|
+
agent-browser screenshot /tmp/qa-screenshots/<page-name>.png
|
|
54
|
+
agent-browser console --errors
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
For each page, check the per-page exploration checklist:
|
|
58
|
+
|
|
59
|
+
1. **Visual scan** — layout issues, broken images, alignment
|
|
60
|
+
2. **Interactive elements** — click buttons, links, controls. Do they work?
|
|
61
|
+
3. **Forms** — fill and submit. Test empty, invalid, edge cases
|
|
62
|
+
4. **Navigation** — check all paths in and out
|
|
63
|
+
5. **States** — empty state, loading, error, overflow
|
|
64
|
+
6. **Console** — any JS errors after interactions?
|
|
65
|
+
|
|
66
|
+
### Phase 3: Document
|
|
67
|
+
|
|
68
|
+
Document each issue immediately with:
|
|
69
|
+
- Screenshot evidence
|
|
70
|
+
- Severity (critical/high/medium/low)
|
|
71
|
+
- Category (visual/functional/UX/content/performance/accessibility)
|
|
72
|
+
- Reproduction steps
|
|
73
|
+
|
|
74
|
+
### Phase 4: Fix loop (modes B and C)
|
|
75
|
+
|
|
76
|
+
For each fixable issue, in severity order:
|
|
77
|
+
|
|
78
|
+
1. **Locate source** — grep for the component, find the responsible file
|
|
79
|
+
2. **Fix** — minimal change that resolves the issue
|
|
80
|
+
3. **Commit** — `git commit -m "fix(qa): ISSUE-NNN — description"`
|
|
81
|
+
4. **Re-test** — navigate back and verify the fix with a screenshot
|
|
82
|
+
5. **Classify** — verified / best-effort / reverted
|
|
83
|
+
|
|
84
|
+
Self-regulation: Stop every 5 fixes and check with the user. Hard cap at 50 fixes.
|
|
85
|
+
|
|
86
|
+
### Phase 5: Regression tests (mode C only)
|
|
87
|
+
|
|
88
|
+
For each verified fix, write a regression test:
|
|
89
|
+
- Trace the bug's codepath through the code you just fixed
|
|
90
|
+
- Set up the exact precondition that triggered the bug
|
|
91
|
+
- Assert the correct behavior (NOT "it renders" — test what it DOES)
|
|
92
|
+
- Include attribution comment: `// Regression: ISSUE-NNN — {what broke}`
|
|
93
|
+
- Run the test, commit if passing
|
|
94
|
+
|
|
95
|
+
## Issue severity rubric
|
|
96
|
+
|
|
97
|
+
| Severity | Definition | Examples |
|
|
98
|
+
|----------|-----------|---------|
|
|
99
|
+
| Critical | Blocks a core workflow, data loss, crash | Form submit causes error page, checkout broken |
|
|
100
|
+
| High | Major feature broken, no workaround | Search returns wrong results, file upload fails |
|
|
101
|
+
| Medium | Feature works but with problems, workaround exists | Slow page load, form validation missing |
|
|
102
|
+
| Low | Minor cosmetic or polish issue | Typo, 1px alignment issue, hover state |
|
|
103
|
+
|
|
104
|
+
## Health score
|
|
105
|
+
|
|
106
|
+
Compute a weighted score:
|
|
107
|
+
|
|
108
|
+
| Category | Weight |
|
|
109
|
+
|----------|--------|
|
|
110
|
+
| Console errors | 15% |
|
|
111
|
+
| Broken links | 10% |
|
|
112
|
+
| Visual | 10% |
|
|
113
|
+
| Functional | 20% |
|
|
114
|
+
| UX | 15% |
|
|
115
|
+
| Performance | 10% |
|
|
116
|
+
| Content | 5% |
|
|
117
|
+
| Accessibility | 15% |
|
|
118
|
+
|
|
119
|
+
Each category starts at 100. Deduct per finding: critical (-25), high (-15), medium (-8), low (-3).
|
|
120
|
+
|
|
121
|
+
## Diff-aware mode
|
|
122
|
+
|
|
123
|
+
If the user is on a feature branch with no explicit URL, automatically:
|
|
124
|
+
1. Analyze the branch diff: `git diff main...HEAD --name-only`
|
|
125
|
+
2. Identify affected pages/routes from the changed files
|
|
126
|
+
3. Detect the running app on common local ports
|
|
127
|
+
4. Test only the affected pages
|
|
128
|
+
5. Report findings scoped to the branch changes
|
|
129
|
+
|
|
130
|
+
## Framework-specific guidance
|
|
131
|
+
|
|
132
|
+
- **Next.js**: Check for hydration errors, test client-side navigation, monitor `_next/data` requests
|
|
133
|
+
- **Rails**: Check CSRF tokens, test Turbo/Stimulus integration, verify flash messages
|
|
134
|
+
- **SPA (React/Vue/Angular)**: Use `snapshot -i` for navigation, check stale state, test browser back/forward
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Reviewer selection
|
|
2
|
+
|
|
3
|
+
Use the `review_router` tool to determine which reviewers to apply based on diff metadata.
|
|
4
|
+
|
|
5
|
+
## How to use
|
|
6
|
+
|
|
7
|
+
1. Collect diff stats: files changed, insertions, deletions.
|
|
8
|
+
2. Call `review_router` with these inputs.
|
|
9
|
+
3. Apply the returned reviewer personas to the review.
|
|
10
|
+
|
|
11
|
+
## Reviewer personas
|
|
12
|
+
|
|
13
|
+
### Base reviewers (always active)
|
|
14
|
+
|
|
15
|
+
- **correctness-reviewer**: Logical correctness, intended behavior, edge cases.
|
|
16
|
+
- **testing-reviewer**: Test coverage, test quality, missing test scenarios.
|
|
17
|
+
- **maintainability-reviewer**: Code clarity, naming, structure, duplication.
|
|
18
|
+
|
|
19
|
+
### Conditional reviewers (routed by `review_router`)
|
|
20
|
+
|
|
21
|
+
- **security-reviewer**: Triggered when auth, permissions, tokens, sessions, or crypto files change. Reviews for injection, auth bypass, credential leakage.
|
|
22
|
+
- **performan04-reviewer**: Triggered when query, cache, database, or streaming files change. Reviews for N+1, unnecessary allocation, missing indexes.
|
|
23
|
+
- **integration-reviewer**: Triggered when CI/CD, Docker, package.json, or config files change. Reviews for dependency conflicts, build breakage, deployment issues.
|
|
24
|
+
- **thoroughness-reviewer**: Triggered for large diffs (5+ files or 300+ lines). Reviews for incomplete refactors, missed callers, inconsistent changes.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: 05-compound
|
|
3
|
+
description: Capture solved problems as reusable solution artifacts.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Compound
|
|
7
|
+
|
|
8
|
+
Use this skill after solving a problem so the repository gains a reusable learning in `docs/solutions/`.
|
|
9
|
+
|
|
10
|
+
## Core rules
|
|
11
|
+
|
|
12
|
+
- Every solution MUST include YAML frontmatter per `references/solution-schema.yaml` (title, category, severity, tags, applies_when).
|
|
13
|
+
- Use `references/category-map.md` to map the problem to the correct solution category.
|
|
14
|
+
- Check for overlap with nearby solution docs before creating a new artifact.
|
|
15
|
+
- Use `references/overlap-rules.md` to decide whether to create, update, or consolidate.
|
|
16
|
+
- Use **`pattern_extractor`** to identify recurring patterns across existing artifacts before writing a new solution.
|
|
17
|
+
- Structure the document with `assets/solution-template.md`.
|
|
18
|
+
- Determine storage level:
|
|
19
|
+
- **Project-specific** → `{project-root}/docs/solutions/` (only relevant to current project)
|
|
20
|
+
- **Cross-project (global)** → `~/.pi/agent/docs/solutions/` (applicable to any project)
|
|
21
|
+
- Default to **global** when uncertain.
|
|
22
|
+
- Make the result useful to future `02-plan` and `04-review` runs via the search strategy in `references/solution-search-strategy.md`.
|
|
23
|
+
|
|
24
|
+
## Workflow
|
|
25
|
+
|
|
26
|
+
1. Identify the recently solved problem or learning.
|
|
27
|
+
2. Use `pattern_extractor` `extract` to scan existing artifacts for recurring patterns.
|
|
28
|
+
3. Use `pattern_extractor` `categorize` to group patterns by type.
|
|
29
|
+
4. Search `docs/solutions/` for related artifacts and perform an overlap check.
|
|
30
|
+
5. Choose the correct category using `references/category-map.md`.
|
|
31
|
+
6. Write or update the solution artifact under `docs/solutions/<category>/`.
|
|
32
|
+
7. Mention how future `02-plan` and `04-review` runs should benefit from the new learning.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
---
|
|
2
|
+
title:
|
|
3
|
+
category:
|
|
4
|
+
severity: medium
|
|
5
|
+
tags: []
|
|
6
|
+
applies_when: []
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Problem
|
|
10
|
+
|
|
11
|
+
Describe the solved problem or reusable learning.
|
|
12
|
+
|
|
13
|
+
# Context
|
|
14
|
+
|
|
15
|
+
Explain where it showed up and why it mattered.
|
|
16
|
+
|
|
17
|
+
# Solution
|
|
18
|
+
|
|
19
|
+
Describe the fix or recommended practice.
|
|
20
|
+
|
|
21
|
+
# Why this works
|
|
22
|
+
|
|
23
|
+
Explain the root cause or reasoning.
|
|
24
|
+
|
|
25
|
+
# Prevention
|
|
26
|
+
|
|
27
|
+
Describe how future work should avoid rediscovering the same issue.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Category map
|
|
2
|
+
|
|
3
|
+
Use these categories when writing `docs/solutions/` artifacts:
|
|
4
|
+
|
|
5
|
+
- `workflow` — planning, execution, or review workflow learnings
|
|
6
|
+
- `testing` — test failures, harness issues, or coverage learnings
|
|
7
|
+
- `architecture` — cross-cutting design or system structure learnings
|
|
8
|
+
- `integration` — external service or tool integration learnings
|
|
9
|
+
- `tooling` — package, CLI, or environment learnings
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Overlap rules
|
|
2
|
+
|
|
3
|
+
Use these overlap levels when deciding whether to create a new solution doc or update an existing one.
|
|
4
|
+
|
|
5
|
+
- **High** — same problem, same root cause, and same solution approach. Update the existing doc.
|
|
6
|
+
- **Moderate** — related problem area but a different angle or solution. Create a new doc and cross-link it.
|
|
7
|
+
- **Low** — only loosely related. Create a distinct doc.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
required:
|
|
2
|
+
- title
|
|
3
|
+
- category
|
|
4
|
+
- severity
|
|
5
|
+
- tags
|
|
6
|
+
- applies_when
|
|
7
|
+
properties:
|
|
8
|
+
title:
|
|
9
|
+
type: string
|
|
10
|
+
description: Human-readable title for the solution
|
|
11
|
+
category:
|
|
12
|
+
type: string
|
|
13
|
+
description: Subdirectory name (tooling, integration, workflow, testing, architecture)
|
|
14
|
+
severity:
|
|
15
|
+
type: string
|
|
16
|
+
enum: [critical, high, medium, low]
|
|
17
|
+
description: Priority for retrieval ranking
|
|
18
|
+
tags:
|
|
19
|
+
type: array
|
|
20
|
+
items:
|
|
21
|
+
type: string
|
|
22
|
+
description: Keywords for grep-based search matching
|
|
23
|
+
applies_when:
|
|
24
|
+
type: array
|
|
25
|
+
items:
|
|
26
|
+
type: string
|
|
27
|
+
description: Conditions where this solution is relevant
|