Relicex 资产包规范 · 给任何大模型

生成可单独售卖、也可被方案复用的 package.zip

这份规范告诉创作者或任意大模型:zip 里应该有哪些文件,manifest.json 应该怎么写,能力包如何声明运行入口、输入输出、凭证和权限,以及这个资产包如何成为解决方案的底层组件。

manifest.jsonREADME.mdrelicex.pack.v0package.zip

双核心定位

资产包既是商品,也是方案组件

买家可以单独购买资产包,也可以购买由多个资产包支撑的完整方案。package.zip / manifest.json 负责描述底层能力;listing、solution 和 checkout 负责描述价格、授权、交付和分账。

单独售卖

资产包可以作为 Asset Library 中的独立商品被购买和授权。

方案复用

资产包也可以作为 memory、experience、capability 或 evaluation 组件支撑解决方案。

复用分账

当资产包被方案引用时,收益结算可以体现上游资产贡献。

给模型的最短指令

复制这一段给任何模型

如果你不想解释整套平台,只要让模型先读这段,再读下面的 manifest 模板即可。

LLM Prompt
你要生成一个符合 Relicex relicex.pack.v0 的 package.zip。请只生成公开可授权的内容,不要包含任何 API key、token、password、cookie、private key、.env、个人隐私或未授权内容。

必须输出:
1. zip 根目录 manifest.json。
2. zip 根目录 README.md。
3. manifest.files 中列出的所有文件。
4. 如果 kind=capability_pack,必须有 runtime、inputs_schema、outputs_schema、workflow、evaluation,并提供 code/main.py:run 或等价入口。

manifest.id 必须匹配 ^[a-z0-9][a-z0-9_-]{2,79}$,不要把 _v1 写进 id,版本写入 manifest.version。
如果 capability_pack 需要文件输入或生成 Markdown、CSV、PDF、图片等产物,必须使用 inputs/input.json、inputs/files/、outputs/result.json、artifacts/、logs/、tmp/ 运行时目录约定,并在输出 JSON 中用相对路径引用 artifacts。
普通 capability_pack 属于发布前需确认,不是默认高风险;只有包含真实 secret、个人数据、prompt-injection、危险扩展名或 risk_level=high 时才标高风险。
listing 的价格、库存、发布状态、订阅和商业授权不属于 manifest。
真实凭证不能写入包内;只能用 secret_requirements 声明运行时需要的环境变量名。

硬性契约

一个合规 Relicex 资产包必须满足这些规则

平台校验、Agent 读取、交付、下载、本地运行都围绕这些字段和文件工作。

根目录固定

manifest.json 和 README.md 必须在 zip 根目录。manifest.files 里引用的路径必须真实存在。

包名规范

manifest.id 是规范包名,必须机器可读、稳定,不包含版本后缀。

类型明确

kind 只能是 memory_pack、experience_pack 或 capability_pack。不同类型有不同必备章节。

风险分级

普通能力包只是发布前需确认,不默认标红为高风险。

输入输出统一

文件型能力包使用 inputs/、outputs/、artifacts/、logs/ 和 tmp/ 运行时目录。

不含密钥

包内不能有真实凭证,只能通过 secret_requirements 声明运行时环境变量。

推荐 zip 目录结构

manifest.json 必须在根目录。其他目录可以按资产类型组织,但 manifest.files 中声明的路径必须和 zip 内路径一致。

package.zip
package.zip
├── manifest.json                 # required, at zip root
├── README.md                     # required for humans and Agents
├── docs/                         # optional supporting docs
│   └── usage.md
├── prompts/                      # optional prompt assets
│   └── system_prompt.md
├── templates/                    # optional reusable templates
│   └── report.md
├── examples/                     # recommended examples
│   ├── example_input.json
│   └── example_output.md
├── code/                         # capability_pack only, if executable
│   └── main.py
├── assets/                       # optional static assets
└── memory/                       # memory_pack only, if needed

最小 experience_pack manifest 模板

经验包适合方法论、流程、提示词、模板和案例。它通常不需要 runtime。

