openknowledge ast

August 3, 2026 ยท View on GitHub

Inspect the parser model that validation, search, listing, rendering, and exporters use. Use validate for pass or fail checks.

Usage

okn ast [key-or-path]
okn ast Wiki --spec 0.2
okn ast Wiki --out ast.json
OptionDefaultDescription
key-or-path.Registry key or bundle root.
--spec <version>latestOKF spec version.
--out <file>stdoutAtomically write the JSON document.

Output

The v1 AST contains the resolved root and spec version. It also contains Markdown documents in path order. Each document can include:

  • Source identity and classification: rel, id, kind, and reserved.
  • Complete content and body.
  • Typed YAML frontmatter and compatible scalar values.
  • Derived title, type, description, tags, resource, and bundle metadata.
  • Markdown blocks, sections, headings, links, and code blocks.
  • Read, UTF-8, frontmatter, and Markdown diagnostics.
{
  "schemaVersion": "1",
  "root": "/work/project-memory",
  "specVersion": "0.2",
  "documents": [
    {
      "rel": "AGENTS.md",
      "id": "AGENTS",
      "kind": "concept",
      "metadata": {"type": "Agent Rules"}
    }
  ]
}

The ast.schema.json file defines the contract. AST output is a detailed diagnostic format. export json provides a smaller normalized bundle model.


Source anchors

  • packages/cli/cmd/openknowledge/ast_command.go
  • packages/cli/internal/okf/ast_bundle_parse.go
  • packages/cli/internal/okf/ast_document_types.go
  • packages/cli/schemas/v1/ast.schema.json