Skip to content

Scoped audits: audit PRD changes instead of whole codebase #5

Closed

Description

@dominicnunez

Summary

Rename CLI commands to Simpsons character names and add scoped audits as the default post-PRD behavior.

Problem

Currently sfk run and sfk audit are generic names, and Willie audits the full codebase every time. For large projects this burns tokens re-auditing unchanged code and takes forever.

Command Rename

  • sfk run → sfk ralph
  • sfk audit → sfk willie

Why: brand, clarity, pipeline identity. Ralph builds, Willie audits. Opens the door for future characters. Keep sfk run and sfk audit as hidden aliases with deprecation warnings.

Key Decision: Scoped Audit is Default After PRD

sfk ralph should always run a scoped audit after Ralph finishes the PRD. Writing code without auditing it should be the exception, not the norm.

  • sfk ralph → PRD + scoped audit automatically
  • sfk ralph -na / --no-audit → PRD only, skip audit
  • sfk ralph -fa / --full-audit → PRD + full codebase audit instead of scoped
  • sfk willie → standalone full codebase audit (current behavior)
  • sfk willie -s|--scope diff|branch|prd|commits=N → standalone scoped audit

Implementation Plan

Phase 1: Command Rename

  1. Rename run command → ralph, audit command → willie
  2. Add hidden aliases run → ralph, audit → willie with deprecation warnings
  3. Update all help text, README, docs

Phase 2: File Collection

  1. After Ralph finishes PRD, collect changed files via git diff --name-only (compare before/after Ralph's commits)
  2. Save to .sfk/last-run-files.txt — list of files Ralph touched
  3. For -s diff: git diff --name-only
  4. For -s branch: git diff --name-only main...HEAD

Phase 3: Dependency Expansion

The naive file list misses callers/dependents. When Ralph changes a utility, every caller should be in scope.

Approach: Inject the file list into the audit prompt and let Claude expand scope naturally. The prompt says:

"Audit these files and any code that directly imports or depends on them. If a changed function is called elsewhere, include the caller in your review."

Claude is smart enough to grep for imports/callers. No need for a static analysis tool — keep it simple.

Phase 4: Scoped Audit Prompt

New prompt variant (or injection block) for scoped audits:

SCOPE: This is a scoped audit. Only review the following files and their direct dependents:
<file list>

Do NOT audit files outside this scope unless they directly import/call code in the scoped files.

Phase 5: Wire into sfk ralph (Default Behavior)

  1. Ralph finishes PRD → automatically collect changed files
  2. Run scoped Willie using the file list — no flag needed
  3. -na / --no-audit flag to skip the audit
  4. -fa / --full-audit flag to force full codebase audit instead of scoped
  5. If file list is empty (Ralph made no changes), skip audit with a note

Phase 6: Standalone Scoped Audits

sfk willie                       # full codebase (current, unchanged)
sfk willie -s prd                # last PRD run files
sfk willie -s diff               # uncommitted changes
sfk willie -s branch             # branch diff vs main
sfk willie -s commits=5          # last N commits

-s is the short form for --scope.

All scope modes: collect files → expand dependents via prompt → run normal audit→validate→fix loop.

Use Cases

  1. Every sfk ralph (primary): Ralph builds, Willie reviews what Ralph touched — automatic, no flags
  2. Skip audit: sfk ralph -na — rare, for when you just want code fast
  3. Pre-push review: sfk willie -s diff — quick check before pushing
  4. PR review: sfk willie -s branch — audit branch diff before merging
  5. Full codebase wringing: sfk willie — dedicated deep audit

Priority

High — this is the key workflow for daily development and the audit-as-a-service model.

Activity

  1. dominicnunez commented on Feb 21, 2026

    @dominicnunez
    OwnerAuthor

    Closed as duplicate of #24 - RFC: Springfield Ultra

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions