@shiwenbin1617/pstack 0.14.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (149) hide show
  1. package/LICENSE +28 -0
  2. package/README.md +332 -0
  3. package/adapters/claude-code/overrides/setup-pstack/SKILL.md +48 -0
  4. package/adapters/claude-code.md +29 -0
  5. package/adapters/codex/agents/comment-sicko.toml +7 -0
  6. package/adapters/codex/agents/poteto-agent.toml +7 -0
  7. package/adapters/codex/overrides/setup-pstack/SKILL.md +40 -0
  8. package/adapters/codex.md +34 -0
  9. package/agents/comment-sicko.md +32 -0
  10. package/agents/poteto-agent.md +9 -0
  11. package/automations/benny/FOR_AGENTS.md +89 -0
  12. package/automations/benny/README.md +23 -0
  13. package/automations/benny/skills/reproduce-and-fix-issues/SKILL.md +310 -0
  14. package/automations/benny/skills/reproduce-and-fix-issues/references/control-adapter.md +169 -0
  15. package/automations/benny/skills/reproduce-and-fix-issues/references/feature-map.example.md +205 -0
  16. package/automations/benny/skills/reproduce-and-fix-issues/references/verify-existing-fix.md +93 -0
  17. package/automations/benny/skills/setup-benny/SKILL.md +266 -0
  18. package/automations/benny/skills/triage-issue-reports/SKILL.md +240 -0
  19. package/automations/benny/skills/triage-issue-reports/references/routing.example.md +61 -0
  20. package/automations/benny/templates/configuration.example.yaml +84 -0
  21. package/automations/benny/templates/reproduce-automation-prompt.md +33 -0
  22. package/automations/benny/templates/triage-automation-prompt.md +39 -0
  23. package/bin/pstack.mjs +331 -0
  24. package/package.json +48 -0
  25. package/scripts/build.mjs +218 -0
  26. package/scripts/host-adapters.mjs +128 -0
  27. package/scripts/lib.mjs +181 -0
  28. package/scripts/test.mjs +106 -0
  29. package/skills/architect/SKILL.md +83 -0
  30. package/skills/architect/references/design-red-flags.md +33 -0
  31. package/skills/architect/references/rationale-template.md +35 -0
  32. package/skills/architect/references/runner-prompt.md +20 -0
  33. package/skills/arena/SKILL.md +71 -0
  34. package/skills/automate-me/SKILL.md +109 -0
  35. package/skills/blast-radius/SKILL.md +50 -0
  36. package/skills/bro/SKILL.md +7 -0
  37. package/skills/create-verification-skill/SKILL.md +44 -0
  38. package/skills/create-verification-skill/references/feature-map-example/README.md +47 -0
  39. package/skills/create-verification-skill/references/feature-map-example/create-note.md +39 -0
  40. package/skills/create-verification-skill/references/feature-map-example/search.md +45 -0
  41. package/skills/figure-it-out/SKILL.md +55 -0
  42. package/skills/how/SKILL.md +134 -0
  43. package/skills/how/references/critic-prompt.md +59 -0
  44. package/skills/how/references/critique-rubric.md +58 -0
  45. package/skills/how/references/explainer-prompt.md +55 -0
  46. package/skills/how/references/explorer-prompt.md +52 -0
  47. package/skills/interrogate/SKILL.md +113 -0
  48. package/skills/interrogate/references/code-quality-review.md +47 -0
  49. package/skills/interrogate/references/lead-judgment.md +58 -0
  50. package/skills/interrogate/references/reviewer-prompt.md +72 -0
  51. package/skills/interrogate/references/rubric.md +77 -0
  52. package/skills/maintain-verification-skill/SKILL.md +39 -0
  53. package/skills/no-comments/SKILL.md +24 -0
  54. package/skills/poteto-mode/SKILL.md +140 -0
  55. package/skills/poteto-mode/playbooks/authoring-a-skill.md +12 -0
  56. package/skills/poteto-mode/playbooks/autonomous-run.md +13 -0
  57. package/skills/poteto-mode/playbooks/autopilot-full.md +13 -0
  58. package/skills/poteto-mode/playbooks/autopilot-stack.md +16 -0
  59. package/skills/poteto-mode/playbooks/babysit.md +27 -0
  60. package/skills/poteto-mode/playbooks/bug-fix.md +17 -0
  61. package/skills/poteto-mode/playbooks/eval.md +27 -0
  62. package/skills/poteto-mode/playbooks/feature.md +21 -0
  63. package/skills/poteto-mode/playbooks/hillclimb.md +21 -0
  64. package/skills/poteto-mode/playbooks/investigation.md +14 -0
  65. package/skills/poteto-mode/playbooks/multi-phase-plan.md +155 -0
  66. package/skills/poteto-mode/playbooks/opening-a-pr.md +29 -0
  67. package/skills/poteto-mode/playbooks/orchestrate.md +113 -0
  68. package/skills/poteto-mode/playbooks/pause-safely.md +10 -0
  69. package/skills/poteto-mode/playbooks/perf-issue.md +24 -0
  70. package/skills/poteto-mode/playbooks/prototype.md +14 -0
  71. package/skills/poteto-mode/playbooks/refactoring.md +16 -0
  72. package/skills/poteto-mode/playbooks/runtime-forensics.md +11 -0
  73. package/skills/poteto-mode/playbooks/session-pickup.md +13 -0
  74. package/skills/poteto-mode/playbooks/shipping.md +20 -0
  75. package/skills/poteto-mode/playbooks/trace-forensics.md +14 -0
  76. package/skills/poteto-mode/playbooks/visual-parity.md +11 -0
  77. package/skills/poteto-mode/playbooks/worktree-cleanup.md +14 -0
  78. package/skills/poteto-mode/references/bugbot-triage.md +142 -0
  79. package/skills/poteto-mode/scripts/bootstrap.ts +30 -0
  80. package/skills/poteto-mode/scripts/bun.lock +67 -0
  81. package/skills/poteto-mode/scripts/check-plan.mjs +186 -0
  82. package/skills/poteto-mode/scripts/orch/orch.test.ts +634 -0
  83. package/skills/poteto-mode/scripts/orch/orch.ts +578 -0
  84. package/skills/poteto-mode/scripts/orch/store.ts +1607 -0
  85. package/skills/poteto-mode/scripts/package.json +16 -0
  86. package/skills/poteto-mode/scripts/watch-pr/cli.test.ts +224 -0
  87. package/skills/poteto-mode/scripts/watch-pr/cli.ts +223 -0
  88. package/skills/poteto-mode/scripts/watch-pr/fakes.test-helper.ts +118 -0
  89. package/skills/poteto-mode/scripts/watch-pr/github.test.ts +306 -0
  90. package/skills/poteto-mode/scripts/watch-pr/github.ts +699 -0
  91. package/skills/poteto-mode/scripts/watch-pr/policy.test.ts +420 -0
  92. package/skills/poteto-mode/scripts/watch-pr/policy.ts +832 -0
  93. package/skills/poteto-mode/scripts/watch-pr/render.ts +169 -0
  94. package/skills/poteto-mode/scripts/watch-pr/tsconfig.json +13 -0
  95. package/skills/poteto-mode/scripts/watch-pr/types.compile.ts +93 -0
  96. package/skills/poteto-mode/scripts/watch-pr/types.ts +401 -0
  97. package/skills/poteto-mode/scripts/watch-pr/watch-pr +6 -0
  98. package/skills/poteto-mode/scripts/worktree-audit.sh +89 -0
  99. package/skills/principle-boundary-discipline/SKILL.md +34 -0
  100. package/skills/principle-build-the-lever/SKILL.md +23 -0
  101. package/skills/principle-encode-lessons-in-structure/SKILL.md +31 -0
  102. package/skills/principle-exhaust-the-design-space/SKILL.md +21 -0
  103. package/skills/principle-experience-first/SKILL.md +19 -0
  104. package/skills/principle-fix-root-causes/SKILL.md +23 -0
  105. package/skills/principle-foundational-thinking/SKILL.md +21 -0
  106. package/skills/principle-guard-the-context-window/SKILL.md +17 -0
  107. package/skills/principle-laziness-protocol/SKILL.md +18 -0
  108. package/skills/principle-make-operations-idempotent/SKILL.md +24 -0
  109. package/skills/principle-migrate-callers-then-delete-legacy-apis/SKILL.md +22 -0
  110. package/skills/principle-minimize-reader-load/SKILL.md +23 -0
  111. package/skills/principle-model-the-domain/SKILL.md +26 -0
  112. package/skills/principle-never-block-on-the-human/SKILL.md +23 -0
  113. package/skills/principle-outcome-oriented-execution/SKILL.md +22 -0
  114. package/skills/principle-prove-it-works/SKILL.md +33 -0
  115. package/skills/principle-redesign-from-first-principles/SKILL.md +16 -0
  116. package/skills/principle-separate-before-serializing-shared-state/SKILL.md +16 -0
  117. package/skills/principle-sequence-verifiable-units/SKILL.md +22 -0
  118. package/skills/principle-subtract-before-you-add/SKILL.md +22 -0
  119. package/skills/principle-type-system-discipline/SKILL.md +31 -0
  120. package/skills/recall/SKILL.md +35 -0
  121. package/skills/reflect/SKILL.md +77 -0
  122. package/skills/reflect/references/divergent-reviewer.md +43 -0
  123. package/skills/reflect/references/judgment-reviewer.md +42 -0
  124. package/skills/reflect/references/synthesizer.md +56 -0
  125. package/skills/reflect/references/tooling-reviewer.md +57 -0
  126. package/skills/setup-pstack/SKILL.md +106 -0
  127. package/skills/show-me-your-work/SKILL.md +82 -0
  128. package/skills/show-me-your-work/references/decision-log-template.tsv +1 -0
  129. package/skills/show-me-your-work/scripts/log.sh +40 -0
  130. package/skills/swarm/SKILL.md +46 -0
  131. package/skills/tdd/SKILL.md +44 -0
  132. package/skills/teach/SKILL.md +21 -0
  133. package/skills/technical-writing/SKILL.md +130 -0
  134. package/skills/typescript-best-practices/SKILL.md +28 -0
  135. package/skills/typescript-best-practices/references/patterns.md +292 -0
  136. package/skills/unslop/SKILL.md +80 -0
  137. package/skills/why/SKILL.md +229 -0
  138. package/skills/why/references/epistemics.md +144 -0
  139. package/skills/why/references/investigator-prompt.md +103 -0
  140. package/skills/why/references/source-playbook.md +17 -0
  141. package/skills/why/references/sources/code-archaeology.md +88 -0
  142. package/skills/why/references/sources/databricks.md +70 -0
  143. package/skills/why/references/sources/datadog.md +99 -0
  144. package/skills/why/references/sources/incident-postmortem.md +15 -0
  145. package/skills/why/references/sources/linear.md +48 -0
  146. package/skills/why/references/sources/notion.md +55 -0
  147. package/skills/why/references/sources/sentry.md +100 -0
  148. package/skills/why/references/sources/slack.md +54 -0
  149. package/skills/why/references/synthesizer-prompt.md +135 -0
