Context: the plugin collaboration surface
Service discovery, event dispatch, dependency checks, and effect ownership meet in one scope
ctx.service + ctx.on + ctx.effectIs Context a convenient global variable, or the system's boundary object?
Context is a scoped campus pass: it determines which facilities you can discover, which broadcasts you can hear, where you may install equipment, and what must be removed when you leave.
Mechanism
Plugins discover declared services from ctx rather than importing concrete implementations; missing dependencies surface during composition.
Child contexts inherit visible parent capabilities while owning independent effects and event scope, which enables agent-local capability worlds.
Create context
Parent, realm, and config determine initial visibility.
What extensions must preserve
- A Context reference carries scope semantics
- Duplicate services fail by contract instead of silently overwriting
- A disposed Context must reject new registrations
The tempting wrong turns
- ×Reducing ctx to dependency injection and ignoring events/lifecycle
- ×Caching agent-scoped services at module scope
- ×Instantiating providers directly around ctx
Do not trust the conclusion—verify it
These anchors are pinned to official deepseek-harness@47f9438; account for later breaking changes when reading current upstream.
Pause for ten seconds before revealing
Why register agent-local tools on agent.ctx rather than root ctx?
Context can be safely recomposed because effects and fibers own side effects and asynchronous lifetimes.