spec 1.0 · chuẩn tắc

Frontmatter của agent profile Leji

Bản dịch có sự hỗ trợ của AI agent. Nếu có khác biệt, trang tiếng Anh là bản có hiệu lực. Nếu bạn thấy vấn đề nào trong văn bản, rất mong bạn mở một issue hoặc gửi một pull request.

Kiểm tra phần frontmatter YAML của một tài liệu agent profile. Phần thân markdown vẫn để tự do.

$id chuẩn: https://leji.org/schemas/v1.0/agent-profile.schema.json
Tệp gốc: agent-profile.schema.json

Các trường

#idstringbắt buộc

Định danh ổn định cho profile này, ví dụ "core" hoặc "reviewer".

Mẫu ^[a-z0-9]+(-[a-z0-9]+)*$

#namestringbắt buộc

Tên vai trò, dạng người đọc được.

#rolestringbắt buộc

Định danh vai trò mà profile này đảm nhận, được gắn trong map agents của manifest.

#purposestring

Một dòng nói vai trò này để làm gì.

#versionstring

Phiên bản của profile này; không bắt buộc.

#inheritsstring

id của một profile core duy nhất mà profile này kế thừa các mảng tư thế và phần thân, được phân giải theo bản đặc tả. Việc phân giải chỉ một cấp: đích phải tồn tại, phải là duy nhất, và phải khai báo role là core. Một profile có khai báo inherits được phép bỏ qua requiredRead và mustAskWhen ở những chỗ profile gốc đã cung cấp.

Mẫu ^[a-z0-9]+(-[a-z0-9]+)*$

#requiredReadmảng chuỗi

Các đường dẫn vai trò này nạp trước bất kỳ tác vụ nào.

#defaultContextmảng gồm "domain" · "system" · "practice" · "governance" · "decisions"

Các danh mục vai trò này nạp mặc định.

#mustAskWhenmảng chuỗi

Những điều kiện mà ở đó vai trò phải dừng lại và hỏi một con người.

#mustRefuseWhenmảng chuỗi

Những điều kiện mà ở đó vai trò phải từ chối thẳng thay vì hỏi.

#escalationstring

Chuyển lên cho ai hoặc cho đâu.

#ownersmảng chuỗi

Chủ sở hữu của profile này; không bắt buộc.

#freshnessobject

Hạn xem xét lại của profile này.

reviewAfterstring

Ngày theo ISO 8601, sau ngày đó profile nên được xem xét lại xem đã lỗi thời chưa.

#hoststring

Agent host chạy agent này, ví dụ "claude-code", "codex", "cursor". Bỏ trống với những profile không gắn với host nào.

#invocationobject

Cách gọi agent này như một CLI bên ngoài. Bỏ trống với agent thường trú của chính host.

commandstringbắt buộc

Mẫu câu lệnh để gọi agent này từ shell. Phải mang chỗ giữ <prompt>, đứng thành một từ shell riêng không đặt trong dấu nháy; pattern chỉ kiểm rằng chỗ thay thế có tồn tại, còn vị trí đặt là quy tắc của bản đặc tả.

constraintsmảng chuỗi

Những ràng buộc vận hành đáng cho máy biết, ví dụ giới hạn độ dài prompt hay thời gian chờ.

