docs: add init command section to root README
本仓库用于实验和沉淀「AI 编程流水线 / Orchestrator + Subagent + Shim」相关实践,当前主要聚焦:
gxd-subagent-shim
.artifacts/agent_runs/
gxd-subagent-shim-0.2.3/
POLICY_VERSION = "0.3.0"
claude
--backend=codex
SUBAGENT_BACKEND=codex
allowed_paths
forbidden_paths
--prompt-file
--validate-schema/--validate-scope/--validate-contract
SUBAGENT_VALIDATE_*
.artifacts/agent_runs/<RUN_ID>/
详细验收过程见:docs/06-验收文档/0.2.3-guardrails-升级与验收.md。
docs/06-验收文档/0.2.3-guardrails-升级与验收.md
AGENTS.md
docs/00-快速开始/index.md
011.AI编程流水线边界升级/ ├── AGENTS.md # Orchestrator 核心规范(本仓库专用) ├── docs/ # 文档目录(按主题分组,主要为中文) │ ├── 00-快速开始/ │ │ ├── index.md # 文档索引 │ │ ├── getting-started.md # 使用指南 │ │ └── command-generator.md # 命令生成提示词 │ ├── 01-使用指南/ │ │ ├── configuration.md # 进阶配置(环境变量、日志、审计) │ │ └── integration.md # 与项目集成指南 │ ├── 02-设计文档/ │ │ ├── design-analysis.md # 设计分析 │ │ └── git-integration.md # Git 集成方案 │ ├── 03-技术参考/ │ │ └── shim-reference.md # Shim 项目说明与接口细节 │ ├── 04-演化历史/ │ │ ├── prompt-evolution.md # 提示词演化 │ │ └── lecture-notes.md # 讲义/课程笔记 │ ├── 05-问题文档/ # 问题与工程分析 │ └── 06-验收文档/ # 版本验收与问题修复记录 ├── gxd-subagent-shim-0.2.2/ # shim 源码(当前版本 0.2.3) └── .artifacts/ # 运行审计目录(已在 .gitignore 中忽略)
在仓库根目录执行:
cd gxd-subagent-shim-0.2.3 python -m pip install -e .
这会以 editable 方式安装 gxd-subagent-shim,方便在本地修改源码并立刻生效。
gxd-subagent-shim 0.2.3 新增了 init 子命令,可以快速在新项目中初始化 Orchestrator 策略文件:
init
# 方式1:进入目标项目目录后执行 cd /path/to/your-project gxd-subagent-shim init # 方式2:使用 --target 指定目标目录(无需切换目录) gxd-subagent-shim init --target /path/to/your-project # 如果目标目录已有 AGENTS.md 或 agents/ 目录,使用 --force 强制覆盖 gxd-subagent-shim init --force # 查看帮助 gxd-subagent-shim init --help
执行后会在目标目录创建:
agents/
这样新项目就可以立即使用 Subagent Orchestrator 的完整策略框架,无需手动复制文件。
严格模式下,推荐通过 文件 传入 Step JSON,并在 CLI 上开启 Guardrails:
# 将 Step JSON 写入 step.json,内容可参考 AGENTS.md 中的 Step JSON 模板 @' { "task_kind": "step", "task_id": "hello_world", "run_id": "hello_world_20260106T000000Z_local", "step_id": "S1", "step_title": "Hello World via prompt-file", "step_description": "Return a short greeting.", "acceptance_criteria": [ "Subagent returns a short greeting", "Output Contract includes all 8 sections", "No shim-level validation errors" ], "scope_guard": { "allowed_paths": ["docs/**"], "forbidden_paths": ["AGENTS.md", ".artifacts/**"] }, "policy_version": "0.3.0" } '@ | Set-Content -Encoding utf8 step.json # 通过 --prompt-file 调用 shim,并启用三类 Guardrails 校验 gxd-subagent-shim create ` --prompt-file step.json ` --backend=claude ` --validate-schema ` --validate-scope ` --validate-contract
运行后可在 .artifacts/agent_runs/<RUN_ID>/ 下查看:
meta.json
shim_version
policy_version
events.jsonl
steps/<STEP_ID>/rounds/R0/
在某些快速试验场景,可以直接将 JSON 字符串作为位置参数传入:
$prompt = '{"task_id": "hello_world", "step_id": "S1", "instruction": "输出一段问候语"}' gxd-subagent-shim create $prompt --backend=claude
这种写法在不同 shell / CI 环境中容易因为引号和转义规则差异导致 JSON 被拆坏,推荐仅在本地最小化试验时使用;在真正的 Orchestrator 流程中,应优先采用第 2 节的 --prompt-file 方案。
本仓库已提供基础的 .gitignore,主要忽略:
.gitignore
subagent.log
.DS_Store
__pycache__/
*.pyc
如在本地新增 IDE 配置、临时脚本或大数据量目录,建议一并追加到 .gitignore 中,避免误提交。
©Copyright 2023 CCF 开源发展委员会 Powered by Trustie& IntelliDE 京ICP备13000930号
AI 编程流水线边界升级
本仓库用于实验和沉淀「AI 编程流水线 / Orchestrator + Subagent + Shim」相关实践,当前主要聚焦:
gxd-subagent-shim将 Codex / Claude 等代码模型接入本地工程;.artifacts/agent_runs/记录可追溯的执行审计日志;当前版本与 Guardrails 里程碑
gxd-subagent-shim0.2.3(源码位于gxd-subagent-shim-0.2.3/目录,推荐以 editable 方式安装)。POLICY_VERSION = "0.3.0"(Step JSON 模板和 Output Contract 的基线版本)。claude(可通过--backend=codex或SUBAGENT_BACKEND=codex切换为 Codex)。allowed_paths/forbidden_paths自动比对);--prompt-file文件输入通道,避免跨 shell 的 JSON 引号问题;--validate-schema/--validate-scope/--validate-contract与SUBAGENT_VALIDATE_*环境变量控制各类校验;.artifacts/agent_runs/<RUN_ID>/下统一归档 meta、events 以及各类校验结果。详细验收过程见:
docs/06-验收文档/0.2.3-guardrails-升级与验收.md。文档导航 (Documentation)
AGENTS.mddocs/00-快速开始/index.md快速链接
gxd-subagent-shimgxd-subagent-shim项目说明仓库结构
开发者指南
1. 安装 shim(可选但推荐)
在仓库根目录执行:
这会以 editable 方式安装
gxd-subagent-shim,方便在本地修改源码并立刻生效。2. 在新项目中初始化策略文件(v0.2.3+)
gxd-subagent-shim0.2.3 新增了init子命令,可以快速在新项目中初始化 Orchestrator 策略文件:执行后会在目标目录创建:
AGENTS.md— Orchestrator 策略入口文件agents/— 策略模块目录(包含 contracts、playbooks、policy、templates 等)这样新项目就可以立即使用 Subagent Orchestrator 的完整策略框架,无需手动复制文件。
3. 推荐:使用 prompt 文件 +
--prompt-file调用(Guardrails 模式)严格模式下,推荐通过 文件 传入 Step JSON,并在 CLI 上开启 Guardrails:
运行后可在
.artifacts/agent_runs/<RUN_ID>/下查看:meta.json:包含shim_version/policy_version等 run 元信息;events.jsonl:运行事件与 Guardrails 校验事件;steps/<STEP_ID>/rounds/R0/:原始 prompt、后端输出、校验结果等。4. 快速示例:直接通过参数传 JSON Prompt(不推荐用于复杂场景)
在某些快速试验场景,可以直接将 JSON 字符串作为位置参数传入:
这种写法在不同 shell / CI 环境中容易因为引号和转义规则差异导致 JSON 被拆坏,推荐仅在本地最小化试验时使用;在真正的 Orchestrator 流程中,应优先采用第 2 节的
--prompt-file方案。Git 与忽略规则
本仓库已提供基础的
.gitignore,主要忽略:.artifacts/agent_runs/等运行审计产物;subagent.log等本地日志;.DS_Store、__pycache__/、*.pyc、虚拟环境目录、打包产物等。如在本地新增 IDE 配置、临时脚本或大数据量目录,建议一并追加到
.gitignore中,避免误提交。