@@ -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,113 @@
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
+ disable-model-invocation: true
5
+ ---
6
+
7
+ # Interrogate
8
+
9
+ 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.
10
+
11
+ The deliverable is a synthesized verdict. Do NOT auto-apply changes.
12
+
13
+ ## Step 1, Determine Scope
14
+
15
+ Identify what to review from context:
16
+
17
+ - If the user points at specific files or a diff, use that
18
+ - If on a feature branch, run `git diff main...HEAD` (or the appropriate base branch) for the full changeset
19
+ - If the user's message references recent work, gather the relevant files
20
+
21
+ Package the diff (or file contents) plus any surrounding context files the reviewers need to understand the code.
22
+
23
+ ## Step 2, State the Intent
24
+
25
+ Before spawning reviewers, state the intent explicitly. What is this code trying to accomplish? Derive this from:
26
+
27
+ - The user's message
28
+ - Commit messages
29
+ - PR description if one exists
30
+ - The code itself
31
+
32
+ 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.
33
+
34
+ ## Step 3, Spawn Reviewers
35
+
36
+ Launch all reviewers in a single message using the Task tool. Use the `interrogate reviewers` list from the pstack model config (`/setup-pstack` writes it) when present, one reviewer per entry, extending or shrinking the Reviewer A/B/C/D labels below to the configured entry count; otherwise use the table defaults.
37
+
38
+ | Subagent | Default model |
39
+ |----------|---------------|
40
+ | Reviewer A | your judgment model |
41
+ | Reviewer B | your precise-execution model |
42
+ | Reviewer C | your fast code model |
43
+ | Reviewer D | a second seat on whichever tier the diff stresses most |
44
+
45
+ For each reviewer:
46
+ - a general-purpose subagent
47
+ - `model`: the configured `interrogate reviewers` entry, or the table default with no configured line
48
+ - read-only: spawn a subagent that cannot edit or write files, so a reviewer physically cannot smuggle in a fix. It still needs MCP access. On Claude Code that is `subagent_type: Explore`.
49
+
50
+ If a model slug is rejected as unresolvable when you try to spawn the subagent, check the valid slugs in the Task tool's 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.
51
+
52
+ Read `references/reviewer-prompt.md` and fill in the template with:
53
+ 1. The stated intent
54
+ 2. The diff or file contents
55
+ 3. The review rubric from `references/rubric.md`
56
+ 4. The code-quality lens from `references/code-quality-review.md`
57
+
58
+ The same filled template goes to all reviewers, so every model applies the code-quality lens.
59
+
60
+ Each reviewer produces structured findings as described in the prompt template.
61
+
62
+ ## Step 4, Synthesize
63
+
64
+ As results come back, build a unified picture:
65
+
66
+ 1. **Parse all findings** from the reviewers
67
+ 2. **Identify consensus**. Findings raised by 2+ models independently are highest signal.
68
+ 3. **Identify lone-model findings**. Still worth reading, but weight accordingly.
69
+ 4. **Deduplicate**. Different models may describe the same issue differently. Merge these and note which models raised it.
70
+ 5. **Note disagreements**. If one model flags something and another explicitly says the opposite, that's useful context for the verdict.
71
+
72
+ ## Step 5, Lead Judgment
73
+
74
+ You are the lead reviewer, a pragmatic senior engineer, not a neutral aggregator.
75
+
76
+ 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.
77
+
78
+ Categorize every finding using these buckets:
79
+
80
+ - **Act on**. Real issues affecting correctness, security, or maintainability given the actual goals. These would block a real PR.
81
+ - **Consider**. Legitimate points, but you're not sure they outweigh the cost of addressing them right now. Worth the user's attention.
82
+ - **Noted**. Technically valid but not actionable. Context-dependent, premature optimization, or low-impact given the current stage.
83
+ - **Dismissed**. Wrong, nitpicky, or missing context. Brief explanation why.
84
+
85
+ For each finding, include:
86
+ - Which model(s) raised it
87
+ - The category (act on / consider / noted / dismissed)
88
+ - A one-line rationale for the categorization
89
+
90
+ ## Output Format
91
+
92
+ Present the verdict in this structure:
93
+
94
+ ### Intent
95
+ > [The stated intent paragraph from Step 2]
96
+
97
+ ### Reviewers
98
+ - Reviewer [label]: [model name], [N findings] (one bullet per reviewer)
99
+
100
+ ### Act On
101
+ [Findings that should be addressed. For each: description, which models raised it, why it matters.]
102
+
103
+ ### Consider
104
+ [Findings worth thinking about. For each: description, which models raised it, tradeoff involved.]
105
+
106
+ ### Noted
107
+ [Valid but low-priority. Brief list.]
108
+
109
+ ### Dismissed
110
+ [Rejected findings with brief rationale. This shows the user what was filtered out and why, so they can override your judgment if they disagree.]
111
+
112
+ ### Agreement Map
113
+ [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.
@@ -0,0 +1,72 @@
1
+ # Reviewer Prompt Template
2
+
3
+ Build each reviewer subagent's prompt from this template, filling in the placeholders.
4
+
5
+ ---
6
+
7
+ You are an adversarial code reviewer. Find real problems in the code below: bugs, design flaws, security issues, and maintainability concerns. You are not here to be helpful or encouraging. You are here to stress-test.
8
+
9
+ ## Intent
10
+
11
+ The author's stated intent for this change:
12
+
13
+ > {INTENT}
14
+
15
+ You are reviewing whether the code achieves this intent well. Do NOT question the intent itself. Assume the goal is correct and challenge the execution.
16
+
17
+ ## Code Under Review
18
+
19
+ {DIFF_OR_FILES}
20
+
21
+ ## Review Rubric
22
+
23
+ {RUBRIC_CONTENTS}
24
+
25
+ ## Code Quality Lens
26
+
27
+ {CODE_QUALITY_CONTENTS}
28
+
29
+ ## Instructions
30
+
31
+ Review the code through every lens in the rubric and the code-quality lens above that you find relevant. Do not force lenses that don't apply. A simple bug fix does not need paragraphs about architectural integrity.
32
+
33
+ For each finding, provide:
34
+
35
+ 1. **Severity**: `critical` | `warning` | `nit`
36
+ - `critical`: Would cause bugs, data loss, security issues, or fundamentally broken behavior
37
+ - `warning`: Design concern, maintainability risk, or correctness issue that isn't immediately broken but will cause pain
38
+ - `nit`: Style, naming, minor improvement. Only include nits if they're genuinely useful, not to pad your review.
39
+ 2. **Finding**: What the problem is, in concrete terms. Reference specific lines/functions.
40
+ 3. **Evidence**: Why you believe this is a problem. Show your reasoning. Don't just assert.
41
+ 4. **Suggestion** (optional): What you'd do instead, if you have a concrete alternative. Skip this if you don't have a clear fix.
42
+
43
+ ## What Makes a Good Finding
44
+
45
+ - It references specific code, not vague concerns ("this could be better")
46
+ - It explains WHY something is a problem, not just THAT it is
47
+ - It distinguishes between "this is broken" and "I would have done this differently"
48
+ - It considers the stated intent. A finding that ignores the context of what's being built is a bad finding
49
+
50
+ ## What to Avoid
51
+
52
+ - Restating what the code does without identifying a problem
53
+ - Suggesting rewrites for working code because you'd prefer a different style
54
+ - Raising hypothetical issues ("what if someone passes null here") without evidence that the code path is reachable
55
+ - Praising the code. You're an adversary, not a cheerleader. If you find nothing wrong, say "no findings" and stop.
56
+
57
+ ## Output
58
+
59
+ Return your findings as a structured list. If you have zero findings, say so. An empty review is a valid outcome.
60
+
61
+ ```
62
+ ## Findings
63
+
64
+ ### 1. [Severity] Short title
65
+ **Location**: file:line or function name
66
+ **Finding**: What's wrong
67
+ **Evidence**: Why this matters
68
+ **Suggestion**: (optional) What to do instead
69
+
70
+ ### 2. [Severity] Short title
71
+ ...
72
+ ```
@@ -0,0 +1,77 @@
1
+ # Review Rubric
2
+
3
+ Review through whichever lenses are relevant. Not every lens applies to every change. Use judgment.
4
+
5
+ ## Correctness
6
+
7
+ Does the code actually do what the intent says it should?
8
+
9
+ - Edge cases: empty inputs, nil/undefined, boundary values, concurrent access
10
+ - Error handling: are errors caught, propagated, or silently swallowed?
11
+ - Off-by-one, type coercion, integer overflow, string encoding
12
+ - State management: race conditions, stale closures, dangling references
13
+ - Does the happy path work? Does the sad path work?
14
+ - Idempotency: what happens if this operation runs twice, or if a previous run crashed halfway? If the answer is "it depends on what state was left behind," there's a missing reconciliation step.
15
+ - Concurrency: if multiple actors can touch the same mutable state (files, branches, shared data), is access serialized structurally (locks, sequential phases, exclusive ownership), or by conventions that won't hold?
16
+
17
+ When you find a potential bug, trace the execution path. Don't just flag "this could be nil". Show the call chain that makes it nil.
18
+
19
+ ## Root Causes vs. Symptoms
20
+
21
+ Is the code fixing the actual problem or papering over a symptom?
22
+
23
+ Answering this often requires looking beyond the changed files. Read the surrounding code (callers, callees, type definitions, sibling modules) and understand the architecture the change lives in. Use the tools available to you (Read, Grep, Glob) to explore. Follow the call chain. Read the types. Understand why the code exists before judging whether the change addresses the right layer.
24
+
25
+ - Guard clauses that mask a deeper invariant violation
26
+ - Retry logic that hides a broken contract
27
+ - Type casts that silence a modeling error
28
+ - If you see a workaround, ask: why is the workaround needed? What would a proper fix look like?
29
+ - A fix in module A that should really be a fix in module B's contract
30
+ - Instructions where structure would be better: if the fix is a comment saying "don't do X" or a convention someone has to remember, ask whether it could instead be a type constraint, a lint rule, or a runtime check that makes the wrong thing impossible
31
+
32
+ ## Structural Integrity
33
+
34
+ Does the code fit well into the system it's part of?
35
+
36
+ - Boundary discipline: is validation at system boundaries, or scattered through business logic? Validate data once where it enters the system, then trust it internally.
37
+ - Abstraction level: is the code mixing high-level orchestration with low-level detail?
38
+ - Coupling: does this change introduce dependencies that will make future changes harder?
39
+ - Data model fit: do the data structures match the actual access patterns? The right structure makes downstream code obvious; the wrong one fights you at every turn.
40
+ - Bolted-on vs. integrated: was the change patched onto the existing design, or does it read as if the design always accounted for it? If the new requirement had been known from the start, would the code look like this?
41
+ - Legacy dual-paths: does the change introduce a new API while keeping the old one alive? If there are no external consumers, migrate callers and delete the old path in the same wave. Don't leave compatibility layers that will become permanent.
42
+
43
+ Don't penalize simple code for lacking abstraction. Premature abstraction is worse than duplication.
44
+
45
+ ## Verification
46
+
47
+ Can you tell that this code works from reading it?
48
+
49
+ - Are there tests? Do they test behavior or implementation details?
50
+ - Are there assertions/invariants that would catch regressions?
51
+ - If this is a bug fix: is there a test for the bug?
52
+ - If this touches an integration boundary: is the full path tested?
53
+ - Check the real thing, not a proxy: if the code checks liveness via file mtime or cached state instead of reading the actual value, that's a verification gap.
54
+ - For delegated or async work: does the code verify actual output artifacts, or does it trust self-reports and summaries?
55
+
56
+ ## Complexity Budget
57
+
58
+ Is the complexity justified by what the code accomplishes?
59
+
60
+ - Code that could be simpler without losing correctness or clarity
61
+ - Abstractions that serve only one call site
62
+ - Configuration or parameterization for cases that don't exist yet
63
+ - Dead code, unused imports, vestigial parameters
64
+ - Over-engineering: "just in case" code paths with no current callers
65
+ - Obsolete compatibility paths kept alive for transitional stability that's no longer needed. If the migration is done, delete the scaffolding
66
+ - Does the user experience justify the complexity? Every feature, control, and option should earn its place. Half-finished features are worse than missing ones.
67
+
68
+ Simpler is better unless simpler is wrong. Three lines of duplication beat a premature abstraction.
69
+
70
+ ## Security
71
+
72
+ Only flag security issues you can actually trace through the code. "This could be an injection vector" without showing the input path is not useful.
73
+
74
+ - User input flowing to dangerous sinks (SQL, shell, eval, innerHTML) without sanitization
75
+ - Authentication/authorization gaps in new endpoints
76
+ - Secrets in code, logs, or error messages
77
+ - TOCTOU (time-of-check-time-of-use) in security-critical paths
@@ -0,0 +1,39 @@
1
+ ---
2
+ name: maintain-verification-skill
3
+ description: "Periodic pass that keeps a project's verification skill and feature map honest: parallel source readers per feature, one live session driving every feature, at most one PR of proven corrections. Use for /maintain-verification-skill or \"audit the verify skill\"."
4
+ disable-model-invocation: true
5
+ ---
6
+
7
+ # Maintain a verification skill
8
+
9
+ A feature map rots the moment the app changes. This skill is the upkeep loop for a skill generated by `/create-verification-skill` (or any project-local verification skill with a feature map). The unit of rigor is the feature, not every sentence: cover every feature file from source and exercise every feature live, without terminalising every bullet.
10
+
11
+ ## Outcomes
12
+
13
+ Pick one, and say which:
14
+
15
+ - **clean** — every feature got source and live coverage; nothing worth shipping. No branch, no PR.
16
+ - **changed** — one PR ships proven doc, harness, or map corrections.
17
+ - **blocked** — coverage could not finish or a proven fix could not ship safely. Say exactly what blocked it.
18
+
19
+ ## Edit scope
20
+
21
+ Only edit the verification skill's own directory (its SKILL.md, features/, and any harness scripts it owns). Never edit product code during a run: a behavior the map describes that the app no longer does is either doc drift (fix the map) or a product regression (report it, don't paper over it in docs).
22
+
23
+ ## Pass
24
+
25
+ 0. **Locate the target.** Find the verification skill to maintain: the project-local skill whose body has launch/drive sections and a feature map (usually `.claude/skills/verify-*/`, or `.agents/skills/verify-*/` on Codex). Several candidates → ask which one; none → stop and point at `/create-verification-skill` instead of inventing a target.
26
+
27
+ 1. **Index hygiene.** Read the feature map README and glob its sibling files. Fix missing, extra, duplicate, or dead entries. Lightweight; no generated inventory.
28
+
29
+ 2. **Source wave.** One read-only subagent per feature file, launched concurrently. Each explains "how does this user-facing feature work?" from source, flags likely doc drift with citations, and returns one concise live-verification recipe. Children never drive the app and never edit files. Return shape: feature summary / source entry points / likely drift or none / one recipe.
30
+
31
+ 3. **Reconcile.** Every feature file has a returned summary. Merge overlapping recipes into as few app states as practical. Spot-check cited drift; don't re-prove clean claims. Sweep recent churn for user-facing surfaces missing from the map — require a concrete source path before calling one missing.
32
+
33
+ 4. **Live pass.** Required even when source looks clean. The coordinator owns all driving; follow the verification skill's own launch model — one long-lived instance driven serially for servers and UIs, or a fresh isolated session per drive for short-lived CLIs (the skill's Launch section decides, not this one). Exercise every feature at least once, and hold three invariants the whole pass, whatever the failure: (1) never drive an instance you haven't health-checked since it last did something surprising — doctor before first drive, doctor on each fresh session where sessions are the unit, doctor again after any failed drive, and where doctor can't see the failure (a wedged UI state on a healthy process), reset to a known state or relaunch rather than hoping; (2) evidence captured so far survives every cleanup, checked at its named location, not assumed; (3) nothing a drive started outlives that drive's usefulness — failed-iteration residue is cleaned whether the session is stuck, exited, or shared (for a shared instance, clean the residue, not the instance). A doctor failure caused by skill drift is drift: fix it under edit scope and retry once — restart whatever the fix invalidated, nothing more — before calling the pass `blocked`. A feature that can't be reached is `verified-unreachable` only with the concrete prerequisite (auth, entitlement, OS, external state) and the route attempted; if the map omits that prerequisite, that's drift. Any harness fix from triage gets re-driven live before it ships. Final teardown happens after the last drive of the run — including those re-proofs — so nothing outlives the run (evidence stays, per the skill).
34
+
35
+ 5. **Triage.** Wrong or missing user-POV description → doc drift, fix it. Working behavior the harness can't drive → harness gap, fix it; a harness fix follows the same helpers rule as generation (scripts executable, invocation documented in the skill body). App behavior that's actually broken → product gap; record it for the user, keep it out of this PR.
36
+
37
+ 6. **Ship or stop.** For changed: one PR of proven corrections, re-read every changed file first. For clean or blocked: no PR, report the outcome and the coverage honestly.
38
+
39
+ Keep concise run notes (features covered, unreachable prerequisites, confirmed drift, outcome) in a scratch location; don't commit them.