Knowledge Graph
The knowledge graph stores scoped entities, aspects, grouped claim values, dependencies, proposals, and assertions. Dreaming derives this state from evidence through audited operations, and explicit ontology operations can also change it. Structured remember payloads are kept as evidence. They are not applied to the graph.
This page is the implementation reference. For the model behind it, see Knowledge Architecture. For routes, see the knowledge and ontology API.
Core Tables
Section titled “Core Tables”The base schema comes from migration 019-knowledge-structure.ts and later
migrations in platform/core/src/migrations/.
entities
Section titled “entities”Top-level graph nodes. Main fields:
id,name,canonical_name,entity_type,agent_id,descriptionmentionspinned,pinned_atstatus(activeorarchived),archived_at,archived_by,archive_reasonproposal_id,proposal_evidencelast_synthesized_at- timestamps
ENTITY_TYPES in platform/core/src/types.ts lists the valid types. It covers
people, projects, systems, tools, concepts, skills, tasks, sources, artifacts,
agents, policies, actions, workflows, events, object types, interfaces,
observations, claim slots, claim values, and unknown.
Entity lists filter to the agent and to active rows, then sort pinned entities first:
ORDER BY e.pinned DESC, e.pinned_at DESC, e.mentions DESC, e.updated_at DESC, e.name ASCentity_aspects
Section titled “entity_aspects”Named dimensions under an entity. Main fields: id, entity_id, agent_id,
name, canonical_name, weight, status, archive fields, proposal fields,
and timestamps.
Aspects are unique on (entity_id, canonical_name).
entity_attributes
Section titled “entity_attributes”Values under an aspect. Main fields:
id,aspect_id,agent_id,memory_idkind:attribute,claim, orconstraintcontent,normalized_contentgroup_key,claim_keyconfidence,importancestatus:active,superseded, ordeletedsuperseded_byversion,version_root_id,previous_attribute_id- archive fields, source provenance fields, proposal fields, timestamps
group_key and claim_key give each value its navigation path and its update
identity:
entity -> aspect -> group_key -> claim_key -> attribute versionsA missing group_key is treated as general. Versions and replacement are
scoped to one claim slot: the same aspect, kind, group, and claim key.
entity_dependencies
Section titled “entity_dependencies”Directed edges between entities. Main fields: id, source_entity_id,
target_entity_id, agent_id, aspect_id, dependency_type, strength,
confidence, reason, status, archive fields, source provenance fields,
proposal fields, and timestamps.
DEPENDENCY_TYPES in platform/core/src/types.ts lists the valid types. A
related_to edge must have a non-empty reason; database triggers from
migration 050 enforce this.
Migration 050 also adds entity_dependency_history. Triggers write a row for
each dependency insert, update, and delete.
The retention worker runs a bounded compactor over this table. It removes both
rows of a rebuild pair: a trigger-written deleted event and the next event
for the same dependency, when that event is a trigger-written created event
with the same timestamp, source, target, agent, dependency type, and reason.
Rows with no reason never match, because the comparison is an SQL equality.
Every other history row is kept.
task_meta
Section titled “task_meta”Task lifecycle metadata keyed by entity_id: agent_id, status,
expires_at, retention_until, completed_at, and updated_at.
Audit and Control Tables
Section titled “Audit and Control Tables”ontology_proposals
Section titled “ontology_proposals”Pending proposals and the audit record of applied operations. Main fields:
operation,payloadstatus:pending,applied,rejected, orfailedconfidence,rationale,evidence,risk- source provenance
created_by,applied_by,rejected_byresult, timestamps
epistemic_assertions
Section titled “epistemic_assertions”Attributed statements that do not become current truth. Main fields:
subject_entity_id, optionalclaim_attribute_idpredicate:claims,believes,observed,decided,prefers,denies, orquestionscontent,speaker,asserted_at,confidence,evidence- source provenance
status:active,archived, orsupersededsupersedes_assertion_id, archive fields, timestamps
Assertions are written by the assertion endpoints and, when
write_assertions is set, by POST /api/ontology/extract. They do not pass
through the operation handlers below and do not write ontology_proposals
rows.
ontology_contradictions
Section titled “ontology_contradictions”A derived audit ledger, not a truth layer. Each row is agent-scoped and links two active, non-constraint claim values in the same entity, aspect, group, and claim slot. It snapshots both values, their confidence, source provenance, and proposal evidence, so a source purge can resolve the row without losing the record of what conflicted.
The detector is a bounded lexical check (negation_mismatch and supported
antonym pairs). A row stays active while both values stay active and still
match. Supersession, archival, replacement, or source deletion marks it
resolved. The ledger never ranks sources, picks a winner, bypasses proposal
review, or adds a contradicts edge to the graph.
Write Paths
Section titled “Write Paths”Dreaming is the only automatic semantic writer. It applies its changes as
operation batches through the same handlers that explicit edits use, so every
change leaves an applied ontology_proposals row.
Remember writes evidence only. Ingest adds only mechanical source-topology
entities and containment links, never aspects or claim values.
POST /api/memory/remember keeps a
structured payload as evidence metadata on a newly saved memory and returns
structured_applied: false; a deduplicated remember keeps no new payload and
its response omits that field.
The retired txPersistStructured and txPersistEntities closures and the
inline LLM extraction chain were removed in the Dreaming cutover. The only
write helper left in platform/daemon/src/ontology/graph/transactions.ts is
txDecrementEntityMentions. The retention worker uses it to lower mention
counts after a memory purge. Retention never deletes entities. An entity with
zero mentions keeps its pin, aspects, values, aliases, dependencies, and
assertions.
Ontology Operations
Section titled “Ontology Operations”Source: platform/daemon/src/ontology/proposals/proposals.ts
Operations that can be applied or proposed:
- entities:
create_entity,rename_entity,archive_entity,merge_entities - aspects:
create_aspect,rename_aspect,archive_aspect,merge_aspects - claim values:
add_claim_value,set_claim_value,supersede_claim_value,archive_claim_value,restore_claim_version - links:
create_link,update_link,archive_link - policy and interface objects:
create_policy,create_action_type,create_interface,attach_interface
pin_entity, unpin_entity, create_entity_alias, and
archive_entity_alias use the same apply path from the pin and alias routes.
Each operation runs in one of three modes:
- dry run: apply inside a transaction, return the result, then roll back;
- apply: change the graph and write an
appliedproposal row in the same transaction; - propose: write a
pendingproposal and change nothing else.
Dry run and propose cannot be combined. A batch takes up to 500 operations and applies them in one transaction; one failure rolls back the whole batch. In a dry-run batch, failures are collected per operation instead.
Claim values
Section titled “Claim values”add_claim_valueadds an active value to a slot. It does not replace other active values in that slot. If the same normalized value is already active there, it returns that row instead of adding a duplicate.set_claim_valuemakes the new value the current version of the slot and marks the slot’s other active valuessuperseded. If an active value in the slot has newer evidence time than the incoming value, the incoming value is stored assupersededby that newer value instead.supersede_claim_valueexplicitly supersedes values selected byattribute_idorold_value. Withnew_value, it writes the replacement throughset_claim_value.
Maintenance does not run a supersession sweep.
Force and write caps
Section titled “Force and write caps”Some operations refuse with 409 unless the payload sets force: true:
set_claim_valuewhen the slot holds an active constraint;archive_claim_valueon a constraint;archive_aspectwhen the aspect has active constraints;archive_entityon a pinned entity.
The operation routes pass write caps from
memory.pipelineV2.traversal.maxWriteAspectsPerEntity (default 20) and
maxWriteAttributesPerAspect (default 50). When caps are passed, these fail
with 409:
create_aspect, oradd_claim_valuethat names a new aspect, when the entity already has the maximum active aspects;add_claim_value, orset_claim_valueon a slot with no earlier versions, when the aspect already has the maximum active values.
Traversal
Section titled “Traversal”Source: platform/daemon/src/recall/graph/traversal.ts
Traversal picks focal entities, walks a bounded subgraph, and returns memory
IDs and structure for recall. Automatic recall runs it only when both
memory.pipelineV2.graph.enabled and memory.pipelineV2.traversal.enabled
are true. An explicit POST /api/knowledge/expand call runs traversal
regardless of those two flags.
Focal Resolution
Section titled “Focal Resolution”resolveFocalEntities uses the first source that returns entities:
- checkpoint entity IDs, when supplied;
- otherwise, project entities whose names match tokens from the project path (up to 5);
- otherwise, query-token matches through
entities_fts, with aLIKEfallback (up to 20).
Pinned entities are then merged in, unless the caller disables them. The final
set is capped at 200 entities. A session key does not resolve entities. It
only sets the reported source to session_key when nothing else matched.
Collection Rules
Section titled “Collection Rules”For the focal entities, traversal:
- collects active
constraintvalues, ordered by importance and de-duplicated by entity and content; - takes up to
maxAspectsPerEntityaspects per entity, ordered byweight DESC, or only aspects whose canonical name matchesaspectFilterwhen one is set; - collects
memory_idvalues from active values in those aspects, ordered by importance, up tomaxAttributesPerAspectper aspect; - if the memory budget is not full, adds memories from
memory_entity_mentions; - if time and budget remain, follows outgoing dependencies from the focal set and runs steps 1 to 4 for target entities not yet visited.
All steps share one memory budget, maxTraversalPaths.
Dependencies qualify when both of these hold (a missing confidence counts as 0.7):
confidence * strength >= minDependencyStrengthconfidence >= minConfidenceQualifying edges are ordered by confidence * strength. The walk follows one
hop only; maxDependencyHops is accepted but not used.
The edge limit is shared across all focal entities: the query returns at most
maxBranching times the number of focal entities, so one well-connected
entity can use the whole allowance (#2352).
Traversal does not check the archived status of entities, aspects, or dependencies. An archived link is still followed, and archived entities and aspects can still add constraints and memories (#2351).
The result contains memoryIds, memoryScores, memoryPaths,
constraints, entityCount, timedOut, activeAspectIds, and
focalEntityIds. Recall blends it with its other channels; see
How recall ranks candidates.
Configuration
Section titled “Configuration”Settings live under memory.pipelineV2.traversal in agent.yaml:
| Key | Default | Meaning |
|---|---|---|
enabled |
true |
Run traversal (also needs graph.enabled) |
primary |
true |
Use traversal as a primary recall candidate source |
maxAspectsPerEntity |
20 | Aspects read per entity (1 to 100) |
maxAttributesPerAspect |
50 | Memory IDs taken per aspect (1 to 200) |
maxDependencyHops |
10 | Not used by the current one-hop walk |
minDependencyStrength |
0.3 | Minimum confidence * strength |
maxBranching |
4 | Edge allowance per focal entity, pooled (1 to 50) |
maxTraversalPaths |
50 | Total memory ID budget (1 to 500) |
minConfidence |
0.5 | Minimum edge confidence |
timeoutMs |
500 | Deadline in milliseconds (50 to 5000) |
boostWeight |
0.2 | Weight blended into recall scores for traversal hits |
constraintBudgetChars |
1000 | Character budget for constraints injected at session start |
Aspect Weights and Maintenance
Section titled “Aspect Weights and Maintenance”Source: platform/daemon/src/ontology/proposals/aspect-feedback.ts
When memory.pipelineV2.graph.enabled and memory.pipelineV2.feedback.enabled
are on, maintenance can decay aspect weights. With
feedback.decayEnabled, aspects not updated for feedback.staleDays lose
feedback.decayRate, down to feedback.minAspectWeight. Decay is off by
default (decayEnabled: false, decayRate: 0).
applyFtsOverlapFeedback, which raised aspect weights from keyword-search
overlap, is still in the file, but nothing calls it.
Hygiene Report
Section titled “Hygiene Report”Source: platform/daemon/src/ontology/graph/hygiene.ts
The hygiene report is read-only. It lists suspicious entities, duplicate canonical groups, counts of values missing a group key, claim key, or source memory, and safe mention-link candidates where a known entity name appears in an unlinked memory.
HTTP API
Section titled “HTTP API”Knowledge routes are in platform/daemon/src/http/routes/knowledge-routes.ts
and ontology routes in platform/daemon/src/http/routes/ontology-routes.ts.
Every route, with parameters and permissions, is documented in the
knowledge and ontology API.
CLI Surfaces
Section titled “CLI Surfaces”signet knowledge reads the graph: entities, entity, tree, aspects,
groups, claims, attributes, and hygiene.
signet ontology changes and inspects it:
entity,aspect,claim, andlinksubcommands apply operations;stream applyapplies a JSONL operation stream;proposals,proposal,propose,apply,reject, andconflictswork with the proposal queue;assertionsandassertionmanage epistemic assertions;contradictions,claim-evidence,link-evidence, andexplain-claimread audit data;extractandconsolidatebuild proposals from sources.
Operation commands accept --dry-run, --propose, --actor, --reason, and
--evidence-file. Both command groups accept --agent and --json. Usage
examples are next to each route in the
knowledge and ontology API.
Dashboard Constellation
Section titled “Dashboard Constellation”getKnowledgeGraphForConstellation in
platform/daemon/src/ontology/graph/knowledge-graph.ts builds the bounded
payload for the dashboard graph. It reads active entities, aspects, values,
dependencies, assertions, pending proposals, and a Dreaming summary. Source
document entities are included when an active Dreaming claim cites them.
Source folders, skills, and uncited source topology are left out. Limits,
defaults, and caching are documented under
GET /api/knowledge/constellation.
The dashboard scene draws entities and source documents, aspects, optional
groups, claim slots, values, assertions, evidence origins, and memory
references. Relationships are typed edges, not nodes. When every value in an
aspect is in general, the group is folded into the aspect. An assertion
attaches to its linked claim value when that value is shown, and otherwise to
its subject entity. Confidence and provenance appear in node details. Pending
proposals are in the payload but are not drawn as nodes. For using the view,
see Memory graph.
Agent Scope
Section titled “Agent Scope”Graph rows belong to one agent (agent_id). Most knowledge routes use the
requested agent_id, then the credential’s scoped agent, then default. The
constellation route falls back to the configured daemon agent instead.
When token scope enforcement applies, a non-admin credential restricted to one
agent cannot request another agent; the route answers 403. Scope is not
enforced in local mode or for unauthenticated requests in hybrid mode, and
admin credentials can request any agent. The constellation route also offers
an all-agents view, which needs admin permission outside local mode.

