Skip to main content

Know-Do Graph

A wiki-native, agent-oriented infrastructure for executable knowledge, operational memory, and capability discovery.

Entries are wiki-style pages that agents can read, traverse, update, and validate. The graph emerges from typed edges plus [[wikilink]] references between entries.

Quick Start

Install from PyPI:

pip install know-do-graph

# Create an empty ./data/know_do_graph.db
know-do-graph init

# Or start from the database bundled with the package
know-do-graph init --starter

know-do-graph serve

The server prints the local URLs:

Know-Do Graph API  ->  http://127.0.0.1:8000
  Graph UI         ->  http://127.0.0.1:8000/ui
  Swagger          ->  http://127.0.0.1:8000/docs

Set KDG_DB_PATH to use a different database path:

KDG_DB_PATH=./my-data/my-memory.db

Relative paths are resolved from the current working directory.

Optional Embeddings

The default install does not download a local embedding model stack. Keyword search works out of the box; hybrid and semantic retrieval fall back gracefully when no embedding provider is enabled.

Local embeddings:

pip install "know-do-graph[local-embeddings]"
export KDG_EMBED_PROVIDER=local
export KDG_EMBED_MODEL="sentence-transformers/all-MiniLM-L6-v2"

OpenAI-compatible embeddings:

export KDG_EMBED_PROVIDER=openai
export KDG_EMBED_MODEL="text-embedding-3-small"
export KDG_EMBED_DIM=384
export KDG_EMBED_API_KEY="..."                      # or OPENAI_API_KEY
export KDG_EMBED_BASE_URL="https://example.com/v1"  # optional

KDG_EMBED_DIM defaults to 384, matching the bundled SQLite vector table.

Python API

Use the high-level client directly inside an agent process:

from know_do_graph import EdgeRelation, EntryType, KnowDoGraph

with KnowDoGraph("data/my_agent.db") as graph:
    skill = graph.add(
        "Relax an atomic structure",
        entry_type=EntryType.capability,
        content="Choose a calculator, then run [[ASE Relaxation]].",
        tags=["atomistic"],
    )
    procedure = graph.add(
        "ASE Relaxation",
        entry_type=EntryType.procedure,
        content="Attach a calculator and run an ASE optimizer.",
    )
    graph.connect(skill.id, procedure.id, relation=EdgeRelation.decomposes_to)

    planner_context = graph.plan("relax this crystal")
    execution_context = graph.expand(skill.slug, stages=["decomposition"])

Main client methods include add, get, list, search, update, delete, connect, related, plan, heuristics, constraints, expand, and memory. IDs, slugs, and aliases are accepted anywhere an entry identifier is required.

Disabled entries and custom graph types

Set metadata.disabled when creating an entry, or call set_disabled() to hide an existing entry without deleting its content or edges. Disabled entries are excluded from normal retrieval and graph traversal; pass disabled=True to list() or search() to audit them, then re-enable the entry to restore its persisted connections.

The shared storage schema also supports custom graph type labels such as category or parameter. Those labels remain intact, while progressive L1--L4 retrieval is available only for Know-Do Graph type semantics.

Chat API

Configure an OpenAI or OpenAI-compatible provider:

export OPENAI_API_KEY="..."
export OPENAI_API_BASE="https://your-provider.example/v1"  # optional
export GRAPH_AGENT_MODEL="qwen-plus"                       # optional

Read-only Q&A:

from know_do_graph import KnowDoGraph

with KnowDoGraph("data/my_agent.db") as graph:
    chat = graph.chat(read_only=True)
    print(chat.send("Which skills can construct a material interface?"))

Graph-editing agent:

with KnowDoGraph("data/my_agent.db") as graph:
    chat = graph.chat()
    reply = chat.send(
        "Add a reusable capability for validating atomistic relaxations. "
        "Search for duplicates and connect it to relevant procedures."
    )
    print(reply)

Review agent:

with KnowDoGraph("data/my_agent.db") as graph:
    reviewer = graph.chat(agent="reviewer", batch_size=3)
    print(reviewer.review("Focus on duplicate titles and inconsistent tags."))

CLI Examples

# Add an entry
know-do-graph entry add "My Tool" \
  --content "Useful for [[ASE Relaxation]]." \
  --type tool \
  --tags "python,simulation"

# Search and inspect
know-do-graph entry search "relaxation"
know-do-graph entry show ase-relaxation

# Graph inspection
know-do-graph graph stats
know-do-graph graph neighbors <entry-id> --depth 2

# Memory traces
know-do-graph mem add "MACE worked for bulk Fe relaxation" \
  --session my-session --tags "success,atomistic"
know-do-graph mem promote <mem-id> --session my-session --type capability

REST Examples

Interactive OpenAPI docs are available at http://127.0.0.1:8000/docs.

curl http://127.0.0.1:8000/graph/full
curl "http://127.0.0.1:8000/entries/search?q=relaxation&limit=5"

curl -X POST http://127.0.0.1:8000/entries/ \
  -H "Content-Type: application/json" \
  -d '{"title":"ASE Relaxation","entry_type":"procedure","tags":["ase"]}'

From Source

python -m venv .venv
.venv\Scripts\activate        # Windows
source .venv/bin/activate     # macOS / Linux

bash install.sh
python examples/example_entries.py
python main.py serve

Frontend hot reload:

# Terminal 1
python main.py serve

# Terminal 2
cd frontend && npm run dev

Documentation

Entry Format

Entries are wiki-style documents. Internal [[wikilinks]] can be resolved into graph edges during extraction or maintenance.

# ASE Relaxation

Geometry optimisation workflow using [[ASE]].

## Prerequisites
- [[ASE]]
- A [[MACE Calculator]] or other calculator

Common entry types are capability, procedure, workflow, tool, repository, environment, dependency, data, analytical, memory, heuristic, constraint, and generic.

Metadata

Release files for know-do-graph 0.1.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for know-do-graph 0.1.9
File Size Uploaded
know_do_graph-0.1.9.tar.gz 4.4 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for know-do-graph 0.1.9
File Interpreter ABI Platform
know_do_graph-0.1.9-py3-none-any.whl Python 3 none any Details

Total release size: 8.7 MB

Release files / know_do_graph-0.1.9.tar.gz

Download URL know_do_graph-0.1.9.tar.gz
Size 4.4 MB
Tags Source
SHA-256 checksum
How to use checksums
595d0e9d0f63820617d22405dcc6a3880edd047462357914667b7d86f5ebb3e9
BLAKE2b-256 checksum
How to use checksums
0aa42dc77a2f9c0bf73b892dd40f0b4f45ccad2f9275ad66bd70d236b94f647b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 18, 2026.

Transparency log

Release files / know_do_graph-0.1.9-py3-none-any.whl

Download URL know_do_graph-0.1.9-py3-none-any.whl
Size 4.3 MB
Tags Python 3
SHA-256 checksum
How to use checksums
9dbafccb85332d4a4e37e13d404c7be1951b88fa592065dc922ff4f9544e3609
BLAKE2b-256 checksum
How to use checksums
272ec36ed373de01932fa19158c4135f7306d3dc4f91ec663f1451e396a55d7a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 18, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.9 This release

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page