Skip to content

実装: agent-retrospective の Orchestrator Skill と retrospective-runtime-observer・retrospective-evaluator SubAgent を実装する #2237

Closed

Description

@squne121

Parent Issue

#2192

Machine-Readable Contract

contract_schema_version: v1
issue_kind: implementation
parent_issue: "#2192"
goal_ref: "#2192 の Child 4: agent-retrospective の Orchestrator Skill と retrospective-runtime-observer/retrospective-evaluator SubAgent を実装する"
change_kind: mixed

Parent Goal Ref

Current Validated Scope

  • .claude/skills/agent-retrospective/SKILL.md の新規追加、stable executable entrypoint .claude/skills/agent-retrospective/scripts/run_retrospective.py の新規追加、.claude/agents/retrospective-runtime-observer.md / .claude/agents/retrospective-evaluator.md の新規追加、既存 web-researcher / codebase-investigator の再利用配線
  • OWNER review(#2237 comment #1, verdict: REQUEST_CHANGES, recommended_disposition: reframe_in_place)を受け、ANCHOR_SCOPE_REFRAME_V1 comment(OWNER_DIRECTIVE_MATERIALIZED_FROM_INTERACTIVE_PROMPT_V1)で承認された Allowed Path delta を反映した reframe-in-place 版
  • OWNER review #2(main SHA 1fb91c36 時点、verdict: REQUEST_CHANGES、recommended_disposition: reframe_in_place、P0 5件・P1 4件)を受け、既存 Allowed Paths の範囲内で orchestration owner の一意化・ephemeral wire contract・PreviousStateProvider port・PublishRequest proposal-only envelope・reused Agent の enforcement boundary・timeout/retry/budget の具体値・偽陽性 VC 修正を反映した再 reframe 版(本セクション以降)

Remaining Parent Gaps

Outcome

.claude/skills/agent-retrospective/SKILL.md(disable-model-invocation: true、500 行未満、progressive disclosure 構造)が新規追加され、Child 2 の schema・Child 3 の adapter・stable executable entrypoint run_retrospective.py を配線する orchestrator として動作する状態になる。

Orchestration owner(P0-1 対応)

orchestration_owner は root Skill / main conversation に一意に固定する(SKILL.md と run_retrospective.py の二重所有を解消)。

orchestration_owner: root Skill / main conversation
run_retrospective.py:
  role: deterministic phase engine
  phases:
    - prepare          # collector 実行・SourcePlanV1・run nonce・base_sha・source digest 生成
    - validate-observers  # observer 結果の strict schema validation・EvaluatorRequestV1 生成
    - prepare-evaluator
    - finalize         # evaluator 結果検証・PublishRequestV1 生成
agent_tool_calls:
  owner: root Skill
  prohibited_owner: observer/evaluator leaf agents  # leaf は Agent tool call を一切行わない

run_retrospective.py 自身は Claude Code Agent tool を呼ばない(prepare / validate-observers / finalize の各 phase を実行する deterministic function 群のみを提供する)。実際の observer/evaluator 起動・待機・再試行・キャンセルは root Skill(SKILL.md の手順に従う main conversation)が所有する。

production Agent invocation 経路: headless CLI subprocess(claude -p --output-format json --json-schema <schema>)に固定する。理由: 現行 pyproject.toml は pyyaml / jsonschema のみに依存し、Claude Agent SDK 依存を追加すると Allowed Paths 外(pyproject.toml / lockfile)への変更が必要になるため、既存 Allowed Paths を維持できる CLI subprocess 経路を採用する。cwd は run 開始時に固定した repository root、base SHA は prepare phase で一度だけ解決した値を環境変数として子プロセスへ明示的に渡す。authentication は既存 Claude Code subscription login を前提とし、--bare(API key 必須)は採用しない(subscription 前提を明記することで暗黙の認証方式選択を排除する)。timeout・SIGTERM・API error・partial result・background 完了確認は「実行 budget(下記)」で固定する。observer と evaluator が同一 run に属することは、run_id(prepare phase が生成する run-scoped nonce)をすべての wire envelope(下記)に必須フィールドとして持たせ、fan-in 時に一致検証することで照合する。

ephemeral wire contract(P0-2 対応)

persistent state schema(agent_retrospective_run/v1 / agent_improvement_candidate/v1、#2288 で確定済み)とは別に、process/model 境界の ephemeral wire contract を Python dataclass + strict serializer/deserializer として固定する:

SOURCE_PLAN_V1
OBSERVER_RESULT_V1
FINDING_SET_V1
EVALUATOR_REQUEST_V1
EVALUATION_RESULT_V1
PUBLISH_REQUEST_V1

各 envelope の最低要件:

  • schema_version / run_id / base_sha / source_set_digest を必須フィールドとして持つ
  • 未知フィールドは additionalProperties: false 相当(strict なフィールド集合、schema-controlled projection)で拒否する
  • evidence は public-safe evidence_ref(文字列参照)のみを持ち、raw payload・stdout/stderr・絶対パス・credential-bearing フィールドを構造上持てない
  • observer result と evaluator request は run_id が完全一致することを検証する
  • JSON decode failure・missing field・unknown field・duplicate ID・oversize(バイト上限)は fail-closed で reject する
  • schema repair retry は最大 1 回に固定する(schema_repair_retries: 1)
  • テストは dataclass を直接構築せず、serialized Agent output(文字列)を parser へ入力して round-trip 検証する

PreviousStateProvider(P0-3 対応)

delta 算出(new / resolved / recurrent / regressed / unchanged)の責務を本 Issue が持つため、read-only port を先に固定する:

PreviousStateProvider:
  input:
    repository_id: string
    scope: string
    finding_identity_algorithm: string
  output:
    schema: PREVIOUS_RETROSPECTIVE_STATE_V1
    status:
      - available
      - no_history
      - legacy_unavailable
      - partial
      - stale
    previous_run_ref: string | null
    candidates: []
    read_version: string | null

本 Issue では fixture / in-memory provider を実装し、5 状態すべてを網羅する delta computation を pytest で証明する。production provider(実際の永続化読み取りと read_version optimistic concurrency)は #2238 の責務とし、#2238 は本 port の exact interface を production provider として実装する(PreviousStateProvider の型・5 状態を変更しない)。

PublishRequest producer/consumer contract(P0-4 対応)

PUBLISH_REQUEST_V1 は proposal-only envelope とし、mutation authority や human 承認の trust root を一切含まない:

schema_version: publish_request/v1
request_id: string
repository_id: string
target_issue: integer
run_identity: object
candidate_records: []
expected_previous_digest: string | null
idempotency_key: string
public_projection_digest: string
authorization_required: true

以下のフィールドは schema レベルで 禁止(存在すれば invalid)とする: authorized / authorized_by_human / authorization_token / mutation_capability。人間承認は本 envelope とは別の trusted channel(HUMAN_AUTHORIZATION_RECEIPT_V1、#2238 が発行・検証する controlled executor 経由)で供給され、request_id / public_projection_digest / repository・target Issue / operation class / expiry or one-shot nonce に束縛される。本 Issue は PUBLISH_REQUEST_V1 の producer 側 schema・serializer のみを実装し、receipt の発行・検証・実際の mutation 実行は #2238 の責務とする。

reused Agent の capability matrix(P0-5 対応)

既存 web-researcher / codebase-investigator を capability matrix に基づき再利用する。matrix は prose ではなく enforcement contract として実装する:

Role Authority 必須入力 本番制約
runtime observer interpreter private runtime evidence + digest no Agent/Skill/write、raw 出力禁止
codebase investigator advisory(current worktree を authority にしない) git show <base_sha>:<path> 等で materialize した入力 base_sha 非束縛の調査結果は finding authority にしない
web researcher URL discovery / claim interpretation bounded query 最終 evidence は Web collector(Child 3)で再取得・digest 化してから finding authority にする
evaluator privileged synthesis validated projection のみ Web/Bash/Agent/Skill/write 全禁止

production Agent invocation 層(root Skill が所有)は、委譲した Agent が次を試みても拒否する permission policy / tool callback を持つ: git commit/git push、gh issue/gh pr/gh comment、filesystem write、unapproved Bash command、対象 run 以外の resume。各 run の private temp artifact は専用ディレクトリ(mode 0700)に置き、success・exception・SIGINT・SIGTERM の全経路で削除することを pytest で証明する。

実行 budget・retry・cancel・partial-result policy(P1-2 対応)

observer_parallelism: 3
schema_repair_retries: 1
evaluator_retries: 0
partial_agent_output: reject
api_error_with_partial_text: reject_as_evidence
timeout_status: typed operational failure
interruption_status: aborted
cleanup_required: true

observer/evaluator それぞれの maxTurns・output byte/token limit は .claude/agents/retrospective-runtime-observer.md / .claude/agents/retrospective-evaluator.md の frontmatter に具体値として固定し、mcpServers/hooks/memory/background/isolation/skills の許容値も同 frontmatter に明示する(省略しない)。一部 observer 成功時に evaluator を起動可能かは partial_agent_output: reject に従い、全 observer 成功後にのみ evaluator を起動する。

delegation topology は二段階固定とする: Human explicit invocation → root Skill(main conversation) → deterministic collectors(run_retrospective.py の prepare phase) → observer wave(retrospective-runtime-observer / codebase-investigator / web-researcher、同時起動可、observer_parallelism: 3) → deterministic fan-in・validation(validate-observers phase)・conflict classification → fresh-context retrospective-evaluator(observer wave 完了・validated projection 受領後にのみ起動、observer と同時起動しない) → finalize phase(proposal-only output)。

新規 SubAgent 定義 .claude/agents/retrospective-runtime-observer.md(Claude Code/Claude-GPT adapter evidence の解釈専用)と .claude/agents/retrospective-evaluator.md(独立 adversarial evaluation 専用)は、両方とも leaf として明示的に制約される。現行 Claude Code は既定で最大 3 階層まで nested subagent spawn を許容する仕様(Agent tool を持つ SubAgent は自身がさらに SubAgent を spawn できる)であり、「SubAgent は nested SubAgent を spawn できない」という前提は現行仕様と一致しないため採用しない。したがって、leaf 制約は「現行では nested delegation が可能だからこそ、leaf boundary を明示的に enforcement する必要がある」という理由で設計する。制約方法は tools frontmatter allowlist から Agent を完全除外する、または disallowedTools へ Agent を追加することのみとする(Agent(name1, name2) のような allowlist 構文は nested SubAgent 定義内では実行時に無視されるため、leaf 制約の手段として使わない)。両 SubAgent は最低限: name 必須、description 必須、tools を省略しない明示 read-only allowlist、Agent 不可、Skill 不可、Write 不可、Edit 不可、NotebookEdit 等 write-capable tool も必要に応じ deny、不要な mcpServers 禁止、不要な hooks 禁止、不要な memory 禁止、bounded maxTurns(具体値を frontmatter に明示)、malformed output は fail-closed とする。

既存 web-researcher / codebase-investigator は上記 capability matrix に基づき Web/repository 調査で再利用され、observer wave に組み込まれる。

Runtime Verification Applicability

In Scope

  • .claude/skills/agent-retrospective/SKILL.md の新規追加(disable-model-invocation: true、500 行未満、progressive disclosure:詳細は references/ へ分離)
  • .claude/skills/agent-retrospective/scripts/run_retrospective.py の新規追加(stable executable entrypoint、prepare/validate-observers/prepare-evaluator/finalize の deterministic phase engine、manual trigger preflight、base_sha 一度だけの固定、ephemeral wire contract の serializer/deserializer、private evidence 隔離、proposal-only 出力。Agent tool の起動は行わず、root Skill が所有する。mutation なし)
  • .claude/agents/retrospective-runtime-observer.md の新規追加(leaf SubAgent、tools frontmatter に Skill/Agent を含まない、maxTurns・出力上限を具体値で明示、Claude Code/Claude-GPT adapter evidence の解釈専用)
  • .claude/agents/retrospective-evaluator.md の新規追加(leaf SubAgent、tools frontmatter に Skill/Agent を含まない、maxTurns・出力上限を具体値で明示、独立 adversarial evaluation 専用、observer wave 完了後にのみ起動)
  • 既存 web-researcher / codebase-investigator の capability matrix(enforcement contract)ドキュメント化と、SKILL.md からの再利用配線
  • 二段階 fan-out/fan-in topology(observer wave → fan-in → evaluator)の SKILL.md 内定義(leaf からの nested Skill/SubAgent delegation を禁止する明記)
  • production Agent invocation adapter(headless CLI subprocess claude -p --output-format json --json-schema 経由、typed AgentInvocationRequest/AgentInvocationResult)を run_retrospective.py 内に実装し、fake-runtime と同一 protocol を満たすことを subprocess mock harness で証明する
  • ephemeral wire contract(SOURCE_PLAN_V1/OBSERVER_RESULT_V1/FINDING_SET_V1/EVALUATOR_REQUEST_V1/EVALUATION_RESULT_V1/PUBLISH_REQUEST_V1)の dataclass・strict serializer/deserializer・schema repair retry(上限1)を実装する
  • PreviousStateProvider read-only port を fixture/in-memory provider として実装し、5 状態(available/no_history/legacy_unavailable/partial/stale)を通した delta 算出(new/resolved/recurrent/regressed/unchanged)を実装する
  • PUBLISH_REQUEST_V1 の producer 側 schema・serializer を実装する(authorized/authorized_by_human/authorization_token/mutation_capability を forbidden field として schema レベルで拒否する)
  • capability matrix を enforcement contract 化した permission policy / tool callback(delegated Agent による git/gh mutation・filesystem write・unapproved Bash・対象 run 外 resume を拒否)を実装する
  • run-scoped temp artifact ディレクトリ(mode 0700)と、success/exception/SIGINT/SIGTERM 全経路での cleanup を実装する
  • 新規 2 SubAgent の frontmatter が tools に Skill/Agent を含まないこと、および maxTurns/mcpServers/hooks/memory の具体値が固定されていることを検証する pytest(CI 収集対象 .claude/agents/tests/ 配下に配置)
  • run_retrospective.py の hermetic 統合検証(base_sha 固定・evaluator 起動順序・raw evidence 非流入・no-mutation・wire contract round-trip・PreviousStateProvider 5 状態・PublishRequest forbidden field・permission policy・temp cleanup)を検証する pytest(.claude/skills/agent-retrospective/scripts/tests/ 配下に配置)

Out of Scope

Acceptance Criteria

  • AC1: .claude/skills/agent-retrospective/SKILL.md が存在し、frontmatter に disable-model-invocation: true を含む
  • AC2: .claude/skills/agent-retrospective/SKILL.md が 500 行未満であることを pytest(test_run_retrospective.py 内の行数アサーション、wc -l相当の厳密な <500 判定)で証明する
  • AC3: .claude/agents/retrospective-runtime-observer.md が存在し、frontmatter tools に Skill を含まない
  • AC4: .claude/agents/retrospective-evaluator.md が存在し、frontmatter tools に Skill を含まない
  • AC5: 両 SubAgent の frontmatter tools に Agent を含まない(nested SubAgent delegation 禁止の静的証明。Agent(name) allowlist 構文ではなく tools からの完全除外、または disallowedTools への追加で証明する)
  • AC6: SKILL.md が既存 web-researcher および codebase-investigator の両方の再利用を明記している
  • AC7: run_retrospective.py が存在し、SourcePlan/EvidenceBundle/FindingSet/Evaluation/PublishRequest の各 dataclass が dataclasses.is_dataclass を満たし、exact field set・exact field types・schema_version フィールドを持ち、serializer/deserializer の round-trip(serialized Agent output 文字列 → parse → 再 serialize で不変)を pytest で証明する
  • AC8: run_retrospective.py が run 内で base_sha を一度だけ固定し、collector 呼び出し間で再解決しないことを pytest で証明する
  • AC9: retrospective-evaluator 相当の呼び出しが observer wave 完了・validated projection 受領前には起動されないことを pytest で証明する(evaluator ordering enforcement)
  • AC10: raw evidence(未加工の GitHub/Web/log/stdout)が evaluator 入力に一切渡らず、schema-controlled projection のみが渡ることを pytest で証明する
  • AC11: run_retrospective.py が GitHub/Issue へのいかなる mutation も実行しない(proposal-only、PublishRequest 生成のみ)ことを pytest で証明する
  • AC12: 両 SubAgent 定義の frontmatter が Write/Edit を含まず、maxTurns が具体的な整数値として固定されていること、および mcpServers/hooks/memory が明示的に空または不使用であることを pytest で証明する(.claude/agents/tests/ 配下の boundary test)
  • AC13: production Agent invocation adapter(headless CLI subprocess、claude -p --output-format json --json-schema 相当の argv 構築)が実装され、fake-runtime harness と同一 protocol(成功・timeout・SIGTERM・API error・partial result・malformed structured output の各分岐)を満たすことを subprocess mock(実プロセスは起動しない)で pytest 証明する
  • AC14: Agent の serialized output が strict schema validation(schema_version/run_id/base_sha/source_set_digest 必須、未知フィールド拒否、evidence は evidence_ref のみ)を通らない場合、schema repair retry を最大 1 回実行し、それでも失敗すれば evaluator を起動せず fail-closed で終了することを pytest で証明する
  • AC15: PreviousStateProvider(fixture/in-memory 実装)が available/no_history/legacy_unavailable/partial/stale の 5 状態を返せること、および各状態からの delta 算出(new/resolved/recurrent/regressed/unchanged)が正しいことを pytest で証明する
  • AC16: PUBLISH_REQUEST_V1 の serializer が authorized/authorized_by_human/authorization_token/mutation_capability のいずれかのフィールドを含む入力を invalid として拒否し、request_id/repository_id/target_issue/run_identity/candidate_records/expected_previous_digest/idempotency_key/public_projection_digest/authorization_required を持つ envelope のみを valid とすることを pytest で証明する
  • AC17: 委譲された Agent(web-researcher/codebase-investigator 相当のモック)が git commit/git push/gh issue comment/gh pr/filesystem write/unapproved Bash command を試みた場合、permission policy / tool callback がこれを拒否することを adversarial pytest harness で証明する
  • AC18: run-scoped temp artifact ディレクトリが mode 0700 で作成され、正常終了・例外発生・SIGINT・SIGTERM の全 4 経路で削除されることを pytest で証明する

Verification Commands

# AC1
# baseline-expect: fail
$ rg -n "disable-model-invocation: true" .claude/skills/agent-retrospective/SKILL.md
# AC2
# baseline-expect: fail
$ uv run pytest .claude/skills/agent-retrospective/scripts/tests/test_run_retrospective.py -k skill_md_under_500_lines -v
# AC3
# baseline-expect: fail
$ uv run pytest .claude/agents/tests/test_retrospective_subagent_boundary.py -k runtime_observer_no_skill_tool -v
# AC4
# baseline-expect: fail
$ uv run pytest .claude/agents/tests/test_retrospective_subagent_boundary.py -k evaluator_no_skill_tool -v
# AC5
# baseline-expect: fail
$ uv run pytest .claude/agents/tests/test_retrospective_subagent_boundary.py -k no_agent_tool -v
# AC6
# baseline-expect: fail
$ rg -n "web-researcher" .claude/skills/agent-retrospective/SKILL.md
# baseline-expect: fail
$ rg -n "codebase-investigator" .claude/skills/agent-retrospective/SKILL.md
# AC7
# baseline-expect: fail
$ uv run pytest .claude/skills/agent-retrospective/scripts/tests/test_run_retrospective.py -k wire_contract_dataclass_roundtrip -v
# AC8
# baseline-expect: fail
$ uv run pytest .claude/skills/agent-retrospective/scripts/tests/test_run_retrospective.py -k base_sha_fixed_once -v
# AC9
# baseline-expect: fail
$ uv run pytest .claude/skills/agent-retrospective/scripts/tests/test_run_retrospective.py -k evaluator_waits_for_observer -v
# AC10
# baseline-expect: fail
$ uv run pytest .claude/skills/agent-retrospective/scripts/tests/test_run_retrospective.py -k evaluator_receives_typed_projection_only -v
# AC11
# baseline-expect: fail
$ uv run pytest .claude/skills/agent-retrospective/scripts/tests/test_run_retrospective.py -k no_mutation_side_effect -v
# AC12
# baseline-expect: fail
$ uv run pytest .claude/agents/tests/test_retrospective_subagent_boundary.py -k leaf_frontmatter_contract -v
# AC13
# baseline-expect: fail
$ uv run pytest .claude/skills/agent-retrospective/scripts/tests/test_run_retrospective.py -k production_agent_invocation_adapter -v
# AC14
# baseline-expect: fail
$ uv run pytest .claude/skills/agent-retrospective/scripts/tests/test_run_retrospective.py -k schema_repair_retry_bounded -v
# AC15
# baseline-expect: fail
$ uv run pytest .claude/skills/agent-retrospective/scripts/tests/test_run_retrospective.py -k previous_state_provider_five_states -v
# AC16
# baseline-expect: fail
$ uv run pytest .claude/skills/agent-retrospective/scripts/tests/test_run_retrospective.py -k publish_request_forbidden_fields -v
# AC17
# baseline-expect: fail
$ uv run pytest .claude/skills/agent-retrospective/scripts/tests/test_run_retrospective.py -k delegated_agent_mutation_denied -v
# AC18
# baseline-expect: fail
$ uv run pytest .claude/skills/agent-retrospective/scripts/tests/test_run_retrospective.py -k temp_artifact_cleanup_all_paths -v

Allowed Paths

  • .claude/skills/agent-retrospective/SKILL.md
  • .claude/skills/agent-retrospective/references/
  • .claude/agents/retrospective-runtime-observer.md
  • .claude/agents/retrospective-evaluator.md
  • .claude/skills/agent-retrospective/scripts/run_retrospective.py
  • .claude/skills/agent-retrospective/scripts/tests/test_run_retrospective.py
  • .claude/agents/tests/test_retrospective_subagent_boundary.py

Stop Conditions

  • Allowed Paths 外の変更が必要と判明した場合(例: Claude Agent SDK 採用による pyproject.toml/lockfile 変更、新規 persistent state schema ファイルの追加)
  • In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
  • ephemeral wire contract の envelope 定義の変更が必要になった場合
  • 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
  • 後続 Phase / 別スコープへの波及が判明した場合
  • nested SubAgent delegation が必要になった場合
  • observer/evaluator が leaf 制約を超えて nested SubAgent delegation を必要とする設計変更が必要になった場合
  • 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
  • Child 3 の source adapter が未マージ・未確定の場合は着手せず停止する
  • PreviousStateProvider の production 実装(実装: agent-retrospective の run 永続化と agent_retro_index/v1 統合を実装する #2238)や HUMAN_AUTHORIZATION_RECEIPT_V1 の producer/consumer contract test が本 Issue 側の変更を要求する場合は着手前に本 Issue の contract を再確認する

Required Skills

なし

Required Design References

Scope Delta(任意)

Source

Delivery Rule

1 Issue = 1 PR。専用 worktree で作業し、Draft PR を既定とする。Depends on #2235(Child 2)のマージ。Depends on #2236(Child 3)のマージ。Depends on #2288(delta-evaluation schema 拡張契約)は PR #2289 により 2026-08-22 にマージ済みのため依存は解消済み。

Activity

  1. added
    phase/implementation
    agent/implementer
    enhancement
    on Aug 17, 2026
  2. squne121 commented on Aug 21, 2026

    @squne121
    OwnerAuthor

    結論

    verdict: REQUEST_CHANGES
    implementation_readiness: blocked
    recommended_disposition: reframe_in_place
    review_snapshot:
      date: "2026-08-21"
      main_sha: "908b48f7ba5347b75e61e1d931971a6a043eb88d"
    blocking_findings:
      - executable_orchestration_contract_missing
      - trust_boundary_and_typed_handoff_missing
      - delta_and_publication_integration_owner_missing
      - acceptance_and_ci_contract_incomplete

    #2237 の方向性自体は妥当です。人間による明示起動、disable-model-invocation: true、500行未満の SKILL.md、progressive disclosure、専用 Agent の増殖を2件に抑えて既存 Agent を再利用する判断は維持できます。これらは Claude Code/Agent Skills の現行ガイダンスとも整合します。(Claude)

    しかし、現本文は2026年8月17日の起票直後から実質更新されておらず、コメントもありません。その後、ADR 0007、run/candidate schema、5 source adapter が順次マージされました。現行 main の .claude/skills/agent-retrospective/ には schemas/ と scripts/ だけがあり、#2237 がそれらの確定後の実インターフェースを再評価した形跡がありません。

    このまま実装すると、「Markdown上では Agent 名が書かれているが、runを構築できず、証跡境界も保証せず、CIにも収録されない Skill」がACを全件通過します。


    P0 — 実装開始を止める blocker

    P0-1 — 「orchestrator」が実行可能な統合層を所有していない

    #2237 は SKILL.md が Child 2 の schema と Child 3 の adapter を「呼び出す orchestrator として動作する」としていますが、Allowed Paths は Markdown、Agent定義、frontmatterテストだけです。ACもファイル存在、行数、Agent名の記載、tools 内の文字列確認に限定されています。

    一方、マージ済み adapter は呼び出し元に具体的な入力解決を要求します。

    • Claude Code collector: 対象セッションの session_paths
    • Claude-GPT collector: hook_sink_path と run_nonce
    • repository collector: 一度だけ固定した40桁 base_sha と repo_root
    • GitHub collector: 調査対象 endpoint 群と page fetcher
    • Web collector: 対象URL、SSRF境界を維持する fetcher/resolver

    また、末尾の collect_all_sources() は、既に引数を束縛済みの zero-argument callable を順番に実行するだけです。対象セッション、GitHub scope、Web source、base SHA、前回runを解決する実装ではありません。

    したがって、少なくとも次の実行可能層が #2237 の責務に必要です。

    run_retrospective.py
      ├─ manual trigger preflight
      ├─ base_sha の一度だけの固定
      ├─ source scope / input plan の構築
      ├─ 5 collector の引数束縛と実行
      ├─ source_observations の組み立て
      ├─ source_set_digest の計算
      ├─ validate_run() による検証
      ├─ private evidence bundle の隔離保存
      ├─ specialist Agent への typed input 構築
      └─ proposal artifact の出力
    

    SKILL.md からインラインPythonや自由形式のBashを組み立てる方式は、引数、失敗分類、digest、公開境界をプロンプト解釈に委ねるため不適切です。scripts/run_retrospective.py または同等の stable entrypoint と、fixtureベースの統合テストを In Scope に追加すべきです。


    P0-2 — ADR 0007 の trust boundary を実装できる handoff contract がない

    ADR 0007 は、GitHub/Web/ログ由来の untrusted content を次の順序で処理することを要求しています。

    deterministic extraction
      → provenance / taint
      → isolated observation context
      → schema-controlled projection
      → privileged evaluator / control-plane
    

    rawなIssue本文、コメント、Web本文、stdout、ログを evaluator や mutation判断を行うメインコンテキストへ直接渡してはいけません。

    Child 3 の CollectorResult.private_evidence は invocation-private ですが、privateであることと evaluator-safe であることは別です。secretや絶対パスが scrub されていても、prompt injection文字列や誤誘導された意味内容は残り得ます。PR #2269 も private_evidence は永続化しない invocation-private channel と位置付けています。

    #2237 は「flat fan-out/fan-in」と Agent 名だけを指定しており、次がありません。

    • Agentへ渡せるフィールドのallowlist
    • taint/provenanceの保持方法
    • observer出力の型
    • conflict taxonomyの適用主体
    • evaluatorへraw evidenceを渡さないことの検証
    • evaluatorが最終synthesisを評価する実行順序
    • malformed/schema-invalid Agent出力の扱い
    • correction loopの上限

    必要な topology は、単一波のfan-outではなく、深さ1を維持した二段階委譲です。

    Human explicit request
            │
            ▼
    Main orchestrator
            │
            ├─ 1. deterministic collection
            │
            ├─ 2. observer wave
            │      ├─ retrospective-runtime-observer
            │      ├─ codebase-investigator
            │      └─ web-researcher
            │
            ├─ 3. deterministic fan-in / conflict classification
            │
            ├─ 4. fresh-context retrospective-evaluator
            │
            └─ 5. proposal-only result
    

    evaluator は最初のfan-outと同時起動させず、全observer出力の検証・正規化後に、メインスレッドから別のdepth-1 Agentとして起動すべきです。

    最低限、以下の ephemeral contract が必要です。

    RETROSPECTIVE_SOURCE_PLAN_V1:
      base_sha: <40hex>
      runtime_sources: []
      github_endpoints: []
      web_claims: []
      scope_digest: <sha256>
    
    RETROSPECTIVE_EVIDENCE_BUNDLE_V1:
      source_observations: []
      private_evidence_refs: []
      evidence_digests: []
      taint_labels: []
      collection_status: complete | partial | fatal
    
    RETROSPECTIVE_FINDING_SET_V1:
      findings:
        - finding_id: <stable-id>
          claim_class: <enum>
          evidence_refs: []
          confidence: <enum>
          delta_status: new | resolved | recurrent | regressed | unchanged
    
    RETROSPECTIVE_EVALUATION_V1:
      verdict: approve | revise | blocked
      accepted_finding_ids: []
      rejected_finding_ids: []
      blocking_reasons: []

    Webについては、web-researcher が検索した内容をそのまま evidence にしてはいけません。AgentはURL候補と検証対象claimを発見し、対象URLをChild 3のSSRF防御済みWeb collectorで再取得した後、そのdigest-bound projectionだけを解釈対象にする必要があります。

    同様に codebase-investigator はcurrent worktreeをauthorityにせず、base_sha のtree/blobに束縛された内容を入力とするか、結果をadvisoryに限定しなければなりません。現 Agent はAGY-onlyの調査経路を使用するため、base-SHA bindingを#2237側で明示しない限り、repository collectorのimmutable snapshotと異なる状態を解釈する可能性があります。


    P0-3 — delta evaluationとpublication handoffの所有者が存在しない

    Parent #2192 は、前回runとcandidate stateを読み、new / resolved / recurrent / regressed / unchanged を区別し、結果をproposal-onlyで扱うことを固定契約にしています。

    ところが、現在の永続schemaには次の制約があります。

    • agent_retrospective_run/v1 は run_identity と source_observations が中心で、finding setや個別evidence fingerprintを持たない

    • agent_improvement_candidate/v1 はcandidate lifecycleとproseを持つが、個別finding/evidence reference/baseline signal/expected signalを構造化していない

    • Child 3の private_evidence.evidence_digest はinvocation-privateであり、run schemaへ永続化されない

    • source_set_digest はsource observationのidempotency用であり、semantic no-change判定用のcontent digestではない

    この状態では、次回runが「前回と同一のfrictionか」「一度解消して再発したか」を機械的に判定する正本がありません。description の自然言語比較に任せると、stable delta evaluationになりません。

    さらに、Child 5の #2238 は #2237 完了を前提としながら、Skill/SubAgent変更をOut of Scopeにしています。Child 6の #2239も、schema/adapter/Skill/SubAgent/永続化実装の変更をOut of Scopeにしています。したがって、#2238で新設される永続化APIを最終orchestratorへ配線する責務も、security testで発見された実装修正を戻す責務も、現在のChild DAGには明示されていません。

    加えてADR 0007は、run commentの投稿を含む artifact-publication mutationにも事前の人間承認を要求し、自動投稿を禁止しています。

    推奨する責務分離は次です。

    #2237
      prepare_retrospective()
        → public-safe proposal
        → RETROSPECTIVE_PUBLISH_REQUEST_V1
        → mutationなし
    
    Human
      publish requestを明示承認
    
    #2238 controlled publisher
      authorizationを検証
        → Issue comment投稿
        → readback
        → idempotency / optimistic concurrency
    

    #2237 はpublish関数を直接呼ばず、Child 5がconsumeできるversioned handoff artifactを生成するべきです。

    delta evaluationについては、次のいずれかを#2237着手前に選ぶ必要があります。

    1. public-safeな finding_id/evidence fingerprintを新schemaとして永続化する
    2. candidate schemaを拡張する別Issueを起票する
    3. Child 5が管理するversioned finding indexを追加する

    現在のStop Conditionsではschema変更や新Issueが必要になった時点で停止するため、この判断を曖昧なまま実装に入るべきではありません。


    P0-4 — 現ACは安全性も動作も証明せず、指定テストはCI対象外

    現AC1〜6は、以下の実装をすべて合格させます。

    • SKILL.md にAgent名だけ書き、実際には呼び出さない
    • Agentの tools 自体を省略する
    • tools に Write/Edit/MultiEdit を含める
    • disallowedTools を定義しない
    • skills/memory/hooks/mcpServers を追加する
    • typed outputを持たない
    • maxTurns を持たず、終了条件を定義しない
    • Skillの name/description が欠ける
    • adapter、schema validator、digest計算を一度も呼ばない

    特にAC3〜5は Skill と Agent の不在しか確認しておらず、Outcomeで禁止している Write/Edit を検証していません。tools を省略したSubAgentは利用可能な全toolを継承するため、文字列不在テストではread-onlyを証明できません。公式仕様も tools をallowlist、disallowedTools を追加denylistとして扱います。([Claude]2)

    また、現行Claude CodeではSubAgent自身は別SubAgentをspawnできません。そのため「Agent がないこと=nested delegation禁止の静的証明」という説明は現行仕様と一致しません。Agent 不在は、定義を claude --agent 等でmain threadとして起動した場合へのdefense-in-depthとしては有効ですが、nested delegationの主証明ではありません。([Claude]2)

    Skillの name/description はAgent Skills仕様上の基本フィールドであり、リポジトリの既存validatorも両方を要求しています。しかし#2237のAC1は disable-model-invocation だけしか確認しません。 ([Agent Skills]3)

    さらに、#2237 が指定するテスト配置:

    .claude/skills/agent-retrospective/tests/test_subagent_tool_boundary.py
    

    はcurrent .github/ci/python-test-plan.json の対象外です。現planが収集するのは主に次です。

    .claude/agents/tests/
    .claude/skills/agent-retrospective/scripts/tests/
    

    これは推測ではなく、PR #2266 で同じ問題が既に発生しています。新規pytestがuncovered_changed_test_filesとしてCIをFAILさせ、.github/ci/python-test-plan.json のScope Delta追加が必要になりました。#2237のAllowed Pathsはこの修正を許可しておらず、Stop Conditionとも衝突します。

    推奨はテストを既存収集対象へ配置することです。

    .claude/agents/tests/test_agent_retrospective_boundaries.py
    .claude/skills/agent-retrospective/scripts/tests/test_run_retrospective.py
    

    これなら .github/ci/python-test-plan.json の変更を回避できます。


    P1 — 追加の重大問題

    P1-1 — Runtime Verification Applicability は not_applicable ではなく deferred

    リポジトリのruntime verification policyでは、プロセス起動、通信、I/Oが不要な変更だけが not_applicable です。後続Issueで統合動作を検証する場合は deferred とし、destinationと成立条件を明記する必要があります。

    #2237 は実際には以下を含みます。

    • Python collectorの起動
    • Agent起動
    • GitHub/Web経路
    • Claude Code/Claude-GPTランタイム
    • fan-out/fan-in
    • private evidenceの受け渡し

    したがって修正値は次です。

    Runtime Verification Applicability:
      decision: deferred
      deferred_destination:
        destination_type: issue
        destination_ref: "#2239"
      deferred_verification_condition: >-
        #2237 の hermetic orchestration test と #2238 の controlled
        persistence path がマージされ、Claude Code / Claude-GPT の両方で
        full prepare-only run を実行できること

    #2237内ではhermetic統合テストを実行し、fresh sessionのwith-skill/without-skill比較とlive smokeだけを#2239へdeferするのが妥当です。Claude公式もSkillのtrigger判定とoutput qualityを分離し、fresh sessionでSkill有無のbaselineを比較するよう案内しています。(Claude)


    P1-2 — 既存Agent再利用と「外部サービス利用時停止」が矛盾している

    web-researcher はAGYを先行経路とし、必要に応じてnative WebSearch/WebFetchを使用します。codebase-investigator はAGY-only経路で、direct fallbackを成功扱いしません。

    一方、#2237のStop Conditionsは「外部サービス利用が必要になった場合」に停止するとしています。必須再利用Agentを一度でも実行すると、文言上は即停止です。

    次のように限定すべきです。

    新規または未承認の provider、
    追加 credential scope、
    既存 capability matrix にない外部経路が必要になった場合に停止する
    

    capability matrixには少なくとも以下が必要です。

    • role
    • source authority/advisory区分
    • required/optional
    • input schema
    • output schema
    • exact tools
    • maxTurns
    • timeout/token budget
    • fallback route
    • partial/blocked/fatalへのstatus mapping
    • raw content access可否
    • public output可否
    • mutation capability

    rg -n "web-researcher" だけでは、このどれも検証できません。


    P1-3 — Agent tool boundaryをexact contractにする必要がある

    新規2 Agentには、単なる「Skill/Agentを含まない」ではなく、frontmatterの完全な期待値を固定すべきです。

    概念例:

    name: retrospective-runtime-observer
    tools:
      - Read
    disallowedTools:
      - Agent
      - Skill
      - Edit
      - Write
      - MultiEdit
    permissionMode: dontAsk
    maxTurns: 8

    追加条件:

    • tools の省略禁止
    • skills の省略または空配列
    • memory 禁止
    • hooks 禁止
    • mcpServers 禁止
    • Bashが不要なら与えない
    • output contract以外の自由形式最終出力を禁止
    • schema-invalid outputはrun-level partial ではなくAgent-stage failure
    • evaluatorはraw private evidenceをReadできない

    Skillの allowed-tools はツール制限ではなく事前承認の指定であり、hard security boundaryとして使えません。必要な禁止は disallowed-tools、leaf Agentのexact tools、実行可能スクリプトのmutation-free設計で重ねるべきです。([Claude]1)


    P1-4 — retry、budget、interruptionの契約がない

    長時間・複数source・複数Agentのworkflowで、次が未定義です。

    • Agentごとの maxTurns
    • sourceごとのtimeout
    • Web URL件数上限
    • GitHub endpoint/page上限
    • Agent出力再試行回数
    • schema-invalid出力の再試行可否
    • evaluatorのrevise loop上限
    • sourceの一部失敗時にrunを継続できる条件
    • programmer errorとoperational failureの違い
    • interrupted runのprivate artifact cleanup
    • deterministic fan-in順序
    • duplicate Agent resultの排除

    推奨値は「無制限」ではなく、各stageに固定budgetを持たせることです。correction loopも最大1〜2回に固定し、超過時は blocked として終了させるべきです。


    P1-5 — source_set_digest をsemantic deltaに流用してはいけない

    現在のvalidatorは source_set_digest をidempotency用途に限定し、optimistic concurrencyとは別物としています。fetch時刻などを含むsource observationが変われば、内容が同じでもdigestが変わり得ます。

    したがって、#2192が要求する unchanged/recurrent 判定には別のstable identityが必要です。

    推奨:

    finding_id:
      sha256(
        claim_class
        + normalized_affected_asset
        + normalized_failure_mode
        + stable_evidence_fingerprints
      )
    
    evidence_fingerprint:
      source_id
      + immutable_resource_identity
      + normalized_content_digest

    wall-clock、fetch順、Agent文面をfinding identityへ含めてはいけません。


    P1-6 — 下流のplugin配布Issue #2240は現行Claude Code plugin構造と一致しない

    #2240 はmanifestを次に置く契約です。

    .claude/skills/agent-retrospective/plugin/plugin.json
    

    しかし現行Claude Code pluginの標準構造は、plugin root直下の .claude-plugin/plugin.json と、その兄弟ディレクトリとして skills/、agents/ 等を置く構造です。project Skillを先に実装してpluginへ変換する方針自体は正しいものの、#2240のAllowed PathsではSkill、Agent、scriptsをplugin packageへ収録できません。 (Claude)

    概念的には次の構造が必要です。

    agent-retrospective-plugin/
    ├─ .claude-plugin/
    │  └─ plugin.json
    ├─ skills/
    │  └─ agent-retrospective/
    │     ├─ SKILL.md
    │     ├─ references/
    │     └─ scripts/
    └─ agents/
       ├─ retrospective-runtime-observer.md
       └─ retrospective-evaluator.md
    

    plugin testは claude --plugin-dir を用いて、namespaced Skillの起動、Agent discovery、scriptsの解決を確認する必要があります。([Claude]4)

    また、plugin由来SubAgentでは hooks、mcpServers、permissionMode が無視されます。したがって#2237段階から、安全性をこれらに依存させず、exact tool allowlist/denylistとproposal-only executable boundaryで成立させる必要があります。([Claude]2)


    修正後の推奨実装契約

    orchestration_contract:
      invocation:
        trigger: explicit_user_request
        automatic_invocation: forbidden
        mode: prepare_only
    
      repository_binding:
        resolve_base_sha_once: true
        agents_may_reresolve_main: false
    
      pipeline:
        - preflight
        - source_plan
        - deterministic_collection
        - isolated_observer_wave
        - deterministic_fan_in
        - fresh_context_evaluation
        - proposal_render
    
      typed_handoffs:
        source_plan: retrospective_source_plan/v1
        evidence_bundle: retrospective_evidence_bundle/v1
        finding_set: retrospective_finding_set/v1
        evaluation: retrospective_evaluation/v1
        publish_request: retrospective_publish_request/v1
    
      mutation:
        default: forbidden
        artifact_publication_requires_human_authorization: true
        remediation_requires_human_authorization: true
        publisher_owner: "#2238"
    
      evidence:
        raw_untrusted_to_evaluator: forbidden
        public_artifact_allowlist_only: true
        evidence_digest_required: true
        stable_finding_id_required: true
    
      failure_policy:
        typed_operational_source_failure: source_partial_or_unavailable
        schema_or_programmer_error: run_fatal
        agent_output_invalid: stage_failed
        evaluator_revision_limit: 1
    
      runtime_verification:
        decision: deferred
        destination: "#2239"

    推奨 Allowed Paths

    .claude/skills/agent-retrospective/SKILL.md
    .claude/skills/agent-retrospective/references/**
    .claude/skills/agent-retrospective/scripts/run_retrospective.py
    .claude/skills/agent-retrospective/scripts/tests/test_run_retrospective.py
    .claude/agents/retrospective-runtime-observer.md
    .claude/agents/retrospective-evaluator.md
    .claude/agents/tests/test_agent_retrospective_boundaries.py
    

    新しい永続schemaが必要と判断した場合は、既存schemaを#2237で暗黙拡張せず、別Issueまたは明示的Scope Deltaに分けるべきです。


    最低限追加すべきAcceptance Criteria

    1. SKILL.md が name、description、disable-model-invocation: true を持ち、既存skill validatorを通過する。

    2. run_retrospective.py がversioned input contractを持ち、base_sha を一度だけ解決する。

    3. 5 source adapterへ必要な引数を明示的に束縛し、各sourceの独立statusを保持する。

    4. source_observations、source_set_digest、run_identity を組み立て、validate_run() を通過させる。

    5. private evidenceを公開stdout、Issue comment、evaluator raw contextへ流さず、digest付きprivate referenceとして扱う。

    6. web-researcher が発見したURLをSSRF防御済みWeb collectorで再取得してからevidence化する。

    7. repository/codebase findingが固定 base_sha またはblob SHAへ束縛される。

    8. 新規2 Agentがexact tool allowlist、denylist、maxTurns、typed outputを持ち、Write/Edit/MultiEdit/Skill/Agent/memoryを持たない。

    9. observer wave完了後にのみevaluatorを起動し、evaluatorがraw untrusted payloadを受け取らない。

    10. stable finding_id とpublic-safe evidence fingerprintにより、new / resolved / recurrent / regressed / unchanged をfixture上で判定できる。

    11. run結果はproposalとpublish requestの生成までに限定し、GitHub/repo mutationを行わない。

    12. complete、partial、unavailable、blocked、programmer error、malicious input、schema-invalid Agent output、interrupted run、no-changeのhermetic integration fixtureを持つ。

    13. test fileがcurrent Python test planの既存target下に配置され、uncovered_changed_test_files を発生させない。

    14. live dual-runtime verificationを#2239へ deferred として明記する。


    関連Issueへ必要な同期

    #2192

    Child 1〜3が既にマージ済みであるのに、parent checklistとRemaining Parent Gapsが未完了のままです。#2237 refinementと同時に現在状態へ同期しないと、rollup consumerが誤ったdependency statusを読む可能性があります。

    #2238

    次を追加すべきです。

    • #2237の RETROSPECTIVE_PUBLISH_REQUEST_V1 をconsumeする
    • explicit human authorizationを必須入力にする
    • authorizationなしのIssue comment投稿を拒否する
    • stable finding/candidate stateを次回runへ返すread APIを持つ
    • Skillを直接編集せずに成立する明示的portを固定する

    #2239

    decision: immediate に対するruntime verification ACタグと、SKIP 77/fallback FAIL/証跡要件を現在のpolicyへ同期する必要があります。現本文のAC5・AC6はlive smokeですが、policyが要求するruntime-verification tagがありません。

    また、security/evalが問題を発見した場合のroutingを明示し、単にOut of Scopeとして終了しないようにします。

    #2240

    manifest path、package layout、Skill/Agent/scriptsの収録範囲、--plugin-dir smoke、plugin下で無効になるpermission関連fieldへの非依存を全面的に再定義する必要があります。


    推奨アクション

    #2237の実装は開始せず、current main 908b48f7ba5347b75e61e1d931971a6a043eb88d を基準に issue-refinement-loop で本文を再構成するべきです。

    実装着手の最終ゲートは次の4点です。

    1. executable run builderとtyped handoffがIn Scopeになっている
    2. ADR 0007のtaint/isolation/proposal-only境界がAC化されている
    3. delta stateとChild 5 publicationのhandoff ownerが確定している
    4. 新規pytestがcurrent CI targetに収録されている

    現状の判定は REQUEST_CHANGES / implementation_readiness: blocked / reframe_in_place が妥当です。

  3. squne121 commented on Aug 21, 2026

    @squne121
    OwnerAuthor

    issue-refinement-loop 実行結果(2026-08-21)

    対象コメント: #2237 (comment)

    実施した修正

    review-issue の deterministic checker(root_review_pipeline.py)が VERDICT: needs-fix / blockers: 2 を検出しました(VCP_MISSING_BASELINE_EXP:新規 Allowed Path ファイルを対象にした VC に # baseline-expect: fail アノテーションが欠落)。この機械的な指摘を issue-editor 経由で修正しました(AC1/AC6 の VC ブロック直前へ1行ずつ挿入、他セクションは無変更)。

    修正後の再レビューは VERDICT: approve(BLOCKERS: 0)です。body_sha256: sha256:7a1d5a42d9f08d81d90ada5c97cdc89c1fb9bb9f5f97d93bcf1086e780a6b4fa。

    human_escalation で停止する理由

    対象コメントは OWNER による詳細な技術レビュー(REQUEST_CHANGES, implementation_readiness: blocked, recommended_disposition: reframe_in_place)で、以下の scope 拡張を要求しています。

    • P0-1: scripts/run_retrospective.py(または同等の stable entrypoint)を Allowed Paths へ新規追加する実行可能な orchestration layer
    • P0-2: ADR 0007 trust boundary を実装する typed handoff contract(RETROSPECTIVE_SOURCE_PLAN_V1 等の新規 schema)
    • P0-3: delta evaluation / publication handoff の所有者を決める(新スキーマ永続化・candidate schema 拡張・Child 5 index のいずれかを選択する必要があり、選択によっては新規 Issue 起票が必要)
    • P0-4: AC/VC・テスト配置の見直し(.claude/agents/tests/ 等既存 CI 収集対象への再配置)
    • P1-1: Runtime Verification Applicability を not_applicable から deferred へ修正
    • P1-2: Stop Conditions と既存 Agent 再利用方針の矛盾解消

    issue-refinement-loop の scope_signal_guard_decision_v2.scope_delta_authority 判定(classify_scope_delta_authority())は、このコメントを boundary_flags: {expands_allowed_paths: true, changes_external_service_boundary: true} と分類し、route.action: human_escalation(implementation_allowed: false)を返しました。このコメントは構造化された ANCHOR_SCOPE_REFRAME_V1 payload ではなく自由記述の技術レビューであるため、scope_delta_decision.status も not_applicable(reason: no_anchor_scope_reframe_v1_payload)のままです。

    これは skill 設計上の hard stop(references/scope-signal-guard.md の trusted anchor 承認フロー、references/anchor-comment-handling.md の human_escalation 経路)であり、この loop はここを自律的に飛び越えません。

    必要な人間判断(次のアクション)

    以下のいずれかを OWNER が選択・実行してください。

    1. Allowed Paths 拡張を明示承認する: references/scope-signal-guard.md の ANCHOR_SCOPE_REFRAME_V1 テンプレートで、承認する具体的な新規 Allowed Path(例: scripts/run_retrospective.py, 新規 schema ファイル群)を列挙したコメントを投稿する。
    2. スコープを分割する: レビューが提示した delta evaluation 所有権の3択(新schema永続化 / candidate schema拡張 / Child 5 versioned index)のいずれかを選び、必要なら follow-up Issue を起票してから 実装: agent-retrospective の Orchestrator Skill と retrospective-runtime-observer・retrospective-evaluator SubAgent を実装する #2237 の本文を reframe する。
    3. 現状スコープのまま進める(レビューを却下する)場合も、その判断根拠を明示した上で issue-refinement-loop を再実行する。

    いずれの場合も、決定後は本 loop(issue-refinement-loop)を再実行し、fresh preflight → review → readiness を経てから実装着手してください。

    収束状態

    機械的ブロッカーは解消(収束)。人間判断が必要な scope 拡張要求が残るため、human_escalation として本イテレーションを終了します。

  4. squne121 commented on Aug 21, 2026

    @squne121
    OwnerAuthor

    推奨は、提示された3択では 「2. candidate schema 拡張を follow-up Issue に分離」 です。そのうえで #2237 は reframe_in_place し、#2238/#2239 も契約整合だけ追随修正するのが最も一貫します。

    理由は、ADR 0007 が run/candidate の一次状態を agent_retrospective_run/v1 と agent_improvement_candidate/v1 の2 schema に限定し、agent_retro_index/v1 を derived index と明示しているためです。したがって「3. Child 5 の finding index を正本にする」は ADR と正面衝突します。新しい第3 schema を追加する「1」も、ADR・Parent #2192 の再設計まで波及します。既存 candidate schema は既に stable candidate_id と lifecycle を一次状態として持つため、stable finding identity・public-safe evidence fingerprint/reference・delta 判定に必要な履歴情報を additive に追加する方が変更範囲を抑えられます。

    ただし、アンカーコメントの P0-4 の一部は訂正してから採用すべきです。2026年8月21日時点の Claude Code 公式仕様では、subagent は既定で main より下に最大3階層まで別 subagent を spawn できます。つまり「Claude Code 自体が nested delegation 不可なので Agent 不在は defense-in-depth にすぎない」というレビュー記述は現在は逆で、Agent を tools から除外する/disallowedTools に指定することが実効的な nested-delegation 制約です。さらに tools 省略時は利用可能 tool を継承するため、明示 allowlist が必要です。 ([code.claude.com]1) ([Claude]1)

    また disable-model-invocation: true を維持する判断は現在の Claude Code 仕様とも合っています。Skill の name / description は Agent Skills 仕様でも必須です。 ([Claude]2) ([Agent Skills]3)

    実行順は、schema follow-up Issue 作成・refine → #2237 の構造化 scope 承認を materialize → #2237 reframe/refinement → #2238/#2239 の契約同期を推奨します。レビューを却下して現行 #2237 を進める案は採りません。なお ANCHOR_SCOPE_REFRAME_V1 自体も implementation go ではなく、承認後に contract review / preflight / Allowed Paths gate の fresh rerun が必須です。

    以下は、その判断を織り込んだ Claude Code 用プロンプトです。

    Issue #2237 の human_escalation を、OWNER decision を materialize して解消する

    対象 repository:

    https://github.com/squne121/loop-protocol

    主対象:

    関連:

    OWNER decision

    このプロンプトを interactive human instruction として受領したことを前提に、以下を OWNER decision として扱う。

    1. 実装: agent-retrospective の Orchestrator Skill と retrospective-runtime-observer・retrospective-evaluator SubAgent を実装する #2237 の OWNER REQUEST_CHANGES は却下しない。
    2. disposition は reframe_in_place を採用する。
    3. P0-1 / P0-2 / P0-3 / P1 系の指摘は原則採用する。
    4. delta-evaluation ownership の3案では 「candidate schema を additive に拡張する follow-up Issue を分離する案」 を採用する。
    5. agent_retro_index/v1 を finding/delta state の正本にはしない。
    6. 新しい第三の persistent state schema は原則追加しない。
    7. 実装: agent-retrospective の Orchestrator Skill と retrospective-runtime-observer・retrospective-evaluator SubAgent を実装する #2237 の orchestrator は publication mutation を行わず、public-safe な publish request / proposal artifact を生成するところまでとする。
    8. publication mutation は 実装: agent-retrospective の run 永続化と agent_retro_index/v1 統合を実装する #2238 側で human authorization を検証してから実行する。
    9. 実装: agent-retrospective の Orchestrator Skill と retrospective-runtime-observer・retrospective-evaluator SubAgent を実装する #2237 anchor review の「Claude Code の SubAgent は nested SubAgent を spawn できない」という前提は現在の公式仕様と一致しないため、その部分は訂正する。
    10. 現行 Claude Code では nested subagent が既定で可能なので、retrospective leaf SubAgent は Agent を明示的に利用不可とする。Skill / Write / Edit 等についても必要最小限の明示 allowlist/deny を用いる。
    11. この OWNER decision の範囲内の Issue 作成、Issue 本文更新、scope anchor comment 投稿、関連 Issue の整合修正について追加の人間承認を要求しない。
    12. ただし、ここで承認していない destructive operation、permission escalation、外部有料サービス、新たな独立 architecture boundary が発見された場合は既存 hard-stop を迂回しない。

    最重要: SubAgent を使用すること

    main thread だけで事実認定しないこと。

    最初に少なくとも以下を並行起動する。

    A. codebase-investigator

    read-only で以下を調査する。

    特に、#2237 に追加すべき exact repository-relative Allowed Paths を current main から確定すること。

    B. web-researcher

    必ず最新の一次資料を調査する。

    最低限:

    • Claude Code official docs — custom subagents
    • Claude Code official docs — Skills
    • Agent Skills specification

    確認対象:

    • current nested subagent semantics
    • tools
    • disallowedTools
    • Agent
    • Skill
    • Write
    • Edit
    • maxTurns
    • skills
    • memory
    • hooks
    • mcpServers
    • disable-model-invocation
    • Skill name / description
    • executable scripts/ を Skill に配置することの仕様上の妥当性

    古い Claude Code 仕様を前提にしないこと。

    両 SubAgent の完了を必ず待つこと。

    main thread は両方の結果を受領し、矛盾を解消してから GitHub mutation に進むこと。


    Phase 1 — delta evaluation schema follow-up Issue

    採用する設計

    新しい第三の persistent finding schema や agent_retro_index/v1 state store は作らない。

    既存:

    agent_improvement_candidate/v1

    を additive に拡張し、少なくとも次を machine-readable に表現できる契約を設計する。

    • stable finding identity
    • claim class
    • public-safe evidence reference / evidence fingerprint
    • baseline signal
    • expected signal
    • 過去 run との対応を追跡可能な occurrence/history 情報
    • new
    • resolved
    • recurrent
    • regressed
    • unchanged

    ただし delta_status と candidate_status を混同しないこと。

    candidate_status は既存 lifecycle:

    proposed / accepted / implementation_issue_created / implemented / validating / validated / rejected / superseded

    のまま維持する。

    delta_status は retrospective run ごとに算出される observation/delta classification として扱う。

    follow-up Issue を起票する

    #2235 の schema 実装に対する follow-up Issue を新規起票する。

    タイトル案:

    実装: agent-retrospective candidate schema に stable finding identity と delta evaluation contract を追加する

    ただし repository の Issue template / parent-child contract / dedupe convention を調べ、適切なら表現を修正してよい。

    Issue には最低限以下を含める。

    必要なら #2235 本文自体は historical contract として不用意に書き換えず、follow-up Issue 側から参照する。

    新規 Issue 作成後、issue-refinement-loop をその Issue に対して実行する。

    機械修正・review iteration は人間承認不要で継続する。

    SubAgent を起動した場合は、必ず完了を待ってから次工程へ進む。


    Phase 2 — #2237 の OWNER scope decision materialization

    #2237 の current human_escalation は skill boundary を迂回しない。

    代わりに、この interactive OWNER instruction を repository の accepted trust model に従って materialize する。

    scope-signal-guard.md /
    anchor-comment-handling.md
    の現行契約を確認したうえで、必要なら次の provenance marker を使用する。

    OWNER_DIRECTIVE_MATERIALIZED_FROM_INTERACTIVE_PROMPT_V1

    そのうえで #2237 に top-level の canonical YAML fence として
    ANCHOR_SCOPE_REFRAME_V1
    を投稿する。

    allowed_path_deltas には codebase-investigator が current main で確認した exact path literal のみを列挙する。

    最低限候補:

    • .claude/skills/agent-retrospective/scripts/run_retrospective.py
    • .claude/skills/agent-retrospective/scripts/tests/test_run_retrospective.py
    • .claude/agents/tests/<CI収集対象となるretrospective boundary test>

    ただし実在する CI collection contract を調べ、最終 path は current main に基づき決定する。

    架空 path を作らない。

    required_rerun は少なくとも:

    • contract_review
    • refinement_preflight
    • allowed_paths_gate

    を含める。

    この comment を generated agent report lane として扱ってはならない。

    repository の Accepted Trust Model が要求する場合、
    今回の interactive human instruction を provenance とする
    with_human_context
    lane に明示的に投入する。

    ANCHOR_SCOPE_REFRAME_V1 自体を implementation go と解釈しない。


    Phase 3 — #2237 を reframe in place

    その structured OWNER decision を anchor/human context として issue-refinement-loop を再実行する。

    #2237 を以下の設計へ収束させる。

    3.1 executable orchestrator

    SKILL.md の prose だけで orchestration を実行しない。

    stable executable entrypoint を持たせる。

    原則:

    .claude/skills/agent-retrospective/scripts/run_retrospective.py

    責務:

    • manual trigger preflight
    • base_sha の一度だけの固定
    • source plan 構築
    • 5 collector の引数束縛
    • deterministic collection
    • source observation assembly
    • digest validation
    • private evidence isolation
    • observer input projection
    • observer wave
    • deterministic validation/fan-in
    • conflict classification
    • evaluator input projection
    • fresh evaluator invocation
    • proposal artifact generation
    • publish request generation

    mutation はしない。

    3.2 typed handoff

    少なくとも概念的に以下を固定する。

    • source plan
    • evidence bundle
    • finding set
    • evaluation
    • publish request

    Python dataclass / TypedDict / schema-controlled structure等、repository convention に最も合う方式を選ぶ。

    ただし新しい persistent state schema を安易に作らない。

    raw GitHub/Web/log/stdout を evaluator に直接渡さない。

    必ず:

    deterministic collection
    → provenance/taint
    → isolated observation
    → schema-controlled projection
    → evaluator

    の順序にする。

    3.3 delegation topology

    単純な全Agent同時 fan-out にしない。

    以下の二段階 topology とする。

    Human explicit invocation
    → main orchestrator
    → deterministic collectors
    → observer wave
    → deterministic fan-in / validation / conflict classification
    → fresh-context evaluator
    → proposal-only output

    observer wave:

    • retrospective-runtime-observer
    • codebase-investigator
    • web-researcher

    evaluator は observer と同時起動しない。

    observer 完了を待ち、validated projection のみ受け取ってから起動する。

    3.4 current Claude Code nested-agent semantics を反映

    古い前提:

    「SubAgent 自身は SubAgent を spawn できない」

    を採用しない。

    current official docs を正本として扱う。

    retrospective-runtime-observer /
    retrospective-evaluator は leaf として明示的に制約する。

    最低限:

    • name 必須
    • description 必須
    • tools を省略しない
    • required read-only tools の explicit allowlist
    • Agent 使用不可
    • Skill 使用不可
    • Write 使用不可
    • Edit 使用不可
    • NotebookEdit 等 write-capable tool も必要に応じ deny
      -不要な mcpServers 禁止
    • 不要な hooks 禁止
    • 不要な memory 禁止
    • bounded maxTurns
    • malformed output fail-closed

    Agent 不在テストを
    「現行 Claude Code では nested delegation がそもそも不可能だから」
    という理由にしない。

    現行では nested delegation が可能なので、
    leaf boundary を明示的に enforcement するため
    と説明する。

    3.5 tests / CI

    .claude/skills/agent-retrospective/tests/
    が current CI collection 対象外なら使用しない。

    既存 CI plan に入る exact location へ配置する。

    候補:

    • .claude/agents/tests/
    • .claude/skills/agent-retrospective/scripts/tests/

    Acceptance Criteria は単なる rg に依存しない。

    最低限テストする:

    • stable entrypoint が実際に collector/validator を呼ぶ
    • base SHA が run 中に変化しない
    • raw evidence が evaluator input に入らない
    • taint/provenance が保持される
    • evaluator が observer 完了前に起動されない
    • malformed observer/evaluator output fail-closed
    • correction loop が bounded
    • Agent/Skill/Write/Edit boundary
    • Skill required frontmatter
    • disable-model-invocation: true
    • proposal-only
    • publish request に mutation authority が含まれない
    • integration fixture

    3.6 Runtime Verification Applicability

    現状の:

    not_applicable

    を維持しない。

    current runtime-verification-policy を確認し、
    実装本体の live smoke が Child 6 の責務なら原則:

    deferred

    へ変更する。

    #2237 内では hermetic integration verification を実施し、
    dual-runtime live smoke は #2239 に明示的に handoff する。

    3.7 dependency

    Phase 1 で新設した candidate-schema follow-up Issue を #2237 の dependency / prerequisite として明記する。

    schema contract が未確定のまま implementation ready にしない。


    Phase 4 — #2238 を同期

    #2238 を調査し、#2237 の新契約との不整合を修正する。

    最低限:

    ADR 0007 の
    artifact-publication mutation requires prior human authorization
    を上書きしない。

    Allowed Paths 拡張が必要なら、#2238 についても同じ trusted scope-delta 手順を踏む。

    skill boundary を迂回しない。


    Phase 5 — #2239 を同期

    #2239 の security/eval/live-smoke Issue も確認する。

    特に:

    • current CI に収集されない test path を残さない
    • injection resistance
    • raw-evidence isolation
    • nested Agent denial
    • Skill/write boundary
    • malformed typed handoff
    • evaluator ordering
    • proposal-only / unauthorized publication
    • candidate delta five-state fixtures
    • Claude Code / Claude-GPT live smoke

    を検証対象として明示する。

    必要なら #2239 本文を reframe/refine する。

    Allowed Paths の新規 architecture layer が必要なら、
    #2239 にも正式 scope-delta authority を materialize してから
    issue-refinement-loop を実行する。


    Phase 6 — fresh refinement

    最終的に少なくとも以下を fresh に再実行する。

    1. schema follow-up Issue の issue-refinement-loop
    2. 実装: agent-retrospective の Orchestrator Skill と retrospective-runtime-observer・retrospective-evaluator SubAgent を実装する #2237 の issue-refinement-loop
    3. 実装: agent-retrospective の run 永続化と agent_retro_index/v1 統合を実装する #2238/検証: agent-retrospective のsecurity boundary・evaluation・dual-runtime smokeを統合検証する #2239 は本文変更した場合、それぞれ issue-refinement-loop

    各 loop では:

    • fresh preflight
    • contract review
    • codebase investigation
    • 必要な web fact check
    • issue-editor
    • review
    • allowed paths gate
    • readiness

    を省略しない。

    「前回 approve だったから」という理由で review を再利用しない。

    SubAgent は必ず作業完了を待ってから main thread が synthesis / mutation する。


    禁止事項

    • human_escalation を force flag 等で無視しない
    • scope_delta_decision.status=not_applicable のまま implementation に進まない
    • generated agent comment を勝手に human-authored と推定しない
    • agent_retro_index/v1 を finding state の正本にしない
    • 第三の persistent schema を無断で追加しない
    • raw GitHub body/comment/Web/log/stdout を evaluator へ渡さない
    • evaluator を observer wave と同時起動しない
    • SKILL.md 内で ad-hoc Python/Bash orchestration を組み立てない
    • CI 非収集 path に safety test を置いて完了扱いしない
    • schema follow-up 未確定のまま 実装: agent-retrospective の Orchestrator Skill と retrospective-runtime-observer・retrospective-evaluator SubAgent を実装する #2237 を implementation-ready にしない
    • implementation を開始しない

    今回の目的は Issue graph と refinement contract を implementation-ready な形まで修復することであり、コード実装は別工程とする。


    終了条件

    次の状態まで進める。

    最後に GitHub へ終了報告を投稿し、以下をまとめる。

    • 作成した follow-up Issue
    • 更新した Issue
    • scope decision comment URL
    • 各 refinement loop の verdict
    • unresolved blockers
    • implementation dependency order
    • 次に実行すべき具体的 action

    追加の人間承認は、このプロンプトで明示されている decision/mutation については要求しない。

    この構成なら、human_escalation を迂回するのではなく、停止理由になった設計判断を control-plane 側で先に確定し、その結果を skill が認識できる trusted input に変換してから再実行できます。#2237 を無理に一枚へ詰め込まず、同時に Parent/ADR の「2 schema + derived index」という既存設計も維持できます。

  5. squne121 commented on Aug 21, 2026

    @squne121
    OwnerAuthor

    OWNER decision materialization(OWNER_DIRECTIVE_MATERIALIZED_FROM_INTERACTIVE_PROMPT_V1)

    このコメントは generated agent report ではない。root control-plane が受領した interactive human instruction(OWNER によるチャット指示、2026-08-22)を、scope-signal-guard.md / anchor-comment-handling.md が定義する Accepted Trust Model の with_human_context lane に沿って materialize したものである。provenance marker: OWNER_DIRECTIVE_MATERIALIZED_FROM_INTERACTIVE_PROMPT_V1。

    次回このコメント URL を用いて issue-refinement-loop / run_refinement_preflight.py を実行する際は、with_human_context lane(human_context_comment_urls)にこの comment URL を明示投入すること。with_agent_report / unlabeled lane に置いてはならない(置いた場合 source_kind: generated_by_agent に解決され scope mutation authority を得ない)。

    この marker はそれ自体で implementation go を意味しない。承認後も contract_review / refinement_preflight / allowed_paths_gate の fresh rerun が必須である。

    対象指摘(anchor review 要約)

    Allowed Path delta の根拠(codebase-investigator による current main 実在確認)

    • .claude/skills/agent-retrospective/scripts/ は実在(collect_snapshot.py, tests/, validate_retrospective_schema.py を含む)。run_retrospective.py は不在(新規追加対象)。
    • .claude/skills/agent-retrospective/scripts/tests/ は実在し test_collect_snapshot.py / test_validate_retrospective_schema.py を含む。.github/ci/python-test-plan.json line 28 でディレクトリ単位の CI collection target として登録済み(Issue 実装: python-test-plan に edit-issue tests directory coverage を追加する #1303 directory-target convention)。
    • 現行 実装: agent-retrospective の Orchestrator Skill と retrospective-runtime-observer・retrospective-evaluator SubAgent を実装する #2237 Allowed Paths にある .claude/skills/agent-retrospective/tests/test_subagent_tool_boundary.py(scripts/ を含まないパス)は python-test-plan.json のどの target にも一致せず、CI 非収集のまま安全性テストが放置される欠陥パスである。正しい CI 収集対象は .claude/agents/tests/(python-test-plan.json line 5 でディレクトリ単位登録済み、既存 test_issue_editor_runtime_smoke.py 等の SubAgent 関連テストの実例あり)である。
    • .claude/agents/retrospective-runtime-observer.md / .claude/agents/retrospective-evaluator.md は既存 Allowed Paths のまま変更しない(新規追加不要、既に承認済み)。
    schema_version: ANCHOR_SCOPE_REFRAME_V1
    target:
      repo: squne121/loop-protocol
      issue_number: 2237
    decision: approve_scope_delta
    allowed_path_deltas:
      - ".claude/skills/agent-retrospective/scripts/run_retrospective.py"
      - ".claude/skills/agent-retrospective/scripts/tests/test_run_retrospective.py"
      - ".claude/agents/tests/test_retrospective_subagent_boundary.py"
    rationale: "P0-1(executable orchestration contract欠落)への対処として、SKILL.mdのprose配線だけでなくstable executable entrypoint(run_retrospective.py)とそのpytestカバレッジを追加する。既存Allowed Pathsのtest_subagent_tool_boundary.pyはCI収集対象ディレクトリ(python-test-plan.json)に一致しないため、CI収集対象である.claude/agents/tests/配下の正しいpathに置き換える。新しいpersistent state schemaやagent_retro_index/v1をfinding正本にはしない。"
    required_rerun:
      - contract_review
      - refinement_preflight
      - allowed_paths_gate

    次アクション

    1. 上記 allowed_path_deltas を Issue 実装: agent-retrospective の Orchestrator Skill と retrospective-runtime-observer・retrospective-evaluator SubAgent を実装する #2237 の ## Allowed Paths セクションへ additive に反映し、.claude/skills/agent-retrospective/tests/test_subagent_tool_boundary.py は .claude/agents/tests/test_retrospective_subagent_boundary.py に置き換える(AC3〜AC5 の VC もこの新パスを参照するよう更新)。
    2. ## Runtime Verification Applicability を not_applicable から deferred(destination: 検証: agent-retrospective のsecurity boundary・evaluation・dual-runtime smokeを統合検証する #2239)へ更新する。
    3. run_retrospective.py の責務(manual trigger preflight / base_sha 一度だけ固定 / typed handoff / private evidence 隔離 / observer→evaluator の二段階 topology / proposal-only 出力)を Outcome / In Scope / Acceptance Criteria に反映する。
    4. Phase 1 で新設した delta-evaluation schema follow-up Issue(実装: agent-retrospective candidate schema に stable finding identity と delta evaluation contract を追加する #2288)を dependency として明記する。
    5. 反映後、fresh contract_review / refinement_preflight / allowed_paths_gate を実行して readiness を再確認する。

    この comment 自体は scope 拡張の承認のみを行うものであり、実装開始の go を意味しない。

  6. squne121 commented on Aug 21, 2026

    @squne121
    OwnerAuthor

    issue-refinement-loop 終了報告(#2237)

    Review Verdict: approve(BLOCKERS: 0) — fresh review が収束しました。

    実施内容

    1. Step 0f preflight(run_refinement_preflight.py): STATUS: pass / NEXT_ACTION: proceed(blockers なし)。
    2. Step 2 review(run_root_review_pipeline.py produce): 初回実行で VERDICT: approve / BLOCKERS: 0(deterministic checks C1〜C13 すべて pass or n/a)。
    3. Final Gate 確認(issue-contract-review/scripts/run_contract_review_once.py)で機械的な不整合を検出:
    4. 修正後、fresh preflight → fresh Step 2 review を再実行し、VERDICT: approve / BLOCKERS: 0 を再確認(reviewed body sha256 は修正後の body と一致)。
    5. Final Gate を再実行した結果、native dependency の不一致は解消したが、実装: agent-retrospective candidate schema に stable finding identity と delta evaluation contract を追加する #2288 が引き続き OPEN(実装: agent-retrospective の agent_retrospective_run/v1・agent_improvement_candidate/v1 schema と validator を実装する #2235・実装: agent-retrospective に Claude Code・Claude-GPT・repository・GitHub・Web の deterministic source adapter を実装する #2236 は CLOSED 済み)であることを確認。check_blockers.sh が human_escalation: blocker が open です。着手不可。open blocker: #2288 (state=OPEN) を返し、CONTRACT_REVIEW_ONCE_RESULT_V1.status: blocked となる。

    現状

    結論

    review verdict は approve / blocker 0 で収束しました。ただし impl-review-loop への handoff(Final Gate status: go)は #2288 のマージ待ちのため保留です。#2288 がマージされ次第、issue-contract-review(run_contract_review_once.py)を再実行して status: go を確認してください。

    LOOP_HANDOFF_RESULT_V1:
      status: blocked
      routing_action: blocked
      contract_review:
        status: blocked
        gate_result: blocked
        latest_comment_url: null
        generated_at: "2026-08-21T15:44:36Z"
        body_sha256: "sha256:41b2cf9103086c326e19b580db83bfa5862f5b52960a1d6cdbd1bd7ac5aa7b95"
      metadata:
        title_prefix_ready: true
      blockers:
        - code: open_dependency
          detail: "#2288 (state=OPEN) is a declared prerequisite and is not yet closed"
  7. squne121 commented on Aug 21, 2026

    @squne121
    OwnerAuthor

    終了報告: #2237 human_escalation の OWNER decision materialization 完了

    interactive human instruction(2026-08-22付 OWNER decision)に基づき、#2237 の human_escalation を machine-executable な状態まで解消しました。

    作成した follow-up Issue

    更新した Issue

    scope decision comment

    未解決 blocker(すべて具体的Issue番号で表現される temporal dependency)

    implementation dependency order

    1. 実装: agent-retrospective candidate schema に stable finding identity と delta evaluation contract を追加する #2288(delta-evaluation schema 拡張契約)
    2. 実装: agent-retrospective の Orchestrator Skill と retrospective-runtime-observer・retrospective-evaluator SubAgent を実装する #2237(Child 4: Orchestrator Skill・SubAgent定義)— 実装: agent-retrospective candidate schema に stable finding identity と delta evaluation contract を追加する #2288 マージ後
    3. 実装: agent-retrospective の run 永続化と agent_retro_index/v1 統合を実装する #2238(Child 5: 永続化)— 実装: agent-retrospective の Orchestrator Skill と retrospective-runtime-observer・retrospective-evaluator SubAgent を実装する #2237 マージ後
    4. 検証: agent-retrospective のsecurity boundary・evaluation・dual-runtime smokeを統合検証する #2239(Child 6: security/eval/live smoke)— 実装: agent-retrospective の run 永続化と agent_retro_index/v1 統合を実装する #2238 マージ後

    次に実行すべき具体的 action

    1. issue-contract-review を 実装: agent-retrospective candidate schema に stable finding identity と delta evaluation contract を追加する #2288 に対して実行し status: go を確認、impl-review-loop / implement-issue へハンドオフしてマージする
    2. 実装: agent-retrospective candidate schema に stable finding identity と delta evaluation contract を追加する #2288 マージ後、実装: agent-retrospective の Orchestrator Skill と retrospective-runtime-observer・retrospective-evaluator SubAgent を実装する #2237 に対して issue-contract-review を再実行し status: go を確認、実装フェーズへ進む
    3. 以降 実装: agent-retrospective の run 永続化と agent_retro_index/v1 統合を実装する #2238 → 検証: agent-retrospective のsecurity boundary・evaluation・dual-runtime smokeを統合検証する #2239 の順で同様に進める

    コード実装は本 loop の範囲外であり、着手していません。

  8. squne121 commented on Aug 22, 2026

    @squne121
    OwnerAuthor

    結論

    verdict: REQUEST_CHANGES
    implementation_readiness: blocked
    recommended_disposition: reframe_in_place
    implementation_start: HOLD
    reviewed_snapshot:
      main_sha: 1fb91c361900aec79b3c50c83be21980a6e39dd6
      issue_state: open
      prerequisite_2288: resolved
    blocking_findings:
      P0: 5
    additional_findings:
      P1: 4

    #2237 は前回レビュー後にかなり改善されています。実行可能な run_retrospective.py、observer/evaluator の二段階構造、typed handoff、leaf Agent 制約まで本文へ取り込まれています。一方で、現在の契約のままではfake-runtime のテストを通しながら、実際には Agent を起動できない実装、前回状態を読めず delta を算出できない実装、委譲 Agent 経由で mutation・snapshot drift を起こす実装が AC 達成扱いになり得ます。

    また、#2288 は PR #2289 により 2026年8月22日に main へマージ済みです。したがって「#2288 未マージ」はもはや blocker ではありません。現在の #2237 本文と updated_at はこのマージ以前の状態なので、prerequisite 表示と fresh contract/preflight を更新する必要があります。

    解消済みと判定する点

    前回の「Claude Code の SubAgent は nested SubAgent を起動できない」という前提は、現行仕様では成立しません。現在は既定で最大3階層まで nested spawn が可能であり、leaf 化には Agent を tools から除外するか disallowedTools へ入れる方法が公式に案内されています。#2237 の現在の記述はこの仕様と整合しています。(Claude)

    また、次の点も修正済みです。

    • prose だけでなく stable executable entrypoint が In Scope / Allowed Paths に入った。

    • observer wave 完了後に fresh evaluator を起動する二段階 topology が明示された。

    • Agent boundary test が CI 収集対象の .claude/agents/tests/ に移された。

    • raw evidence → observer → validated projection → evaluator という方向性が本文に入った。

    以下は、その再構成後にも残る blocker です。


    P0-1 — Orchestrator の所有者が二重化しており、本番 Agent invocation が未定義

    本文は一方で SKILL.md を「orchestrator」と呼び、他方では run_retrospective.py を main orchestrator として observer/evaluator の起動順まで所有させています。どちらが実際の Agent 呼び出し、待機、再試行、キャンセルを所有するのか確定していません。

    現在の AC9 は fake-runtime で evaluator ordering を確認できますが、次の本番経路を要求していません。

    • Python から Claude Code Agent をどう起動するか

    • custom Agent 定義をどう指定するか

    • cwd、base SHA、environment、authentication をどう固定するか

    • timeout、SIGTERM、API error、partial result をどう扱うか

    • background Agent の完了を何で確認するか

    • observer と evaluator が同一 run に属することをどう照合するか

    Claude Code の公式な programmatic 経路は claude -p または Agent SDK です。CLI は --output-format json --json-schema による構造化出力、SDK は JSON Schema/Pydantic による検証済み出力を提供します。(Claude)

    一方、現在の Python 依存は pyyaml と jsonschema で、Claude Agent SDK は含まれていません。SDK を採用するなら pyproject.toml / lockfile が現在の Allowed Paths 外になります。CLI subprocess を採用するならその契約を Issue に固定する必要があります。

    さらに、現在の Claude Code は SubAgent を background で動かす場合があり、background task の完了通知を待つ必要があります。セッション全体の spawn 総数には上限がなく、既定の同時実行上限は20です。Issue が「observer wave 完了」を prose で宣言するだけでは順序保証になりません。(Claude)

    必須修正

    推奨は、責務を次のように分割することです。

    orchestration_owner: root Skill / main conversation
    run_retrospective.py:
      role: deterministic phase engine
      phases:
        - prepare
        - validate-observers
        - prepare-evaluator
        - finalize
    Agent_tool_calls:
      owner: root Skill
      prohibited_owner: observer/evaluator leaf agents

    具体的には、

    1. prepare が collector 実行、SourcePlanV1、run nonce、base SHA、source digest を生成する。

    2. root が observer Agent 群を起動して完了を待つ。

    3. validate-observers が全結果を strict validation し、EvaluatorRequestV1 を生成する。

    4. root が evaluator を起動する。

    5. finalize が evaluator 結果を検証し、PublishRequestV1 を生成する。

    Python 自身が Agent を起動する設計を維持する場合は、AgentInvoker production implementation として CLIまたはSDKのどちらかを Issue 上で固定し、fake implementation と同じ protocol を実装させる必要があります。

    なお --bare は script の再現性には有効ですが、OAuth・subscription login を使わず API key を必要とします。Claude Code subscription を前提にするのか、API key を前提にするのかも暗黙にしてはいけません。(Claude)


    P0-2 — Python dataclass は model/process 境界の typed handoff になっていない

    AC7 が証明するのは、SourcePlan、EvidenceBundle、FindingSet、Evaluation、PublishRequest というクラス名がファイル内に存在することだけです。serializer、schema version、unknown field rejection、型検証、出力サイズ制限、malformed output の再試行上限は要求されていません。

    既存 Agent の実際の出力も共通 dataclass ではありません。

    • web-researcher は YAML 形式の WEB_RESEARCH_RESULT_V1 を返し、raw_summary も持ちます。

    • codebase-investigator は Markdown 報告と別の YAML contract を返し、/tmp の request/result path も報告形式に含めます。

    したがって、実装者は Agent の prose を適当に parse して dataclass を組み立てても AC7 を満たせます。これは ADR 0007 が求める「deterministic extraction → taint → isolated observation → schema-controlled projection → privileged evaluator」を機械的に保証しません。

    必須修正

    persistent state schema とは別に、ephemeral wire contract を固定してください。

    SOURCE_PLAN_V1
    OBSERVER_RESULT_V1
    FINDING_SET_V1
    EVALUATOR_REQUEST_V1
    EVALUATION_RESULT_V1
    PUBLISH_REQUEST_V1

    最低限必要なのは次です。

    • 全 envelope に schema_version、run_id、base_sha、source_set_digest

    • additionalProperties: false

    • evidence は public-safe evidence_ref のみ

    • raw payload、stdout/stderr、absolute path、credential-bearing field を構造上持てない

    • observer result と evaluator request の run identity 完全一致

    • JSON decode failure・missing field・unknown field・duplicate ID・oversize を fail-closed

    • schema repair retry は最大1回などの固定上限

    • test は dataclass を直接生成せず、serialized Agent output を parser へ入力する

    CLIまたはSDKを使う場合、公式 structured output は schema validation と mismatch 時の retry/error を提供します。成功 subtype でも structured_output が欠ける場合は failure 扱いが必要です。(Claude)


    P0-3 — delta 算出 owner なのに「前回状態」の入力経路が存在しない

    #2288 が実装した validator は、finding identity と評価履歴の表現を検証しますが、前回評価と今回評価を比較して new / resolved / recurrent / regressed / unchanged を算出する処理は明示的に #2237 の責務とされています。

    しかし #2237 の SourcePlan は5 collector の入力計画しか説明しておらず、次がありません。

    • previous run の読取り口

    • previous candidate state の読取り口

    • finding identity ごとの直前 evaluation 選択規則

    • history がない場合

    • legacy candidate しかない場合

    • persistence が部分取得だった場合

    • stale read が検出された場合

    一方、candidate state の永続化・再読込みを実装する #2238 は #2237 の後続です。#2238 は現在、PublishRequest や historical-state provider の exact interface を消費する契約になっていません。

    このままでは循環します。

    #2237: delta を計算したい
      └─ 前回状態が必要
          └─ #2238 が永続化・読取りを実装
              └─ #2238 は #2237 完了を待つ

    #2239 AC10 が5状態 fixture を E2E 実行しても、fixture が手作りなら production の previous-state acquisition を証明しません。また #2239 は Skill・schema・永続化本体の変更を Out of Scope にしています。

    必須修正

    #2237 で read-only port を先に固定してください。

    PreviousStateProvider:
      input:
        repository_id: string
        scope: string
        finding_identity_algorithm: string
      output:
        schema: PREVIOUS_RETROSPECTIVE_STATE_V1
        status:
          - available
          - no_history
          - legacy_unavailable
          - partial
          - stale
        previous_run_ref: string|null
        candidates: []
        read_version: string|null

    #2237 は fixture/in-memory provider で delta computation を実装し、#2238 が production provider と optimistic concurrency 用 read_version を実装する構造にするべきです。


    P0-4 — PublishRequest の producer/consumer contract と人間承認の trust root が未固定

    #2237 は PublishRequest を「public-safe、mutation authority を含まない」と説明しています。この方針自体は正しいです。しかし AC7 はクラス名しか確認せず、fields、version、canonical serialization、digest を固定していません。

    #2238 側も、PublishRequestV1 の exact consumer にはなっていません。現在は persist_retrospective_run.py が run/candidate を受け取り、--authorized-by-human フラグまたは authorization token などを確認する設計ですが、producer と consumer の境界が未定義です。

    ADR 0007 は Issue comment 投稿を含む artifact-publication mutation に事前の人間承認を要求しています。したがって、任意の呼出し元が付けられる単純な boolean flag は、それ自体では「人間が承認した」証拠になりません。

    必須修正

    PUBLISH_REQUEST_V1 は次のような proposal-only envelope にしてください。

    schema_version: publish_request/v1
    request_id: string
    repository_id: string
    target_issue: integer
    run_identity: object
    candidate_records: []
    expected_previous_digest: string|null
    idempotency_key: string
    public_projection_digest: string
    authorization_required: true

    明示的に含めてはならないもの:

    authorized: forbidden
    authorized_by_human: forbidden
    authorization_token: forbidden
    mutation_capability: forbidden

    人間承認は別の trusted channel から供給される HUMAN_AUTHORIZATION_RECEIPT_V1 とし、少なくとも以下へ束縛する必要があります。

    • request_id

    • public_projection_digest

    • repository / target Issue

    • operation class

    • expiry または one-shot nonce

    #2238 はこの receipt を controlled executor 経由で照合してから mutation するべきです。#2237 と #2238 の間に producer/consumer contract test も必要です。


    P0-5 — 再利用 Agent が snapshot authority と no-mutation boundary を迂回できる

    #2237 は既存 web-researcher と codebase-investigator を capability matrix に基づいて再利用するとしていますが、AC6 は SKILL.md に名称が書かれていることしか検証しません。

    実際の定義を見ると、次の性質があります。

    web-researcher

    • Bash、Read、WebSearch、WebFetch を持つ。

    • AGY または native Web を直接実行する。

    • URL・summary・raw_summary を返す。

    • Child 3 の Web collector を必ず経由する契約ではない。

    codebase-investigator

    • Bash と Read を持つ。

    • current workspace / AGY / Serena を使う。

    • request、context、result を /tmp に作成する。

    • base_sha に束縛された blob/snapshot を入力とする契約ではない。

    • temp file cleanup が定義されていない。

    この結果、次が起こり得ます。

    • repository collector は base_sha=A を観測したが、codebase Agent は dirty worktree または main=B を調査する。

    • web-researcher が取得した URL/content が Child 3 の SSRF防御・provenance・digest を経由せず finding authority になる。

    • Agent の Bash が session permission により許可されていた場合、run_retrospective.py 自身の no-mutation test を通りながら委譲先が git / gh mutation を行う。

    • /tmp に Issue body、absolute path、private context が残り、「invocation-private、永続化しない」と矛盾する。

    Claude Code の subagent output scan は instruction-shaped textをマークするだけで、悪意判定や除去は行わず、tool restriction の代替ではありません。(Claude)

    必須修正

    capability matrix を prose ではなく enforcement contract にしてください。

    Role | Authority | 必須入力 | 本番制約 -- | -- | -- | -- runtime observer | interpreter | private runtime evidence + digest | no Agent/Skill/write、raw出力禁止 codebase investigator | advisory、または base-SHA-bound | git show : 等で materialize した入力 | current worktree を authority にしない web researcher | URL discovery / claim interpretation | bounded query | 最終 evidence は Web collector で再取得・digest化 evaluator | privileged synthesis | validated projection only | Web/Bash/Agent/Skill/write 全禁止

    さらに production Agent invocation 層で、

    • git commit/push

    • gh issue/pr/comment

    • filesystem write

    • unapproved Bash command

    • target run 以外の resume

    を拒否する tool callback / permission policy が必要です。

    各 run の temp artifact は 0700 の専用 temp directory に置き、success、exception、SIGINT、SIGTERM の全経路で cleanup するテストを追加してください。


    P1-1 — 現在の Verification Commands は偽陽性を許す

    具体的な欠陥があります。

    AC2

    wc -l SKILL.md

    これは行数を表示するだけで、500行以上でも exit 0 です。

    修正例:

    test "$(wc -l < .claude/skills/agent-retrospective/SKILL.md)" -lt 500

    AC6

    本文は web-researcher と codebase-investigator の両方を要求していますが、VC は web-researcher しか検索しません。

    rg -n "web-researcher" ... &&
    rg -n "codebase-investigator" ...

    AC7

    複数の rg -e は、全 pattern ではなくいずれか1つが見つかれば成功します。def main だけでも AC7 が PASS になります。

    クラス名検索ではなく Python test で、

    • dataclasses.is_dataclass

    • exact field set

    • exact field types

    • schema_version

    • serializer/deserializer round-trip

    を確認するべきです。

    AC12

    maxTurns が「bounded」であることだけでは不十分です。具体値の上限、exact tools set、mcpServers/hooks/memory/background/isolation/skills の許容値を固定してください。Claude Code は tools を省略すると全 tool を継承します。(Claude)


    P1-2 — 実行 budget、retry、cancel、partial-result policy が未固定

    現在の本文は bounded maxTurns とだけ記載し、次を固定していません。

    • observer/evaluator それぞれの maxTurns

    • Agent 単位の timeout

    • output byte/token limit

    • observer 並列数

    • schema correction retry

    • API retry exhaustion 時の扱い

    • 一部 observer 成功時に evaluator を起動可能か

    • user interruption / SIGTERM 時の cleanup

    • evaluator が partial observer output を受理できる条件

    Claude Code は SubAgent ごとに fresh context を持ち、background 実行やAPI error時の partial outputもあり得ます。そのため、単なる「完了を待つ」という記述では不十分です。(Claude)

    最低限、次を固定してください。

    observer_parallelism: 3
    schema_repair_retries: 1
    evaluator_retries: 0
    partial_agent_output: reject
    api_error_with_partial_text: reject_as_evidence
    timeout_status: typed operational failure
    interruption_status: aborted
    cleanup_required: true

    具体的数値は Issue 上で一つに決める必要があります。


    P1-3 — 関連 Issue 間の契約がまだ矛盾している

    #2236 と #2237

    #2236 は private_evidence を「Child 4 evaluator の入力専用」と記載していますが、現在の #2237 は raw evidence を evaluator へ直接渡さず observer projection のみを渡す設計です。後者が ADR 0007 と整合するため、#2236 の表現を「observer context input」に修正する必要があります。

    #2239

    #2239 は malformed handoff、ordering、5-state delta、unauthorized publication を検出しますが、Skill/SubAgent/persistence の修正自体は Out of Scope です。live smoke で defect が出た場合の owner が定義されていません。

    次の routing を追加すべきです。

    failure_owner:
      orchestrator_or_handoff: reopen_or_fix_issue_2237
      persistence_or_authorization: reopen_or_fix_issue_2238
      adapter_or_snapshot: reopen_or_fix_issue_2236

    #2288 prerequisite

    main にはマージ済みなので、#2237 の Remaining Parent Gaps、Stop Conditions、Delivery Rule を更新し、post-merge SHA で fresh issue-contract-review を実行する必要があります。OWNER materialization comment 自体も「これだけでは implementation go ではなく fresh preflight が必要」としています。


    P1-4 — #2240 の plugin distribution は現在の公式 layout では成立しない

    #2240 は manifest を次の場所へ置く契約です。

    .claude/skills/agent-retrospective/plugin/plugin.json

    Allowed Paths も manifest、README、receipt の3ファイルだけです。

    現在の公式 plugin layout は、plugin root に次を置きます。

    plugin-root/
    ├── .claude-plugin/
    │   └── plugin.json
    ├── skills/
    ├── agents/
    └── bin/ または scripts相当

    skills/ や agents/ を .claude-plugin/ 内へ置いてはいけません。plugin は --plugin-dir で指定できる self-contained directory である必要があります。(Claude)

    したがって #2240 は manifest だけでなく、少なくとも以下を package closure として扱う必要があります。

    • SKILL.md

    • run_retrospective.py

    • collector / validator / schema

    • 新規 observer/evaluator

    • 再利用 Agent の配布方法または plugin-local copy

    • relative import/path resolution

    • clean environment の dependency installation

    plugin Agent では hooks、mcpServers、permissionMode が無視されるため、安全性をこれらへ依存させてもいけません。(Claude)

    これは project Skill MVP の #2237 を直接止める blocker ではありませんが、Child 7 は現状のままでは着手時に即 Stop Condition へ到達します。


    最低限必要な Issue 修正

    #2237 を implementation-ready にするには、少なくとも次を本文へ追加する必要があります。

    required_contract_changes:
      - orchestration ownerをroot SkillかPythonの一方に固定
      - production Agent invocation経路を固定
      - serialized handoff schema v1を定義
      - PreviousStateProvider contractを定義
      - PublishRequestV1を#2238と共有
      - human authorization receiptをproposalから分離
      - reused Agentのauthority/tool/base_sha/temp境界をenforce
      - timeout/retry/cancel/output budgetを固定
      - AC2/AC6/AC7の偽陽性VCを修正
      - #2236/#2238/#2239/#2240の契約を同期

    追加 AC は最低でも次です。

    1. fake runtime ではなく production invocation adapter または root-owned phase protocol が存在する。

    2. Agent の serialized output が strict schema validation を通らなければ evaluator は起動されない。

    3. available / no_history / legacy_unavailable / partial / stale の previous-state matrixを通して5種類の delta を算出する。

    4. 実装: agent-retrospective の Orchestrator Skill と retrospective-runtime-observer・retrospective-evaluator SubAgent を実装する #2237 producer と 実装: agent-retrospective の run 永続化と agent_retro_index/v1 統合を実装する #2238 consumer が同一 PUBLISH_REQUEST_V1 fixture を受理する。

    5. 委譲 Agent が git push、gh issue comment、write command を試みても runtime policy が拒否する。

    6. codebase finding は base_sha に束縛され、Web finding は collector provenance/digest に束縛される。

    7. normal/error/interruption の全経路で private temp artifact が削除される。

    8. public output に raw text、secret、absolute path、untrusted instruction-shaped textが入らない。

    最終判断

    merge_or_implementation_decision: HOLD
    reason:
      - prerequisite #2288 自体は解消済み
      - ただし production orchestration 経路が未定義
      - historical-state inputが欠落
      - handoffとpublication authorizationがconsumer未同期
      - reused Agentがsnapshot/no-mutation境界を機械的に満たさない
    next_gate:
      - Issue本文reframe
      - 関連Issue同期
      - main SHA 1fb91c36以降でfresh contract review

    新規 Issue へ分割するより、まず #2237 を in-place で再度 reframe し、#2238/#2239 の consumer/test 契約を同時に同期する方が適切です。GitHub への投稿・変更は行っていません。

    ## 結論
    verdict: REQUEST_CHANGES
    implementation_readiness: blocked
    recommended_disposition: reframe_in_place
    implementation_start: HOLD
    reviewed_snapshot:
      main_sha: 1fb91c361900aec79b3c50c83be21980a6e39dd6
      issue_state: open
      prerequisite_2288: resolved
    blocking_findings:
      P0: 5
    additional_findings:
      P1: 4

    #2237 は前回レビュー後にかなり改善されています。実行可能な run_retrospective.py、observer/evaluator の二段階構造、typed handoff、leaf Agent 制約まで本文へ取り込まれています。一方で、現在の契約のままではfake-runtime のテストを通しながら、実際には Agent を起動できない実装、前回状態を読めず delta を算出できない実装、委譲 Agent 経由で mutation・snapshot drift を起こす実装が AC 達成扱いになり得ます。

    また、#2288 は PR #2289 により 2026年8月22日に main へマージ済みです。したがって「#2288 未マージ」はもはや blocker ではありません。現在の #2237 本文と updated_at はこのマージ以前の状態なので、prerequisite 表示と fresh contract/preflight を更新する必要があります。

    解消済みと判定する点

    前回の「Claude Code の SubAgent は nested SubAgent を起動できない」という前提は、現行仕様では成立しません。現在は既定で最大3階層まで nested spawn が可能であり、leaf 化には Agent を tools から除外するか disallowedTools へ入れる方法が公式に案内されています。#2237 の現在の記述はこの仕様と整合しています。([Claude]1)

    また、次の点も修正済みです。

    • prose だけでなく stable executable entrypoint が In Scope / Allowed Paths に入った。
    • observer wave 完了後に fresh evaluator を起動する二段階 topology が明示された。
    • Agent boundary test が CI 収集対象の .claude/agents/tests/ に移された。
    • raw evidence → observer → validated projection → evaluator という方向性が本文に入った。

    以下は、その再構成後にも残る blocker です。


    P0-1 — Orchestrator の所有者が二重化しており、本番 Agent invocation が未定義

    本文は一方で SKILL.md を「orchestrator」と呼び、他方では run_retrospective.py を main orchestrator として observer/evaluator の起動順まで所有させています。どちらが実際の Agent 呼び出し、待機、再試行、キャンセルを所有するのか確定していません。

    現在の AC9 は fake-runtime で evaluator ordering を確認できますが、次の本番経路を要求していません。

    • Python から Claude Code Agent をどう起動するか
    • custom Agent 定義をどう指定するか
    • cwd、base SHA、environment、authentication をどう固定するか
    • timeout、SIGTERM、API error、partial result をどう扱うか
    • background Agent の完了を何で確認するか
    • observer と evaluator が同一 run に属することをどう照合するか

    Claude Code の公式な programmatic 経路は claude -p または Agent SDK です。CLI は --output-format json --json-schema による構造化出力、SDK は JSON Schema/Pydantic による検証済み出力を提供します。([Claude]2)

    一方、現在の Python 依存は pyyaml と jsonschema で、Claude Agent SDK は含まれていません。SDK を採用するなら pyproject.toml / lockfile が現在の Allowed Paths 外になります。CLI subprocess を採用するならその契約を Issue に固定する必要があります。

    さらに、現在の Claude Code は SubAgent を background で動かす場合があり、background task の完了通知を待つ必要があります。セッション全体の spawn 総数には上限がなく、既定の同時実行上限は20です。Issue が「observer wave 完了」を prose で宣言するだけでは順序保証になりません。([Claude]1)

    必須修正

    推奨は、責務を次のように分割することです。

    orchestration_owner: root Skill / main conversation
    run_retrospective.py:
      role: deterministic phase engine
      phases:
        - prepare
        - validate-observers
        - prepare-evaluator
        - finalize
    Agent_tool_calls:
      owner: root Skill
      prohibited_owner: observer/evaluator leaf agents

    具体的には、

    1. prepare が collector 実行、SourcePlanV1、run nonce、base SHA、source digest を生成する。
    2. root が observer Agent 群を起動して完了を待つ。
    3. validate-observers が全結果を strict validation し、EvaluatorRequestV1 を生成する。
    4. root が evaluator を起動する。
    5. finalize が evaluator 結果を検証し、PublishRequestV1 を生成する。

    Python 自身が Agent を起動する設計を維持する場合は、AgentInvoker production implementation として CLIまたはSDKのどちらかを Issue 上で固定し、fake implementation と同じ protocol を実装させる必要があります。

    なお --bare は script の再現性には有効ですが、OAuth・subscription login を使わず API key を必要とします。Claude Code subscription を前提にするのか、API key を前提にするのかも暗黙にしてはいけません。(Claude)


    P0-2 — Python dataclass は model/process 境界の typed handoff になっていない

    AC7 が証明するのは、SourcePlan、EvidenceBundle、FindingSet、Evaluation、PublishRequest というクラス名がファイル内に存在することだけです。serializer、schema version、unknown field rejection、型検証、出力サイズ制限、malformed output の再試行上限は要求されていません。

    既存 Agent の実際の出力も共通 dataclass ではありません。

    • web-researcher は YAML 形式の WEB_RESEARCH_RESULT_V1 を返し、raw_summary も持ちます。
    • codebase-investigator は Markdown 報告と別の YAML contract を返し、/tmp の request/result path も報告形式に含めます。

    したがって、実装者は Agent の prose を適当に parse して dataclass を組み立てても AC7 を満たせます。これは ADR 0007 が求める「deterministic extraction → taint → isolated observation → schema-controlled projection → privileged evaluator」を機械的に保証しません。

    必須修正

    persistent state schema とは別に、ephemeral wire contract を固定してください。

    SOURCE_PLAN_V1
    OBSERVER_RESULT_V1
    FINDING_SET_V1
    EVALUATOR_REQUEST_V1
    EVALUATION_RESULT_V1
    PUBLISH_REQUEST_V1
    

    最低限必要なのは次です。

    • 全 envelope に schema_version、run_id、base_sha、source_set_digest
    • additionalProperties: false
    • evidence は public-safe evidence_ref のみ
    • raw payload、stdout/stderr、absolute path、credential-bearing field を構造上持てない
    • observer result と evaluator request の run identity 完全一致
    • JSON decode failure・missing field・unknown field・duplicate ID・oversize を fail-closed
    • schema repair retry は最大1回などの固定上限
    • test は dataclass を直接生成せず、serialized Agent output を parser へ入力する

    CLIまたはSDKを使う場合、公式 structured output は schema validation と mismatch 時の retry/error を提供します。成功 subtype でも structured_output が欠ける場合は failure 扱いが必要です。([Claude]3)


    P0-3 — delta 算出 owner なのに「前回状態」の入力経路が存在しない

    #2288 が実装した validator は、finding identity と評価履歴の表現を検証しますが、前回評価と今回評価を比較して new / resolved / recurrent / regressed / unchanged を算出する処理は明示的に #2237 の責務とされています。

    しかし #2237 の SourcePlan は5 collector の入力計画しか説明しておらず、次がありません。

    • previous run の読取り口
    • previous candidate state の読取り口
    • finding identity ごとの直前 evaluation 選択規則
    • history がない場合
    • legacy candidate しかない場合
    • persistence が部分取得だった場合
    • stale read が検出された場合

    一方、candidate state の永続化・再読込みを実装する #2238 は #2237 の後続です。#2238 は現在、PublishRequest や historical-state provider の exact interface を消費する契約になっていません。

    このままでは循環します。

    #2237: delta を計算したい
      └─ 前回状態が必要
          └─ #2238 が永続化・読取りを実装
              └─ #2238 は #2237 完了を待つ
    

    #2239 AC10 が5状態 fixture を E2E 実行しても、fixture が手作りなら production の previous-state acquisition を証明しません。また #2239 は Skill・schema・永続化本体の変更を Out of Scope にしています。

    必須修正

    #2237 で read-only port を先に固定してください。

    PreviousStateProvider:
      input:
        repository_id: string
        scope: string
        finding_identity_algorithm: string
      output:
        schema: PREVIOUS_RETROSPECTIVE_STATE_V1
        status:
          - available
          - no_history
          - legacy_unavailable
          - partial
          - stale
        previous_run_ref: string|null
        candidates: []
        read_version: string|null

    #2237 は fixture/in-memory provider で delta computation を実装し、#2238 が production provider と optimistic concurrency 用 read_version を実装する構造にするべきです。


    P0-4 — PublishRequest の producer/consumer contract と人間承認の trust root が未固定

    #2237 は PublishRequest を「public-safe、mutation authority を含まない」と説明しています。この方針自体は正しいです。しかし AC7 はクラス名しか確認せず、fields、version、canonical serialization、digest を固定していません。

    #2238 側も、PublishRequestV1 の exact consumer にはなっていません。現在は persist_retrospective_run.py が run/candidate を受け取り、--authorized-by-human フラグまたは authorization token などを確認する設計ですが、producer と consumer の境界が未定義です。

    ADR 0007 は Issue comment 投稿を含む artifact-publication mutation に事前の人間承認を要求しています。したがって、任意の呼出し元が付けられる単純な boolean flag は、それ自体では「人間が承認した」証拠になりません。

    必須修正

    PUBLISH_REQUEST_V1 は次のような proposal-only envelope にしてください。

    schema_version: publish_request/v1
    request_id: string
    repository_id: string
    target_issue: integer
    run_identity: object
    candidate_records: []
    expected_previous_digest: string|null
    idempotency_key: string
    public_projection_digest: string
    authorization_required: true

    明示的に含めてはならないもの:

    authorized: forbidden
    authorized_by_human: forbidden
    authorization_token: forbidden
    mutation_capability: forbidden

    人間承認は別の trusted channel から供給される HUMAN_AUTHORIZATION_RECEIPT_V1 とし、少なくとも以下へ束縛する必要があります。

    • request_id
    • public_projection_digest
    • repository / target Issue
    • operation class
    • expiry または one-shot nonce

    #2238 はこの receipt を controlled executor 経由で照合してから mutation するべきです。#2237 と #2238 の間に producer/consumer contract test も必要です。


    P0-5 — 再利用 Agent が snapshot authority と no-mutation boundary を迂回できる

    #2237 は既存 web-researcher と codebase-investigator を capability matrix に基づいて再利用するとしていますが、AC6 は SKILL.md に名称が書かれていることしか検証しません。

    実際の定義を見ると、次の性質があります。

    web-researcher

    • Bash、Read、WebSearch、WebFetch を持つ。
    • AGY または native Web を直接実行する。
    • URL・summary・raw_summary を返す。
    • Child 3 の Web collector を必ず経由する契約ではない。

    codebase-investigator

    • Bash と Read を持つ。
    • current workspace / AGY / Serena を使う。
    • request、context、result を /tmp に作成する。
    • base_sha に束縛された blob/snapshot を入力とする契約ではない。
    • temp file cleanup が定義されていない。

    この結果、次が起こり得ます。

    • repository collector は base_sha=A を観測したが、codebase Agent は dirty worktree または main=B を調査する。
    • web-researcher が取得した URL/content が Child 3 の SSRF防御・provenance・digest を経由せず finding authority になる。
    • Agent の Bash が session permission により許可されていた場合、run_retrospective.py 自身の no-mutation test を通りながら委譲先が git / gh mutation を行う。
    • /tmp に Issue body、absolute path、private context が残り、「invocation-private、永続化しない」と矛盾する。

    Claude Code の subagent output scan は instruction-shaped textをマークするだけで、悪意判定や除去は行わず、tool restriction の代替ではありません。(Claude)

    必須修正

    capability matrix を prose ではなく enforcement contract にしてください。

    Role Authority 必須入力 本番制約
    runtime observer interpreter private runtime evidence + digest no Agent/Skill/write、raw出力禁止
    codebase investigator advisory、または base-SHA-bound git show <base_sha>:<path> 等で materialize した入力 current worktree を authority にしない
    web researcher URL discovery / claim interpretation bounded query 最終 evidence は Web collector で再取得・digest化
    evaluator privileged synthesis validated projection only Web/Bash/Agent/Skill/write 全禁止

    さらに production Agent invocation 層で、

    • git commit/push
    • gh issue/pr/comment
    • filesystem write
    • unapproved Bash command
    • target run 以外の resume

    を拒否する tool callback / permission policy が必要です。

    各 run の temp artifact は 0700 の専用 temp directory に置き、success、exception、SIGINT、SIGTERM の全経路で cleanup するテストを追加してください。


    P1-1 — 現在の Verification Commands は偽陽性を許す

    具体的な欠陥があります。

    AC2

    wc -l SKILL.md

    これは行数を表示するだけで、500行以上でも exit 0 です。

    修正例:

    test "$(wc -l < .claude/skills/agent-retrospective/SKILL.md)" -lt 500

    AC6

    本文は web-researcher と codebase-investigator の両方を要求していますが、VC は web-researcher しか検索しません。

    rg -n "web-researcher" ... &&
    rg -n "codebase-investigator" ...

    AC7

    複数の rg -e は、全 pattern ではなくいずれか1つが見つかれば成功します。def main だけでも AC7 が PASS になります。

    クラス名検索ではなく Python test で、

    • dataclasses.is_dataclass
    • exact field set
    • exact field types
    • schema_version
    • serializer/deserializer round-trip

    を確認するべきです。

    AC12

    maxTurns が「bounded」であることだけでは不十分です。具体値の上限、exact tools set、mcpServers/hooks/memory/background/isolation/skills の許容値を固定してください。Claude Code は tools を省略すると全 tool を継承します。(Claude)


    P1-2 — 実行 budget、retry、cancel、partial-result policy が未固定

    現在の本文は bounded maxTurns とだけ記載し、次を固定していません。

    • observer/evaluator それぞれの maxTurns
    • Agent 単位の timeout
    • output byte/token limit
    • observer 並列数
    • schema correction retry
    • API retry exhaustion 時の扱い
    • 一部 observer 成功時に evaluator を起動可能か
    • user interruption / SIGTERM 時の cleanup
    • evaluator が partial observer output を受理できる条件

    Claude Code は SubAgent ごとに fresh context を持ち、background 実行やAPI error時の partial outputもあり得ます。そのため、単なる「完了を待つ」という記述では不十分です。([Claude]1)

    最低限、次を固定してください。

    observer_parallelism: 3
    schema_repair_retries: 1
    evaluator_retries: 0
    partial_agent_output: reject
    api_error_with_partial_text: reject_as_evidence
    timeout_status: typed operational failure
    interruption_status: aborted
    cleanup_required: true

    具体的数値は Issue 上で一つに決める必要があります。


    P1-3 — 関連 Issue 間の契約がまだ矛盾している

    #2236 と #2237

    #2236 は private_evidence を「Child 4 evaluator の入力専用」と記載していますが、現在の #2237 は raw evidence を evaluator へ直接渡さず observer projection のみを渡す設計です。後者が ADR 0007 と整合するため、#2236 の表現を「observer context input」に修正する必要があります。

    #2239

    #2239 は malformed handoff、ordering、5-state delta、unauthorized publication を検出しますが、Skill/SubAgent/persistence の修正自体は Out of Scope です。live smoke で defect が出た場合の owner が定義されていません。

    次の routing を追加すべきです。

    failure_owner:
      orchestrator_or_handoff: reopen_or_fix_issue_2237
      persistence_or_authorization: reopen_or_fix_issue_2238
      adapter_or_snapshot: reopen_or_fix_issue_2236

    #2288 prerequisite

    main にはマージ済みなので、#2237 の Remaining Parent Gaps、Stop Conditions、Delivery Rule を更新し、post-merge SHA で fresh issue-contract-review を実行する必要があります。OWNER materialization comment 自体も「これだけでは implementation go ではなく fresh preflight が必要」としています。


    P1-4 — #2240 の plugin distribution は現在の公式 layout では成立しない

    #2240 は manifest を次の場所へ置く契約です。

    .claude/skills/agent-retrospective/plugin/plugin.json
    

    Allowed Paths も manifest、README、receipt の3ファイルだけです。

    現在の公式 plugin layout は、plugin root に次を置きます。

    plugin-root/
    ├── .claude-plugin/
    │   └── plugin.json
    ├── skills/
    ├── agents/
    └── bin/ または scripts相当
    

    skills/ や agents/ を .claude-plugin/ 内へ置いてはいけません。plugin は --plugin-dir で指定できる self-contained directory である必要があります。([Claude]4)

    したがって #2240 は manifest だけでなく、少なくとも以下を package closure として扱う必要があります。

    • SKILL.md
    • run_retrospective.py
    • collector / validator / schema
    • 新規 observer/evaluator
    • 再利用 Agent の配布方法または plugin-local copy
    • relative import/path resolution
    • clean environment の dependency installation

    plugin Agent では hooks、mcpServers、permissionMode が無視されるため、安全性をこれらへ依存させてもいけません。([Claude]1)

    これは project Skill MVP の #2237 を直接止める blocker ではありませんが、Child 7 は現状のままでは着手時に即 Stop Condition へ到達します。


    最低限必要な Issue 修正

    #2237 を implementation-ready にするには、少なくとも次を本文へ追加する必要があります。

    required_contract_changes:
      - orchestration ownerをroot SkillかPythonの一方に固定
      - production Agent invocation経路を固定
      - serialized handoff schema v1を定義
      - PreviousStateProvider contractを定義
      - PublishRequestV1を#2238と共有
      - human authorization receiptをproposalから分離
      - reused Agentのauthority/tool/base_sha/temp境界をenforce
      - timeout/retry/cancel/output budgetを固定
      - AC2/AC6/AC7の偽陽性VCを修正
      - #2236/#2238/#2239/#2240の契約を同期

    追加 AC は最低でも次です。

    1. fake runtime ではなく production invocation adapter または root-owned phase protocol が存在する。
    2. Agent の serialized output が strict schema validation を通らなければ evaluator は起動されない。
    3. available / no_history / legacy_unavailable / partial / stale の previous-state matrixを通して5種類の delta を算出する。
    4. 実装: agent-retrospective の Orchestrator Skill と retrospective-runtime-observer・retrospective-evaluator SubAgent を実装する #2237 producer と 実装: agent-retrospective の run 永続化と agent_retro_index/v1 統合を実装する #2238 consumer が同一 PUBLISH_REQUEST_V1 fixture を受理する。
    5. 委譲 Agent が git push、gh issue comment、write command を試みても runtime policy が拒否する。
    6. codebase finding は base_sha に束縛され、Web finding は collector provenance/digest に束縛される。
    7. normal/error/interruption の全経路で private temp artifact が削除される。
    8. public output に raw text、secret、absolute path、untrusted instruction-shaped textが入らない。

    最終判断

    merge_or_implementation_decision: HOLD
    reason:
      - prerequisite #2288 自体は解消済み
      - ただし production orchestration 経路が未定義
      - historical-state inputが欠落
      - handoffとpublication authorizationがconsumer未同期
      - reused Agentがsnapshot/no-mutation境界を機械的に満たさない
    next_gate:
      - Issue本文reframe
      - 関連Issue同期
      - main SHA 1fb91c36以降でfresh contract review

    新規 Issue へ分割するより、まず #2237 を in-place で再度 reframe し、#2238/#2239 の consumer/test 契約を同時に同期する方が適切です。GitHub への投稿・変更は行っていません。

  9. squne121 commented on Aug 22, 2026

    @squne121
    OwnerAuthor

    issue-refinement-loop 終了報告(2026-08-22)

    対象コメント: https://github.com/squne121/loop-protocol/issues/2237#issuecomment-5377568980(OWNER review、verdict: REQUEST_CHANGES、recommended_disposition: reframe_in_place、P0 5件・P1 4件)

    実施内容

    1. codebase-investigator / web-researcher による事前調査で、OWNER レビューの技術的主張(Claude Code headless CLI 構造化出力、SubAgent nesting 上限3階層・同時実行20、plugin layout 制約、structured-output retry 挙動)をすべて一次資料(code.claude.com/docs)で確認し、PASS と判定した。また #2288 が PR 実装: agent_improvement_candidate/v1 に finding_contract versioned envelope を追加する (#2288) #2289 により 2026-08-22 に main へマージ済みであることを独立確認した。
    2. Allowed Paths の新規追加なしに(既存 5 ファイルの内容変更のみ)、既存 Allowed Paths の範囲内で本文を reframe した。
      • orchestration owner を root Skill / main conversation に一意化(run_retrospective.py は prepare/validate-observers/prepare-evaluator/finalize の deterministic phase engine に限定)
      • production Agent invocation 経路を headless CLI subprocess(claude -p --output-format json --json-schema)に固定(Claude Agent SDK 非採用、pyproject.toml 変更不要)
      • ephemeral wire contract(SOURCE_PLAN_V1/OBSERVER_RESULT_V1/FINDING_SET_V1/EVALUATOR_REQUEST_V1/EVALUATION_RESULT_V1/PUBLISH_REQUEST_V1)を追加
      • PreviousStateProvider read-only port(5 状態: available/no_history/legacy_unavailable/partial/stale)を追加、production 実装は 実装: agent-retrospective の run 永続化と agent_retro_index/v1 統合を実装する #2238 に委譲
      • PUBLISH_REQUEST_V1 を proposal-only envelope とし、authorized/authorized_by_human/authorization_token/mutation_capability を forbidden field として明記
      • 既存 web-researcher/codebase-investigator の capability matrix を enforcement contract 化
      • timeout/retry/budget の具体値(observer_parallelism: 3、schema_repair_retries: 1、evaluator_retries: 0 等)を固定
      • AC2/AC6/AC7/AC12 の偽陽性 VC を修正し、AC13-18 を新規追加(AC数: 12→18)
      • #2288 prerequisite 解消を Remaining Parent Gaps / Stop Conditions / Required Design References / Delivery Rule に反映
    3. 本文編集は issue-editor 経由で計5回のイテレーションを実施(VC preflight の shell-substitution 禁止・command allowlist・baseline-expect annotation 個別行必須・native/fallback dependency 不一致、という4種の機械的ブロッカーをすべて解消)。

    レビュー結果

    fresh review(run_root_review_pipeline.py produce): VERDICT: approve、BLOCKERS: 0
    REVIEWED_BODY_SHA256: sha256:ea9f9b7db973a1228c996b8c1d2fb98a966a94e616351a5d87782fc6e6cd27b8

    Final Gate(issue-contract-review/run_contract_review_once.py): status: go(readiness: go, blockers: pass, product_spec: pass, vc_preflight: pass, declared_path_overlap: advisory_only/disjoint)。前回保留していた #2288 未マージによる human_escalation は解消済み。

    結論

    Issue 本文の品質改善は収束(approve/0 blockers)。実装ハンドオフ可否(Final Gate)も status: go に到達した。

    LOOP_HANDOFF_RESULT_V1:
      status: approved
      routing_action: proceed
      contract_review:
        status: go
        gate_result: go
        latest_comment_url: null
        generated_at: "2026-08-22T03:49:00Z"
        body_sha256: "sha256:ea9f9b7db973a1228c996b8c1d2fb98a966a94e616351a5d87782fc6e6cd27b8"
      metadata:
        title_prefix_ready: true
      blockers: []
  10. squne121 commented on Aug 22, 2026

    @squne121
    OwnerAuthor

    root-owned entry router audit

    route: invoke_impl_review_loop
    reason: fresh_review_go_live_equality

  11. squne121 commented on Aug 22, 2026

    @squne121
    OwnerAuthor

    implement-issue: 実装完了 (2026-08-22)

    IMPLEMENT_RESULT_V1:
      status: ok
      generated_at: "2026-08-22T00:00:00Z"
      generated_by: implement-issue
      issue_url: https://github.com/squne121/loop-protocol/issues/2237
      pr_url: https://github.com/squne121/loop-protocol/pull/2293
      worktree: .claude/worktrees/issue-2237-agent-retrospective-orchestrator-skill-r
      branch: worktree-issue-2237-agent-retrospective-orchestrator-skill-r
      verification:
        typecheck: pass
        lint: pass
        test:
          passed: 1872
          failed: 0
          files: 112
        build: pass
      allowed_paths_compliance: true
      warnings:
        - "contract_snapshot_url は missing_go(go コメントなし)。live Issue contract(Outcome / AC / Allowed Paths / VC / Stop Conditions)を正本として実装した(#1860 Owner Decision)。"
      errors: []

    Issue 固有の Verification Commands(AC1-AC18)

    issue_2237_ac_verification:
      AC1_disable_model_invocation: pass  # rg -n "disable-model-invocation: true" SKILL.md
      AC2_skill_md_under_500_lines: pass  # SKILL.md = 145 lines
      AC3_runtime_observer_no_skill_tool: pass
      AC4_evaluator_no_skill_tool: pass
      AC5_no_agent_tool: pass
      AC6_web_researcher_and_codebase_investigator_reuse: pass  # rg 両方 SKILL.md に存在
      AC7_wire_contract_dataclass_roundtrip: pass
      AC8_base_sha_fixed_once: pass
      AC9_evaluator_waits_for_observer: pass
      AC10_evaluator_receives_typed_projection_only: pass
      AC11_no_mutation_side_effect: pass
      AC12_leaf_frontmatter_contract: pass
      AC13_production_agent_invocation_adapter: pass
      AC14_schema_repair_retry_bounded: pass
      AC15_previous_state_provider_five_states: pass
      AC16_publish_request_forbidden_fields: pass
      AC17_delegated_agent_mutation_denied: pass
      AC18_temp_artifact_cleanup_all_paths: pass
      pytest_totals:
        test_run_retrospective.py: "83 passed"
        test_retrospective_subagent_boundary.py: "16 passed"
        combined: "99 passed"

    実装サマリ

    • .claude/skills/agent-retrospective/SKILL.md(145 行、disable-model-invocation: true)を
      orchestrator として新規追加。references/(capability-matrix.md / wire-contract.md /
      execution-budget.md / design-rationale.md)へ詳細を progressive disclosure 分離
    • .claude/skills/agent-retrospective/scripts/run_retrospective.py(deterministic phase engine:
      prepare/validate-observers/prepare-evaluator/finalize。ephemeral wire contract 6 envelope・
      production Agent invocation adapter・PreviousStateProvider・proposal-only PublishRequest・
      delegated-Agent permission policy・run-scoped temp dir cleanup)
    • .claude/agents/retrospective-runtime-observer.md / .claude/agents/retrospective-evaluator.md
      (新規 leaf SubAgent。tools 空リスト、Agent/Skill 完全除外、maxTurns 具体値固定)
    • 既存 web-researcher / codebase-investigator を observer wave へ再利用配線(SKILL.md 内で明記)

    後続

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent/implementerenhancementphase/implementation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions