Daemion docs

How do I query the knowledge graph?

Auth: Bearer token from device pairing
Base URL: http://localhost:3001
All examples tested against live gateway

Daemion stores long-term knowledge in Engram, a graph memory system backed by Neo4j. Every agent conversation, insight, and fact gets written into the graph as entities and relationships. These endpoints let you query that graph directly — inspect what Daemion knows, find entities by type, and traverse local neighborhoods.


How do I get graph statistics?

GET /graph/stats Auth required

Return node and relationship counts for the entire graph. Useful for a quick health check or dashboard widget.

bash
Verified

curl “http://localhost:3001/graph/stats
-H “Authorization: Bearer $DAEMION_TOKEN”

Response shape:

json

{ “stats”: { “Entity”: 342, “Fact_total”: 891, “Fact_active”: 874 } }

The stats object is keyed by Neo4j node label. Fact_total is the total number of FACT relationships; Fact_active counts only those where is_active is true.


How do I get the full graph?

GET /graph/full Auth required

Return the top N entities by activation score, plus all facts between those entities. Designed for graph visualization.

Parameter Type Description
limit number Maximum number of entities to return. Capped at 300. Defaults to 200.
bash
Verified

Default limit (200 entities)

curl “http://localhost:3001/graph/full
-H “Authorization: Bearer $DAEMION_TOKEN”

Smaller snapshot for visualization

curl “http://localhost:3001/graph/full?limit=50
-H “Authorization: Bearer $DAEMION_TOKEN”

Response shape:

json

{ “entities”: [ { “uuid”: “a1b2c3d4-…”, “name”: “Daemion”, “entity_type”: “project”, “summary”: “Persistent autonomous AI copartner system.”, “group_id”: “daemion”, “confidence”: 1, “activation_score”: 0.95, “created_at”: “2026-03-01T10:00:00Z”, “last_accessed”: “2026-03-31T08:00:00Z”, “access_count”: 47 } ], “facts”: [ { “uuid”: “e5f6…”, “from_name”: “Daemion”, “to_name”: “Neo4j”, “fact”: “Daemion uses Neo4j as its graph memory store.”, “predicate”: “USES”, “confidence”: 0.98, “created_at”: “2026-03-01T10:00:00Z”, “is_active”: true } ] }

Facts are limited to relationships between the returned entities. Maximum 600 facts per call.


How do I list entity types?

GET /graph/types Auth required

Return all distinct entity_type values in the graph with their counts, ordered by count descending.

bash
Verified

curl “http://localhost:3001/graph/types
-H “Authorization: Bearer $DAEMION_TOKEN”

Response shape:

json

{ “types”: [ { “type”: “person”, “count”: 12 }, { “type”: “project”, “count”: 8 }, { “type”: “concept”, “count”: 34 } ] }


How do I search entities?

GET /graph/entities Auth required

List entities with optional filters. Returns up to 100 entities ordered by activation_score descending.

Parameter Type Description
type string Filter by entity_type. Case-insensitive.
group string Filter by group_id. Matches exactly.
limit number Maximum entities to return. Defaults to 100.
search string Substring search over entity name and summary. Case-insensitive.
bash
Verified

All entities of type “concept”

curl “http://localhost:3001/graph/entities?type=concept
-H “Authorization: Bearer $DAEMION_TOKEN”

Search for entities mentioning “gateway”

curl “http://localhost:3001/graph/entities?search=gateway&limit=20
-H “Authorization: Bearer $DAEMION_TOKEN”

Entities in the daemion group

curl “http://localhost:3001/graph/entities?group=daemion
-H “Authorization: Bearer $DAEMION_TOKEN”

Response shape:

json

{ “entities”: [ { “uuid”: ”…”, “name”: ”…”, “entity_type”: “concept”, ”…” : ”…” } ], “count”: 14 }


How do I get an entity with its facts?

GET /graph/entity/:id Auth required

Fetch a single entity by UUID or exact name, plus all outgoing and incoming FACT relationships. Returns 404 if no match.

The :id segment can be either the entity’s UUID or its exact name.

bash
Verified

