Problem
Currently runbox ps and runbox history list ALL runs from global storage (~/.local/share/runbox/runs/), regardless of which repo the user is in.
For users working on multiple projects, this creates noise - runs from unrelated projects are mixed together.
Design Decisions
1. Default behavior: Repo-scoped (BREAKING CHANGE)
# In a git repo (main or worktree):
runbox ps # filters to current repo (NEW default)
runbox history # filters to current repo (NEW default)
# Escape hatch for global view:
runbox ps --global
runbox history --global
2. Worktree handling
When in a worktree, resolve to the main repo's origin URL. This groups all experiments across worktrees together.
main-repo/
├── worktree-exp-v1/ → same repo URL
├── worktree-exp-v2/ → same repo URL
└── worktree-exp-v3/ → same repo URL
# In ANY of these dirs:
runbox ps → shows runs from ALL worktrees of this repo
3. Outside git repo: Error
$ cd /tmp
$ runbox ps
Error: Not in a git repository. Use --global to see all runs.
$ runbox ps --global
# Works, shows all runs
Implementation Notes
Run struct already stores code_state.repo_url
- Use
GitContext::from_current_dir() to get repo URL (works in worktrees too)
- Add
--global flag to ps and history commands
- Filter:
run.code_state.repo_url == current_repo_url
- URL normalization: extract
org/repo portion for comparison (handles SSH vs HTTPS)
Acceptance Criteria
Problem
Currently
runbox psandrunbox historylist ALL runs from global storage (~/.local/share/runbox/runs/), regardless of which repo the user is in.For users working on multiple projects, this creates noise - runs from unrelated projects are mixed together.
Design Decisions
1. Default behavior: Repo-scoped (BREAKING CHANGE)
2. Worktree handling
When in a worktree, resolve to the main repo's origin URL. This groups all experiments across worktrees together.
3. Outside git repo: Error
Implementation Notes
Runstruct already storescode_state.repo_urlGitContext::from_current_dir()to get repo URL (works in worktrees too)--globalflag topsandhistorycommandsrun.code_state.repo_url == current_repo_urlorg/repoportion for comparison (handles SSH vs HTTPS)Acceptance Criteria
runbox psin git repo filters to current repo by defaultrunbox psin worktree filters to main reporunbox ps --globalshows all runs regardless of locationrunbox psoutside git repo errors with helpful messagerunbox historysame behavior asps