opencode-desktop-repair

Diagnose and repair OpenCode desktop state after project directories are renamed or deleted.

Updated Sep 7, 2026
One-click install
npx skills add https://github.com/deriye/.agents-work --skill opencode-desktop-repair-deriye
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: opencode-desktop-repair
Source: https://github.com/deriye/.agents-work/tree/main/skills/opencode-desktop-repair
Command: npx skills add https://github.com/deriye/.agents-work --skill opencode-desktop-repair-deriye

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve? OpenCode desktop breaks when a project folder is renamed or deleted: the app keeps reopening a dead "ghost" directory, sessions hang with no assistant reply, ENOENT/realPath errors appear, or projects vanish from the sidebar on every launch. This Skill diagnoses the root cause in the app's SQLite database and JSON state files and applies targeted fixes. ## Core Features & Use Cases - Log-driven diagnosis: Read opencode.log to identify the poisoned project ID, dead worktree paths, and corrupt session rows before changing anything. - Database repair scripts: Remove poisoned project rows, ghost sessions, and corrupt session entries from opencode.db with automatic backups and integrity checks. - State file encoding fixes: Detect and strip UTF-8 BOMs from opencode.global.dat and window state files that cause projects to disappear every launch. - Use Case: You renamed a folder from .agents-old to .agents and now OpenCode spawns the deleted directory and hangs on new sessions. The Skill inspects the DB copy, finds the poisoned project row, and hands you a PowerShell script to run after quitting the app. ## Quick Start Ask the agent to diagnose why OpenCode desktop keeps reopening a deleted project folder and hanging on new sessions.

Frequently Asked Questions about opencode-desktop-repair

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fix OpenCode desktop reopening a deleted project folder?▼

The usual root cause is a poisoned project row in opencode.db whose worktree points at the deleted directory. Run the fix-project.ps1 script in an external PowerShell after fully quitting OpenCode; it deletes the stale project row and its child records while keeping the clean project intact.

Why do my OpenCode desktop projects disappear every launch?▼

This happens when opencode.global.dat contains a UTF-8 BOM, usually from a prior edit with Set-Content -Encoding UTF8 on PowerShell 5.1. The app cannot parse the file, shows an empty project list, and refuses to persist changes. Run fix-global-bom.ps1 to rewrite the file without a BOM.

Why does OpenCode desktop hang with no assistant reply on new sessions?▼

Corrupt session rows with non-UTF8 directory values or NULL paths make session.list fail with a 'Path is not absolute' error, causing a silent hang. The fix-sessions.ps1 script removes these corrupt rows plus sessions bound to deleted directories.

Can I repair the OpenCode database while the app is running?▼

No. The opencode.db file is WAL-locked while the app runs, so all mutation scripts refuse to execute if an OpenCode process is detected. You can copy the database with shared-read access for read-only diagnosis, but fixes require fully quitting the app first.

What tools are required to run the OpenCode repair scripts?▼

The scripts require Windows PowerShell 5.1 and Python 3 on PATH, using Python's built-in sqlite3 module for database access. No additional packages need to be installed, and every script creates a timestamped backup before making changes.