Skip to content

Context

POST /api/v1/context
Content-Type: application/json

Returns ranked, contextually relevant nodes for a session. Designed for use at the start of a work session — surfaces what you already know about a subject before you start writing or coding.

{
"topic": "knowledge graph architecture",
"working_directory": "/Users/user/projects/loombrain",
"limit": 20
}

| Field | Type | Required | Description | |-------|------|----------|-------------| | topic | string | Yes | The topic or question to retrieve context for | | para_item_id | string | No | Explicit PARA item ID to scope results to | | working_directory | string | No | File system path used for automatic PARA item detection | | limit | number | No | Number of nodes to return (1–50, default 20) |

{
"nodes": [
{
"id": "node_123",
"title": "Node title",
"score": 15,
"reasons": ["Primary tag", "Semantic match"]
}
],
"matched_para_item": {
"id": "para_abc",
"label": "LoomBrain v2",
"category": "projects"
}
}

matched_para_item is present only when a PARA item was resolved — either because para_item_id was supplied, or because auto-detection succeeded. It is null otherwise.

When working_directory is provided and para_item_id is not, the endpoint attempts to infer the relevant PARA item from the path:

  1. Extracts the last directory component (e.g., loombrain from /Users/user/projects/loombrain).
  2. Normalizes the name — lowercases, strips common TLDs, removes hyphens/underscores.
  3. Fuzzy-matches the normalized name against all active PARA item slugs and labels.
  4. If a match is found, scopes the context retrieval to that item automatically.

GET /api/v1/graph-health

Returns knowledge graph statistics:

{
"total_nodes": 156,
"validated_nodes": 120,
"total_captures": 200,
"pending_captures": 3,
"total_links": 450,
"stale_nodes": 12
}

GET /api/v1/links/suggestions?text=your+search+text

| Parameter | Type | Description | |-----------|------|-------------| | text | string | Text to find link suggestions for (max 10,000 chars) |

Returns suggested nodes that could be linked based on content similarity:

{
"suggestions": [
{
"node_id": "abc123",
"title": "Related concept",
"score": 0.85
}
]
}