Skip to main content

Module blackboard

Module blackboard 

Source
Expand description

Q42 Semantic Blackboard & Constraint Context — plan §7.3 A5.

Observable state channels on Q42 CRDT graphs with pinned hard/soft constraint propagation. The blackboard provides:

  • Channels: named observable state channels backed by the Q42 graph.
  • Constraints: hard (must-hold) and soft (preferably-hold) constraints that propagate to downstream consumers.
  • Pinning: constraints can be pinned to a root context, ensuring downstream DAG nodes inherit and enforce them.
  • Subscription: consumers can subscribe to channel updates and receive notifications when state changes.
  • CRDT integration: uses the existing NQuin 48-byte structure and Lamport clock for ordering.

§Design

The blackboard is a zero-heap hot-path structure. Channel writes and constraint checks do not allocate. Subscription notifications use the existing broadcast channel pattern from daemon_graph.rs.

Constraints are encoded as NQuin entries with specific opcodes:

  • OP_CONSTRAINT_HARD (0x40): hard constraint — violation aborts.
  • OP_CONSTRAINT_SOFT (0x41): soft constraint — violation warns.
  • OP_CONSTRAINT_PIN (0x42): pinned root constraint — inherited by downstream.

Structs§

BlackboardBus
A bus connecting DAG nodes to a SemanticBlackboard.
Channel
A named observable state channel on the blackboard.
Constraint
A constraint on a blackboard channel.
ConstraintViolation
A constraint violation detected during checking.
SemanticBlackboard
The semantic blackboard — a collection of observable channels with constraint propagation.

Constants§

MAX_CHANNELS
Maximum number of channels per blackboard.
MAX_CONSTRAINTS_PER_CHANNEL
Maximum number of constraints per channel.
MAX_SUBSCRIBERS_PER_CHANNEL
Maximum number of subscribers per channel.
OP_CONSTRAINT_HARD
Hard constraint opcode — violation aborts the operation.
OP_CONSTRAINT_PIN
Pinned root constraint opcode — inherited by downstream DAG nodes.
OP_CONSTRAINT_SOFT
Soft constraint opcode — violation produces a warning but continues.