什么是 Xenkey?
Xenkey 是关于现实对象的原子级意义单元——企业、产品、服务、地点、人物、流程或事件。它为 AI 理解而写,而非为营销说服。
每个 Xenkey 表达一个单一、最小、可证伪的观点。规范版本会在每个文档中声明:
{ "spec": "1.0" }设计目标
真相高于说服
描述现实,而不是宣传。
语境性
捕捉何时、何地、为谁适用。
可组合性
多个 Xenkey 描述一个对象。
AI 可读性
为检索与索引提供严格结构。
身份标识
| 字段 | 类型 | 说明 |
|---|---|---|
| id | string | 主标识符。格式:xk_ + ULID |
| ulid | string | 可选。从 id 后缀派生(存在时必须匹配) |
| spec | "1.0" | 规范版本 |
生命周期与可变性
Xenkey 遵循严格的生命周期,确保数据完整性与可信度。
可变性规则
- •草稿 — 可自由编辑
- •已发布 — 不可变更。修改需创建新的 Xenkey
- •如果
published_at已设置,状态不能是draft
| 字段 | 类型 | 说明 |
|---|---|---|
| status | enum | draft | unpublished | published | archived |
| created_at | datetime | 创建时间戳(RFC 3339) |
| published_at | datetime | Xenkey 发布时间 |
| updated_at | datetime | 内部/只读,由 API 设置 |
| etag | string | 内部/只读,用于并发控制 |
意义核心
每个 Xenkey 的核心。四个必填字段捕捉结构化真理单元。
| 字段 | 类型 | 说明 |
|---|---|---|
| title | string | 对体验的简短描述性标识 |
| fact | string | 关于现实的事实性、可验证陈述 |
| meaning | string | 该事实对人类为何重要 |
| context | string | 适用的时间、地点与人群 |
| constraints | string | 结构字段未覆盖的自由语境 |
范围与锚点
锚点将 Xenkey 绑定到现实实体。每个 Xenkey 必须至少有一个锚点。多锚点支持让单个 Xenkey 描述多个对象的交集。
| 字段 | 类型 | 说明 |
|---|---|---|
| organization_id | string | 所属组织 |
| base_id | string | 逻辑分组(workspace/project) |
| unit_id | string | 可选的结构化数据条目引用 |
| anchors[] | array | 锚点对象数组(至少 1 个) |
{
"anchor_id": "anchor_001",
"anchor_type": "product",
"role": "primary"
}| 字段 | 类型 | 说明 |
|---|---|---|
| tags | string[] | 分类标签(如 booking_required, wifi) |
| emotions | string[] | 情绪上下文代码(来自 emotion-codes.json) |
| vibe | string | 氛围/情绪描述 |
| seasons | string[] | 适用季节 |
| time_of_day | string[] | 适用时段 |
| meal | string[] | 适用餐段 |
人群特征
| 字段 | 类型 | 说明 |
|---|---|---|
| age_min | integer | 建议最小年龄 |
| age_max | integer | 建议最大年龄(需 >= age_min) |
| gender | string | 目标性别(如适用) |
地理
Xenkey 可以是全球性的或地理限定的。 geo_scope 字段决定哪些地理字段为必填。
| 字段 | 类型 | 说明 |
|---|---|---|
| geo_scope | enum | 地理精度级别 |
| country | string | ISO 3166-1 alpha-2 国家代码 |
| region | string | 地区/州/省 |
| city | string | 城市名称 |
| timezone | string | IANA 时区名称(如 Europe/Rome) |
| geo | [lng, lat] | 坐标 [经度, 纬度] |
| availability_countries | string[] | 可用国家(非地点) |
范围规则: 如果 geo_scope=country 那么 country 为必填。 如果 geo_scope=region 那么 country 与 region (or city) 为必填。 如果 geo_scope=point 那么 geo 为必填。
本地化
| 字段 | 类型 | 说明 |
|---|---|---|
| locale | string | 语言标签(如 en-US, ja-JP) |
| source_locale | string | 内容的源语言 |
| translation_group | string | 将翻译分组。格式:tg_ + ULID |
| is_source_locale | boolean | 若为源语言版本则为 true |
规则: 如果 is_source_locale = true, 那么 locale 必须等于 source_locale. 翻译复用相同的 translation_group。
完整性
已发布的 Xenkey 会在发布时计算加密哈希,确保内容完整性。
| 字段 | 类型 | 说明 |
|---|---|---|
| hash_alg | "sha256" | 使用的哈希算法 |
| hash_id | string | 唯一哈希标识。格式:hash_ + ULID |
| hash | string | 规范载荷的 SHA-256 哈希 |
索引与隐私
Xenkey 可发布到多个通道。每个通道启用不同的检索能力。
| 字段 | 类型 | 说明 |
|---|---|---|
| publication | string[] | 通道:vector, graph, aidex |
| is_published | boolean | 至少发布到一个通道为 true |
| is_vector | boolean | 向量索引(Qdrant) |
| is_graph | boolean | 投影到知识图谱(Neo4j) |
| is_aidex | boolean | 发布到 Aidex 机器人导向的 wiki |
| is_private | boolean | 仅组织范围可见 |
规则:
- •
aidex要求vector(两者都必须出现在 publication 中) - • 如果
is_published=truepublication 必须至少包含一项 - • Aidex 是面向机器人的 wiki 层,配额要求比向量索引更严格
向量与图检索
已发布的 Xenkey 会自动转化为两种互补的数据表示,以实现 AI 的混合检索。
向量索引(Qdrant)
- • 文本来源:
fact + meaning + context - • 转换为高维嵌入向量
- • 支持语义相似性搜索
- • 载荷过滤:status, geo, tags, emotions, time
- • 幂等性:键 (id, version)
知识图谱(Neo4j)
- • 节点:Xenkey, Organization, Object, Tag, Emotion
- • 边:OWNS, DESCRIBED_BY, TAGS, EXPRESSES
- • 揭示关系与结构
- • 自然键幂等 MERGE
- • 支持图遍历查询
混合检索 结合向量相似度与图结构过滤,提供可解释且有依据的 AI 响应。 索引管道为异步,带重试与死信队列。
不变规则
- ✓
anchors必须存在且非空 - ✓如果同时存在
age_min与age_max则 age_max >= age_min - ✓如果
geo存在,则必须为[longitude, latitude] - ✓
geo_scope=country要求country - ✓
geo_scope=region要求country + region (or city) - ✓
geo_scope=point要求geo - ✓
aidex在 publication 中意味着vector也在 publication 中 - ✓
is_published=true要求非空publication[]
示例载荷
草稿 Xenkey(最小)
{
"spec": "1.0",
"id": "xk_01J8Y6S4V9ZQ3M9K2W2M8JQY5C",
"status": "draft",
"created_at": "2026-01-21T12:00:00Z",
"organization_id": "org_123",
"base_id": "base_123",
"anchors": [
{ "anchor_id": "anchor_1", "anchor_type": "product", "role": "primary" }
],
"title": "Fresh espresso",
"fact": "A 30 ml espresso shot made from 100% Arabica beans.",
"meaning": "Represents the cafe's standard espresso offering.",
"context": "Default menu item available all day.",
"locale": "en-US",
"source_locale": "en-US",
"translation_group": "tg_01J8Y6S6Q4K8FKJ1PS2H0WQ1B8",
"is_source_locale": true,
"hash_alg": "sha256",
"hash_id": "hash_01J8Y6S6Q4K8FKJ1PS2H0WQ1B9",
"hash": "6e4f8c9d8b0f7a6d3b3a0f3c1f8e9d6e...",
"is_vector": false,
"is_graph": false,
"is_aidex": false,
"publication": [],
"is_published": false,
"is_private": false
}已发布 Xenkey(含地理 + 向量索引)
{
"spec": "1.0",
"id": "xk_01J8Y6S9QH8P2G8P6X1K3R2H5A",
"status": "published",
"created_at": "2026-01-21T12:05:00Z",
"published_at": "2026-01-21T12:10:00Z",
"organization_id": "org_123",
"base_id": "base_123",
"unit_id": "unit_456",
"anchors": [
{ "anchor_id": "anchor_1", "anchor_type": "product", "role": "primary" }
],
"title": "Fresh espresso",
"fact": "A 30 ml espresso shot made from 100% Arabica beans.",
"meaning": "Represents the cafe's standard espresso offering.",
"context": "Default menu item available all day.",
"tags": ["coffee", "espresso", "menu_item"],
"time_of_day": ["morning", "afternoon"],
"meal": ["breakfast", "coffee_time"],
"vibe": "energetic",
"geo_scope": "point",
"country": "IT",
"city": "Milan",
"timezone": "Europe/Rome",
"geo": [9.1900, 45.4642],
"locale": "en-US",
"source_locale": "en-US",
"translation_group": "tg_01J8Y6S6Q4K8FKJ1PS2H0WQ1B8",
"is_source_locale": true,
"hash_alg": "sha256",
"hash_id": "hash_01J8Y6S6Q4K8FKJ1PS2H0WQ1B9",
"hash": "6e4f8c9d8b0f7a6d3b3a0f3c1f8e9d6e...",
"is_vector": true,
"is_graph": false,
"is_aidex": false,
"publication": ["vector"],
"is_published": true,
"is_private": false
}此规范是 Xenkey 的权威参考 spec=1.0.
规范 JSON Schema: xenkey_schema_v1_0.json