Summary
A knip + manual audit identified approximately 60+ locations of dead code across the app and ui packages — unused exports, entire unused files, and symbols that are only used inside their own module but unnecessarily carry export.
Audit Method
- Ran
npx knip to detect unused files, exports, dependencies, and devDependencies.
- Manually verified each flagged symbol with
grep to confirm zero external references.
- Stashed changes and re-ran the test suite to confirm pre-existing failures vs. regression.
Findings by Category
A. Entire files with zero references — safe to delete
| File |
Package |
Lines |
src/components/dialog-manage-models.tsx |
app |
102 |
src/custom-elements.d.ts |
app |
1 |
B. Exported symbols with zero external imports — safe to delete
| Symbol |
File |
Package |
ConstrainDragXAxis |
utils/solid-dnd.tsx |
app |
WorkspaceDragOverlay |
pages/layout/sidebar-workspace.tsx |
app |
SortableWorkspace |
pages/layout/sidebar-workspace.tsx |
app |
LocalWorkspace |
pages/layout/sidebar-workspace.tsx |
app |
useHighlights |
context/highlights.tsx |
app |
getSessionKey |
pages/session/helpers.ts |
app |
currentSession |
components/message-part/session-link.ts |
ui |
diff |
storybook/fixtures.ts |
ui |
code |
storybook/fixtures.ts |
ui |
C. Over-exported internals — used only within same module
These functions are called by other functions in the same file, but no external file imports them. They should lose export.
| Symbol |
File |
Internal caller |
agentColor |
utils/agent.ts |
messageAgentColor |
soundSrc |
utils/sound.ts |
playSoundById |
playSound |
utils/sound.ts |
playSoundById |
stripFileProtocol |
context/file/path.ts |
createPathHelpers chain |
decodeFilePath |
context/file/path.ts |
createPathHelpers chain |
getAvatarColors |
context/layout.tsx |
(internal only) |
MAX_TITLEBAR_HISTORY |
components/titlebar-history.ts |
applyPath, pushPath, trimHistory |
pushPath |
components/titlebar-history.ts |
applyPath |
trimHistory |
components/titlebar-history.ts |
pushPath |
patchFile |
components/apply-patch-file.ts |
patchFiles |
enterWorktreeOwnerProject |
components/tool-info.ts |
enterWorktreeSubtitle |
enterWorktreeTarget |
components/tool-info.ts |
enterWorktreeSubtitle |
exitWorktreeProjectName |
components/tool-info.ts |
exitWorktreeSubtitle |
exitWorktreePreviousLabel |
components/tool-info.ts |
exitWorktreeSubtitle |
agentTitle |
components/tool-info.ts |
toolInfoForInput |
D. Console debugging statements (25+)
Scattered console.debug / console.warn / console.error calls in production source files, e.g.:
// app/src/components/terminal.tsx:69
console.debug("[terminal]", ...values)
// app/src/pages/session/review-tab.tsx:59
console.debug("[session-review] failed to read file", { path, error })
E. SDK-generated dead code (not addressed in PR)
Knip flagged ~20 unused exports in packages/sdk/js/src/v2/gen/core/*.gen.ts (serializers, query key helpers, etc.). These are generated files and should be handled by the code generator, not manual deletion.
F. Deprecated fields (not addressed in PR)
@deprecated annotations in opencode/src/config/agent.ts, opencode/src/config/config.ts, and opencode/src/session/message-v2.ts. These require careful migration planning before removal.
Recommended Next Steps
| Priority |
Action |
| P0 |
Merge the PR for A+B+C (low risk, high cleanup value) |
| P1 |
Audit and remove console.* debug statements or replace with formal logger |
| P2 |
Configure knip in CI to prevent re-accumulation |
| P3 |
Address deprecated config fields with migration paths |
| P4 |
Tune SDK generator to skip unused serializer helpers |
Summary
A knip + manual audit identified approximately 60+ locations of dead code across the
appanduipackages — unused exports, entire unused files, and symbols that are only used inside their own module but unnecessarily carryexport.Audit Method
npx knipto detect unused files, exports, dependencies, and devDependencies.grepto confirm zero external references.Findings by Category
A. Entire files with zero references — safe to delete
src/components/dialog-manage-models.tsxsrc/custom-elements.d.tsB. Exported symbols with zero external imports — safe to delete
ConstrainDragXAxisutils/solid-dnd.tsxWorkspaceDragOverlaypages/layout/sidebar-workspace.tsxSortableWorkspacepages/layout/sidebar-workspace.tsxLocalWorkspacepages/layout/sidebar-workspace.tsxuseHighlightscontext/highlights.tsxgetSessionKeypages/session/helpers.tscurrentSessioncomponents/message-part/session-link.tsdiffstorybook/fixtures.tscodestorybook/fixtures.tsC. Over-exported internals — used only within same module
These functions are called by other functions in the same file, but no external file imports them. They should lose
export.agentColorutils/agent.tsmessageAgentColorsoundSrcutils/sound.tsplaySoundByIdplaySoundutils/sound.tsplaySoundByIdstripFileProtocolcontext/file/path.tscreatePathHelperschaindecodeFilePathcontext/file/path.tscreatePathHelperschaingetAvatarColorscontext/layout.tsxMAX_TITLEBAR_HISTORYcomponents/titlebar-history.tsapplyPath,pushPath,trimHistorypushPathcomponents/titlebar-history.tsapplyPathtrimHistorycomponents/titlebar-history.tspushPathpatchFilecomponents/apply-patch-file.tspatchFilesenterWorktreeOwnerProjectcomponents/tool-info.tsenterWorktreeSubtitleenterWorktreeTargetcomponents/tool-info.tsenterWorktreeSubtitleexitWorktreeProjectNamecomponents/tool-info.tsexitWorktreeSubtitleexitWorktreePreviousLabelcomponents/tool-info.tsexitWorktreeSubtitleagentTitlecomponents/tool-info.tstoolInfoForInputD. Console debugging statements (25+)
Scattered
console.debug/console.warn/console.errorcalls in production source files, e.g.:E. SDK-generated dead code (not addressed in PR)
Knip flagged ~20 unused exports in
packages/sdk/js/src/v2/gen/core/*.gen.ts(serializers, query key helpers, etc.). These are generated files and should be handled by the code generator, not manual deletion.F. Deprecated fields (not addressed in PR)
@deprecatedannotations inopencode/src/config/agent.ts,opencode/src/config/config.ts, andopencode/src/session/message-v2.ts. These require careful migration planning before removal.Recommended Next Steps