Skip to content

Latest commit

 

History

History
269 lines (157 loc) · 29.7 KB

CONCEPTS.md

File metadata and controls

269 lines (157 loc) · 29.7 KB

Concepts — SPOKE Domain Vocabulary

Core terms for the SPOKE protocol repository. Each entry defines what the term means in SPOKE wire form.

Product name: SPOKE = Standardized Programmable Ontology Knowledge Engine.


Protocol layer

KnowledgeEntry

The atomic Knowledge Base entry on the SPOKE wire (L0–L1). A KnowledgeEntry has stable identity (entry_id), open-string entry_type and status, a closed structured body (optional summary, tags, attributes[], and under l2-computable optional state / computable maps), optional provenance (source_anchor), and required extensions. Core status vocabulary: provisional, confirmed, deprecated, merged, deleted — transitions enforced by @42ch/spoke-operations / spoke-operations; deprecated → merged is excluded (restore to confirmed before absorb).

Relation

A directed edge between two KnowledgeEntries (or KnowledgeEntry ↔ source) identified by relation_id and open-string relation_type. Optionally carries revision (integer ≥ 0) for optimistic concurrency control, at parity with KnowledgeEntry.

SourceAnchor

A pointer to a source artifact span (manuscript, scene, external locator). Ties KnowledgeEntries and Findings to provenance without embedding product file paths in protocol fields.

Finding

Checker output — consistency, style, structure, or other analysis results. Not a KnowledgeEntry body and not a declarative rule definition.

Rule

Declarative constraint input to check (L6). First-class wire object — schemas/data/rule.schema.json + field tables in spoke-data-model.md. Distinct from Finding (checker output) and from KnowledgeEntry entry_type strings used as ontology labels.

TimelineEvent

First-class when-axis temporal object (L5) — schemas/data/timeline-event.schema.json + field tables in spoke-data-model.md. Optional timeline_scale tags the L5 projection tier (brief, narrative, moment). Distinct from KnowledgeEntry entry_type: "event" (ontology label on a KB entry body).

TimelineScale

L5 Timeline projection tier vocabulary on the wire: core values brief, narrative, moment (open string). Field name timeline_scale on TimelineEvent and optional Scope filters.

Scope

Shared ops selector for check and assemble. Required scope_id (protocol-neutral opaque string) plus optional refinements (entry_ids, entry_types, timeline_event_ids, source_id, timeline_scale, fork_id, viewpoint under ke-ownership, cognition under spoke-cognition, extensions). Optional extensions carries product-scoped query metadata; protocol matchers ignore it. Product-local scope ids map via op extensions, Scope.extensions, or adapters — not required Scope fields. fork_id matches TimelineEvent.fork_id by strict equality (l5-fork); events without fork_id do not match.

Domain Profile

How an integrator publishes ontology vocabulary without closing core protocol enums. Open entry_type strings + published vocabulary tables in adapter specs — not closed enum in core schemas. See spoke-protocol-layers.md. Tracked profile handbooks: narrative-structure / Beat mapping — domain-profile-narrative-structure.md; lore-activation (modules.activation) — domain-profile-lore-activation.md; mental-state (modules.cognition / modules.mental / modules.observation) — domain-profile-mental-state.md.

spoke-baseline

Declared capability level for spoke-baseline SPOKE compliance: L0–L8 semantics per spoke-protocol-layers.md §Baseline — excludes required Fork (l5-fork) and L2 computable state (l2-computable). Baseline adapters implement six port families including HostManifestPort per spoke-operations.md.

HostCapabilityManifest

Wire object (schemas/data/host-capability-manifest.schema.json) advertising a host's host_id, roles, capabilities, and owned extensions namespaces. Distinct from KnowledgeEntry — host metadata MUST NOT be required inside KnowledgeEntry.extensions.<ns>. Field tables: spoke-data-model.md §HostCapabilityManifest.

HostManifestPort

Baseline-required adapter port: getHostCapabilityManifest / listPeerHostCapabilityManifests (Rust: get_host_capability_manifest / list_peer_host_capability_manifests). Peer list excludes self, dedupes by host_id, sorts ascending by host_id. See spoke-operations.md §Host collaboration.

