@zenspc/pi-pstack 0.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.
- package/LICENSE +21 -0
- package/README.md +49 -0
- package/agents/comment-sicko.md +34 -0
- package/agents/poteto-agent.md +13 -0
- package/extensions/pstack/config.ts +228 -0
- package/extensions/pstack/index.ts +211 -0
- package/package.json +57 -0
- package/skills/architect/SKILL.md +82 -0
- package/skills/architect/references/design-red-flags.md +33 -0
- package/skills/architect/references/rationale-template.md +35 -0
- package/skills/architect/references/runner-prompt.md +20 -0
- package/skills/arena/SKILL.md +70 -0
- package/skills/automate-me/SKILL.md +114 -0
- package/skills/blast-radius/SKILL.md +49 -0
- package/skills/bro/SKILL.md +6 -0
- package/skills/create-verification-skill/SKILL.md +43 -0
- package/skills/create-verification-skill/references/feature-map-example/README.md +47 -0
- package/skills/create-verification-skill/references/feature-map-example/create-note.md +39 -0
- package/skills/create-verification-skill/references/feature-map-example/search.md +45 -0
- package/skills/figure-it-out/SKILL.md +54 -0
- package/skills/how/SKILL.md +134 -0
- package/skills/how/references/critic-prompt.md +59 -0
- package/skills/how/references/critique-rubric.md +58 -0
- package/skills/how/references/explainer-prompt.md +55 -0
- package/skills/how/references/explorer-prompt.md +52 -0
- package/skills/interrogate/SKILL.md +109 -0
- package/skills/interrogate/references/code-quality-review.md +47 -0
- package/skills/interrogate/references/lead-judgment.md +58 -0
- package/skills/interrogate/references/reviewer-prompt.md +72 -0
- package/skills/interrogate/references/rubric.md +77 -0
- package/skills/maintain-verification-skill/SKILL.md +38 -0
- package/skills/no-comments/SKILL.md +23 -0
- package/skills/poteto-mode/SKILL.md +140 -0
- package/skills/poteto-mode/playbooks/authoring-a-skill.md +12 -0
- package/skills/poteto-mode/playbooks/autonomous-run.md +13 -0
- package/skills/poteto-mode/playbooks/autopilot-full.md +13 -0
- package/skills/poteto-mode/playbooks/autopilot-stack.md +31 -0
- package/skills/poteto-mode/playbooks/babysit.md +27 -0
- package/skills/poteto-mode/playbooks/bug-fix.md +17 -0
- package/skills/poteto-mode/playbooks/eval.md +27 -0
- package/skills/poteto-mode/playbooks/feature.md +21 -0
- package/skills/poteto-mode/playbooks/hillclimb.md +21 -0
- package/skills/poteto-mode/playbooks/investigation.md +14 -0
- package/skills/poteto-mode/playbooks/multi-phase-plan.md +3 -0
- package/skills/poteto-mode/playbooks/opening-a-pr.md +35 -0
- package/skills/poteto-mode/playbooks/orchestrate.md +113 -0
- package/skills/poteto-mode/playbooks/pause-safely.md +10 -0
- package/skills/poteto-mode/playbooks/perf-issue.md +24 -0
- package/skills/poteto-mode/playbooks/prototype.md +14 -0
- package/skills/poteto-mode/playbooks/refactoring.md +16 -0
- package/skills/poteto-mode/playbooks/runtime-forensics.md +11 -0
- package/skills/poteto-mode/playbooks/session-pickup.md +13 -0
- package/skills/poteto-mode/playbooks/shipping.md +40 -0
- package/skills/poteto-mode/playbooks/trace-forensics.md +14 -0
- package/skills/poteto-mode/playbooks/visual-parity.md +11 -0
- package/skills/poteto-mode/playbooks/worktree-cleanup.md +14 -0
- package/skills/poteto-mode/references/bugbot-triage.md +142 -0
- package/skills/poteto-mode/references/plan.md +105 -0
- package/skills/poteto-mode/scripts/bootstrap.ts +62 -0
- package/skills/poteto-mode/scripts/bun.lock +67 -0
- package/skills/poteto-mode/scripts/orch/orch.test.ts +634 -0
- package/skills/poteto-mode/scripts/orch/orch.ts +578 -0
- package/skills/poteto-mode/scripts/orch/store.ts +1607 -0
- package/skills/poteto-mode/scripts/package.json +16 -0
- package/skills/poteto-mode/scripts/watch-pr/cli.test.ts +224 -0
- package/skills/poteto-mode/scripts/watch-pr/cli.ts +223 -0
- package/skills/poteto-mode/scripts/watch-pr/fakes.test-helper.ts +118 -0
- package/skills/poteto-mode/scripts/watch-pr/github.test.ts +306 -0
- package/skills/poteto-mode/scripts/watch-pr/github.ts +699 -0
- package/skills/poteto-mode/scripts/watch-pr/policy.test.ts +420 -0
- package/skills/poteto-mode/scripts/watch-pr/policy.ts +832 -0
- package/skills/poteto-mode/scripts/watch-pr/render.ts +169 -0
- package/skills/poteto-mode/scripts/watch-pr/tsconfig.json +13 -0
- package/skills/poteto-mode/scripts/watch-pr/types.compile.ts +93 -0
- package/skills/poteto-mode/scripts/watch-pr/types.ts +401 -0
- package/skills/poteto-mode/scripts/watch-pr/watch-pr +6 -0
- package/skills/poteto-mode/scripts/worktree-audit.sh +85 -0
- package/skills/principle-boundary-discipline/SKILL.md +33 -0
- package/skills/principle-build-the-lever/SKILL.md +22 -0
- package/skills/principle-encode-lessons-in-structure/SKILL.md +30 -0
- package/skills/principle-exhaust-the-design-space/SKILL.md +20 -0
- package/skills/principle-experience-first/SKILL.md +18 -0
- package/skills/principle-fix-root-causes/SKILL.md +22 -0
- package/skills/principle-foundational-thinking/SKILL.md +20 -0
- package/skills/principle-guard-the-context-window/SKILL.md +16 -0
- package/skills/principle-laziness-protocol/SKILL.md +17 -0
- package/skills/principle-make-operations-idempotent/SKILL.md +23 -0
- package/skills/principle-migrate-callers-then-delete-legacy-apis/SKILL.md +21 -0
- package/skills/principle-minimize-reader-load/SKILL.md +22 -0
- package/skills/principle-model-the-domain/SKILL.md +25 -0
- package/skills/principle-never-block-on-the-human/SKILL.md +22 -0
- package/skills/principle-outcome-oriented-execution/SKILL.md +21 -0
- package/skills/principle-prove-it-works/SKILL.md +32 -0
- package/skills/principle-redesign-from-first-principles/SKILL.md +15 -0
- package/skills/principle-separate-before-serializing-shared-state/SKILL.md +15 -0
- package/skills/principle-sequence-verifiable-units/SKILL.md +21 -0
- package/skills/principle-subtract-before-you-add/SKILL.md +21 -0
- package/skills/principle-type-system-discipline/SKILL.md +30 -0
- package/skills/recall/SKILL.md +40 -0
- package/skills/reflect/SKILL.md +77 -0
- package/skills/reflect/references/divergent-reviewer.md +43 -0
- package/skills/reflect/references/judgment-reviewer.md +42 -0
- package/skills/reflect/references/synthesizer.md +56 -0
- package/skills/reflect/references/tooling-reviewer.md +57 -0
- package/skills/setup-pstack/SKILL.md +28 -0
- package/skills/show-me-your-work/SKILL.md +89 -0
- package/skills/show-me-your-work/references/decision-log-template.tsv +1 -0
- package/skills/show-me-your-work/scripts/log.sh +40 -0
- package/skills/swarm/SKILL.md +45 -0
- package/skills/tdd/SKILL.md +43 -0
- package/skills/teach/SKILL.md +20 -0
- package/skills/technical-writing/SKILL.md +129 -0
- package/skills/typescript-best-practices/SKILL.md +28 -0
- package/skills/typescript-best-practices/references/patterns.md +292 -0
- package/skills/unslop/SKILL.md +80 -0
- package/skills/why/SKILL.md +229 -0
- package/skills/why/references/epistemics.md +144 -0
- package/skills/why/references/investigator-prompt.md +103 -0
- package/skills/why/references/source-playbook.md +17 -0
- package/skills/why/references/sources/code-archaeology.md +88 -0
- package/skills/why/references/sources/databricks.md +70 -0
- package/skills/why/references/sources/datadog.md +99 -0
- package/skills/why/references/sources/incident-postmortem.md +15 -0
- package/skills/why/references/sources/linear.md +48 -0
- package/skills/why/references/sources/notion.md +55 -0
- package/skills/why/references/sources/sentry.md +100 -0
- package/skills/why/references/sources/slack.md +54 -0
- package/skills/why/references/synthesizer-prompt.md +135 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: figure-it-out
|
|
3
|
+
description: "Design an auditable playbook when no narrower one fits: a large migration, an ambitious multi-part change, or work a human reviews after stepping away. Scales rigor to the task, runs a hypothesis loop, and logs decisions via show-me-your-work. Use for /skill:figure-it-out, 'figure it out', a large migration, or when no narrower playbook applies."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Figure it out
|
|
7
|
+
|
|
8
|
+
When the task matches no playbook, design one. The deliverable before any code is the workflow itself: a sequence of phases that scales rigor to the task, runs the scientific method, and leaves a decision trail a human can audit after stepping away. Bias toward more rigor. The cost of building the wrong thing dwarfs the cost of being careful.
|
|
9
|
+
|
|
10
|
+
Don't reinvent a playbook you already have. A focused single-unit task that matches Bug fix, Perf, Feature, Visual parity, Eval, or Multi-phase plan routes there. But a large or cross-cutting version of one (a migration across many call sites, an ambitious multi-part change), or work the user reviews after stepping away, belongs here even though a single-unit version would be a Feature. The rigor and the audit trail are the point.
|
|
11
|
+
|
|
12
|
+
## Start
|
|
13
|
+
|
|
14
|
+
Open a todolist whose first item is to read the Principles section of the **poteto-mode** skill. Then add the phases below as todos.
|
|
15
|
+
|
|
16
|
+
## Phase A: Frame
|
|
17
|
+
|
|
18
|
+
Ground first, then commit. Don't start the run until you can state:
|
|
19
|
+
|
|
20
|
+
- The definition of done as a falsifiable predicate (the **prove-it-works** principle skill). "Done well" has to be checkable.
|
|
21
|
+
- Scope, quantified: rough units and effort, plus the blockers grounding surfaced. Raise them before spending hours, not after fifty doomed commits.
|
|
22
|
+
- The rigor level, biased high. One-way doors and high blast radius get more; reversible low-stakes steps get less. Rigor is gates and artifacts, not "try harder".
|
|
23
|
+
|
|
24
|
+
Present the framing and tradeoffs before committing to a long run. Reversible work proceeds (the **never-block-on-the-human** principle skill), but a multi-hour run earns one checkpoint.
|
|
25
|
+
|
|
26
|
+
## Phase B: Design the workflow
|
|
27
|
+
|
|
28
|
+
Decompose into atomic, independently-landable units. Sequence riskiest-unknown-first so option value stays high. Scaffold and verification come before features (the **foundational-thinking** principle skill).
|
|
29
|
+
|
|
30
|
+
- Build the verification harness before the work, with the baseline captured from the pre-change state, so the check reads as "old value vs new value".
|
|
31
|
+
- For one-way-door design decisions, run the **architect** skill (it runs **arena**) with diverse, isolated, opinionated candidates and a read-only judge on a different model family. Skip it for mechanical work whose shape is already concrete. A second arena over a settled design is over-engineering (the **laziness-protocol** principle skill).
|
|
32
|
+
- Decide what fans out. Parallelize only across genuine seams, and give each worker its own worktree or branch (the **separate-before-serializing-shared-state** principle skill). Don't over-fan.
|
|
33
|
+
- Write the designed phase list down. That list is what the human reviews.
|
|
34
|
+
|
|
35
|
+
Then put the design into motion. Add its steps to the todolist as concrete items, after the Phase C entry and before Phase D. Run each under the Phase C loop discipline, and weave the Phase D log through them, a row as each step lands, rather than saving the whole trail for the end.
|
|
36
|
+
|
|
37
|
+
## Phase C: Run the loop
|
|
38
|
+
|
|
39
|
+
Each unit is an experiment: state the hypothesis, make the smallest change, measure against the predicate on the real artifact, keep it if it advanced, revert it if it didn't.
|
|
40
|
+
Apply the **sequence-verifiable-units** principle skill, verifying each unit before starting the next instead of batching checks at the end.
|
|
41
|
+
|
|
42
|
+
- Verify by inspecting the artifact, never a self-report. When something passes too easily, suspect the observation method before the system. A blank screenshot passes a lazy gate.
|
|
43
|
+
- Pair delegated work with a judge and audit the delegates' artifacts yourself before trusting them. If a worker games the gate, reset and harden the contract. If the gate itself is wrong, fix the gate in its own change rather than routing around it.
|
|
44
|
+
- A verdict is VERIFIED, NOT VERIFIED, or INCONCLUSIVE. Inconclusive is not a pass. Don't hide a negative.
|
|
45
|
+
|
|
46
|
+
## Phase D: Keep the audit trail
|
|
47
|
+
|
|
48
|
+
Log the run via the **show-me-your-work** skill, one canonical TSV with a row per decision and per unit, evidence as links. figure-it-out's work is usually ambitious enough to commit the trail so the reviewer can read it in the PR; commit it when confidence has to be shown. Prefer evidence produced by committed scripts so a reviewer can re-run it. The trail plus the diff is what lets the human come back and trust the work.
|
|
49
|
+
|
|
50
|
+
## Phase E: Verify and hand back
|
|
51
|
+
|
|
52
|
+
Check the whole against the Phase A predicate on the real product, not just the harness. Encode any recurring correction as a gate, a lint rule, a check, or a script, so the win can't silently regress (the **encode-lessons-in-structure** principle skill).
|
|
53
|
+
|
|
54
|
+
**Reply:** the playbook you designed, the rigor level and why, the decision-trail path, what's verified against the predicate, and what's still open.
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: how
|
|
3
|
+
description: "Use for \"how does X work\", code walkthroughs before changing something, and placement / ownership / layering questions (\"where should this live\", \"which package owns this\", \"is this the right layer\"). Explains subsystem architecture, runtime flow, onboarding mental models. Can critique architecture. Use why for motivation."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# How
|
|
7
|
+
|
|
8
|
+
Explore the codebase to answer "how does X work?" questions. Produce clear architectural explanations at the level of a senior engineer onboarding onto a subsystem. Enough to build a working mental model, not annotated source code.
|
|
9
|
+
|
|
10
|
+
Two modes:
|
|
11
|
+
|
|
12
|
+
1. **Explain** (default). Explore the codebase and produce a clear explanation
|
|
13
|
+
2. **Critique.** Explain first, then spawn multiple models to independently identify architectural issues
|
|
14
|
+
|
|
15
|
+
## Explain Mode
|
|
16
|
+
|
|
17
|
+
### Step 1. Understand the Question and Assess Complexity
|
|
18
|
+
|
|
19
|
+
Parse what the user is asking about:
|
|
20
|
+
|
|
21
|
+
- "How does the rate limiter work?", a subsystem
|
|
22
|
+
- "How do we handle billing for on-demand usage?", a feature flow
|
|
23
|
+
- "How is the auth service structured?", an architectural overview
|
|
24
|
+
- "Walk me through what happens when a user submits a form", a runtime trace
|
|
25
|
+
|
|
26
|
+
Identify the scope. If ambiguous, state your best-guess interpretation before exploring. Don't ask. Let the user redirect if you're off.
|
|
27
|
+
|
|
28
|
+
**Assess complexity to decide the approach:**
|
|
29
|
+
|
|
30
|
+
- **Simple** (a single module, a small utility, a narrow question like "how does function X work"): skip explorer agents; the explainer explores and explains in a single pass. Go to Step 2b.
|
|
31
|
+
- **Complex** (a subsystem spanning multiple files/services, a cross-cutting feature, a full architectural overview): spawn parallel explorer agents first, then hand off to the explainer. Go to Step 2a.
|
|
32
|
+
|
|
33
|
+
When in doubt, lean simple. You can always spawn explorers if the explainer hits a wall.
|
|
34
|
+
|
|
35
|
+
### Step 2a. Explore (complex questions only)
|
|
36
|
+
|
|
37
|
+
Decompose the question into 2-4 parallel exploration angles, each a distinct slice of the subsystem so explorers don't duplicate work. Example split for "how does the rate limiter work?":
|
|
38
|
+
|
|
39
|
+
- Explorer 1: data model and state management
|
|
40
|
+
- Explorer 2: request path and enforcement
|
|
41
|
+
- Explorer 3: configuration and metrics infrastructure
|
|
42
|
+
|
|
43
|
+
The right decomposition depends on the question. Use your judgment. Narrow questions: 2 explorers is fine. Broad subsystems: up to 4.
|
|
44
|
+
|
|
45
|
+
Spawn all explorers in a single message:
|
|
46
|
+
|
|
47
|
+
- agent: `worker`
|
|
48
|
+
- `model`: your configured how-explorer model (default `inherit-parent`)
|
|
49
|
+
- tools: read-only (`read, grep, find, ls, bash`)
|
|
50
|
+
|
|
51
|
+
Each explorer gets the same base prompt from `references/explorer-prompt.md` plus a specific exploration angle naming its slice. Each explorer should:
|
|
52
|
+
- Start broad: Glob for relevant directories, Grep for key types/interfaces/class names
|
|
53
|
+
- Follow the thread: from an entry point, trace the call chain (callers, callees, data flow, type definitions)
|
|
54
|
+
- Read the actual code, don't guess from file names
|
|
55
|
+
- Stop when it can describe the full path from input to output (or trigger to effect) without hand-waving any step
|
|
56
|
+
- Note things that are surprising, non-obvious, or that a newcomer would get wrong
|
|
57
|
+
|
|
58
|
+
Each explorer returns structured findings: components found, flow traced, files read, anything non-obvious. Overlap between explorers is fine; the explainer reconciles.
|
|
59
|
+
|
|
60
|
+
Then proceed to Step 3.
|
|
61
|
+
|
|
62
|
+
### Step 2b. Direct Explain (simple questions)
|
|
63
|
+
|
|
64
|
+
Spawn a single subagent that explores and explains in one pass:
|
|
65
|
+
|
|
66
|
+
- agent: `worker`
|
|
67
|
+
- `model`: your configured how-explainer model (default `inherit-parent`)
|
|
68
|
+
- tools: read-only (`read, grep, find, ls, bash`)
|
|
69
|
+
|
|
70
|
+
The agent does its own exploration (Glob, Grep, Read) and writes the explanation directly. Read `references/explainer-prompt.md` for the communication style and output format. Same structure, just no explorer findings as input.
|
|
71
|
+
|
|
72
|
+
Proceed to Step 4.
|
|
73
|
+
|
|
74
|
+
### Step 3. Synthesize (complex questions only)
|
|
75
|
+
|
|
76
|
+
Once all explorers return, spawn a single subagent to synthesize their findings into one coherent explanation:
|
|
77
|
+
|
|
78
|
+
- agent: `worker`
|
|
79
|
+
- `model`: your configured how-explainer model (default `inherit-parent`)
|
|
80
|
+
- tools: read-only (`read, grep, find, ls, bash`)
|
|
81
|
+
|
|
82
|
+
The explainer gets all explorers' findings and writes the human-facing explanation (output format below). Read `references/explainer-prompt.md` for the full prompt template. The explainer reconciles overlapping findings, resolves contradictions, and weaves the slices into a unified picture.
|
|
83
|
+
|
|
84
|
+
### Step 4. Present
|
|
85
|
+
|
|
86
|
+
Present the explainer's output to the user. You may lightly edit for clarity or add context from the conversation, but don't substantially rewrite. The explainer's communication is the product.
|
|
87
|
+
|
|
88
|
+
### Output Format
|
|
89
|
+
|
|
90
|
+
Follow this structure, adapted to the question. Not every section is needed for every question.
|
|
91
|
+
|
|
92
|
+
**Overview.** 1-2 paragraphs. What it is, what it does, why it exists. Enough to decide whether to keep reading.
|
|
93
|
+
|
|
94
|
+
**Key Concepts.** The important types, services, or abstractions. Brief definition of each. Not exhaustive, just the ones needed to understand the rest.
|
|
95
|
+
|
|
96
|
+
**How It Works.** The core of the explanation. Walk through the flow: what triggers it, what happens step by step, where data goes, the decision points. Prose, not pseudocode. Reference specific files and functions so the reader can go look, but don't dump code blocks unless a snippet is genuinely necessary.
|
|
97
|
+
|
|
98
|
+
**Where Things Live.** A brief map of the relevant files/directories. Not every file, just the ones needed to start working in this area.
|
|
99
|
+
|
|
100
|
+
**Gotchas.** Non-obvious or surprising things that would trip someone up. Historical context that explains why something looks weird. Known sharp edges.
|
|
101
|
+
|
|
102
|
+
## Critique Mode
|
|
103
|
+
|
|
104
|
+
Triggered when the user asks for architectural issues, problems, or improvements, not just understanding.
|
|
105
|
+
|
|
106
|
+
### Step 1. Explain First
|
|
107
|
+
|
|
108
|
+
Run the full explain flow above (Steps 1-4). You must understand the architecture before critiquing it.
|
|
109
|
+
|
|
110
|
+
### Step 2. Spawn Critics
|
|
111
|
+
|
|
112
|
+
After the explanation is complete, spawn one architectural critic per model in the configured `how critics` list when present, all in a single message. Otherwise spawn one critic on the parent model. To compare models, run `/setup-pstack` and set a list.
|
|
113
|
+
|
|
114
|
+
For each critic:
|
|
115
|
+
- agent: `worker`
|
|
116
|
+
- `model`: one model from the configured `how critics` list, or omit `model` when there is no list (parent model). These are minimum reasoning levels. The lead should escalate any model when the architecture warrants deeper analysis.
|
|
117
|
+
- tools: read-only (`read, grep, find, ls, bash`)
|
|
118
|
+
|
|
119
|
+
Read `references/critic-prompt.md` for the prompt template. Each critic gets:
|
|
120
|
+
1. The explanation from Step 1 (so they don't re-explore)
|
|
121
|
+
2. The relevant file paths (so they can read the actual code)
|
|
122
|
+
3. The architectural critique rubric from `references/critique-rubric.md`
|
|
123
|
+
|
|
124
|
+
### Step 3. Lead Judgment
|
|
125
|
+
|
|
126
|
+
Same framework as the interrogate skill. You're a pragmatic lead, not an aggregator.
|
|
127
|
+
|
|
128
|
+
Categorize findings:
|
|
129
|
+
- **Act on.** Architectural problems worth fixing now
|
|
130
|
+
- **Consider.** Real concerns, but the cost/benefit is unclear
|
|
131
|
+
- **Noted.** Valid observations, low priority
|
|
132
|
+
- **Dismissed.** Wrong, missing context, or style preference
|
|
133
|
+
|
|
134
|
+
Present the explanation first (from Step 1), then the critique verdict below it. The explanation should stand on its own; someone who just wants to understand the system shouldn't wade through critique.
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Critic Prompt Template
|
|
2
|
+
|
|
3
|
+
Build each critic subagent's prompt from this template. Fill in the placeholders.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
You are reviewing the architecture of a codebase subsystem. An explanation of how it works has already been written. Read it to orient yourself, then read the actual code to form your own judgment.
|
|
8
|
+
|
|
9
|
+
## Architectural Explanation
|
|
10
|
+
|
|
11
|
+
{EXPLANATION}
|
|
12
|
+
|
|
13
|
+
## Relevant Files
|
|
14
|
+
|
|
15
|
+
{FILE_PATHS}
|
|
16
|
+
|
|
17
|
+
## Critique Rubric
|
|
18
|
+
|
|
19
|
+
{CRITIQUE_RUBRIC_CONTENTS}
|
|
20
|
+
|
|
21
|
+
## Instructions
|
|
22
|
+
|
|
23
|
+
Read the files listed above. Use the explanation as a map, but form your own opinions from the code itself. The explanation might miss things or frame them charitably.
|
|
24
|
+
|
|
25
|
+
Find architectural problems, not line-level bugs or style issues. Ask whether this subsystem is built well for what it needs to do and how it will need to evolve.
|
|
26
|
+
|
|
27
|
+
For each finding:
|
|
28
|
+
|
|
29
|
+
1. **Severity**: `structural` | `concern` | `observation`
|
|
30
|
+
- `structural`: a fundamental architectural problem. Wrong abstraction boundary, broken data model, coupling that will block future work
|
|
31
|
+
- `concern`: a real issue that makes the system harder to work with or reason about, but not fundamentally broken
|
|
32
|
+
- `observation`: worth noting. A tradeoff that might not age well, a pattern inconsistent with the rest of the codebase, technical debt
|
|
33
|
+
2. **Finding**: the architectural issue. Be specific. Name the components, the boundary, the coupling.
|
|
34
|
+
3. **Evidence**: concrete code that demonstrates the problem. Don't just assert that "this is too coupled". Show the dependency chain.
|
|
35
|
+
4. **Impact**: what the issue costs. Harder to test? Harder to change? Performance cliff at scale? Be concrete about the consequence.
|
|
36
|
+
|
|
37
|
+
## What to Avoid
|
|
38
|
+
|
|
39
|
+
- Line-level code review (not your job here)
|
|
40
|
+
- Suggesting rewrites without demonstrating a problem with the current approach
|
|
41
|
+
- "This could use more abstraction" without showing what the abstraction would actually solve
|
|
42
|
+
- Flagging intentional tradeoffs with clear benefits as issues
|
|
43
|
+
|
|
44
|
+
If the architecture is sound, say so. An empty critique is a valid outcome.
|
|
45
|
+
|
|
46
|
+
## Output
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
## Findings
|
|
50
|
+
|
|
51
|
+
### 1. [Severity] Short title
|
|
52
|
+
**Components**: Which parts of the system are involved
|
|
53
|
+
**Finding**: What's wrong architecturally
|
|
54
|
+
**Evidence**: Concrete code references
|
|
55
|
+
**Impact**: What this costs in practice
|
|
56
|
+
|
|
57
|
+
### 2. [Severity] Short title
|
|
58
|
+
...
|
|
59
|
+
```
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Architectural Critique Rubric
|
|
2
|
+
|
|
3
|
+
Review through whichever of these lenses are relevant. Not every lens applies to every subsystem.
|
|
4
|
+
|
|
5
|
+
## Abstraction Fit
|
|
6
|
+
|
|
7
|
+
Are the abstractions pulling their weight?
|
|
8
|
+
|
|
9
|
+
- Does each abstraction represent a real concept, or is it an indirection layer "in case we need it"?
|
|
10
|
+
- Are the boundaries in the right place? Do they separate things that change independently?
|
|
11
|
+
- Is there accidental coupling where components share implementation details they shouldn't need to know about?
|
|
12
|
+
- Is business logic entangled with framework wiring, or cleanly separated?
|
|
13
|
+
|
|
14
|
+
Over-abstraction is as much a problem as under-abstraction. A flat, simple design is fine when the domain is simple.
|
|
15
|
+
|
|
16
|
+
## Data Model
|
|
17
|
+
|
|
18
|
+
Do the data structures fit the actual usage patterns?
|
|
19
|
+
|
|
20
|
+
- Are the data models designed for how data is actually accessed, or for how it was conceptually modeled?
|
|
21
|
+
- Are there impedance mismatches, places where code constantly reshapes data because the model doesn't match the access pattern?
|
|
22
|
+
- Are types honest? Do they represent what data actually looks like at runtime, or claim more structure than exists?
|
|
23
|
+
|
|
24
|
+
## Boundary Discipline
|
|
25
|
+
|
|
26
|
+
Are system boundaries clean and well-placed?
|
|
27
|
+
|
|
28
|
+
- Is validation concentrated at entry points, or scattered through internal code?
|
|
29
|
+
- Are errors handled at boundaries and propagated cleanly, or caught and re-thrown at every layer?
|
|
30
|
+
- Does data cross boundaries in well-typed shapes, or as bags of optional fields?
|
|
31
|
+
- Could this subsystem be tested in isolation, or does it require the entire system to be running?
|
|
32
|
+
|
|
33
|
+
## Evolution Readiness
|
|
34
|
+
|
|
35
|
+
How well will this architecture handle likely changes?
|
|
36
|
+
|
|
37
|
+
- If the most probable next requirement landed tomorrow, how much would change? "One file" or "everything"?
|
|
38
|
+
- Are there hardcoded assumptions that would need to be relaxed?
|
|
39
|
+
- Is the design bolted-on (integrated as an afterthought) or integrated (looks like it was always part of the plan)?
|
|
40
|
+
- Are legacy paths preserved for compatibility that no one depends on?
|
|
41
|
+
|
|
42
|
+
Don't penalize for not handling hypothetical changes. Focus on changes plausible given the codebase's trajectory.
|
|
43
|
+
|
|
44
|
+
## Complexity vs. Value
|
|
45
|
+
|
|
46
|
+
Is the complexity budget spent wisely?
|
|
47
|
+
|
|
48
|
+
- Is complexity concentrated in the parts that need it (core logic, tricky invariants) or in accidental places (boilerplate, unnecessary indirection, configuration)?
|
|
49
|
+
- Are there simpler ways to achieve the same behavior?
|
|
50
|
+
- Does every component earn its existence, or are there vestigial pieces from an earlier design?
|
|
51
|
+
|
|
52
|
+
## Consistency
|
|
53
|
+
|
|
54
|
+
Does this subsystem follow the patterns established elsewhere in the codebase?
|
|
55
|
+
|
|
56
|
+
- Are similar problems solved the same way here as elsewhere, or does this area invent its own patterns?
|
|
57
|
+
- If the patterns differ, is there a good reason, or did it just evolve independently?
|
|
58
|
+
- Inconsistency isn't automatically bad. But unexplained inconsistency is a maintenance burden.
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Explainer Prompt Template
|
|
2
|
+
|
|
3
|
+
Build the explainer subagent's prompt from this template. Fill in the placeholders.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
You are writing an architectural explanation for a senior engineer. Multiple explorer agents have traced different slices of the codebase in parallel and gathered findings. Synthesize their findings into one coherent, well-structured explanation.
|
|
8
|
+
|
|
9
|
+
## Original Question
|
|
10
|
+
|
|
11
|
+
> {QUESTION}
|
|
12
|
+
|
|
13
|
+
## Explorer Findings
|
|
14
|
+
|
|
15
|
+
{EXPLORER_FINDINGS_ALL}
|
|
16
|
+
|
|
17
|
+
## Instructions
|
|
18
|
+
|
|
19
|
+
The explorers each investigated a different angle of the same subsystem. Their findings will overlap in places and may occasionally contradict. Reconcile them. Merge overlapping descriptions, resolve contradictions by checking the code yourself, and weave the separate slices into a unified picture.
|
|
20
|
+
|
|
21
|
+
Write an explanation a senior engineer unfamiliar with this area could read and walk away with a solid mental model, understanding the architecture well enough to start working in it confidently.
|
|
22
|
+
|
|
23
|
+
You have read-only access to the codebase to check anything, clarify a detail, or fill a gap. Use Read, Grep, and Glob as needed. The explorers did the heavy lifting, so you shouldn't need to re-explore from scratch.
|
|
24
|
+
|
|
25
|
+
## Output Format
|
|
26
|
+
|
|
27
|
+
Use this structure, adapted to what makes sense for the question. Not every section is needed for every question.
|
|
28
|
+
|
|
29
|
+
### Overview
|
|
30
|
+
1-2 paragraphs. What is this thing, what does it do, why does it exist. Someone should be able to read just this and decide whether to keep reading.
|
|
31
|
+
|
|
32
|
+
### Key Concepts
|
|
33
|
+
The important types, services, or abstractions needed to follow the rest. Brief definitions, not exhaustive.
|
|
34
|
+
|
|
35
|
+
### How It Works
|
|
36
|
+
The core of the explanation, and the longest section. Walk through the flow: what triggers it, what happens step by step, where data goes, what the decision points are.
|
|
37
|
+
|
|
38
|
+
Use prose, not pseudocode. Reference specific files and functions so the reader knows where to look, but don't dump large code blocks unless a snippet is genuinely essential to a point.
|
|
39
|
+
|
|
40
|
+
When the flow involves multiple components talking to each other, or data transforming through stages, include a diagram. Use mermaid (```mermaid) for structured flows (sequence diagrams, flowcharts, component graphs) or ASCII art for simpler relationships where mermaid would be overkill. Use your judgment. A diagram should clarify, not decorate. If prose covers the flow, skip the diagram.
|
|
41
|
+
|
|
42
|
+
### Where Things Live
|
|
43
|
+
A brief file/directory map. Just the ones someone would need to start working here.
|
|
44
|
+
|
|
45
|
+
### Gotchas
|
|
46
|
+
Non-obvious things, surprising behavior, historical context, sharp edges. Skip this section if there's nothing worth calling out.
|
|
47
|
+
|
|
48
|
+
## Communication Style
|
|
49
|
+
|
|
50
|
+
- Use concrete language, not abstractions-about-abstractions
|
|
51
|
+
- Say "the `UserService` calls `AuthClient.refresh()`" not "the service delegates to the client"
|
|
52
|
+
- When something is complex, explain why it's complex. Don't just describe the complexity
|
|
53
|
+
- When something is simple, don't pad it out
|
|
54
|
+
- If there's a helpful analogy, use it; if there isn't, don't force one
|
|
55
|
+
- If the explorers flagged open questions or gaps, acknowledge them honestly rather than papering over them
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Explorer Prompt Template
|
|
2
|
+
|
|
3
|
+
Build each explorer subagent's prompt from this template. Fill in the placeholders.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
You are exploring a codebase to understand how something works. Gather facts: trace code paths, read implementations, map components. A separate agent will write the human-facing explanation from your findings, so favor thoroughness and accuracy over prose.
|
|
8
|
+
|
|
9
|
+
Other explorers are investigating different slices of the same subsystem in parallel. Don't try to cover everything. Focus on your assigned angle and go deep.
|
|
10
|
+
|
|
11
|
+
## Question
|
|
12
|
+
|
|
13
|
+
> {QUESTION}
|
|
14
|
+
|
|
15
|
+
## Your Exploration Angle
|
|
16
|
+
|
|
17
|
+
{EXPLORATION_ANGLE}
|
|
18
|
+
|
|
19
|
+
## Exploration Instructions
|
|
20
|
+
|
|
21
|
+
Start by finding the relevant code. Use Glob to find directories and files, Grep to find key symbols, Read to understand the actual implementation. Don't guess from names. Read the code.
|
|
22
|
+
|
|
23
|
+
Follow this pattern:
|
|
24
|
+
1. **Find the entry point.** What triggers this behavior? A user action, an API call, a scheduled job? Find where it starts.
|
|
25
|
+
2. **Trace the flow.** Follow the call chain from the entry point. Read each function. Understand what data flows through and how it transforms.
|
|
26
|
+
3. **Map the key abstractions.** What types, interfaces, services, or classes are central? Read their definitions. Understand what they represent and why they exist.
|
|
27
|
+
4. **Find the boundaries.** Where does this subsystem interface with others? What goes in, what comes out?
|
|
28
|
+
5. **Look for the non-obvious.** Anything surprising? Anything that looks like a historical artifact? Anything a newcomer would misunderstand?
|
|
29
|
+
|
|
30
|
+
Keep exploring until you can describe the full picture without hand-waving. If you hit a part you can't trace, say so explicitly. "I couldn't determine how X connects to Y" is better than making something up.
|
|
31
|
+
|
|
32
|
+
## Output
|
|
33
|
+
|
|
34
|
+
Return your findings in this structure. Be factual and specific. Reference exact file paths, function names, type names, and line numbers where relevant.
|
|
35
|
+
|
|
36
|
+
### Components Found
|
|
37
|
+
The key types, services, classes, and abstractions. For each: name, file path, and a one-sentence description of what it does.
|
|
38
|
+
|
|
39
|
+
### Flow
|
|
40
|
+
The execution flow step by step. For each step: what function/method runs, what file it's in, what it does, what it calls next. Include the data that flows between steps.
|
|
41
|
+
|
|
42
|
+
### Files Read
|
|
43
|
+
Every file you read during exploration, so the explainer can reference them.
|
|
44
|
+
|
|
45
|
+
### Boundaries
|
|
46
|
+
Where this subsystem connects to other parts of the codebase. The inputs and outputs.
|
|
47
|
+
|
|
48
|
+
### Non-Obvious Things
|
|
49
|
+
Anything surprising, historically motivated, or easy to get wrong. Things that look like they should work one way but actually work another.
|
|
50
|
+
|
|
51
|
+
### Open Questions
|
|
52
|
+
Anything you couldn't fully trace or understand. Be honest about gaps.
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: interrogate
|
|
3
|
+
description: "Use for \"interrogate\", \"adversarial review\", \"multi-model review\", \"challenge this\", \"stress test this code\", \"find blind spots\", or \"tear this apart\". Multiple LLM reviewers challenge changes from independent angles."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Interrogate
|
|
7
|
+
|
|
8
|
+
Spawn one reviewer per configured model to adversarially review code changes. Each model gets the same prompt and rubric. The adversarial signal comes from model diversity, not assigned personas. Models differ in blind spots, priors, and reasoning patterns. Agreement across models is high-confidence signal; lone-model findings are worth reading but lower confidence.
|
|
9
|
+
|
|
10
|
+
The deliverable is a synthesized verdict. Do NOT auto-apply changes.
|
|
11
|
+
|
|
12
|
+
## Step 1, Determine Scope
|
|
13
|
+
|
|
14
|
+
Identify what to review from context:
|
|
15
|
+
|
|
16
|
+
- If the user points at specific files or a diff, use that
|
|
17
|
+
- If on a feature branch, run `git diff main...HEAD` (or the appropriate base branch) for the full changeset
|
|
18
|
+
- If the user's message references recent work, gather the relevant files
|
|
19
|
+
|
|
20
|
+
Package the diff (or file contents) plus any surrounding context files the reviewers need to understand the code.
|
|
21
|
+
|
|
22
|
+
## Step 2, State the Intent
|
|
23
|
+
|
|
24
|
+
Before spawning reviewers, state the intent explicitly. What is this code trying to accomplish? Derive this from:
|
|
25
|
+
|
|
26
|
+
- The user's message
|
|
27
|
+
- Commit messages
|
|
28
|
+
- PR description if one exists
|
|
29
|
+
- The code itself
|
|
30
|
+
|
|
31
|
+
Write one clear paragraph. Reviewers challenge whether the work achieves the intent well, not whether the intent itself is correct. If you're unsure about the intent, ask the user before proceeding.
|
|
32
|
+
|
|
33
|
+
## Step 3, Spawn Reviewers
|
|
34
|
+
|
|
35
|
+
Launch all reviewers as one parallel fanout in one `subagent` workflow. Use the `interrogate reviewers` list from `~/.pi/agent/pstack/models.json` when present, one reviewer per entry, extending or shrinking the Reviewer labels below to the configured entry count; otherwise use the table default.
|
|
36
|
+
|
|
37
|
+
| Subagent | Default model |
|
|
38
|
+
|----------|---------------|
|
|
39
|
+
| Reviewer | `inherit-parent` |
|
|
40
|
+
|
|
41
|
+
For each reviewer:
|
|
42
|
+
- agent: `worker`
|
|
43
|
+
- `model`: the configured `interrogate reviewers` entry, or the table default with no configured line
|
|
44
|
+
- tools: read-only (`read, grep, find, ls, bash`)
|
|
45
|
+
|
|
46
|
+
If a model id is rejected as unresolvable when you try to spawn the subagent, check the valid ids in the error message, pick the closest equivalent (prefer the highest-reasoning tier of the same family), spawn with the valid slug, and open a separate PR to update the configured value or default table. Do not block the review on the slug issue. If the configured value is `inherit-parent` or `auto`, omit `model` instead; never treat those aliases as broken slugs or enter this fallback for them.
|
|
47
|
+
|
|
48
|
+
Read `references/reviewer-prompt.md` and fill in the template with:
|
|
49
|
+
1. The stated intent
|
|
50
|
+
2. The diff or file contents
|
|
51
|
+
3. The review rubric from `references/rubric.md`
|
|
52
|
+
4. The code-quality lens from `references/code-quality-review.md`
|
|
53
|
+
|
|
54
|
+
The same filled template goes to all reviewers, so every model applies the code-quality lens.
|
|
55
|
+
|
|
56
|
+
Each reviewer produces structured findings as described in the prompt template.
|
|
57
|
+
|
|
58
|
+
## Step 4, Synthesize
|
|
59
|
+
|
|
60
|
+
As results come back, build a unified picture:
|
|
61
|
+
|
|
62
|
+
1. **Parse all findings** from the reviewers
|
|
63
|
+
2. **Identify consensus**. Findings raised by 2+ models independently are highest signal.
|
|
64
|
+
3. **Identify lone-model findings**. Still worth reading, but weight accordingly.
|
|
65
|
+
4. **Deduplicate**. Different models may describe the same issue differently. Merge these and note which models raised it.
|
|
66
|
+
5. **Note disagreements**. If one model flags something and another explicitly says the opposite, that's useful context for the verdict.
|
|
67
|
+
|
|
68
|
+
## Step 5, Lead Judgment
|
|
69
|
+
|
|
70
|
+
You are the lead reviewer, a pragmatic senior engineer, not a neutral aggregator.
|
|
71
|
+
|
|
72
|
+
Read `references/lead-judgment.md` for the full framework. Reviewers only see a slice of the codebase. You have the full context (the goal, the constraints, the timeline, which tradeoffs were already considered). Use that context aggressively.
|
|
73
|
+
|
|
74
|
+
Categorize every finding using these buckets:
|
|
75
|
+
|
|
76
|
+
- **Act on**. Real issues affecting correctness, security, or maintainability given the actual goals. These would block a real PR.
|
|
77
|
+
- **Consider**. Legitimate points, but you're not sure they outweigh the cost of addressing them right now. Worth the user's attention.
|
|
78
|
+
- **Noted**. Technically valid but not actionable. Context-dependent, premature optimization, or low-impact given the current stage.
|
|
79
|
+
- **Dismissed**. Wrong, nitpicky, or missing context. Brief explanation why.
|
|
80
|
+
|
|
81
|
+
For each finding, include:
|
|
82
|
+
- Which model(s) raised it
|
|
83
|
+
- The category (act on / consider / noted / dismissed)
|
|
84
|
+
- A one-line rationale for the categorization
|
|
85
|
+
|
|
86
|
+
## Output Format
|
|
87
|
+
|
|
88
|
+
Present the verdict in this structure:
|
|
89
|
+
|
|
90
|
+
### Intent
|
|
91
|
+
> [The stated intent paragraph from Step 2]
|
|
92
|
+
|
|
93
|
+
### Reviewers
|
|
94
|
+
- Reviewer [label]: [model name], [N findings] (one bullet per reviewer)
|
|
95
|
+
|
|
96
|
+
### Act On
|
|
97
|
+
[Findings that should be addressed. For each: description, which models raised it, why it matters.]
|
|
98
|
+
|
|
99
|
+
### Consider
|
|
100
|
+
[Findings worth thinking about. For each: description, which models raised it, tradeoff involved.]
|
|
101
|
+
|
|
102
|
+
### Noted
|
|
103
|
+
[Valid but low-priority. Brief list.]
|
|
104
|
+
|
|
105
|
+
### Dismissed
|
|
106
|
+
[Rejected findings with brief rationale. This shows the user what was filtered out and why, so they can override your judgment if they disagree.]
|
|
107
|
+
|
|
108
|
+
### Agreement Map
|
|
109
|
+
[Where did models agree, where did they diverge, and what does the pattern of agreement/disagreement tell us?]
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Code Quality Review
|
|
2
|
+
|
|
3
|
+
Each reviewer applies this code-quality lens in addition to the rubric. It is a strict standard focused on implementation quality, maintainability, abstraction quality, and codebase health.
|
|
4
|
+
|
|
5
|
+
Above all, be ambitious about code structure. Do not merely identify local cleanup. Actively search for "code judo" moves, restructurings that preserve behavior while making the implementation dramatically simpler, smaller, more direct, and more elegant.
|
|
6
|
+
|
|
7
|
+
## Core Prompt
|
|
8
|
+
|
|
9
|
+
Start from this baseline:
|
|
10
|
+
|
|
11
|
+
> Perform a deep code quality audit of the current branch's changes.
|
|
12
|
+
> Rethink how to structure / implement the changes to meaningfully improve code quality without impacting behavior.
|
|
13
|
+
> Work to improve abstractions, modularity, reduce Spaghetti code, improve succinctness and legibility.
|
|
14
|
+
> Be ambitious, if there is a clear path to improving the implementation that involves restructuring some of the codebase, go for it.
|
|
15
|
+
> Be extremely thorough and rigorous. Measure twice, cut once.
|
|
16
|
+
|
|
17
|
+
## Dimensions
|
|
18
|
+
|
|
19
|
+
Each dimension is stated once. Apply the ones that are relevant.
|
|
20
|
+
|
|
21
|
+
0. **Be ambitious about structural simplification.** Do not stop at "this could be a bit cleaner." Look for reframings that make whole branches, helpers, modes, conditionals, or layers disappear. Assume a "code judo" move is often available. It uses the existing architecture more effectively and makes the change dramatically simpler. If you can delete complexity rather than rearrange it, push hard for that.
|
|
22
|
+
|
|
23
|
+
1. **Do not let a PR push a file from under 1k lines to over 1k lines without a very strong reason.** Treat this as a strong smell. Prefer extracting helpers, subcomponents, or modules. If the diff crosses that threshold, ask whether the code should be decomposed first. Waive only for a compelling structural reason where the resulting file stays clearly organized.
|
|
24
|
+
|
|
25
|
+
2. **Do not allow spaghetti growth in existing code.** Be suspicious of new ad-hoc conditionals, scattered special cases, or one-off branches inserted into unrelated flows. Treat "weird if statements in random places" as a design problem, not a style nit. Prefer pushing the logic into a dedicated helper, state machine, or module instead of tangling an existing path.
|
|
26
|
+
|
|
27
|
+
3. **Bias toward cleaning the design, not just accepting working code.** If behavior can stay the same while the structure becomes meaningfully cleaner, push for the cleaner version. Prefer simplifications that remove moving pieces over refactors that spread the same complexity around.
|
|
28
|
+
|
|
29
|
+
4. **Prefer direct, boring, maintainable code over hacky or magical code.** Treat brittle, ad-hoc, or "magic" behavior as a problem. Be skeptical of generic mechanisms that hide simple data-shape assumptions. Flag thin abstractions, identity wrappers, or pass-through helpers that add indirection without buying clarity.
|
|
30
|
+
|
|
31
|
+
5. **Push on type and boundary cleanliness when it affects maintainability.** Question unnecessary optionality, `unknown`, `any`, or cast-heavy code when a clearer type boundary could exist. Prefer explicit typed models over loosely-shaped ad-hoc objects. If a branch leans on a silent fallback to paper over an unclear invariant, ask whether the boundary should be made explicit.
|
|
32
|
+
|
|
33
|
+
6. **Keep logic in the canonical layer and reuse existing helpers.** Call out feature logic leaking into shared paths or implementation details leaking through APIs. Prefer existing canonical utilities over bespoke one-offs. Push code toward the right package, service, or module instead of normalizing drift.
|
|
34
|
+
|
|
35
|
+
7. **Treat unnecessary sequential orchestration and non-atomic updates as design smells when the cleaner structure is obvious.** If independent work is serialized for no reason, ask whether it should run in parallel. If related updates can leave state half-applied, push for a more atomic structure. Do not over-index on micro-optimizations, but do flag avoidable orchestration complexity that makes the code more brittle.
|
|
36
|
+
|
|
37
|
+
## Output Expectations
|
|
38
|
+
|
|
39
|
+
Prioritize structural code-quality regressions and missed simplifications first, then spaghetti and branching complexity, then boundary, type, and file-size concerns, then smaller modularity and legibility issues. Do not flood the review with low-value nits when larger structural issues exist. Prefer a few high-conviction comments over a long list of cosmetic notes.
|
|
40
|
+
|
|
41
|
+
## Approval Bar
|
|
42
|
+
|
|
43
|
+
Do not approve merely because behavior seems correct. Treat these as presumptive blockers unless the author can justify them: the PR keeps a lot of incidental complexity when a code-judo move would delete it; pushes a file from below 1000 lines to above 1000 lines; adds ad-hoc branching that tangles an existing flow; scatters feature checks across shared code; adds an unnecessary abstraction, wrapper, or cast-heavy contract; or duplicates an existing helper or puts logic in the wrong layer when there is a clear canonical home. If those conditions are not met, leave explicit, actionable feedback and push for a cleaner decomposition.
|
|
44
|
+
|
|
45
|
+
## Review Tone
|
|
46
|
+
|
|
47
|
+
Be direct, serious, and demanding about quality. Do not be rude, but do not soften major maintainability issues into mild suggestions. If the code is making the codebase messier, say so. If the implementation missed an obvious dramatic simplification, say that too. Do not be satisfied with "maybe rename this" when the real issue is structural.
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Lead Judgment Framework
|
|
2
|
+
|
|
3
|
+
You are the lead reviewer. The configured reviewers have produced their findings. Apply pragmatic engineering judgment. Don't aggregate; filter, contextualize, and decide.
|
|
4
|
+
|
|
5
|
+
## Why This Step Matters
|
|
6
|
+
|
|
7
|
+
Adversarial reviewers are useful because they're aggressive. But aggression without context produces noise. The reviewers only saw a slice of the codebase and a one-paragraph intent statement. They don't know:
|
|
8
|
+
|
|
9
|
+
- What was already tried and rejected
|
|
10
|
+
- What constraints exist outside the code (timeline, dependencies, migration plans)
|
|
11
|
+
- Which parts of the code are temporary scaffolding vs. permanent architecture
|
|
12
|
+
- What the next PR in the stack will address
|
|
13
|
+
|
|
14
|
+
You have the full conversation context. Use it.
|
|
15
|
+
|
|
16
|
+
## Filtering Principles
|
|
17
|
+
|
|
18
|
+
### Nitpick Gravity
|
|
19
|
+
|
|
20
|
+
Reviewers, especially adversarial ones, tend to fill their review. If they don't find critical issues, they'll inflate nits to fill the space. If a reviewer's findings are all nits and style preferences, the code is probably fine. Say so.
|
|
21
|
+
|
|
22
|
+
### Hypothetical vs. Actual
|
|
23
|
+
|
|
24
|
+
"What if someone passes null here?" is only a finding if the caller can actually pass null. Trace the call site. If the input is validated upstream or the type system prevents it, dismiss the finding. Reviewers working from a diff can't always see the full call chain. You can.
|
|
25
|
+
|
|
26
|
+
### Premature Abstraction Warnings
|
|
27
|
+
|
|
28
|
+
Reviewers often suggest extracting functions, adding interfaces, or creating abstractions. Does this code need to change in a second way? If not, the abstraction is premature. Simple inline code that works beats a clean abstraction that's overkill for the current scope.
|
|
29
|
+
|
|
30
|
+
### "I Would Have Done It Differently"
|
|
31
|
+
|
|
32
|
+
This is the most common false positive in code review. A finding that amounts to "I prefer a different approach" is not a bug, not a design flaw, and not actionable unless the reviewer shows a concrete problem with the current approach. Dismiss these, and say why.
|
|
33
|
+
|
|
34
|
+
### Missing Context Signals
|
|
35
|
+
|
|
36
|
+
Watch for findings that reveal the reviewer didn't understand the context:
|
|
37
|
+
- Suggesting changes to code the author didn't write or modify
|
|
38
|
+
- Flagging patterns that are consistent with the rest of the codebase (the reviewer just doesn't know that)
|
|
39
|
+
- Recommending approaches that conflict with constraints you know about
|
|
40
|
+
|
|
41
|
+
These are honest mistakes from reviewers working with limited information. Dismiss them gracefully.
|
|
42
|
+
|
|
43
|
+
## When Reviewers Are Right
|
|
44
|
+
|
|
45
|
+
Don't dismiss findings just because they're uncomfortable. The whole point of adversarial review is to catch things you'd miss. Signs a finding deserves attention:
|
|
46
|
+
|
|
47
|
+
- Multiple models flag the same issue independently (consensus signal)
|
|
48
|
+
- The finding identifies a concrete execution path, not a hypothetical
|
|
49
|
+
- The finding reveals a gap in your mental model of the code
|
|
50
|
+
- You read the finding and think "...yeah, actually"
|
|
51
|
+
|
|
52
|
+
Be especially careful about dismissing security findings and correctness bugs. These deserve more scrutiny even when they come from a single model.
|
|
53
|
+
|
|
54
|
+
## Verdict Calibration
|
|
55
|
+
|
|
56
|
+
A good verdict is useful, not comprehensive. The user should be able to read the "Act On" section, fix those issues, and ship with confidence. If your "Act On" list has more than 5 items, you're probably not filtering hard enough.
|
|
57
|
+
|
|
58
|
+
The "Dismissed" section is not busywork. It's a trust mechanism. Showing the user what you rejected and why lets them override your judgment where they disagree. This is more valuable than hiding the rejected findings.
|