Repository navigation
Closed
Labels
phase/implementationImplementation phase
Description
Machine-Readable Contract
contract_schema_version: v1
issue_kind: implementation
parent_issue: 1663
goal_ref: "runtime-validated adapter と agent-neutral policy-domain の実装"
change_kind: implementation
dependencies:
- issue: 1595
kind: partial
responsibility: "Bash raw command parser API のみを利用し再実装しない"Parent Issue
Parent Goal Ref
- Goal: validated runtime adapter と agent-neutral policy-domain contract の実装
- Desired Destination: 調査: agent-neutral worktree mutation guard input schema の要否を判断する #1663 の調査結論を実装可能な成果物へ接続する
Source / Decision Evidence
- ADR:
.claude/artifacts/issue-refinement-loop/1663/runtime-evidence/adr-policy-domain.md - Claude/Codex sanitized wire: 同 artifact directory
Outcome
Claude Code/Codex の version-validated adapter が vendor raw payload を
WORKTREE_MUTATION_INTENT_V1へ正規化し、resolver が
WORKTREE_SCOPE_BINDING_V1、shared policy が
WORKTREE_POLICY_DECISION_V1を返す。malformed/unsupported/version mismatch は
fail-closed とし、同一 intent/binding の runtime parity を検証する。
Current Validated Scope
Claude Write と Codex canonical apply_patch の sanitized wire captureを取得済み。
Bash parser は #1595 の公開 API に限定する。
Remaining Parent Gaps
adapter/domain/policy 実装、alias・malformed・Move・binding state・lifecycle parity
のテストと capture corpus を追加する。
In Scope
- closed domain contracts、resolver、shared policy と Claude/Codex thin adapter。
- supported version/canonical identity/alias を区別する validation。
- Move source/destination、POSIX/Windows path flavor、5 binding states の tests。
Out of Scope
- 実装: launcher command 共有 parser(argv boundary 保持・cwd/project_root 対応)を抽出し全 consumer の invocation contract を移行する #1595 の Bash parser 再実装。
- hook を security boundary、CI/branch protection/repository permission の代替と主張すること。
- 未捕捉 runtime/channel の parity 保証。
Acceptance Criteria
- AC1: closed intent/binding/decision contract が unknown key、bool-as-int、null、oversize、malformed digest を reject する。
- AC2: Claude/Codex adapters は raw DTO を policy core へ渡さず canonical identity と alias を区別する。
- AC3: bound、verified_unbound、unknown、ambiguous、resolution_failed を分離し unsupported/malformed を fail-closed にする。
- AC4: relative/absolute/traversal/symlink、Move 両側、POSIX/Windows/WSL path semantics を検証する。
- AC5: captured corpus の同一 normalized intent/binding で decision/reason_code parity を検証する。
Runtime Verification Applicability
runtime_verification_applicability:
decision: immediate
applicable_acs: [AC2, AC5]
execution_environment: "Claude Code 2.1.216、Codex CLI 0.145.0、synthetic Git repository、network-authenticated existing subscription"
skip_conditions: "runtime/hook trust が利用不能な場合は exit 77 とし PASS にしない"
fallback_policy: "synthetic fixture、manual payload、fallback result は official wire PASS としない"
artifact_requirements: ".claude/artifacts/issue-refinement-loop/1663/runtime-evidence/ と implementation worktree artifact に schema/version/digest を保存"Verification Commands
# AC1
# baseline-expect: fail
$ uv run --locked pytest tests/agent_guards/test_worktree_policy_domain.py -q
# AC2
# baseline-expect: fail
$ uv run --locked pytest tests/agent_guards/test_worktree_policy_domain.py -q
# AC3
# baseline-expect: fail
$ uv run --locked pytest tests/agent_guards/test_worktree_policy_domain.py -q
# AC4
# baseline-expect: fail
$ uv run --locked pytest tests/agent_guards/test_worktree_policy_domain.py -q
# AC5
# baseline-expect: fail
$ uv run --locked pytest tests/agent_guards/test_worktree_policy_domain.py -qAllowed Paths
- scripts/agent-guards/worktree_policy_domain.py
- scripts/agent-guards/worktree_scope_guard.py
- scripts/agent-guards/codex_apply_patch_adapter.py
- tests/agent_guards/test_worktree_scope_guard.py
- tests/agent_guards/test_codex_apply_patch_adapter.py
- tests/agent_guards/test_worktree_policy_domain.py
- tests/agent_guards/worktree_scope_guard_testkit.py
Stop Conditions
- 実装: launcher command 共有 parser(argv boundary 保持・cwd/project_root 対応)を抽出し全 consumer の invocation contract を移行する #1595 の public parser API が未提供の場合、Bash consumer integration は分離して dependency を維持する。
- Allowed Paths 外の変更が必要と判明した場合
- In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
- 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
- 後続 Phase / 別スコープへの波及が判明した場合
- nested SubAgent delegation が必要になった場合
- 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
- secret を sanitize できない runtime wire は保存・公開せず停止する。
Required Skills
- Python / pytest
Required Design References
docs/dev/hook-boundaries.mddocs/dev/agent-skill-boundaries.mddocs/dev/schema-governance.md
Delivery Rule
1 Issue = 1 PR
Metadata
Metadata
Assignees
Labels
phase/implementationImplementation phase
Activity
squne121 commentedon Jul 22, 2026
Contract Review Result
squne121 commentedon Jul 22, 2026
Contract Review Result
squne121 commentedon Jul 22, 2026
実装前重複確認
check_implementation_overlap.py --limit 2000は 176 件を全ページ取得し、complete: true/saturated: falseを確認しました。proceed_with_collision_evidence、evidence digest はsha256:6323f37a309e146a01444ecaa95eeb683155682f990ee9e12753674615dcb0dfです。squne121 commentedon Jul 22, 2026
Contract Review Result
fix: policy-domain の lint 違反を修正する (#1670)
squne121 commentedon Jul 22, 2026
Contract Review Result
test: adapter parity を回帰検証する (#1670)
feat: runtime policy-domain を adapter から分離する (#1672)