Skip to content

tencent-source/opencode-debloat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

OpenCode CLI Debloat Guide

Strip OpenCode CLI down to the bare essentials. Kill background processes, stop unnecessary I/O, reclaim your CPU and RAM.

If your machine is heating up or OpenCode feels sluggish, this is why.


The Problem

Out of the box, OpenCode runs several background systems you probably don't need:

Feature What it does behind your back Impact
Snapshot Continuously diffs and hashes every file in your project for undo/restore Constant disk I/O + CPU
LSP Spawns persistent language server processes that index your entire codebase RAM + CPU (often hundreds of MB)
Formatter Runs prettier/formatters as child processes after every file write CPU spikes on every save
Auto-update Checks for and downloads updates on every launch Network + disk on startup
Share Maintains session sharing infrastructure Unnecessary overhead
Telemetry OpenTelemetry tracing spans on AI SDK calls Background overhead

Combined, these can easily consume 1-2+ GB of RAM and keep your CPU busy enough to spin up the fans — even when you're not doing anything.


The Fix

Add this to your OpenCode config file:

Location: ~/.config/opencode/opencode.json

{
  "$schema": "https://opencode.ai/config.json",
  "snapshot": false,
  "lsp": false,
  "formatter": false,
  "autoupdate": false,
  "share": "disabled",
  "compaction": {
    "auto": true,
    "prune": true
  },
  "experimental": {
    "openTelemetry": false
  }
}

If you already have an opencode.json, merge these keys into your existing config. Don't replace the whole file.


What Each Setting Does

"snapshot": false — THE BIGGEST WIN

Snapshots track every file change in your working directory so you can undo/restore. This means OpenCode is constantly:

  • Watching your filesystem for changes
  • Reading and hashing files to detect diffs
  • Storing copies of file states in memory and on disk

On large projects (or if you run OpenCode from your home directory), this alone can peg a CPU core and generate significant heat.

Trade-off: You lose the ability to undo file changes from within OpenCode. Use git instead.

"lsp": false — SECOND BIGGEST WIN

LSP (Language Server Protocol) spawns background processes like typescript-language-server, pylsp, etc. These:

  • Index your entire project on startup
  • Sit in memory permanently (often 200-800 MB each)
  • Re-index on file changes
  • Provide code intelligence features (hover info, go-to-definition)

Most people use OpenCode for AI-assisted coding and don't need a second set of language servers running alongside their editor's.

Trade-off: You lose in-tool code intelligence. Your editor already provides this.

"formatter": false

Disables auto-formatting after every file write. OpenCode spawns child processes (prettier, biome, etc.) each time it writes a file.

Trade-off: Files won't be auto-formatted. Run your formatter manually or let your editor handle it.

"autoupdate": false

Stops OpenCode from checking for and downloading updates every time it launches.

Trade-off: You need to manually update with opencode upgrade when you want new versions.

"share": "disabled"

Kills the session sharing system entirely.

Trade-off: You can't share sessions. Most people never use this.

"compaction": { "auto": true, "prune": true }

This one actually helps performance. It aggressively prunes old tool outputs from your conversation context, keeping memory usage down during long sessions.

"experimental": { "openTelemetry": false }

Disables OpenTelemetry tracing spans. No reason to keep this on unless you're debugging OpenCode itself.


Before & After

Before debloat:

  • Multiple background processes (LSP servers, file watchers, formatters)
  • Constant disk I/O from snapshot tracking
  • 1-2+ GB RAM overhead
  • Fans spinning, machine heating up

After debloat:

  • Just the AI agent and your conversation
  • Minimal disk I/O (only when you actually read/write files)
  • Drastically lower RAM usage
  • Cool and quiet machine

How to Verify

Check your resolved config after applying:

opencode debug config

You should see all the debloat settings reflected in the output.


Per-Project Override

If you want debloat globally but need LSP or formatters for a specific project, add an opencode.json in that project's root:

{
  "lsp": true,
  "formatter": true
}

Project configs override global configs, so you can selectively re-enable features where needed.


FAQ

Q: Is this safe? Yes. These are all official config options documented in the OpenCode config schema. You're just turning off features you don't need.

Q: Can I undo this? Yes. Delete the keys from your config or set them back to true. Changes take effect next time you start OpenCode.

Q: Will this break anything? No. Core functionality (AI chat, file editing, bash, tools) is completely unaffected. You're only disabling auxiliary features.

Q: I still want auto-updates but just want notifications. Set "autoupdate": "notify" instead of false. You'll get notified of new versions without auto-downloading.


One-Liner Setup

If you don't have an existing config and want to start fresh:

mkdir -p ~/.config/opencode && cat > ~/.config/opencode/opencode.json << 'EOF'
{
  "$schema": "https://opencode.ai/config.json",
  "snapshot": false,
  "lsp": false,
  "formatter": false,
  "autoupdate": false,
  "share": "disabled",
  "compaction": {
    "auto": true,
    "prune": true
  },
  "experimental": {
    "openTelemetry": false
  }
}
EOF

License

MIT — do whatever you want with this.

About

Practical guide to debloat OpenCode CLI and reduce CPU, RAM, disk I/O, and heat for faster day-to-day development.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages