Every document filename now mirrors its lifecycle state with a status suffix (e.g., .draft.md, .wip.md, .accepted.md). No more bare .md for tracked document types. Also renamed all from_str methods to parse to avoid FromStr trait confusion, introduced StagingDeploymentParams struct, and fixed all 19 clippy warnings across the codebase. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
3.4 KiB
Spike: Worktree Naming Mismatch Investigation
Date: 2025-01-24 Time-box: 30 minutes Status: Complete
Problem
User reported seeing:
Done. Implementation complete in worktree ../fungal-image-analysis-rfc0069
(branch rfc0069-job-status-namespace)
The worktree/branch weren't created with the right names.
Investigation
Blue's Actual Worktree Naming Patterns
Single-repo worktrees (crates/blue-mcp/src/handlers/worktree.rs):
- Path:
~/.blue/worktrees/<stripped-name>(e.g.,~/.blue/worktrees/job-status-namespace) - Branch:
<stripped-name>(RFC number prefix stripped per RFC 0007) - Example: RFC
0069-job-status-namespace→ branchjob-status-namespace
Realm multi-repo worktrees (crates/blue-mcp/src/handlers/realm.rs):
- Path:
~/.blue/worktrees/<realm>/<rfc>/<repo> - Branch:
rfc/<rfc>(prefixed withrfc/) - Example: RFC
0069-job-status-namespace→ branchrfc/0069-job-status-namespace
What the User Saw
- Path:
../fungal-image-analysis-rfc0069 - Branch:
rfc0069-job-status-namespace
Key Finding: Not From Blue
The observed output doesn't match either Blue pattern:
| Aspect | Blue Single-Repo | Blue Realm | User Saw |
|---|---|---|---|
| Path style | Absolute (~/.blue/...) |
Absolute (~/.blue/...) |
Relative (../) |
| Path components | worktrees/<name> |
worktrees/<realm>/<rfc>/<repo> |
<repo>-<rfc> |
| Branch format | <stripped-name> |
rfc/<rfc> |
rfc<number>-<name> (no slash) |
There's no code in Blue that:
- Produces relative paths like
../ - Uses the squashed
rfc0069format (no leading zeros, no separator) - Combines repo name with RFC number in a single path segment
Root Cause
The message "Implementation complete in worktree" is not from Blue - it's from the LLM agent (Claude) that was implementing the feature.
The LLM agent likely:
- Constructed its own worktree path instead of using
blue_worktree_createorblue_realm_worktree_create - Used
git worktree adddirectly via Bash, inventing its own naming convention - Hallucinated the path/branch names in its completion message
Evidence
- Searched Blue codebase for
../pattern - not found - Searched for
rfc\d+squashed format - not found (onlyrfc3339date formats) - Blue's worktree success messages don't include "Implementation complete"
- Blue always uses absolute paths via
state.home.worktrees_pathorDaemonPaths
Additional Issues Found
While investigating, identified these potential problems in Blue's worktree code:
- Inconsistent naming between single/realm: Single-repo strips RFC number, realm preserves it with
rfc/prefix - Store failures silently ignored:
let _ = state.store.add_worktree()at worktree.rs:87 - Realm worktrees not persisted:
realm.rs:551-691never callsadd_worktree()
Recommendations
- Guide LLM agents: Add clear instructions in
blue_guideabout always using Blue's worktree tools, never raw git worktree commands - Validate in status:
blue_statuscould check for orphan worktrees (git worktrees not in Blue's store) - Consider RFC for guidance: Write an RFC for "LLM Agent Worktree Best Practices" if this recurs
Outcome
The worktree naming wasn't wrong in Blue - the LLM agent bypassed Blue's tools entirely and invented its own naming. The fix is behavioral (prompt engineering/guidance) rather than code.