# DS scope: what the language is for

The domain DS serves, the patterns it makes first-class, and
the things it deliberately doesn't try to do. Everything else
in the spec is in service of this scope.

DS is a language with Rete-based semantics. The language spec
is abstract: it specifies what DS does rather than how a
runtime implements it, so integrators have a fixed contract to
write rules against. Two official runtimes implement it, libds
and the Mercury runtime, and they move in lockstep.

**DS is not a general-purpose production-system language.**
It makes first-class a narrow slice of Rete-based pattern
matching, extends it with orchestration primitives the domain
needs, and deliberately omits the rest. This doc is where
that cut is drawn.

## What this is not

- Not a feature list. Features live in the per-topic specs.
- Not a performance benchmark. Sizing below is design target,
  not measured result.
- Not marketing. This is an engineering scope — it exists to
  say no to features, not to sell the language.

---

(LSCO-1)=
## The domain [LSCO.1]

(LSCO-1-13)=
[LSCO.1.13] The language's official name is **Desert Sage**, and `DS` is its
short form. This specification says `DS`.

(LSCO-1-1)=
[LSCO.1.1] DS is a rule language for **reactive orchestration over a
bounded fact base**.

(LSCO-1-2)=
[LSCO.1.2] In a sentence: when state changes or events arrive in a system
composed of heterogeneous parts, DS encodes the policies that
decide what to do about them — in a form humans can read,
test, debug, and change without redeploying.

(LSCO-1-3)=
[LSCO.1.3] The domain has five observable properties:

(LSCO-1-4)=
1. [LSCO.1.4] **Inputs arrive as discrete events or state changes.** A
   detector produces a detection fact; a sensor's state
   changes; a scheduled time arrives; an external system
   publishes an update. DS's working memory is the total of
   these facts at any instant.

(LSCO-1-5)=
2. [LSCO.1.5] **The fact surface is bounded and schema-declared.** At
   any instant there are hundreds to thousands of live
   facts, not millions. The schema set is finite and known
   at compile time (modulo adapter-driven discovery). DS
   assumes this bound; it does not scale to unbounded-fact
   or unbounded-schema workloads.

(LSCO-1-6)=
3. [LSCO.1.6] **Decisions compose multiple inputs with temporal
   structure.** "Person detected at the door in the last
   5 seconds AND it's after sunset AND nobody is home."
   Single-fact triggers are the degenerate case; the
   interesting work is multi-fact correlation.

(LSCO-1-7)=
4. [LSCO.1.7] **Outputs are actions on other systems, not primary
   computation.** DS dispatches calls, publishes facts,
   writes cache keys, records events. It does not transform
   data as its main job. Computation happens in rules as a
   means to decide; it is not the output.

(LSCO-1-8)=
5. [LSCO.1.8] **Policies change more often than engine code.** The
   rules are the configuration. They are edited, reloaded,
   versioned. The engine doesn't change when the policies
   do. Reloadability and human legibility are spec
   concerns, not afterthoughts.

(LSCO-1-9)=
[LSCO.1.9] Two concrete use cases sit squarely inside this domain:

(LSCO-1-10)=
- [LSCO.1.10] **Detection scheduling.** Cameras emit detections; rules
  decide which detectors to run next, at what rate, on which
  frames, on which sources. Temporal, reactive, bounded.

(LSCO-1-11)=
- [LSCO.1.11] **Home automation.** Sensors change state; HA / MQTT /
  weather data flows in; rules decide which lights to turn
  on, which notifications to send, when to pre-heat, etc.
  Temporal, reactive, bounded.

(LSCO-1-12)=
[LSCO.1.12] Both collapse to the same shape: bounded facts in, policy
decisions out, with temporal structure and multi-source
correlation in the middle. DS is for that shape — not
specifically for either use case.

---

(LSCO-2)=
## What DS is specifically good at [LSCO.2]

(LSCO-2-1)=
[LSCO.2.1] The language makes the following patterns first-class. Each
one costs something in the grammar or semantics surface; each
one is there because it's core to the domain.

*ratified*

(LSCO-2-2)=
### Reactive, temporal decisions [LSCO.2.2]

