DeepSeek Harness

DeepSeek Harness: Cordis Context Capabilities

· 7 min read · 中文版

Cordis Context is the scoped entry point through which a DeepSeek Harness plugin resolves services, registers lifecycle effects, participates in events and creates child contexts.

DeepSeek Harness: what does a Context provide?

The Context reference describes ctx as the core Cordis object through which services, events and lifecycle APIs are reached. A context is a proxy: normal property reads go through the service resolver. Root and child contexts form dependency containers for plugins, so the service visible at a key depends on the context in which it is resolved.

The Cordis primer gives examples such as ctx.tools, ctx.llm and ctx.sessions. Plugins declare required services with inject, allowing Cordis to wait for them. Context is consequently more than an object passed into apply: it connects the plugin to scoped capabilities and framework-managed lifetime. It does not guarantee that every service exists in every composition.

Context connects a plugin to services, events, effects and child scopes

CapabilityWhat it is forBoundary
Service resolutionFind a capability by its context keyVisible implementation depends on scope
EventsObserve or intercept documented extension pointsEach event has its own dispatch contract
EffectsRegister reversible workCleanup must be designed with the registration
Child contextsAdd metadata, isolate a service, or intercept its configThe parent context is not mutated

DeepSeek Harness: how do child contexts differ?

ctx.extend(meta?) creates a child that prototypally inherits the current context. Own properties of meta, including symbol keys, shadow inherited ones; the parent is unchanged. This is useful for adding scoped metadata, but shadowing metadata is not the same operation as installing a separate service implementation.

ctx.isolate(name, label?) creates a child with an independent service scope for the named service. Reads and writes of that name below the child resolve using the new label rather than the parent's. The default label is a fresh unique symbol; supplying the same label to two calls joins their scopes. Isolating one service does not imply every service in the child is isolated.

ctx.intercept(name, config) returns a child carrying service-specific intercept configuration for plugins started below it. The service's resolved configuration merges ancestor entries first. The parent is unaffected. This is service configuration interception; it should not be confused with replacing a whole plugin row through a profile patch. Check the service's own contract for the meaning of its configuration.

DeepSeek Harness: how should a plugin use these capabilities?

  1. Identify the required capability and its documented context key. Declare required services using the plugin's injection contract before using them.
  2. Choose the scope intentionally. Use the current context when its service is the intended one; consider a child only when metadata, a separate named service scope or service-specific interception is needed.
  3. Register behavior through the appropriate service or documented event. For example, the primer distinguishes direct service methods from events used for interception and policy.
  4. Attach cleanup to registrations with ctx.effect() or a helper such as ctx.on() that manages disposal. Keep related work together when teardown order matters.
  5. Exercise activation, the intended operation and teardown or replacement in the actual composition. Verify which service instance is visible in each relevant scope.

The Context reference lists ctx.registry as the plugin registry, with methods such as ctx.plugin and ctx.inject mixed onto ctx. It also lists ctx.events, whose methods include ctx.on and ctx.emit, ctx.logger(name) for a named logger, and ctx.reflect, the layer backing operations such as ctx.get and ctx.provide. These are entry points to separate contracts, not a reason to assume that every call behaves identically across arbitrary plugins.

DeepSeek Harness: how do events and lifecycle relate?

The primer identifies emit, waterfall, parallel, serial and bail as dispatch modes. An event's mode is part of its public contract. A waterfall listener receives next; calling next() delegates, while returning without it short-circuits. An observer that intends to leave the decision to others must delegate. Read the event declaration rather than selecting a dispatch style solely from its name.

Registrations are reversible effects. The primer names prompt sections, tool schemas, adapters, providers and listeners as examples installed through ctx.effect() or ctx.on(). When a plugin is reloaded or torn down, the associated cleanup unwinds those registrations. A listener that remains after its owner is replaced can change future behavior, so test the lifecycle as well as the initial registration.

Context is not itself an Agent conversation or a record of model-visible history. It is the plugin framework's service and lifecycle context; a service accessed through it may manage other kinds of state. Distinguishing these meanings helps when reading references that use the word context in different domains.

DeepSeek Harness: what are the scope and safety limits?

ctx.root is documented as experimental and shared by child contexts. ctx.baseUrl, when supplied by the runtime, resolves relative plugin or module specifiers. Neither property by itself guarantees that a plugin has access to a particular service or that an external module is trustworthy. An isolated service scope affects resolution for the named service; it is not described as a process sandbox or a security guarantee.

The available ctx keys depend on the composition, and service and event contracts can change across versions. Check the reference corresponding to the installed release and the owning subsystem. Successful injection or registration establishes an activation fact, not the correctness or security of the implementation. See services and injection for the provider and consumer relationship.

When a required capability is missing, inspect the consumer’s declared dependencies and the provider visible in its scope. A key shown in a different context is not sufficient evidence that the waiting consumer can resolve it.

DeepSeek Harness: what do the terms mean?

  • Context: a proxy and scoped container exposing services and framework APIs.
  • Service key: the name used to resolve a capability from a context.
  • Child context: a context derived without mutating its parent.
  • Isolation label: the symbol selecting a service scope for isolate.
  • Effect: lifecycle-associated work with cleanup.
  • Waterfall: an around-middleware event mode where next() delegates.

Frequently asked questions

Does isolate affect every service?

No. It creates an independent scope for the named service.

Does a child context mutate its parent?

The documented extend, isolate, and intercept operations create children without mutating the parent.

Is a service scope a process sandbox?

The Context reference describes service resolution, not a process security guarantee.

Sources

Every claim in this article was checked against the sources below. Community discussions are user reports, not official behavior.

  1. Context reference
  2. Cordis primer

This is an independent community article, not official DeepSeek documentation. Listing a plugin in the registry is not a security review.

← Back to all articles

DeepSeek Harness: Cordis Context Capabilities