spec 1.0 · 規範

Leji コンテキストインデックス

AI エージェントの支援による翻訳です。内容に相違がある場合は、英語版ページが優先されます。文章に問題を見つけた際は、Issueまたはプルリクエストをお願いします。

コンテキストレイヤーの、生成される地図です。手で維持するものではなく、変更のたびに生成し直します。

正規の $idhttps://leji.org/schemas/v1.0/context-index.schema.json
生ファイル:context-index.schema.json

フィールド

#schemaVersionstring必須

この成果物が書かれた対象の Leji 仕様系列です。たとえば "1.0"。

パターン ^\d+\.\d+$

#generatedAtstring必須

インデックスが生成された時刻の ISO 8601 タイムスタンプです。

パターン ^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])[T ].+$

#generatorobject

このインデックスを生成したツールです。

namestring

生成したツールの名前です。たとえば "leji"。

versionstring

生成したツールのバージョンです。

#rootPathstring必須

このインデックスが生成された対象の、コンテキストレイヤーのルートです。マニフェストの rootPath と一致します。エントリのパスはリポジトリルートからの相対であり、このルートを基準に取り直されることはありません。

パターン ^(?!/)(?!\./)(?!.*(^|/)\.\.(/|$))(?!.*\\).*$

#entriesオブジェクトの配列必須

コンテキストレイヤーの中でインデックス化された文書 1 件につき、1 エントリです。idpath も、エントリ全体を通じて一意です。リファレンスの検証ツールがそれを強制します(制約が対象とするのはオブジェクト全体ではなく下位のフィールドなので、JSON Schema では表現できません)。

idstring必須

安定した識別子です。改名や移動が更新するのは path であって、id ではありません。

pathstring必須

その文書への、リポジトリルートからの相対パスです。

titlestring必須

人が読めるタイトルです。その文書の最初の見出しか、フロントマターから取ります。

category"domain" · "system" · "practice" · "governance" · "decisions"必須

この文書が、どのコンテンツカテゴリに属するかです。

kind"intent" · "record"

その文書が、維持される現在の真実(intent)なのか、日付のある証跡(record)なのかです。値がない場合は intent を意味します。

datestring

record の日付です。妥当なフロントマターの date からのみ取ります。

summarystring

その文書の一行の要約です。経路の決定とナビゲーションに使います。

tags文字列の配列

自由な形式のタグです。任意です。

owners文字列の配列

この文書の所有者です。任意です。

lastModifiedstring

その文書が最後に変わった日付(ISO 8601)です。可能な場合はバージョン管理から取ります。

contentHashstring

その文書の内容のハッシュです。ずれと、内容を保ったままの移動を見分けるために使います。

freshnessobject

この文書のレビューの期限です。

reviewAfterstring

この日付を過ぎたら、文書が古くなっていないか見直すべき、という ISO 8601 の日付です。

links文字列の配列

この文書からの外向きの参照です。任意です。

#mountsオブジェクトの配列

フェデレーションされた兄弟コンテキストレイヤーの、経路の記録です。マニフェストの federation.mounts から導かれます(仕様: distribution.md、machine-readable-surface.md)。経路のメタデータに限られます。ツールは、兄弟のインデックスエントリや散文をここへコピーしてはなりません(MUST NOT)。マウントの記録は、ホストの読み手が見てはならないものを決して明かしません。

namestring必須

兄弟レイヤーの名前です。兄弟自身のマニフェストにある name と一致します。

sourcestring必須

兄弟レイヤーの、正規化されたリポジトリの所在です。

pinstring必須

ホストが読む兄弟のリビジョンの、不変なコミット id(SHA-1 または SHA-256)を完全な形で示したものです。

trackingRefstring

到達可能性と古さを照らして判断する相手となる、完全修飾の参照(証跡となる参照)です。宣言されている場合に使われます。

ownerobject必須

兄弟レイヤーの所有者です。

namestring必須
contactstring
rolestring

その兄弟が何を担っているかの、散文による説明です。

categories"domain" · "system" · "practice" · "governance" · "decisions" の配列

この兄弟が答えを返せる、コンテンツカテゴリの範囲です。

topics文字列の配列

関連度による経路の決定に使う、短いトピックのラベルです。

requiredWhen文字列の配列

読み手がこのマウントを解決しなければならない、さもなければフェイルクローズする、という作業の条件です。