Look up by name

curl “http://localhost:3001/graph/entity/Daemion
-H “Authorization: Bearer $DAEMION_TOKEN”

Look up by UUID

curl “http://localhost:3001/graph/entity/a1b2c3d4-e5f6-7890-abcd-ef1234567890
-H “Authorization: Bearer $DAEMION_TOKEN”

Response shape:

json

{ “entity”: { “uuid”: “a1b2c3d4-…”, “name”: “Daemion”, “entity_type”: “project”, “summary”: “Persistent autonomous AI copartner system.”, “group_id”: “daemion”, “confidence”: 1, “activation_score”: 0.95, “created_at”: “2026-03-01T10:00:00Z”, “last_accessed”: “2026-03-31T08:00:00Z”, “access_count”: 47 }, “outgoing”: [ { “uuid”: ”…”, “from_name”: “Daemion”, “to_name”: “Neo4j”, “fact”: “Daemion uses Neo4j as its graph memory store.”, “predicate”: “USES”, “confidence”: 0.98, “created_at”: “2026-03-01T10:00:00Z”, “is_active”: true } ], “incoming”: [] }

Outgoing and incoming are each capped at 50 facts, ordered by confidence descending.


How do I get a local subgraph?

GET /graph/local/:id Auth required

Return the neighborhood around an entity: all entities reachable within N hops, plus the facts connecting them.

Parameter Type Description
depth number Traversal depth from the center entity. Defaults to 2. Capped at 3.
bash
Verified

2-hop neighborhood around “Daemion”

curl “http://localhost:3001/graph/local/Daemion
-H “Authorization: Bearer $DAEMION_TOKEN”

1-hop neighborhood (immediate neighbors only)

curl “http://localhost:3001/graph/local/Daemion?depth=1
-H “Authorization: Bearer $DAEMION_TOKEN”

Response shape is the same as /graph/full — an object with entities and facts arrays. Entities are capped at 60; facts at 100.


Frequently asked questions

Q What is Engram?
Engram is Daemion's persistent graph memory system built on Neo4j. Every agent session writes entities (people, projects, concepts) and facts (relationships between them) into the graph. Agents can recall this memory using tools like search_history and find_relevant. The graph endpoints here give you direct read access to the same store.
Q What is activation_score?
A measure of how recently and frequently an entity has been accessed. Higher scores surface first in /graph/full and /graph/entities results. It is updated by Engram automatically as agents read and write the graph — you don't set it manually.
Q What is group_id?
Entities are partitioned into named groups. Daemion's shared memory uses the daemion group by default (configurable via the DAEMION_SHARED_GROUP environment variable). Individual agents may write to their own group. Use ?group=daemion to filter to project-level memory.
Q Can I write to the graph through these endpoints?
No. These endpoints are read-only. Writing to Engram happens through agent conversations — the agent's memory tools handle inserts and updates. To store a fact programmatically, send a message to an agent instructing it to remember something.
Q Why does /graph/full cap at 300 entities?
Returning the full graph without a limit can produce very large payloads and slow Neo4j queries on large knowledge bases. The 300-entity cap keeps responses snappy for visualization use cases. Use /graph/entities with filters for programmatic access to specific subsets.

What can go wrong

Common errors

404 {"error": "entity not found"} — No entity matched the UUID or name you provided in /graph/entity/:id or /graph/local/:id. Entity names are case-sensitive and must match exactly. Use /graph/entities?search=... to find the correct name first.

Empty stats object — Neo4j is not running or is unreachable. The gateway connects to NEO4J_URL (default http://localhost:7474). Check that the Neo4j service is up and that NEO4J_USER / NEO4J_PASS environment variables are correct. Graph endpoints return empty results rather than erroring when Neo4j is down.

facts array is empty on /graph/entity/:id — The entity exists but has no FACT relationships yet. This is normal for newly created entities that haven’t been linked to others through conversation.

/graph/local/:id returns only the center entity — The entity has no neighbors within the requested depth. Try ?depth=3 or use /graph/entity/:id to inspect its direct outgoing and incoming facts.


What’s next?