openAgent
gitlabThe open source UNIVERSAL agent.
clone
https://gitlab.com/bitzzdev/openAgent.gitAIagentautomationopen-sourceuniversal-agent
# Effect Migration PatternsThis is the compact reference for moving code toward the current Effectshape. The high-level roadmap is [`todo.md`](./todo.md); examples andrules are in [`guide.md`](./guide.md).## Default Shape- Service methods return `Effect`.- Service methods are named with `Effect.fn("Domain.method")`.- Expected failures are typed errors on the error channel.- Dependencies are yielded once at layer construction and closed over bymethods.- `defaultLayer` wires production dependencies; tests can use open layerswhen replacing dependencies.## Instance StateUse `InstanceState` for per-directory state, subscriptions, scopedbackground work, and per-instance cleanup.Do not add ad hoc `started` flags on top of `InstanceState`; the scopedcache handles run-once and concurrent deduplication.## Runtime BoundariesPrefer `AppRuntime` for crossing from non-Effect code into the shared applayer.`makeRuntime(...)` exists for intentional service-local boundaries andlegacy facades. Do not add new service-local runtimes unless the service isgenuinely outside `AppLayer`.## Platform Edges- Use `FSUtil.Service` instead of raw filesystem APIs ineffectified services.- Use `AppProcess.Service` instead of raw process wrappers.- Use `HttpClient.HttpClient` instead of raw `fetch` in Effect code.- Use `Effect.cached` for shared in-flight work.- Use `Effect.callback` for callback APIs.## Tests During MigrationWhen migrating code, migrate touched tests toward[`test/EFFECT_TEST_MIGRATION.md`](../../test/EFFECT_TEST_MIGRATION.md):- `testEffect(...)`- `it.effect`, `it.live`, or `it.instance`- explicit layers for behavior changes- deterministic waits instead of sleeps- no mutable env/global flags after layers are built## Migration Checklist- [ ] The code has a single Effect body instead of Promise wrappers aroundservice calls.- [ ] Expected failures are typed errors, not thrown exceptions or defects.- [ ] Layer requirements are explicit.- [ ] Tests use Effect-aware fixtures and focused layers.- [ ] Public behavior and wire shapes are preserved unless intentionallychanged.