Skip to content

Commit 88b69e2

Browse files
committed
feat: complete unified skill routing B4
1 parent 8ecb69f commit 88b69e2

36 files changed

Lines changed: 252 additions & 659 deletions

‎README.md‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ SKILL-LOAD-VERIFY-OK
8585
CLI:
8686

8787
```bash
88-
devcodex skill intent "验证技能加载" --json
8988
devcodex skill resolve skill-load-verify
89+
npm run test:skill-route
9090
```
9191

9292
---
@@ -116,8 +116,6 @@ devcodex status
116116
devcodex global-adapters apply
117117
devcodex skill plan <id...>
118118
devcodex skill resolve <id...>
119-
devcodex skill match "<prompt>"
120-
devcodex skill intent "<prompt>" [--json]
121119
devcodex grok # Grok Full 入口(有边界)
122120
devcodex profile plan|init
123121
```
@@ -141,7 +139,7 @@ devcodex profile plan|init
141139
| 工作区 skill(W 优先) | `.devcodex/workspace/skills/<id>/SKILL.md` |
142140
| 全局 skill(hidden) | `~/.agents/devcodex/skills/<id>/`(菜单可能不显示,仍可加载) |
143141

144-
**未发布源码候选**:渐进式 Skill 路由会在每轮建立 W + managed G 动态快照,再按 catalog → commit → stage 分页加载正文;全程使用宿主按需启动的本地 stdio MCP 子进程,不监听端口,也不需要服务端。新增或修改 `.devcodex/workspace/skills/<id>/SKILL.md` 会让旧快照失效,并在下一轮重新发现。旧路由只会在五个精确宿主入口均取得当前版本的生产证据,并连续满足 72 小时、每宿主 20 次、总计 100 次和零异常后退役;维护者可运行 `npm run check:skill-route-retirement` 查看门禁。
142+
**未发布源码候选**:渐进式 Skill 路由是五宿主唯一默认路由。它会在每轮建立 W + managed G 动态快照,再按 catalog → commit → stage 分页加载正文;全程使用宿主按需启动的本地 stdio MCP 子进程,不监听端口,也不需要服务端。新增或修改 `.devcodex/workspace/skills/<id>/SKILL.md` 会让旧快照失效,并在下一轮重新发现。宿主生产证据继续作为发布后的可观测性材料,不再控制源码路由模式,也不阻塞功能完成。
145143

146144
Codex/Claude 等宿主自己的 `AGENTS.md`、`CLAUDE.md`、原生个人/项目 Skill 仍由宿主负责发现。DevCodex 不扫描、复制、合并、覆盖或删除这些用户资产;同名也不视为 DevCodex 所有权。Codex 项目指令使用 `AGENTS.md`(不是 `codex.md`),Claude 项目指令使用精确文件名 `CLAUDE.md`,Skill 入口使用精确文件名 `SKILL.md`。
147145

@@ -227,7 +225,7 @@ cd <devcodex-source-root>
227225
npm install
228226
npm run test:stop-gate
229227
npm run test:docs-surface-inventory
230-
npm run check:skill-route-retirement
228+
npm run test:skill-route
231229
npm run global-adapters:apply
232230
```
233231

