claudebox/.planning/phases/05-per-project-instance-isolation/05-DISCUSSION-LOG.md

52 lines
2.7 KiB
Markdown

# Phase 5: Per-Project Instance Isolation - Discussion Log (Assumptions Mode)
> **Audit trail only.** Do not use as input to planning, research, or execution agents.
> Decisions captured in CONTEXT.md — this log preserves the analysis.
**Date:** 2026-04-10
**Phase:** 05-per-project-instance-isolation
**Mode:** assumptions
**Areas analyzed:** Instance Isolation Mechanism, Project Root Identification, Shared vs Per-Instance Files, GC Mechanism
## Assumptions Presented
### Instance Isolation Mechanism
| Assumption | Confidence | Evidence |
|------------|-----------|----------|
| Use `CLAUDE_CONFIG_DIR` env var to redirect Claude state to per-project instance dir | Likely | Research confirmed env var exists in official Claude Code docs; current `~/.claudebox` mount stays intact |
Alternatives presented:
- A (Env var `CLAUDE_CONFIG_DIR`): simpler, no mount changes, caveat `~/.claude.json` not redirectable
- B (Mount swap): replace `--bind "$HOME/.claudebox"` with per-instance path, more invasive
### Project Root Identification
| Assumption | Confidence | Evidence |
|------------|-----------|----------|
| `git rev-parse --git-common-dir` as canonical root for worktree sharing | Likely | `--git-common-dir` returns shared `.git` for all worktrees; `--show-toplevel` would diverge per worktree |
Alternatives presented:
- A (`--git-common-dir`): worktrees share instance — satisfies criterion 2
- B (`--show-toplevel`): simpler but violates criterion 2
### Shared vs Per-Instance Files
| Assumption | Confidence | Evidence |
|------------|-----------|----------|
| Credentials stay shared across all instances, not per-instance | Confident | Phase 4 AUTH-01 locked; OAuth refresh requires single writable path; `~/.claude.json` not redirectable per research |
### GC Mechanism
| Assumption | Confidence | Evidence |
|------------|-----------|----------|
| `project-root` plaintext file inside instance dir; `--gc` reads and checks if path exists | Likely | SHA-256 not reversible; `sessions/*.json` already uses `"cwd"` field establishing the pattern |
Alternatives presented:
- A (plaintext `project-root` file): simple, debuggable
- B (`meta.json` with createdAt): more structure, allows future timestamp-based GC
## Corrections Made
No corrections — all assumptions confirmed by user.
## External Research
- **`CLAUDE_CONFIG_DIR`:** Confirmed in official Claude Code env-vars documentation. Redirects sessions/settings/todos/plugins. `~/.claude.json` hardcoded to `$HOME`, NOT redirected. Source: Claude Code docs + issues #3833, #1652.
- **Auto-resume behavior:** Claude Code does NOT auto-resume on launch. Sessions are fresh by default; `--continue`/`--resume` are explicit opt-in. Source: Claude Code common-workflows docs.