ai-agents-portability-campaign
Execute cross-harness hook changes for Claude Code and GitHub Copilot CLI using the settled official contract, versioned probes, generators, and runtime tests. Use for `run the portability campaign`, `port hooks to a new harness`, `copilot hook timeout regression`, or `new copilot cli release, recheck the contract`. Do NOT use for fact lookup alone (use `agent-harness-reference`) or release generation ownership (use `ai-agents-generation-and-release`).
rjmurillo · 已有静态检查记录
安装与使用
运行命令前先阅读来源与依赖说明。复制命令不会自动安装或执行。
npx skills add rjmurillo/ai-agents --skill ai-agents-portability-campaign技能说明
name: ai-agents-portability-campaign
description: Execute cross-harness hook changes for Claude Code and GitHub Copilot CLI using the settled official contract, versioned probes, generators, and runtime tests. Use for run the portability campaign, port hooks to a new harness, copilot hook timeout regression, or new copilot cli release, recheck the contract. Do NOT use for fact lookup alone (use agent-harness-reference) or release generation ownership (use ai-agents-generation-and-release).
version: 1.1.0
license: MIT
metadata:
routing:
role: front-door
invoker: autoplan
trigger: autoplan routes cross-harness hook port requests to ai-agents-portability-campaign
user-facing: false
ai-agents Portability Campaign
This skill changes hooks. agent-harness-reference owns hook facts.
ai-agents-empirical-probe-toolkit owns probe design.
ai-agents-generation-and-release owns mirror generation and the release path.
Triggers
run the portability campaignport hooks to a new harnesscopilot hook timeout regressionverify the copilot runtime contractnew copilot cli release, recheck the contract
Process
Phase 0: Load the Settled Contract
Read:
.claude/skills/agent-harness-reference/SKILL.md.claude/skills/agent-harness-reference/references/official-hook-contracts.md.claude/skills/agent-harness-reference/references/probe-evidence.md.project-toolkit/architecture/ADR-068-consolidated-hook-dispatcher.md.project-toolkit/architecture/ADR-071-plugin-hook-runtime-contract-verification.md.claude/rules/generated-artifacts.md
Do not run open-ended documentation research. Re-search or re-probe only when the reference skill's refresh rules apply.
Current load-bearing facts:
| Dimension | Settled contract |
|---|---|
| Event casing | PascalCase compatibility events deliver snake_case payloads |
| Stop | Stop is per-turn completion; SessionEnd is process lifecycle |
| PreCompact | Supported locally and in cloud automatic compaction |
| Matcher | Supported; PascalCase tool events use Claude-compatible tool names |
| PreToolUse deny | Top-level permissionDecision; nonzero denies; timeout fails open |
| PermissionRequest | behavior accepts only allow or deny; translated ask emits nothing |
| Observer output | Active PostToolUse text merges into one additionalContext; dormant SessionStart, PreCompact, and UserPromptSubmit adapters discard output; unclassified events stay direct |
| Cloud reach | Only default-branch .github/hooks/*.json loads |
| Plugin paths | Anchor through plugin-root variables; do not depend on cwd |
Phase 1: Classify the Source Hook
For every source registration, record:
- Claude event and Copilot event.
- Input payload fields in each harness.
- Matcher target and matcher syntax.
- Output schema.
- Exit, crash, timeout, and malformed-output behavior.
- Local CLI and cloud reach.
- Whether stdout is diagnostic text or documented structured host output.
Use this repository mapping:
| Claude source | Copilot target | Generated form |
|---|---|---|
| PreToolUse | PreToolUse | Active gate dispatcher, one source shim |
| PostToolUse | PostToolUse | Active observe dispatcher, one source shim, text to additionalContext |
| PermissionRequest | PermissionRequest | Supported translation path; no current producer |
| SessionStart | SessionStart | No current vendored source; observe/discard adapter if added |
| UserPromptSubmit | UserPromptSubmit | No current vendored source; observe/discard adapter if added |
| PreCompact | PreCompact | No current vendored source; observe/discard adapter if added |
| Stop | Stop | No current vendored source; separate direct registrations if added |
| SubagentStop | SubagentStop | Separate direct registrations if added |
| SessionEnd | SessionEnd | No current source registration; stays direct if added until reviewed |
| PostToolUseFailure | PostToolUseFailure | Direct registration preserves exit-2 recovery context |
Why Stop stays direct: Copilot parses one final JSON document from each command
hook. Concatenating two decision objects makes invalid JSON and discards both.
The same parser boundary applies to additionalContext, modifiedResult, and
other structured outputs. The active PostToolUse merger treats successful
observer stdout as ordered, flat context text and emits one additionalContext
object. Failed-observer partial output is discarded. It does not merge
modifiedResult or pre-structured JSON. Dormant SessionStart and PreCompact
adapters discard stdout and stderr. Their direct rollback tests preserve side
effects but suppress both channels. PostToolUseFailure stays direct because
exit-2 stdout becomes recovery
context. Copilot drops config-file UserPromptSubmit output, so its stdout is
redirected to stderr in dispatcher and direct rollback modes. Memory recall uses
the direct userPromptTransformed registration in
.github/hooks/memory-recall.json instead (issue #4727). Stderr is not a
documented model-context path. Every unclassified event stays direct until its
host contract is reviewed.
Phase 2: Change Canonical Sources
Edit the smallest canonical surface:
- Hook script:
.claude/hooks/** - Hook registrations:
.claude/settings.json - Event mapping:
templates/platforms/copilot-cli.yaml - Copilot generation:
build/scripts/generate_hooks*.pyandbuild/scripts/generate_dispatcher.py - Runtime adapter:
.claude/lib/hook_dispatch.py
Do not hand-edit src/copilot-cli/**.
Rules:
- Keep PascalCase target events when source hooks expect snake_case payloads.
- Keep script-side matcher checks as defense in depth.
- Keep canonical Claude PermissionRequest output unchanged.
- Translate only in the generated Copilot dispatcher.
- Translate Claude
approve