Skip to content

Optimize code-review-deep command for ~50% lower usage#34

Merged
ydesgagn merged 1 commit into
masterfrom
optimize-code-review-deep-cmd
May 9, 2026
Merged

Optimize code-review-deep command for ~50% lower usage#34
ydesgagn merged 1 commit into
masterfrom
optimize-code-review-deep-cmd

Conversation

@ydesgagn
Copy link
Copy Markdown
Contributor

@ydesgagn ydesgagn commented May 8, 2026

Summary

Reworks the /code-review-deep command to consume substantially less usage while producing better reports than the original. Verified against the github-build repo: the optimized run produces 42 main-body findings (6 High / 27 Medium / 6 Low / 3 Info) versus the original's 26, while running on roughly half the agents.

Key changes:

  • Phase 1 scans now use the Explore subagent (purpose-built for read-only file location / grep, returns excerpts not full files) instead of the heavier general-purpose agent.
  • Phase 2 agent count consolidated from 20 to 10 by merging overlapping concerns: Quality/Comments and Bugs/Errors stay separate, but Perf+Observability+API+Concurrency+Migrations merge into a single Backend agent, IaC+Compliance merge, i18n+AI/ML merge, Repo+CI/CD merge, Docs+Config merge, Deps+BackwardsCompat merge.
  • Web search is now opt-in only — agents rely on the model's existing knowledge by default; web search is reserved for CVE lookups, latest-version checks, and explicitly user-requested verification.
  • Phase 3 adversarial validation batch size raised from 3 to 10 findings per agent (~70% fewer validation agents on a typical repo).
  • Phase 3.5 confidence filter tiered by severity (Critical >= 50, High/Medium >= 65, Low/Info >= 80) so important findings aren't hidden behind a single 80 threshold.
  • Phase tracking simplified to TaskCreate-based tracking (was a verbose multi-page log).
  • Bug-pattern and error-handling checks expanded with CLI-specific concerns (STDOUT vs STDERR, narrow rescue clauses, error context loss).
  • Quantitative count requirements preserved and made explicit (linter disables, silent failures, addObserver/removeObserver delta, pattern duplication).
  • All high-value rules preserved verbatim: Dependabot `gh api` evidence requirement, IaC UserData/CloudWatch agent observability check, case-insensitive file lookups, full exclusions list, severity rubrics, markdown lint rules.
  • File size reduced from 1336 to 750 lines (~44% smaller).

Types of changes

  • Bugfix (fixes an issue)
  • New feature (adds functionality)
  • Refactoring (improves code without changing functionality)
  • Breaking change (incompatible changes)
  • Build or security update (updates dependencies, libraries, or security patches)
  • Code style or documentation update (formatting, renaming, or documentation changes)
  • Other (please describe):

Checklist

  • Unit tests added to validate my fix/feature
  • I have manually tested my change
  • I did not add automation test. Why ?: This is a slash-command markdown file with no executable code path; verified by running the command end-to-end against the `cloud-officer/github-build` repo and comparing the generated `docs/code-review.md` against a baseline produced by the previous version of the command.
  • Database changes requiring migration with downtime or reprocessing of existing data
  • The SOUP file lists the risk Level, requirements and verification reasoning associated with each library
  • `readme.md` includes sections on introduction, installation, usage, and contributing
  • `docs/architecture.md` includes sections on the architecture diagram, software units, software of unknown provenance, critical algorithms and risk controls related to PII and security
  • Impact on PII, privacy regulations (CCPA/GDPR/PIPEDA), CIS benchmarks or security (availability/confidentiality/integrity); management must be notified

@ydesgagn ydesgagn merged commit 5c699b3 into master May 9, 2026
7 checks passed
@ydesgagn ydesgagn deleted the optimize-code-review-deep-cmd branch May 9, 2026 02:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant