Skip to content

Commit e243136

Browse files
committed
feat: skill-load-verify probe and retire user-visible skill meta line
Add global skill-load-verify (SKILL-LOAD-VERIFY-OK) for load probing, stop forcing DevCodex skill receipt lines in final replies, prefer process wording 正在加载 <id> 技能, and block host skill directory inventory that leaks home paths. Bump skill scale anchors to 86 and refresh portfolio/docs-surface gates.
1 parent d9d5d2b commit e243136

20 files changed

Lines changed: 601 additions & 69 deletions

‎README.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,7 @@ devcodex/
542542
├── instructions.md # 单源完整规范;确定性生成精简 host kernel、薄 wrapper 与非 always-on full fallback
543543
├── agents/ # Agent 源文件;Copilot 端默认分发,Claude Code 端不分发
544544
├── instructions/ # 全局 Instructions(15 个,含工作流规则摘要,自动注入)
545-
├── skills/ # Skill 详细检查标准(85 个,按 01-common §按需读取表 路由读取)
545+
├── skills/ # Skill 详细检查标准(86 个,按 01-common §按需读取表 路由读取)
546546
├── prompts/ # Prompt 模板(30 个)
547547
├── hooks/ # 包内 Hook 配置与稳定 runtime 源;npm 全局生命周期投影到各宿主用户级目录
548548
├── codex/ # Codex adapter 源模板(分发到 `.codex/hooks.json`,不是工作区部署副本 `.codex/`)
@@ -554,7 +554,7 @@ devcodex/
554554
```
555555

556556
其中 `instructions.md` 汇总 Instructions 约束(15 个,含全部工作流规则);宿主始终可见入口只投影受预算约束的精简 kernel。
557-
Skill 详细检查标准(85 个,按需读取;具体路由仍以 `01-common` 的按需读取表为准)。
557+
Skill 详细检查标准(86 个,按需读取;具体路由仍以 `01-common` 的按需读取表为准)。
558558

559559
规范治理由 `spec-governance` 与 `spec-absorption` 分工:`spec-governance` 负责 `PostAssessmentGovernanceIntakeGate`、RecordRouter、真实落账验证、SCV 和 `GovernanceGateRegistry`;`spec-absorption` 负责最新可吸纳、仍需吸纳和 `.devcodex/*/data` 候选扫描、通用性证明、`AbsorptionCandidateMatrixV1` 结构化规划与分层实现。所有模式下每条非空用户消息都会先登记中性 candidate,再由 AI 在合理性评估、项目现实扩展和上下文归因后按语义形成 `GovernanceIntakeDecision`;关键词不具有触发或分类权威。复合意图逐项写入 `violations / pending-fixes / process-improvements(优化清单,PI) / pending-issues / gap-registry`,只有成功 PostToolUse 对当前 active-root 的精确台账写入及落盘 ID 复证后才算 verified;`record.none` 也必须提供完整 challenge evidence。
560560

‎changelogs/unreleased.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
> **当前**: v1.15.3 已归档到 `changelogs/releases/v1.15.3.md`;本文件仅保留历史锚点索引与镜像供 validate 探针消费。发版后新实现再写入下方「当前未发布」。
55
66
## 当前未发布实现候选
7+
- **全局验证 skill `skill-load-verify`**:触发「验证技能 / skill load verify」;用户可见仅固定句 `SKILL-LOAD-VERIFY-OK`;Skill 规模 85→**86**(83 active + 3 gray)。
8+
- **取消用户可见 SkillLoadReceipt 元行**:不再强制/注入 `【DevCodex 技能】…`;加载可见性靠宿主过程时间线 + `skill-load-verify`;Stop 仅 enforce 命中 skill 的 must-reply/body。
9+
- **技能过程文案**:inject 引导过程侧写「正在加载 <id> 技能」,避免「命中 … 正在读取并按该技能执行」。
10+
- **宿主 skill 目录隐私**:PreToolUse 拦截 List/扫描 `~/.grok/skills`、`bundled/skills` 等用户主目录 skill 树,避免过程 UI 暴露 `C:\\Users\\…`;只允许读单个已知 SKILL.md。
711
- **控制面 ImplementStartGate 防过程跳过**:`classifyImplementStartGate` 对控制面 mutation **禁止 unbound 放行**(`implement-start-without-task-binding`);绑定任务后除 04/05/复审清单外还须 **00/01 + 02 技术方案**(`implement-start-without-design`);lifecycle PreTool 无任务也 enforce。探针 `test-implement-start-gate.js`。需求:`VSCode全局MCP与五宿主同刷`(过程事故:承诺按流程却直接改码)。
812
- **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`。
913
- **SkillsDeployModeV1(隐蔽运行时 + PR-1 防假绿)**:默认 `skillsDeployMode=hidden` 将 active skills 部署到 `~/.agents/devcodex/skills`(G_RUNTIME),停写/目录 prune `~/.agents/skills`、`~/.claude/skills`、`~/.copilot/skills` 中的包 managed id;`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与插件隐蔽运行时`。

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,15 @@ Grok **UserPromptSubmit** cannot inject model context (stdout ignored). Workspac
1414
## WorkspaceSkillAutoMatch(用户可见闭环)
1515

1616
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 that SKILL.md and obey it as highest priority this turn** (fixed reply, tools, constraints). Do not invent Ready/闲聊.
18-
3. CLI verify: `devcodex skill match "<prompt>"` and `devcodex skill resolve <id>`.
19-
4. Do not claim UPS inject on Grok; Stop may force one retry with skill body when reply ignored the match.
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/闲聊.
18+
3. **Privacy / process UI**: **禁止**列出或扫描用户主目录下的宿主 skill 树,例如
19+
`C:\Users\…\.grok\skills`、`~\.grok\bundled\skills`、`~\.claude\skills`、`~\.agents\skills`(L1)。
20+
这些 List 会把 C 盘用户路径暴露在过程时间线里。全局 skill 只读
21+
`~/.agents/devcodex/skills/<id>/SKILL.md` 单文件;工作区 skill 只读
22+
`.devcodex/workspace/skills/<id>/SKILL.md`。
23+
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.
2026

2127
## HostParity (vs Codex) — honesty contract
2228

‎hooks/_runtime/lifecycle-dangerous-command.cjs‎

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,125 @@ function buildLifecycleDangerousCommandUtils({
139139
return true
140140
}
141141

142+
/**
143+
* Host skill inventory roots under the user profile (privacy + UX).
144+
* Listing these surfaces absolute home paths (e.g. C:\\Users\\…\\.grok\\skills) in the process UI.
145+
* Allow reading a single known SKILL.md under G_RUNTIME; ban directory inventory of host skill trees.
146+
*/
147+
function normalizePathSlash (p) {
148+
return String(p || '').replace(/\\/g, '/').toLowerCase()
149+
}
150+
151+
function isHostSkillInventoryTarget (targetPath) {
152+
const n = normalizePathSlash(targetPath)
153+
if (!n) return false
154+
// Single skill body under DevCodex G_RUNTIME is OK
155+
if (/\/\.agents\/devcodex\/skills\/[^/]+\/(?:skill\.md)?$/i.test(n) && !n.endsWith('/skills') && !n.endsWith('/skills/')) {
156+
if (/\/skill\.md$/i.test(n) || /\/\.agents\/devcodex\/skills\/[^/]+$/i.test(n)) return false
157+
}
158+
const bans = [
159+
/\/\.grok\/skills(?:\/|$)/,
160+
/\/\.grok\/bundled\/skills(?:\/|$)/,
161+
/\/\.claude\/skills(?:\/|$)/,
162+
/\/\.codex\/skills(?:\/|$)/,
163+
/\/\.gemini\/skills(?:\/|$)/,
164+
/\/\.copilot\/skills(?:\/|$)/,
165+
/\/\.agents\/skills(?:\/|$)/,
166+
/\/\.agents\/devcodex\/skills\/?$/
167+
]
168+
return bans.some(re => re.test(n))
169+
}
170+
171+
function extractListingTargets (payload) {
172+
const input = (payload && (payload.tool_input || payload.toolInput)) || {}
173+
const out = []
174+
for (const key of ['path', 'target_directory', 'targetDirectory', 'directory', 'dir', 'root', 'cwd']) {
175+
if (typeof input[key] === 'string' && input[key].trim()) out.push(input[key].trim())
176+
}
177+
if (Array.isArray(input.paths)) {
178+
for (const p of input.paths) if (typeof p === 'string' && p.trim()) out.push(p.trim())
179+
}
180+
const cmd = typeof input.command === 'string' ? input.command : getCommandText(payload)
181+
if (cmd) {
182+
const m = String(cmd).match(
183+
/(?:Get-ChildItem|gci|dir|ls|list_dir|find)\b[\s\S]{0,200}?([A-Za-z]:\\[^\s"'|]+|~\/[^\s"'|]+|\/(?:Users|home)\/[^\s"'|]+)/i
184+
)
185+
if (m && m[1]) out.push(m[1])
186+
// also catch quoted paths
187+
const q = String(cmd).match(/["']([A-Za-z]:\\[^"']+\.?(?:grok|claude|agents|codex)[^"']*)["']/i)
188+
if (q && q[1]) out.push(q[1])
189+
}
190+
return out
191+
}
192+
193+
function isListingStyleTool (payload, platform) {
194+
const tn = getToolName(payload).toLowerCase()
195+
if (/list|ls|glob|dir|find|scandir|listdir|skill/.test(tn)) return true
196+
if (isCommandTool(payload, platform)) {
197+
const cmd = getCommandText(payload)
198+
return /\b(?:Get-ChildItem|gci|dir|ls|find)\b/i.test(cmd)
199+
}
200+
return false
201+
}
202+
203+
/**
204+
* Block host skill directory inventory so process UI does not leak user-home skill paths.
205+
* @returns {null|{reason:string,neverApprove:boolean,code:string,command?:string}}
206+
*/
207+
function checkHostSkillInventoryListing (payload, platform) {
208+
if (!payload) return null
209+
const tn = getToolName(payload).toLowerCase()
210+
// Native Skill tool browsing host catalogs
211+
if (/\bskill\b/.test(tn) && !/skill\.md|read/i.test(tn)) {
212+
const targets = extractListingTargets(payload)
213+
const hay = JSON.stringify(payload.tool_input || payload.toolInput || {}).toLowerCase()
214+
if (/[\\/]\.grok[\\/](bundled[\\/])?skills|[\\/]\.agents[\\/]skills|[\\/]\.claude[\\/]skills/.test(hay) ||
215+
targets.some(isHostSkillInventoryTarget)) {
216+
return {
217+
reason: 'Blocked: host skill inventory under user profile (privacy); do not list ~/.grok/skills or bundled skills. Read a single known SKILL.md under .devcodex/workspace/skills/<id> or ~/.agents/devcodex/skills/<id> only.',
218+
neverApprove: true,
219+
code: 'host-skill-inventory-ban'
220+
}
221+
}
222+
}
223+
if (!isListingStyleTool(payload, platform) && !isCommandTool(payload, platform)) {
224+
// still check explicit path fields on any tool
225+
const targets = extractListingTargets(payload)
226+
if (!targets.length) return null
227+
if (!targets.some(isHostSkillInventoryTarget)) return null
228+
// only ban when action looks like list/inventory
229+
if (!isListingStyleTool(payload, platform)) return null
230+
}
231+
const targets = extractListingTargets(payload)
232+
for (const t of targets) {
233+
if (isHostSkillInventoryTarget(t)) {
234+
return {
235+
reason: 'Blocked: host skill inventory under user profile (privacy); process UI must not list C:\\Users\\… skill roots. Use exact path to one SKILL.md (workspace or ~/.agents/devcodex/skills/<id>/SKILL.md).',
236+
neverApprove: true,
237+
code: 'host-skill-inventory-ban',
238+
command: getCommandText(payload) || t
239+
}
240+
}
241+
}
242+
// Shell inventory without extracted path but mentioning host skill roots
243+
if (isCommandTool(payload, platform)) {
244+
const cmd = String(getCommandText(payload) || '')
245+
if (/[\\/]\.grok[\\/](?:bundled[\\/])?skills|[\\/]\.agents[\\/]skills(?![\\/]devcodex)|[\\/]\.claude[\\/]skills/i.test(cmd) &&
246+
/\b(?:Get-ChildItem|gci|dir|ls|find)\b/i.test(cmd)) {
247+
return {
248+
reason: 'Blocked: host skill inventory under user profile (privacy); do not list ~/.grok/skills or similar host skill trees.',
249+
neverApprove: true,
250+
code: 'host-skill-inventory-ban',
251+
command: cmd
252+
}
253+
}
254+
}
255+
return null
256+
}
257+
142258
function checkDangerousCommand(payload, platform) {
259+
const hostSkillBan = checkHostSkillInventoryListing(payload, platform)
260+
if (hostSkillBan) return hostSkillBan
143261
if (!isCommandTool(payload, platform)) return null
144262
const cmd = getCommandText(payload)
145263
const readOnlySearch = /^\s*(?:rg|grep|Select-String)\b/i.test(cmd)
@@ -251,6 +369,8 @@ function buildLifecycleDangerousCommandUtils({
251369
return {
252370
isCommandTool,
253371
checkDangerousCommand,
372+
checkHostSkillInventoryListing,
373+
isHostSkillInventoryTarget,
254374
stripApprovalMarker,
255375
isWorkspaceRootRecursiveInventory,
256376
extractApprovalId,

‎hooks/_runtime/lifecycle.cjs‎

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1665,8 +1665,12 @@ async function main() {
16651665
if (eventName === 'PreCompact') markContextAcquisitionStale(state, 'compact')
16661666
captureFinalPayloadSample(payload, eventName, state)
16671667

1668-
// P0-1: if UPS matched a W skill via intent and reply ignored it, Stop-force one retry.
1669-
if (eventName === 'Stop' && state.workspaceSkillAutoMatch && state.workspaceSkillAutoMatch.skillId) {
1668+
// P0-1: if a workspace/global intent skill matched, enforce mustReply/body — not a user-visible meta line.
1669+
if (
1670+
eventName === 'Stop' &&
1671+
state.workspaceSkillAutoMatch &&
1672+
state.workspaceSkillAutoMatch.skillId
1673+
) {
16701674
try {
16711675
const {
16721676
isIntentReplySatisfied,
@@ -1679,27 +1683,39 @@ async function main() {
16791683
let matchForCheck = state.workspaceSkillAutoMatch
16801684
if (!matchForCheck.content && matchForCheck.injectionText) {
16811685
matchForCheck = {
1682-
matched: true,
1686+
matched: Boolean(matchForCheck.skillId),
16831687
skillId: matchForCheck.skillId,
16841688
mustReply: matchForCheck.mustReply,
16851689
content: matchForCheck.injectionText,
1686-
injectionText: matchForCheck.injectionText
1690+
injectionText: matchForCheck.injectionText,
1691+
skillLoadReceiptRequired: false,
1692+
skillLoadReceipt: ''
16871693
}
16881694
} else if (!matchForCheck.injectionText && matchForCheck.skillId) {
16891695
const rematch = routeWorkspaceSkillIntent(matchForCheck.skillId, { cwd: CONTEXT_ROOT })
16901696
if (rematch.matched) {
16911697
matchForCheck = {
1692-
matched: true,
1698+
matched: rematch.matched,
16931699
skillId: rematch.skillId,
16941700
mustReply: rematch.mustReply,
16951701
content: rematch.content,
1696-
injectionText: rematch.injectionText
1702+
injectionText: rematch.injectionText,
1703+
skillLoadReceiptRequired: false,
1704+
skillLoadReceipt: ''
16971705
}
16981706
} else {
1699-
matchForCheck = { ...matchForCheck, matched: true }
1707+
matchForCheck = {
1708+
...matchForCheck,
1709+
matched: Boolean(matchForCheck.skillId),
1710+
skillLoadReceiptRequired: false
1711+
}
17001712
}
17011713
} else {
1702-
matchForCheck = { ...matchForCheck, matched: true }
1714+
matchForCheck = {
1715+
...matchForCheck,
1716+
matched: Boolean(matchForCheck.skillId),
1717+
skillLoadReceiptRequired: false
1718+
}
17031719
}
17041720

17051721
const satisfied = isIntentReplySatisfied(lastAssistant, matchForCheck)
@@ -1717,14 +1733,14 @@ async function main() {
17171733
enforceCount: enforceCount + 1,
17181734
lastEnforceAt: new Date().toISOString()
17191735
}
1720-
state.lastReason = `workspace-skill-intent-stop:${state.workspaceSkillAutoMatch.skillId}`
1736+
state.lastReason = `workspace-skill-intent-stop:${matchForCheck.skillId}`
17211737
const output = decorateHookOutput(
17221738
blockOutput(platform, 'Stop', 'workspace-skill-intent', reason),
17231739
{
17241740
devcodexAction: INTERCEPTION_ACTION.FORBID,
17251741
devcodexCode: 'workspace-skill-intent',
17261742
devcodexEffective: true,
1727-
devcodexNextStep: 'Reply following the matched workspace skill body.'
1743+
devcodexNextStep: 'Follow matched skill body / must-reply (no meta skill line required).'
17281744
}
17291745
)
17301746
// Also top-level decision for Grok/Codex adapters

‎hooks/_runtime/workspace-skill-auto-match.cjs‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -383,18 +383,20 @@ function matchWorkspaceSkills(prompt, options = {}) {
383383

384384
const injectionText = [
385385
'### DevCodex · WorkspaceSkillAutoMatch',
386-
`matchedSkillId: ${best.skillId}`,
386+
`loadingSkillId: ${best.skillId}`,
387387
`selectedLayer: workspace`,
388388
`score: ${bestScore}`,
389389
`reasons: ${bestReasons.join(', ')}`,
390390
'',
391-
'【强制】本轮用户消息已匹配工作区自定义 Skill。你必须严格按下列 SKILL 正文执行;',
391+
`【过程文案】若宿主显示步骤/思考过程,写「正在加载 ${best.skillId} 技能」;不要写「命中 … 正在读取并按该技能执行」。`,
392+
'【强制】本轮已加载工作区自定义 Skill。你必须严格按下列 SKILL 正文执行;',
392393
'禁止当成连通性测试、@rocky 闲聊或通用 Ready 回复。',
394+
'最终用户可见正文不要加 DevCodex 技能元信息行。',
393395
mustReply ? `【必须回复核心】${mustReply}` : '',
394396
'',
395-
'----- BEGIN WORKSPACE SKILL -----',
397+
'----- BEGIN SKILL -----',
396398
injectBody,
397-
'----- END WORKSPACE SKILL -----'
399+
'----- END SKILL -----'
398400
].filter(Boolean).join('\n')
399401

400402
return {

0 commit comments

Comments
 (0)