スキーマと実例

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://leji.org/schemas/v1.0/context-index.schema.json",
  "title": "Leji context index",
  "description": "Generated map of the context layer. Never hand-maintained; regenerate on change.",
  "type": "object",
  "required": [
    "schemaVersion",
    "generatedAt",
    "rootPath",
    "entries"
  ],
  "additionalProperties": false,
  "properties": {
    "$schema": {
      "description": "Optional pointer to this schema, for editor validation and tooling.",
      "type": "string"
    },
    "schemaVersion": {
      "description": "The Leji spec line this artifact was written against, e.g. \"1.0\".",
      "type": "string",
      "pattern": "^\\d+\\.\\d+$"
    },
    "generatedAt": {
      "description": "ISO 8601 timestamp when the index was generated.",
      "type": "string",
      "pattern": "^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\\d|3[01])[T ].+$"
    },
    "generator": {
      "description": "The tool that generated this index.",
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "name": {
          "description": "Name of the generating tool, e.g. \"leji\".",
          "type": "string"
        },
        "version": {
          "description": "Version of the generating tool.",
          "type": "string"
        }
      }
    },
    "rootPath": {
      "description": "The context layer root this index was generated for; mirrors the manifest's rootPath. Entry paths are repository-root-relative, not re-based under it.",
      "type": "string",
      "pattern": "^(?!/)(?!\\./)(?!.*(^|/)\\.\\.(/|$))(?!.*\\\\).*$"
    },
    "entries": {
      "description": "One entry per indexed document in the context layer. Each `id` and each `path` is unique across entries; the reference validator enforces this (JSON Schema cannot, since the constraint is on a sub-field, not the whole object).",
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "id",
          "path",
          "title",
          "category"
        ],
        "additionalProperties": false,
        "properties": {
          "id": {
            "description": "Stable identifier; renames and moves update the path, never the id.",
            "type": "string",
            "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$"
          },
          "path": {
            "description": "Repository-root-relative path to the document.",
            "type": "string",
            "pattern": "^(?!/)(?!\\./)(?!.*(^|/)\\.\\.(/|$))(?!.*\\\\).+$"
          },
          "title": {
            "description": "Human-readable title, from the document's first heading or frontmatter.",
            "type": "string",
            "minLength": 1
          },
          "category": {
            "description": "Which content category this document belongs to.",
            "enum": [
              "domain",
              "system",
              "practice",
              "governance",
              "decisions"
            ]
          },
          "kind": {
            "description": "Whether the document is maintained present truth (intent) or dated evidence (record). Absent means intent.",
            "enum": [
              "intent",
              "record"
            ]
          },
          "date": {
            "description": "A record's date, sourced only from valid frontmatter date.",
            "pattern": "^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\\d|3[01])$",
            "type": "string"
          },
          "summary": {
            "description": "One-line summary of the document, for routing and navigation.",
            "type": "string"
          },
          "tags": {
            "description": "Optional free-form tags.",
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "owners": {
            "description": "Optional owners of this document.",
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "lastModified": {
            "description": "ISO 8601 date the document last changed, from version control where available.",
            "type": "string",
            "pattern": "^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\\d|3[01])([T ].*)?$"
          },
          "contentHash": {
            "description": "Hash of the document's contents, used to detect drift and stable moves.",
            "type": "string"
          },
          "freshness": {
            "description": "Review horizon for this document.",
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "reviewAfter": {
                "description": "ISO 8601 date after which the document should be reviewed for staleness.",
                "type": "string",
                "pattern": "^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\\d|3[01])$"
              }
            }
          },
          "links": {
            "description": "Optional outbound references from this document.",
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      }
    },
    "mounts": {
      "description": "Routing records for federated sibling context layers, derived from the manifest's federation.mounts (spec: distribution.md, machine-readable-surface.md). Routing metadata only: tooling MUST NOT copy a sibling's index entries or prose here. A mount record never discloses what the host's audience may not see.",
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "name",
          "source",
          "pin",
          "owner"
        ],
        "additionalProperties": false,
        "properties": {
          "name": {
            "description": "The sibling layer's name; matches the name in the sibling's own manifest.",
            "type": "string",
            "minLength": 1
          },
          "source": {
            "description": "Normalized repository locator of the sibling layer.",
            "type": "string",
            "minLength": 1
          },
          "pin": {
            "description": "Full immutable commit id (SHA-1 or SHA-256) of the sibling revision the host reads.",
            "type": "string",
            "pattern": "^([0-9a-f]{40}|[0-9a-f]{64})$"
          },
          "trackingRef": {
            "description": "Fully qualified witness ref reachability and staleness are compared against, when declared.",
            "type": "string",
            "pattern": "^refs/(heads|tags)/.+$"
          },
          "owner": {
            "description": "The owner of the sibling layer.",
            "type": "object",
            "required": [
              "name"
            ],
            "additionalProperties": false,
            "properties": {
              "name": {
                "type": "string",
                "minLength": 1
              },
              "contact": {
                "type": "string"
              }
            }
          },
          "role": {
            "description": "Prose description of what the sibling carries.",
            "type": "string"
          },
          "categories": {
            "description": "Content-category scopes this sibling can answer for.",
            "type": "array",
            "items": {
              "enum": [
                "domain",
                "system",
                "practice",
                "governance",
                "decisions"
              ]
            }
          },
          "topics": {
            "description": "Short topic labels for relevance routing.",
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            }
          },
          "requiredWhen": {
            "description": "Task conditions under which a reader must resolve this mount or fail closed.",
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            }
          }
        }
      }
    }
  }
}

生成されたコンテキストインデックスです。変更のたびに CLI が生成し直します。

{
  "$schema": "https://leji.org/schemas/v1.0/context-index.schema.json",
  "schemaVersion": "1.0",
  "generatedAt": "2026-07-31T12:23:37.412Z",
  "generator": {
    "name": "leji",
    "version": "1.3.1"
  },
  "rootPath": "docs/",
  "entries": [
    {
      "id": "adopt-leji",
      "path": "docs/decisions/0001-adopt-leji.md",
      "title": "Leji コンテキストレイヤーの導入",
      "category": "decisions",
      "kind": "record",
      "date": "2026-06-10",
      "lastModified": "2026-06-17",
      "contentHash": "sha256:9680ba24ad268894"
    },
    {
      "id": "glossary",
      "path": "docs/domain/glossary.md",
      "title": "用語集",
      "category": "domain",
      "kind": "intent",
      "summary": "Acme における invoice、credit note、settlement の意味。",
      "lastModified": "2026-06-17",
      "contentHash": "sha256:22d9bcc4fe0ce860"
    },
    {
      "id": "system-invariants",
      "path": "docs/system/invariants.md",
      "title": "システムの不変条件",
      "category": "system",
      "kind": "intent",
      "summary": "金銭の扱い、元帳の追記のみの規則、サービスの境界。",
      "lastModified": "2026-06-17",
      "contentHash": "sha256:6e179b4fa71bd5ad",
      "freshness": {
        "reviewAfter": "2026-12-10"
      }
    }
  ]
}

← スキーマ一覧