Skip to content

Output schemas

All formats contain a budget-limited path listing and selected source. Source entries use FULL, SKEL, or SIGS. A TREE selection contributes only to the path listing, when space allows.

CLI statistics go to stderr. Scores, findings, dependency edges, and token counts are SDK metadata and are not fields in these serialized artifacts.

JSON

Use --format json to produce an object with two arrays:

JSON
{
  "files": ["main.py", "helper.py"],
  "context": [
    {
      "path": "main.py",
      "language": "python",
      "tier": "FULL",
      "content": "from helper import ready\nprint(ready())\n"
    }
  ]
}
FieldTypeMeaning
filesArray of stringsRepository-relative paths retained in the listing
contextArray of objectsFiles with selected source beyond TREE
context[].pathStringSource file path
context[].languageString or nullRegistry language ID, or null when unknown
context[].tierStringFULL, SKEL, or SIGS
context[].contentStringSelected source after secret protection

The JSON Schema describes these fields. Parse the JSON rather than relying on whitespace, property order, or matching array indexes. An empty artifact has empty files and context arrays.

XML

Use --format xml for a context root containing a files element and zero or more source elements:

xml
<context>
  <files>
    <file path="main.py"/>
    <file path="helper.py"/>
  </files>
  <source path="main.py" tier="FULL" language="python">from helper import ready&#10;print(ready())&#10;</source>
</context>

The example is indented for reading. Generated XML is compact. Each source has path, tier, and language attributes, with an empty language attribute when detection is unknown. An XML parser restores escaped source characters, including line breaks. Source is text content, not CDATA.

Markdown

Markdown starts with # Repository context and a ## Files listing. Each listed path is a JSON-quoted string. Selected source follows under headings containing the quoted path and tier:

Markdown
## "main.py" (FULL)

```python
from helper import ready
print(ready())
```

The code-fence width grows when source contains backticks. Use JSON or XML when consuming artifacts programmatically, rather than parsing Markdown headings.

Paths, protection, and counts

Paths use repository-relative names. Sensitive-file policies can retain a path without source, and protection can redact path or source text. A tight budget can shorten the listing or lower source detail.

Counts apply to the exact generated bytes, including JSON escapes, XML entities, Markdown fences, and paths. Reformatting an artifact can change its token count. See export context for commands and secret protection for policy modes.