‎changelogs/unreleased.md‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
> **当前**: v1.15.3 已归档到 `changelogs/releases/v1.15.3.md`;本文件仅保留历史锚点索引与镜像供 validate 探针消费。发版后新实现再写入下方「当前未发布」。
55
66
## 当前未发布实现候选
7-
- **工作区 Skill 意图结构化与渐进路由**:83 个 active Skill 增加 `SkillIntentV1`;运行时构建 W + managed G 动态快照,经单一 `skill_route` MCP Tool 执行 catalog/commit/load_stage/status、0/1 自由选择、依赖闭包、冲突与预算校验、分阶段正文加载、条件重规划、幂等重放、上下文截断恢复和有锁 GC。仅有新鲜能力证据的 exact `grok-cli-single/global-launcher-local-stdio` 可进入 unified;其他宿主 fail-closed 到 legacy。五精确宿主身份、Copilot camelCase Hook、直接 S15 与 `SkillRouteRetirementGateV1` 已落地;legacy 只有在当前 runtime/adapter digest 下连续 72 小时、每宿主 20 次、总计 100 次且六类异常全为 0 后才可退役。当前真实检查 accepted=1/100,因此 legacy 保留。MCP 为宿主按需启动的本地 stdio 子进程,无端口、HTTP、远程服务或常驻 daemon。W 在每轮动态发现;用户原生 `AGENTS.md` / `CLAUDE.md` / `SKILL.md` 与个人 Skill 保持宿主所有权,同名不构成清理或覆盖权限。完整 full/staged `87/87`、profile-deploy、package-release 与真实 tarball global-install 均通过。
7+
- **工作区 Skill 意图结构化与渐进路由(B4 收口)**:83 个 active Skill 使用 `SkillIntentV1`;运行时构建 W + managed G 动态快照,经单一 `skill_route` MCP Tool 执行 catalog/commit/load_stage/status、0/1 自由选择、依赖闭包、冲突与预算校验、分阶段正文加载、条件重规划、幂等重放、会话隔离恢复和有锁 GC。统一路由现为 Claude/Codex/Copilot/Gemini/Grok 五宿主唯一源码默认,能力证据仅用于发布后观测,不再切换模式或阻塞完成;旧 `WorkspaceSkillAutoMatch` / `WorkspaceSkillIntent` 生命周期分支、CLI 入口和验证节点退出活跃闭包。修复跨会话 Stop 读取共享状态导致的 `test` 误触发,并把否定、截图、日志、报告、诊断性提及排除在显式调用外。MCP 为宿主按需启动的本地 stdio 子进程,无端口、HTTP、远程服务或常驻 daemon。W 在每轮动态发现;用户原生 `AGENTS.md` / `CLAUDE.md` / `SKILL.md` 与个人 Skill 保持宿主所有权,同名不构成清理或覆盖权限。
88
- **公共 README 校验迁移**:以严格 `PublicReadmeContractV1` 替代要求公共 README 罗列内部 Gate/Skill/控制面术语的历史断言;README/client/release/workflow/brand/turn/execution consumers 共用该边界,并用损坏核心安装路径的负向探针防止宽松绕过。
99
- **全局验证 skill `skill-load-verify`**:触发「验证技能 / skill load verify」;用户可见仅固定句 `SKILL-LOAD-VERIFY-OK`;Skill 规模 85→**86**(83 active + 3 gray)。
1010
- **取消用户可见 SkillLoadReceipt 元行**:不再强制/注入 `【DevCodex 技能】…`;加载可见性靠宿主过程时间线 + `skill-load-verify`;Stop 仅 enforce 命中 skill 的 must-reply/body。
@@ -17,8 +17,8 @@
1717
- **VS Code 全局 MCP 与五宿主同刷**:`global-adapters apply` / 全局安装在 Copilot host 事务中合并写入用户级 `Code/User/mcp.json`(及已存在的 Code - Insiders)的 `servers.devcodex-memory|profile`(stdio→copilot runtime mcp),保留既有 `inputs`/其它 server;测试与边界见 `global-host-target.resolveVscodeUserMcpPaths`。
1818
- **SkillsDeployModeV1(隐蔽运行时 + PR-1 防假绿)**:默认 `skillsDeployMode=hidden` 将 active skills 部署到 `~/.agents/devcodex/skills`(G_RUNTIME),不再写入、扫描、按 ID prune 或覆盖 `~/.agents/skills`、`~/.claude/skills`、`~/.copilot/skills` 等宿主原生根;仅有 committed receipt/marker/digest 完整 ownership proof 的旧受管路径可进入显式清理预览。`resolveGlobalSkillsRoot` 随 mode 切换(ENV `DEVCODEX_GLOBAL_SKILLS_ROOT` 仍最高优先);`global-adapters apply --mode=hidden|legacy` 与 npm lifecycle 透传;receipt 记录 mode。强化 `pr1EvidenceOk`:有 `02` 须独立实质 `03` 复审(长度+blocker=0+实质章节),拒绝 thin open-blocker / sessions-only;改写 stop-gate 负向探针。需求:`全局Skill与插件隐蔽运行时`。
1919
- **Runtime 白名单闭包防复发**:新增 `scripts/lib/runtime-dependency-closure.js` 作为统一 runtime require 闭包 Owner;`MCP_RUNTIME_DEPS` / `PROJECT_RUNTIME_SCRIPT_DEPS`(兼容 `CLAUDE_MCP_RUNTIME_SCRIPT_DEPS`)改为派生;Codex project hook 复制到 `.codex/scripts/lib`;`test:mcp-runtime-closure` 覆盖 allowlist-only layout/MCP smoke/负向/packlist;validation 节点 `mcp-runtime-closure` 接入 fast/full/profile-deploy/package-release。需求:`bugs/runtime白名单闭包防复发修复`。
20-
- **P0-1 工作区意图 + DEVCODEX.md + ImplementStartGate + e2e(Batch1)**:入口 `.devcodex/workspace/DEVCODEX.md`;`workspace-skill-intent` catalog/意图/lifecycle;控制面 mutation 前 04+05+复审清单门闩(`IMPLEMENT_START_WITHOUT_PROCESS`);全局 skill `workspace-skill-author`;`npm run test:workspace-skill-intent` / `test:workspace-skill-intent-e2e`(E2E-A~J+K)并入 `test:skill-resolve`。**无 e2e 不算 Batch1 完成**。需求:`开源发布前用户面与文档边界收口`。
21-
- **P0-1 Batch2**:`init`/`ensureRuntimeDirs` 写入 DEVCODEX.md 模板(不覆盖);CLI `devcodex skill intent <prompt> [--json]`;help 文案同步。
20+
- **P0-1 历史实现(已由统一路由替代)**:入口 `.devcodex/workspace/DEVCODEX.md`、ImplementStartGate 与 `workspace-skill-author` 保留;旧 workspace intent lifecycle、CLI 和专用 E2E 已在 B4 退出活跃闭包。
21+
- **P0-1 Batch2 历史实现(已由统一路由替代)**:`init`/`ensureRuntimeDirs` 写入 DEVCODEX.md 模板(不覆盖);旧 intent CLI 已退役。
2222
- **P0-1 ECR 计数同步**:新增 `workspace-skill-author` 后 Skill 规模 84→**85**(82 active + 3 gray);重生 `skills/portfolio.json`;同步 test-skill-portfolio / docs-surface-inventory / V92/V95 / README / website 规模锚点。
2323
- **联系邮箱统一为 `rockyshi1993@gmail.com`**:`package.json` author 与 `SECURITY.md` 漏洞报告邮箱一致(唯一可用邮箱)。
2424
- **npm 包名为未 scope 的 `devcodex`**:安装入口 `npm install -g devcodex` / `npm update -g devcodex`;GitHub 组织仓与 npm 模块身份分离;`package.json` name=`devcodex`;撤销 `devcodex` 误绑。
@@ -36,8 +36,8 @@ pm install|update -g 对齐 devcodex; alidate-profile 识别 scoped 包名;
3636
- **Stop 审查修复批(F-01~F-16)**:`lastAssistantMessage` 进入 visible 证据;完成检查识别 `### DevCodex · 完成检查`;PR-1 强证据;R11 gap 命名 + `completion-check-missing`;report/memory 可 N/A 豁免;host-parity 站点条件硬续文案;R10 路径/Honesty 探针;hook 矩阵优先源码 + adapter 保留 block。验证:`npm run test:stop-gate`。
3737
- **Grok Stop 完成硬续 + EnforcementHonesty(20260726)**:`lifecycle-stop-gate.cjs` + lifecycle Stop 接线;`adaptGrokOutput`/`blockOutput` 保留 Stop `decision:block`;R9 `pr1-skipped`;R10 扩展 `CONTROL_PLANE_SOURCE_RE`(host-projections/host-parity)并复用 `checkCpGate`(safety-only 披露 `cp2-unconfirmed-write`);compliance/report/dev-default/cp-gate/dev-plan-review Honesty+R12 顺序索引;cannotClaim 改为「无正文/softCap fail-open」;探针 `test-lifecycle-stop-gate.js` + host-adapters/parity 更新。需求:`20260726-grok-stop-enforcement-honesty` B1–B4+B2b。
3838
- **工作区 Skill 双层 resolve(S2 / W>G)**:新增 `hooks/_runtime/skill-resolution.cjs`(唯一 Owner):`workspace-namespace` 下 `.devcodex/workspace/skills` 优先于 `~/.agents/skills`,**reserved** skill id 禁止 W 覆盖;同次 digest/content 契约;`profile_skill_plan` / `BundleDecisionV2` 附加 `resolutionPlan` 并改写 selected source identity;Hook 对 workspace-skill 做 managed/control-plane carve-out;CLI `devcodex skill resolve`;`npm run test:skill-resolve`(含 hook 路径矩阵;并入 `test:control-plane`);`validation-manifest` 节点 `skill-resolve` + `skill-resolution-hook-paths` 进入 fast/full/profile-deploy/package-release;apply 目标禁入 W 树。需求:`双层Skill用户优先与意图加载` CP2 v1.2 S2 / CP3。
39-
- **WorkspaceSkillAutoMatch(P0.5 用户可见闭环 / PF-213)**:新增 `hooks/_runtime/workspace-skill-auto-match.cjs`:UserPromptSubmit 按 W skill `name`/`description` 引号触发语/id 匹配 → `resolveSkillRead` → `additionalContext` 注入正文(Claude/Codex 等 inject 宿主);Grok UPS 仍诚实不宣称 inject,但 **Stop `decision:block`** 在回复未遵守 skill 时强制再答一轮(官方 Stop Decision Control);CLI `devcodex skill match <prompt>`;探针 `test-workspace-skill-auto-match.js` / manifest 节点 `skill-auto-match`。禁止仅 CLI resolve 绿冒充「发 test 即生效」。
40-
- **WorkspaceSkill 闭环产品化收口(CP1→C1.1→C2/C3)**:**C1.1** 短/歧义 skill id(如 `test`)在长任务句中不误触发,仅 exact/短句 alone/显式「用 x skill」命中;**doctor** 输出 `workspaceSkills` 数量与 ids;**README** 用户闭环表;Profile `06` 登记 `workspace-skill-auto-match`;PI-179 六环写入 `requirement-overview` / `product-requirement` 模板;部署回放 `npm run test:skill-automatch-accept`。需求:`双层Skill用户可见闭环完整产品`。
39+
- **WorkspaceSkillAutoMatch 历史实现(已由统一路由替代)**:P0.5 曾提供 token 匹配与 Stop 重试;B4 后不再是 lifecycle、CLI、package 或 validation consumer。
40+
- **WorkspaceSkill 历史产品化阶段(已由统一路由替代)**:doctor 的 W 层库存改从 `RuntimeSkillIdentityIndexV1` 派生;旧 auto-match 回放退出活跃验证链。
4141
- **SourceExistenceVerificationGate(规范吸纳防复发)**:`spec-absorption` 强制在输出「可吸纳」前对 source-root 做同名/近邻存在性验证;台账 `open/pending absorption` 不得单独成 absorb。`AbsorptionCandidateMatrixV1` 增加 `sourceExistence`;planner 阻断 `unverified` 与 `present/equivalent-covered` 的 absorb;并列「可关账清单」。负向:ledger-status-only。验证:`node scripts/plan-absorption-candidates.js --self-test`、`npm run test:residual-absorption-controls`、V81 needles。
4242
- **ExecutableAbsorption + ProbeNecessity(假吸纳禁止)**:吸纳必须可执行——`enforcementLevel` 不得为 checklist-only/none;每条 absorb 必填 `probeNecessity`(required/conditional/not-required/forbidden、alwaysOnImpact、复杂度与误报)。只写 Skill 正文或「以后再补探针」不得 ready/absorbed。分类器 `classifyExecutableAbsorptionSample`。验证:planner self-test + residual + V81。
4343
- **可执行吸纳主包 A 实施(R1~R4 + T2)**:`ProgressReportFastPath`(skill-gap/compliance/SC16);`TaskPhaseProjectionGate`(cp-gate/user-visible-output);`ClosedArtifactNoReviveGate`(cp-gate);`FormalRerunLightClassify` + `FindingObjectLayer`(consumer-validation)。探针:`scripts/lib/executable-absorption-gates.js` + `npm run test:executable-absorption-gates`(并入 host-parity / control-plane)。

