Skip to content

/wbAudit — Exhaustive Simulation () ​

/wbAudit is the critic. Its job is brutal evidence-based review: read code, name what's wrong, and cite the file/line/symbol so the finding is verifiable. It is the only command in the QA group whose output is adversarial by design — it actively looks for problems, and prefers a false-positive over a false-negative.

Read this if you want to know what --profile actually selects against, why --act and --wbPlan produce different downstream artifacts, and where audit ends and refactor begins.


1. Role & target ​

AspectBehavior
RoleThe Critic — adversarial review with citations.
TargetA file, a directory, a glob, or a comma-separated list of paths.
Cell scopeNone. Audit produces a report, not plan mutations. (Mutation happens via --act or --wbPlan chaining into other commands.)
Side effects allowedReading code, reading test results if present, citing line numbers.
Side effects forbiddenEditing source code, running fixes, mutating plan cells directly.

The "evidence-based" rule is what separates /wbAudit from /wbReview. A review (/wbReview) compares a diff against a plan row's intent: did you do what the row asked? An audit compares code against standards: is what's there well-built, regardless of why it was built? Different jobs, different lenses.

/wbAudit always cites — file path + line range + symbol name. A finding without a citation is not a finding; it's an opinion. The agent will refuse to emit unsourced critique even when the code is clearly bad, because unverifiable feedback rots the audit's credibility.


2. Argument resolution matrix ​

FormExampleWhat /wbAudit does
Single fileCommand: /wbAudit core2/packages/wb-core/src/WBC.jsLocks to one file. Deepest possible scrutiny.
DirectoryCommand: /wbAudit core2/packages/wb-core/Walks the directory. Excludes node_modules, dist*, .git.
GlobCommand: /wbAudit "core2/packages/*/src/**/*.js"Matches across packages. Expands quietly; refuses with explicit error if expansion exceeds 200 files.
CSV arrayCommand: /wbAudit src/WBC.js,src/renderString.jsTwo specific files. Findings cross-reference where relevant.
Free-text scopeCommand: /wbAudit "the auth path"Resolves keyword across workspace. Refuses if 3+ unrelated candidates match (no fuzzy guessing on adversarial work).

The 200-file glob ceiling is intentional. An audit's value is per-finding density; spreading across 2000 files dilutes attention and produces a list of generic warnings. If the user genuinely wants that breadth, they should run multiple narrower audits and let the findings stack. The ceiling protects the quality of the output, not the runtime.


3. Flag matrix ​

/wbAudit has five flags. Two of them (--act, --wbPlan) are chaining flags that pipe the audit output into a downstream command — they're how an audit becomes actionable.

FlagShortcutModeWhat it does
--profile="<name>"-pFilterRestricts findings to one lens: security, performance, accessibility, correctness, style. Default: all five at low density.
--scope="<level>"-sFilterLimits the audit to one architectural tier (single-package vs cross-package vs whole-repo).
--security-SFilterConvenience alias for -p="security". Capitalized to avoid colliding with -s (scope).
--act-aChainRoutes audit output through /wbActOn — produces a sibling action file ranking findings by impact/effort.
--wbPlan-PChainRoutes audit output through /wbActOn's plan-generation engine — appends new rows to the active plan, one per critical finding.

--act and --wbPlan are composable. /wbAudit ... --act --wbPlan produces the audit report and the action file and new plan rows — three artifacts in one chain. They're independent flags; combining them isn't a special mode, it's just two pipes.

How --profile shapes the output ​

Each profile has a fixed checklist of finding types. The agent doesn't invent categories per audit — the profile is a contract with the reader about what was looked for.

ProfileLooks for
securityXSS surfaces, eval/Function constructor use, unsafe deserialize, secrets in source, token storage in localStorage, SSRF-prone URL composition.
performanceO(n²) in hot paths, unbounded recursion, sync I/O on event loop, unmemoized expensive computes, memory leaks via uncleared timers.
accessibilityMissing alt text, unlabeled controls, color-only signals, keyboard trap, semantic-tag misuse.
correctnessOff-by-one, null-deref, type assertions without checks, dropped promise rejections, uncaught async errors.
styleNaming, dead code, duplicate logic, missing type annotations (only when the file is otherwise typed).