Schema và ví dụ

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://leji.org/schemas/v1.0/agent-profile.schema.json",
  "title": "Leji agent profile frontmatter",
  "description": "Validates the YAML frontmatter of an agent profile document. The markdown body stays free-form.",
  "type": "object",
  "required": [
    "id",
    "name",
    "role"
  ],
  "if": {
    "not": {
      "required": [
        "inherits"
      ]
    }
  },
  "then": {
    "required": [
      "requiredRead",
      "mustAskWhen"
    ]
  },
  "additionalProperties": false,
  "properties": {
    "id": {
      "description": "Stable identifier for this profile, e.g. \"core\" or \"reviewer\".",
      "type": "string",
      "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$"
    },
    "name": {
      "description": "Human-readable name of the role.",
      "type": "string",
      "minLength": 1
    },
    "role": {
      "description": "The role identifier this profile fills, bound in the manifest's agents map.",
      "type": "string",
      "minLength": 1
    },
    "purpose": {
      "description": "One line on what this role is for.",
      "type": "string"
    },
    "version": {
      "description": "Optional version of this profile.",
      "type": "string"
    },
    "inherits": {
      "type": "string",
      "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$",
      "description": "id of the single core profile whose posture arrays and body this profile extends, resolved per the specification. Resolution is single-level: the target must exist, be unique, and declare role core. A profile that declares inherits may omit requiredRead and mustAskWhen where the base supplies them."
    },
    "requiredRead": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "string",
        "pattern": "^(?!/)(?!\\./)(?!.*(^|/)\\.\\.(/|$))(?!.*\\\\).+$"
      },
      "description": "Paths this role loads before any task."
    },
    "defaultContext": {
      "type": "array",
      "items": {
        "enum": [
          "domain",
          "system",
          "practice",
          "governance",
          "decisions"
        ]
      },
      "description": "Categories this role loads by default."
    },
    "mustAskWhen": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "string"
      },
      "description": "Conditions under which the role must stop and ask a human."
    },
    "mustRefuseWhen": {
      "description": "Conditions under which the role must refuse outright rather than ask.",
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "escalation": {
      "type": "string",
      "description": "Who or what to escalate to."
    },
    "owners": {
      "description": "Optional owners of this profile.",
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "freshness": {
      "description": "Review horizon for this profile.",
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "reviewAfter": {
          "description": "ISO 8601 date after which the profile should be reviewed for staleness.",
          "type": "string",
          "pattern": "^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\\d|3[01])$"
        }
      }
    },
    "host": {
      "type": "string",
      "description": "The agent host that runs this agent, e.g. \"claude-code\", \"codex\", \"cursor\". Omit for host-agnostic profiles."
    },
    "invocation": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "command"
      ],
      "properties": {
        "command": {
          "type": "string",
          "pattern": "<prompt>",
          "description": "Command template to engage this agent from a shell. Must carry the <prompt> placeholder, standing as its own unquoted shell word; the pattern verifies the substitution site exists, placement is the spec's rule."
        },
        "constraints": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Operational constraints worth machine-knowing, e.g. prompt length limits, timeouts."
        }
      },
      "description": "How to engage this agent as an external CLI. Omit for the host's own resident agent."
    }
  }
}

Một agent profile hợp lệ. Schema này kiểm tra phần frontmatter YAML; phần thân markdown bên dưới là văn bản tự do.

---
id: thought-partner
name: Thought Partner (Codex)
role: thought-partner
purpose: Ý kiến thứ hai độc lập về câu chữ, các quyết định thiết kế và những câu hỏi cần phán đoán.
host: codex
invocation:
  command: codex exec --skip-git-repo-check <prompt>
  constraints:
    - giữ prompt ngắn gọn; prompt quá dài sẽ làm CLI treo
    - không tương tác; một prompt vào, một câu trả lời ra, không giữ trạng thái phiên
inherits: core
requiredRead:
  - docs/boot-profile.md
mustAskWhen:
  - khi kết luận sẽ làm thay đổi một quyết định đã ghi
  - khi câu hỏi liên quan tới tài liệu mật chưa có trong lớp ngữ cảnh
---

# Thought Partner (Codex)

Được gọi qua vai trò `thought-partner` trong `leji.json`, không bao giờ gọi
đích danh trong các quy trình. Hãy giao việc bằng những prompt tự chứa: đoạn câu
chữ hoặc quyết định liên quan, những ràng buộc đang chi phối nó, và câu hỏi
chính xác cần trả lời. Nó không truy cập được kho mã nguồn này hay lịch sử của
kho mã nguồn; mọi thứ nó cần cân nhắc đều phải nằm trong prompt.

Hãy xem kết luận của nó như một góc nhìn. Khi partner này và agent thường trú
bất đồng, việc đó được đưa lên một con người, kèm cả hai cách nhìn.

← Tất cả schema