anomalyco / anomalyco/opencode
.opencode/ dirs (plans + node_modules) duplicated in every opened project, no opt-out
@jlongster is already working on this.
Since Aug 29, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- Avg merge
- 7h 2m
- Merged PRs (30d)
- 384
Description
What happens
- Open opencode in any git project and use plan mode: the plan file is written to
<project>/.opencode/plans/<ts>-<slug>.md(hardcoded whenever the project has a VCS). - On the next start, opencode discovers the now-existing
.opencodedirectory as a config directory and auto-installs@opencode-ai/plugin(plus ~28 transitive dependencies) into<project>/.opencode/node_modules, and also writespackage.json,package-lock.jsonand a.gitignorethere. - Repeat for every project plan mode is ever used in: identical dependency trees duplicated everywhere.
This also hits ~/.config/opencode itself when it happens to be a git repo (common for people who version-control their opencode config): opening opencode there creates ~/.config/opencode/.opencode/ with its own node_modules.
Why this is a problem
Developers generally do not appreciate unrequested artifacts appearing in their repositories, and a side-effect node_modules tree with enough mass to make a black hole blush appearing in every project without consent is a hard sell. The plan file location is at least intentional, but the dependency install is pure collateral, and there is currently no config option to opt out of either behavior.
Code refs (v1.18.25)
Plan path hardcoded to the worktree when the project has a VCS, packages/opencode/src/session/session.ts:331-336:
const base = instance.project.vcs
? path.join(instance.worktree, ".opencode", "plans")
: path.join(Global.Path.data, "plans")
Per-directory SDK auto-install for every discovered .opencode config directory, packages/opencode/src/config/config.ts (~439-465 in v1.18.25):
yield* ensureGitignore(dir).pipe(Effect.orDie)
const dep = yield* npmSvc
.install(dir, {
add: [{ name: "@opencode-ai/plugin", version: InstallationLocal ? undefined : InstallationVersion }],
})
Related
- #28174 (configurable plans directory, auto-closed after inactivity)
- #30337 (
.opencode/node_modules/causes startup hang because scanners do not skip it) - #27786 (XDG violation: node_modules installed in
~/.configinstead of~/.local/share)
Request
- A config option to relocate plan files (e.g.
plans_directory), or defaulting them to the global data dir when no per-project override is set. - An opt-out (env flag or config key) for the per-directory
@opencode-ai/pluginauto-install, or relocation to an XDG cache location so project directories stay untouched.
Happy to open a PR for either/both if maintainers are open to it.
Environment
- opencode 1.18.25, Linux x86_64
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.