VCP Root Cause Check
Analyze a proposed bug fix to determine whether it addresses the root cause or patches a symptom.
Step 1: Resolve Config
- Read
.vcp/config.json from the project root. Extract the pluginRoot field.
- If
.vcp/config.json does not exist or pluginRoot is missing: Stop and tell the user: "No VCP configuration found. Run /vcp-init to configure VCP for this project."
- Validate
pluginRoot: The path must be absolute, contain /.claude/ (or \.claude\ on Windows) as a path segment, and contain only safe path characters (letters, digits, /, \, -, _, ., :, and spaces). Reject any path with shell metacharacters (;, &, |, $, `, (, ), {, }, <, >, !, ~, #, *, ?, [, ], ', "). If validation fails, stop and tell the user: "Invalid pluginRoot — must be within ~/.claude/ and contain no shell metacharacters. Run /vcp-init to fix." Also verify the file <pluginRoot>/lib/vcp-context-core.ts exists using Glob. If it does not exist, stop and tell the user: "pluginRoot points to an invalid VCP installation. Run /vcp-init to fix."
- Run the config resolution script via Bash:
bun "<pluginRoot>/lib/resolve-config.ts" "<project-root>"
- Parse the JSON output. It contains:
applicableStandards, ignoredRules, severity, exclude.
Step 2: Fetch Applicable Standards
From the applicableStandards array in the resolved config, keep only the entry where:
id is core-root-cause-analysis
Use WebFetch to fetch its content from:
{entry.url}
Extract the Rules section and the Patterns section from the fetched standard.
Step 4: Gather Bug Context
From $ARGUMENTS: If provided, interpret as either a bug description or a file path.
- If a file path: Read the file and look for recent changes (use
git diff or git log -1 -p on the file) to identify the proposed fix.
- If a bug description: Use it as context to locate the relevant code.
- If no arguments: Look at the current conversation for bug context. If none found, ask the user to describe the bug and point to the proposed fix.
Gather:
- Bug description — What symptom was observed?
- Proposed fix — What code was changed or is about to be changed? Use
git diff (staged and unstaged), or read the files specified by the user.
- Surrounding context — Read the files involved in the fix. Use Grep to trace how data flows through the affected code paths.
Step 5: Trace Data Flow
Apply the root cause analysis standard's decision framework:
- Where does the symptom appear? Identify the error, crash, or wrong output.
- Where does the incorrect data originate? Trace the data flow backwards from the symptom — follow variables, function calls, and data transformations upstream.
- Are these the same location? If the symptom location and origin are the same, a local fix is correct. If they differ, the fix should be at the origin.
- Does this data flow through other paths? If yes, a fix only at the symptom site leaves other paths broken.
- Would this fix survive a refactor? If the fix depends on execution order, specific call sites, or implementation details of other modules, it's a patch — not a root cause fix.
Step 6: Produce Verdict
Output the analysis in this format:
### VCP Root Cause Check
**Bug:** [Brief description of the symptom]
**Proposed fix:** [Summary of what the fix changes]
#### Data Flow Trace
1. **Symptom:** [Where the error appears] — `file:line`
2. **Intermediate:** [Data transformation steps] — `file:line`
3. **Origin:** [Where correct data first becomes incorrect] — `file:line`
#### Decision Framework
- **Symptom location:** `file:line`
- **Origin location:** `file:line`
- **Same location?** Yes/No
- **Other data paths affected?** Yes/No — [list if yes]
- **Survives refactor?** Yes/No — [why]
---
**Verdict: ROOT-CAUSE FIX** — The fix addresses the origin of the defect.
Or:
**Verdict: SYMPTOM-PATCH** — The fix patches where the bug manifests, not where it originates.
**Recommended fix location:** `file:line` — [explanation of what should be fixed there instead]
If the analysis is inconclusive (e.g., insufficient context to trace the full data flow), say so and explain what additional information would be needed.
1---2name: vcp-root-cause-check3description: Analyze a proposed bug fix against VCP root cause analysis standards. Determines whether a fix addresses the root cause or just patches a symptom.4---5
6# VCP Root Cause Check
7
8Analyze a proposed bug fix to determine whether it addresses the root cause or patches a symptom.
9
10## Step 1: Resolve Config
11
121. Read `.vcp/config.json` from the project root. Extract the `pluginRoot` field.
132. **If `.vcp/config.json` does not exist or `pluginRoot` is missing:** Stop and tell the user: "No VCP configuration found. Run `/vcp-init` to configure VCP for this project."
143. **Validate `pluginRoot`:** The path must be absolute, contain `/.claude/` (or `\.claude\` on Windows) as a path segment, and contain only safe path characters (letters, digits, `/`, `\`, `-`, `_`, `.`, `:`, and spaces). Reject any path with shell metacharacters (`;`, `&`, `|`, `$`, `` ` ``, `(`, `)`, `{`, `}`, `<`, `>`, `!`, `~`, `#`, `*`, `?`, `[`, `]`, `'`, `"`). If validation fails, stop and tell the user: "Invalid pluginRoot — must be within ~/.claude/ and contain no shell metacharacters. Run `/vcp-init` to fix." Also verify the file `<pluginRoot>/lib/vcp-context-core.ts` exists using Glob. If it does not exist, stop and tell the user: "pluginRoot points to an invalid VCP installation. Run `/vcp-init` to fix."
154. Run the config resolution script via Bash:
16 ```bash
17 bun "<pluginRoot>/lib/resolve-config.ts" "<project-root>"
18 ```
195. Parse the JSON output. It contains: `applicableStandards`, `ignoredRules`, `severity`, `exclude`.
20
21## Step 2: Fetch Applicable Standards
22
23From the `applicableStandards` array in the resolved config, keep only the entry where:
24- `id` is `core-root-cause-analysis`
25
26Use WebFetch to fetch its content from:
27```
28{entry.url}
29```
30
31Extract the **Rules** section and the **Patterns** section from the fetched standard.
32
33## Step 4: Gather Bug Context
34
35**From `$ARGUMENTS`:** If provided, interpret as either a bug description or a file path.
36
37- **If a file path:** Read the file and look for recent changes (use `git diff` or `git log -1 -p` on the file) to identify the proposed fix.
38- **If a bug description:** Use it as context to locate the relevant code.
39- **If no arguments:** Look at the current conversation for bug context. If none found, ask the user to describe the bug and point to the proposed fix.
40
41Gather:
421. **Bug description** — What symptom was observed?
432. **Proposed fix** — What code was changed or is about to be changed? Use `git diff` (staged and unstaged), or read the files specified by the user.
443. **Surrounding context** — Read the files involved in the fix. Use Grep to trace how data flows through the affected code paths.
45
46## Step 5: Trace Data Flow
47
48Apply the root cause analysis standard's decision framework:
49
501. **Where does the symptom appear?** Identify the error, crash, or wrong output.
512. **Where does the incorrect data originate?** Trace the data flow backwards from the symptom — follow variables, function calls, and data transformations upstream.
523. **Are these the same location?** If the symptom location and origin are the same, a local fix is correct. If they differ, the fix should be at the origin.
534. **Does this data flow through other paths?** If yes, a fix only at the symptom site leaves other paths broken.
545. **Would this fix survive a refactor?** If the fix depends on execution order, specific call sites, or implementation details of other modules, it's a patch — not a root cause fix.
55
56## Step 6: Produce Verdict
57
58Output the analysis in this format:
59
60```
61### VCP Root Cause Check
62
63**Bug:** [Brief description of the symptom]
64**Proposed fix:** [Summary of what the fix changes]
65
66#### Data Flow Trace
67
681. **Symptom:** [Where the error appears] — `file:line`
692. **Intermediate:** [Data transformation steps] — `file:line`
703. **Origin:** [Where correct data first becomes incorrect] — `file:line`
71
72#### Decision Framework
73
74- **Symptom location:** `file:line`
75- **Origin location:** `file:line`
76- **Same location?** Yes/No
77- **Other data paths affected?** Yes/No — [list if yes]
78- **Survives refactor?** Yes/No — [why]
79
80---
81
82**Verdict: ROOT-CAUSE FIX** — The fix addresses the origin of the defect.
83```
84
85Or:
86
87```
88**Verdict: SYMPTOM-PATCH** — The fix patches where the bug manifests, not where it originates.
89
90**Recommended fix location:** `file:line` — [explanation of what should be fixed there instead]
91```
92
93If the analysis is inconclusive (e.g., insufficient context to trace the full data flow), say so and explain what additional information would be needed.