Skip to content

導入: ChatGPT改善検討用のAI作業ログレポートをGitHubに永続保存する #928

Closed
1 of 1 issue completed

Description

@squne121

Machine-Readable Contract

contract_schema_version: v1
issue_kind: parent
goal_ref: "AI agent の作業過程を ChatGPT が public-safe にレビューできる run report / retro index 層を GitHub 上へ永続保存する"
change_kind: workflow
parent_mode: "delivery-rollup"
closure_mode: "child-complete"

Summary

agent_session_manifest/v1 の provenance / validation / evidence index 役割は維持したまま、ChatGPT が AI エージェント運用改善を検討できる粒度の agent_run_report/v1 と agent_retro_index/v1 を追加する親トラッカー。

現行 manifest は metadata-first / full transcript は疑義発生時のみという設計で、Issue/PR/phase/token/evidence の索引には向く一方、prompt・読んだ資料・修正ループ・CI 失敗・human intervention・context pollution を横断的にレビューするには薄い。さらに GitHub public surface には raw transcript / local path / secret 類を出せず、現行 agent-session-manifest workflow artifact は 7 日保持の補助面に留まるため、public-safe に redaction された構造化作業レポートを Issue / PR comment に marker upsert で永続保存する新しい層が必要。

#246 は AI 駆動 session 記録 pilot smoke test の research issue であり、本親 Issue は pilot 可否そのものではなく、pilot を含む AI 作業の retrospective 用 report / index の schema・validator・script・GitHub 永続化・docs・workflow 統合を delivery-rollup する。agent_session_manifest/v1 を置き換えず、その根拠リンクを ChatGPT 改善検討に読ませる report 層を追加する。

Outcome

agent_session_manifest/v1 を public comment に出さない既存境界を維持したまま、public-safe な agent_run_report/v1 / agent_retro_index/v1 を生成・検証・upsert・参照できる child issue 群と handoff 契約が parent issue 上で固定されている。

Goal

Issue 起票から PR merge / follow-up Issue 作成までの AI 作業過程を、raw transcript を公開せずに GitHub 上へ永続保存し、人間が対象 Issue / PR に紐付く agent_run_report/v1 と agent_retro_index/v1 を読ませて ChatGPT に prompt / skill / hook / script / CI / context engineering / token 削減の改善相談を行える状態にする。

