LAYER 02 · Learn the composition grammar

Services and events: separate capability from cooperation

Services answer who can act; events answer when others may participate

17 min3 source anchorsupstream@47f9438
service = capability · event = extension point
The question this chapter resolves

When should you call ctx.fs, and when should you listen to fs/write-intent?

Build intuition

A radiology department is a service with a clear interface and active provider. A pre-op review is an event where multiple specialties participate, observe, or alter a decision.

MECHANISM

Mechanism

Services suit capabilities with identity, methods, and replaceable implementations. Events suit cross-cutting policy, observation, and waterfall transformation.

DeepSeek Harness distinguishes durable SessionEvents, live agent/* events, and capability events. Choosing the wrong domain corrupts replay or loses control semantics.

Step 1 of 4

Declare contract

Services define methods; events define payload and dispatch mode.

INVARIANTS

What extensions must preserve

  • Waterfall listeners delegate only by calling next()
  • There is one authoritative final fact
  • Durable event payloads must be lossless JSON
FAILURE MODES

The tempting wrong turns

  • ×Implementing return-value capabilities with broadcast events
  • ×Mutating state inside an observation event
  • ×Letting observer exceptions escape an authoritative dispatcher
VERIFY IN SOURCE

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.

KNOWLEDGE CHECK

Pause for ten seconds before revealing

Why is approval a waterfall instead of a broadcast?

Why the next chapter follows

Next we add scope: how the same service and event protocol can resolve differently in different agent worlds.

Learn DeepSeek Harness

An independent learning project. Explanations derive from source; upstream remains authoritative.