Repository navigation
Description
Machine-Readable Contract
contract_schema_version: v1
issue_kind: implementation
parent_issue: "none"
goal_ref: >-
agent-retrospective が Antigravity CLI (agy) delegation の実効性を、
AGY の直接成功率、出力採用率、Claude Code token 消費、fallback/recovery、
および利用可能な local AGY session provenance から public-safe に測定し、
control の有無を区別した effectiveness evidence として継続比較できるようにする
change_kind: mixedParent Issue
なし(単独改善)。
Parent Goal Ref
- Goal: Antigravity CLI を利用することが実際に開発効率・成果品質へ寄与しているかを、単なる「wrapper が exit 0 だった」ではなく downstream の採用・fallback・Claude Code token 消費まで含めて retrospective で観測する。
- Desired Destination:
.claude/skills/agent-retrospective/が AGY effectiveness の public-safe evidence を生成し、前回 run / matched control / paired control が存在する場合は比較できる。control が無い場合は observational result として扱い、因果的な改善主張をしない。
Current Validated Scope
current repository では以下が既に存在する。
.claude/skills/agent-retrospective/は Claude Code / Claude-GPT runtime evidence、repository、GitHub、Web を収集し、agent_improvement_candidate/v1のruntime_behaviorfinding と typed signal(number / enum 等)を扱える。- 実装: agent-retrospective に Latitude CLI runtime evidence enrichment を追加する #2375 で Latitude CLI の private runtime evidence を
latitude_runtime_evidence/v1に public-safe projection し deterministic enrichment する precedent がある。 gemini-cli-headless-delegationは AGY 実行についてdelegation_result/v1、delegation_audit_v1、agy_tool_provenance_v1を既に生成する。delegation_audit_v1は start/end を同一run_idで pair し、provider_requested/tool_profile/ok/failure_class/provider_attempts/fallback_reason/ fan-out correlation ids を public-safe に記録する。- AGY
delegation_result/v1はagy_provenance_hook_events、conversation_id、transcript_sha256を持ち得る。 - AGY native tool provenance の実調査では、
~/.gemini/antigravity-cli/brain/*/.system_generated/logs/transcript.jsonlのtoolCall.nameを readback した実績がある。~/.gemini/antigravity-cli/にhistory.jsonlが存在することも repository 内で認識済みだが、現時点で retrospective effectiveness の authority としての意味論は固定されていない。 scripts/summarize_agent_transcript.pyは session transcript の trustedtoken_usageevent からprompt_tokens/completion_tokens/total_tokensを抽出する既存 precedent を持つ。- 実装: agent-retrospective の codebase observer を role-specific contract で接続し、AGY operational failure 時の native fallback 結果を base_sha-bound な OBSERVER_RESULT_V1 へ正規化する #2374 / 実装: AGY advisory調査のfallback判定をdeterministic化し実wrapper smokeを追加する #2434 等で AGY operational failure 後の native fallback / recovery は既に扱われているが、「fallback で最終的に解決したから AGY 成功」とは定義されていない。
- optional plugin 版
plugins/agent-retrospective/**は AGY / Latitude / Claude-GPT 固有依存を意図的に持たない。初版では project Skill のみを対象にする。
Problem
現行 retrospective は「AGY を使ったか」「AGY wrapper が成功したか」は部分的に観測できるが、次を継続的に評価できない。
- AGY の出力が Claude Code に実際に採用された割合。
- AGY delegation により Claude Code 自身の token 消費が削減されたか。
- AGY が失敗した後に Claude Code が同じ作業を native にやり直して解決したケースを、AGY 成功ではなく「AGY failure / workflow recovered」と区別できるか。
- AGY の local session/tool provenance を用いて、wrapper self-report だけでは分からない実 tool use / execution details を補強できるか。
- control が無い単なる相関を「AGY の効果」と誤認しない比較境界。
Outcome
project agent-retrospective に agy_effectiveness_evidence/v1 相当の closed public-safe evidence contract、bounded collector、correlation / aggregation、deterministic enrichment、tests を追加する。
retrospective は少なくとも以下を profile / task class ごとに出力できる。
- AGY attempts
- AGY direct successes
- AGY failures recovered by Claude Code
- AGY unrecovered failures
- indeterminate attempts
- AGY direct success rate
- workflow completion / recovery rate(AGY success rate とは別指標)
- output adoption classification / rate
- Claude Code token consumption
- comparable control がある場合の Claude Code token savings absolute / percent
- fallback rate / failure class distribution
- optional local AGY session provenance coverage
- comparison mode と effect verdict
Metric Semantics
1. AGY direct success と fallback recovery を分離する
attempt-level classification は closed enum とする。
agy_attempt_outcome:
- direct_success
- failure_recovered_by_claude
- failure_unrecovered
- indeterminatedirect_success: AGY が要求された delegated task を成立させ、caller が同じ delegated work を native fallback でやり直す必要がなかった。failure_recovered_by_claude: AGY の operational failure、provider failure、quality failure、output rejection 等の後、Claude Code / Claude-GPT が同じ作業を native route でやり直して最終目的を達成した。failure_unrecovered: AGY が失敗し、その task/window 内で recovery できなかった。indeterminate: AGY attempt と downstream action / task completion の binding が不足・矛盾・partial で判定不能。
重要: failure_recovered_by_claude は AGY 成功に数えない。最終 workflow が成功していても AGY effectiveness 上は failure である。
agy_direct_success_rate =
direct_success / evaluable_agy_attempts
workflow_completion_rate =
(direct_success + failure_recovered_by_claude) / evaluable_agy_attempts
両値を混同しない。
2. Output Adoption Rate
AGY ok: true だけでは「採用」とみなさない。AGY result と downstream Claude session を correlation し、次で分類する。
output_adoption:
- accepted_without_rework
- accepted_with_verification_or_minor_followup
- rejected_or_redone
- unknownaccepted_without_rework: delegated result が downstream 作業の根拠として使われ、同一 delegated task の substantive native redo がない。accepted_with_verification_or_minor_followup: result は利用されたが、検証・軽微な補足が必要だった。rejected_or_redone: result が採用されず、同じ delegated task を Claude Code が substantive にやり直した、または明示的 fallback に入った。unknown: transcript / correlation evidence から区別できない。
公開する率:
strict_output_adoption_rate =
accepted_without_rework / adoption_evaluable_attempts
usable_output_adoption_rate =
(accepted_without_rework + accepted_with_verification_or_minor_followup)
/ adoption_evaluable_attempts
曖昧なケースを evaluator の推測だけで accepted に昇格させない。deterministic correlation evidence が不足する場合は unknown を維持する。
3. Claude Code Token Reduction
測定対象は Claude Code / Claude-GPT 側 token 消費。AGY 自身の model token 消費はこの指標へ混ぜない。
最低限以下を保持する。
claude_code_tokens:
treatment_total_tokens: integer | null
control_total_tokens: integer | null
savings_absolute_tokens: integer | null
savings_percent: number | null- treatment は AGY-assisted task/window の Claude-side token usage。
- control は同一/比較可能 task の AGY 無し baseline。
savings_absolute_tokens = control - treatmentsavings_percent = (control - treatment) / control * 100- control が存在しない、task binding が不十分、token coverage が partial/unavailable の場合、削減量/率は null +
effect_verdict: indeterminate。 - 単に AGY 利用 run の token が少なかったという observational correlation だけで「AGY が token を削減した」と断定しない。
- cached / input / output token の扱いは source が区別可能な場合 additive detail として保持してよいが、canonical comparison metric は同一 source semantics の
total_tokens同士で比較する。 - task complexity / profile が明らかに異なる run を無条件に baseline として比較しない。
4. Comparison / Effect Mode
comparison_mode:
- observational
- matched_control
- paired_control
effect_verdict:
- improved
- neutral
- worse
- indeterminateobservational: control 無し。率・件数・token observation は出してよいが、effect verdict は原則indeterminate。matched_control: task class / profile / acceptance target 等を一致させた historical control。matching key と sample count を evidence に残す。paired_control: 同一 fixture / task を AGY enabled / disabled で bounded に比較した controlled run。- causal / effectiveness claim を出す場合は既存
experimental-validity reviewerの考え方を再利用し、unsupported claim を positive verdict にしない。 - 小標本から統計的有意性を装わない。sample count と comparison mode を常に表示する。
5. Profile / Task-Class Segmentation
最低限 tool_profile と delegated role/task class で集計を分ける。
例:
- codebase investigation / local_asset_research
- web research / grounded_research
- proposal_only
- github_research
異なる profile を全て一つの success/adoption/token 指標へ混ぜた aggregate だけで判断しない。
Local AGY Session Evidence
local AGY session log は 有用な supplemental private evidence source として In Scope とする。ただし blanket scan / raw publication は禁止する。
Primary target
current repository で実 readback precedent がある:
~/.gemini/antigravity-cli/brain/*/.system_generated/logs/transcript.jsonl
collector は AGY result / provenance から得た conversation_id、transcript_path_ref、transcript_sha256、run correlation ids 等で対象 session を bounded に特定できる場合だけ読む。全 brain/* の無制限探索を通常経路にしない。
What it may prove
- actual AGY tool call が発生したか
- tool class / count
- conversation/run correlation
- wrapper result と native transcript provenance の整合
- AGY 自身は成功したが downstream で採用されなかったケースの原因調査補助
- fallback 前に AGY がどこまで作業していたか
What it does NOT prove by itself
- Claude Code が AGY 出力を採用したか
- Claude Code token が削減されたか
- AGY の因果効果
output adoption は caller-side Claude transcript / workflow evidence との相関が必要。token reduction は Claude-side token telemetry と control が必要。
history.jsonl
~/.gemini/antigravity-cli/history.jsonl の存在は current repository で認識されているが、MVP では primary authority にしない。
- current AGY versionで semantics / retention / session binding が検証できる場合のみ supplemental discovery source として利用可能。
- 未検証なら
availability: unavailable|partialとし、brain transcript や wrapper evidence を推測で補完しない。 - raw history content を publication しない。
Public-Safety Boundary
local AGY logs から public output へ出してよいのは allowlisted projection のみ。
例:
- session/provenance availability
- correlation status
- tool call count / tool class
- digest / opaque evidence ref
- timestamps / duration(public-safe な場合)
- closed reason code
禁止:
- raw prompt
- raw response / transcript
- tool arguments / tool results 全文
- credential / token / account info
- absolute local path
- unredacted source content
Proposed agy_effectiveness_evidence/v1
概念 shape:
schema_version: agy_effectiveness_evidence/v1
availability: available | partial | unavailable | error
window:
scope_kind: retrospective_run | task | activity
correlation_status: complete | partial | unbound
sample:
attempted: integer
evaluable: integer
direct_success: integer
failure_recovered_by_claude: integer
failure_unrecovered: integer
indeterminate: integer
metrics:
agy_direct_success_rate: number | null
workflow_completion_rate: number | null
strict_output_adoption_rate: number | null
usable_output_adoption_rate: number | null
fallback_rate: number | null
failure_class_counts: object
claude_code_tokens:
treatment_total_tokens: integer | null
control_total_tokens: integer | null
savings_absolute_tokens: integer | null
savings_percent: number | null
comparison:
mode: observational | matched_control | paired_control
effect_verdict: improved | neutral | worse | indeterminate
sample_count: integer
reason_code: string | null
local_agy_session:
availability: available | partial | unavailable | error
correlated_sessions: integer
tool_call_count: integer | null
evidence_ref: string | null
evidence_identity: string | null
reason_code: string | nullexact schema は implementation/refinement 時に既存 schema taxonomy と current producer contract を再確認して固定する。既存 canonical agent_improvement_candidate/v1 に不要な新 field を直接追加するより、独立 evidence envelope + existing runtime_behavior / typed signals / runtime_receipt へ enrichment する構造を優先する。
In Scope
- project
agent-retrospectiveに AGY effectiveness evidence collector / validator / aggregation / enrichment を追加する。 - existing
delegation_audit_v1/delegation_result/v1/agy_tool_provenance_v1を consumer として再利用する。 - Claude Code / Claude-GPT runtime transcript の public-safe token metrics を task/window に相関する。
- AGY failure 後に Claude Code が native fallback で解決した場合を
failure_recovered_by_claudeとして AGY failure に数える。 - output adoption を accepted / minor-followup / rejected-redone / unknown に分類し、strict / usable adoption rate を生成する。
- Claude Code total token comparison と savings metric を追加する。control 不在時は savings を indeterminate にする。
- bounded local AGY transcript projection を supplemental evidence として追加する。
- profile / task-class segmentation。
- hermetic fixtures、partial/unavailable/ambiguity/fallback/public-safety negative tests。
- opt-in live verification で実 AGY + Claude-side correlation を確認する。
- schema catalog / docs が current governance 上必要なら同一 PR で更新する。
Out of Scope
- raw AGY transcript / history / prompt / response の GitHub publication。
- AGY credential/config/account/session の mutation。
- AGY token/cost を Claude Code token savings に混ぜた「総コスト削減」指標。
- AGY を使う/使わない provider policy 自体の変更。
- automatic disable / rollout / provider selection decision。
- statistical significance を装う score。
- optional plugin
plugins/agent-retrospective/**への同時 port。 - 導入: EntireCLI + Latitude の観測データを agent_run_report に接続し、GitHub 経由の ChatGPT レトロ動線を確立する #1153 の generic Google Antigravity capture capability / Latitude Cloud pilot の完了主張。
- unrelated AGY auth / permission / sandbox hardening。
Acceptance Criteria
- AC1:
agy_effectiveness_evidence/v1相当の validator が closed key set、availability/nullability、non-negative counts、rate range、count/rate consistency、public-safety invariant を fail-closed で検証する。 - AC2: collector は retrospective 対象 window の AGY attempt を
delegation_audit_v1/delegation_result/v1から deterministic に相関し、duplicate/orphan/malformed/inconsistent run binding を success に昇格させない。 - AC3:
failure_recovered_by_claudeは AGY direct success に数えられず、agy_direct_success_rateとworkflow_completion_rateが別指標として出力される。 - AC4: output adoption は
accepted_without_rework | accepted_with_verification_or_minor_followup | rejected_or_redone | unknownの closed classification を持ち、ambiguous evidence を accepted へ推測昇格しない。 - AC5: strict / usable output adoption rate が evaluable denominator と sample count を伴って生成される。
- AC6: Claude Code / Claude-GPT token metric は task/window に相関した trusted token source から算出され、control 無し・coverage partial/unavailable・binding ambiguity では token savings を null + indeterminate にする。
- AC7: matched/paired control が有効な場合だけ
savings_absolute_tokens/savings_percentを生成し、同一 semantics のtotal_tokensを比較する。異種 task/profile の無条件比較を禁止する。 - AC8: local AGY session collector は known AGY run から bounded に相関した
brain/*/.system_generated/logs/transcript.jsonlの public-safe projection のみを生成し、raw prompt/response/tool args/tool result/credential/absolute path を output・fixture・GitHub artifactへ流さない。 - AC9:
history.jsonlは current-version semantics/session binding が検証されない限り authority にせず、未検証時は partial/unavailable を返す。 - AC10: local AGY session evidence が unavailable でも delegation audit + Claude runtime evidence が十分なら observational effectiveness aggregation は継続できる。unavailable を success evidence に変換しない。
- AC11: metrics は少なくとも tool_profile / delegated task class で segment でき、全 profile 混合 aggregate だけを effect 判定に使わない。
- AC12:
comparison_mode=observationalでは descriptive metrics を出してよいが、AGY の causal improvement を positive に断定せずeffect_verdict=indeterminateを維持する。 - AC13: matched_control / paired_control の比較は matching/binding evidence・sample count を保持し、既存 experimental-validity 境界で unsupported causal claim を reject できる。
- AC14: available evidence は existing
agent_improvement_candidate/v1のclaim_class=runtime_behavior/ typed signal / runtime evidence reference へ deterministic enrichment され、canonical candidate schema を不要に拡張しない。 - AC15: AGY を一度も使わない retrospective run、AGY evidence unavailable run、plugin distribution の既存挙動を regression させない。
- AC16: opt-in live verification で少なくとも (a) AGY direct success、(b) AGY failure → Claude fallback recovery の2極性を観測し、後者が AGY success rate に入らないことを runtime artifact で確認する。
- AC17: opt-in controlled token verification で、同一 bounded fixture/task に対する AGY-assisted / no-AGY control の Claude-side total token measurement を取得し、comparison mode・raw counts・算出式から savings result を再計算できる。環境上 control を成立させられない場合は SKIP/incomplete であり PASS を偽装しない。
Verification Commands
implementation/refinement 時に current script names を確定する。最低限次のテスト群を用意する。
# schema / aggregation / fallback classification / adoption / token comparison
uv run --locked pytest .claude/skills/agent-retrospective/scripts/tests/ -k "agy_effectiveness"
# public-safety / local AGY transcript projection
uv run --locked pytest .claude/skills/agent-retrospective/scripts/tests/ -k "agy_local_session or public_safe"
# regression
uv run --locked pytest .claude/skills/agent-retrospective/scripts/tests/
# live polarity / controlled token measurement
uv run --locked pytest .claude/skills/agent-retrospective/scripts/tests/verify_agy_effectiveness_live.py -sRuntime Verification Applicability
decision: immediate
reason: >-
AGY direct success vs Claude fallback recovery の分類、local AGY transcript correlation、
Claude-side token measurement は static fixture だけでは production route の成立を証明できないため。
applicable_acs:
- AC16
- AC17
execution_environment:
cli_tools:
- python3
- uv
- claude
- agy
auth_required: true
network_required: profile-dependent
skip_conditions:
- "AGY account session / binary / required profile capability が利用不能"
- "Claude runtime token source が current runtime で取得不能"
- "paired control を同一 bounded fixture で安全に成立させられない"
fallback_policy:
fallback_success_is_pass: false
notes: >-
AGY failure 後に Claude Code が作業を完遂しても AGY direct-success verification の PASS にはしない。
それ自体を failure_recovered_by_claude の期待極性として記録する。
artifact_requirements:
- "public-safe effectiveness summary"
- "attempt counts / classifications / rates / comparison mode / token raw counts"
- "local AGY evidence は opaque digest/ref + allowlisted counts のみ"
- "raw prompt/response/transcript/tool args/tool results/credential/absolute path を含まない"Proposed Allowed Paths
.claude/skills/agent-retrospective/SKILL.md.claude/skills/agent-retrospective/references/**.claude/skills/agent-retrospective/schemas/agy_effectiveness_evidence_v1.schema.json.claude/skills/agent-retrospective/schemas/fixtures/**.claude/skills/agent-retrospective/scripts/collect_snapshot.py.claude/skills/agent-retrospective/scripts/run_retrospective.py.claude/skills/agent-retrospective/scripts/validate_retrospective_schema.py.claude/skills/agent-retrospective/scripts/tests/**docs/dev/schema-governance.md(current governance が新 schema 登録を要求する場合)
既存 AGY producer schema の変更が不可避と判明した場合は、consumer 側で private shadow field を推測追加せず、scope delta を明示して別 follow-up Issue へ分割する。
Stop Conditions
- raw AGY/Claude transcript、prompt、response、tool arguments/results、credential、absolute path の永続化・GitHub publication が必要になる場合。
- AGY local session と wrapper/caller run を deterministic/bounded に相関できず、全 global history scan しか方法がない場合。
- token source semantics が treatment/control 間で一致せず、比較結果を再計算不能な場合。
- caller-side output adoption を evidence なしで model judgment だけにより確定する必要がある場合。
- canonical
agent_improvement_candidate/v1の breaking schema change が必要と判明した場合。 plugins/agent-retrospective/**への AGY dependency 導入が必要と判明した場合。- destructive operation、credential mutation、permission bypass が必要な場合。
Required Skills / References
.claude/skills/agent-retrospective/SKILL.md.claude/skills/agent-retrospective/references/wire-contract.md.claude/skills/agent-retrospective/references/execution-budget.md.claude/skills/gemini-cli-headless-delegation/references/usage-contract.md.claude/skills/gemini-cli-headless-delegation/references/runtime-portability.md.claude/skills/pr-review-judge/SKILL.mdの experimental-validity review 境界scripts/summarize_agent_transcript.pyの token metric extraction precedent- 実装: agent-retrospective に Latitude CLI runtime evidence enrichment を追加する #2375(runtime evidence enrichment precedent)
- 実装: agent-retrospective の codebase observer を role-specific contract で接続し、AGY operational failure 時の native fallback 結果を base_sha-bound な OBSERVER_RESULT_V1 へ正規化する #2374 / 実装: AGY advisory調査のfallback判定をdeterministic化し実wrapper smokeを追加する #2434(AGY fallback / recovery boundary)
- 導入: EntireCLI + Latitude の観測データを agent_run_report に接続し、GitHub 経由の ChatGPT レトロ動線を確立する #1153(private observation / public retrospective boundary。generic capture goal は本 Issue では完了扱いしない)
Delivery Rule
- 1 Issue = 1 PR。
- current main / current AGY contracts を実装開始時に再確認する。
- project Skill を先に実装し、optional plugin への port は必要なら別 Issue。
- retrospective の既存 proposal-only / public-safety / bounded execution contract を維持する。
- live verification unavailable は SKIP/incomplete とし、fallback success や fixture-only success を live PASS に変換しない。
Notes for Reviewer
- 本 Issue の「AGY success」は direct success を意味する。Claude Code fallback で最終 workflow が成功したケースを AGY success に数えない。
- output adoption は AGY local session log 単独では判定できない。caller-side Claude session evidence が必要。
- Claude token savings は AGY-assisted vs comparable no-AGY control が存在するときだけ「削減効果」と呼ぶ。control 無しは observational metric。
- local AGY transcript は有用だが private evidence plane に留め、public retrospective には digest / count / closed classification のみ渡す。
Activity