Skip to content

Commit b9a2337

Browse files
committed
refactor: change verify directory base path from CLAUDE_PROJECT_DIR to WORKTREE_PATH
1 parent fac5e3d commit b9a2337

6 files changed

Lines changed: 58 additions & 11 deletions

File tree

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
{
2-
"status" : "open",
2+
"status" : "closed",
3+
"resolution" : "implemented",
34
"dependencies" : [ ],
4-
"blocks" : [ ]
5-
}
5+
"blocks" : [ ],
6+
"target_branch" : "v2.1"
7+
}

.cat/issues/v2/v2.1/refactor-work-verify-to-cat-verify/plan.md

Lines changed: 49 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,60 @@
22

33
## Goal
44

5-
Move the work verify directory from `.cat/work/verify` to `.cat/verify` inside the worktree. This refactoring improves directory organization by consolidating CAT-managed state under the `.cat/` directory hierarchy and clarifies the semantic separation between implementation work (`.cat/work/`) and verification state (`.cat/verify/`).
5+
Change the VERIFY_DIR base path from `${CLAUDE_PROJECT_DIR}` to `${WORKTREE_PATH}` in all files that reference
6+
`.cat/work/verify`. The directory name `.cat/work/verify` stays the same — only the base path variable changes. This
7+
ensures verify files are written inside the issue worktree rather than the main project directory, maintaining worktree
8+
isolation.
9+
10+
## Research Findings
11+
12+
Codebase analysis identified 5 files that reference the VERIFY_DIR path using `${CLAUDE_PROJECT_DIR}/.cat/work/verify`:
13+
1. `plugin/concepts/work.md` — Concept documentation describing VERIFY_DIR path
14+
2. `plugin/skills/work-merge-agent/first-use.md` — Skill implementation setting VERIFY_DIR
15+
3. `plugin/skills/work-confirm-agent/first-use.md` — Skill implementation setting VERIFY_DIR
16+
4. `plugin/agents/work-verify.md` — Agent documentation setting VERIFY_DIR
17+
5. `plugin/migrations/2.1.sh` — Migration script (directory name unchanged, no base path variable)
18+
19+
All references are string literals in shell/Markdown files. The migration script uses the relative path
20+
`.cat/work/verify` without a base path variable, so it requires no change.
621

722
## Pre-conditions
823

924
(none)
1025

1126
## Post-conditions
1227

13-
- [ ] User-visible behavior unchanged
28+
- [ ] All 4 identified plugin files updated from `${CLAUDE_PROJECT_DIR}/.cat/work/verify` to `${WORKTREE_PATH}/.cat/work/verify`
29+
- [ ] Migration script unchanged (already uses relative path `.cat/work/verify`)
30+
- [ ] No references to `${CLAUDE_PROJECT_DIR}/.cat/work/verify` remain in plugin source files
31+
- [ ] The directory name `.cat/work/verify` is preserved (not renamed)
1432
- [ ] Tests passing
15-
- [ ] Code quality improved
16-
- [ ] E2E verification — verify the new directory structure works as expected
33+
34+
## Execution Steps
35+
36+
1. **Update plugin/concepts/work.md**
37+
- Change: `${CLAUDE_PROJECT_DIR}/.cat/work/verify/${CLAUDE_SESSION_ID}/` to `${WORKTREE_PATH}/.cat/work/verify/${CLAUDE_SESSION_ID}/`
38+
- Rationale: Verify files should be written inside the worktree
39+
40+
2. **Update plugin/skills/work-merge-agent/first-use.md**
41+
- Change: `VERIFY_DIR="${CLAUDE_PROJECT_DIR}/.cat/work/verify/${CLAUDE_SESSION_ID}"` to `VERIFY_DIR="${WORKTREE_PATH}/.cat/work/verify/${CLAUDE_SESSION_ID}"`
42+
- Rationale: Merge-agent reads verify files from the worktree
43+
44+
3. **Update plugin/skills/work-confirm-agent/first-use.md**
45+
- Change: `VERIFY_DIR="${CLAUDE_PROJECT_DIR}/.cat/work/verify/${CLAUDE_SESSION_ID}"` to `VERIFY_DIR="${WORKTREE_PATH}/.cat/work/verify/${CLAUDE_SESSION_ID}"`
46+
- Rationale: Confirm-agent writes verify files inside the worktree
47+
48+
4. **Update plugin/agents/work-verify.md**
49+
- Change: `VERIFY_DIR="${CLAUDE_PROJECT_DIR}/.cat/work/verify/${CLAUDE_SESSION_ID}"` to `VERIFY_DIR="${WORKTREE_PATH}/.cat/work/verify/${CLAUDE_SESSION_ID}"`
50+
- Rationale: Verify agent writes analysis files inside the worktree
51+
52+
5. **Verify migration script unchanged**
53+
- Confirm `plugin/migrations/2.1.sh` still has `new_verify_base=".cat/work/verify"` (relative path, no base variable)
54+
55+
6. **Verify no remaining CLAUDE_PROJECT_DIR references to .cat/work/verify**
56+
- Run: `grep -r "CLAUDE_PROJECT_DIR.*\.cat/work/verify" plugin/`
57+
- Expected: No output
58+
59+
7. **Run tests**
60+
- Command: `mvn -f client/pom.xml test`
61+
- Rationale: Ensures refactoring doesn't break existing functionality