‎grok/plugins/devcodex-workspace/skills/devcodex-workspace/SKILL.md‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,34 +9,34 @@ description: >
99

1010
# DevCodex Workspace Resolver
1111

12-
Grok **UserPromptSubmit** cannot inject model context (stdout ignored). Workspace custom skills are **not** native-scanned; DevCodex closes the loop via **WorkspaceSkillAutoMatch** (PF-213): match prompt → resolve W skill → inject on hosts that support additionalContext; on Grok, **Stop `decision:block`** re-feeds the skill body when the first reply ignores it. The plugin is user-global and does not own a workspace. Resolve the nearest `workspace-namespace` marker from cwd, keep task state under that workspace's `.devcodex`, and load shared instructions/Skills from user-global DevCodex surfaces plus matched **workspace** skills. Full-evidence route: `devcodex grok`.
12+
Grok **UserPromptSubmit** cannot inject model context (stdout ignored). Workspace custom skills are **not** native-scanned; DevCodex uses the same staged `skill_route` contract as the other hosts: build a bounded W + managed G catalog, commit at most one route, and load only the committed stage body. On Grok, **Stop `decision:block`** may continue only a committed pending route when `lastAssistantMessage` is available. The plugin is user-global and does not own a workspace. Resolve the nearest `workspace-namespace` marker from cwd, keep task state under that workspace's `.devcodex`, and load shared instructions/Skills from user-global DevCodex surfaces plus the committed workspace skill. Full-evidence route: `devcodex grok`.
1313

