APM Review Panel - Fan-Out Advisory Review
The panel is FAN-OUT + SYNTHESIZER. Each persona runs in its own agent
thread (via the task tool) and returns JSON matching
assets/panelist-return-schema.json. The orchestrator schema-validates
each return, hands all returns to the apm-ceo synthesizer (also a task
thread, returns JSON matching assets/ceo-return-schema.json), then
renders ONE recommendation comment from assets/recommendation-template.md.
This skill is ADVISORY by design. It does not compute a binary verdict, it
does not apply verdict labels, and it does not gate merge. The panel
surfaces findings; the maintainer and the PR author decide ship.
Architecture invariants
- Advisory regime, not gate regime. There is no
APPROVE / REJECT,
no panel-approved / panel-rejected label, no deterministic verdict
computation. The CEO returns a ship_recommendation.stance (ship_now
/ ship_with_followups / needs_discussion / needs_rework); this is
prose for the human reviewer, never auto-applied as a label or status
check. This is the architectural fix for the previous regime's
over-strictness: removing the binary gate removes the incentive for
panelists to inflate required[] defensively.
- Three severity buckets, none of them gate. Findings carry
severity: blocking | recommended | nit. blocking is the highest
signal a panelist can send and renders prominently in the comment; it
still does not block merge. recommended is the default for substantive
feedback. nit is one-line polish. The orchestrator never reads
severity to gate anything.
- Single-writer interlock. Only the orchestrator writes to the PR:
exactly one
add-comment and one remove-labels call. The
remove-labels call always sweeps panel-review (trigger
idempotency) AND defensively removes panel-approved /
panel-rejected if present (legacy verdict labels from the
pre-advisory regime; they have no meaning here and would mislead
readers if left on a PR after a fresh advisory pass). NO add-labels
call -- there are no verdict labels to apply. Panelist subagents and
the CEO subagent return JSON only and MUST NOT call any gh write
command, post comments, apply labels, or touch the PR state.
- Single-emission discipline. Exactly one comment per panel run,
rendered from
assets/recommendation-template.md after all subagents
return.
Agent roster
Topology
apm-review-panel SKILL (orchestrator thread)
|
FAN-OUT via task tool (panelists in parallel)
|
+-----+-------+-------+-----+-----+------+-----------+----------+
v v v v v v v v v (cond.)
py cli dx-ux sec grw auth doc-writer test-cov
| | | | | | | |
| each returns JSON per panelist-return-schema.json
+-----+-------+-------+-----+-----+------+-----------+----------+
|
v <-- S4 schema-validate
v <-- on malformed: re-spawn that persona
v
task: apm-ceo synthesizer
- aggregates findings across panelists
- resolves dissent
- emits headline + arbitration prose + principle alignment
- emits curated recommended_followups (prioritized)
- emits ship_recommendation (stance + prose)
- returns ceo-return-schema.json
|
v <-- S4 schema-validate
v
orchestrator (sole writer)
| |
v v
add-comment remove-labels
(max:2) [panel-review,
panel-approved,
panel-rejected]
(trigger reset +
legacy verdict sweep)
Conditional panelists
Two personas are conditional (auth, doc-writer). A third
(test-coverage) is mandatory on every PR that touches src/ and only
skipped on documentation-only PRs -- see its section below for why.
The orchestrator ALWAYS spawns ALL three tasks to keep the schema
return shape uniform; the prompt instructs the subagent to set
active: false with an inactive_reason if the condition does not
hold.
Auth Expert
Activate when the PR changes any of:
src/apm_cli/core/auth.py
src/apm_cli/core/token_manager.py
src/apm_cli/core/azure_cli.py
src/apm_cli/deps/github_downloader.py
src/apm_cli/marketplace/client.py
src/apm_cli/utils/github_host.py
src/apm_cli/install/validation.py
src/apm_cli/install/pipeline.py
src/apm_cli/deps/registry_proxy.py
Fallback self-check (when no fast-path file matched): "Does this PR
change authentication behavior, token management, credential resolution,
host classification used by AuthResolver, git or HTTP authorization
headers, or remote-host fallback semantics? If unsure, answer YES."
Doc Writer
Activate when the PR changes any of:
README.md
CHANGELOG.md
MANIFESTO.md
docs/src/content/docs/**
.apm/skills/**/*.md
.apm/agents/**/*.md
.github/skills/**/*.md
.github/agents/**/*.md
.github/instructions/**/*.md
.github/workflows/*.md (gh-aw natural-language workflows)
packages/apm-guide/**
Fallback self-check (when no fast-path file matched): "Does this PR
change user-facing documentation, agent or skill prose, instruction
files, CHANGELOG entries, README claims, or any natural-language
artifact a reader will rely on? If unsure, answer YES."
When the doc-writer is active and the PR includes documentation changes,
the persona reviews them for: (a) consistency with the existing voice
and structure, (b) accuracy against the code being changed, (c)
completeness for the typical reader (no orphan claims, no missing
prerequisites), (d) discoverability (cross-links, sidebar order if
Starlight content). When the doc-writer is active because of code
changes that SHOULD have updated docs but did not, the persona surfaces
that gap as a finding.
Test Coverage Expert
Active by default on every PR that touches src/**/*.py. The only
condition that flips this persona to active: false is a
documentation-only PR -- the diff contains zero src/**/*.py files.
In that case set inactive_reason: "documentation-only PR -- no runtime code paths to defend".
The activation rule is intentionally narrow: under the advisory regime,
test outcomes are LOAD-BEARING for CEO arbitration (passed / failed /
missing test evidence outranks opinion-only findings -- see
apm-ceo.agent.md and panelist-return-schema.json evidence block).
A persona whose findings carry that weight cannot be silently skipped
on a heuristic. Better to spawn it on a pure refactor and have it
return a single nit-severity "no behavior surface touched -- no
coverage finding" line than to skip it and leave the CEO without
evidence to weigh. (Earlier revisions of this skill paired test-coverage
with auth and doc-writer as conditional for symmetry; that symmetry
broke when test evidence became load-bearing.)
The test-coverage-expert is paired with the devx-ux-expert lens and
defends the user-promise contracts the DevX persona enumerates (CLI
surface, error wording, install idempotency, lockfile determinism, auth
resolution). It MUST verify "no test exists" claims with view/grep
on the test tree before emitting a finding -- false-positive coverage
findings destroy trust in the field. It does NOT compute coverage
percentages, does NOT flag tests for pure refactors, and does NOT
duplicate python-architect on test-code design.
Routing matrix (CEO synthesis emphasis only)
These routes describe WHICH specialist's findings the CEO weights more
heavily for a given PR type. They do NOT change which personas run --
every mandatory persona always runs. Routing is a CEO synthesis hint.
- Architecture-heavy PR -> CEO weights Python Architect on
abstraction calls; CLI Logging on consistency.
- CLI UX PR -> CEO weights DevX UX on command surface; CLI Logging
on output paths; Growth Hacker on first-run conversion.
- Security PR -> CEO biases toward Supply Chain Security on default
behavior; DevX UX flags ergonomics regression from any mitigation.
- Auth PR (auth-expert active) -> CEO weights Auth Expert on
AuthResolver / token precedence; Supply Chain on token-scoping.
- Docs / release / comms PR (doc-writer active) -> CEO weights Doc
Writer on accuracy and voice; Growth Hacker on hook and story angle.
- Behavior-change PR (test-coverage active) -> CEO weights Test
Coverage Expert on regression-trap presence; DevX UX on which user
promises the change touches. A blocking-severity coverage finding on
a critical-promise surface (auth, lockfile, install, marketplace,
hooks) is the highest signal in this routing.
- Full panel (default) -> CEO synthesizes equally; calls out any
dissent in
dissent_notes.
Execution checklist
Work through these steps in order. Do not skip ahead. Do not emit any
output to the PR before step 6.
Read PR context (the orchestrating workflow already fetched it
via gh pr view / gh pr diff). Identify changed files for the
conditional panelist routing decisions (auth-expert and doc-writer).
Resolve the conditional panelists using the rules above. Decide
for EACH conditional persona: spawn active OR spawn with
active: false + an inactive_reason. Either way, all three
conditional personas ARE spawned -- the schema requires uniform
return shape.
Fan out panelist tasks. Spawn the following tasks in PARALLEL
via the task tool, one task per persona:
python-architect (also asked to supply extras.diagrams:
class_diagram (mermaid classDiagram), component (mermaid
flowchart TD), and OPTIONAL sequence (mermaid
sequenceDiagram) blocks per the persona's section 1/2/3 contract)
cli-logging-expert
devx-ux-expert
supply-chain-security-expert
oss-growth-hacker
auth-expert (always - active per step 2)
doc-writer (always - active per step 2)
test-coverage-expert (always - active per step 2)
Each task prompt MUST:
- Reference its persona file by relative path so the subagent loads
its own scope, lens, and anti-patterns.
- Include the PR number, title, body, and diff (passed inline).
- Cite
assets/panelist-return-schema.json and require the subagent
to emit JSON matching that schema as its FINAL message.
- State the calibrated severity contract: "Use
severity: blocking
ONLY for correctness regressions, security/auth bypasses, or
architectural faults that compound, with explicit rationale.
Default substantive feedback to recommended. Use nit for
one-line polish. The panel is advisory; nothing you return blocks
merge -- pick the severity that honestly matches your signal
strength."
- Restate the output contract: NO
gh write commands, NO posting
comments, NO label changes, NO touching PR state. JSON return only.
S4 schema gate. When each panelist task returns, parse the JSON
and validate against assets/panelist-return-schema.json. On
validation failure:
- Re-spawn that ONE panelist with an explicit error message pointing
at the violated rule.
- Maximum two re-spawn attempts per panelist. If still malformed,
synthesize a placeholder
{persona: "<slug>", active: true, summary: "Schema failure -- see extras.", findings: [], extras: {schema_failure: "<reason>"}}
and surface the failure in the CEO arbitration prompt.
Spawn the CEO synthesizer task. Pass the full set of validated
panelist JSON returns to a task invocation that loads
../../agents/apm-ceo.agent.md. The prompt MUST:
- Provide all panelist returns as structured input.
- Ask for: headline, arbitration prose, principle alignment (only
applicable principles), curated recommended_followups (prioritized
by signal, NOT a re-listing of every finding), ship_recommendation
(stance + prose).
- Cite
assets/ceo-return-schema.json and require JSON return.
- Restate the contract: the panel is advisory. The CEO does NOT pick
a verdict label. The
ship_recommendation.stance is prose for the
human reviewer, not a gate. NO gh write commands.
Validate the CEO return against assets/ceo-return-schema.json. On
failure, re-spawn once with the violation cited.
Resolve the notification audience. The advisory comment must
surface in the inboxes of the people who will act on it. Run:
gh pr view <PR_NUMBER> --json author,reviewRequests
Build notify_audience as the deduplicated list:
- the PR author's
@login (always included);
- every requested reviewer's
@login (these are the
CODEOWNERS-resolved reviewers GitHub auto-requested for the
touched paths, plus any explicitly-requested human reviewers);
- every requested team's
@org/team-slug (CODEOWNERS team
entries).
Filter out:
- bot logins (login ending in
[bot] or matching
dependabot|github-actions|copilot-pull-request-reviewer);
- the orchestrator's own identity (avoid self-ping).
Cap the final list at 6 handles to avoid notification noise (PR
author + up to 5 reviewers/teams). If the cap trims, prefer team
handles over individual logins. Pass the resulting list to the
template renderer as notify_audience.
This step replaces the maintainer-notification signal that the
pre-advisory verdict labels carried. It is the only mechanism by
which a fresh panel pass announces itself.
Render the comment. Load assets/recommendation-template.md,
fill the placeholders from the panelist + CEO JSON, and emit it as
exactly ONE comment.
Filling rules:
- The per-persona summary table renders ONLY active panelists, one
row per persona, with finding counts by severity and the persona's
summary field.
- The mermaid diagrams come from
python-architect.extras.diagrams.
If absent, render the placeholder lines from the template (do NOT
invent diagrams).
- The recommended follow-ups list renders the CEO's curated subset,
not every finding. Full per-persona findings collapse at the bottom.
- NEVER render the words "Verdict", "APPROVE", "REJECT", "blocked",
"merge gate", or any equivalent. The panel is advisory.
Sweep labels via safe-outputs.remove-labels. The list MUST be
[panel-review, panel-approved, panel-rejected] -- always all three,
regardless of which are currently on the PR. panel-review is the
re-run idempotency reset; the other two are LEGACY VERDICT LABELS
from the pre-advisory regime that have no meaning under the advisory
contract and would mislead readers if left on a freshly-reviewed PR.
safe-outputs.remove-labels is idempotent on missing labels, so
sweeping all three on every run is safe and self-healing. NO
verdict labels are applied.
Output contract (non-negotiable)
- Exactly ONE comment per panel run, rendered from
assets/recommendation-template.md. The safe-outputs.add-comment.max: 2 is a fail-soft ceiling; the discipline lives here.
- Exactly ONE
remove-labels call sweeping
[panel-review, panel-approved, panel-rejected].
- NO
add-labels call. The advisory regime has no verdict to encode.
- Subagents (panelists + CEO) NEVER write to PR state, NEVER call
gh pr comment, NEVER call gh pr edit --add-label. They return JSON.
The orchestrator is the sole writer.
- Never invent new top-level template sections or drop existing ones.
Gotchas
- Roster invariant. The frontmatter description, the roster table,
the conditional rules, the recommendation template, and the JSON
schema MUST agree on the persona set. If you change one, change all
in the same edit.
- Calibrated severity discipline. The advisory regime relies on
panelists honestly distinguishing
blocking from recommended. If a
panelist marks everything blocking, the comment becomes noisy and
the maintainer learns to ignore the field. The panelist prompts state
the contract explicitly; the CEO arbitration prose is the safety
valve when a panelist over-flags.
- Mermaid diagrams are template-required. The python-architect
persona is asked to supply
extras.diagrams.class_diagram,
extras.diagrams.component, and the OPTIONAL
extras.diagrams.sequence. The template renders nothing when they
are missing -- it does NOT invent diagrams. Real diagrams are
what makes the comment scannable for the human reviewer.
- Mermaid
classDiagram :::cssClass shorthand gotcha. GitHub's
mermaid renderer rejects :::cssClass appended to relationship
lines (e.g. A *-- B:::touched); use standalone
class Name:::cssClass declarations instead. Authority:
python-architect.agent.md:146-154.
- Doc-writer detects DRIFT, not just edits. When the PR changes
user-facing code that SHOULD have updated docs but did not, doc-writer
surfaces that as a finding. The conditional rule above is necessary
but not sufficient -- doc-writer reasons about doc consistency given
the diff, not just whether doc files were touched.
- False-negative auth gotcha. Auth regressions can be introduced
from non-auth files that change the inputs to auth -- host
classification, dependency parsing, clone URL construction, HTTP
authorization headers, or call sites that bypass
AuthResolver. If
a diff changes how a remote host, org, token source, or fallback path
is selected and you are not certain it is auth-neutral, activate
auth-expert as active: true.
- Test-coverage probe is mandatory. The test-coverage-expert MUST
verify "no test exists for X" via
view/grep on the tests/ tree
before emitting a finding. A false-positive coverage finding (test
exists but persona claimed it does not) destroys maintainer trust in
the field. The persona scope file enforces this; the orchestrator
passes the diff and trusts the persona to probe.
- Subagent write enforcement is contract-based, not sandbox-based.
Tool permissions are workflow-scoped, not subagent-scoped, so every
spawned task technically inherits the same
gh toolset. The
"subagents must not write" rule is enforced by the prompt contract in
each .agent.md plus the safe-outputs.add-comment.max: 2
fail-soft. If a subagent ever tries to post a comment, the cap
catches it.
- No verdict-label reset workflow. The previous regime had a
companion workflow
pr-panel-label-reset.yml that stripped verdict
labels on every push. The advisory regime has no verdict labels to
strip; that workflow is removed.
1---
2name: apm-review-panel
3description: >-
4 Use this skill to run a multi-persona expert advisory review on a labelled
5 pull request in microsoft/apm. The panel fans out to five mandatory
6 specialists plus a test-coverage specialist (active on every PR that
7 touches src/) plus two conditional specialists (auth, doc-writer),
8 all running in their own agent threads, and a CEO
9 synthesizer. The orchestrator is the sole writer to the PR: ONE
10 recommendation comment, no verdict labels, no merge gating. The panel
11 is advisory -- it surfaces findings, prioritizes follow-ups, and renders
12 a ship-recommendation that the maintainer and author weigh. Activate
13 when a non-trivial PR needs a cross-cutting recommendation
14 (architecture, CLI logging, DevX UX, supply-chain security,
15 growth/positioning, optionally auth, docs, and test coverage, with CEO
16 arbitration).
17metadata:
18 source: https://skillmd.com/skills/aibot88/apm-review-panel
19---
20
21# APM Review Panel - Fan-Out Advisory Review
22
23The panel is FAN-OUT + SYNTHESIZER. Each persona runs in its own agent
24thread (via the `task` tool) and returns JSON matching
25`assets/panelist-return-schema.json`. The orchestrator schema-validates
26each return, hands all returns to the apm-ceo synthesizer (also a task
27thread, returns JSON matching `assets/ceo-return-schema.json`), then
28renders ONE recommendation comment from `assets/recommendation-template.md`.
29
30This skill is ADVISORY by design. It does not compute a binary verdict, it
31does not apply verdict labels, and it does not gate merge. The panel
32surfaces findings; the maintainer and the PR author decide ship.
33
34## Architecture invariants
35
36- **Advisory regime, not gate regime.** There is no `APPROVE` / `REJECT`,
37 no `panel-approved` / `panel-rejected` label, no deterministic verdict
38 computation. The CEO returns a `ship_recommendation.stance` (`ship_now`
39 / `ship_with_followups` / `needs_discussion` / `needs_rework`); this is
40 prose for the human reviewer, never auto-applied as a label or status
41 check. This is the architectural fix for the previous regime's
42 over-strictness: removing the binary gate removes the incentive for
43 panelists to inflate `required[]` defensively.
44- **Three severity buckets, none of them gate.** Findings carry
45 `severity: blocking | recommended | nit`. `blocking` is the highest
46 signal a panelist can send and renders prominently in the comment; it
47 still does not block merge. `recommended` is the default for substantive
48 feedback. `nit` is one-line polish. The orchestrator never reads
49 severity to gate anything.
50- **Single-writer interlock.** Only the orchestrator writes to the PR:
51 exactly one `add-comment` and one `remove-labels` call. The
52 `remove-labels` call always sweeps `panel-review` (trigger
53 idempotency) AND defensively removes `panel-approved` /
54 `panel-rejected` if present (legacy verdict labels from the
55 pre-advisory regime; they have no meaning here and would mislead
56 readers if left on a PR after a fresh advisory pass). NO `add-labels`
57 call -- there are no verdict labels to apply. Panelist subagents and
58 the CEO subagent return JSON only and MUST NOT call any `gh` write
59 command, post comments, apply labels, or touch the PR state.
60- **Single-emission discipline.** Exactly one comment per panel run,
61 rendered from `assets/recommendation-template.md` after all subagents
62 return.
63
64## Agent roster
65
66| Agent | Role | Always active? |
67|-------|------|----------------|
68| [Python Architect](../../agents/python-architect.agent.md) | Architectural Reviewer + supplies mermaid diagrams | Yes |
69| [CLI Logging Expert](../../agents/cli-logging-expert.agent.md) | Output UX Reviewer | Yes |
70| [DevX UX Expert](../../agents/devx-ux-expert.agent.md) | Package-Manager UX | Yes |
71| [Supply Chain Security Expert](../../agents/supply-chain-security-expert.agent.md) | Threat-Model Reviewer | Yes |
72| [OSS Growth Hacker](../../agents/oss-growth-hacker.agent.md) | Adoption Strategist | Yes |
73| [Auth Expert](../../agents/auth-expert.agent.md) | Auth / Token Reviewer | Conditional (see below) |
74| [Doc Writer](../../agents/doc-writer.agent.md) | Documentation Reviewer | Conditional (see below) |
75| [Test Coverage Expert](../../agents/test-coverage-expert.agent.md) | Test-Presence Reviewer (paired with DevX UX) | Yes (skipped only on docs-only PRs -- see below) |
76| [APM CEO](../../agents/apm-ceo.agent.md) | Strategic Arbiter / Synthesizer | Yes |
77
78## Topology
79
80```
81 apm-review-panel SKILL (orchestrator thread)
82 |
83 FAN-OUT via task tool (panelists in parallel)
84 |
85 +-----+-------+-------+-----+-----+------+-----------+----------+
86 v v v v v v v v v (cond.)
87 py cli dx-ux sec grw auth doc-writer test-cov
88 | | | | | | | |
89 | each returns JSON per panelist-return-schema.json
90 +-----+-------+-------+-----+-----+------+-----------+----------+
91 |
92 v <-- S4 schema-validate
93 v <-- on malformed: re-spawn that persona
94 v
95 task: apm-ceo synthesizer
96 - aggregates findings across panelists
97 - resolves dissent
98 - emits headline + arbitration prose + principle alignment
99 - emits curated recommended_followups (prioritized)
100 - emits ship_recommendation (stance + prose)
101 - returns ceo-return-schema.json
102 |
103 v <-- S4 schema-validate
104 v
105 orchestrator (sole writer)
106 | |
107 v v
108 add-comment remove-labels
109 (max:2) [panel-review,
110 panel-approved,
111 panel-rejected]
112 (trigger reset +
113 legacy verdict sweep)
114```
115
116## Conditional panelists
117
118Two personas are conditional (auth, doc-writer). A third
119(test-coverage) is mandatory on every PR that touches `src/` and only
120skipped on documentation-only PRs -- see its section below for why.
121The orchestrator ALWAYS spawns ALL three tasks to keep the schema
122return shape uniform; the prompt instructs the subagent to set
123`active: false` with an `inactive_reason` if the condition does not
124hold.
125
126### Auth Expert
127
128Activate when the PR changes any of:
129- `src/apm_cli/core/auth.py`
130- `src/apm_cli/core/token_manager.py`
131- `src/apm_cli/core/azure_cli.py`
132- `src/apm_cli/deps/github_downloader.py`
133- `src/apm_cli/marketplace/client.py`
134- `src/apm_cli/utils/github_host.py`
135- `src/apm_cli/install/validation.py`
136- `src/apm_cli/install/pipeline.py`
137- `src/apm_cli/deps/registry_proxy.py`
138
139Fallback self-check (when no fast-path file matched): "Does this PR
140change authentication behavior, token management, credential resolution,
141host classification used by `AuthResolver`, git or HTTP authorization
142headers, or remote-host fallback semantics? If unsure, answer YES."
143
144### Doc Writer
145
146Activate when the PR changes any of:
147- `README.md`
148- `CHANGELOG.md`
149- `MANIFESTO.md`
150- `docs/src/content/docs/**`
151- `.apm/skills/**/*.md`
152- `.apm/agents/**/*.md`
153- `.github/skills/**/*.md`
154- `.github/agents/**/*.md`
155- `.github/instructions/**/*.md`
156- `.github/workflows/*.md` (gh-aw natural-language workflows)
157- `packages/apm-guide/**`
158
159Fallback self-check (when no fast-path file matched): "Does this PR
160change user-facing documentation, agent or skill prose, instruction
161files, CHANGELOG entries, README claims, or any natural-language
162artifact a reader will rely on? If unsure, answer YES."
163
164When the doc-writer is active and the PR includes documentation changes,
165the persona reviews them for: (a) consistency with the existing voice
166and structure, (b) accuracy against the code being changed, (c)
167completeness for the typical reader (no orphan claims, no missing
168prerequisites), (d) discoverability (cross-links, sidebar order if
169Starlight content). When the doc-writer is active because of code
170changes that SHOULD have updated docs but did not, the persona surfaces
171that gap as a finding.
172
173### Test Coverage Expert
174
175**Active by default on every PR that touches `src/**/*.py`.** The only
176condition that flips this persona to `active: false` is a
177documentation-only PR -- the diff contains zero `src/**/*.py` files.
178In that case set `inactive_reason: "documentation-only PR -- no
179runtime code paths to defend"`.
180
181The activation rule is intentionally narrow: under the advisory regime,
182test outcomes are LOAD-BEARING for CEO arbitration (passed / failed /
183missing test evidence outranks opinion-only findings -- see
184`apm-ceo.agent.md` and `panelist-return-schema.json` evidence block).
185A persona whose findings carry that weight cannot be silently skipped
186on a heuristic. Better to spawn it on a pure refactor and have it
187return a single `nit`-severity "no behavior surface touched -- no
188coverage finding" line than to skip it and leave the CEO without
189evidence to weigh. (Earlier revisions of this skill paired test-coverage
190with auth and doc-writer as conditional for symmetry; that symmetry
191broke when test evidence became load-bearing.)
192
193The test-coverage-expert is paired with the devx-ux-expert lens and
194defends the user-promise contracts the DevX persona enumerates (CLI
195surface, error wording, install idempotency, lockfile determinism, auth
196resolution). It MUST verify "no test exists" claims with `view`/`grep`
197on the test tree before emitting a finding -- false-positive coverage
198findings destroy trust in the field. It does NOT compute coverage
199percentages, does NOT flag tests for pure refactors, and does NOT
200duplicate python-architect on test-code design.
201
202## Routing matrix (CEO synthesis emphasis only)
203
204These routes describe WHICH specialist's findings the CEO weights more
205heavily for a given PR type. They do NOT change which personas run --
206every mandatory persona always runs. Routing is a CEO synthesis hint.
207
208- **Architecture-heavy PR** -> CEO weights Python Architect on
209 abstraction calls; CLI Logging on consistency.
210- **CLI UX PR** -> CEO weights DevX UX on command surface; CLI Logging
211 on output paths; Growth Hacker on first-run conversion.
212- **Security PR** -> CEO biases toward Supply Chain Security on default
213 behavior; DevX UX flags ergonomics regression from any mitigation.
214- **Auth PR** (auth-expert active) -> CEO weights Auth Expert on
215 AuthResolver / token precedence; Supply Chain on token-scoping.
216- **Docs / release / comms PR** (doc-writer active) -> CEO weights Doc
217 Writer on accuracy and voice; Growth Hacker on hook and story angle.
218- **Behavior-change PR** (test-coverage active) -> CEO weights Test
219 Coverage Expert on regression-trap presence; DevX UX on which user
220 promises the change touches. A blocking-severity coverage finding on
221 a critical-promise surface (auth, lockfile, install, marketplace,
222 hooks) is the highest signal in this routing.
223- **Full panel** (default) -> CEO synthesizes equally; calls out any
224 dissent in `dissent_notes`.
225
226## Execution checklist
227
228Work through these steps in order. Do not skip ahead. Do not emit any
229output to the PR before step 6.
230
2311. **Read PR context** (the orchestrating workflow already fetched it
232 via `gh pr view` / `gh pr diff`). Identify changed files for the
233 conditional panelist routing decisions (auth-expert and doc-writer).
234
2352. **Resolve the conditional panelists** using the rules above. Decide
236 for EACH conditional persona: spawn active OR spawn with
237 `active: false` + an `inactive_reason`. Either way, all three
238 conditional personas ARE spawned -- the schema requires uniform
239 return shape.
240
2413. **Fan out panelist tasks.** Spawn the following tasks in PARALLEL
242 via the `task` tool, one task per persona:
243 - `python-architect` (also asked to supply `extras.diagrams`:
244 `class_diagram` (mermaid `classDiagram`), `component` (mermaid
245 `flowchart TD`), and OPTIONAL `sequence` (mermaid
246 `sequenceDiagram`) blocks per the persona's section 1/2/3 contract)
247 - `cli-logging-expert`
248 - `devx-ux-expert`
249 - `supply-chain-security-expert`
250 - `oss-growth-hacker`
251 - `auth-expert` (always - active per step 2)
252 - `doc-writer` (always - active per step 2)
253 - `test-coverage-expert` (always - active per step 2)
254
255 Each task prompt MUST:
256 - Reference its persona file by relative path so the subagent loads
257 its own scope, lens, and anti-patterns.
258 - Include the PR number, title, body, and diff (passed inline).
259 - Cite `assets/panelist-return-schema.json` and require the subagent
260 to emit JSON matching that schema as its FINAL message.
261 - State the calibrated severity contract: "Use `severity: blocking`
262 ONLY for correctness regressions, security/auth bypasses, or
263 architectural faults that compound, with explicit rationale.
264 Default substantive feedback to `recommended`. Use `nit` for
265 one-line polish. The panel is advisory; nothing you return blocks
266 merge -- pick the severity that honestly matches your signal
267 strength."
268 - Restate the output contract: NO `gh` write commands, NO posting
269 comments, NO label changes, NO touching PR state. JSON return only.
270
2714. **S4 schema gate.** When each panelist task returns, parse the JSON
272 and validate against `assets/panelist-return-schema.json`. On
273 validation failure:
274 - Re-spawn that ONE panelist with an explicit error message pointing
275 at the violated rule.
276 - Maximum two re-spawn attempts per panelist. If still malformed,
277 synthesize a placeholder
278 `{persona: "<slug>", active: true, summary: "Schema failure -- see
279 extras.", findings: [], extras: {schema_failure: "<reason>"}}`
280 and surface the failure in the CEO arbitration prompt.
281
2825. **Spawn the CEO synthesizer task.** Pass the full set of validated
283 panelist JSON returns to a `task` invocation that loads
284 `../../agents/apm-ceo.agent.md`. The prompt MUST:
285 - Provide all panelist returns as structured input.
286 - Ask for: headline, arbitration prose, principle alignment (only
287 applicable principles), curated recommended_followups (prioritized
288 by signal, NOT a re-listing of every finding), ship_recommendation
289 (stance + prose).
290 - Cite `assets/ceo-return-schema.json` and require JSON return.
291 - Restate the contract: the panel is advisory. The CEO does NOT pick
292 a verdict label. The `ship_recommendation.stance` is prose for the
293 human reviewer, not a gate. NO `gh` write commands.
294
295 Validate the CEO return against `assets/ceo-return-schema.json`. On
296 failure, re-spawn once with the violation cited.
297
2986. **Resolve the notification audience.** The advisory comment must
299 surface in the inboxes of the people who will act on it. Run:
300
301 ```
302 gh pr view <PR_NUMBER> --json author,reviewRequests
303 ```
304
305 Build `notify_audience` as the deduplicated list:
306 - the PR author's `@login` (always included);
307 - every requested reviewer's `@login` (these are the
308 CODEOWNERS-resolved reviewers GitHub auto-requested for the
309 touched paths, plus any explicitly-requested human reviewers);
310 - every requested team's `@org/team-slug` (CODEOWNERS team
311 entries).
312
313 Filter out:
314 - bot logins (login ending in `[bot]` or matching
315 `dependabot|github-actions|copilot-pull-request-reviewer`);
316 - the orchestrator's own identity (avoid self-ping).
317
318 Cap the final list at 6 handles to avoid notification noise (PR
319 author + up to 5 reviewers/teams). If the cap trims, prefer team
320 handles over individual logins. Pass the resulting list to the
321 template renderer as `notify_audience`.
322
323 This step replaces the maintainer-notification signal that the
324 pre-advisory verdict labels carried. It is the only mechanism by
325 which a fresh panel pass announces itself.
326
3277. **Render the comment.** Load `assets/recommendation-template.md`,
328 fill the placeholders from the panelist + CEO JSON, and emit it as
329 exactly ONE comment.
330
331 Filling rules:
332 - The per-persona summary table renders ONLY active panelists, one
333 row per persona, with finding counts by severity and the persona's
334 `summary` field.
335 - The mermaid diagrams come from `python-architect.extras.diagrams`.
336 If absent, render the placeholder lines from the template (do NOT
337 invent diagrams).
338 - The recommended follow-ups list renders the CEO's curated subset,
339 not every finding. Full per-persona findings collapse at the bottom.
340 - NEVER render the words "Verdict", "APPROVE", "REJECT", "blocked",
341 "merge gate", or any equivalent. The panel is advisory.
342
3438. **Sweep labels** via `safe-outputs.remove-labels`. The list MUST be
344 `[panel-review, panel-approved, panel-rejected]` -- always all three,
345 regardless of which are currently on the PR. `panel-review` is the
346 re-run idempotency reset; the other two are LEGACY VERDICT LABELS
347 from the pre-advisory regime that have no meaning under the advisory
348 contract and would mislead readers if left on a freshly-reviewed PR.
349 `safe-outputs.remove-labels` is idempotent on missing labels, so
350 sweeping all three on every run is safe and self-healing. NO
351 verdict labels are applied.
352
353## Output contract (non-negotiable)
354
355- Exactly ONE comment per panel run, rendered from
356 `assets/recommendation-template.md`. The `safe-outputs.add-comment.max:
357 2` is a fail-soft ceiling; the discipline lives here.
358- Exactly ONE `remove-labels` call sweeping
359 `[panel-review, panel-approved, panel-rejected]`.
360- NO `add-labels` call. The advisory regime has no verdict to encode.
361- Subagents (panelists + CEO) NEVER write to PR state, NEVER call `gh
362 pr comment`, NEVER call `gh pr edit --add-label`. They return JSON.
363 The orchestrator is the sole writer.
364- Never invent new top-level template sections or drop existing ones.
365
366## Gotchas
367
368- **Roster invariant.** The frontmatter description, the roster table,
369 the conditional rules, the recommendation template, and the JSON
370 schema MUST agree on the persona set. If you change one, change all
371 in the same edit.
372- **Calibrated severity discipline.** The advisory regime relies on
373 panelists honestly distinguishing `blocking` from `recommended`. If a
374 panelist marks everything `blocking`, the comment becomes noisy and
375 the maintainer learns to ignore the field. The panelist prompts state
376 the contract explicitly; the CEO arbitration prose is the safety
377 valve when a panelist over-flags.
378- **Mermaid diagrams are template-required.** The python-architect
379 persona is asked to supply `extras.diagrams.class_diagram`,
380 `extras.diagrams.component`, and the OPTIONAL
381 `extras.diagrams.sequence`. The template renders nothing when they
382 are missing -- it does NOT invent diagrams. Real diagrams are
383 what makes the comment scannable for the human reviewer.
384- **Mermaid `classDiagram` `:::cssClass` shorthand gotcha.** GitHub's
385 mermaid renderer rejects `:::cssClass` appended to relationship
386 lines (e.g. `A *-- B:::touched`); use standalone
387 `class Name:::cssClass` declarations instead. Authority:
388 `python-architect.agent.md:146-154`.
389- **Doc-writer detects DRIFT, not just edits.** When the PR changes
390 user-facing code that SHOULD have updated docs but did not, doc-writer
391 surfaces that as a finding. The conditional rule above is necessary
392 but not sufficient -- doc-writer reasons about doc consistency given
393 the diff, not just whether doc files were touched.
394- **False-negative auth gotcha.** Auth regressions can be introduced
395 from non-auth files that change the inputs to auth -- host
396 classification, dependency parsing, clone URL construction, HTTP
397 authorization headers, or call sites that bypass `AuthResolver`. If
398 a diff changes how a remote host, org, token source, or fallback path
399 is selected and you are not certain it is auth-neutral, activate
400 auth-expert as `active: true`.
401- **Test-coverage probe is mandatory.** The test-coverage-expert MUST
402 verify "no test exists for X" via `view`/`grep` on the `tests/` tree
403 before emitting a finding. A false-positive coverage finding (test
404 exists but persona claimed it does not) destroys maintainer trust in
405 the field. The persona scope file enforces this; the orchestrator
406 passes the diff and trusts the persona to probe.
407- **Subagent write enforcement is contract-based, not sandbox-based.**
408 Tool permissions are workflow-scoped, not subagent-scoped, so every
409 spawned task technically inherits the same `gh` toolset. The
410 "subagents must not write" rule is enforced by the prompt contract in
411 each `.agent.md` plus the `safe-outputs.add-comment.max: 2`
412 fail-soft. If a subagent ever tries to post a comment, the cap
413 catches it.
414- **No verdict-label reset workflow.** The previous regime had a
415 companion workflow `pr-panel-label-reset.yml` that stripped verdict
416 labels on every push. The advisory regime has no verdict labels to
417 strip; that workflow is removed.