If a finding doesn't fit any profile, it's reported under correctness with a note that it's a soft category. This keeps the contract honest.


4. Pipelines (the agent-native scenarios) ​

📋/wbAudit Exhaustive Simulation
The wbc-ui2-cdn package config audit/wbAudit core2/packages/wbc-ui2-cdn/ --profile="correctness"
> /wbAudit core2/packages/wbc-ui2-cdn/ --profile="correctness"
[SYSTEM] Target: core2/packages/wbc-ui2-cdn/
[PROFILE] correctness — looking for off-by-ones, null-derefs, dropped
promises, build-config drift.
[SCAN] 14 files inspected.
## Finding 1 — main field points at non-existent dist/
**Severity:** P1
**File:** core2/packages/wbc-ui2-cdn/package.json:6
**Symbol:** "main"
**Citation:**
"main": "./dist/index.js"
**Evidence:**
- vite.config.js:18 sets build.outDir = "dist-dev"
- ls dist/ → no such directory
- ls dist-dev/index.js → exists
**Why it matters:** Consumers resolving `main` get module-not-found.
**Why it's still here:** Memory note `project_pkg_dist_mismatch.md`
records this as parked tech debt — fixing it without choosing
"dev convention leaks to consumers" or "vite reconfig" is unsolved.
**Recommendation:** Not a one-line fix; do not patch. Document or fix
both ends in a coordinated change.
## Finding 2 — ...
⚠️ Note: A real situation: the `core2/` packages have a parked `dist-folder mismatch` (per `project_pkg_dist_mismatch.md`). The audit doesn't *fix* it — but it can confirm the symptom is still present and surface it as a citation.

💠 Pipeline The wbc-ui2-cdn package config audit ​

A real situation: the core2/ packages have a parked dist-folder mismatch (per project_pkg_dist_mismatch.md). The audit doesn't fix it — but it can confirm the symptom is still present and surface it as a citation.

💠 Pipeline The chained "audit → plan rows" workflow ​

The use case for --wbPlan: an audit surfaces real work, and the user wants those findings to become plan rows that /wbWork can pick up. Run live:

💠 Pipeline Surgical security check before a release ​

A real pattern at release time: scan only the security-relevant files in a single package, fail loudly if anything P0 surfaces, otherwise stay quiet. --act (no --wbPlan) gives you the ranked action file without polluting the plan:


5. Edge cases & refusals ​

TriggerWhat /wbAudit does
No target at allHalt. ❌ Provide a path, glob, CSV, or scope keyword.
Glob expanding to >200 filesHalt. ❌ Glob too broad. Run multiple narrower audits and let findings stack.
--profile="magic" (unrecognized)Halt. ❌ Unknown profile. Choose: security | performance | accessibility | correctness | style. (No silent fallback to "general" — the contract with the reader matters.)
--act --wbPlan togetherBoth fire. Audit + action file + plan rows produced.
Free-text target matches 3+ unrelated areasHalt with disambiguation. /wbAudit is adversarial; fuzzy guessing on adversarial work amplifies bias.
Target file genuinely has zero findings[OK] No findings at the requested profile depth. Quiet exit, no false-positive padding.
Audit triggers on auto-generated files (.d.ts, vendored deps)Skip with one-line notice. Auto-gen findings are noise; the audit is for hand-written code.
--security and --profile="performance" both passedHalt. Conflicting profiles. The user must pick one.

The unifying rule: /wbAudit is opinionated and citable. It refuses to invent findings without sources, refuses to dilute attention across thousands of files, refuses to silently fall back when the user asks for something unrecognized. The output is a contract — every finding can be checked against the cited line.