> For the complete documentation index, see [llms.txt](https://docs.origintrail.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.origintrail.io/agent-context/publish-query.md).

# Publish & Query

## Write path

1. Create or select a Context Graph.
2. Create a Working Memory Knowledge Asset.
3. Write RDF quads.
4. Finalize (seal) the Knowledge Asset.
5. Query the Knowledge Asset to verify.
6. Share to Shared Working Memory when peers should see it.
7. Publish to Verifiable Memory only with explicit finality intent.

Node Skill tools:

* `dkg_context_graph_create`
* `dkg_knowledge_asset_create`
* `dkg_knowledge_asset_write`
* `dkg_knowledge_asset_finalize`
* `dkg_knowledge_asset_query`
* `dkg_knowledge_asset_share`
* `dkg_knowledge_asset_publish`

CLI equivalents:

```bash
dkg ka create <name> -c <context-graph-id> --input-file <rdf-file> --share
dkg ka publish-async <name> -c <context-graph-id>
```

Use the one-shot CLI form only for create/write/finalize/share into SWM. VM publish remains explicit and operates on the named KA after it is fully shared.

## Query path

* Use `memory_search` for recall (`dkg_memory_search` on the MCP runtime).
* Use `dkg_query` for SPARQL.
* Use `GRAPH ?g { ... }` for sub-graph-routed data.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.origintrail.io/agent-context/publish-query.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
