/praxis:perf-leak-reviewfrom praxis
Point at performance-defect and memory-leak candidates in a diff — a read-only LLM reviewer reads the change plus the repository around it and reports candidates in a closed list of six classes. Report-only: nothing is executed, nothing is written, no finding is a proven defect.
Ships in praxis. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
A session writes code and the next thing that reads it is a reviewer looking for
correctness. Performance defects and leaks survive that pass: they are correct
code, they pass the tests, and the cost shows up in production instead. praxis
has no axis that looks for them — retrospect grades
workflow friction, and its one "performance" word means a slow tool call, not
slow code.
This skill hands a unified diff and the repository around it to a read-only
LLM reviewer and asks one question: does this change introduce a candidate in
one of six defect classes? It is report-only — it runs none of the
project's code, writes nothing into the repository, and grades every finding
candidate rather than defect, the same read-oracle lineage
codex-review-wrap sits in.
Core principle: a reader can point at a candidate; only an execution can
prove a defect — so the output says candidate and never more.
References: references/reviewer-brief.md
is the delegated reviewer's prompt (Step 3);
references/repo-wide-sweep.md is the
area fan-out for a request with no diff. The skill ends at the candidate list;
proving a candidate by execution is outside it.
--diff); follow
references/repo-wide-sweep.md, which
reuses the reviewer brief per area and reports area sampling, not
exhaustive coverage.Six classes, and nothing outside them is reported. The list is the spec:
widening it is a separate change to
references/reviewer-brief.md and
validate_findings.py together.
| # | Class |
|---|---|
| C1 | N+1 / remote call inside a loop |
| C2 | Unreleased resource (file, socket, connection, subprocess) |
| C3 | Unbounded global container or cache |
| C4 | Load-everything-then-filter-in-memory |
| C5 | Unreleased listener, callback, or timer |
| C6 | Unbounded LLM context (prompt, message list, history) |
The skill takes --diff <path> --repo <root> and returns a finding envelope. It
does not decide when a review runs or where the findings go — those are
the caller's, and they are deliberately unsettled. So no step here reads a
session transcript, posts a comment, opens an issue, or blocks anything; a
trigger surface added later attaches by passing the two arguments.
One such caller ships in praxis: the merge-gate perfleak check
(hooks/preflight-gate/merge-gate/spec.md → Check: perfleak). With
PRAXIS_MERGE_PERF_LEAK_REVIEW=1 in the hook environment it denies
gh pr merge until a record exists for the PR's current head. The recorder
wraps this skill's run, so the skill itself still writes nothing:
"${CLAUDE_SKILL_DIR}/record_review.py" prepare --pr <PR URL> # prints the diff path
# Steps 1-4 with --diff <that path> --repo <a checkout of the PR head>
"${CLAUDE_SKILL_DIR}/record_review.py" commit --pr <PR URL> --envelope <envelope file>
commit refuses when the head or diff moved since prepare, or when the
envelope fails the validator, and prints one verification-anchor row. Put
that row in the anchor before the merge question and list any candidate you
could not refute under the briefing's Open items; a candidate never blocks
the merge. A push moves the head, so run both steps again on the new head.
On Hermes, one command does all three steps when the caller cannot spend a
delegate_task on the review (a headless run, or one whose result must land
in this turn):
"${CLAUDE_SKILL_DIR}/record_review.py" run --pr <PR URL> --repo <clean checkout at the PR head> [--profile <name>]
It runs prepare, writes the reviewer prompt (brief path, --diff, --repo,
the diff's line count, and a numbered required-reading list of the changed
code files with their diff line ranges) next to the diff, runs
hermes -p <profile> chat -Q --oneshot --query-file <prompt> (profile
reviewer by default) and waits for it, takes the one envelope from its
stdout, and runs commit. It refuses a checkout that is not clean at the PR
head, a reviewer that exits non-zero, and output without exactly one
envelope. An empty envelope is recorded only when the reviewer profile's
state.db shows that session (and any segment it was compressed from) read
the diff and every listed file with a read_file call that did not fail;
otherwise it names the files it skipped. The reviewer's stdout
and the prompt stay beside the diff (.reviewer.out, .prompt.txt), so no
caller writes its own wrapper script or edits an older prompt for a new head.
The validated envelope is the .envelope.json file beside the record (also
the record JSON's envelope field): read each candidate's file, line and
evidence there
to refute it or list it under Open items. When the PR head moves while the
reviewer runs, run refuses to record and you run it again.
Name the repository in the merge (--repo or the PR URL) and run it alone, or
pin the reviewed head with --match-head-commit <sha>; otherwise the gate
cannot tell which head the merge takes and denies it.
git rev-parse --show-toplevel
--diff <path> is a unified diff file and --repo <root> is the root the diff
applies to. --diff is required. Step 3 hands the reviewer a path, and this
skill cannot produce one from git diff: that writes to stdout, and the
allowed-tools above carry no Write and no redirect, deliberately — a skill
whose whole claim is that it does not write to the repository does not get a
file-creating step. A caller with no diff file on hand makes one itself
(git diff > <path outside the repository>) and passes it.
With --diff given and --repo omitted, the root comes from
git rev-parse --show-toplevel. Both paths are read-only for the rest of the
run.
Stop if --diff is absent and report
perf-leak-review: --diff <path> is required — this skill does not create one.
Stop if the diff is empty: there is nothing to review, and an empty envelope from an empty diff says nothing about the reviewer.
This step needs the Agent tool. Under Hermes Agent the equivalent is
delegate_task with a goal that names the brief's path and the two resolved
paths and tells the child to read the brief and return only its envelope; the
child returned a bare (unfenced) envelope that the validator accepted. When
the call runs in the background (it returns at once and the result arrives as
a later message), end the turn after dispatching; when it returns the result
in the same call, continue in this turn. For a merge-gate record on Hermes,
record_review.py run (see Merge gate) runs this delegation as a
synchronous one-shot session instead. The
reviewer reads the working tree, so do not start anything that rewrites the
repo's source files (a mutation matrix, a formatter) until its envelope is
back; otherwise it may review a mutant instead of the change. On a
host with neither — the Codex host is UNKNOWN here, never verified —
stop and report
perf-leak-review: this host cannot delegate a read-only reviewer — unverified here. Do not review the diff inline instead: the session that wrote the diff is
the one context that cannot read it independently (CLAUDE.md, the author-exempt
trap), and an inline fallback would silently trade that away.
Read references/reviewer-brief.md and pass it
as the prompt, verbatim, followed by the two resolved paths:
Agent(
subagent_type="general-purpose",
prompt=<the full text of references/reviewer-brief.md>
+ "\n\n--diff <resolved diff path>\n--repo <resolved repo root>\n"
)
Under Hermes Agent, the delegate_task call of Step 2 is this delegation:
make no Agent call, and take its envelope to the next step.
One delegation per diff. The brief, not this file, is the source of truth for what the reviewer is told — the class definitions, the read budget, the tool restriction, and the output schema all live there, so they cannot drift from what the validator enforces.
The reviewer is told to use Read, Grep, and Glob only. That instruction is the
whole enforcement: allowed-tools above is an allow list for this skill's
steps and does not bind a subagent, so "it did not write" is a claim the
caller's own after-the-fact check has to settle (see Limitations).
Pipe the reviewer's JSON through the validator; it exits non-zero and prints every violation:
printf '%s' "$envelope" | "${CLAUDE_SKILL_DIR}/validate_findings.py"
A rejected envelope is not repaired and re-emitted. Report the violations as they are: a class outside C1..C6 is a false positive that the count has to see, and quietly rewriting it into a compliant finding is what the closed list exists to prevent.
Print the validated envelope, then one summary line:
perf-leak-review: <n> candidate(s) — C1:<n> C2:<n> C3:<n> C4:<n> C5:<n> C6:<n> (candidates, not verified by execution)
Zero findings is a result, not a failure — say 0 candidates plainly. Every
finding carries file, line, and the quoted evidence, so the reader can go
to the line without re-deriving anything.
The report — the validated envelope and the candidate list above — is the whole output. This skill runs nothing and hands off to nothing; whether a candidate gets proven by execution is the reader's decision.
| Error | Recovery |
|---|---|
--diff absent, or its path missing or empty | Abort and report it. There is no fallback: this skill cannot create a diff file (Step 1) |
--repo is not a directory | Abort with the path |
Neither Agent nor Hermes delegate_task available on this host | Stop with the unverified-host message (Step 2); never review inline. With delegate_task, take the Hermes path of Step 2 |
Reviewer wrapped the envelope in a ```json fence, or put prose around it | Strip the fence and extract the single JSON object; if there is not exactly one, report the raw output and stop. Observed on a third of live envelopes, so treat it as normal rather than as a failure |
| Validator exits 1 | Report its violation lines verbatim; do not repair the envelope |
| Reviewer reports a class outside C1..C6 | The validator rejects it — report it as an out-of-list finding, which is a false positive |
allowed-tools does not
constrain the delegated reviewer. A harness that needs proof runs the review
against a write-protected copy and checks git status --porcelain afterwards
— which is what scripts/perf-leak-review-eval.sh does, and even that
observes only traces left inside the prepared tree.scripts/run-tests.sh
never executes a skill, so CI gates the schema, the fixture inventory, and the
scorer; recall and the clean controls are measured live and transcribed into
the PR verification anchor.Agent delegation is verified on the
Claude host and its delegate_task equivalent on Hermes (Step 2); the Codex
host is UNKNOWN and the skill stops there rather than guessing.What SKILL.md sets; muted values are Claude Code's defaults
Triggers on "perf review", "leak review", "performance defect", "memory leak", "성능 결함 점검", "메모리 누수 점검". Do NOT activate on "프로파일링", "벤치마크", "성능 측정", or any request to measure runtime — this skill never runs the code it reviews.
Other plugins' skills for the same job
npx claudepluginhub devseunggwan/praxis --plugin praxis16 skills in this plugin
/cmux-delegateHand off an existing independent issue that surfaced mid-task to its own Claude Code session in a new cmux workspace, with auto-collected context; that session runs issue→worktree→PR alone. Not for splitting the current task./cmux-recover-sessionsBulk recover Claude Code sessions after a crash, power loss, OOM kill, or reboot by scanning the .jsonl files Claude Code persists automatically. Interactive interview chooses recovery scope and layout. Use this when sessions died and you need them back. The .jsonl scan reflects each session's real final state, so no snapshot taken before the crash is needed.
/codex-review-wrapWorktree-aware wrapper for /codex:review. Forces explicit worktree selection when several worktrees are active, preventing silent cwd mismatch, then gates every returned finding: premise verification before fact-modifying edits, flip detection halting A→B→A oscillation, sibling cross-checks for a port or parallel hotfix, a diminishing-returns advisory (PRAXIS_DIMINISHING_RETURNS_N), and a per-finding approval ask. It also reaps leaked openai-codex brokers (PRAXIS_CODEX_REAP=1).
/merge-briefingBrief and ask before merging any PR: probe CI, reviews and inline threads, grade every open finding by its blocking decoration, carry the anchor's `Unverified` gaps, write the six-part briefing, and end on the approve-ask.
/reset-strikesReset the current session's strike counter to 0 and clear the recorded violation list. Required after a 3rd strike block before Claude can respond again./retrospectSession retrospect — analyze the current Claude Code session against the rules it ran under (project and global `CLAUDE.md`), identify friction patterns and root causes, propose context-appropriate improvement actions, then execute after user approval.