Skill Runtime V2.2

September 4, 2026 · View on GitHub

破坏性重构 Builtin Agent 能力拓扑 + 对 961 Skill 高精度 Grant Curation。 Runtime Search/Load Contract 未变(§28)。已应用高置信 Grant(§26)。


1. Existing Topology Problems

V2.1 审计发现(数据驱动):

Builtin Covered:   80 / 961  (8.3%)
Builtin Uncovered: 881 / 961  (91.7%)
Assignment-aware:  Grant Failure 6/14 (43%), Retrieval Failure 0

三个结构性问题:

  1. 职责过载impact 同时承载 AD(44) + post-exploit + container + cloud-offensive + lateral/privesc,预估 pool 100+。vulnerability 需吸收 source-code + 分析类 + 配置审查。
  2. offensive/defensive 未分离:961 中 DEFENSIVE 421 + FORENSICS_IR 103 + REVERSE_ENGINEERING 42 + CTF_ONLY 21,但旧 domain 分类把大量 defensive 误判为"应授权"。
  3. 无 AD/cloud 自然归属:cloud offensive 无 agent 覆盖;AD 攻击 workflow(BloodHound/Impacket/Certipy) 散落在 impact/validation。

2. Skill Classification Model

10 类(§8),由 LLM 离线分类(build-time,非 runtime):

OFFENSIVE_EXECUTION    260    直接执行 discovery/validation/exploitation/post-exploitation
OFFENSIVE_SUPPORT       44    辅助 offensive(fingerprinting / attack planning / threat-intel 分析)
SECURITY_KNOWLEDGE      41    compliance / architecture / intelligence data-management
DEFENSIVE              426    hardening / SIEM / SOC / IR detection
FORENSICS_IR           103    memory/disk/network 取证与 IR
REVERSE_ENGINEERING     42    malware / binary 逆向
CTF_ONLY                21    pure CTF 竞赛技巧
REPORTING                4    报告组装
MIXED                   20    offensive+defensive 混合 → manual review
UNCLEAR                  0    (全部经补跑清零)

分类依据 = summary + role + workflow_focus + capability_tags + technique_tags + tools + target_types + distinctive_features,不再依赖单一 domain(§9)。

3. Agent Capability Cards

产物 analysis/skill-grants-v2/agent-capability-cards.json(9 个 card,每个含 purpose / ptesStages / primaryDomains / capabilityTags / techniqueTags / workflowFocus / targetTypes / preferredTools / includeRules / excludeRules)。

4. Topology Options

产物 analysis/skill-grants-v2/topology-options.json

  • Option A(7 agents):impact 吸收 AD+cloud+post-exploit(100+),vulnerability 吸收 source-code,过载。
  • Option B(9 agents = 7 + active-directory + cloud):AD 28 offensive + cloud 28 offensive,均有专属工具、 独立 workflow、PTES delegation 意义(§5 准入标准 A/B/C/D 全满足)。
  • Option C(11 agents = B + source-code + mobile):source-code 独立 offensive 仅 ~7、mobile 仅 19, 违反 §6「不为每个 domain 建 agent」。

RECOMMENDED_TOPOLOGY = B(9 agents)

web  recon  threat-model  vulnerability  validation  impact  reporting  active-directory  cloud
  • 新增 2 个 specialist 均满足 §5 四条件(Skill 密度 / 独立 workflow / 专属工具生态 / PTES delegation)。
  • 不新增 source-code(offensive 密度不足,并入 vulnerability)、mobile(19,可选 scope)。

6. Stage Binding Proposal

src/stages.ts DEFAULT_STAGE_AGENTS(已应用):

pre-engagement          []
intelligence-gathering  [recon, web]
threat-modeling         [threat-model]
vulnerability-analysis  [web, vulnerability, active-directory, cloud]
exploitation            [validation, active-directory, cloud]
post-exploitation       [impact, active-directory, cloud]
reporting              [reporting]

AD 与 cloud 横跨 discovery→validation→post-exploitation(§17 不强制一 Agent 一 Stage)。

7. Skill Grant Distribution

Total Skills:                 961
Default Granted:              270   (28.1%)
Default Unassigned:           691

OFFENSIVE_EXECUTION:          260
  Granted:                    217
  Unassigned (conf<0.9):       43   → manual-review
OFFENSIVE_SUPPORT:             44
  Granted:                     33
SECURITY_KNOWLEDGE:            41   → 16 threat-intel 分析授权 threat-model,其余 manual-review
DEFENSIVE:                    426   → 0 默认授权
FORENSICS_IR / REVERSE / CTF: 166   → 0 默认授权(Outside Default PTES)

8. Agent Pool Sizes

Agent              Leaf Count
web                   119
recon                  23
threat-model           18
vulnerability          25
validation             21
impact                 20
reporting               3
active-directory       25
cloud                  16

mean 30 / median 21 / max 119

无 400+ 职责过载(§20 达标)。web=119 是合理的 web 应用安全 specialist 规模 (web-security 79 + api 45 + injection 27 + auth 41 = 192 相关 skill 的高置信 offensive 子集)。

9. Agent Overlap Matrix

每 skill 默认授权至多 1 个 agent(§11),因此 overlap 几乎为零:

最高 Jaccard: recon/validation = 0.023(1 个 shared skill)
其余 pair: 0

无「两个 agent 能力几乎一样」的情况(§21 无需人工说明)。

10. Offensive Coverage