ToolDescriptor

A wire descriptor (schemas/data/tool-descriptor.schema.json) declaring the ABI of one remote-invokable tool. A manifest that exposes tools carries its descriptors in HostCapabilityManifest.tools[]; each descriptor's capability_id — the tools.<ns>.<tool_id> string — also appears in the same manifest's capabilities[], and the namespace derived from the capability id is a member of the manifest's namespaces[]. The descriptor pairs op with the same string as capability_id, carries a description, and declares input / output as JSON Schema draft-07 subschema objects, where {} declares an unconstrained ABI. idempotent is optional metadata. Field tables: spoke-data-model.md §HostCapabilityManifest.

Tool capability id

The tools.<ns>.<tool_id> string that names one tool and gates its dispatch. ns matches the manifest namespace pattern and is a member of the declaring manifest's namespaces[]; tool_id is an open-ended lowercase token (^[a-z0-9][a-z0-9_-]*$). The capability id is the op string for the tool and the required capability for dispatching the invoke; it enters negotiated_capabilities when both session hellos list that exact string. Grammar and gate: spoke-connect.md §Op dispatch gate.

Host role

Open string in HostCapabilityManifest.roles[]. Core vocabulary: data-store (single OCC write authority), input-source, checker, assembler (closed-loop assemble; core vocabulary), computable-engine (optional; pairs with l2-computable).

l2-computable

Optional capability flag: body.state + body.computable on KnowledgeEntry, optional computable_logs on Moment-scale TimelineEvents, and optional project / compute op families. Session lifecycle is normative prose + op session_id correlation — not a durable Session wire object or entry_type.

Session (computable lifecycle)

Protocol lifecycle binding static body.state to temporary body.computable projection. Not an ontology label, not a required KnowledgeEntry, not a top-level schema. Products own Session stores; SPOKE documents init → mutate computable only → settle invariants.

ComputableFieldMap

Open JSON object (additionalProperties: true) shared by body.state and body.computable. Domain field names and values are product-owned; protocol does not embed WASM bytecode as required fields.

BodyAttribute

Scalar trait item in body.attributes[] — trait_type (non-empty string) + value (string | number | boolean); optional display_type, max_value. Duplicate trait_type values are allowed in the array. Nested object/array values belong in extensions.<namespace> or as multiple scalar traits. Shared def: common.schema.json#/definitions/BodyAttribute.

ComputableLogEntry

Presentation-only log item on TimelineEvent.computable_logs for Moment-scale computable field history. Distinct from Finding (L7 checker output).

project / compute (ops)

Optional ops under l2-computable. project = init/projection (static state → dynamic computable). compute = apply/settle I/O (computable updates; optional settle: true returns merged state). Products run all engines.

l5-fork

Optional capability flag for world-history branch metadata on TimelineEvent. Not required for spoke-baseline. Declaring l5-fork means a product implements interoperable Fork fields on the L5 when-axis — branch create/merge/rebase engines and stores remain product-owned.

Fork (world-history branch)

Optional L5 branch identity on TimelineEvent under l5-fork via wire fields fork_id and optional parent_fork_id (ForkId in common.schema.json). Distinct from timeline_scale (projection tier), Domain Profile (ontology adapter), Session (l2-computable), and Finding (checker output). Product extensions.<namespace> fork hints are adapter folklore — not the normative Fork interchange. Field tables: spoke-data-model.md §TimelineEvent / §Fork fields.

spoke-cognition

Optional capability family (spoke-cognition, one flag, no subflags) carried by the holder KnowledgeEntry modules.cognition — a closed CognitionModule with records[] (Belief, epistemic knowledge/ignorance/undetermined, Perception) and narrated world_facts[] (schemas/data/cognition.schema.json). Every completed Belief, epistemic or Perception record declares a foundational q for its identified cognitive assertion (holder, target, assessor, basis, criterion where applicable, assessment context, times) and may carry distinct optional metrics. Scope.cognition selects records and builds attribution-preserving projections; Memory Content.cognition carries the recorded-at-time view; MindState remains the derivative temporal view. Declare the flag in HostCapabilityManifest.capabilities only for surfaces whose mandatory rules are implemented; unsupported requirements reject explicitly. Not spoke-baseline. Field tables and procedures: docs/reference/data-model.md.

