Repository navigation
Description
Problem
OpenCode has CRUD for sessions but only CRU for projects:
GET /project— listGET /project/current— get currentPATCH /project/:id— update- DELETE — missing
This causes:
-
Stale project entries that cannot be removed — users report in:
- Title: (OpenCode-Desktop) Open Project no longer detects manually created git worktrees as workspaces, and stale workspace entries cannot be removed on macOS #21554 — stale workspace entries cannot be removed on macOS
- [FEATURE]:good way to manage stored data #8083 — "a good way to clear everything or categorize then delete a project would be super helpful"
-
No API-driven cleanup — users resort to manual SQLite manipulation or community tools like opencode-project-manager
-
Blocks downstream features — Telegram bots, workspace management, and storage reclamation ([FEATURE]: Session Lifecycle Management — unified storage reclamation, auto-archival, and child session cleanup #16101) cannot programmatically remove projects
-
Orphaned sessions — Sessions become orphaned when project directory is renamed #23248 shows sessions become invisible when directories are renamed/moved; [FEATURE]: Add session migration dialog to recover orphaned or misplaced sessions #23249 proposes migration, but deleting the dead project is often the simpler fix
Proposal
Add DELETE /project/:projectID:
- Deletes the project row from the
projecttable - Foreign key cascade (
ON DELETE CASCADE) automatically removes all associated sessions, messages, parts, todos, and permissions - Response:
{ deleted: true, sessionsRemoved: <count> } - Returns 404 for non-existent project IDs
Scope
-
Project.remove(id)— Effect service method -
DELETE /project/:projectID— Hono route (server) -
DELETE /project/:projectID— HttpApi endpoint (for SDK generation) - SDK client regenerates from OpenAPI annotations automatically
- No TUI/Desktop UI changes in this PR
Related
- Title: (OpenCode-Desktop) Open Project no longer detects manually created git worktrees as workspaces, and stale workspace entries cannot be removed on macOS #21554 — stale workspace entries cannot be removed
- [FEATURE]:good way to manage stored data #8083 — good way to manage stored data
- [FEATURE]: Session Lifecycle Management — unified storage reclamation, auto-archival, and child session cleanup #16101 — Session Lifecycle Management
- Sessions become orphaned when project directory is renamed #23248 — Sessions become orphaned when project directory is renamed
- [FEATURE]: Add session migration dialog to recover orphaned or misplaced sessions #23249 — Session migration dialog for orphaned sessions
Activity
github-actions commentedon Apr 29, 2026
This issue doesn't fully meet our contributing guidelines.
What needs to be fixed:
I have verified this feature I'm about to request hasn't been suggested before.). This checkbox is missing from the issue.Please edit this issue to address the above within 2 hours, or it will be automatically closed.
This issue might be a duplicate of existing issues. Please check:
If you believe this was flagged incorrectly, please let a maintainer know.
github-actions commentedon Apr 29, 2026
This issue has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window.
Feel free to open a new issue that follows our issue templates.