Dashboard › opencode › makeRuntime InstanceState ownership
01a0ab03-ec58-7eaf-8664-f35a9199dab9Always build services with makeRuntime from src/effect/run-service.ts and own per-directory/project state through InstanceState. Chose scoped InstanceState.make, Effect.addFinalizer/acquireRelease, and forkScoped over module globals or detached promises because reload and directory cleanup must own every resource; non-blocking init() forks InstanceState.get(state) at the call site.