Skip to content

Commit 98cb50c

Browse files
committed
fix: harden five-host global adapters and Codex managed drift
Land GlobalOnly user-global adapters with layered readiness (configured / adapterReady / contract / native / operational), runtime verification, and Grok user-global plugin/Hook/MCP. Close PF-211 by treating Codex mcp_servers.devcodex-*.tools.* approval subtables as host-owned inside the managed MCP block while still fail-closing authority command/args drift. Close PF-212 by marking superseded audit sessions and teaching V15 to reject active priors when a closed successor references them. Verified with targeted host/global-config tests and installed doctor (adapterReady 5/5, HostParity full-capable). Not published.
1 parent 9c6141e commit 98cb50c

69 files changed

Lines changed: 4428 additions & 739 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎README.md‎

Lines changed: 33 additions & 19 deletions
Large diffs are not rendered by default.

‎RULES.md‎

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
11
# DevCodex v1.15.3 — 使用入口
22

3-
> AI workflow injector for Copilot / Claude Code / Codex · publisher: Rocky · version: 1.15.3
3+
> AI workflow injector for Copilot / Claude Code / Codex / Gemini / Grok · publisher: Rocky · version: 1.15.3
44
55
## 正式主支持客户端
66

7-
- **Copilot**:从用户级 Copilot instructions 加载;IDE workspace hooks 不在 GlobalOnlyHostConfigModeV1 首批范围。
7+
- **Copilot CLI**:从用户级 instructions、Hooks、MCP、Skills 与稳定 runtime 加载;Copilot IDE workspace hooks 不在 GlobalOnlyWorkspaceCleanModeV1 首批范围。
88
- **Claude Code**:从用户级 `CLAUDE.md`、settings、MCP 与稳定 runtime 加载。
9-
- **Codex**:从用户级 `.codex/AGENTS.md`、hooks、config 与用户级 `.agents/skills/` 加载。
9+
- **Codex**:从用户级 `.codex/AGENTS.md`、hooks、config 与用户级 `.agents/skills/` 加载;完整回退规范位于用户级 `.agents/devcodex/instructions.full.md`。
1010
- **Gemini / Grok**:分别使用用户级 settings/runtime 与用户级 plugin/config/runtime;Grok 完整入口为 `devcodex grok`。
1111

1212
## 五宿主加载机制
1313

1414
DevCodex 同时支持五宿主的用户级加载路径,规则语义保持一致,由宿主决定实际生效方式:
1515

16-
- **Copilot / Claude / Gemini**:用户级 instruction/settings 投影,能力按 fixture ceiling 声明。
17-
- **Codex**:用户级 `.codex/AGENTS.md` + hooks/config,并从用户级 `.agents/skills/*` 按需读取 Skill。
16+
- **Copilot CLI**:用户级 instructions/hooks/MCP/Skills/runtime,adapter 合同按 fixture 验证,原生 CLI 就绪由 `doctor` 深探针判定。
17+
- **Claude / Gemini**:用户级 instruction/settings 投影,能力按 fixture ceiling 声明。
18+
- **Codex**:用户级 `.codex/AGENTS.md` + hooks/config,并从用户级 `.agents/skills/*` 按需读取 Skill;不读取工作区 `.agents`。
1819
- **Grok**:用户级 plugin/config/runtime;`devcodex grok` 用用户级 controlling kernel 启动。
1920

2021
无论哪条路径进入,所有 Instructions 均通过同一 `instructions.md` / instructions 目录派生。工作区只保留 `.devcodex`,不会因安装生成五宿主目录;已有目录也不会被自动删除。
@@ -23,8 +24,12 @@ DevCodex 同时支持五宿主的用户级加载路径,规则语义保持一
2324

