From d384dd6713c575be5201aab29b542ed358949ab3 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Wed, 23 Sep 2026 11:16:45 +0000 Subject: [PATCH] feat: add profiling regression proposal skill Adds an evidence-only performance skill that interprets classified Hermes CPU-profile regressions without re-deciding whether a regression exists. Co-authored-by: javiergarciavera --- CHANGELOG.md | 1 + .../references/evidence-schema.md | 58 ++++++++++++++ .../profiling-regression-proposal/skill.md | 76 +++++++++++++++++++ 3 files changed, 135 insertions(+) create mode 100644 domains/performance/skills/profiling-regression-proposal/references/evidence-schema.md create mode 100644 domains/performance/skills/profiling-regression-proposal/skill.md diff --git a/CHANGELOG.md b/CHANGELOG.md index e7367690..c77fcc48 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added +- Add `performance/profiling-regression-proposal`: an evidence-only skill that proposes follow-up actions after MetaMask Mobile CI has already classified a Hermes CPU-profile regression. - Support explicit-only workflow skills through native invocation controls, preserve repository overlays, and prune managed retired skill names during sync. - Add `navigation` skill with a repo-agnostic base and a MetaMask Mobile overlay for `Routes` and `NavigationService`. Marked `base: true` so it installs even when its domain is filtered out. - Add `feature-flags` skill with a repo-agnostic base and a MetaMask Mobile overlay for version-gated remote flags. Marked `base: true` so it installs even when its domain is filtered out. ([#147](https://github.com/MetaMask/skills/pull/147)) diff --git a/domains/performance/skills/profiling-regression-proposal/references/evidence-schema.md b/domains/performance/skills/profiling-regression-proposal/references/evidence-schema.md new file mode 100644 index 00000000..ad9988f2 --- /dev/null +++ b/domains/performance/skills/profiling-regression-proposal/references/evidence-schema.md @@ -0,0 +1,58 @@ +# Evidence schema + +The caller provides a single JSON object. Field names may evolve, but the +security boundary does not: only values present in this object may appear as +facts in the proposal. + +```json +{ + "runId": "123", + "runUrl": "https://github.com/example/actions/runs/123", + "currentSha": "abc", + "previousRunId": "122", + "previousSha": "def", + "findings": [ + { + "scenario": "Perps add funds", + "owner": "team-name", + "jsWorkMs": 12600, + "baselineMedianJsWorkMs": 3000, + "ratio": 4.2, + "baselineRuns": 3 + } + ], + "frames": [ + { + "scenario": "Perps add funds", + "name": "usePerpsOrderForm", + "url": "app/example.ts", + "line": 40, + "selfMs": 800 + } + ], + "pullsOverlappingTheProfile": [ + { + "number": 123, + "title": "Example", + "url": "https://github.com/example/pull/123", + "files": [ + { + "path": "app/example.ts", + "patch": "+changed line" + } + ] + } + ], + "pullsMergedWithNoProfileFile": [ + { + "number": 124, + "title": "Unrelated", + "url": "https://github.com/example/pull/124" + } + ] +} +``` + +`pullsOverlappingTheProfile` is computed by deterministic tooling before model +invocation. The model must not promote entries from +`pullsMergedWithNoProfileFile` based on titles or prior knowledge. diff --git a/domains/performance/skills/profiling-regression-proposal/skill.md b/domains/performance/skills/profiling-regression-proposal/skill.md new file mode 100644 index 00000000..bb7f233c --- /dev/null +++ b/domains/performance/skills/profiling-regression-proposal/skill.md @@ -0,0 +1,76 @@ +--- +name: profiling-regression-proposal +description: >- + Proposes follow-up actions for an already-classified Hermes CPU-profile + regression using only the profiling evidence supplied by the caller. Use + after deterministic tooling has identified a slow scenario and correlated + hot-frame paths with files from recently merged pull requests. +maturity: stable +--- + +# Profiling Regression Proposal + +Produce a short, evidence-bound proposal after deterministic profiling tooling +has already classified a run. This skill interprets evidence; it does not decide +whether a regression exists. + +## When To Use + +Use this skill only when the caller supplies structured evidence containing: + +- findings produced by a deterministic threshold; +- hot frames extracted from generated CPU-profile reports; +- recently merged pull requests separated by whether their changed files + overlap those hot-frame paths. + +Do not use source-tree searches, repository knowledge, issue history, PR titles, +or general performance heuristics as additional evidence. + +## Workflow + +1. Treat the supplied evidence object as the only source of truth. +2. Do not change, second-guess, or reapply the caller's regression threshold. +3. Mention a file, function, timing, ratio, run, or owner only when it appears + in the evidence. +4. Connect a pull request to a finding only when the caller places it in the + profile-overlap collection. A title that mentions the affected feature is + not evidence. +5. A changed file may be discussed only when its path already occurs in a hot + frame from the generated profile. +6. Pull requests in the no-profile-overlap collection may be named only to say + the supplied profile cannot implicate them. +7. Do not infer source files, behavior, ownership, causes, or fixes from + unsymbolicated frames. +8. Several scenarios crossing the threshold in one run are one run-level + anomaly, not automatically several independent bugs. +9. If no pull request overlaps a profiled path, say so and stop. Do not choose a + likely culprit. +10. Describe every proposed action as a hypothesis to validate by rerunning the + same profile, never as a confirmed root cause. + +## Output + +Return Slack mrkdwn: + +- first line: + `*AI proposal (profiling evidence only; not a root cause)*`; +- at most six bullets; +- one sentence per bullet; +- pull-request links formatted as ``; +- no general disclaimer beyond the required first line. + +Good: + +> PR #123 changed a file that appears as a hot frame; rerun the same scenario +> with that change isolated and compare the frame's self time. + +Not allowed: + +> PR #123 is the cause because its title mentions Perps. + +The title is routing context, not profiling evidence. + +## Failure behavior + +Return no proposal when the evidence is missing or malformed. Never fill gaps +with repository knowledge or generic optimization advice.