> 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/use-dkg/knowledge-asset-lifecycle.md).

# Knowledge Asset Lifecycle CLI

Use `dkg knowledge-asset ...` or its short alias `dkg ka ...` for named Knowledge Asset work:

```mermaid
flowchart LR
  Create["create"] --> Write["write"]
  Write --> Finalize["finalize / seal"]
  Finalize --> Share["share to SWM"]
  Share --> Publish["publish to VM"]
```

## One-shot WM to SWM

```bash
dkg ka create notes \
  --context-graph-id my-project \
  --input-file ./notes.ttl \
  --share
```

This creates the KA named `notes`, writes RDF from `--input-file`, finalizes the draft, and shares it to Shared Working Memory. It does not publish to Verifiable Memory.

`-f` is a short alias for `--input-file`. Prefer `--input-file <path>` in scripts and docs so the local payload source is never confused with the positional KA `<name>`.

## Step-by-step Lifecycle

```bash
dkg ka create notes -c my-project
dkg ka write notes -c my-project --input-file ./notes.ttl
dkg ka finalize notes -c my-project
dkg ka share notes -c my-project
dkg ka publish notes -c my-project
```

Use `dkg ka publish-async notes -c my-project` for an async VM publish job. `dkg publisher publish-async my-project notes` remains an operational alias.

Async VM publish requires the async publisher to be enabled and backed by publisher wallets with native gas plus PCA registration or TRAC for direct spend. Publisher wallet node identity is optional attribution: if the wallet resolves to identity `0`, the publish runs in no-attribution mode. Use `--publisher-node-identity-id 0` to force no-attribution for one publish. See [Async Publisher Wallets](/use-dkg/async-publisher-wallets.md).

## Command Reference

| Command                                                                        | Purpose                                                        |
| ------------------------------------------------------------------------------ | -------------------------------------------------------------- |
| `dkg ka create <name> -c <cg> [--input-file <rdf>] [--share]`                  | Create a WM draft; optionally write/finalize/share in one call |
| `dkg ka write <name> -c <cg> --input-file <rdf>`                               | Append RDF payload quads                                       |
| `dkg ka import-file <name> -c <cg> --input-file <file>`                        | Extract a local document into WM                               |
| `dkg ka extraction-status <name> -c <cg>`                                      | Check document extraction status                               |
| \`dkg ka finalize -c \[--layer wm                                              | swm]\`                                                         |
| `dkg ka share <name> -c <cg> [--entity <uri...>] [--skip-seal]`                | Share WM to SWM                                                |
| `dkg ka share-async <name> -c <cg>`                                            | Enqueue async WM-to-SWM share                                  |
| `dkg ka share-jobs [--context-graph-id <cg>] [--state <states>] [--limit <n>]` | List async share jobs                                          |
| `dkg ka share-job <job-id>`                                                    | Show one async share job                                       |
| `dkg ka cancel-share-job <job-id>`                                             | Cancel a queued/retrying share job                             |
| `dkg ka recover-share-job <job-id>`                                            | Recover a failed share job                                     |
| `dkg ka publish <name> -c <cg>`                                                | Synchronously publish finalized, fully shared SWM to VM        |
| `dkg ka publish-async <name> -c <cg> [--publisher-node-identity-id 0]`         | Enqueue VM publish                                             |
| \`dkg ka pull-from -c --layer swm                                              | vm\`                                                           |
| `dkg ka discard <name> -c <cg>`                                                | Discard a WM draft                                             |
| `dkg ka query <name> -c <cg>`                                                  | Read WM quads                                                  |
| `dkg ka history <name> -c <cg>`                                                | Read lifecycle descriptor                                      |

`dkg assertion ...` remains as compatibility for older document import/query/promote flows. New docs and agents should prefer `dkg ka ...`.


---

# 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/use-dkg/knowledge-asset-lifecycle.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.
