Skip to content

[agentic-token-optimizer] Optimize Matt Pocock Skills Reviewer: drop unused skills, guard against timeout-driven AIC spikes #52096

Description

@github-actions

Target workflow

Matt Pocock Skills Reviewer (.github/workflows/mattpocock-skills-reviewer.md) — highest-AIC workflow in the last 7 days not yet optimized in the past 14 days (last optimized 2026-06-26).

Analysis period

Last 7 days, 5 completed runs (all pull_request events).

Cost profile

Metric Value
Total AIC (5 runs) 416.53
Avg AIC/run 83.31
Avg AIC/run (successful only, n=4) 22.27
Total raw tokens 76,807
Avg turns/run not tracked (0 reported)
Runs §31499327485 success · §31497707048 success · §31497780690 failure (timeout) · §31497481617 success · §31497365960 success

Headline finding: a single failed run (§31497780690) consumed 327.4 AIC — 78.6% of the entire 5-run total — while every successful run averaged only 22.3 AIC. This one run dominates the cost profile far more than any prompt inefficiency in the successful runs.

Ranked recommendations

1. Fail fast on safe-outputs MCP gateway startup failure instead of timing out (est. ~250 AIC saved per occurrence)

  • Evidence: run §31497780690 hit safeoutputs tools/list returned 0 tools at 13:47:23 (within the first minute) and printed ##[error]Unhandled error: ... Failing fast, yet the agent step continued running for another ~15 minutes doing full PR analysis (reading diffs, invoking the pr-triage sub-agent, generating full review comments) before the job was killed by the 15-minute timeout-minutes limit at 14:02:37. All of that analysis work was thrown away since no safe output could ever be emitted once the gateway had 0 tools registered.
  • Action: when the safeoutputs gateway reports 0 tools at startup, abort the agent turn immediately (before invoking the model) rather than letting the harness continue for the full timeout window. This is an infra/harness-level fix (not this workflow's prompt), but it directly protects every safe-outputs-dependent workflow from this exact AIC-spike pattern.
  • Caveat: this may be a shared harness behavior outside this workflow's .md source — flagging here because this workflow was the clearest example in the sample, but the fix likely belongs in the MCP gateway / agent driver.

2. Remove two unused installed skills from the workflow (est. 3-5% prompt reduction, ~1 AIC/run)

  • Evidence: the skills: frontmatter installs 7 skills (diagnosing-bugs, tdd, improve-codebase-architecture, grill-with-docs, to-prd, codebase-design, domain-modeling) and all 7 are documented in the "Available Matt Pocock Skills" section (lines 87–97). However, the pr-triage sub-agent's Skill mapping (lines 290–297) and its allowed recommended_skills list (lines 281–286) only ever select from 5 skills: /diagnosing-bugs, /tdd, /codebase-design, /improve-codebase-architecture, /grill-with-docs. /to-prd and /domain-modeling are installed, described in the main prompt, and referenced in "Focus areas by skill" style guidance nowhere in Step 4 — they can never be selected or applied by the current triage logic.
  • Action: either (a) remove /to-prd and /domain-modeling from skills: frontmatter and the "Available Matt Pocock Skills" section entirely, or (b) add them to the pr-triage skill mapping if they were intended to be reachable. Given they were likely intentionally scoped out (both are PRD/vocabulary tools, poor fit for line-level code review), option (a) is the conservative choice — this removes two skill descriptions from the always-loaded prompt and stops installing two unused skill bundles at workflow start.

3. Trim "Focus areas by skill" section to only include mapped skills (est. minor, ~5% of prompt body)

  • Evidence: Step 4 (lines 156–182) spells out full focus-area guidance for all 5 mapped skills every run, even though pr-triage only ever recommends 1–2 of them per PR. This is much smaller overhead than Recommendation 1 but is a legitimate, low-risk trim.
  • Action: no removal recommended (all 5 remain reachable and used across historical runs) — flagging only as an observation; do not act on this without more run samples confirming which skill combinations are actually infrequent.

Caveats

  • Sample size is small (5 runs, 1 workflow file version) — AIC savings estimates for Recommendation 2 are conservative and based on frontmatter/prompt line-count reduction only, not measured before/after runs.
  • Recommendation 1 addresses harness/driver behavior, not workflow-specific YAML; it is included because it was the dominant cost driver in this sample and materially changes how much AIC this specific workflow burns during safe-outputs infra failures.
  • No inline sub-agent recommendation is made: the workflow already has one (pr-triage), which appropriately isolates a small-model-suited classification task from the main review.
  • No setup-prefix duplication was found across sections in this workflow — it already uses shared components (shared/pr-review-base.md, shared/pr-diff-data-fetch.md, shared/otlp.md) for cache/data-fetch logic.
Raw run data (5 runs analyzed)
Run Status Duration Action min Tokens AIC
§31499327485 success 7.7m 8 8,100 19.64
§31497707048 success 12.0m 13 9,672 27.69
§31497780690 failure (timeout) 19.9m 20 40,719 327.44
§31497481617 success 7.2m 8 10,637 27.41
§31497365960 success 6.3m 7 7,679 14.35

Generated by Agentic Workflow AIC Usage Optimizer · auto · 66.1 AIC · ⊞ 10.5K ·

  • expires on Aug 18, 2026, 7:22 AM UTC-08:00

Metadata

Metadata

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions