بنقرة واحدة
review-perf-fix
Review a performance fix for correctness and measure its necessity
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Review a performance fix for correctness and measure its necessity
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
One tick of a CI watchdog — check main-branch GHA status; spawn an agent to fix if failing and no investigation is in flight.
One tick of the henyey mainnet monitor — checks, metrics scan, deploy, status report
Continuous always-on orchestrator for the henyey project pipeline. Each pass queries the board, central-picks up to N actionable issues by priority, and fans out parallel foreground specialist sub-agents (triage/plan/do/review-pr) with the right Claude model per stage. Owns concurrency, conflict-avoidance, CI pipelining, sibling-nit consolidation, and a self-reflection pass that files pipeline-improvement issues. Replaces scripts/project-tick-loop.sh. Use when the operator asks to "run the loop", "process the board continuously", or "keep the pipeline going".
Single-pick dispatcher primitive for the henyey project pipeline. One tick = pick one actionable issue from the project board and dispatch the right specialist sub-agent for its current state. Used for manual single picks and `--issue=` recovery; the continuous orchestrator is `/project-loop`, which owns concurrency centrally. Use when the user asks to "run a tick", "pick up an issue", or "process one board item".
Run two parallel adversarial PR reviewers and combine their verdicts with external PR reviews (GH Copilot bot, humans, other bots) and CI state into a merge decision. Agent reviewers post structured comment verdicts (since the agent is the PR author and cannot self-approve via GH native review). External CHANGES_REQUESTED reviews block merge identically to agent CHANGES_REQUESTED. Operates on issues in `in-review`. Auto-merges with --admin on all-green (after filing follow-up issues for unaddressed inline review comments, so non-critical feedback is preserved as backlog instead of dropped); bounces to `ready-for-doing` on any request-changes or CI red; blocks after 3 bounce-backs on the same code state. At the lifetime cap (6 bounces since last `## Review: Reset`) the PR enters **force-converge mode**: if CI is green, the PR auto-merges and unresolved reviewer concerns become follow-up issues; only red/pending CI at the cap still blocks. Use when invoked by /project-tick with an issue in in-review, or manuall
Audit a Rust crate's adherence to its Stellar protocol spec (spec-driven, walks every normative claim)
| name | review-perf-fix |
| description | Review a performance fix for correctness and measure its necessity |
| argument-hint | <commit-or-range> [--apply] |
Parse $ARGUMENTS:
.., treat it as a range $START..$END. Expand to
the list of commits with git rev-list --reverse $START..$END and set
$MODE_BATCH = true. Each commit is reviewed individually; a summary table is
appended at the end.$COMMIT with it.
Set $MODE_BATCH = false.--apply is present, set $APPLY = true. Otherwise $APPLY = false.Review a performance optimization commit for correctness (Phase 1) and measure whether it actually improves throughput (Phase 2). Produce a necessity judgment combining measured impact, code complexity, and risk.
Benchmark command (fixed for all measurements):
<binary> apply-load --mode single-shot --tx-count 50000 --clusters 4 --iterations 10
~/data/<session-id>/.$HEAD.git status --porcelain must be empty).
If not, abort with an error.For each $COMMIT:
git log -1 --format=fuller $COMMIT
git show $COMMIT --stat
git diff $COMMIT~1..$COMMIT
Identify: commit message, author, files changed, lines added/removed, and the full diff. Read the complete current state of every file touched by the commit to understand surrounding context.
From the diff and commit message, reconstruct:
Read the code before and after. Do not guess — if the strategy is unclear, read callers, callees, and related types until you understand it.
Evaluate along these dimensions:
Classify correctness:
Use subagents (Task tool with explore type) to find:
IMPORTANT — Measurement Isolation: Baseline and without-fix measurements MUST be taken sequentially in the same session. Do NOT reuse baseline measurements from a prior session or a different day. Environmental variance (CPU thermals, background load, OS scheduling) can cause 5–7% drift between sessions on the same machine with the same binary. Always measure: baseline → without-fix (or vice versa) back-to-back, with no significant time gap between them.
Build the current HEAD as the baseline:
CARGO_TARGET_DIR=~/data/<session-id>/cargo-target cargo build --release -p henyey
cp ~/data/<session-id>/cargo-target/release/henyey ~/data/<session-id>/baseline
Run the benchmark 3 times and record each result:
~/data/<session-id>/baseline apply-load --mode single-shot --tx-count 50000 --clusters 4 --iterations 10
Parse "Average TPS: NNN" from the output. Record all 3 values and compute
the median as $BASELINE_TPS.
The goal is to create a version of current HEAD without this specific optimization, so we can measure TPS without it.
Strategy — reverse-patch the commit onto HEAD:
git stash # safety, even though we checked clean
git revert --no-commit $COMMIT
If git revert succeeds cleanly, proceed to Step 9.
If git revert has conflicts:
$COMMIT's changes.Vec → HashMap),
and later commits use the new structure, the revert will break. In this
case, you must adapt the subsequent code to work with the old structure.CARGO_TARGET_DIR=~/data/<session-id>/cargo-target cargo build --release -p henyey
git checkout . to restore HEADCARGO_TARGET_DIR=~/data/<session-id>/cargo-target cargo build --release -p henyey
cp ~/data/<session-id>/cargo-target/release/henyey ~/data/<session-id>/without-fix
Run the same benchmark 3 times with the without-fix binary:
~/data/<session-id>/without-fix apply-load --mode single-shot --tx-count 50000 --clusters 4 --iterations 10
Record all 3 values, compute median as $WITHOUT_FIX_TPS.
git checkout .
git clean -fd
Verify HEAD is back to $HEAD.
$BASELINE_TPS - $WITHOUT_FIX_TPS(delta / $WITHOUT_FIX_TPS) * 100git show --stat), number of files
touched, new abstractions introduced (new types, traits, caches, threads)Make a judgment call considering all three dimensions:
The verdict is a judgment call, not a mechanical threshold. A 0.5% gain from a 2-line change is WORTHWHILE; a 2% gain from a 500-line refactor with race condition concerns might be UNNECESSARY. Explain your reasoning.
For each commit with a MARGINAL verdict, assess whether it should be reverted based on complexity cost vs. the value it provides.
Evaluate:
Option<&Cache> patterns) impose cost on every caller.Determine whether a later commit in the series (or a subsequent change) makes this optimization redundant:
Categorize each MARGINAL commit:
Include a summary table grouping all MARGINAL commits by recommendation, with commit hash, line counts, and a one-line reason for each.
For each commit, produce:
# Perf Fix Review: $COMMIT_SHORT
## Commit Summary
- **Hash**: full hash
- **Message**: commit message
- **Files changed**: list with line counts
- **Optimization category**: caching / parallelism / allocation / algorithm / etc.
## Correctness Review
- **Hot path**: function(s) and crate(s) targeted
- **Problem**: what was inefficient
- **Strategy**: what the optimization does
- **Semantic preservation**: any observable behavior changes?
- **Edge cases**: concerns or confirmation that they're handled
- **Parity**: stellar-core alignment (if applicable)
- **Test coverage**: adequate / gaps identified
- **Correctness verdict**: SOUND / CONCERNS / INCOMPLETE / WRONG
## Performance Measurement
- **Baseline (HEAD)**: X TPS (runs: a, b, c)
- **Without fix**: Y TPS (runs: a, b, c)
- **Delta**: +Z TPS (+P%)
- **Measurement notes**: any caveats (e.g., high variance, unable to isolate)
If measurement was skipped:
- **Measurement**: SKIPPED — <reason>
## Necessity Judgment
- **TPS gain**: +P% (+Z TPS)
- **Complexity**: N lines, M files, description of added abstractions
- **Risk**: low / medium / high
- **Verdict**: ESSENTIAL / WORTHWHILE / MARGINAL / UNNECESSARY
- **Rationale**: 2-3 sentences explaining the judgment
## Similar Opportunities
(Other locations that could benefit from the same optimization pattern.
If none: "No similar opportunities identified.")
## Recommendations
(Prioritized follow-up actions, if any.)
## Revert Recommendation (MARGINAL only)
- **Complexity cost**: lines, abstractions, signature pollution
- **Superseded by**: commit(s) that make this redundant, or "N/A"
- **Recommendation**: REVERT / CONSIDER REVERTING / KEEP
- **Rationale**: 1-2 sentences
After all individual reviews, append:
# Batch Summary
| # | Commit | Description | Baseline | Without | Delta | Correctness | Necessity |
|---|--------|-------------|----------|---------|-------|-------------|-----------|
| 1 | abc123 | Cache TTL hashes | 12000 | 11800 | +1.7% | SOUND | WORTHWHILE |
| 2 | def456 | ... | ... | ... | ... | ... | ... |
**Cumulative**: If all UNNECESSARY fixes were removed, estimated TPS would be ~X.
# Revert Recommendations (MARGINAL commits)
| Recommendation | Commit | # | Lines | Reason |
|----------------|--------|---|-------|--------|
| REVERT | abc123 | 1 | +134/−43 | High signature pollution, superseded by #15 |
| CONSIDER REVERTING | ... | ... | ... | ... |
| KEEP | ... | ... | ... | ... |
When $APPLY = true, after producing the full review:
For commits rated CONCERNS or INCOMPLETE:
cargo clippy --all and cargo test --all after each fixFor commits with inadequate test coverage:
cargo test -p <crate> to verifyFor commits rated UNNECESSARY:
RECOMMENDATION: Consider reverting $COMMIT (<description>).
Measured impact: +X TPS (+P%), but complexity cost is <description>.
To revert: git revert $COMMIT
cargo clippy --all and cargo test --all after each change.Co-authored-by trailers per AGENTS.md.When all reviews are complete (or on abort):
$HEAD.~/data/<session-id>/ until the user confirms
cleanup (it contains the binaries and benchmark logs for reproducibility).Session artifacts: ~/data/<session-id>/file:line for every claim.