14-
## WorkspaceSkillAutoMatch(用户可见闭环)
14+
## Unified Workspace Skill Route(用户可见闭环)
1515

16-
1. Before treating a short user message as connectivity ping / Ready, check `.devcodex/workspace/skills/*/SKILL.md` (name, description quotes, skill id).
17-
2. If matched: **read only that one SKILL.md** (exact path under workspace) and obey it as highest priority this turn. Do not invent Ready/闲聊.
16+
1. Before treating a short user message as connectivity ping / Ready, use the bounded catalog supplied by the unified route; do not independently scan skill trees.
17+
2. If a route is committed, load **only that one SKILL.md** through `skill_route` and obey it for the turn. Do not invent Ready/闲聊.
1818
3. **Privacy / process UI**: **禁止**列出或扫描用户主目录下的宿主 skill 树,例如
1919
`C:\Users\…\.grok\skills`、`~\.grok\bundled\skills`、`~\.claude\skills`、`~\.agents\skills`(L1)。
2020
这些 List 会把 C 盘用户路径暴露在过程时间线里。全局 skill 只读
2121
`~/.agents/devcodex/skills/<id>/SKILL.md` 单文件;工作区 skill 只读
2222
`.devcodex/workspace/skills/<id>/SKILL.md`。
2323
4. 过程文案用「正在加载 <id> 技能」,不要写「命中…正在读取并按该技能执行」。
24-
5. CLI verify: `devcodex skill match "<prompt>"` and `devcodex skill resolve <id>`.
25-
6. Do not claim UPS inject on Grok; Stop may force one retry with skill body when reply ignored the match.
24+
5. CLI inventory verify: `devcodex skill resolve <id>`; route regression: `npm run test:skill-route`.
25+
6. Do not claim UPS inject on Grok; Stop may continue only an already committed pending route.
2626