manifest.json
{
  "api_version": "relicex.pack.v0",
  "kind": "experience_pack",
  "id": "api_design_playbook",
  "version": "0.1.0",
  "title": "API Design Playbook",
  "description": "A reusable workflow for designing API resources, auth, errors, and examples.",
  "author": {
    "name": "creator_or_team",
    "id": "creator_id"
  },
  "tags": ["api", "workflow", "experience"],
  "mode": "text",
  "runtime": null,
  "experience": {
    "goal": "Help an Agent design consistent API specs and implementation plans.",
    "inputs_hint": {
      "required": ["product goal", "users", "core entities"],
      "optional": ["existing API", "security constraints"]
    },
    "pitfalls": ["Mixing listing price or supply into manifest.json"],
    "recommended_params": {},
    "examples": ["examples/example_input.json"]
  },
  "files": {
    "readme": "README.md",
    "docs": ["docs/usage.md"],
    "code": [],
    "prompts": ["prompts/system_prompt.md"],
    "templates": ["templates/report.md"],
    "examples": ["examples/example_input.json", "examples/example_output.md"],
    "assets": []
  },
  "secret_requirements": [],
  "secret_groups": [],
  "runtime_permissions": {
    "network": { "required": false, "allow_domains": [] },
    "filesystem": { "writes": [] }
  },
  "redaction": {
    "enabled": true,
    "patterns": []
  }
}

capability_pack 运行入口模板

能力包是可执行资产,必须声明 runtime、输入输出 schema、workflow 和 evaluation。Python 入口可以写成 code/main.py:run。

manifest.json
{
  "api_version": "relicex.pack.v0",
  "kind": "capability_pack",
  "id": "github_issue_summarizer",
  "version": "0.1.0",
  "title": "GitHub Issue Summarizer",
  "description": "Summarizes GitHub issue JSON into a prioritized action report.",
  "author": { "name": "creator_or_team", "id": "creator_id" },
  "tags": ["github", "summary", "automation"],
  "mode": "code",
  "runtime": {
    "kind": "interpreted",
    "profile": "python311-base@1",
    "entry": { "kind": "python", "value": "code/main.py:run" }
  },
  "inputs_schema": {
    "type": "object",
    "properties": {
      "issues": { "type": "array", "items": { "type": "object" } }
    },
    "required": ["issues"]
  },
  "outputs_schema": {
    "type": "object",
    "properties": {
      "summary": { "type": "string" },
      "report_md": { "type": "string" },
      "artifacts": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "name": { "type": "string" },
            "path": { "type": "string" },
            "mime_type": { "type": "string" }
          },
          "required": ["name", "path"]
        }
      }
    },
    "required": ["summary", "report_md"]
  },
  "workflow": [
    {
      "id": "summarize",
      "executor": { "type": "code", "entry": "code/main.py:run" },
      "in": { "issues": "${inputs.issues}" },
      "out": ["summary", "report_md", "artifacts"]
    }
  ],
  "evaluation": {
    "required_outputs": ["summary", "report_md"]
  },
  "files": {
    "readme": "README.md",
    "docs": ["docs/usage.md"],
    "code": ["code/main.py"],
    "prompts": [],
    "templates": [],
    "examples": ["examples/example_input.json", "examples/example_output.md"],
    "assets": []
  },
  "secret_requirements": [],
  "secret_groups": [],
  "runtime_permissions": {
    "network": { "required": false, "allow_domains": [] },
    "filesystem": {
      "reads": ["./inputs"],
      "writes": ["./outputs", "./artifacts", "./logs", "./tmp"]
    }
  }
}
code/main.py
# code/main.py
from __future__ import annotations

import os
from pathlib import Path


def run(inputs: dict | None = None) -> dict:
    inputs = inputs or {}
    issues = inputs.get("issues") or []
    lines = ["# Issue summary", ""]
    for index, issue in enumerate(issues, start=1):
        title = issue.get("title", "Untitled") if isinstance(issue, dict) else str(issue)
        lines.append(f"{index}. {title}")
    report_md = "\n".join(lines)
    artifact_dir = Path(os.environ.get("RELICEX_ARTIFACT_DIR", "artifacts"))
    artifact_dir.mkdir(parents=True, exist_ok=True)
    (artifact_dir / "issue_summary.md").write_text(report_md, encoding="utf-8")
    return {
        "summary": f"Summarized {len(issues)} issues.",
        "report_md": report_md,
        "artifacts": [
            {
                "name": "issue_summary",
                "path": "artifacts/issue_summary.md",
                "mime_type": "text/markdown",
            }
        ],
    }

能力包运行时输入输出目录约定

核心契约仍然是 JSON:run(inputs: dict) -> dict、inputs_schema 和 outputs_schema。纯 JSON 能力包可以只返回 dict;如果读取用户文件或生成报告、CSV、PDF、图片等产物,就使用这套目录。

