Not a source paraphrase
We explain why the design exists before tracing events, boundaries, and trade-offs.
Start with why this is more than a while loop, then travel through Cordis composition, turns and steps, event truth, guarded tools, compaction, projections, subagents, workflows, and finally your own safe extensions.

We explain why the design exists before tracing events, boundaries, and trade-offs.
Every claim is calibrated to upstream 47f9438: 49 package families and 324 docs.
Every chapter has an interactive mechanism, invariants, failure modes, a check, and an explicit bridge.
Forty-nine package families are not forty-nine islands. Six planes put complexity into understandable drawers.
Decides which plugins exist, how they layer, and how they unwind.
bootbundlepresetextensionsUnderstand the problem before studying how complexity is divided.
Why can the same model feel like a different system inside another agent product?
If sessions, tools, and even the agent loop are plugins, what remains as the core?
Across thousands of source files, how do you decide where new behavior belongs?
In a large agent repository, do you search functions first or find contracts first?
Read the system through Cordis contexts, effects, services, events, scopes, and config trees.
Is Context a convenient global variable, or the system's boundary object?
Why does AbortController.abort() not mean a plugin has finished unloading?
When should you call ctx.fs, and when should you listen to fs/write-intent?
How can two agents see different tools, personas, and working directories in one process?
How do you replace models, sandboxing, or tools without forking upstream?
From agent creation through SessionEvent, turns, steps, prompts, LLMs, and tools.
Who may destroy an agent, and how does a half-failed creation roll back?
Why persist raw assistant chunks instead of only the final message?
Why does one user message not imply one model request?
How can plugins add model-visible context without everyone editing one systemPrompt?
Why can DeepSeek, replay, and other providers stream into the same agent loop?
Why can a later plugin not re-allow a dangerous call already denied upstream?
Approval, sandboxing, filesystem policy, compaction, persistence, projections, and invariants.
Why does danger-full-access plus never-ask still not mean every tool can execute?
Why does replacing the subprocess provider move Bash, PTY, LSP, and external subagents together?
How do you shorten context without breaking tool call/result pairing or deleting original facts?
Why should a session list not load the complete event log for every row?
Why can a timeout not simply Promise.race and forget the still-running work?
Goals, plans, todos, subagents, jobs, workflows, schedules, and capability discovery.
Why can all todos be complete while the goal is not?
After starting a subagent, who owns it, who may continue it, and who must stop it?
Why can workflow, job, and schedule not collapse into one background-task concept?
Skills and plugins both extend agents—why are they not the same?
Turn understanding into tools, adapters, client surfaces, profiles, and bundles.
Beyond name, description, and execute, what makes a production-grade tool definition?
When should you add a provider, and when should you design a new seam?
How does a Web UI button become agent behavior without making the browser own business state?
What boundaries separate a locally working plugin from a shippable product?
Chapter one takes twelve minutes and starts by separating a harness from an agent loop.
Start deep dive