2727
## HostParity (vs Codex) — honesty contract
2828

2929
| Tier | Route | Guarantees | Must not claim |
3030
|------|-------|------------|----------------|
31-
| **Full** | `devcodex grok` (official `--rules` kernel bind) | Controlling `AGENTS.md` in context; PreToolUse hard deny uses Grok `decision:deny`; context acquisition is **path-observable**; **conditional** Stop hard-continue (`decision:block` when `lastAssistantMessage` present — skill auto-match / completion gate) | UserPromptSubmit context inject; unconditional Stop without body / after softCap fail-open; verified PC0 from Hook payload alone |
31+
| **Full** | `devcodex grok` (official `--rules` kernel bind) | Controlling `AGENTS.md` in context; PreToolUse hard deny uses Grok `decision:deny`; context acquisition is **path-observable**; unified staged skill route; **conditional** Stop hard-continue (`decision:block` when `lastAssistantMessage` is available and a committed route/completion gate remains pending) | UserPromptSubmit context inject; unconditional Stop without body / after softCap fail-open; verified PC0 from Hook payload alone |
3232
| **Partial** | plain `grok` in a child Git project | Best-effort Skill discovery + plugin bridge when trusted; PreToolUse deny adapter still applies when lifecycle is reachable | Full host parity with Codex; `kernelInjected=true` from passive Hook stdout |
3333

3434
Platform facts (Grok Build hooks docs): `PreToolUse` and `Stop`/`SubagentStop` can hard-control; UserPromptSubmit is passive (no inject). PC5 must report `Partial` unless Full launcher evidence is present. Do not equate Grok with Codex UPS inject bootstrap.
3535

3636
1. Preserve the semantic intent seed before reading project context.
3737
2. Bind the nearest valid `workspace-namespace` root from cwd. Do not require or create workspace `AGENTS.md`, `.agents`, `.grok`, `.codex`, `.claude`, `.gemini`, or `.github`.
3838
3. Resolve the project namespace relative to that workspace and bind runtime state under `.devcodex/<project>/`.
39-
4. Follow the kernel's intent-first route and read only selected files from `~/.agents/skills/` plus the resulting workspace Profile/context plan, **and any WorkspaceSkillAutoMatch hit under `.devcodex/workspace/skills/`**.
39+
4. Follow the kernel's intent-first route and read only selected files from the managed global runtime plus the resulting workspace Profile/context plan, and the single workspace skill committed by `skill_route`.
4040
5. Use `~/.agents/devcodex/instructions.full.md` only for an explicit fallback; workspace `.devcodex` remains the sole workspace-owned DevCodex surface.
4141
6. Before substantive output, satisfy the parent kernel's visible entry-check (PC0~PC7). Runtime cannot inject that block on Grok; models still own S07 user-visible output.
4242
7. Optional assist: call MCP `profile_compose_entry_check` to obtain a portable PC0~PC7 block, or rely on PreToolUse deny reasons that embed the same template when context acquisition is incomplete.

0 commit comments

Comments
 (0)