MindState

First-class L5 temporal record under the optional spoke-cognition capability — a standalone wire object (schemas/data/mind-state.schema.json) on the when-axis, separate from TimelineEvent. Strictly derivative: it presents mental-state changes over time (snapshot via MentalFieldMap; deltas via MindDelta[]; optional cognition via a derivative CognitionProjection), while the holder KnowledgeEntry's modules.cognition / modules.mental remain the authority. Distinct from KnowledgeEntry ontology labels (entry_type: "belief", profile mind) — the same dual-concern separation as TimelineEvent vs entry_type: "event" — and from TimelineEvent (what happened vs the state of a mind over time). Field tables: spoke-data-model.md §MindState; dialect vocabulary: domain-profile-mental-state.md.

MentalFieldMap / MindDelta

Shared definitions (common.schema.json#/definitions/MentalFieldMap, #/definitions/MindDelta) for MindState.snapshot / MindState.deltas[]. MentalFieldMap is an open map of mental-state field names to domain values, matching the modules.mental nine-field vocabulary (settled field vocabulary handbook-defined). MindDelta mirrors ComputableLogChange — { path, previous?, next? } — with path an RFC 6901 JSON Pointer rooted at /modules/mental/<field> (any of the nine fields), /modules/cognition/records/... (derivative standard cognition) or /modules/cognition/world_facts/... (narrated world facts).

modules.cognition / modules.mental / modules.observation

Cross-product functional dialects of the capability-flagged modules bag — triad authority: .agents/specs/extensions/spoke-extension-modules.md. modules.cognition lives on the holder KnowledgeEntry (bag narrative-modules, semantics spoke-cognition) and carries the closed CognitionModule: current holder-side Belief, epistemic and Perception records — each completed record with its mandated q and optional distinct metrics — plus narrated world_facts[], whose records carry neither q nor metrics. modules.mental stays an open nine-field mental vocabulary (identity, beliefs, attention, goals, intentions, emotions, dispositions, norms, constraints); its beliefs member carries derivative summary, count or reference data. modules.observation lives on TimelineEvent.modules (bag narrative-modules, semantics spoke-cognition) and records who could perceive an event plus open perceptual-access constraints; a Perception record describes actual capture. Missing observation metadata and observers: [] stay distinct. Field tables: docs/reference/data-model.md.

AssemblePacket

Wire-only context-assembly payload: a list of slim entries (entry_id, entry_type, canonical_name, optional snippet), required extensions, and optional capability-flagged modules (ModuleMap). Ranking, retrieval, and token budgeting are product-local; see spoke-ops.md §assemble.

Extensions (extensions.<namespace>)

Product-specific bag on durable data objects and ops envelopes. On HostCapabilityManifest, extensions carries deployment metadata only — roles, capabilities, and namespace ownership are core manifest fields. Namespace keys are opaque product / integrator ids. Adapters MUST round-trip unknown namespaces and keys verbatim. Product and adapter data live here; cross-product functional dialects use modules.* — triad authority: .agents/specs/extensions/spoke-extension-modules.md.

Modules (capability-flagged)

Optional ModuleMap on KnowledgeEntry + AssemblePacket + TimelineEvent (event observation); capability-flagged (narrative-modules; spoke-cognition for cognition and event-observation semantics); inner dialect shapes stay handbook-defined. Placement authority: .agents/specs/extensions/spoke-extension-modules.md.

modules.* carries cross-product functional dialects (for example activation, placement, and activation_trace metadata), distinct from product-owned extensions.<namespace>. Absent and empty modules are valid; baseline hosts need not emit or parse the bag unless they declare narrative-modules. Shared functional dialects use modules.*; product bags stay in extensions.<namespace>. Knowledge Pack catalog metadata (title / version / creator) lives on the product transport envelope — not under modules.*.

spoke-knowledge

Optional connect capability flag covering port.knowledge.get, port.knowledge.put, and port.scope.list_knowledge_entries. A declaring host serves these ops through a standalone ScopedKnowledgePort with a per-peer admission policy that maps each authenticated peer to exactly one Scope; the request's scope is a declaration to check, not authority. The flag must appear explicitly in negotiated_capabilities — spoke-baseline alone authorizes only baseline ops and never satisfies it — and capability-token grants for these ops require the same exact membership. Dispatch gate, admission and refusal semantics: spoke-connect.md §Op dispatch gate; serving rows: spoke-operations.md.

spoke-connect

Optional capability flag: a product declaring it implements the connect envelope family (schemas/connect/), per-session ordering, and the noise-peerid auth model documented in spoke-connect.md. Not part of spoke-baseline. Hosts that speak connect SHOULD list spoke-connect in HostCapabilityManifest.capabilities.

Connect envelope family

Six opt-in interaction envelopes in schemas/connect/: ConnectHello (signed manifest exchange), ConnectSession (session context snapshot), ConnectInvokeRequest / ConnectInvokeResponse (remote op call wrapping existing ops envelopes as opaque payload; failure reuses the shared ErrorEnvelope), ConnectAuthChallenge / ConnectAuthResponse (extensible method auth). Closed envelopes with required extensions; hello embeds HostCapabilityManifest by $ref. Normative semantics: spoke-connect.md.

Connect embedding path

How a host language embeds connect session rules. Path A (language-direct) = language-native client — host-language session core, no Rust runtime (exemplar TypeScript @42ch/spoke-connect). Path B (shared core bindings) = native bindings — FFI into a shared session core, exposed through generated bindings or the hand-written C ABI carrier (C# / Kotlin / Swift / Go / Python / C and C++). Rust spoke-connect = Rust reference (session-core reference + Path B uniffi source + libp2p transport), not Path A. Consumer docs use the aliases, not the Path letters. Field table: spoke-connect.md §Embedding model.

Session (connect)

Established cross-process invocation context: session_id, initiator_peer_id / responder_peer_id, opened_at, negotiated_capabilities (MUST include spoke-connect when both hosts declare it), initial_sequence (const 0 for protocol versions 1 and 2). Per-session monotonic sequence ordering with request_id correlation; each peer keeps its own outbound counter. Distinct from Session (computable lifecycle) — the l2-computable projection lifecycle on body.state / body.computable.

peer_id

Opaque network peer identity string on connect envelopes — the trust root for noise-peerid authorization (deployment-configured allowlist). Distinct from host_id (advisory application-host label inside the embedded HostCapabilityManifest): receivers authorize on peer_id + signature, then consume host for roles/capabilities. For protocol_version 1, wire peer_id is the libp2p identity-spec PeerId string for Ed25519 (identity multihash of protobuf PublicKey, base58btc).

capability token (connect)

Short-lived, capability-scoped grant proof carried as the opaque proof on ConnectAuthResponse / ConnectInvokeRequest.auth: a trusted issuer signs {iss, sub, aud, capabilities, exp} over RFC 8785 JCS with Ed25519, and the verifying node accepts only when the signature verifies, iss is in its configured trusted_issuers, subject / audience bind, and expiry holds — offline validation with no revocation list in protocol version 1.


spoke-history

Optional capability family (spoke-history) for revision observability. RevisionSnapshot carries a stored entity's state at one revision — open entity_kind (core values knowledge_entry, relation), entity_id, revision, the snapshot object, extensions — and stored timestamps replay byte-for-byte as stored. Two ops: history.revisions.get replays a stated revision (below the retained floor answers HISTORY_TRUNCATED with details.floor_revision) and history.revisions.prune bounds the history (keep counts checkpoints excluding the live row; floor_revision is the newest deleted checkpoint plus one, so a revision derived from a surviving checkpoint stays answerable; pruning reuses the entity's write permission). Storage and replay engines stay product-owned; the standalone HistoryPort is the adapter seam.

spoke-knowledge-adoption

Optional capability family (spoke-knowledge-adoption, declared together with spoke-knowledge) for taking a shared entry into a destination scope. KnowledgeEntry.adoption_anchor is a protocol field (AdoptionAnchor) recording the resolved terminal live source — scope, entry id, revision — and is immutable after creation (a put that changes it answers ADOPTION_ANCHOR_IMMUTABLE with details.entry_id). One op knowledge.adopt writes the copy as one create-only CAS transaction: an exact repeat answers already_present, a different revision answers REVISION_CONFLICT with details.adopted_revision, an owner-private source answers NOT_FOUND, and a retired source resolves through the retirement chain to its terminal live source (a cycle or ambiguity answers SOURCE_RETIRED with details.retirement_chain). source_anchor keeps its own provenance meaning and is cleared on the copy; modules.cognition is not copied; owner and disclosure reset to the destination's values. The standalone AdoptionPort is the adapter seam.

spoke-judgment

Optional capability family (spoke-judgment) for a validatable verdict envelope — a data capability with no Connect dispatch row. Judgment carries judgment_kind (open vocabulary, core consistency / support / acceptance / review), target, evidence[] (each a JudgmentRef pinning a positive revision), and verdict { outcome, confidence?, detail? }, where detail is an opaque object that may not carry protocol-level members. The pure validators validateJudgment / validate_judgment refuse missing core fields, an empty outcome, confidence outside [0,1], non-positive revisions, and protocol members smuggled into verdict.detail, naming the violated field; two implementations agree byte-for-byte under RFC 8785 canonical JSON. deliberate stays a product op carried through tools.*; the reasoner and thresholds remain product-owned.

Core entry_type vocabulary (documented, not enforced)

Open string on KnowledgeEntry.entry_type. Full table with typical-use rows: spoke-data-model.md §Open vocabulary. Schema description core list in knowledge-entry.schema.json MUST match that table.

In the core table: includes ability (skill / power / capability) and rule (world-rule ontology label — see dual-concern below), among other documented values.

Profile-only (not in core table or schema description list): e.g. dialogue, beat, species, magic_system — publish via Domain Profile / adapter specs. Beat-assisted outlining maps atomic beats to TimelineEvent (timeline_scale: "moment"), structural roles to BodyAttribute (e.g. structural_role), and beat-sheet order to open Relation strings such as precedes — see domain-profile-narrative-structure.md.


Dual-concern: ontology "event" vs TimelineEvent

Concern Wire artifact Example
Ontology / KB fact KnowledgeEntry with entry_type: "event" “The Battle of Five Armies” as a typed KB node
Timeline / when-axis TimelineEvent with timeline_event_id Same story beat placed on the Timeline with timeline_scale: "narrative"

Integrators may map one local concept to one or both wire shapes. SPOKE keeps the names separate so check/assemble selectors stay unambiguous.


Dual-concern: ontology "rule" vs L6 Rule

Concern Wire artifact Example
Ontology / KB label KnowledgeEntry with entry_type: "rule" “No resurrection without foreshadowing” as a typed KB node
Declarative checker input L6 Rule with rule_id, kind, statement, target_entry_types Same constraint as portable check input via rules[]

Rule.target_entry_types filters KnowledgeEntry entry_type strings (e.g. character, event) — not kinds of Rule objects. Scope.entry_types filters KnowledgeEntry labels; Scope.timeline_event_ids filters TimelineEvent ids — do not cross-wire.


Dual-concern: ontology "mind" / "belief" vs CognitionRecord / MindState

Concern Wire artifact Example
Ontology / KB label KnowledgeEntry with profile entry_type: "mind" / "belief" “Bo believes the marble is in the box” as a typed KB node
Settled home (authority) holder KnowledgeEntry modules.cognition + modules.mental Bo's Belief / epistemic / Perception records with mandatory q; nine open mental fields
Temporal derivative MindState with mind_state_id Field-level snapshot / delta of Bo's mental state at occurred_at on the when-axis, plus an optional derivative cognition projection
Timeline / when-axis (event) TimelineEvent with timeline_event_id “Marble moved box → basket” placed on the Timeline with timeline_scale: "moment"

Integrators may map one local mental fact to one or more of these surfaces. SPOKE keeps the names separate so the authority (modules.cognition / modules.mental), the derivative (MindState), and the when-axis (TimelineEvent) stay unambiguous — the same separation as event vs TimelineEvent.


Boundaries

Term In SPOKE
KnowledgeEntry Portable wire envelope for one KB entry
World KB / Author Memory World KB stays a product-local store mapped via adapters. Author Memory is standardized as the optional spoke-memory capability family (spoke-memory.md) — thirteen models, 34 memory.* ops, standalone MemoryPort. A product that does not implement the family keeps memory product-local and MUST NOT emulate memory semantics through baseline objects (MEM-R019)
Rule L6 declarative wire object + check input
TimelineEvent / TimelineScale L5 when-axis object + brief / narrative / moment vocabulary
CognitionRecord / Scope.cognition Optional spoke-cognition records on the holder KnowledgeEntry — Belief, epistemic (knowledge/ignorance/undetermined), Perception — with mandatory q; Scope.cognition filters/projections and Memory Content.cognition
Session / Computable Optional l2-computable lifecycle — body.state, body.computable, op session_id; not entry_type
BodyAttribute Scalar trait in body.attributes[] — see spoke-data-model.md §BodyAttribute
Fork Optional l5-fork — fork_id / parent_fork_id on TimelineEvent; Scope.fork_id filter (not baseline)
HostCapabilityManifest Adapter self-description wire object; namespace exclusivity per collaboration context
Host role / HostManifestPort Roles on manifest; baseline port for self + peer manifests

Invariant: SPOKE standardizes interchange shapes. It does not own world history implementation, daemon routes, or checker engines.


Spelling

Context Spelling
SPOKE protocol / schemas / packages KnowledgeEntry, TimelineEvent
TimelineScale wire values (timeline_scale field) brief, narrative, moment (lowercase)
Ontology label on a KB entry entry_type: "event" (string value — not the TimelineEvent type)
Ontology label vs L6 object entry_type: "rule" — not the L6 Rule type
Ontology label vs L5 temporal record entry_type: "mind" / "belief" — not the CognitionRecord / MindState wire objects

See also

Doc Topic
STRATEGY.md Protocol-not-runtime positioning
.agents/specs/protocol/spoke-protocol.md Umbrella spec
.agents/specs/protocol/spoke-protocol-layers.md L0–L8, capability levels, Timeline tiers
.agents/specs/protocol/spoke-data-model.md Data objects, Rule, TimelineEvent, TimelineScale
.agents/specs/protocol/spoke-history.md spoke-history — revision snapshots, retained floor, explicit prune
.agents/specs/protocol/spoke-knowledge-adoption.md spoke-knowledge-adoption — anchor, knowledge.adopt, retirement chain
.agents/specs/protocol/spoke-judgment.md spoke-judgment — Judgment envelope and the pure validator
.agents/specs/extensions/spoke-extension-modules.md Core / modules / extensions triad
.agents/specs/domain-profiles/domain-profile-narrative-structure.md Narrative-structure Domain Profile — Beat mapping, precedes, structural_role
.agents/specs/domain-profiles/domain-profile-lore-activation.md Lore-activation Domain Profile — modules.activation
.agents/specs/domain-profiles/domain-profile-mental-state.md Mental-state Domain Profile — modules.cognition / modules.mental / modules.observation dialects + MindState sketch
docs/reference/data-model.md Cognition records, q and metrics, Scope.cognition filters/projections, Memory carrier
.agents/specs/domain-profiles/assemble-module-recipes.md AssemblePacket placement + activation_trace recipes (modules.placement / modules.activation_trace)
.agents/specs/protocol/spoke-ops.md Scope, check/assemble, error envelope
.agents/specs/connect/spoke-connect.md Connect envelope family, session ordering, auth model (opt-in spoke-connect)