2425
- **Hook-First**:VS Code / Claude Code / Codex Hooks 可用时,通过对应宿主 hooks 承载 bootstrap、危险操作护栏和结束前兜底
2526
- **Instruction-Fallback**:Hooks 不可用时,继续依赖 instructions / skills 承载软约束
26-
- **当前实现**:npm 全局安装/升级通过 `postinstall` 更新用户级稳定 runtime;bare `init/update` 只管理 workspace `.devcodex`
27+
- **当前实现**:npm 全局安装/升级通过 `postinstall` 更新用户级稳定 runtime、共享 full fallback 与 active Skills;共享 `.agents` 由单一事务 Owner 写入。bare `init/update` 只管理 workspace `.devcodex`,fresh workspace 会建立 `workspace-namespace` marker
2728
- **全局唯一写入口**:`devcodex init --claude`、`devcodex init --codex` 及其他宿主 selector/alias 均返回 `CLI_HOST_CONFIG_GLOBAL_ONLY`;宿主 adapter 通过 `npm install -g devcodex` 或 `npm update -g devcodex` 管理
29+
- **就绪分层**:receipt 与文件存在只表示 `configured`;`status` 验证 adapter/静态合同,`doctor` 再验证可用原生 CLI、Grok canonical 唯一 identity、inspect 发现面、已安装 Hook 合同与 MCP initialize。任一合同或原生探针失败时不得标记 `ready`。
30+
- **受管回执**:receipt 只绑定 DevCodex 管理的 instruction、hook、MCP 与 config segment;用户自有主题或其他宿主设置不构成 adapter 漂移,受管字段变化仍必须 fail closed 并由全局安装刷新。
31+
- **诊断作用域**:源码仓中的 `status/doctor` 只能形成 `source-candidate-vs-installed-receipts` 候选比较,必须声明 `installedHealthClaim=false`,并抑制已安装包的 `checks/failedChecks/repairSteps`;真实全局健康结论只能由打包并安装后的候选在源码仓外形成。
32+
- **Grok 收敛**:只允许官方 CLI 修改 plugin registry;已知受管 identity 可回滚收敛,未知同名来源必须在 mutation 前阻断。
2833

2934
## 正式需求与执行模板边界
3035

‎changelogs/unreleased.md‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,15 @@
55
66
## 当前未发布实现候选
77