plugin/agents/work-verify.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ You receive a prompt containing:
2626
Write detailed analysis to files in the external session-scoped CAT directory:
2727
```bash
2828
source "${CLAUDE_PLUGIN_ROOT}/scripts/cat-env.sh"
29-
VERIFY_DIR="${CLAUDE_PROJECT_DIR}/.cat/work/verify/${CLAUDE_SESSION_ID}"
29+
VERIFY_DIR="${WORKTREE_PATH}/.cat/work/verify/${CLAUDE_SESSION_ID}"
3030
mkdir -p "${VERIFY_DIR}"
3131
```
3232
- Criterion-level verification details: `${VERIFY_DIR}/criteria-analysis.json`

plugin/concepts/work.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ Main agent tracks lock status but doesn't manage locks directly.
176176

177177
Work phases write output files to two distinct locations based on ownership and lifecycle:
178178

179-
**Verify files**`${CLAUDE_PROJECT_DIR}/.cat/work/verify/${CLAUDE_SESSION_ID}/`
179+
**Verify files**`${WORKTREE_PATH}/.cat/work/verify/${CLAUDE_SESSION_ID}/`
180180
- Owner: verify subagent; Scope: session-scoped
181181
- Ephemeral scratch files (`criteria-analysis.json`, `e2e-test-output.json`) written during confirm phase
182182
- Read by fix subagents to understand what failed; never committed to the issue branch

plugin/skills/work-confirm-agent/first-use.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ Task tool:
130130
3. Create the verify output directory and write detailed analysis files:
131131
```bash
132132
source "${CLAUDE_PLUGIN_ROOT}/scripts/cat-env.sh"
133-
VERIFY_DIR="${CLAUDE_PROJECT_DIR}/.cat/work/verify/${CLAUDE_SESSION_ID}"
133+
VERIFY_DIR="${WORKTREE_PATH}/.cat/work/verify/${CLAUDE_SESSION_ID}"
134134
mkdir -p "${VERIFY_DIR}"
135135
```
136136
- Write criterion-level details to: ${VERIFY_DIR}/criteria-analysis.json

plugin/skills/work-merge-agent/first-use.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ result is not in context, treat as State 1 and run the full merge workflow.
4747
## Step 7: Post-Condition Gate Check (MANDATORY — BLOCKING)
4848

4949
```bash
50-
VERIFY_DIR="${CLAUDE_PROJECT_DIR}/.cat/work/verify/${CLAUDE_SESSION_ID}"
50+
VERIFY_DIR="${WORKTREE_PATH}/.cat/work/verify/${CLAUDE_SESSION_ID}"
5151
CRITERIA_FILE="${VERIFY_DIR}/criteria-analysis.json"
5252
```
5353

0 commit comments

Comments
 (0)