Skip to content

feat: add recent cwd path selection#238

Closed
kerwin2046 wants to merge 2 commits into
agegr:mainfrom
kerwin2046:feat/recent-cwd-paths
Closed

feat: add recent cwd path selection#238
kerwin2046 wants to merge 2 commits into
agegr:mainfrom
kerwin2046:feat/recent-cwd-paths

Conversation

@kerwin2046

Copy link
Copy Markdown
Contributor

Problem: Users who frequently switch between working directories had to re-enter custom paths or scroll through all session-derived projects to find their desired directory. There was no persistence of manually entered or recently used paths — they were lost after navigating away.
Changes:

  1. New API endpoint app/api/cwd/recent/route.ts
  • GET /api/cwd/recent — returns the list of recent working directories from ~/.pi/agent/recent-cwds.json
  • POST /api/cwd/recent — accepts { cwd: string }, prepends it to the recent list (deduplicated), caps at 10 entries, and persists to the JSON file
  1. components/SessionSidebar.tsx
  • On mount, fetches the recent paths list and stores it in local state
  • Whenever the user selects a CWD (via project list, custom path, default directory, or worktree switch), a debounced effect records it as a recent path via POST /api/cwd/recent
  • The CWD dropdown now includes a "Recent" section between the project list and the "Default directory"/"Custom path" actions
  • Recent paths that already appear in the current project list are filtered out to avoid duplication
  • Up to 5 recent paths are shown, each with a folder icon and left-ellipsized path label
  • The "Recent" section is hidden when the project filter is active to avoid confusion

@kerwin2046

Copy link
Copy Markdown
Contributor Author
image

@agegr

agegr commented Jul 25, 2026

Copy link
Copy Markdown
Owner

Thanks for the contribution. The current CWD selector already lists session-backed projects ordered by recent activity, with filtering for larger lists.

We’d like to keep the selector scoped to directories that have sessions, so we don’t need a separate persisted “Recent paths” list at this time. We’ll close this PR for now. Thanks for understanding.

@agegr agegr closed this Jul 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants