> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://stelltec.com/rhebok/docs/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://stelltec.com/rhebok/docs/_mcp/server.

# Get the knowledge graph

GET http://127.0.0.1:7331/api/graph

Returns every document as a node, with entities, tags and edges. When
memory is enabled, memories are added as nodes of `source_type`
`memory`, with `distilled-from` edges to their session and `scoped-to`
edges to a `project:<path>` node. A machine that has never indexed
returns an empty graph (plus any memories).

Reference: https://stelltec.com/rhebok/docs/api/graph/get-graph

## Response

### 200

The graph.

- `nodes` (list of GraphNode, required)
- `entities` (list of GraphEntity, required)
- `tags` (list of string, required)
- `edges` (list of GraphEdge, required)

## Errors

### 421 Misdirected Request Error

The `Host` header does not name this dashboard (see the rules at the top of this page).

- `error` (string, required) — What went wrong, in plain words.

### 500 Internal Server Error

lbug's `vector` extension could not be loaded. This is a stable state, so `stable` is true and a retry will not help.

- `error` (string, required) — The message, which names the extension directory.
- `stable` (true, required) — Always true. The state will not clear on retry.

### 503 Service Unavailable Error

The index store could not be opened or read right now. A retry can succeed.

- `error` (string, required) — What went wrong, in plain words.

## Types

### GraphNode

- `id` (string, required) — A document id, a memory's `doc_id`, or `project:<path>` for a project node.
- `title` (string, required)
- `source_type` (string, required) — The kind of source a document came from. Graph nodes also use `project` for project nodes.
- `chunks` (integer, required)
- `inbound` (integer, required) — Inbound links.
- `agent` (enum, optional) — The coding agent a session transcript came from.
  - Allowed values: `claude-code`, `codex`
- `memory_kind` (enum, optional)
  - Allowed values: `lesson`, `fact`, `episode`
- `memory_id` (string, optional) — Present on memory nodes.

### GraphEntity

- `id` (string, required)
- `name` (string, required)
- `kind` (string, required)

### GraphEdge

- `from` (string, required)
- `to` (string, required)
- `kind` (string, required) — For example `wikilink`, `supersedes`, `superseded-by`, `mentions`, `tagged`, `distilled-from` or `scoped-to`.

## Examples

**Response**

```json
{
  "nodes": [
    {
      "id": "3f9a1c0be47d2a5591c8e0f6a7b3d214",
      "title": "How we ship",
      "source_type": "markdown",
      "chunks": 6,
      "inbound": 4
    },
    {
      "id": "7a2c5e8f1b4d4a90c3e6f9a2b5d8e1f4",
      "title": "Session 2026-11-18",
      "source_type": "transcript",
      "chunks": 41,
      "inbound": 0,
      "agent": "claude-code"
    },
    {
      "id": "9c04e7d1aa3b46f28e5d0c71b2f9a863",
      "title": "One commit per pull request",
      "source_type": "memory",
      "chunks": 1,
      "inbound": 0,
      "memory_kind": "lesson",
      "memory_id": "a41c09e2f7b3"
    },
    {
      "id": "project:/Users/me/code/rhebok",
      "title": "/Users/me/code/rhebok",
      "source_type": "project",
      "chunks": 0,
      "inbound": 0
    }
  ],
  "entities": [
    {
      "id": "project:rhebok",
      "name": "rhebok",
      "kind": "project"
    }
  ],
  "tags": [
    "engineering"
  ],
  "edges": [
    {
      "from": "5e8d2a7c0f3b4e1d9a6c8b2f4e0d7a13",
      "to": "3f9a1c0be47d2a5591c8e0f6a7b3d214",
      "kind": "wikilink"
    },
    {
      "from": "3f9a1c0be47d2a5591c8e0f6a7b3d214",
      "to": "engineering",
      "kind": "tagged"
    },
    {
      "from": "7a2c5e8f1b4d4a90c3e6f9a2b5d8e1f4",
      "to": "project:rhebok",
      "kind": "mentions"
    },
    {
      "from": "9c04e7d1aa3b46f28e5d0c71b2f9a863",
      "to": "project:/Users/me/code/rhebok",
      "kind": "scoped-to"
    }
  ]
}
```

**SDK Code**

```python Graph_getGraph_example
import requests

url = "http://127.0.0.1:7331/api/graph"

response = requests.get(url)

print(response.json())
```

```javascript Graph_getGraph_example
const url = 'http://127.0.0.1:7331/api/graph';
const options = {method: 'GET'};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Graph_getGraph_example
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "http://127.0.0.1:7331/api/graph"

	req, _ := http.NewRequest("GET", url, nil)

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Graph_getGraph_example
require 'uri'
require 'net/http'

url = URI("http://127.0.0.1:7331/api/graph")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
```

```java Graph_getGraph_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("http://127.0.0.1:7331/api/graph")
  .asString();
```

```php Graph_getGraph_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'http://127.0.0.1:7331/api/graph');

echo $response->getBody();
```

```csharp Graph_getGraph_example
using RestSharp;

var client = new RestClient("http://127.0.0.1:7331/api/graph");
var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);
```

```swift Graph_getGraph_example
import Foundation

let request = NSMutableURLRequest(url: NSURL(string: "http://127.0.0.1:7331/api/graph")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```