8+
- **文档站依赖审计加固**:Rspress 提升到 2.0.18,`brace-expansion` 提升到 5.0.8;`test:audit` 改为 fail-closed 结构化审计。当前唯一例外为仅影响 unstable RSC 的 `GHSA-qwww-vcr4-c8h2`,本站静态运行面禁止 RSC 标记,例外于 2026-08-15 到期;任何新 advisory、依赖链变化、RSC 使用或到期都会重新阻断。
9+
- **Grok 兼容导入去重**:Grok 原生会话兼容加载 `~/.claude/settings.json` 时,DevCodex Claude adapter 识别 Grok 的 camelCase payload 与 snake_case 事件并安全跳过重复 lifecycle;Grok 专用 plugin 保持唯一生命周期 owner,消除 `user_prompt_submit` / `stop` hook 报错和双重状态写入。
10+
- **五宿主全局 adapter 运行态修复**:`status`/`doctor` 从 receipt/files 假就绪升级为 `configured/adapterReady/contractStatus/nativeStatus/operationalState/ready/issues` 分层;五个可执行 adapter 均增加有界契约探针,只有原生 CLI 深探针通过才可标记 operational ready。doctor 增加原生版本与 Grok list/inspect、installed Hook contract、MCP initialize。Grok plugin source 改为用户级 runtime + cwd workspace 发现,同名受管 identity 经官方 CLI drain-all 后收敛到唯一 canonical;未知来源 mutation 前阻断,首次安装与多 identity 失败均保留/恢复原注册状态,受管恢复来源可继续收敛。Copilot CLI 按官方用户级目录部署 instructions、Hooks、MCP 与 Skills;Copilot IDE 仍保持独立 instruction-fallback ceiling。
11+
- **全局 adapter 终审防假绿**:stale managed 文件清理失败会写入 receipt 的 `pendingStaleManagedPaths` 并由后续全局升级重试,不能因首轮事务已提交而丢失;Copilot CLI 的 PascalCase Hook 输入与原生输出合同已接入共享 lifecycle,`PreToolUse` 与 `Stop` 的阻断能力按宿主事件分别声明。
12+
- **源码候选诊断隔离**:源码仓中的 `status/doctor` 现在明确使用 `source-candidate-vs-installed-receipts`,返回 `installedHealthClaim=false` 并抑制已安装包修复动作,候选差异仅保留为 `withheld*` 证据;receipt 不再持久化任何安装进程临时路径,生命周期清理/receipt 收尾不完整会显式降级,安全审计默认读取受控 registry 策略。
13+
- **全局适配深审补强**:fresh workspace 的 bare `init/update` 自动建立 `workspace-namespace` marker,避免已安装 Hook 找不到 owner;共享 `.agents` 改为单一事务 Owner,且只部署 active Skill;per-host receipt 改为只绑定 DevCodex 管理片段,用户自有宿主配置不再制造假 stale,受管字段漂移仍会被检测和修复。
14+
- **全局宿主边缘合同收口**:Claude 显式 `CLAUDE_CONFIG_DIR` 时,instruction/settings 与 MCP managed segment 统一落入同一配置身份;`status/doctor` 将 receipt 缺失、受管文件缺失或漂移转为结构化失败,不再假绿;裸 `devcodex uninstall` 与带宿主形式统一返回 GlobalOnly 禁用合同;`devcodex grok` 显式向子进程传递已解析的用户级 `GROK_HOME`,避免 Windows 上 worktree GC 因 HOME 缺失告警。
815
- **HostParity 企业级持续对齐(E1/E3/E5/E7)**:新增 `UnalignedLedgerV1` fixture(U-A1~U-C3)+ `parity-unaligned-ledger` / `parity-upgrade-decision`;`MIN_CANNOT_CLAIM` + floor 断言;`test:host-parity` 串联 `test-host-parity-ledger`;站点/AGENTS 投影补台账与 9 步 checklist;validate 默认不挂 host-parity(以 optimization-controls 为准)。需求:`Grok-Codex未对齐收敛与持续对齐保证` CP3。
9-
- **CLI 默认五宿主(A2)**:bare `devcodex init` / `update` 经 `cmdInit({ includeExtended: true })` 部署 copilot+claude+codex+gemini+grok(含 Grok `installed-plugins` digest 同步);**不**绑 `cmdInitHost('all')`(避免 bare init 触发 `HOST_INSTRUCTION_COLLISION`)。`--host copilot` 显式 `includeExtended: false`。`test-cli-command-registry` 断言第二参 opts。help/README/host-instruction-projection 文案同步。需求:`Grok插件随update自动同步` CP1 A2 / CP2 v0.3。
16+
- **历史候选(已被 GlobalOnly 取代)— CLI 默认五宿主(A2)**:曾计划让 bare `devcodex init/update` 部署五宿主;当前正式候选已改为 npm 全局安装/升级管理用户级宿主 adapter,bare `init/update` 仅维护 workspace `.devcodex`。本条只保留设计演进记录,不是当前行为。
1017
- **C16 TTFV + WorkspaceRootScanBan(PI-20260724-01)**:GrokTurnChecklist 增加 `scan-hygiene` / `ttfv-first-delivery`;Hook `neverApprove` 拦截 monorepo/workspace 根递归 inventory(绝对根路径、`dir /s`、cwd=根时的相对 `-Recurse`/`-Depth`);SC16 与 `17-compliance`/`01-common`/website 消费者对齐;探针与 Hook 一级子路径一致;`test:host-parity` 纳入回归矩阵。
1118
- **意图驱动五宿主能力映射**:新增 active `host-capability-routing`、`CapabilityIntentDecisionV1`、`HostLeverCatalogV1`、`OriginalInstructionRefV1`、8-row local catalog 与纯校验器;薄 Rule 保留原指令权威、portable-first、CP/Auto/S01~S07 边界,5 个逻辑宿主/8 个 variant 在证据未知、过期、重复或 MCP absent 时 fail closed。当前 canonical native eligible=0,Phase 1 不新增 MCP primitive;README/website 明确收益、catalog/证据/消费者维护代价与 MCP Tool 升级阈值。
1219
- **运行态产物分层存储与索引**:新增内容寻址 partition / immutable manifest / 原子 pointer 公共契约,以及 memory、runtime-state、report 三个 domain adapter;旧 Markdown/files 与 reader 保持,stale/corrupt 自动回退且 query 零写入。memory 10 Tools 不变,仅 additive `indexReceipt/coverage`;status/doctor 使用 compact projection;report 只扫描 allowlisted roots、默认 primary metadata,宽分页通过 `snapshotCursor` 固定 manifest,正文按 pointer/batch lazy hydrate,metadata-only 可用 compact projection。真实 3 进程 ×(5 warmup + 30 measurement)benchmark 的 W1/W3/W4 总读取量减少 91.45% / 90.76% / 98.98%,公共投影 mismatch=0;W2 延迟为观测项。W5 宽查询 smoke accepted:W5A/W5B 总读取下降 81.22% / 82.42%,W5C 全文 0 截断且总读取下降 48.88%,W5D compact 响应体下降 41.92%;token telemetry 不可见,结论仅声明 bytes/latency。

0 commit comments

Comments
 (0)