Skip to content

feat(agents-cli): add recent-projects management with stale entry detection and pruning#3469

Draft
amikofalvy wants to merge 1 commit into
mainfrom
cursor/fix-stale-recent-projects-d822
Draft

feat(agents-cli): add recent-projects management with stale entry detection and pruning#3469
amikofalvy wants to merge 1 commit into
mainfrom
cursor/fix-stale-recent-projects-d822

Conversation

@amikofalvy

Copy link
Copy Markdown
Collaborator

Summary

Resolves [PRD-7464] — Desktop: stale recent-project entries remain after project directory is deleted.

Adds a recent-projects state management module and CLI commands to the agents-cli package. This provides the core infrastructure for detecting, listing, and removing stale project entries whose filesystem paths no longer exist.

What's included

State management (agents-cli/src/utils/recent-projects.ts)

  • getRecentProjects() — Read the recent projects list from state.json
  • addRecentProject() — Add/move a project to the top of the recents list
  • removeRecentProject() — Remove a project and clean up projectSessions, projectWindowBounds, and lastOpenedProject
  • validateRecentProjects() — Check which entries have missing directory paths
  • pruneStaleProjects() — Auto-remove all entries whose paths no longer exist on disk
  • getRecentProjectsState() — Read the full state file

CLI commands (inkeep recent-projects)

Command Description
inkeep recent-projects list List recent projects, flagging those with missing directories
inkeep recent-projects remove <path> Remove a specific project from history by path
inkeep recent-projects prune Remove all projects whose directories no longer exist

Platform-aware state directory

Follows the OS-native application data convention:

  • macOS: ~/Library/Application Support/OpenKnowledge/state.json
  • Windows: %APPDATA%/OpenKnowledge/state.json
  • Linux: ~/.config/OpenKnowledge/state.json

Cleanup scope

When removing a project entry, all associated keys are cleaned:

  • recentProjects — the project entry itself
  • projectSessions — any session data keyed by path
  • projectWindowBounds — any window geometry data keyed by path
  • lastOpenedProject — reset to the next most recent project (or cleared)

Tests

17 unit tests covering all functions and edge cases (malformed JSON, empty state, nested directory creation, multi-project interactions, stale detection with real filesystem paths).

Changeset

patch bump for @inkeep/agents-cli.

Linear Issue: PRD-7464

Open in Web Open in Cursor 

…ection and pruning

Implements state management for desktop recent-project entries:
- Add/remove/list recent projects with path tracking
- Validate project paths exist on disk (detect stale entries)
- Auto-prune stale entries whose directories no longer exist
- Clean up associated projectSessions, projectWindowBounds, and lastOpenedProject
- CLI commands: recent-projects list, remove, prune
- Comprehensive unit tests (17 tests)

Resolves PRD-7464
@changeset-bot

changeset-bot Bot commented Jul 18, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 558275a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 10 packages
Name Type
@inkeep/agents-cli Patch
@inkeep/agents-api Patch
@inkeep/agents-manage-ui Patch
@inkeep/agents-core Patch
@inkeep/agents-email Patch
@inkeep/agents-mcp Patch
@inkeep/agents-sdk Patch
@inkeep/agents-work-apps Patch
@inkeep/ai-sdk-provider Patch
@inkeep/create-agents Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

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