Desired Destination

  • docs/schemas/agent-run-report.schema.json と docs/schemas/agent-retro-index.schema.json が正本として追加されている
  • scripts/agent-logs/*.mjs と package.json scripts により run report 生成・GitHub marker upsert・retro index 更新・ChatGPT context export が再実行可能になっている
  • .github/workflows/agent-retro-index.yml が trusted context だけで retro index を再生成し、必要最小限の write permission だけで parent Issue comment を更新できる
  • docs/dev/agent-run-report.md と docs/dev/agent-retro-index.md に public-safe 運用手順と manifest との責務差分が明記されている
  • issue-refinement-loop / impl-review-loop / PR open / review correction / post-merge cleanup / follow-up issue creation が、作業完了時の run report finalize / posting / retro index 更新を handoff 契約として参照できる

Current Validated Scope

  • agent_session_manifest/v1 は provenance / validation / evidence index として継続利用し、置き換えない
  • GitHub public surface へ raw transcript、local absolute path、secret、private config を出さない public-safe redaction が必須
  • public comment に載せるのは manifest 本文ではなく redacted report / index のみであり、manifest への参照は digest / artifact ref / validation verdict などの opaque ref に限定する
  • artifact は補助用途に留め、永続正本は Issue / PR comment の marker upsert comment とする
  • #246 の smoke/policy 検証とは別 concern として、run report / retro index の docs drift cleanup、schema、validator、script、posting guard、workflow、docs、skill integration を扱う
  • EntireCLI は private/local 詳細ログ保管の補助としてのみ条件付き採用可能であり、public checkpoint branch や raw session push は許容しない

Decisions Fixed

  • 2026-06-15: agent_session_manifest/v1 は provenance / validation / evidence index として継続利用し、ChatGPT 改善検討用には新規 agent_run_report/v1 を追加する
  • 2026-06-15: public 永続正本は GitHub Issue / PR comment の marker upsert とし、manifest 本文は comment に出さない
  • 2026-06-15: report / index の public posting より前に、既存 docs 上で manifest と report/index の公開境界を固定する docs drift cleanup child を置く
  • 2026-06-15: child issue の依存順は docs drift cleanup -> schema/validator -> lifecycle scripts -> posting guard -> retro index workflow -> ChatGPT export -> docs/skill handoff -> EntireCLI safety checker とする
  • 2026-06-15: workflow permission は existing session-manifest.yml の read-only baseline と、必要 job にだけ write を付与する既存方針に合わせる

Quality Decision Record

Parent Closure Rule

  • delivery-rollup: 下記 Child Issues が依存順どおりに close され、親 Goal に対する Remaining Parent Gaps が なし になった時点で close する
  • quality-gate: N/A
  • routing-map: N/A
  • decision-log: N/A
  • quality-gate parent では closure_mode と Quality Decision Record を同一編集で更新する
  • 非 quality-gate parent の Quality Decision Record は N/A 扱いでよく、close 判定の必須材料にしない

Child Issues

Remaining Parent Gaps

  • manifest 本文禁止と public-safe report/index 許可の境界を既存 docs / policy 上で drift なく固定する
  • report schema の禁止パターンと invalid fixture を validator に落とし込む
  • GitHub public comment へ出せる JSON / markdown 形式と marker upsert 規約を exact match で固定する
  • merge 後 workflow から対象 Issue / PR を決定論的に辿る方法を固定する
  • skill / hook / script への統合順序と stop condition 追記位置を固定する
  • artifact を「secret-safe」ではなく「public-safe content に限る retention-limited 補助面」として明確化する

Phase Handoff Contract

  • Desired Destination
  • Current Validated Scope
  • Remaining Parent Gaps
  • Current Objective
  • Bounded Current Context
  • Normative References
  • Allowed Paths
  • Required Skills
  • Validation Commands
  • Stop Conditions
  • Open Questions
  • Next Action
  • Artifact Refs
  • Handoff Prompt Draft
  • Linked PR (implementation のみ)

Acceptance Criteria

  • AC1: parent issue として agent_run_report/v1 / agent_retro_index/v1 導入の決定事項、禁止事項、境界 (#246 との差分を含む) が固定されている
  • AC2: docs drift cleanup を含む child issue 分割先と依存順が定義されている
  • AC3: child issue が parent の Goal と Desired Destination をそのまま参照できる handoff 契約を持つ
  • AC4: public-safe 永続化の原則(manifest 本文非公開、raw transcript 非公開、local path 非公開、secret 非公開、artifact 補助・Issue/PR comment 正本)が parent issue 上で明文化されている
  • AC5: comment upsert / workflow permission / artifact boundary / EntireCLI conditional 採用の guardrail が child issue へ分解されている
  • AC6: close 条件が child-complete として固定され、quality-gate issue と混同しない

Verification Commands

# AC1
# baseline-expect: pass
$ gh issue view 928 --repo squne121/loop-protocol --json body --jq '.body | contains("manifest 本文は comment に出さない") and contains("raw transcript")'

# AC2
# baseline-expect: pass
$ gh issue view 928 --repo squne121/loop-protocol --json body --jq '.body | contains("docs: #928 導入前に session-recording policy と report公開境界の drift を解消する") and contains("agent_run_report/v1 / agent_retro_index/v1 schema・fixtures・public-safe validator") and contains("EntireCLI safety checker")'

# AC3
# baseline-expect: pass
$ gh issue view 928 --repo squne121/loop-protocol --json body --jq '.body | contains("## Phase Handoff Contract") and contains("Desired Destination") and contains("Linked PR")'

# AC4
# baseline-expect: pass
$ rg -n "agent_session_manifest_allowed|raw_transcript_allowed|source_kind_prohibited|private_artifact" docs/dev/session-recording-policy.md docs/dev/onboarding/session-recording-tool.md docs/schemas/agent-session-manifest.md

# AC5
# baseline-expect: pass
$ gh issue view 928 --repo squne121/loop-protocol --json body --jq '.body | contains("exact marker match") and contains("issues: write") and contains("pull-requests: write") and contains("conditional 採用")'

# AC6
# baseline-expect: pass
$ gh issue view 928 --repo squne121/loop-protocol --json body --jq '.body | contains("child-complete") and contains("delivery-rollup") and contains("close する")'

Allowed Paths

  • GitHub Issue 本文・comment の作成/更新
  • .claude/tmp/issue928_refined_body.md のような起票用一時ファイル
  • docs/dev/session-recording-policy.md
  • docs/dev/onboarding/session-recording-tool.md
  • docs/schemas/agent-session-manifest.md
  • .github/workflows/session-manifest.yml
  • child issue 起票時に参照する docs / schemas / scripts / workflow / skill path の列挙のみ(この parent 自体では repo 本体の実装変更を行わない)

Runtime Verification Applicability

  • decision: not_applicable
  • reason: 本 Issue は delivery-rollup parent であり、runtime 実行そのものではなく child issue の分割・境界固定・handoff 契約の確定を成果物とする

Notes

  • session-manifest.yml の artifact retention 7 日は現行 manifest workflow の事実であり、report/index の retention 設計は child issue で別途固定する
  • comment upsert は list -> exact marker match -> 0件 create / 1件 update / 2件以上 fail closed を child issue の必須仕様とする
  • workflow write permission は top-level read-only baseline を維持しつつ、必要 job にだけ issues: write / pull-requests: write を付与する
  • deploy-pages.yml の marker comment update パターンを、agent-run-report posting guard 設計の前例として参照してよい
  • ChatGPT に読ませる対象は raw transcript ではなく、redacted された structured report / retro index / evidence link / friction signal とする

Sub-issues

Sub-issues

1 of 1 Issues completed
Loading 1 sub-issues

Activity

  1. added
    tracking
    state/in-progress
    workflow
    process
    area/ai-ops
    on Jun 15, 2026
  2. squne121 commented on Jun 15, 2026

    @squne121
    OwnerAuthor

    結論

    #928 の方向性は妥当です。agent_session_manifest/v1 を provenance / validation / evidence index として残し、その上に ChatGPT へ読ませる agent_run_report/v1 と agent_retro_index/v1 を追加する、という責務分離は正しいです。#928 本文も「raw transcript 非公開」「local path 非公開」「secret 非公開」「Issue / PR comment を永続正本」「artifact は補助」という原則を明示しています。

    ただし、現状の #928 はこのまま implementation issue に落とすと false green / public leak / comment upsert drift / workflow permission overreach を起こしやすいです。#928 自体にはコメントがまだ無く、本文上の設計をそのまま精査対象にする必要があります。

    最重要の敵対的指摘はこれです。既存の session recording policy と PR #426 は、agent_session_manifest 本文を workflow log / Issue comment / PR comment / git commit / stdout に出すことを明示的に禁止しています。一方 #928 は run report / retro index を Issue / PR comment に永続保存する方針です。この2つは矛盾ではありませんが、manifest JSON を comment に出すな、public-safe report/index だけを comment に出せ、という境界を schema・validator・posting guard で機械的に固定しないと危険です。

    参照した関連 Issue / PR / コメント

    #928 は delivery-rollup parent で、agent_session_manifest/v1 を置換せず、ChatGPT 改善検討用に agent_run_report/v1 と agent_retro_index/v1 を足す設計です。Desired Destination には schema、scripts、GitHub upsert、retro index workflow、docs、skill handoff、EntireCLI safety が含まれています。

    #246 は別 concern です。#246 は session recording pilot smoke test であり、authoritative producer / negative control / Kill Switch / secret scan / metrics strictness により「AI が自分で manifest を書いて成功に見せる」false green を防ぐ契約です。#928 はその pilot 自体ではなく、pilot を含む AI 作業を後からレビューする report / index 層です。

    #246 のコメントでは、#326 / #377 / #378 / #379 / #380 などが揃うまで pilot 開始不可、各 phase で agent_session_manifest/v1 を記録、token / latency / human intervention は実測可能なもののみ、public GitHub comment に raw transcript / local file / secret-bearing artifact を載せない、という前提が同期されています。

    #136 は元の導入判断 Issue で、AI agent が AC を読んだか、test-runner SubAgent を呼んだか、SKIP exit 0 を黙認したか、PR body を全面置換したか、token/context 圧迫があったかを後から検証できない、という問題意識を起点にしています。

    PR #314 は agent_session_manifest/v1 の JSON Schema Draft 2020-12 SSOT、valid/invalid fixtures、tests を導入した PR です。public comment 時に transcript / local_file evidence を禁止する制約、4 backticks fence、token unavailable を 0 偽装しないルールなどが REQUEST_CHANGES 対応として入っています。

    PR #426 は hook wrapper と CI workflow を導入し、manifest を artifact に書くが stdout / workflow log / Issue / PR comment / git commit へ出さない方針を明文化しています。ここが #928 の設計境界に直結します。

    敵対的レビュー

    Blocker 1: 「Issue / PR comment 永続正本」と既存 manifest 禁止方針の境界が未固定

    #928 は public 永続正本を GitHub Issue / PR comment の marker upsert としています。一方、既存 policy は manifest 本文の Issue / PR comment 出力を禁止しています。

    これは「manifest は出さないが、redacted report/index は出す」という設計にすれば成立します。しかし #928 の child 分割では、その境界がまだ enforcement まで落ちていません。agent_run_report/v1 が manifest JSON、command output、prompt全文、読んだ資料の長文引用、CI log 抜粋を取り込み始めると、実質的な transcript/comment leak になります。

    修正方針は、schema に public_surface_kind: github_issue_comment | github_pr_comment と public_safety.redaction_status: clean を必須化し、raw_transcript, transcript_excerpt, local_path, absolute_path, secret_value, full_command_output, full_prompt を field 名としても値としても invalid にすることです。manifest への参照は manifest_refs[] の URL / artifact id / digest / schema / validation verdict だけに限定すべきです。

    Blocker 2: comment upsert が未設計だと idempotency が壊れる

    GitHub CLI の gh issue comment --edit-last は「現在ユーザーの最後のコメント」を編集する機能であり、marker-addressed upsert ではありません。(GitHub CLI)

    #928 の用途では、必ず REST API で comments を list し、marker を検索し、comment ID を指定して update する実装に寄せるべきです。GitHub REST は Issue comment / PR comment の update endpoint を持ち、PR も issue として扱われます。更新には Issues write または Pull requests write permission が必要です。([GitHub Docs]2)

    必須仕様は次です。

    <!-- agent_run_report:v1 repo=squne121/loop-protocol issue=928 run_id=arr-... sha256=... -->

    この marker を1コメントに1つだけ置き、list → exact marker match → 0件なら create、1件なら update、2件以上なら fail closed。--edit-last や「本文 grep でなんとなく最後を更新」は禁止です。

    Blocker 3: public-safe validator が現状の manifest validator より強くないと漏れる

    既存 agent-session-manifest-validation.mjs の secret pattern は /home/, /Users/, /tmp/, .env, sk-, gh[pousr]_, private key, expanded env assignment などを検出しますが、coverage は限定的です。

    一方、現行 workflow 側は github_pat_ や 40-hex token-like string も grep しています。

    #928 の report posting guard は、manifest validator の流用だけでは不足です。少なくとも github_pat_, AKIA, BEGIN OPENSSH PRIVATE KEY, Windows path, C:\, file://, .env.local, .claude/settings.local.json, VITE_.*(SECRET|TOKEN|KEY|PASSWORD|PRIVATE), long base64/hex, markdown fence breakout, duplicate HTML marker を invalid fixture に入れるべきです。#928 本文も raw transcript / local path / secret 類を禁止していますが、validator の負例に落とさない限り品質保証になりません。

    Blocker 4: workflow permissions が未固定

    GitHub Actions の permissions は top-level / job-level で指定でき、未指定 permission は none になります。また pull_request_target は fork 由来の PR でも read/write token になり得るため、comment write workflow では避けるべきです。([GitHub Docs]3)

    #928 の .github/workflows/agent-retro-index.yml は、read-only artifact 生成と write-comment upsert を分離した方が安全です。post-merge または workflow_dispatch の trusted context だけで issues: write / pull-requests: write を job-level 付与し、contents: write や secrets.* は不要にするべきです。GitHub docs 上も issue comment には issues: write が必要です。([GitHub Docs]4)

    High 1: artifact を “private” と呼ぶと誤解が残る

    既存 docs は public repo の GitHub Actions artifact は REST API 経由で誰でも download 可能であり、「private artifact」は secret safety を意味しない、と明記しています。

    GitHub artifact の retention は public repo では設定範囲が制限され、actions/upload-artifact の retention-days も repository / organization / enterprise の上限を超えられません。([GitHub Docs]5) ([GitHub Docs]6)

    したがって #928 は artifact を「補助」「短期」「public-safe content only」と明記するだけでなく、artifact_id, artifact_url, artifact_digest, expires_at, retention_days を report/index に記録し、永続正本は comment marker だけ、と固定すべきです。upload-artifact は artifact digest などの output を持つため、digest を report に入れる設計ができます。([GitHub]7)

    High 2: retro index の対象 Issue / PR 解決が未決定

    #928 の Remaining Parent Gaps に「merge 後 workflow から対象 Issue / PR を決定論的に辿る方法」が残っています。ここを曖昧にすると、merge 後に別 Issue へ report が紐付く、関連 PR が欠落する、follow-up issue が index に入らない、という drift が起きます。

    推奨順序は、Linked PR field → PR body の Closes #N → branch naming convention → parent issue body の explicit refs → GitHub API の linked issue 情報、です。複数候補なら自動 merge-index 更新を fail closed にして、ambiguous_targets[] として parent comment に記録すべきです。

    High 3: Claude / Codex hook を security boundary として扱ってはいけない

    既存 docs は Codex の PreToolUse / PermissionRequest を予防層であり security boundary ではない、canonical final gate は post-run verifier と private artifact validation に置く、と明記しています。

    Claude Code hooks は Stop / SubagentStop / PreToolUse などで exit code 2 による block ができますが、hook input には transcript path なども含まれます。設計上、report generator が transcript path を読みに行かないことを schema / tests / wrapper で固定する必要があります。([Claude Code]8)

    Codex 側は hook coverage / dispatch の不安定性が issue として出ており、repo docs も live smoke を diagnostic-only としています。 ([GitHub]9)

    Medium: docs drift が既にある

    現行 agent-session-manifest.schema.json と producer は ci:<producer_slug>:<run_id>:<run_attempt> の phase_instance_id を受け付けます。

    しかし session-recording-policy の古い記述には、CI では raw ci:<workflow>:<run_id>:<run_attempt> が current schema / validator で受け付けられない、という記述が残っています。

    #928 実装前に、既存 policy docs の drift cleanup child を1本足すべきです。これを放置すると、新 report schema の phase_instance_id や retro index の join key がまた揺れます。

    Medium: EntireCLI は conditional のままにすべき

    EntireCLI 公式情報では、AI coding sessions の transcript / prompt / file changes / token / tool calls を捕捉し、checkpoint metadata を entire/checkpoints/v1 に保存し、通常の git push 時に checkpoint branch を push する挙動があります。([docs.entire.io]10)

    公式 README でも、public repo では sessions が誰でも見える可能性、redaction は best-effort、temporary shadow branches に未 redacted data が残り得ること、--local, --skip-push-sessions, --checkpoint-remote, --telemetry=false, strategy_options.push_sessions などの設定が説明されています。([GitHub]11)

    既存 onboarding も Hook-based metadata ledger を Adopt、EntireCLI local/private/no-push 構成を Conditional、public checkpoint 構成を Reject としています。

    したがって #928 の EntireCLI child は「導入」ではなく「unsafe 設定検出時に report posting / index update を fail closed する checker」として扱うべきです。

    高品質化した設計案

    agent_run_report/v1 は、GitHub public comment に出せる レビュー用要約 だけにします。必須 field は schema, run_id, target, time_range, phase, actor, authority, prompt_summary_redacted, docs_read_refs, issue_pr_refs, files_touched_summary, commands_summary, ci_review_loops, human_intervention, token_usage, context_pollution_signals, friction_signals, evidence_refs, manifest_refs, public_safety, known_data_gaps, follow_up_candidates がよいです。

    agent_retro_index/v1 は、run report を横断検索するための index に限定します。必須 field は schema, index_id, repository, generated_at, source_scope, entries[], orphan_reports[], ambiguous_links[], generation_verdict, public_safety, source_comment_refs がよいです。entry は issue, pr, merge_sha, report_comment_url, manifest_artifact_refs, follow_up_issues, tags, friction_summary, quality_signals までに止めます。

    posting は post-agent-run-report.mjs と upsert-github-marker-comment.mjs に分けます。前者は schema / redaction / max-size validation を担当し、後者は GitHub comment API の list / create / update だけを担当します。これにより、GitHub write 権限を持つ script の責務を狭くできます。

    推奨 Child Issues 草案

    Child 0 — docs: #928 導入前に session-recording policy と report公開境界の drift を解消する

    Parent: #928
    Goal: agent_session_manifest は Issue / PR comment に出さないが、agent_run_report / agent_retro_index は public-safe validator 通過後に comment 永続化できる、という境界を既存 docs 上で明文化する。

    Allowed Paths

    • docs/dev/session-recording-policy.md
    • docs/dev/onboarding/session-recording-tool.md
    • docs/schemas/agent-session-manifest.md
    • 必要なら docs/dev/schema-governance.md

    Acceptance Criteria

    • AC1: manifest body と run report / retro index の public surface 方針が別物として説明されている。
    • AC2: Issue / PR comment への manifest 本文出力禁止 は維持されている。
    • AC3: agent_run_report/v1 / agent_retro_index/v1 は schema + redaction validator + marker upsert guard 通過時のみ public comment 可、と明記されている。
    • AC4: phase_instance_id の CI-native 記述 drift が現行 schema / workflow と一致している。
    • AC5: private artifact という語を「非 comment / retention-limited surface」であり secret-safe ではない、と再定義している。

    Validation Commands

    pnpm lint:docs
    rg -n "agent_run_report|agent_retro_index|Issue / PR comment|manifest 本文" docs/dev/session-recording-policy.md docs/dev/onboarding/session-recording-tool.md
    rg -n "ci:<producer_slug>|phase_instance_id" docs/dev/session-recording-policy.md docs/schemas/agent-session-manifest.md

    Child 1 — 実装: agent_run_report/v1 / agent_retro_index/v1 schema・fixtures・public-safe validator を追加する

    Parent: #928
    Goal: ChatGPT 改善レビューに必要な作業要約と retro index を、raw transcript / local path / secret を含めず validation できる SSOT schema と validator に落とす。

    Allowed Paths

    • docs/schemas/agent-run-report.schema.json
    • docs/schemas/agent-retro-index.schema.json
    • docs/schemas/examples/agent-run-report/**
    • docs/schemas/examples/agent-retro-index/**
    • scripts/lib/agent-run-report-validation.mjs
    • scripts/check-agent-run-reports.mjs
    • tests/agent-run-report*.test.ts

    Acceptance Criteria

    • AC1: 両 schema は JSON Schema Draft 2020-12、additionalProperties: false、$defs ベースで定義されている。
    • AC2: raw_transcript, transcript_excerpt, local_path, absolute_path, secret_value, full_command_output, full_prompt が public report で invalid。
    • AC3: authority は authoritative | derived | non_authoritative を持ち、AI self-report は non_authoritative 以外にできない。
    • AC4: token_usage.availability: unavailable の場合、数値 field は null。0 偽装は invalid。
    • AC5: invalid fixtures に /home/, /Users/, C:\, file://, .env.local, .claude/settings.local.json, ghp_, github_pat_, sk-, AKIA, private key, VITE_SECRET_KEY, duplicate marker, fence breakout が含まれる。
    • AC6: validator は public comment posting 用 mode では --allow-local-path のような escape hatch を持たない。
    • AC7: pnpm agent-run-report:check が explicit target 0件を fail し、default target 0件 only の silent green を出さない。

    Validation Commands

    pnpm test -- --run tests/agent-run-report*.test.ts
    pnpm agent-run-report:check docs/schemas/examples/agent-run-report/valid/*.json
    ! pnpm agent-run-report:check docs/schemas/examples/agent-run-report/invalid/*.json
    pnpm lint
    pnpm typecheck

    Child 2 — 実装: agent run lifecycle scripts と package scripts を追加する

    Parent: #928
    Goal: run 開始・終了・report finalize・local artifact 生成を deterministic に行う CLI を追加する。

    Allowed Paths

    • scripts/agent-logs/start-agent-run.mjs
    • scripts/agent-logs/finalize-agent-run.mjs
    • scripts/agent-logs/lib/**
    • package.json
    • tests/agent-logs/**
    • docs/schemas/examples/agent-run-report/**

    Acceptance Criteria

    • AC1: start-agent-run.mjs は run_id, target issue/pr, phase, actor, start time を含む local draft を atomic write する。
    • AC2: finalize-agent-run.mjs は manifest refs / evidence refs / command summaries / CI summaries / human intervention / known data gaps を取り込み、agent_run_report/v1 を生成する。
    • AC3: transcript file path を受け取っても本文を読まない。private/local transcript 参照は opaque ref のみ。
    • AC4: command output は full output を保存せず、command name / exit code / summarized result / artifact ref のみ。
    • AC5: stdout に report JSON を出さない。明示 --output のみ許可。
    • AC6: generated report は Child 1 validator を通る。
    • AC7: package.json に agent-run:start, agent-run:finalize, agent-run:check が追加されている。

    Validation Commands

    pnpm agent-run:start --issue 928 --phase impl --actor ai_agent --output tmp/agent-runs/demo-start.json
    pnpm agent-run:finalize --input tmp/agent-runs/demo-start.json --output tmp/agent-runs/demo-report.json
    pnpm agent-run:check tmp/agent-runs/demo-report.json
    pnpm test -- --run tests/agent-logs

    Child 3 — 実装: GitHub Issue / PR marker upsert と public-safe posting guard を追加する

    Parent: #928
    Goal: agent_run_report/v1 を GitHub Issue / PR comment に idempotent に upsert する。gh issue comment --edit-last 依存は禁止。

    Allowed Paths

    • scripts/agent-logs/post-agent-run-report.mjs
    • scripts/agent-logs/upsert-github-marker-comment.mjs
    • scripts/agent-logs/lib/github-comments.mjs
    • tests/agent-logs/github-comment-upsert*.test.ts
    • package.json

    Acceptance Criteria

    • AC1: marker format が固定されている。

      <!-- agent_run_report:v1 repo=squne121/loop-protocol issue=<N> pr=<N|null> run_id=<id> sha256=<digest> -->
    • AC2: upsert は comments list → exact marker search → 0件 create / 1件 update / 2件以上 fail closed。

    • AC3: marker が user-provided markdown 内に混入しても、script が自前 marker 以外を信頼しない。

    • AC4: report body は validator + redaction scanner + max byte limit を通過しないと post しない。

    • AC5: max body size を固定し、超過時は summary を縮約するか fail closed する。

    • AC6: dry-run mode は GitHub API write を行わず、予定 marker / target / digest だけを出す。

    • AC7: tests は mocked REST response で create / update / duplicate marker / permission failure / 422 validation failure を検証する。

    Validation Commands

    pnpm test -- --run tests/agent-logs/github-comment-upsert*.test.ts
    pnpm agent-run:post --report tmp/agent-runs/demo-report.json --target-issue 928 --dry-run

    Child 4 — 実装: agent_retro_index/v1 builder と post-merge workflow を追加する

    Parent: #928
    Goal: merged PR / Issue / run report / manifest artifact / follow-up issue を横断参照する retro index を deterministic に再生成し、parent Issue comment に marker upsert する。

    Allowed Paths

    • scripts/agent-logs/update-retro-index.mjs
    • scripts/agent-logs/lib/retro-index*.mjs
    • .github/workflows/agent-retro-index.yml
    • tests/agent-logs/retro-index*.test.ts
    • package.json

    Acceptance Criteria

    • AC1: agent_retro_index/v1 は Child 1 schema を通る。
    • AC2: PR → Issue 解決順序が固定されている: explicit Linked PR / Closes #N / branch pattern / parent issue refs / API linked data。
    • AC3: 複数候補・未解決候補は ambiguous_links[] / orphan_reports[] に入り、index generation verdict は partial になる。
    • AC4: workflow は workflow_dispatch と trusted post-merge context のみ。pull_request_target は使わない。
    • AC5: top-level permissions: {}、job-level に必要最小限の contents: read, issues: write, pull-requests: write のみ。
    • AC6: artifact は補助生成のみ。永続正本は parent issue の marker comment。
    • AC7: workflow log に report / index 本文を cat しない。
    • AC8: generated index の digest と source comment refs が記録される。

    Validation Commands

    pnpm test -- --run tests/agent-logs/retro-index*.test.ts
    pnpm agent-retro:update --parent-issue 928 --dry-run
    pnpm lint

    Child 5 — 実装: export-chatgpt-context.mjs を追加し ChatGPT投入用 context bundle を生成する

    Parent: #928
    Goal: parent issue、retro index、選択 run reports、関連 evidence refs から、ChatGPT に投入しやすい public-safe markdown bundle を生成する。

    Allowed Paths

    • scripts/agent-logs/export-chatgpt-context.mjs
    • scripts/agent-logs/lib/chatgpt-context*.mjs
    • tests/agent-logs/chatgpt-context*.test.ts
    • docs/dev/agent-run-report.md

    Acceptance Criteria

    Validation Commands

    pnpm test -- --run tests/agent-logs/chatgpt-context*.test.ts
    pnpm agent-retro:export-chatgpt --parent-issue 928 --max-chars 30000 --dry-run

    Child 6 — docs: agent-run-report.md / agent-retro-index.md と skill handoff を整備する

    Parent: #928
    Goal: issue-refinement-loop / impl-review-loop / PR open / review correction / post-merge cleanup / follow-up issue creation の handoff 契約に run report finalize / posting / retro index update を組み込む。

    Allowed Paths

    • docs/dev/agent-run-report.md
    • docs/dev/agent-retro-index.md
    • .claude/skills/**
    • .codex/**
    • CLAUDE.md
    • AGENTS.md

    Acceptance Criteria

    • AC1: agent_session_manifest, agent_run_report, agent_retro_index の責務差分が表で説明されている。
    • AC2: 各 phase の Stop Conditions に report finalized, public-safe check pass, posting dry-run or upsert done が追加されている。
    • AC3: review correction loop では、CI failure / human correction / reviewer comment を report の ci_review_loops[] / human_intervention に反映する手順がある。
    • AC4: follow-up issue creation では、follow_up_candidates[] から child/follow-up issue を起票するか、起票しない理由を記録する。
    • AC5: Codex hook は diagnostic/prevention であり、post-run verifier が canonical gate であることを明記する。

    Validation Commands

    pnpm lint:docs
    rg -n "agent_run_report|agent_retro_index|report finalized|public-safe" docs .claude AGENTS.md CLAUDE.md

    Child 7 — 実装: EntireCLI safety checker と conditional adoption guard を追加する

    Parent: #928
    Goal: EntireCLI を使う場合でも public checkpoint branch / session auto-push / telemetry / unknown config を検出して、report posting と retro index update を fail closed する。

    Allowed Paths

    • scripts/agent-logs/check-entirecli-safety.mjs
    • scripts/agent-logs/lib/entirecli-safety*.mjs
    • tests/agent-logs/entirecli-safety*.test.ts
    • docs/dev/agent-run-report.md
    • package.json

    Acceptance Criteria

    • AC1: EntireCLI 未使用時は not_applicable verdict を出す。
    • AC2: EntireCLI 使用時は entire version, entire enable --help, entire configure --help などの available surface を記録する。
    • AC3: push_sessions: false / --skip-push-sessions / --local / --telemetry=false / checkpoint remote private verified を確認できない場合は fail closed。
    • AC4: entire/checkpoints/v1, entire/*, *checkpoint*, *session* remote branch を検査する。
    • AC5: local refs, .entire/, commit trailers, git pushurl, insteadOf, pushInsteadOf, checkpoint token env presence を検査する。
    • AC6: public repo への checkpoint / session push 経路が1つでも見つかれば blocked。
    • AC7: checker の verdict は agent_run_report.public_safety.entirecli_safety に取り込める。
    • AC8: fixture で safe / public branch / pushurl rewrite / unknown visibility / telemetry enabled / token present を検証する。

    Validation Commands

    pnpm test -- --run tests/agent-logs/entirecli-safety*.test.ts
    pnpm entirecli:safety --dry-run
    pnpm security:session-recording

    親 #928 の Child Issues 欄はこう直すのがよい

    現在の6本は方向性としてはよいですが、実装リスクに対して粒度が粗いです。特に schema, posting, workflow, ChatGPT export, EntireCLI safety, docs/skill は責務を分けるべきです。

    推奨順序は次です。

    1. Child 0: 既存 policy drift cleanup
    2. Child 1: schema / fixtures / validator
    3. Child 2: local lifecycle scripts
    4. Child 3: GitHub marker upsert
    5. Child 4: retro index builder / workflow
    6. Child 5: ChatGPT context export
    7. Child 6: docs / skill handoff
    8. Child 7: EntireCLI safety checker

    この順序なら、public write 権限を持つ処理を schema / validator 完成後に実装できます。逆に、workflow や comment upsert を先に作ると、validator 不備のまま public surface へ書けてしまいます。

  3. squne121 commented on Jun 15, 2026

    @squne121
    OwnerAuthor

    更新内容

    • Issue 導入: ChatGPT改善検討用のAI作業ログレポートをGitHubに永続保存する #928 の本文を /home/squne/projects/LOOP_PROTOCOL/.claude/tmp/issue928_refined_body.md と一致する形に更新しました
    • ## Outcome を追加しました
    • docs drift cleanup child を先頭に置き、child 順序を固定しました
    • ## Runtime Verification Applicability を追加しました
    • Verification Commands の unsafe な複合シェル形を除去した現行 draft に合わせました

    確認結果

    • check_vc_scope.py: PASS
    • guard-issue-body.py: PASS
    • contract_readiness_check.py --mode preflight-static: status go

    備考

    • タイトルは変更していません
  4. squne121 commented on Jun 15, 2026

    @squne121
    OwnerAuthor

    Refinement Loop: Approved

    The issue has been approved and is ready for implementation.

  5. squne121 commented on Jun 22, 2026

    @squne121
    OwnerAuthor

    全 8 件の child Issue(#934〜#941)がクローズ完了。#941(EntireCLI safety checker)のマージにより全 delivery が揃ったため、parent #928 をクローズします。

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

    area/ai-opsprocessstate/in-progresstrackingworkflow

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions