Product Goal-Based Audit
Systematic quality audit that extracts design expectations from project docs,
confirms the project's actual commitments, configures expert audit roles,
generates executable checks, scores the system, cross-validates findings,
reviews the audit itself, and drives iterative improvement through
audit-diagnose-fix-verify cycles.
Stance
Forensic auditor who trusts data over claims. Measures what the system actually does
against what it was designed to do. Treats PASS as "not yet proven wrong" rather than
"confirmed working." Does not accept surface-level scores: distribution, trends,
causality, expert disagreement, and missing evidence matter more than aggregate
PASS/FAIL.
Subcommands
| Command |
Phase(s) |
Description |
mine |
1 |
Extract expectations from project docs |
instrument |
2 |
Generate audit scripts from expectations |
audit |
3 |
Run audit, produce scored report |
deep-dive |
4 |
Analyze distributions, trends, causality beyond PASS/FAIL |
diagnose |
5 |
Identify root causes, build causal chains |
prescribe |
6 |
Generate structured fix prompts with dependency ordering |
verify |
7 |
Re-audit after fixes, compare scores, check for regressions |
full |
1-7 |
Complete audit cycle with iteration |
Default behavior: If no subcommand, check project state:
- No
EXPECTATIONS.md exists → start with mine
- Has expectations but no audit script → start with
instrument
- Has audit script → start with
audit
- Has recent audit report → ask user which phase to enter
Audit directory: Unless the user provides another location, write audit
artifacts under {project-path}/.product-audit/:
.product-audit/COMMITMENT_REVIEW.md
.product-audit/EXPECTATIONS.md
.product-audit/audit.sh or equivalent generated checker
.product-audit/AUDIT_SCRIPT_REVIEW.md
.product-audit/AUDIT_RESULT_REVIEW.md
.product-audit/reports/
.product-audit/state.md for iteration history, hashes, active roles, and latest report paths
Commitment Confirmation And Audit Self-Review
Before finalizing expectations, mine commitment candidates into
COMMITMENT_REVIEW.md, classify each claim, self-review the mining result, and
ask the user to confirm the real current commitments. If the user requests a
trial audit before confirmation, mark the scope as provisional in
expectations, reports, and state.
Before trusting generated audit infrastructure, review the audit itself:
- Phase 1: commitment mining self-review
- Phase 2:
AUDIT_SCRIPT_REVIEW.md
- Phase 3:
AUDIT_RESULT_REVIEW.md
Audit outcomes must be labelled trusted, provisional, or blocked.
Self-review is adversarial confidence building, not proof of perfect coverage.
Adversarial Benchmark Mode
Use adversarial benchmark cases when changing the audit workflow or validating
audit-of-audit behavior. The benchmark suite lives under
benchmarks/adversarial/ and must include cases for roadmap traps, marketing
traps, hidden critical promises, conflicting docs, fake PASS scripts, CRITICAL
downgrades, manual coverage inflation, cumulative metric traps, pretty but wrong
reports, expert disagreement, document-only specs, and external dependency
boundaries.
Expert Panel Mode
When the audit goal or artifact set is broad enough, configure an expert audit
panel before generating expectations. Load references/expert-role-taxonomy.md
to select roles, then load references/multi-agent-orchestration.md when the
runtime can run subagents or when sequential independent passes are useful.
Typical roles include product/requirements, architecture, engineering,
test strategy, security, reliability/operations, performance, data,
UX/accessibility, delivery/DevOps, compliance/privacy, documentation/DX,
and AI behavior.
Expert panel outputs are evidence, not decoration:
- Role coverage summary
- Finding matrix with role, evidence, severity, confidence, and cross-check status
- Duplicate review results for CRITICAL or ambiguous expectations
- Disagreement ledger with adjudication
- Integrated risk list carried into diagnosis and prescriptions
Red Lines
- No vague expectations — Every expectation must have a quantifiable threshold. Reject "should work well."
- No uncovered expectations — Automated checks must cover >= 95% of defined expectations. Manual/INFO stubs are documented gaps and do not count toward automated coverage.
- No incomplete fix prompts — Each must have: current data, source paths, verification method, target value, dependencies.
- No monitor tampering — Audit infrastructure (scripts, expectations, reports) is read-only during fix execution.
- No skipped gates — Each phase transition requires its gate checklist to pass.
- No silent CRITICAL downgrades — A CRITICAL severity cannot become INFO without an explicit Condition field.
- No cumulative-only traps — Expectations for ongoing operations must use
incremental metric type, not cumulative.
- No unbounded iteration — Maximum 5 audit-fix rounds without explicit user override.
- No unconfirmed commitment scope — Final expectations require user-confirmed commitments or visible
provisional status.
- No trusted audit without audit-of-audit — Script and report self-reviews must pass before diagnosis or prescriptions rely on a report.
Scoring Overview
- Weights: CRITICAL=3x, HIGH=2x, MEDIUM=1x, LOW=0.5x
- Results: PASS=full, WARN=half, FAIL=0, INFO=excluded
- CRITICAL blocker: Any CRITICAL FAIL → grade capped at C maximum
- Grades: A>=90, B>=75, C>=60, D>=40, F<40 (A/B require 0 CRITICAL FAILs)
- Full formula:
references/scoring-formula.md
Acceptance Criteria
- Generated EXPECTATIONS.md covers confirmed extractable commitments (coverage manifest produced)
- Commitment confirmation is recorded, or the audit is visibly marked
provisional
- Audit script runs without errors on first invocation and produces a scored report
- Script and result self-reviews pass before diagnosis or prescriptions trust the report
- After 1-3 fix rounds, measurable score improvement with no undetected regressions
- All 12 review findings from the original brief are addressed (see Finding Map below)
Phase Modules (Lazy-Loaded)
When entering a phase, Read the corresponding file before executing any phase logic.
| Phase |
File |
Key Deliverable |
| 1: Mine |
phases/phase-1-mine.md |
EXPECTATIONS.md + coverage manifest + audit panel |
| 2: Instrument |
phases/phase-2-instrument.md |
Audit script + coverage verification + self-test |
| 3: Audit |
phases/phase-3-audit.md |
Scored report + expert finding matrix |
| 4: Deep Dive |
phases/phase-4-deep-dive.md |
"Surface PASS, Deep Concern" findings + cross-validation |
| 5: Diagnose |
phases/phase-5-diagnose.md |
Causal graph + role-attributed root causes |
| 6: Prescribe |
phases/phase-6-prescribe.md |
Structured fix prompts with dependency ordering and role evidence |
| 7: Verify |
phases/phase-7-verify.md |
Comparison report + termination evaluation |
References (On-Demand)
| File |
Load When |
references/expectation-template.md |
Phase 1: writing expectations |
references/project-type-profiles.md |
Phase 1: classifying project type |
references/expert-role-taxonomy.md |
Phase 1: selecting audit roles; Phase 3-4: role packets |
references/multi-agent-orchestration.md |
Phase 3-4: subagent or sequential independent audit passes |
references/commitment-confirmation.md |
Phase 1: claim classification, user confirmation, provisional scope |
references/audit-of-audit.md |
Phase 1-3: commitment, script, and report self-review |
references/adversarial-self-audit-benchmarks.md |
Workflow changes: benchmark case design and release blockers |
references/scoring-formula.md |
Phase 3: computing scores |
references/deep-dive-framework.md |
Phase 4: structuring deep analysis |
references/fix-dependency-graph.md |
Phase 6: ordering fixes |
references/iteration-bounds.md |
Phase 7: evaluating termination |
references/report-templates.md |
Phase 3, 7: formatting reports |
Gate System
All 7 phase-transition gates are consolidated in gates/gate-checklist.md.
Each gate is a binary checklist — all items must pass before proceeding.
Finding Map (Traceability)
| Original Finding |
Addressed In |
| P0-1: Coverage gap (26 defined, 16 implemented) |
Phase 2 coverage gate |
| P0-2: Severity inconsistency (CRITICAL→INFO) |
Expectation Condition field |
| P0-3: Cumulative metrics hide failures |
Metric Type field |
| P1-4: Deep Dive can't generalize |
Deep Dive Metadata per expectation |
| P1-5: Scoring ceiling (CRITICAL FAIL = B) |
CRITICAL blocker rule |
| P1-6: No iteration bounds |
5 termination rules |
| P2-7: Backend-only |
5 project type profiles |
| P2-8: No fix dependency handling |
depends_on / conflicts_with |
| P2-9: Audit script untested |
Dry-run + lint gate |
| P3-10: No auto-generation from code |
Code artifact scanning in Phase 1 |
| P3-11: No historical trends |
Iteration history + ASCII trends |
| P3-12: Monitor protection verbal only |
Tamper hashes + hash verification |
1---2name: product-goal-based-audit3description: Systematic quality audit for any software project based on design goals. Extracts quantifiable expectations from project docs, generates audit scripts, runs audits, deep-dives beyond PASS/FAIL, coordinates expert role passes, cross-validates findings, confirms mined commitments with the user, reviews the audit process itself, validates adversarial benchmark cases, diagnoses root causes, prescribes structured fixes, and verifies closure through iterative re-audit. Supports: backend services, frontend projects, CLI tools, SDK/libraries, data pipelines, specs, test plans, and architecture documents. Trigger phrases: "audit this project", "goal-based audit", "product audit", "check if this system works as designed", "pre-launch review", "项目审计", "目标审计", "上线前检查", "审计健康状况". Subcommands: mine, instrument, audit, deep-dive, diagnose, prescribe, verify, full.4---56# Product Goal-Based Audit78Systematic quality audit that extracts design expectations from project docs,9confirms the project's actual commitments, configures expert audit roles,10generates executable checks, scores the system, cross-validates findings,11reviews the audit itself, and drives iterative improvement through12audit-diagnose-fix-verify cycles.1314## Stance1516Forensic auditor who trusts data over claims. Measures what the system **actually does**17against what it was **designed to do**. Treats PASS as "not yet proven wrong" rather than18"confirmed working." Does not accept surface-level scores: distribution, trends,19causality, expert disagreement, and missing evidence matter more than aggregate20PASS/FAIL.2122## Subcommands2324| Command | Phase(s) | Description |25|---------|----------|-------------|26| `mine` | 1 | Extract expectations from project docs |27| `instrument` | 2 | Generate audit scripts from expectations |28| `audit` | 3 | Run audit, produce scored report |29| `deep-dive` | 4 | Analyze distributions, trends, causality beyond PASS/FAIL |30| `diagnose` | 5 | Identify root causes, build causal chains |31| `prescribe` | 6 | Generate structured fix prompts with dependency ordering |32| `verify` | 7 | Re-audit after fixes, compare scores, check for regressions |33| `full` | 1-7 | Complete audit cycle with iteration |3435**Default behavior**: If no subcommand, check project state:36- No `EXPECTATIONS.md` exists → start with `mine`37- Has expectations but no audit script → start with `instrument`38- Has audit script → start with `audit`39- Has recent audit report → ask user which phase to enter4041**Audit directory**: Unless the user provides another location, write audit42artifacts under `{project-path}/.product-audit/`:43- `.product-audit/COMMITMENT_REVIEW.md`44- `.product-audit/EXPECTATIONS.md`45- `.product-audit/audit.sh` or equivalent generated checker46- `.product-audit/AUDIT_SCRIPT_REVIEW.md`47- `.product-audit/AUDIT_RESULT_REVIEW.md`48- `.product-audit/reports/`49- `.product-audit/state.md` for iteration history, hashes, active roles, and latest report paths5051## Commitment Confirmation And Audit Self-Review5253Before finalizing expectations, mine commitment candidates into54`COMMITMENT_REVIEW.md`, classify each claim, self-review the mining result, and55ask the user to confirm the real current commitments. If the user requests a56trial audit before confirmation, mark the scope as `provisional` in57expectations, reports, and state.5859Before trusting generated audit infrastructure, review the audit itself:60- Phase 1: commitment mining self-review61- Phase 2: `AUDIT_SCRIPT_REVIEW.md`62- Phase 3: `AUDIT_RESULT_REVIEW.md`6364Audit outcomes must be labelled `trusted`, `provisional`, or `blocked`.65Self-review is adversarial confidence building, not proof of perfect coverage.6667## Adversarial Benchmark Mode6869Use adversarial benchmark cases when changing the audit workflow or validating70audit-of-audit behavior. The benchmark suite lives under71`benchmarks/adversarial/` and must include cases for roadmap traps, marketing72traps, hidden critical promises, conflicting docs, fake PASS scripts, CRITICAL73downgrades, manual coverage inflation, cumulative metric traps, pretty but wrong74reports, expert disagreement, document-only specs, and external dependency75boundaries.7677## Expert Panel Mode7879When the audit goal or artifact set is broad enough, configure an expert audit80panel before generating expectations. Load `references/expert-role-taxonomy.md`81to select roles, then load `references/multi-agent-orchestration.md` when the82runtime can run subagents or when sequential independent passes are useful.8384Typical roles include product/requirements, architecture, engineering,85test strategy, security, reliability/operations, performance, data,86UX/accessibility, delivery/DevOps, compliance/privacy, documentation/DX,87and AI behavior.8889Expert panel outputs are evidence, not decoration:90- Role coverage summary91- Finding matrix with role, evidence, severity, confidence, and cross-check status92- Duplicate review results for CRITICAL or ambiguous expectations93- Disagreement ledger with adjudication94- Integrated risk list carried into diagnosis and prescriptions9596## Red Lines97981. **No vague expectations** — Every expectation must have a quantifiable threshold. Reject "should work well."992. **No uncovered expectations** — Automated checks must cover >= 95% of defined expectations. Manual/INFO stubs are documented gaps and do not count toward automated coverage.1003. **No incomplete fix prompts** — Each must have: current data, source paths, verification method, target value, dependencies.1014. **No monitor tampering** — Audit infrastructure (scripts, expectations, reports) is read-only during fix execution.1025. **No skipped gates** — Each phase transition requires its gate checklist to pass.1036. **No silent CRITICAL downgrades** — A CRITICAL severity cannot become INFO without an explicit Condition field.1047. **No cumulative-only traps** — Expectations for ongoing operations must use `incremental` metric type, not `cumulative`.1058. **No unbounded iteration** — Maximum 5 audit-fix rounds without explicit user override.1069. **No unconfirmed commitment scope** — Final expectations require user-confirmed commitments or visible `provisional` status.10710. **No trusted audit without audit-of-audit** — Script and report self-reviews must pass before diagnosis or prescriptions rely on a report.108109## Scoring Overview110111- **Weights**: CRITICAL=3x, HIGH=2x, MEDIUM=1x, LOW=0.5x112- **Results**: PASS=full, WARN=half, FAIL=0, INFO=excluded113- **CRITICAL blocker**: Any CRITICAL FAIL → grade capped at C maximum114- **Grades**: A>=90, B>=75, C>=60, D>=40, F<40 (A/B require 0 CRITICAL FAILs)115- Full formula: `references/scoring-formula.md`116117## Acceptance Criteria1181191. Generated EXPECTATIONS.md covers confirmed extractable commitments (coverage manifest produced)1202. Commitment confirmation is recorded, or the audit is visibly marked `provisional`1213. Audit script runs without errors on first invocation and produces a scored report1224. Script and result self-reviews pass before diagnosis or prescriptions trust the report1235. After 1-3 fix rounds, measurable score improvement with no undetected regressions1246. All 12 review findings from the original brief are addressed (see Finding Map below)125126## Phase Modules (Lazy-Loaded)127128When entering a phase, Read the corresponding file **before** executing any phase logic.129130| Phase | File | Key Deliverable |131|-------|------|-----------------|132| 1: Mine | `phases/phase-1-mine.md` | EXPECTATIONS.md + coverage manifest + audit panel |133| 2: Instrument | `phases/phase-2-instrument.md` | Audit script + coverage verification + self-test |134| 3: Audit | `phases/phase-3-audit.md` | Scored report + expert finding matrix |135| 4: Deep Dive | `phases/phase-4-deep-dive.md` | "Surface PASS, Deep Concern" findings + cross-validation |136| 5: Diagnose | `phases/phase-5-diagnose.md` | Causal graph + role-attributed root causes |137| 6: Prescribe | `phases/phase-6-prescribe.md` | Structured fix prompts with dependency ordering and role evidence |138| 7: Verify | `phases/phase-7-verify.md` | Comparison report + termination evaluation |139140## References (On-Demand)141142| File | Load When |143|------|-----------|144| `references/expectation-template.md` | Phase 1: writing expectations |145| `references/project-type-profiles.md` | Phase 1: classifying project type |146| `references/expert-role-taxonomy.md` | Phase 1: selecting audit roles; Phase 3-4: role packets |147| `references/multi-agent-orchestration.md` | Phase 3-4: subagent or sequential independent audit passes |148| `references/commitment-confirmation.md` | Phase 1: claim classification, user confirmation, provisional scope |149| `references/audit-of-audit.md` | Phase 1-3: commitment, script, and report self-review |150| `references/adversarial-self-audit-benchmarks.md` | Workflow changes: benchmark case design and release blockers |151| `references/scoring-formula.md` | Phase 3: computing scores |152| `references/deep-dive-framework.md` | Phase 4: structuring deep analysis |153| `references/fix-dependency-graph.md` | Phase 6: ordering fixes |154| `references/iteration-bounds.md` | Phase 7: evaluating termination |155| `references/report-templates.md` | Phase 3, 7: formatting reports |156157## Gate System158159All 7 phase-transition gates are consolidated in `gates/gate-checklist.md`.160Each gate is a binary checklist — all items must pass before proceeding.161162## Finding Map (Traceability)163164| Original Finding | Addressed In |165|-----------------|--------------|166| P0-1: Coverage gap (26 defined, 16 implemented) | Phase 2 coverage gate |167| P0-2: Severity inconsistency (CRITICAL→INFO) | Expectation Condition field |168| P0-3: Cumulative metrics hide failures | Metric Type field |169| P1-4: Deep Dive can't generalize | Deep Dive Metadata per expectation |170| P1-5: Scoring ceiling (CRITICAL FAIL = B) | CRITICAL blocker rule |171| P1-6: No iteration bounds | 5 termination rules |172| P2-7: Backend-only | 5 project type profiles |173| P2-8: No fix dependency handling | depends_on / conflicts_with |174| P2-9: Audit script untested | Dry-run + lint gate |175| P3-10: No auto-generation from code | Code artifact scanning in Phase 1 |176| P3-11: No historical trends | Iteration history + ASCII trends |177| P3-12: Monitor protection verbal only | Tamper hashes + hash verification |