运行目录
<run_dir>/
├── inputs/
│   ├── input.json       # primary JSON object matching inputs_schema
│   └── files/           # CSV, PDF, images, uploaded data files
├── outputs/
│   └── result.json      # primary JSON object matching outputs_schema
├── artifacts/           # Markdown, CSV, PDF, charts, images, binaries
├── logs/                # redacted logs only
└── tmp/                 # temporary files, safe to delete
runner 用法和环境变量
# Run with the standard runtime workspace
python scripts/relicex_run.py github_issue_summarizer \
  --inputs-json @examples/example_input.json \
  --run-dir ./runs/github_issue_summarizer_demo

# Common env vars made available to package code
RELICEX_RUN_DIR
RELICEX_INPUT_DIR
RELICEX_INPUT_FILES_DIR
RELICEX_INPUT_JSON / RELICEX_INPUT_FILE
RELICEX_OUTPUT_DIR
RELICEX_OUTPUT_JSON / RELICEX_OUTPUT_FILE
RELICEX_ARTIFACT_DIR
RELICEX_LOG_DIR
RELICEX_TMP_DIR
inputs/input.json 和 outputs/result.json 必须是 JSON object,并符合 schema。
大文件输入放 inputs/files/,非 JSON 输出放 artifacts/。
输出 JSON 中引用 artifact 只能用相对路径,例如 artifacts/report.md。
禁止绝对路径、../ 路径穿越和未脱敏日志。

运行凭证只声明,不写入真实值

如果包运行时需要 OpenAI、Bybit、GitHub 等密钥,只在 secret_requirements 里声明环境变量名。真实值由买家的 Credential Vault 或本地环境在运行时注入。

secret_requirements example
{
  "secret_requirements": [
    {
      "id": "openai_api_key",
      "label": "OpenAI API Key",
      "provider": "openai",
      "type": "api_key",
      "required": true,
      "sensitive": true,
      "description": "Used only at runtime. The value is supplied by the buyer's Credential Vault.",
      "placement": [
        { "type": "env", "name": "OPENAI_API_KEY" }
      ]
    }
  ],
  "secret_groups": []
}

打包前检查清单

让模型生成文件后,按这个清单再检查一遍。

manifest.api_version 固定为 relicex.pack.v0。
manifest.id 匹配 ^[a-z0-9][a-z0-9_-]{2,79}$,version 单独填写。
README.md 解释用途、输入、输出、使用方式、限制和授权边界。
files.readme/docs/code/prompts/templates/examples/assets 中列出的文件都存在。
capability_pack 有 runtime、inputs_schema、outputs_schema、workflow、evaluation。
普通 capability_pack 是 review-required,不是默认 high-risk;只有发现真实高危信号时才标高风险。
文件型 capability_pack 使用 inputs/input.json、inputs/files/、outputs/result.json、artifacts/、logs/、tmp/ 约定。
outputs/result.json 只能用相对路径引用 artifacts,例如 artifacts/report.md;不要使用绝对路径或 ../。
secret_requirements 只有元数据和 env name,没有真实值。
不要把 price、supply、status、subscription、commercial_price 写入 manifest。
zip 里没有 .env、私钥、cookies、tokens、node_modules、.git 或无关大文件。
本地打包示例
# From inside the package directory that contains manifest.json:
python -m json.tool manifest.json > /tmp/manifest.normalized.json
python - <<'PY'
import json, pathlib
m = json.loads(pathlib.Path('manifest.json').read_text(encoding='utf-8'))
assert m['api_version'] == 'relicex.pack.v0'
assert m['kind'] in {'memory_pack', 'experience_pack', 'capability_pack'}
assert pathlib.Path(m['files']['readme']).exists()
PY
zip -r ../package.zip manifest.json README.md docs prompts templates examples code assets memory -x '*.env' '.git/*' '__pycache__/*'

上传、发布和方案复用边界

package.zip 只表达资产内容和运行契约。价格、库存、免费/无限、订阅、商业授权、上游引用、发布状态和方案组合关系都属于 listing / solution / checkout 记录,不属于 manifest。

package.zip

内容、README、manifest、代码、模板、示例和资产文件。

draft_listing

价格、供应量、授权范围、订阅、商业价格、分类、标题、描述和上游引用。

人工发布

上传只应创建资产包草稿;公开发布或被方案引用前由创作者确认权利、安全和风险。