# @elevasis/core/knowledge

Pure query layer over the organization graph. Browser-safe (no Node APIs); shared by the SDK CLI, platform CLI, and the `@elevasis/ui/knowledge` browser.

## Surface

| Export                                        | Purpose                                                                                                                             |
| --------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
| `bySystem(graph, systemId, knowledgeNodes)` | Knowledge nodes that govern the given system.                                                                                      |
| `byKind(graph, kind, knowledgeNodes)`         | Filter knowledge nodes by `OrgKnowledgeKind`.                                                                                       |
| `byOwner(graph, ownerId, knowledgeNodes)`     | Knowledge nodes whose `ownerIds` includes the given owner.                                                                          |
| `governs(graph, nodeId)`                      | Outgoing `governs` targets (governed-system ids) from a knowledge node.                                                            |
| `governedBy(graph, nodeId)`                   | Incoming `governs` sources (governing knowledge-node ids) into a system.                                                           |
| `parsePath(pathString)`                       | Parse `/by-system/$id`, `/by-kind/$kind`, `/by-owner/$id`, `/graph/$id/{governs,governed-by}`, or `/$id`. Throws on invalid input. |
| `formatText`, `formatJson`, `formatIdsOnly`   | Output formatters used by the `knowledge:*` CLI subcommands.                                                                        |

## Path syntax

```
/by-system/<systemId>
/by-kind/<playbook|strategy|reference>
/by-owner/<ownerId>
/graph/<nodeId>/governs
/graph/<nodeId>/governed-by
/<nodeId>
```

## JSON envelope

`formatJson` returns `{ path, mount, args, results }` â€” the same wrapped envelope used by `pnpm exec elevasis knowledge:ls --json` and `pnpm exec elevasis-sdk knowledge:ls --json`.

`governs` and `governedBy` accept either bare or graph-namespaced ids (`knowledge.foo` or `knowledge:knowledge.foo`).