(LSCO-2-2-1)=
[LSCO.2.2.1] Rules fire when conditions become true, not when an
imperative trigger is invoked. Conditions include temporal
structure: *within* a recent window, *for* a minimum
duration, *after* a delay, with *cooldown* between firings.

*ratified*

(LSCO-2-2-2)=
[LSCO.2.2.2] The language doesn't need to say "check every minute";
temporal reasoning is built in, and determinism makes the
behaviour legible and testable.

(LSCO-2-3)=
### Multi-source correlation [LSCO.2.3]

(LSCO-2-3-1)=
[LSCO.2.3.1] Rules match on combinations of facts from independent
sources, joining on shared attributes or temporal proximity.
The Rete network makes this efficient at the scale DS
targets; every pattern is `schema where …` regardless of
which adapter owns the schema ([LADP.3.1]), so joining
across adapters needs no special form.

*ratified*  —  *see also:* [LADP.3.1](#LADP-3-1)

(LSCO-2-3-2)=
[LSCO.2.3.2] Three independent fact sources; one decision.

(LSCO-2-4)=
### Derived state with truth maintenance [LSCO.2.4]

(LSCO-2-4-1)=
[LSCO.2.4.1] Logical facts let rules encode "X is true as long as Y
matches" — state that appears and disappears as its
justification comes and goes. This is the right primitive
for derived concepts (occupancy, alert states, modes) that
aren't directly emitted by any adapter but fall out of rule
combinations.

(LSCO-2-4-2)=
[LSCO.2.4.2] Downstream rules match `QuietHouse` without knowing how it
was derived.

(LSCO-2-5)=
### Bounded, observable, replayable execution [LSCO.2.5]

(LSCO-2-5-1)=
[LSCO.2.5.1] DS is deterministic under fixed inputs (per
[LDET]), fully testable (per
[LTES]), and fully debuggable (per
[LDEB]). These are operational
affordances — "I can understand what my rules are doing, and
I can prove they still do it after I change them." For a
policy engine whose rules are the configuration, these are
not luxuries; they're what makes the whole exercise
sustainable.

(LSCO-2-6)=
### Policy-as-code authored by domain experts [LSCO.2.6]

(LSCO-2-6-1)=
[LSCO.2.6.1] The rule surface is narrow and declarative. Someone who
understands the domain (home automation, video analytics,
alerting) can learn to write rules without being a software
engineer. The author expresses *what is true* and *what
should happen*, not *how to iterate*.

(LSCO-2-6-2)=
[LSCO.2.6.2] This is the biggest single "not a programming language"
decision. A general production-system engine can be
programmed like a scripting language; DS cannot.

(LSCO-2-7)=
### Bounded external effects [LSCO.2.7]

(LSCO-2-7-1)=
[LSCO.2.7.1] Every side effect (`call`, `emit`, `cache-set`,
`record-event`, `log`) is explicit, cooldown-gated,
and observable. The language does not provide a way to
"do something to the outside world" that bypasses this
surface. Rate discipline and observability are built into the
language, not bolted onto the engine.

---

(LSCO-3)=
## What DS is not for [LSCO.3]

(LSCO-3-1)=
[LSCO.3.1] The scope is narrow. The following are outside it — not
because they're bad problems, but because DS is deliberately
not the right tool.

*ratified*

(LSCO-3-2)=
### Not a general-purpose programming language [LSCO.3.2]

(LSCO-3-2-1)=
[LSCO.3.2.1] A DS program is a set of declarations ([LGRA.3.1]). Rules are
the part that acts: a rule fires on the facts it matches, and acts through typed
actions ([LSCO.2.7.1]). An expression is strongly typed and side-effect-free,
and every call in one resolves to a built-in or a `unit formula`'s function
([LGRA.9.8.11]).

*see also:* [LGRA.3.1](#LGRA-3-1), [LGRA.9.8.11](#LGRA-9-8-11), [LSCO.2.7.1](#LSCO-2-7-1)

(LSCO-3-2-2)=
[LSCO.3.2.2] If you reach for "I just need a small helper function," you
are outside the scope. Either (a) the helper belongs in an
adapter (called via `call`), or (b) the rule is doing
too much. Rule refactoring, not function definition, is the
right move.

(LSCO-3-3)=
### Not a data-processing pipeline [LSCO.3.3]

(LSCO-3-3-1)=
[LSCO.3.3.1] DS is not Spark, Flink, Kafka Streams, Beam, or Pandas. Its
working memory holds hundreds to thousands of facts, not
millions of records. Its aggregations are over bounded
in-memory backings picked from the catalogue at
[LSER.18.1],
not over historical datasets. Its storage planes (events,
samples, cache) exist for policy support, not for analytics.

*see also:* [LSER.18.1](#LSER-18-1)

(LSCO-3-3-2)=
[LSCO.3.3.2] If your problem is "compute a summary statistic over 10B
rows," use a data tool. DS can read a *result* of that
computation as a fact, but it does not do the computation.

(LSCO-3-4)=
### Not a database or query language [LSCO.3.4]

(LSCO-3-4-1)=
[LSCO.3.4.1] Rules reason over what is in working memory.

(LSCO-3-4-2)=
[LSCO.3.4.2] If your problem is "ad-hoc report across years of data," use
a database. DS reaches for the result via `call`.

(LSCO-3-5)=
### Not an unbounded complex-event-processing (CEP) engine [LSCO.3.5]

(LSCO-3-5-1)=
[LSCO.3.5.1] DS has temporal primitives (`within`, `dwell`, `after`,
`window`) that cover common reactive patterns. It does not
have a general CEP pattern language (Esper-style
`A → B → C within t` sequence automata, nested event
patterns with arbitrary temporal operators, Allen-interval
algebra).

(LSCO-3-5-2)=
[LSCO.3.5.2] If your problem genuinely needs "match this complex
temporal sequence over an unbounded event stream with
sub-millisecond latency," use Esper or Flink's CEP. DS's
temporal surface is for the patterns that come up in
orchestration, not every imaginable temporal query.

(LSCO-3-6)=
### Not an ML inference engine [LSCO.3.6]

(LSCO-3-6-1)=
[LSCO.3.6.1] DS orchestrates ML inference — deciding which detector to
run, when to fetch a prediction, how to react to a
classification — but DS itself runs no models. Inference
happens in adapters. The rule triggers the inference
via `call`; the result returns as a fact of the service's response schema.

(LSCO-3-6-2)=
[LSCO.3.6.2] If your problem is "run a model on a batch of inputs," use
an inference server. DS schedules and reacts; it does not
infer.

(LSCO-3-7)=
### Not a long-running stateful workflow engine [LSCO.3.7]

(LSCO-3-7-1)=
[LSCO.3.7.1] DS is not Airflow, Temporal, Cadence, Step Functions, or
any other workflow orchestrator. Rules fire in microseconds
to milliseconds; timed continuations (`after`) cover seconds
to hours. Workflows that span days with dozens of manual
approval steps, complex compensation logic, and
human-in-the-loop retries are not a DS problem.

(LSCO-3-7-2)=
[LSCO.3.7.2] If your problem is "multi-day business process with branching
and approvals," use a workflow engine. DS orchestrates
moment-by-moment; workflow engines orchestrate over
long horizons.

(LSCO-3-8)=
### Not a scripting language [LSCO.3.8]

(LSCO-3-8-1)=
[LSCO.3.8.1] DS cannot manipulate strings, parse files, shell out, fetch
URLs, read the filesystem, or generate random numbers
outside seeded contexts. Everything external happens via
adapters. Rule authors cannot reach around the adapter
contract.

(LSCO-3-8-2)=
[LSCO.3.8.2] If your problem requires ad-hoc programmatic flexibility,
write an adapter. The language deliberately refuses to
grow into a scripting tool.

(LSCO-3-9)=
### Not a "small amount of procedural code on the side" [LSCO.3.9]

(LSCO-3-9-1)=
[LSCO.3.9.1] DS resists growing imperative escape hatches.
Where an imperative shape is needed, the base language
already carries it: per-fact supersedure on `after as`
([LRST.2.2]), and activation-bound fact lifetimes as
`scope activation` ([LSCP.3]). A queue is not
provided — use the WorkItem decoupling pattern, or buffer
adapter-side. If those primitives aren't enough, the right
fix is an adapter that exposes the behaviour as a callable
service — not new procedural primitives in DS.

*see also:* [LRST.2.2](#LRST-2-2), [LSCP.3](#LSCP-3)

(LSCO-3-10)=
### Not a safety-critical or hard-real-time decisioning layer [LSCO.3.10]

(LSCO-3-10-1)=
[LSCO.3.10.1] Firing
order is the spec-defined total order of [LDET.5.1] and the only
author control over it is where a rule is written. If a decision
needs tighter latency guarantees than "fires in a spec-defined
order on the same engine cycle" — sub-millisecond response,
kernel preemption, hard real-time scheduling, life-safety
assurance — it belongs in a PLC, an RTOS, or a kernel-level
control path, not in DS. The rule-engine execution model has
latency floors that come from Rete matching, working-memory
maintenance, and observable cycle boundaries; those floors are
fine for home-automation and operational policy but inappropriate
for emergency-facing control.

---

*see also:* [LDET.5.1](#LDET-5-1)

(LSCO-4)=
## DS is a deliberately narrow language [LSCO.4]

(LSCO-4-1)=
[LSCO.4.1] Our reference runtime is the native C Rete engine. Integrators
take it as-is and build platforms around it; see
[NDLC] for how an integrator
shapes the language to their platform's needs.

*ratified*

(LSCO-4-2)=
[LSCO.4.2] The language spec describes Rete semantics abstractly (per
[LDET.1] and the truth-maintenance contract in [LLOG.1]). The
abstraction exists so rule authors and integrators have a stable
contract as the runtime evolves.

*ratified*  —  *see also:* [LDET.1](#LDET-1), [LLOG.1](#LLOG-1)

(LSCO-4-3)=
[LSCO.4.3] What matters for this scope doc is the surface: **DS is not a
general-purpose rule language.** What rule authors see is
deliberately narrow, typed, declarative, and testable — a
policy surface, not a programming language.

(LSCO-4-4)=
### The Rete-based core [LSCO.4.4]

(LSCO-4-4-1)=
[LSCO.4.4.1] The Rete machinery and the semantics that follow from it:

(LSCO-4-4-2)=
- [LSCO.4.4.2] Pattern matching over fact templates (schemas).

(LSCO-4-4-3)=
- [LSCO.4.4.3] Forward chaining with refraction.

(LSCO-4-4-4)=
- [LSCO.4.4.4] Truth maintenance via the `logical` conditional element.

(LSCO-4-4-5)=
- [LSCO.4.4.5] Multi-justifier coalescence under `logical`.

(LSCO-4-4-6)=
- [LSCO.4.4.6] Conflict resolution (a spec-defined total
  order with no author-facing strategy — see [LDET]; the only author control is where the rule
  is written).

(LSCO-4-4-7)=
- [LSCO.4.4.7] Working-memory-as-fact-store; fact assertion and
  retraction as the reactive substrate.

(LSCO-4-4-8)=
- [LSCO.4.4.8] Per-tier compilation units (one engine instance per tier).

(LSCO-4-5)=
### How facts enter and leave working memory [LSCO.4.5]

(LSCO-4-5-9)=
- [LSCO.4.5.9] **Assertion and retraction.** Facts are schema-typed; assertion is
  through `emit`; retraction is via TTL,
  meaningful-change, `logical` justifier-end, or `withdraw`.

  **A rule retracts a fact only by `withdraw`, and only one it matched:**

  - A rule that matches fact X and removes X in its RHS creates the same
    oscillation risk as a rule that emits X — the removal of X can let
    the rule fire again, re-establishing the very condition that
    triggers it. `[LCYC.3.1.1]` admits exactly the shapes that cannot:
    a rule that only matches and withdraws X, never also emits it
    within the same cycle. A rule pair that matches this clause's own
    oscillation risk — one rule re-emitting what another withdraws,
    in one cycle — remains rejected under `[LCYC.3.1.1]`, not merely
    warned about.
  - Retraction in rules violates the declarative model unless it is
    consumption: `withdraw` acts only on a binding the rule itself
    matched, stating "the fact I read is now spent," not an arbitrary
    imperative delete. Rules that do not consume stay idempotent and
    order-independent; `withdraw` creates execution-order dependence
    only where a rule's own semantics already are order-dependent (it
    consumed something).
  - The sanctioned retraction mechanisms:
      1. **TTL expiry** — size the schema's `ttl` to the
         desired lifetime. The engine retracts when the
         deadline passes.
      2. **Meaningful-change / tolerance dedup** — an
         identical (or within-tolerance) reassertion is a
         no-op; the existing fact is not replaced.
      3. **Truth-maintenance on `emit X logical`**
         — the engine retracts X when the LHS patterns
         that justified it are no longer matched ([LLOG.15.1]).
         This is the `logical` schema retraction path.
      4. **`withdraw <binding>`, `scope explicit` or `internal`
         only** ([LSCP.2.6.1]) — a rule consumes a fact it matched. Admitted only where
         `[LCYC.3.1.1]`'s certificate accepts the resulting rule
         graph. A binding of any other scope is a compile refusal,
         `DS_VALIDATE_WITHDRAW_SCOPE`: `[LLOG.11.8]` for `logical`;
         `activation` and `ambient` are engine-managed and
         author-read-only respectively, neither an author's to end.

*checks:* `idris×5`  —  *see also:* [LSCP.2.6.1](#LSCP-2-6-1), [LCYC.3.1.1](#LCYC-3-1-1), [LLOG.11.8](#LLOG-11-8), [LLOG.15.1](#LLOG-15-1)

(LSCO-4-5-10)=
- [LSCO.4.5.10] **Every fact has a declared schema.**

(LSCO-4-6)=
### What DS narrows [LSCO.4.6]

(LSCO-4-6-1)=
[LSCO.4.6.1] Kept but narrowed:

(LSCO-4-6-2)=
- [LSCO.4.6.2] **Rule priority** — raw salience is arbitrary integers
  and invites a numeric arms race; DS exposes **no priority
  mechanism**, and orders rules by where they are written
  ([LDET.5.4]).

*see also:* [LDET.5.4](#LDET-5-4)

(LSCO-4-6-3)=
- [LSCO.4.6.3] **Pattern language** — a general Rete supports arbitrary
  pattern CEs; DS is a restricted subset, and an adapter's facts are
  matched by the same `schema where …` form as any other
  ([LADP.3.1]).

*see also:* [LADP.3.1](#LADP-3-1)

(LSCO-4-6-4)=
- [LSCO.4.6.4] **Expression language** — a general engine lets any
  function appear in a test; DS is a closed grammar
  (arithmetic, comparison chains, math built-ins, distance
  functions, dwell/timestamp aliases) plus the specific
  primitives the language commits to.

(LSCO-4-6-5)=
- [LSCO.4.6.5] **Action surface** — a general engine lets the RHS be
  arbitrary code; DS RHS is a flat sequence of typed actions
  (`call`, `emit`, `cache-set`, `record-event`,
  `log`, and the explicit few others).

(LSCO-4-6-6)=
- [LSCO.4.6.6] **Module semantics** — DS uses per-tier compilation units
  internally but authors don't write module directives
  directly.

(LSCO-4-7)=
### What DS adds [LSCO.4.7]

(LSCO-4-7-1)=
[LSCO.4.7.1] Orchestration-domain capabilities a bare Rete engine
doesn't provide:

(LSCO-4-7-2)=
- [LSCO.4.7.2] **Tier model** for cross-process fact flow with TTL and
  cross-tier logical semantics.

(LSCO-4-7-3)=
- [LSCO.4.7.3] **Storage planes** (events, samples, cache) with typed
  contracts.

(LSCO-4-7-4)=
- [LSCO.4.7.4] **Adapter contract** for external systems.

(LSCO-4-7-5)=
- [LSCO.4.7.5] **Async `call` with response-as-fact and typed response
  schemas.**

(LSCO-4-7-6)=
- [LSCO.4.7.6] **Series aggregations** declared as observation triples
  (aggregation × time-model × accuracy); compiler picks
  backings from the storage matrix.

(LSCO-4-7-7)=
- [LSCO.4.7.7] **Distance / similarity primitives.**

(LSCO-4-7-8)=
- [LSCO.4.7.8] **Typed string interpolation** in action arguments.

(LSCO-4-7-9)=
- [LSCO.4.7.9] **Deterministic-clock contract** and tick-driven
  re-evaluation of time-bound tests.

(LSCO-4-7-10)=
- [LSCO.4.7.10] **Testability contract** (adapter mocks, event traces,
  introspection, conformance suite).

(LSCO-4-7-11)=
- [LSCO.4.7.11] **Debuggability contract** (Rete introspection in author
  terms, time-travel replay, breakpoints).

(LSCO-4-7-12)=
- [LSCO.4.7.12] **The author-facing test surface**, `.dstest` ([LTSL.2]) — a
  separate file type rather than a capability. The imperative-shaped surface
  the language has — activation-scoped facts and per-fact supersedure on
  `after as <expr>` — sits in the base language per [LSCP.3] and [LRST.2.2].

*see also:* [LRST.2.2](#LRST-2-2), [LSCP.3](#LSCP-3), [LTSL.2](#LTSL-2)

(LSCO-4-7-13)=
[LSCO.4.7.13] These additions are what a policy-engine-over-bounded-facts
needs that a bare general-purpose rule engine doesn't provide.

---

(LSCO-5)=
## Sizing expectations [LSCO.5]

(LSCO-5-1)=
[LSCO.5.1] Orders-of-magnitude targets. Real deployments can sit inside
or outside these; the language is designed for these and is
not expected to scale gracefully outside them.

| Dimension | Typical | Upper end of design target |
|---|---|---|
| Live facts in working memory | 100_s – 1,000_s | ~10,000 |
| Rules per tier | 10_s – 100_s | ~1,000 |
| Fact assertion rate | 10_s / second | ~1,000 / second at the high-frequency end |
| Rule-fire rate | 1_s – 100_s / second | ~10,000 / second peak |
| Cache entries | 10_s – 100_s | ~10,000 |
| Sampled series | 10_s | ~100 |
| Events persisted / day | 1,000_s – 100,000_s | ~10M |
| Adapters (bridges + services) | 5 – 20 | ~50 |
| Tiers | 1 – 3 | ~5 |
| Rule-fire latency budget | ≤ 1 ms typical | ≤ 100 µs at the tightest |

(LSCO-5-2)=
[LSCO.5.2] A deployment two orders of magnitude above these is probably
outside DS's scope — either the wrong tool for the job, or a
sign the rule set is doing work it shouldn't.

---

(LSCO-6)=
## When to reach for something else [LSCO.6]

| If you need | DS is not it. Reach for |
|---|---|
| SQL over years of history | a database; DS can call into it |
| Streaming analytics on high-volume data | Flink / Spark / Kafka Streams; DS reacts to their output |
| Running an ML model | an inference server; DS orchestrates via `call` |
| Long-running human-in-the-loop workflow | Temporal / Airflow; DS handles the moment, not the day |
| Arbitrary scripting glue | Python / Bash; DS refuses to become scripting |
| Full CEP pattern language | Esper; DS's temporal surface is pragmatic, not general |
| General-purpose rule engine with imperative extensibility | a general-purpose production-system shell; DS deliberately narrows it |
| Visual flow-based programming | Node-RED / HA automations UI; DS is text, composable, testable |

(LSCO-6-1)=
[LSCO.6.1] DS plays well with every tool in the right column — call
into them, react to their outputs as facts, emit facts they
can consume. The language's job is orchestration between
them; it does not try to be them.

---

(LSCO-7)=
## Consequences this scope has for the spec [LSCO.7]

(LSCO-7-1)=
[LSCO.7.1] Everything in the language spec follows from the scope
above. A few specific consequences worth calling out:

(LSCO-7-2)=
- [LSCO.7.2] **The grammar stays small.** Every call in an expression is to a
  built-in or a `unit formula`'s function ([LGRA.9.8.11]).

*see also:* [LGRA.9.8.11](#LGRA-9-8-11)

(LSCO-7-3)=
- [LSCO.7.3] **Every feature earns its surface.** The comparison is
  against not having a feature at all, never against making it
  optional. If a feature does not serve reactive orchestration over
  bounded facts, it does not ship.

(LSCO-7-4)=
- [LSCO.7.4] **Determinism is free at this scale.** At DS sizing,
  strict deterministic-order rule fire has negligible cost;
  at data-pipeline scale it would require relaxation. The
  guarantee holds because the language is sized for the former.

(LSCO-7-5)=
- [LSCO.7.5] **Testability and debuggability are achievable.** A
  working memory of thousands of facts can be fully
  introspected; a working memory of billions cannot. The
  sizing targets are what make the observability contracts
  realistic.

(LSCO-7-6)=
- [LSCO.7.6] **Policy reloadability is expected.** Rule-file compile +
  swap must be fast enough to be part of the normal
  operational loop, not a deploy event. The reference
  runtime's hot-reload path is load-bearing.

(LSCO-7-7)=
- [LSCO.7.7] **Humans read rules.** The Python-flavoured expression
  syntax, the closed set of callable names, the typed schemas — all of
  this is for legibility. DS rules are meant to be read aloud.

---

(LSCO-8)=
## Scope commitments [LSCO.8]

(LSCO-8-1)=
- [LSCO.8.1] **DS is a language for reactive orchestration over a
  bounded fact base.** Not a general-purpose language, not
  a data-processing tool, not a workflow engine, not a CEP
  system.

(LSCO-8-2)=
- [LSCO.8.2] **The reference runtime is the native C Rete engine.**
  The language spec abstracts over Rete semantics so the contract stays
  stable while the runtime evolves. DS ships one runtime; integrators
  take it as-is and build platforms around it. Shaping the runtime to a
  specific platform is a first-class concern ([LDIA]).
  Restates [LSCO.4.1].

*see also:* [LSCO.4.1](#LSCO-4-1)

(LSCO-8-3)=
- [LSCO.8.3] **DS is a deliberately narrow language.** A narrow
  slice of Rete-based patterns, extended with orchestration-
  specific primitives, minus everything that would turn it
  into a scripting language. Authors write policy, not programs.

(LSCO-8-4)=
- [LSCO.8.4] **Rule authors write rules** ([LSCO.3.2.1]). The compiler must
  refuse a top-level form [LGRA.3.1] does not admit.
  Everything computed happens in expressions (typed, closed
  grammar) or action arguments (typed, closed grammar).
  Reaching for "a small helper" is outside the scope.

*ratified*  —  *see also:* [LGRA.3.1](#LGRA-3-1), [LSCO.3.2.1](#LSCO-3-2-1)

(LSCO-8-5)=
- [LSCO.8.5] **Side effects are narrow and explicit.** Every external
  interaction is a typed action (`call`, `emit`, etc.)
  through the adapter / storage / cache contracts. No escape
  hatches.

(LSCO-8-6)=
- [LSCO.8.6] **Policies change more often than engine code.** Hot
  reload of rule files is a first-class runtime expectation,
  not a convenience.

(LSCO-8-7)=
- [LSCO.8.7] **Sizing targets are thousands-of-facts, thousands-of-
  rules, sub-ms rule fire.** Two orders of magnitude above
  that, DS is not the right tool. The guarantees
  (determinism, testability, debuggability) depend on these
  sizing assumptions.

(LSCO-8-8)=
- [LSCO.8.8] **The five scope properties** (discrete events, bounded
  fact surface, multi-source temporal decisions, outputs-as-
  actions-on-other-systems, policies-change-more-than-code)
  are the lens every future feature proposal gets measured
  against. A proposal that doesn't serve one of them is a
  scope expansion that needs explicit justification.

(LSCO-9)=
## Scope boundaries [LSCO.9]

(LSCO-9-4)=
4. [LSCO.9.4] **Single-site scope.** DS orchestrates one site.
   Cross-site federation is a separate architectural concern and
   is out of scope for the language.