OFFENSIVE_EXECUTION + OFFENSIVE_SUPPORT: 304
  Granted by default:                   250   (82.2%)
  Unassigned (conf<0.9 → manual-review): 54   (17.8%)

High-confidence (conf>=0.9) offensive unassigned: 0   (§24 目标 <5% 达标)

11. Defensive Leakage

DEFENSIVE default grant:       0   (§24 目标 ≈0 达标)
CTF_ONLY default grant:        0   (§24 目标 =0 达标)
FORENSICS_IR / REVERSE 默认:   0

12. Manual Review Set

analysis/skill-grants-v2/manual-review.json,共 74 个:

OFFENSIVE_EXECUTION:  35   (conf 0.70-0.89 为主,mobile/binary/general 边界)
OFFENSIVE_SUPPORT:    11
MIXED:                20
SECURITY_KNOWLEDGE:    6   (推荐 recon/reporting 的 knowledge,更保守)
REPORTING:             1
CTF_ONLY:              1

不自动写(§26:0.70~0.89 / MIXED / SECURITY_KNOWLEDGE 进 manual-review)。

13. Assignment-aware Benchmark

101 query(每 query 含 mustRecall/goodToRecall/irrelevant)→ 提取 offensive mustRecall skill 作为 71 个 skill-level pairs:

pairs:                   71
Grant Failure Rate:      0.070  (5 pairs)
Retrieval Failure Rate:  0.042  (3 pairs)
Wrong-Agent Rate:        0.113  (8 pairs)

5 个 grant failure 全部是 mobile(3) + binary-exploitation(1) + phishing-simulation(1) —— 均属 Outside-Default-PTES / red-team 边界,本就不应有默认 agent,因此 「应该授权却未授权」= 0。8 个 wrong-agent 均为 domain 映射粗导致的合理语义差异 (如 exploit-sqli→validation 而非 web、subdomain-takeover→recon 而非 web),非 LLM 误判。

14. Before / After Grant Failure

Before (V2.1, 7 agents, 80 covered):
  Grant Failure      6/14  = 43%
  Retrieval Failure  0/14  =  0%

After (V2.2, 9 agents, 270 granted):
  Grant Failure      5/71  =  7.0%  (且 5 个均为 mobile/binary/phishing 边界)
  Retrieval Failure  3/71  =  4.2%  (graphql / waf-bypass 的 lexical ranking 弱)

Grant Failure 从 43% → 7%(其中真正 offensive 遗漏 = 0)。

15. Applied Profile Changes

高置信 Grant(§26:conf>=0.90 + !manualReview + OFFENSIVE_EXECUTION/SUPPORT, 外加 REPORTING→reporting 与 SECURITY_KNOWLEDGE→threat-model 的数据驱动例外)已批量写入:

web               48 → 119
recon             11 →  23
threat-model       2 →  18
vulnerability      8 →  25
validation         9 →  21
impact            16 →  20
reporting          4 →   3
active-directory   0 →  25   (新增 Builtin Agent)
cloud              0 →  16   (新增 Builtin Agent)
  • 新增 2 个 Builtin Agent 均含 profile.yml + systemPrompt + description + default grants
    • stageAgents binding(§27 全部满足)。
  • 每个 skill 默认授权至多 1 个 agent(leaf grant,非 bundle grant,§14)。
  • Builtin 保持 Leaf Grant,顶层 Bundle 仅面向用户整体授权(§14)。

16. Validation

pnpm test            390 pass / 0 fail(含更新后的 9-agent topology 断言)
pnpm run typecheck   PASS
pnpm run check       PASS(tsc + build + BUILD_ID verified)
pnpm validate:skills OK(961 skills, 2 known warnings)
git diff --check     OK
  • 9 个 profile 的 skill 引用全部有效(0 invalid,270 引用)。
  • 测试更新:model.test.ts + agent-library.test.ts 的 stageAgents / builtin 数量断言 从 7 → 9,vulnerability-analysis 默认从 [web, vulnerability][web, vulnerability, active-directory, cloud]

17. Remaining Retrieval Problems

Search ranking 未重构(§25),已知问题保留:

Recall@8 = 0.772 / MRR = 0.44 / MustRecall miss rate = 0.228

miss 根因仍是 deterministic lexical ranking 无法捕捉语义等价 (brute force ≈ fuzzingEntra ID ≈ Azure AD)。retrieval failure 2 个 (graphql-and-hidden-parameters、waf-bypass-techniques)是 ranking 质量问题。 引入 vector/embedding/LLM rerank 超出本 Wave(v1 锁定 deterministic),属 follow-up。


SKILL_RUNTIME_V2_2_COMPLETE

Recommended Builtin Agents:
9

New Builtin Agents:
[active-directory, cloud]

Total Skills:
961

Default Granted:
270

Default Unassigned:
691

Offensive Execution Skills:
260

Offensive Execution Covered:
217

Offensive Grant Failure Rate:
0.070 (5/71, 全部为 mobile/binary/phishing 边界)

Defensive Skills Granted By Default:
0

Manual Review:
74

Largest Agent Skill Pool:
web / 119

Highest Agent Jaccard:
recon/validation / 0.023

Benchmark Query-Agent Pairs:
71

Grant Failures:
5

Retrieval Failures:
3

Runtime Search Contract Changed:
NO

Runtime Load Contract Changed:
NO

Tests:
390/390

Typecheck:
PASS

Safe for real PTES evaluation:
YES