---
title: .gram syntax
description: The current source envelope, identifiers, fields, blocks and literal escaping.
url: https://docs.thegram.one/ko/reference/syntax-guide/
lang: en
requested_lang: ko
fallback_from: https://docs.thegram.one/reference/syntax-guide/
tier: current
status:
  component: .gram format / Gram Core
  deployment: n/a (format spec)
  applies_to_version: Latest
  status: GA
  last_verified: "2026-10-25"
  owner: thegram-one/thegram-format
  public_evidence:
    - https://thegram.one/gram-file/
  rationale: The public .gram overview documents the plain-text file format and its retained history; no separate syntax-spec release version was found.
source: https://docs.thegram.one/sources/syntax-guide.gram
date_published: "2026-10-12T13:11:21.788Z"
date_modified: "2026-10-12T23:17:37.880Z"
evidence:
  Canonical source SHA-256: 8443977830c651d7784d91bdd61fee6ae2f76935a85554b60d90bc35221d532f
  Selected revision: r5 · sha256:ea389f0d8defd071208f4d889781a58995aa696f15680ea28652a2928d9a0394
  Local renderer: configured local Thegram renderer · API thegram-web-render/1
  Core source: git+https://github.com/clab-one/thegram-format.git?rev=b16489e1d0d77d38f82d2f61776524737aa31557#b16489e1d0d77d38f82d2f61776524737aa31557
---

# .gram syntax

<div class="gram-doc-anchor" id="e0-portal-reference-syntax-guide"></div>

### Current source {#h0-2}

A current document begins with `@gram 2`, a `doc <id>` owner, and zero or more typed records. Current writer files end in a Core-owned `@gram-history 6` trailer. The trailer is not authored article content.

`@gram 1` remains a readable legacy source version; it is not the current writer format. IDs are stable document-local identifiers using letters, digits, hyphens or underscores. A record begins with a type code and ID, such as `K local-search` or `T review-index`. IDs are not derived from titles.

### Fields and values {#h0-5}

A field is one line: `key value`. The value is the rest of that line and remains text; the format does not coerce a date, number, status or color. Common keys include `t` (title), `d` (description), `x` (status), `s` (scope), `p` (priority), `owner`, `tag`, `source`, `ref`, `view` and `motion`. `t` is required on the document and known records. Singleton fields cannot repeat; `tag` and `source` may repeat.

### Blocks {#h0-7}

A literal block starts with `::kind` and ends at a line exactly equal to `::end`. Payload is data, not executable code; block bodies do not nest. Unknown block kinds are retained. When a payload line itself equals `::end`, escape it as `\::end`; the reader removes the escape.

### Minimal valid source {#h0-9}

```text
@gram 2
doc index-notes
t Index notes
K lookup
t Keep query boundaries explicit
::reason
The index is a derived view, not canonical document content.
\\\\\\::end
An escaped terminator line remains literal payload.
::end
```

A payload line equal to a terminator must be escaped, and the block still needs its own closing ::end.

See Records for type/field conventions and Relations for edge direction. Source grammar and validation are defined by the linked Core format specification.

## Source

<div class="gram-record" id="e0-format-language" data-record-type="source">

**Source:** .gram language specification

Reference: [https://github.com/clab-one/thegram-format/blob/main/spec/language.md](https://github.com/clab-one/thegram-format/blob/main/spec/language.md)

</div>

<div class="gram-record" id="e0-format-rich" data-record-type="source">

**Source:** Current rich document specification

Reference: [https://github.com/clab-one/thegram-format/blob/main/spec/rich-document.md](https://github.com/clab-one/thegram-format/blob/main/spec/rich-document.md)

</div>

<div class="gram-record" id="e0-format-history6" data-record-type="source">

**Source:** Current History/6 specification

Reference: [https://github.com/clab-one/thegram-format/blob/main/spec/source-history-render.md](https://github.com/clab-one/thegram-format/blob/main/spec/source-history-render.md)

</div>
