Knowledge Graph
SharedMemory's knowledge graph is the structured backbone of its memory system. Built on Neo4j, it represents knowledge as entities, facts, and relationships.
Node Types​
Entity​
The core unit — a person, project, technology, organization, or concept.
{
"name": "John Smith",
"type": "person",
"summary": "Senior engineer at Google specializing in React and cloud computing",
"volume_id": "abc-123"
}
Fact​
A specific piece of knowledge linked to an entity.
{
"content": "Works as a senior engineer at Google since 2021",
"category": "experience",
"importance": 0.85
}
Summary​
Auto-generated narrative summaries updated as new facts arrive.
Document​
Represents an ingested document linked to its extracted entities.
Relationship Types​
| Relationship | Description | Example |
|---|---|---|
HAS_FACT | Entity → Fact | John → HAS_FACT → "Senior engineer" |
HAS_SUMMARY | Entity → Summary | John → HAS_SUMMARY → Summary v3 |
RELATES_TO | Entity → Entity | John → WORKS_AT → Google |
SOURCE_OF | Document → Entity | resume.pdf → SOURCE_OF → John |
RELATES_TO edges carry a type property (e.g., WORKS_AT, HAS_SKILL, CONTRIBUTED_TO).
Extraction Process​
When text enters SharedMemory, the knowledge extractor:
- Identifies entities — People, organizations, technologies, projects
- Extracts facts — 3-6 facts per work experience, 2-4 per education/project
- Builds relationships — How entities connect to each other
- Deduplicates — Merges with existing entities by name + volume
- Updates summaries — Regenerates entity summaries incorporating new facts
Example​
Input: "John worked as a senior engineer at Google from 2021-2024, building distributed systems with Go and Kubernetes."
Extracted:
- Entities: John (Person), Google (Organization), Go (Technology), Kubernetes (Technology)
- Facts: "Senior engineer at Google 2021-2024", "Built distributed systems"
- Relationships: John WORKS_AT Google, John HAS_SKILL Go, John HAS_SKILL Kubernetes
Querying the Graph​
Via SDK​
const john = await memory.getEntity("John Smith")
const results = await memory.searchEntities("Google")
const graph = await memory.getGraph()
Via API​
POST /agent/entity
{ "volume_id": "...", "entity_name": "John Smith" }