ADR-026: All-plugin Cordis agent architecture
Status: Accepted target, effective on the independently reviewed documentation
merge to develop. Runtime migration capabilities remain Planned.
Decision class: Target runtime composition; no runtime implementation or stored-data migration is established by this decision.
Tracked work: #981.
Relationship: Refines the Constitution's four logical responsibilities into plugin composition. It does not supersede their authority boundaries, ADR-001/003 provider/state ownership, ADR-035 inference (superseding ADR-006/024 and absorbing ADR-025), ADR-008 portability, or ADR-013/020 package protections.
Context
The operator selected an all-plugin Cordis architecture on October 8, 2026. Seraph currently has a Python/FastAPI runtime and React cockpit. Existing extension registries, skills, capability packs and MCP adapters are useful seams, but do not mean the runtime is already composed of Cordis plugins.
DeepSeek Harness provides a useful contributor-guide and composition reference. Its upstream instructions are not Seraph policy, and its vendored, patched Cordis fork is not interchangeable with a stock Cordis release. The inspected sources and the limited ideas adopted from them are recorded below.
Decision
Compose Seraph's agent runtime from Cordis plugins. Agent loop and orchestration, goals/policy/authority, capability execution and tools, model integration, persistence and memory, job scheduling, audit, and interface/edge adapters are runtime plugin responsibilities. Only the necessary entry point, composition validation and startup/shutdown wiring remain outside plugins. Pure types, contracts and utility libraries need not pretend to be runtime plugins.
The four-layer model remains a separation of responsibilities, not four large packages or an exception allowing a monolithic guardian runtime outside Cordis:
| Logical responsibility | Plugin composition responsibility |
|---|---|
| Guardian kernel | Goal/policy/planning/intervention and memory-coordination services, including the agent loop, supplied by trusted plugins |
| Capability runtime | Typed capability registration, durable jobs, approvals, execution enforcement, checkpoints, artifacts and bounded admission supplied by trusted services/plugins |
| Model fabric | Governed inference route, transport, capability proof and accounting services/plugins; providers supply inference only |
| Interfaces and edges | Cockpit/API/transport and consented-context adapters consuming typed services; never independent authority or canonical state owners |
“All-plugin” describes composition, not optionality. Policy, authentication, authority, durable ownership and accounting enforcement remain mandatory trusted services for work that depends on them. They are not user-disableable controls that can be bypassed by selecting another plugin.
Service, configuration and lifecycle contract
- Define typed service interfaces and data contracts. Each service has an explicit owner, required/optional dependencies and a bounded public surface. Declare dependencies rather than locating peers through ambient globals or importing their private state. Service availability never substitutes for authenticated authority to invoke it.
- Validate plugin configuration before activation and expose invalid/missing dependencies as actionable states. Reuse settings, vault references and existing policy revisions rather than creating raw env switches or putting credentials in generic plugin configuration. A config update cannot silently expand permissions or restore revoked consent.
- Let the composition bootstrap validate required service identities and readiness before admitting governed work. Missing, unhealthy or disposed enforcement blocks dependent work; optional adapter failures leave independent core work usable and show degraded/blocked state. The bootstrap has no parallel policy engine or separate agent loop.
- Each plugin owns its registrations, timers, listeners, tasks, resources and shutdown obligations. Stop new admission before quiescence, cancel or drain within original bounds, dispose owned resources and preserve durable recovery receipts. Dependency loss fences late work and adoption. Unknown cleanup or cost remains Unknown/blocked; unloading cannot erase liability or justify replay. Seraph must implement and test this policy rather than assume Cordis disposal alone proves cleanup or always propagates cleanup failures.
- Extension points register typed capabilities, approved inference/transport adapters or bounded event consumers under the owning service contract. Events are notifications, not authorization or a second job queue. Model output and external messages remain untrusted input through the same validation boundary.
Official Cordis source supports explicit dependency declarations, service registration, configuration handling and lifecycle-owned effects. These are composition primitives, not a guarantee that an application meets the preceding Seraph requirements. Exact package choice, supported APIs and version pins require their own reviewed implementation contract; no API recipe is mandated here.
Three distinct trust boundaries
| Category | Trust and execution rule |
|---|---|
| Trusted runtime plugins | Reviewed application code in the trusted runtime. May implement mandatory services but cannot bypass their authority contracts. In-process loading/dependency injection is not sandboxing. |
| Reviewed authored capability packs | Keep ADR-013/020 exact package/version/content/schema/runtime bindings, review and activation, finite grants, sandbox/profile enforcement, output verification, quarantine/revoke/uninstall and recovery. Loading an authored package as a trusted Cordis plugin is not permitted by this decision. |
| External adapters and MCP integrations | Cross explicit network/process/credential boundaries; validate external data, declared capability and current consent/approval on each governed operation. Adapter installation or provider credentials grant no authority. |
No dynamic marketplace, arbitrary plugin import, unrestricted discovery, implicit plugin installation or new trust grant follows from this ADR. Reviewed application deployment and reviewed authored-package activation remain distinct processes. Dependency injection cannot contain malicious code, revoke an already leaked credential, or replace OS/process/network isolation. The migration must select and verify any isolation boundary it needs; unsupported profiles remain blocked.
Preserved Seraph invariants
- Canonical goals, memory, jobs, artifacts, approvals and audit stay Seraph-owned. Persistence plugins implement the existing logical ownership and durable contracts, not one database or ledger per plugin. Retain identity, provenance, backup/restore, encryption/private readback, revocation fences and recovery.
- Inference uses governed NEAR AI TEE-hosted models under ADR-035 (amending this
bullet), with explicit slot/purpose, consent, capabilities, budget and its
provider-plaintext disclosure, as a typed model-fabric provider adapter behind
seraph.inference.v1. OpenRouter is retired by policy. No local/direct-vendor fallback or provider-owned agent runtime is introduced. - Preserve the shared remote-inference admission bound of one, priority, deadlines, cancellation, idempotency, reservations, authoritative cost evidence and unresolved liabilities. Plugin/provider boundaries do not create extra lanes, independent budgets or blind retries.
- Observation, data egress, execution, result adoption and learning remain
separate permissions. Check current original authority before the relevant
effect/adoption/read; restart or reload never renews expired authority.
Capability completion still requires real governed execution, evidence/readback
and explicit memory update or
no_learning, with operator-visible recovery. - Core operation stays CPU-capable on macOS and Linux without model servers, GPUs, VLM wrappers, native capture or optional sandbox services. Optional platform profiles show their actual readiness/proof independently. Runtime traffic uses approved APIs; SSH remains administration only.
Migration Boundaries And Open Decisions
This documentation batch does not add dependencies, plugin packages, a runtime loader, compatibility shims, provider calls or data migration. Current module owners and managed lifecycle remain authoritative until reviewed implementation milestones replace them. New work should expose clear ownership/contracts and bounded lifecycle seams without preemptively rewriting the current application.
Resolve the following in separately tracked migration design/implementation:
- Exact Cordis distribution/version and whether any fork is necessary; importing DeepSeek's patched fork or package names is not a default decision.
- Runtime language/process boundaries and how retained Python/native execution integrates with Cordis, including authenticated IPC if separate processes are selected. This ADR does not mandate rewriting all Python in TypeScript.
- Package/service granularity, composition validation, dependency failure rules, configuration transitions and any upgrade/reload support. Hot reload is not a shipped guarantee or an acceptance requirement inherited from upstream.
- Ordered vertical migration slices, coexistence/fencing, compatibility and rollback, plus state-format/schema changes only if independently justified. Do not copy an upstream persistence format or move the canonical workspace.
These are implementation choices within the selected all-plugin target, not an invitation to revisit policy, portability or canonical ownership. Execution sequencing and review status belong in issues/PRs/Project, not this document.
Typed service bridge core (#1007)
The #1007 core slice
implements the fourteen typed service identities (seraph.<noun>.v1, Context
keys seraphAuthority ... seraphSourceExtraction) and the fixed 34-method
inventory as forwarding-only Cordis providers. A provider call is a bounded
callback inside one original Python-issued invocation, admitted only for a
method in that invocation's frozen reviewed closure. Python's finite dispatcher
re-resolves the job, lease, fence, deadline, composition owners and authority
before any private bytes or effect, and the child's answers are accepted only
when they equal the result Python itself sealed or recorded durably.
One RuntimeCompositionState row per runtime domain records the owner
(legacy/cordis), a monotonic epoch, the composition digest, ready,
draining or blocked state and an audit recovery receipt. A Cordis-bound job
stores its immutable dependency vector; the canonical job CAS repeats it as an
SQL predicate, so a changed, draining or missing owner fences admission, effect,
checkpoint, private read and adoption. Cutover is a fenced compare-and-set that
only increases the epoch (rollback is another higher epoch) and refuses an epoch
change while a leased attempt is bound to the prior owner.
Methods without a native owner in this slice return a typed, operator-visible
blocked result (the runtime status lists them). The deferred Memory
composition-snapshot/census/frame-accounting amendments recorded on #1007 are
not implemented by this slice. Current app details are in the
current app guide.
Guardian research composition (#1008)
#1008 is the first capability composed from Cordis providers rather than forwarding proxies: the research service delegates planning to an injected goal-plan provider and execution to the guardian consumer, and source extraction selects interchangeable format providers from closed profile config. Providers propose; Python remains the validator, artifact owner and transport/consent owner, and pins every job to the reviewed package/profile digests. Missing providers are typed blocks, never a fallback. Details are in the current app guide.
Verification And Consequences
This decision requires source/path/link and contradiction checks, both docs contract scripts, documentation typecheck/build and an independent review of the cumulative changes. Review findings and their disposition are recorded with the owning issue/PR; acceptance does not establish runtime or isolation proof.
Independent content review on 2026-10-08 found no material findings in the contributor guide and target-composition changes. The accepted review refinements keep runtime plugins separate from authored packs, distinguish inspected source from executed evidence, and preserve current implementation and provider scope. This is documentation/architecture review, not runtime or isolation acceptance.
Future migration slices must prove one complete operator journey through actual plugin composition, including start/stop and dependency loss; missing mandatory enforcement; wrong/revoked/expired authority; shared inference priority/serial admission; durable jobs/artifacts/audit; no replay after uncertain effects; readback, memory/no-learning and operator-visible recovery. Verify platform claims on their actual hosts. Retain state and unresolved liabilities across restart/rollback; do not weaken checks to make the new composition pass.
Composition makes extension ownership explicit but adds dependency/lifecycle and trusted-code supply-chain risks. The selected framework does not reduce Seraph's enforcement burden. Existing shipped behavior remains described by Development Status and the Current App Guide.
Inspected Sources And Adaptation
Inspected on 2026-10-08:
- DeepSeek Harness commit
5badb15009ae1756c3afe0ae0cef1faafc290ccc(2026-10-03): agent guide, architecture, vendored-framework notice. Adapted annotated repository navigation, practical command conventions and explicit plugin composition/lifecycle ownership. Did not adopt its directory layout, launch commands, package names, provider policies or persistence format. - Official Cordis commit
f8ea3cd50f1a5724e8e715995bcde131c9c12b2c(2026-09-08): registry, service reflection, events/effects, runtime lifecycle. Used to check dependency, service, configuration and lifecycle primitives; framework capability does not establish Seraph implementation or security.