Repository navigation
Description
Machine-Readable Contract
contract_schema_version: v1
issue_kind: implementation
parent_issue: "#2562"
goal_ref: "Connect structured workflow facts to Task Context without Issue/PR split-brain; keep post-merge cleanup resumable."
change_kind: workflow
dedupe_key: "task-context-v1:workflow-signals-ref-equivalence"Parent Issue
Parent Goal Ref
- Deliver 導入: Herdr / Claude Code Task Contextで安定識別・誤操作防止・Attention Managementを実現する #2562's Task Context outcome: stable identity, safe operator behavior, and attention management across Issue and implementation-PR work.
- This issue integrates trusted workflow facts with Task Context so one canonical Task represents related Issue/PR work and a merged PR awaiting cleanup remains resumable.
Current Validated Scope
- 実装: Task Context v1のSQLite registry・schema・typed internal APIを追加する #2563 provides the SQLite registry, typed internal API, historical Activities, and the single
BEGIN IMMEDIATEmutation pattern inscripts/task-context/task_context_service.py. - 実装: Native Claude operatorにTask Context hooks・wrong-session guard・statusLine/Herdr projectionを配線する #2564 provides hook binding/guard semantics and session-to-binding lookup.
task_contextctl.py signal_applystill accepts caller-selected target identifiers and must be replaced. - 実装: Herdr Tab label を短縮し statusLine の情報密度を増やす #2634 / PR feat: Herdr Tab label を短縮し statusLine の情報密度を増やす #2640 own and implement statusLine/Herdr presentation. This issue must not redefine that presentation.
- Workflow-to-Task-Context signal producers and physical event dedupe are not implemented.
Remaining Parent Gaps
- Implement workflow producers and the controlled signal service.
- Replace direct caller target identifiers with adapter-supplied session origin and service-side canonical Task resolution.
- Implement the decided
pr_merged_observedproducer/commit point and post-merge cleanup lifecycle ordering. - Add physical dedupe and producer-side GitHub relation snapshots without network I/O in
UserPromptSubmit.
Depends On
- 実装: Task Context v1のSQLite registry・schema・typed internal APIを追加する #2563 — registry, signal API, and ref claims (closed)
- 実装: Native Claude operatorにTask Context hooks・wrong-session guard・statusLine/Herdr projectionを配線する #2564 — operator Task/Activity transition integration (closed)
Outcome
Only structured workflow facts can change completion state. A canonical Task prevents Issue/PR split-brain; a merged PR remains CLEANUP_PENDING until the eligible cleanup Activity completes.
In Scope
- Implement one coarse-grained
apply_workflow_signal()service operation inscripts/task-context/task_context_service.py. It validates the public envelope and evidence, resolves the origin and canonical Task, performs claim/Task validation and accepted-fact dedupe in the required order, selects the signal's fixed historical Activity semantics, makes a monotonic transition when eligible, appends the event, and enqueues projection in oneBEGIN IMMEDIATEtransaction. External I/O occurs before that transaction. - For
implementation_pr_observed, after legal canonical Task resolution,apply_workflow_signal()is the sole owner, in that transaction, of Issue/PR claim validation and attachment, fact dedupe, event append, and projection enqueue. It validates that both claims can legally attach before mutating either claim; a duplicate or conflict leaves no partial claim mutation.open-prsupplies only validated facts and origin. - Define the public
task-contextctl signal applyv1 payload as exactly four top-level fields:signal_kind,source,source_schema_version, andevidence. All required top-level values exceptevidenceare JSON strings;evidenceis a JSON object. Reject caller input containingsession_id,task_id,activity_id, orbinding_id. The CLI adapter readsCLAUDE_CODE_SESSION_IDand passes it only as internalorigin_session_id; hook adapters map hook JSONsession_idto that field. A non-Claude invocation with no origin returnsdeferred/unboundwithout state mutation. Do not make/clearID rotation a guarantee of this contract. - Use origin only to resolve canonical Task (
origin_session_id → open ExecutionRun → Binding → canonical Task), never to choose the current Activity. The service uses fixed historical phase semantics:refinement_approvedaffects only refine;implementation_pr_observedrecords implementation evidence/claim only and never terminalizes;pr_merged_observedaffects only implementation;cleanup_completedaffects only cleanup. Delayed or replayed signals cannot terminalize another phase or regress state. - Connect
issue-refinement-loop's canonical approved termination/handoff publish torefinement_approved; do not derive completion from raw natural-language text. Connectopen-pr(new andEXISTING=truedetected PR) toimplementation_pr_observed;DRY_RUN=truesends no signal. Adapter outcomes never roll back successful producer work. post-merge-cleanupis the only v1 producer ofpr_merged_observed. Its normative order is: (1) obtain and validate a fresh merged-PR snapshot; (2) applypr_merged_observed; (3) confirmapplied, or confirmduplicate_nooponly for a valid envelope/evidence bound to the same canonical Task and same business fact; (4) only then select, resume, or start cleanup Activity; (5) dispatch worker/work.deferred,conflict,rejected_envelope,rejected_evidence,late_noop, and any other rejected outcome select/resume/start no Activity and dispatch no work in that invocation.- After an accepted merge prerequisite, the post-merge-cleanup main orchestrator is the durable lifecycle owner: in one service transaction it creates, resumes, or selects the sole eligible nonterminal cleanup Activity bound to the same Task, PR, and merge identity, and persists an internal append-only
cleanup_startedevent containing that Activity ID and merge identity. The public v1 envelope and evidence never expose a cleanup Activity handle, and no caller selects one. On final success,cleanup_completeduses its fresh origin to resolve the Task and uses validated evidence to deterministically locate and verify that sole internal Task/PR/merge instance; it cannot create, select, or complete cleanup merely because a PR is merged. Missing instance or Task/PR/merge mismatch is an explicit non-mutating outcome. If cleanup has already begun without an accepted merged fact, a laterpr_merged_observedreturns non-mutatinglate_noop/CLEANUP_ALREADY_BEGUN; it is not a success precondition and does not roll back external work. A replay of the same accepted merged fact first takes origin-first same-Task dedupe and then satisfies the cleanup precondition. - Before
open-premitsimplementation_pr_observed, producers obtain a fresh GitHub PR snapshot and run a total claimless-relation classifier usingclosingIssuesReferences(first: 2, excludeUserLinked: false, userLinkedOnly: false). Exactly one reference proceeds only when it equals the candidate Issue; only that validated matching relation may reach the service's atomic claim attachment. Zero returns named non-mutatingdeferred/NO_LINK; exactly one mismatching reference returnsconflict/RELATION_ISSUE_MISMATCH; and two-or-more references returnconflict/MULTIPLE_CLOSING_ISSUES; each emits no signal and performs no Task Context mutation. Snapshot fetch failure, GraphQL errors, partial or timeout responses, and null or malformed relation connection or nodes normalize todeferred/RELATION_UNAVAILABLE, with no signal, mutation, or claim attachment.first: 2is a bounded classifier, not a claim of complete enumeration; generic text, branch/worktree references, andRefs #Nalone are never equivalence authority. - Keep
UserPromptSubmitlocal-only. It performs local claim lookup only; a PR claim miss passes the prompt through without GitHub relation or merged-state lookup and without Task Context mutation. - Add nullable
events.dedupe_keyand the minimal partial UNIQUE index. Dedupe identity issignal_kindplus business fact identity only: refinement=repo+issue+approved_body_sha256; implementation=repo+PR; merged=repo+PR+merge_commit_oid; cleanup=repo+PR+merge_identity. Keepsourceandsource_schema_versionas event metadata, not identity. Same fact resolved to another Task is a typed identity conflict; no new ledger/framework. - Preserve existing 実装: Native Claude operatorにTask Context hooks・wrong-session guard・statusLine/Herdr projectionを配線する #2564 bind/rebind guards. A different active primary Task is advisory/conflict and never silently retargets claims or directly signals another Task. Multiple closing Issues, multiple implementation PRs for one Issue, and substantive duplicate Tasks are conflicts, not auto-merge candidates.
- Derive and expose
CLEANUP_PENDINGfor an open Task with an accepted merged implementation and incomplete eligible cleanup; a later ordinary cleanup prompt for the same Issue/PR resumes the existing Task rather than creates another. - Retain
docs/dev/task-context.mdas an implementation design reference and permitted documentation path.
Public v1 Envelope, Evidence, and Origin Contract
The public v1 envelope has exactly these four top-level fields and no others:
| Field | Required JSON type and allowed value |
|---|---|
signal_kind |
string enum: refinement_approved, implementation_pr_observed, pr_merged_observed, cleanup_completed |
source |
string enum: issue-refinement-loop, open-pr, post-merge-cleanup |
source_schema_version |
exactly the JSON string v1 |
evidence |
object, strict per signal below |
The v1 kind/source pairs are exact: refinement_approved→issue-refinement-loop; implementation_pr_observed→open-pr; pr_merged_observed→post-merge-cleanup; cleanup_completed→post-merge-cleanup. Future producers or envelope forms require a schema/contract revision. A duplicate-detecting JSON decoder runs before ordinary schema validation. Every envelope-level failure is non-mutating with disposition: rejected_envelope, never conflict; evidence validation uses the separate rejected_evidence disposition. The fixed envelope reason enum is:
| Condition | rejected_envelope reason |
|---|---|
| Malformed JSON | MALFORMED_JSON |
| Non-object root | NON_OBJECT_ROOT |
| Duplicate top-level member | DUPLICATE_TOP_LEVEL_MEMBER |
| Missing or unknown top-level field | UNKNOWN_TOP_LEVEL_FIELD |
| Wrong top-level type | WRONG_TOP_LEVEL_TYPE |
Unknown signal_kind |
UNKNOWN_SIGNAL_KIND |
Unknown source |
UNKNOWN_SOURCE |
| Invalid kind/source pair | SOURCE_SIGNAL_MISMATCH |
source_schema_version other than exact JSON string v1 |
UNSUPPORTED_SCHEMA_VERSION |
Caller supplies session_id, task_id, activity_id, or binding_id |
FORBIDDEN_CALLER_IDENTITY |
evidence has no fields beyond those listed for its signal_kind; duplicate evidence members are detected by that decoder before ordinary schema validation and return non-mutating rejected_evidence with typed reason DUPLICATE_EVIDENCE_MEMBER. Omitted required fields, forbidden/unknown fields, wrong types, or failed canonical-value validation also return disposition: rejected_evidence with a typed reason and perform no state, claim, event, projection, or dedupe mutation.
repois a non-empty canonical GitHub repository ID, exactly lowercaseowner/name(no URL,#, whitespace, or.gitsuffix), obtained from the producer's fresh repository/PR snapshot.issue_numberandpr_numberare JSON integers greater than zero; they are canonical GitHub Issue and PR numbers, never URLs, node IDs, strings, branch names, or text references.approved_body_sha256is exactly 64 lowercase hexadecimal characters, the SHA-256 of the UTF-8 persisted approved Issue body used by the canonical termination/handoff publish; no prefix or alternate digest representation is accepted.merge_commit_oidis exactly 40 lowercase hexadecimal characters, the full GitHub merge commit OID from a fresh merged PR snapshot; abbreviated OIDs, refs, and null/unmerged values are invalid.merge_identityis exactly the same validated 40-lowercase-hex merge OID representation asmerge_commit_oid, copied from the accepted merged fact for the same canonical repository and PR; composite strings, PR URLs, and independently invented identities are invalid.
signal_kind |
Required evidence fields |
Forbidden evidence fields |
Canonical dedupe key from validated values |
|---|---|---|---|
refinement_approved |
repo, issue_number, approved_body_sha256 |
pr_number, merge_commit_oid, merge_identity |
task-context-v1:refinement_approved:<repo>:<issue_number>:<approved_body_sha256> |
implementation_pr_observed |
repo, issue_number, pr_number |
approved_body_sha256, merge_commit_oid, merge_identity |
task-context-v1:implementation_pr_observed:<repo>:<pr_number> |
pr_merged_observed |
repo, issue_number, pr_number, merge_commit_oid |
approved_body_sha256, merge_identity |
task-context-v1:pr_merged_observed:<repo>:<pr_number>:<merge_commit_oid> |
cleanup_completed |
repo, issue_number, pr_number, merge_identity |
approved_body_sha256, merge_commit_oid |
task-context-v1:cleanup_completed:<repo>:<pr_number>:<merge_identity> |
The service, not callers, derives and persists this key only after envelope and evidence validation. source and source_schema_version remain metadata and never enter the key.
The service applies this total, origin-first ordering in one transaction:
- Validate envelope, then validate evidence and derive the business-fact key.
- Resolve internal
origin_session_idthrough open ExecutionRun → Binding → canonical Task. An absent, stale, or unbound origin returnsdeferred/unboundbefore any accepted-fact duplicate lookup. - Validate claim/Task consistency (or, only for
implementation_pr_observed, legal atomic attachment). - Deduplicate an accepted fact only on that canonical Task: same Task and fact returns
duplicate_noop; a fact already bound to a different Task returnsconflict/FACT_TASK_IDENTITY_CONFLICT. - Only for a new
pr_merged_observed, evaluate the cleanup-begun late boundary. Thus a valid same-origin/same-Task accepted duplicate wins before the late boundary, while a new merged fact after cleanup begins returnslate_noop/CLEANUP_ALREADY_BEGUN.
All failures before an accepted transition are non-mutating and return their explicit outcome. Cleanup-begun never converts an accepted same-fact duplicate into late_noop.
| Signal | Selected historical Activity and accepted preconditions | Missing / already terminal | Wrong Task / out of order |
|---|---|---|---|
refinement_approved |
The canonical Task's historical refine Activity only; matching approved termination/handoff evidence is present. | Missing: deferred/activity_missing; terminal or same dedupe key: duplicate_noop. |
Different resolved/claimed Task: conflict/FACT_TASK_IDENTITY_CONFLICT; any phase other than refine: conflict/OUT_OF_ORDER_SIGNAL. |
implementation_pr_observed |
The canonical Task's historical implementation Activity; within apply_workflow_signal()'s single BEGIN IMMEDIATE transaction, after legal canonical Task resolution, validate that the matching Issue and PR claims can both attach, attach both claims, then dedupe and record evidence/claim only. It never terminalizes that Activity. |
Missing: deferred/activity_missing; an existing same fact: duplicate_noop with no partial claim mutation. |
Different Task/claim or illegal attachment: conflict/FACT_TASK_IDENTITY_CONFLICT or conflict/OUT_OF_ORDER_SIGNAL, with no partial claim mutation. |
pr_merged_observed |
The canonical Task's matching, nonterminal historical implementation Activity and validated Issue/PR claim; a fresh merged snapshot supplies the OID. | Missing Activity or claim: deferred/IMPLEMENTATION_NOT_READY; same accepted fact on the same valid origin/Task: duplicate_noop. |
Different Task/PR: conflict/FACT_TASK_IDENTITY_CONFLICT; a new fact after cleanup began: late_noop/CLEANUP_ALREADY_BEGUN; any other non-ready phase: conflict/OUT_OF_ORDER_SIGNAL. |
cleanup_completed |
The service resolves the canonical Task from fresh origin, then deterministically looks up and verifies its sole internal eligible selected/resumed nonterminal cleanup Activity for the validated Task/PR/merge identity and a previously accepted matching pr_merged_observed; callers never supply an Activity ID. |
Precedence is total: no accepted matching merged fact is conflict/OUT_OF_ORDER_SIGNAL; an accepted matching merged fact but no eligible bound internal cleanup Activity is deferred/CLEANUP_NOT_ELIGIBLE; terminal or same dedupe key is duplicate_noop. |
Resolved Task, PR, or merge identity mismatch is conflict/FACT_TASK_IDENTITY_CONFLICT; no instance/mismatch outcome mutates state. |
Producer origin propagation is mandatory and preserves the local-only hot path:
| Producer | Authoritative origin source and adapter boundary | Absent, stale, or different-Task origin |
|---|---|---|
issue-refinement-loop |
Capture CLAUDE_CODE_SESSION_ID at the canonical approved termination/handoff publish and forward it as internal origin_session_id to its signal adapter. Hook-originated execution maps hook JSON session_id to the same field. |
Do not issue a signal: return diagnosable deferred/unbound for absent or stale (no open ExecutionRun/Binding) origin, or conflict/FACT_TASK_IDENTITY_CONFLICT for a different Task. |
open-pr (new and EXISTING=true) |
Capture the invoking CLAUDE_CODE_SESSION_ID or hook JSON session_id when the producer starts and pass it, with only the validated canonical Issue/PR fact from its fresh snapshot, as internal origin_session_id to the adapter. open-pr does not individually pre-mutate either claim. |
Do not issue a signal; return deferred/conflict as above. DRY_RUN=true also emits no signal. |
post-merge-cleanup |
At entry capture the invocation's CLAUDE_CODE_SESSION_ID or hook JSON session_id; after fresh merged-snapshot validation, propagate it unchanged to pr_merged_observed, then only on accepted or valid same-Task duplicate create/resume/select the bound cleanup lifecycle and persist internal cleanup_started, before dispatching work. Final success invokes cleanup_completed without a caller-selected Activity ID. If an entry origin closes while work runs, final completion is origin-first deferred/unbound and producer work is not rolled back. A later ordinary post-merge-cleanup invocation with a fresh origin resolves the existing Task and eligible cleanup instance: an existing final-success cleanup work result may replay cleanup_completed without creating a new cleanup Activity or dispatching worker/work twice; if no such record exists, it stays CLEANUP_PENDING with a diagnosable stop. |
Do not select/resume/start cleanup or dispatch worker/work on deferred, conflict, rejected, or late outcomes. If the origin is no longer open/bound, return diagnosable deferred/unbound; worker receipt, partial, failed, and human_review_required emit no cleanup signal. |
Each producer retains completed producer work and records a diagnosable adapter outcome; deferred, conflict, duplicate_noop, late_noop, rejected envelope/evidence, or other rejected outcomes never roll it back. No producer returns, reconstructs, or substitutes a caller-selected identity. UserPromptSubmit remains local-only: it reads local claims without GitHub lookup, and a PR-claim miss passes through with no Task Context mutation.
Out of Scope
- statusLine or Herdr presentation changes (owned by 実装: Herdr Tab label を短縮し statusLine の情報密度を増やす #2634 / PR feat: Herdr Tab label を短縮し statusLine の情報密度を増やす #2640).
- Workflow review or implementation semantics unrelated to structured signals.
- Completion from natural-language text; Task history auto-merge/rewrite; cross-session routing; cold restore.
- HMAC/signature or ACL frameworks, daemon/poller/message bus, 2PC, generic workflow framework, or generic retry coordinator.
- GitHub network lookup on the
UserPromptSubmithot path, and treating Task Context as a security boundary.
Acceptance Criteria
- AC1: Only a structured
refinement_approvedemitted after canonical termination/handoff publish withtermination_reason=approvedcan terminalize the historical refine Activity. It never terminalizes implementation or cleanup; missing/other termination evidence sends no signal. - AC2: The public v1 payload has exactly
signal_kind,source,source_schema_version, andevidence; the first three are required JSON strings and evidence is an object. A duplicate-detecting JSON decoder runs before ordinary schema validation. Every envelope-level invalid input is non-mutating with exactlydisposition: rejected_envelopeand one fixed reason:MALFORMED_JSON,NON_OBJECT_ROOT,DUPLICATE_TOP_LEVEL_MEMBER,UNKNOWN_TOP_LEVEL_FIELD,WRONG_TOP_LEVEL_TYPE,UNKNOWN_SIGNAL_KIND,UNKNOWN_SOURCE,SOURCE_SIGNAL_MISMATCH,UNSUPPORTED_SCHEMA_VERSION, orFORBIDDEN_CALLER_IDENTITYas specified by the envelope table. Duplicate evidence members return non-mutatingrejected_evidence/DUPLICATE_EVIDENCE_MEMBER; all evidence errors userejected_evidence, neverrejected_envelope. The kind/source pair map and exact stringv1version are enforced. Caller-suppliedsession_id,task_id,activity_id, orbinding_idis rejected without mutation. The CLI mapsCLAUDE_CODE_SESSION_ID, and hooks map JSONsession_id, to internalorigin_session_id; absent/unbound origin returnsdeferredwithout mutation. Producer success remains independent of this result. - AC3: The service follows total origin-first precedence: envelope/evidence validation and business-fact derivation; open ExecutionRun→Binding→canonical Task resolution; claim/Task consistency; same-Task accepted-fact dedupe; then, only for a new merged fact, cleanup-begun evaluation. Absent/stale/unbound origin is
deferred/unboundbefore lookup; different-Task fact isconflict/FACT_TASK_IDENTITY_CONFLICT; valid same-Task same-fact isduplicate_noopeven if cleanup has begun; a new merged fact after cleanup begins islate_noop/CLEANUP_ALREADY_BEGUN. Every earlier failure is non-mutating. - AC4: The service resolves canonical Task identity from origin, then applies fixed historical phase semantics:
implementation_pr_observedonly records claim/evidence;pr_merged_observedterminalizes only implementation;cleanup_completedterminalizes only the bound eligible cleanup Activity. A delayed/replayed signal cannot terminalize a different phase or regress state. - AC5: Before
open-premitsimplementation_pr_observedfor candidate Issue N and PR P, its freshclosingIssuesReferences(first: 2, excludeUserLinked: false, userLinkedOnly: false)classifier proceeds only for exactly one reference equal to N. Zero is named non-mutatingdeferred/NO_LINK; exactly-one mismatch isconflict/RELATION_ISSUE_MISMATCH; two-or-more isconflict/MULTIPLE_CLOSING_ISSUES; each has no signal or Task Context mutation. Snapshot fetch failure, GraphQL errors, partial or timeout responses, and null or malformed relation connection or nodes normalize to non-mutatingdeferred/RELATION_UNAVAILABLE, with no signal, mutation, or claim attachment. Only the validated matching fact and internal origin reachapply_workflow_signal();open-prnever individually pre-mutates either claim. After legal canonical Task resolution,apply_workflow_signal(implementation_pr_observed)is the sole owner, in oneBEGIN IMMEDIATEtransaction, of validating legal attachment, attaching both Issue N and PR P claims, deduping the fact, recording the event, and enqueuing projection. A duplicate or conflict leaves no partial claim mutation. New andEXISTING=truepaths replay the same fact;DRY_RUN=truedoes not signal; adapter failure does not roll back producer success. - AC6:
UserPromptSubmitis local-only: claim miss for a PR performs no GitHub lookup and no Task Context mutation, and passes the prompt through. Beforeimplementation_pr_observed,open-pruses the structured fresh snapshot classifier: only exactly one relation equal to the candidate Issue can signal; zero isdeferred/NO_LINK; exactly-one mismatch isconflict/RELATION_ISSUE_MISMATCH; multiple isconflict/MULTIPLE_CLOSING_ISSUES; snapshot fetch failure, GraphQL errors, partial or timeout response, and null or malformed relation connection/nodes aredeferred/RELATION_UNAVAILABLE; every non-match/unavailable outcome has no signal, mutation, or claim attachment. - AC7: Generic mentions, branch/worktree names, comments, and
Refs #Nalone never establish Task equivalence. Existing guard behavior prevents a different active primary Task from being silently replaced. - AC8: Post-merge cleanup obtains and validates the fresh merged PR snapshot, applies
pr_merged_observed, and only afterappliedor a valid-envelope/evidence same-canonical-Task same-business-factduplicate_noopcreates/resumes/selects the cleanup Activity and dispatches worker/work. Deferred, conflict, rejected envelope/evidence, late-noop, or any invalid outcome does neither. A cleanup Activity begun without accepted merged fact makes a later new merge factlate_noop/CLEANUP_ALREADY_BEGUN, a non-mutating stop with no external-work rollback. - AC9: The post-merge-cleanup main orchestrator durably owns cleanup begin after its accepted prerequisite: one service transaction creates/resumes/selects the sole eligible nonterminal cleanup Activity bound to the same Task/PR/merge identity and appends internal
cleanup_started(activity_id, merge_identity). The public v1 envelope/evidence carries no cleanup handle. On final success,cleanup_completedresolves Task from fresh origin and deterministically looks up/verifies that sole internal instance from validated Task/PR/merge evidence; no caller-selected Activity ID is accepted. Missing instance or mismatch is an explicit non-mutating outcome. If the original origin closed, completion is origin-firstdeferred/unboundwithout rolling back producer work. A later normal post-merge-cleanup invocation with fresh origin resolves/resumes the existing Task and instance; it replayscleanup_completedfrom an existing final-success cleanup work result without creating an Activity or double-dispatching worker/work. Without that record it remainsCLEANUP_PENDINGwith a diagnosable stop. Worker receipt,partial,failed, orhuman_review_requiredcannot complete cleanup. - AC10:
events.dedupe_keyplus a partial UNIQUE index physically prevents duplicate transitions. Identity uses signal kind plus the specified business fact only; source/version are metadata. Forimplementation_pr_observed, claim validation/attachment, dedupe, event append, and projection enqueue share the soleapply_workflow_signal()BEGIN IMMEDIATEtransaction; duplicate or identity conflict leaves no partial claim mutation. Same fact resolved to a different Task is typed identity conflict, and producer success is not rolled back by non-applied outcomes. - AC11: Existing presentation regression tests for
tests/task-context/test_statusline_render.pyandtests/task-context/test_herdr_projection.pypass without changing their presentation contract. - AC12:
evidenceis strict persignal_kind: it validates the specified canonical repository/Issue/PR IDs and approved/merge representations, rejects invalid or forbidden evidence non-mutatively with typedrejected_evidence, and derives exactly the specified validated-values dedupe key. - AC13: The service follows the signal-by-state table and fixed historical Activity selection. Missing, terminal, wrong-Task, out-of-order, and late merged states return the named non-mutating disposition.
cleanup_completedrequires the same Task/PR/merge identity as an accepted merged fact and service-determined eligible internal cleanup Activity, with total precedence: no accepted matching merge isconflict/OUT_OF_ORDER_SIGNAL; only an accepted matching merge with no eligible bound cleanup Activity isdeferred/CLEANUP_NOT_ELIGIBLE; Task/PR/merge mismatch isconflict/FACT_TASK_IDENTITY_CONFLICT. - AC14:
issue-refinement-loop,open-pr, andpost-merge-cleanupcarry only their authoritative internal origin to the adapter. Absent/stale/different-Task origin emits no signal and is diagnosable as deferred/conflict; producer success is not rolled back and caller-selected identity cannot re-enter the path.
Verification Commands
# AC1
$ uv run --locked pytest tests/task-context/test_signal_refinement_approved.py -q
# AC2
# Includes every fixed rejected_envelope reason (including forbidden caller identity), plus duplicate-evidence-member rejection before ordinary schema validation.
$ uv run --locked pytest tests/task-context/test_signal_envelope_schema.py tests/task-context/test_signal_strict_json_rejection.py -q
# AC3
$ uv run --locked pytest tests/task-context/test_signal_origin_first_precedence.py -q
# AC4
$ uv run --locked pytest tests/task-context/test_signal_phase_monotonicity.py -q
# AC5
$ uv run --locked pytest tests/task-context/test_signal_producer_adapters.py -q
# AC6
# Includes zero/no-link, exactly-one match/mismatch, multiple, and each unavailable normalization: snapshot fetch failure, GraphQL errors, partial/timeout, null/malformed connection, and null/malformed nodes.
$ uv run --locked pytest tests/task-context/test_signal_github_relation_conflict.py -q
# AC7
$ uv run --locked pytest tests/task-context/test_signal_generic_reference_non_equivalence.py -q
# AC8
$ uv run --locked pytest tests/task-context/test_cleanup_pending_resume.py -q
# AC9
$ uv run --locked pytest tests/task-context/test_signal_cleanup_completed_commit_point.py -q
# AC10
$ uv run --locked pytest tests/task-context/test_events_dedupe_unique_constraint.py -q
# AC11
$ uv run --locked pytest tests/task-context/test_statusline_render.py tests/task-context/test_herdr_projection.py -q
# AC12
$ uv run --locked pytest tests/task-context/test_signal_evidence_schema.py -q
# AC13
# Includes deterministic internal cleanup-instance lookup, mismatch/no-instance non-mutation, and cleanup_completed precedence for accepted matching merge and bound cleanup Activity.
$ uv run --locked pytest tests/task-context/test_signal_state_transition_matrix.py -q
# AC14
$ uv run --locked pytest tests/task-context/test_signal_producer_origin_propagation.py -qRun uv run --locked pytest tests/task-context -q after changed producers. Tests are deterministic service/equivalence/producer-adapter coverage in the existing suite; do not introduce a generic harness. They cover public-envelope rejection including malformed/non-object/duplicate-member JSON, strict evidence, origin-first precedence, phase-specific delayed replay, local-only prompt miss, total bounded relation states, producer commit points, physical dedupe, and resume.
Runtime Verification Applicability
decision: immediate
applicable_acs: [AC8]
execution_environment:
cli_tools: [python3, uv]
auth_required: false
network_required: false
minimal_canary: "Run the existing local Task Context hook/workflow path: observe a merged implementation as CLEANUP_PENDING, then send a normal cleanup prompt and confirm the same Task resumes."
skip_conditions:
- "No local repository checkout is environment blocked, not SKIP."
fallback_policy:
fallback_success_is_pass: false
artifact_requirements: ["pytest output", "minimal canary output"]
reason: "Resume crosses the existing hook and workflow integration boundary; other ACs have deterministic tests."Allowed Paths
scripts/task-context/**tests/task-context/**.claude/hooks/task_context/**.claude/skills/issue-refinement-loop/**.claude/skills/open-pr/**.claude/skills/post-merge-cleanup/**.claude/skills/post-merge-cleanup-executor/**docs/dev/task-context.md
Stop Conditions
- Allowed Paths 外の変更が必要と判明した場合
- In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
- 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
- 後続 Phase / 別スコープへの波及が判明した場合
- nested SubAgent delegation が必要になった場合
- 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
- A generic framework, security boundary, all-prompt network lookup, or destructive history auto-merge is required.
- Existing workflow result contracts require a breaking change, or completion would depend on natural-language output rather than a structured fact.
- Implementing the strict envelope/evidence, origin-propagation, origin-first ordering, or signal-state contract requires a new framework, caller-selected identity, or network I/O on the
UserPromptSubmithot path.
Required Skills
なし
Required Design References
- 導入: Herdr / Claude Code Task Contextで安定識別・誤操作防止・Attention Managementを実現する #2562, 実装: Task Context v1のSQLite registry・schema・typed internal APIを追加する #2563, 実装: Native Claude operatorにTask Context hooks・wrong-session guard・statusLine/Herdr projectionを配線する #2564, 実装: Herdr Tab label を短縮し statusLine の情報密度を増やす #2634, PR feat: Herdr Tab label を短縮し statusLine の情報密度を増やす #2640
.claude/skills/issue-refinement-loop/SKILL.md.claude/skills/open-pr/SKILL.md.claude/skills/post-merge-cleanup/SKILL.md.claude/skills/post-merge-cleanup-executor/SKILL.mdscripts/task-context/task_context_service.pyscripts/task-context/task_contextctl.pydocs/dev/task-context.mddocs/dev/workflow.md
Delivery Rule
1 Issue = 1 PR.- Re-read current main producer contracts before implementation.
Activity
squne121 commentedon Sep 10, 2026
つまり、スクリーンショットでいうと、UnboundやDegradedだけ表示してほしいです。
ラベルの部分は不要です。
squne121 commentedon Sep 10, 2026
結論
判定は REQUEST_CHANGES。ただし #2565 の基本設計は維持してよいです。
レビュー時点の
mainは9f4430a8d81b51e501eb5838336923d710aeea85で、#2563/#2564 の Task Context 基盤を前提に #2565 を実装できる状態です。 親 #2562 の既存レビューでも、#2565 trusted signals自体は境界が明確で、SQLite SSOT・structured workflow signal・Task/Activity/ExecutionRun の方向は維持してよいと評価されています。問題はアーキテクチャの大枠ではなく、signal の適用点、idempotency、GitHub fallback、producer の commit point がまだ曖昧なことです。このまま実装すると、Task の誤完了や Issue/PR split-brain、あるいは #2564 で削った hot-path latency の再導入が起こり得ます。
重要度 | Finding | 推奨 -- | -- | -- BLOCKER | 現行 signal apply が任意 task_id を受け付ける | 旧payloadを廃止し、session-origin型へ置換 BLOCKER | AC10 の durable dedupe がschema上存在しない | DB physical UNIQUE を追加 BLOCKER | claimless PR の GitHub lookup 失敗と「closing Issue 0件」が未区別 | 0 / 1 / multiple / unavailable の4状態化 BLOCKER | workflow signal の「いつ成功とみなすか」が曖昧 | producerごとのcommit pointを固定 HIGH | open-pr の EXISTING=true retry がsync修復できない可能性 | created/既存の両方で同じsignalを再送 HIGH | Task Context sync failure がproducer本体を失敗扱いし得る | workflow成功とTask Context同期を分離 HIGH | 指定コメントのUI要件が現在のAllowed Pathsでは実装不能 | #2565へ小さく取り込み、2 rendererだけ追加issue-refinement-loop の approved path は
LOOP_HANDOFF_RESULT_V1とpublish_termination_report.pyまでを含みます。特に post-merge-cleanup が重要です。現行contractでは、SubAgentが
POST_MERGE_CLEANUP_REPORT_V1を返した後にmain threadがhuman_review_requiredを処理し、follow_up_issue_requestsをissue-creatorへ渡す等の処理を行います。 Worker reportにもstatus: ok|partial|failedやstash_restoredがあります。したがって
worker.status == ok && !human_review_requiredを見た瞬間にTaskをDONEへすると早すぎます。post-merge-cleanup orchestrator の最後の成功branchから signal を出すのが最小かつ正確です。新たなvalidator frameworkは不要です。HIGH —
open-prの既存PR pathでもsignalを再送するこれは recovery 上かなり重要です。
現行
open-prは同じheadのopen PRを検出した場合、重複作成せず既存PRを返します。 実装もEXISTING=true,PR_URL,PR_NUMBERを出力します。 出力contractにはLINKED_ISSUEとLINK_KINDも既にあります。例えば「PR作成は成功 → Task Context DB syncだけ失敗 → open-pr再実行」となった場合、
EXISTING=falseの新規作成時にしかsignalを出さない実装だと永久に自己修復できません。したがって signal 名も
implementation_pr_createdよりimplementation_pr_observedの方が正確です。EXISTING=falseとEXISTING=trueの両方で同じ canonical evidenceを再送し、AC10のdedupeに任せる設計を推奨します。dry_runだけは送信しません。加えて、origin Taskが既に別Issueをprimary claimしているのに
open-pr linked_issue=Nが来た場合は、Nを勝手にそのTaskへ追加せずtyped mismatchにしてください。これはsecurity対策ではなく、単純なTask identity correctnessです。HIGH — Task Context sync failureで本体workflowを失敗させない
ここは今回の「ワークフローを妨げない」という方針から明文化を推奨します。
PR作成、refinement approval、cleanup完了は、それぞれのworkflow producerがauthorityです。その後のTask Context DB syncが busy / unavailable / conflict になったからといって、既に成功したPR作成やcleanupを「失敗」に巻き戻してはいけません。
Task Context adapterは、workflow resultとは別に
applied / duplicate_noop / deferred / conflict程度を返せば十分です。非hot-pathのproducer signalなら短いbounded retryをして構いませんが、daemon・message bus・汎用retry coordinatorを新設する必要はありません。これは親設計とも合っています。Task Contextはsecurity boundaryではなく、low-frictionなrouting/display layerとして維持する方針です。#2615 の過去レビューでも「checker/harnessに合わせてruntime architectureを歪めない」方向で修正されています。
指定コメントは #2565 にそのまま取り込むのを推奨
この要求は妥当です。別Issueを起こすほどではありません。
コメントは「
Task Contextという説明ラベルを消し、Unbound/Degraded等の内容だけ表示したい」と明示しています。 現行mainはstatusLineで実際に[Task Context: degraded (...)]、[Task Context: unbound]を出しています。 Herdr側もtask-ctx: unboundで、テストまでその文字列を固定しています。外部仕様上も、このprefixに意味はありません。Claude Code statusLineはscript stdoutをそのまま表示する任意presentationです。(Claude) HerdrもTab labelを任意文字列でrenameでき、metadata/tokenはsemantic lifecycleとは分離されたdisplay-only情報です。(Herdr) (Herdr)
私は次の表示に固定します。
degraded_reason自体はquery JSON内には残し、画面からだけ隠すのがよいです。トラブルシュート能力を捨てる必要はありません。ただし #2565 の現在の Allowed Paths は
scripts/task-context/**,tests/task-context/**, 3 workflow skill配下だけなので、このコメントを今の本文のままでは実装できません。 ここだけscopeを次の2ファイルへ限定して拡張すれば十分です。Acceptance Criteriaにも、
程度を足すのが適切です。
推奨する #2565 の最終形
大規模な再設計は不要です。旧
signal apply {task_id,...}の廃止、physical dedupe、GitHub relationの4状態化、producer commit point固定、open-pr replay、UI prefix除去まで本文へ反映すれば、実装へ進めてよい水準になります。逆に、HMAC/signature、ACL、daemon、常駐poller、2PC、全promptでのGitHub問い合わせ、新しい汎用workflow harnessは不要です。今回必要なのはsecurity layerではなく、transaction境界・idempotency・外部factの意味論を単純に正しくすることです。
## 結論判定は REQUEST_CHANGES。ただし #2565 の基本設計は維持してよいです。
レビュー時点の
mainは9f4430a8d81b51e501eb5838336923d710aeea85で、#2563/#2564 の Task Context 基盤を前提に #2565 を実装できる状態です。 親 #2562 の既存レビューでも、#2565 trusted signals自体は境界が明確で、SQLite SSOT・structured workflow signal・Task/Activity/ExecutionRun の方向は維持してよいと評価されています。問題はアーキテクチャの大枠ではなく、signal の適用点、idempotency、GitHub fallback、producer の commit point がまだ曖昧なことです。このまま実装すると、Task の誤完了や Issue/PR split-brain、あるいは #2564 で削った hot-path latency の再導入が起こり得ます。
signal applyが任意task_idを受け付けるopen-prの EXISTING=true retry がsync修復できない可能性BLOCKER —
signal applyは「拡張」ではなく置換すべき#2565 は明確に、signal の対象を
CLAUDE_CODE_SESSION_ID → open ExecutionRun → Binding → Activityから逆引きし、caller に任意task_idを選ばせない契約です。ところが現在の
task_contextctl signal applyは、task_id + repo + ref_kind + ref_numberを必須入力にし、その
task_idへ直接claim_task_ref()しています。これは #2565 AC2 と真正面から衝突します。ここは後方互換を持たせない方がよいです。#2563 自身が operation envelope だけをfreezeし、
signal applyの operation-specific payload は #2565 のような後続consumerで決める、と明示しています。 現時点でも production workflow はsignal applyに未接続で、参照先はCLI・docs・testsが中心です。したがって新payloadは概念的に、
だけにし、
task_id/activity_id/binding_idは入力禁止にするのを推奨します。Claude Code は現在、Bash subprocess にCLAUDE_CODE_SESSION_IDを提供し、hook のsession_idと対応させています。既存ExecutionRun/Bindingをorigin authorityにする設計は成立します。(Claude)さらに
apply_workflow_signal()のような粗粒度 service operation 一個にまとめ、origin resolve → state validation → dedupe → Activity/Task transition → event → projection enqueue を1回のBEGIN IMMEDIATEで処理すべきです。現在の service layer も #2615 の修正後は、この単一transactionパターンと「外部I/Oはservice transaction外」を明示しています。BLOCKER — AC10 の idempotency をDBで保証できる形にする
#2565 は stable evidence identity / dedupe key と AC10 を要求しています。 しかし現行
eventsはid, task_id, activity_id, binding_id, execution_run_id, event_type, metadata_json, occurred_atだけで、dedupe key の物理的 uniqueness がありません。個人開発という前提なら新しいledgerを増やすより、
eventsに nullablededupe_keyをadditive追加し、WHERE dedupe_key IS NOT NULLの UNIQUE indexを張る程度で十分です。eventsをstate replay sourceにする必要はありません。dedupe key はcallerの自由文字列を信用せず、service側で canonical evidence から導出するのがよいです。例えば refinement は
repo + issue + final body_sha256、open-pr はrepo + PR number、merge はrepo + PR number + merge commit OID、cleanup はrepo + PR + merge identityです。issue-refinement-loop は既にbody_sha256を持つ structured handoff contractを持っています。これなら concurrent duplicate も「先にSELECTしたから大丈夫」ではなくSQLite自身で防げます。
BLOCKER — claimless PR lookup は4状態に固定する
#2565 の「PR claimが無ければ GitHub relation を調べ、closing Issue がちょうど1つならそのIssue Taskへ吸収」は正しい方向です。問題はGitHub query失敗時の意味が定義されていないことです。
GitHub GraphQL には正規の
PullRequest.closingIssuesReferencesがあるため、PR本文を独自regexでCloses #123検出する必要はありません。またexcludeUserLinkedのdefaultはfalseなので、Development sidebarから手動設定したclosing relationも含められます。([GitHub Docs]2) GitHub自身も、closing relationにはkeyword linkと手動linkの両方が存在し、default branchへのmergeでlinked Issueをcloseするものとして扱っています。([GitHub Docs]3)ここは
closingIssuesReferences(first: 2)程度の1 round-tripで十分です。推奨する意味論は、0件ならPR-primary作成可、1件ならIssue-primaryへ吸収、2件以上ならtyped conflict、timeout/auth/network failureならunavailableとしてpromptはPASSするがTaskを新規作成しない、です。特に
unavailableを「0件」にfall backしてはいけません。そうすると一時的GitHub障害だけでPR-primary Taskができ、後でIssue Taskとのsplit-brainになります。#2564/PR #2615 では
UserPromptSubmithot pathを1秒に抑えるための修正まで行っています。現行コードもHOT_PATH_TIMEOUT_SECONDS = 1.0を固定し、project hook側も2秒の上限です。 以前のレビューでも毎promptの不要な外部/subprocess処理は明確に問題視されています。したがって、GitHub lookupは「PR + local claim miss」の時だけ。まずは既存1秒budget内で bounded query、間に合わなければ state mutationせずPASS、が最も低摩擦です。実runtimeで成功率が低ければ、その時だけclaimless-PR専用budgetを少し広げればよく、全promptのtimeoutを伸ばす必要はありません。
BLOCKER — signalごとの commit point を固定する
「structured resultなら何でも即signal」にすると早すぎます。次の境界を固定するのがよいです。
refinement_approvedimplementation_pr_observedpr_merged_observedmerged/mergedAtを確認した時cleanup_completedissue-refinement-loop の approved path は
LOOP_HANDOFF_RESULT_V1とpublish_termination_report.pyまでを含みます。特に post-merge-cleanup が重要です。現行contractでは、SubAgentが
POST_MERGE_CLEANUP_REPORT_V1を返した後にmain threadがhuman_review_requiredを処理し、follow_up_issue_requestsをissue-creatorへ渡す等の処理を行います。 Worker reportにもstatus: ok|partial|failedやstash_restoredがあります。したがって
worker.status == ok && !human_review_requiredを見た瞬間にTaskをDONEへすると早すぎます。post-merge-cleanup orchestrator の最後の成功branchから signal を出すのが最小かつ正確です。新たなvalidator frameworkは不要です。HIGH —
open-prの既存PR pathでもsignalを再送するこれは recovery 上かなり重要です。
現行
open-prは同じheadのopen PRを検出した場合、重複作成せず既存PRを返します。 実装もEXISTING=true,PR_URL,PR_NUMBERを出力します。 出力contractにはLINKED_ISSUEとLINK_KINDも既にあります。例えば「PR作成は成功 → Task Context DB syncだけ失敗 → open-pr再実行」となった場合、
EXISTING=falseの新規作成時にしかsignalを出さない実装だと永久に自己修復できません。したがって signal 名も
implementation_pr_createdよりimplementation_pr_observedの方が正確です。EXISTING=falseとEXISTING=trueの両方で同じ canonical evidenceを再送し、AC10のdedupeに任せる設計を推奨します。dry_runだけは送信しません。加えて、origin Taskが既に別Issueをprimary claimしているのに
open-pr linked_issue=Nが来た場合は、Nを勝手にそのTaskへ追加せずtyped mismatchにしてください。これはsecurity対策ではなく、単純なTask identity correctnessです。HIGH — Task Context sync failureで本体workflowを失敗させない
ここは今回の「ワークフローを妨げない」という方針から明文化を推奨します。
PR作成、refinement approval、cleanup完了は、それぞれのworkflow producerがauthorityです。その後のTask Context DB syncが busy / unavailable / conflict になったからといって、既に成功したPR作成やcleanupを「失敗」に巻き戻してはいけません。
Task Context adapterは、workflow resultとは別に
applied / duplicate_noop / deferred / conflict程度を返せば十分です。非hot-pathのproducer signalなら短いbounded retryをして構いませんが、daemon・message bus・汎用retry coordinatorを新設する必要はありません。これは親設計とも合っています。Task Contextはsecurity boundaryではなく、low-frictionなrouting/display layerとして維持する方針です。#2615 の過去レビューでも「checker/harnessに合わせてruntime architectureを歪めない」方向で修正されています。
指定コメントは #2565 にそのまま取り込むのを推奨
この要求は妥当です。別Issueを起こすほどではありません。
コメントは「
Task Contextという説明ラベルを消し、Unbound/Degraded等の内容だけ表示したい」と明示しています。 現行mainはstatusLineで実際に[Task Context: degraded (...)]、[Task Context: unbound]を出しています。 Herdr側もtask-ctx: unboundで、テストまでその文字列を固定しています。外部仕様上も、このprefixに意味はありません。Claude Code statusLineはscript stdoutをそのまま表示する任意presentationです。(Claude) HerdrもTab labelを任意文字列でrenameでき、metadata/tokenはsemantic lifecycleとは分離されたdisplay-only情報です。([Herdr]5) ([Herdr]6)
私は次の表示に固定します。
degraded_reason自体はquery JSON内には残し、画面からだけ隠すのがよいです。トラブルシュート能力を捨てる必要はありません。ただし #2565 の現在の Allowed Paths は
scripts/task-context/**,tests/task-context/**, 3 workflow skill配下だけなので、このコメントを今の本文のままでは実装できません。 ここだけscopeを次の2ファイルへ限定して拡張すれば十分です。Acceptance Criteriaにも、
程度を足すのが適切です。
推奨する #2565 の最終形
大規模な再設計は不要です。旧
signal apply {task_id,...}の廃止、physical dedupe、GitHub relationの4状態化、producer commit point固定、open-pr replay、UI prefix除去まで本文へ反映すれば、実装へ進めてよい水準になります。逆に、HMAC/signature、ACL、daemon、常駐poller、2PC、全promptでのGitHub問い合わせ、新しい汎用workflow harnessは不要です。今回必要なのはsecurity layerではなく、transaction境界・idempotency・外部factの意味論を単純に正しくすることです。
squne121 commentedon Sep 10, 2026
推奨は、comment
5616199676をoperator_asserted_human_contextとして canonical refinement loop に投入し、本文契約を更新して再レビューまで完走させることです。単なる再レビューではなく、anchor が列挙した BLOCKER/HIGH を Issue 本文へ反映する段階です。実際、現在もsignal applyはtask_id等を直接受け取る実装のままで、eventsに durable dedupe key もありません。また、UI要件も未反映です。現行 statusLine は
[Task Context: ...]、Herdr はtask-ctx: unboundをまだ出力しているため、anchor が要求する2 renderer の Allowed Paths 追加と AC11 は有効な refinement delta です。注意点として、レビューコメントは
main=9f4430...を前提にしていますが、現在のmainHEAD はf36f41a7ae20b81e380807a4ce9c4d9b1e95d652です。したがって、anchor の結論を盲目的に転記するのではなく、current main に対して再fact-checkしてから反映させます。.claude/skills/issue-refinement-loop自体は iteration approval をデフォルト不要としており、human-context lane、contract update、必要時のissue-editorhandoff が既に定義されています。その前提で、auto mode の Claude Code には以下を渡すのがよいです。
Issue #2565 に対して
.claude/skills/issue-refinement-loopを canonical procedure どおり実行し、以下の anchor comment を direct interactive human instruction として扱ってください。Target Issue:
#2565
Human-context anchor:
#2565 (comment)
このメッセージ自体が operator による明示的な実行指示です。
anchor は
agent_reportや unlabeled context として扱わず、operator_asserted_human_contextとして canonicalwith_human_contextlane に投入してください。Objective
anchor comment の REQUEST_CHANGES を #2565 の Issue contract へ正しく反映し、
.claude/skills/issue-refinement-loopを human approval なしで bounded に完走させてください。目的は Issue 本文の refinement です。
この作業では #2565 の実装PR作成やコード実装そのものには進まず、Issue contract が current main に対して implementation-ready / approve 相当になるところまでを対象としてください。
Current-state rule
anchor comment のレビュー時点では main SHA が
9f4430a8d81b51e501eb5838336923d710aeea85でしたが、そのSHAを現在状態として固定しないでください。開始時に必ず current
mainHEAD、Issue #2565 本文、anchor snapshot、関連する #2562/#2563/#2564、必要な repository assets を fresh readback してください。current main に後続変更が入っている場合は、その実状態を authority として anchor findings を fact-checkしてください。
anchor の記述を事実確認なしに機械転記しないでください。
Human approval policy
既に Claude Code は auto mode で起動しています。
needs-fixは skill の bounded loop policy に従って自動継続する。Claude Code permission mode自体や repository guardrail を変更する必要はありません。
Canonical human-context flow
.claude/skills/issue-refinement-loop/SKILL.mdと command registry の current-main 定義をSSOTとして使用してください。anchor comment は canonical
preflight.run.with_human_contextprofile で処理してください。trusted contract patch plan が得られた場合は canonical
contract_update.run.with_human_contextphaseへ進めてください。NEXT_ACTION: issue_editor_requiredが返った場合:contract_update.run.with_human_contextを no-progress retryしない。issue-editor/ edit-issue controlled transaction routeへhandoffする。SubAgent execution requirement
必要な SubAgent を実際に使用してください。
planner / skill contract が要求する場合は、少なくとも以下を適切にdispatchしてください。
codebase-investigatorweb-researcherissue-editorrepository fact と外部仕様 fact の両方のinvestigationが必要なら、独立な read-only investigation は並列実行して構いません。
重要:
起動した全SubAgentの完了を必ず待ってください。
fire-and-forgetは禁止です。
SubAgentをspawnしたまま次工程へ進まないでください。
Step 1 / Step 1b のSubAgentを起動した場合は、全結果をjoinしてからStep 2へ進んでください。
issue-editorを起動した場合も、そのstructured resultとartifact/readbackを受け取るまでreviewを再開しないでください。
SubAgentへ control-plane ownership や canonical final routing authority を移譲しないでください。
Anchor findings to resolve
anchor comment の各findingを current main に対してfact-checkした上で、依然有効ならIssue contractへ反映してください。
少なくとも次を解消対象としてください。
1.
signal applyorigin authority旧式の
task_id + repo + ref_kind + ref_numberをcallerが指定するsignal contractを維持しない。
workflow signalは概念上、
を入力とし、target Task/Activityは
CLAUDE_CODE_SESSION_ID→ open ExecutionRun
→ current Binding
→ current Activity / Task
からservice側で解決する契約にする。
caller inputとして任意の
task_id/activity_id/binding_idを許可しない。origin resolve、state validation、dedupe、transition、event append、projection enqueue等、同一workflow signalに属するDB mutationは可能な限り1つの粗粒度service operation /
BEGIN IMMEDIATEtransactionで所有する。external I/Oはtransaction外に保つ。
2. Durable idempotency
AC10をapplication-side precheckだけにしない。
canonical evidence由来のdedupe identityをDB physical constraintで保証する。
新しい大規模ledgerを作る必要はなく、現在のschemaとの整合を確認した上で
events等の既存適切なsurfaceへの nullable dedupe key + partial UNIQUE index のような最小設計を優先する。dedupe keyはcaller自由入力をauthorityにせず、service側でcanonical evidenceから導出する。
concurrent duplicate deliveryもDB constraintでno-op / typed duplicateとして処理できる契約にする。
3. Claimless PR GitHub relation
PR claim miss時のGitHub relation解決は以下を明示的に区別する。
unavailableを zero と同一視してPR-primary Taskを作成しない。GitHub lookupは全promptのhot pathへ追加しない。
PR promptかつlocal claim miss等、本当に必要なslow pathに限定する。
temporary lookup failure時はTask split-brainを作るよりstate mutationを見送り、通常workflowを妨げない bounded behaviorを優先する。
4. Producer commit points
workflow producerごとのTask Context signal commit pointをIssue本文へ明示する。
最低限:
refinement_approvedimplementation_pr_observedpr_merged_observedcleanup_completedworker reportだけでTask全体をDONEにしない。
5.
open-prreplay / recoverysignal名は、current contractsとfact-checkして問題なければ
implementation_pr_createdよりimplementation_pr_observedを優先する。EXISTING=falseの新規作成時だけでなくEXISTING=trueの既存PR検出時にも同じcanonical evidenceを再送可能にする。Task Context syncのみ失敗した後の
open-prretryでself-healできるようにする。dry-runではsignalを送らない。
origin Taskが別Issueをprimary claim済みなのに異なるlinked Issueが来る場合はsilent attachせずtyped identity conflict/mismatchにする。
6. Workflow success と Task Context sync failure の分離
workflow producer自身の成功をTask Context adapter failureで巻き戻さない。
PR作成、refinement approval、cleanup等がauthority上成功済みなら、その後のTask Context syncが
等になってもproducer自身を「失敗したこと」にしない。
adapter側は
applied / duplicate_noop / deferred / conflict等の独立した同期結果として扱う。非hot-pathなら短いbounded retryは可。
daemon、message bus、常駐poller、汎用retry coordinatorは追加しない。
7. UI presentation requirement
comment #5615995722 のユーザー要望も #2565 に小さく取り込む。
Allowed Pathsへ必要最小限として、current mainで実在を再確認した上で以下2 rendererを追加する。
.claude/hooks/task_context/statusline.py.claude/hooks/task_context/herdr_projection.pypresentation semanticsは次を目標とする。
DegradedUnboundTask Contextprefixなしで既存のref/activity/attention/worktree/branch/runtime-health等の内容を直接表示Unbound#N · <activity>系表示を維持degraded_reason等のdiagnostic情報はquery JSON / internal diagnosticsには残し、presentationからだけ隠す。Acceptance CriteriaへAC11相当を追加し、
"Task Context"prefixを表示しない"task-ctx"prefixを表示しないUnboundDegradedことを明示する。
関連testsは既存
tests/task-context/**scope内で表現可能か確認し、VCにも反映する。Keep the architecture small
今回のrefinementを理由として以下を追加しない。
個人趣味開発として、correctness・recovery・idempotency・使いやすさを優先し、checker/harness/securityのためにruntime workflowを重くしない。
Review loop
Issue本文を書き換えたら必ずfresh evidenceで再レビューする。
canonical Step 2 routing authorityを再実装しない。
root-owned review pipelineのresultをそのままconsumeする。
semantic design reviewがapplicableなら実施し、その結果もcanonical join/routingに従う。
needs-fixの間はmax_iterations内で自動修正を継続する。最終的には少なくとも以下を確認する。
Final response
完了時は簡潔に以下を報告してください。
人間承認待ちで終了しないでください。
この形なら、特に UIのAllowed Paths拡張を「別Issueにするか?」と再質問される余地と、anchorをagent-generated report扱いされてscope mutation authorityを失う余地を先に潰せます。anchor 自体も「基本設計維持・7項目を修正・過剰なsecurity/harnessは不要」という結論なので、この refinement は方針選択ではなく契約の具体化として進めるのが適切です。
squne121 commentedon Sep 10, 2026
issue-refinement-loop: human_escalation
max_rewrite_attempts到達)f36f41a7ae20b81e380807a4ce9c4d9b1e95d652実施内容
preflight.run.with_human_context): 初回はissue_kind: implementationの必須4セクション(Parent Goal Ref / Current Validated Scope / Remaining Parent Gaps / Required Skills)欠落でSTATUS: blockedを検出(structural_repair_action disposition:human_review_required、自動derivation不可)。codebase-investigator/web-researcherを並列起動し、anchor findingsを現在mainに対してfact-check(task_contextctl.py signal_applyが任意task_idを受理、eventsテーブルにdedupe UNIQUE制約なし、open-pr/post-merge-cleanup-executorの既存出力契約、Claude Code statusLine仕様等を実コード・公式ドキュメントで検証)。issue-editorへ3回のcontrolled transactionを委譲し、Issue本文を段階的に更新(body_sha256:93552aa4...→33a13fc2...→81b3cf84...→cf3b2341...)。run_root_review_pipeline.py produce)は最終的にVERDICT: approve/canonical_step2_route: step_2_5。issue-design-reviewer, model: opus、cross-contract change検出により昇格)を3回実施。1回目でBLOCKER×1・HIGH×1を検出・修正。2回目でBLOCKER×1(CLAUDE_CODE_SESSION_ID環境変数の実在性)・HIGH×2を検出し、web-researcherでClaude Code公式GitHub issue(#27299, #47018)を確認した上で該当環境変数が未実装であることを確認・修正。3回目でBLOCKERは解消されたが新規HIGH×2(session-origin逆引きとclaim起点target解決の順序矛盾/docs/dev/task-context.mdがAllowed Paths外)を検出。停止理由
semantic_rewrite_constraints.max_rewrite_attempts: 2に対し、semantic design review由来の rewrite を既に2回実施済み(3回目のreviewでも新規HIGHが残った)。3回目のHIGH指摘のうち1件(session-origin逆引きの解決順序と、claim経由のTask解決との整合)は genuine な owner 判断(claim解決時にsessionをTask/Activityへbindする設計にするか、claim-resolved targetをsession-originと同格の別経路として明示的に許可するか)を要するため、これ以上の自動rewriteで捏造的に「解決済み」と扱わずcanonical termination policyに従い停止する。Blockers(3回目semantic reviewの未解決所見)
pr_merged_observed)の順序契約が未定義。unbound Tab起点のPRプロンプトでcatch-upが到達不能になりうる。docs/dev/task-context.md(DB invariant/UNIQUE index表・payload open原則の正本)がAllowed Paths / Required Design References に未追加。statusline.pyの[Task Context: no session]分岐を網羅していない。実行したSubAgent(すべてjoin済み)
codebase-investigator(task-context契約のfact-check)— join済みweb-researcher(Claude Code statusLine仕様、Herdr CLI仕様、CLAUDE_CODE_SESSION_ID実在性)— 2回起動、いずれもjoin済みissue-editor(本文更新)— 3回起動、いずれもjoin済み・body_sha256で成功確認済みissue-design-reviewer(Step 2.5 semantic design review, model: opus)— 3回起動、いずれもjoin済み次のアクション
Issue本文(現在の body_sha256:
cf3b2341e17b60ac1b1b9656592e55bfdd9d6f858a12636e6f9d8992f7d3636e)は anchor comment のBLOCKER/HIGH 7件をすべて反映済みで、deterministic checkerはapproveです。残る争点は上記HIGH「session-origin逆引きとclaim起点target解決の順序」に関するアーキテクチャ判断のみです。owner判断が得られ次第、issue-refinement-loopを再実行してください。squne121 commentedon Sep 10, 2026
推奨は 「claim-resolved target を
signal applyの第二 authority にしない」 です。代わりに、claim / GitHub relation を pre-bind routing に使い、既存 #2564 のルールに従って current session を canonical Task/Activity へ bind/rebind した後、signal applyは session-origin だけで target を解決する構造に固定するのがよいです。理由は、現行
UserPromptSubmitがすでに「unbound なら target へ autobind」「terminal Activity なら bind/rebind」「ACTIVEな別primary targetなら block」という順序を持っているためです。さらにbind_target_to_binding()は Task解決、Activity確保、ExecutionRun attach、event、projection を単一BEGIN IMMEDIATEで扱う既存の原子的境界があります。ここに PR claim / closing-Issue relation の pre-resolution を足す方が、signal applyに session と claim の二重authorityを持たせるより小さく、一貫しています。また、main は escalation 時点と同じ
f36f41a7...で、停止コメントが指摘した HIGH はまだそのまま解決対象です。 前回は semantic rewrite 上限に達したため止まっただけなので、新規セッションでは今回の owner decision を新しい human context として投入し、counterを手動リセット・迂回せず canonical route で再開させるべきです。停止コメントに残ったdocs/dev/task-context.md、MEDIUM/LOW も同じ refinement で畳み込ませます。前回プロンプトでも SubAgent は fire-and-forget 禁止、全結果を join 後に次工程へ進む契約でした。今回もそれを明示的に維持します。
以下を、新規に起動した auto mode の対話的 Claude Code にそのまま渡すのを推奨します。
Issue #2565 の
issue-refinement-loopを、新しい owner decision を与えた continuation として再開してください。対象:
実装: workflow trusted signalsとIssue/PR Task equivalenceをTask Contextへ統合する #2565 (comment)
実装: workflow trusted signalsとIssue/PR Task equivalenceをTask Contextへ統合する #2565 (comment)
このセッションは新規セッションです。前セッションの会話状態、scratchpad、SubAgent結果、artifactを暗黙に引き継がないでください。
この作業では #2565 のコード実装・実装PR作成には進まないでください。
目的は、Issue contractをcurrent mainに対して再精緻化し、deterministic review / applicable semantic design review / readiness を通して implementation-ready / approve 相当にするところまでです。
既に Claude Code は auto mode で起動しています。
refinement iteration間の人間承認は不要です。
Claude Codeのpermission modeやrepository guardrailを変更する必要はありません。
最初にfresh readbackすること
開始時に必ず以下をfresh readbackしてください。
mainHEAD.claude/skills/issue-refinement-loop/SKILL.md前回review時のmainは
f36f41a7ae20b81e380807a4ce9c4d9b1e95d652、Issue body SHAはcf3b2341e17b60ac1b1b9656592e55bfdd9d6f858a12636e6f9d8992f7d3636eでしたが、これらを現在状態として固定しないでください。
current main / current Issue body が変化していれば、fresh readbackした実状態をauthorityにしてください。
前回のsemantic review artifactをそのまま再利用してapprove扱いにせず、必要なreview evidenceはfreshに生成してください。
今回のOwner Decision
前回human escalationで未決定だった、
「claim解決時にsessionをTask/Activityへbindするか」
vs
「claim-resolved targetをsession-originと同格のsignal target authorityにするか」
について、owner decisionを以下で固定します。
採用: resolve/bind-before-signal、signal target authorityはsession-originのみ
claim-resolved targetを
signal applyの第二target authorityにはしないでください。claim / Issue-PR relation / GitHub relation は、
signal targetを直接指定するauthorityではなく、current sessionをcanonical Task/Activityへ合法的にbind/rebindするための pre-bind routing evidence
として扱ってください。
概念上の順序を以下に固定します。
task_ref_claimsを最初にresolveする。signal applyはsession_id → open ExecutionRun → current Binding → current Activity/Taskの単一経路のみでtargetを解決する。claimによって別Taskが見つかっても、ACTIVEなcurrent primary Taskを無条件に乗り換えてはいけません。
既存 #2564 の、
/task→ explicit human escape hatchというguard semanticsを維持してください。
つまり、claim-resolved Taskを使って
signal applyからwrong-session guardを迂回する設計は禁止です。Claimless PR resolution
PR promptでlocal PR claimがない場合のみbounded GitHub slow pathを使用してください。
current-mainの実装・GitHub取得契約をfact-checkした上で、少なくとも以下を区別してください。
unavailableをzero扱いしないでください。exactly one closing Issueの場合は、そのIssueのcanonical Taskをresolve/createした上で、Issue claimとPR claimを同一Taskへatomicに所属させ、そのTaskへcurrent Binding / ExecutionRun / Activityをbindしてください。
その際、
の境界を混ぜないでください。
GitHub relationはtransaction外で取得し、fresh resultを入力として単一の粗粒度DB mutationを行ってください。
transaction取得後にGitHub network I/Oを実行しないでください。
relation取得後からtransaction開始までに競合が起き得るため、transaction内ではlocal claimを再検証し、raceで別Taskがclaimを獲得済みならその事実をauthorityとしてtyped conflictまたは既存canonical Taskへの安全な収束を行ってください。
新しい2PC、daemon、message bus、persistent poller、汎用retry coordinatorは導入しないでください。
pr_merged_observedの順序pr_merged_observedについても同じauthority ruleを適用してください。PR promptに対するcanonical Task解決と合法なbind/rebindをsignal applyより先に完了させてください。
GitHubのmerged factはstrong external factとして扱いますが、それ自体で任意Taskをsignal targetにしてはいけません。
概念上:
canonical PR/Task relation resolve
→ legal session bind/rebind
→ authoritative merged fact confirmation
→
pr_merged_observedsignal apply via current session-originとしてください。
relationとmerged stateを同じfresh PR snapshotで安全に取得できる既存surfaceがあるなら、そのsnapshotを再利用して構いません。ただしDB transaction中のexternal I/Oは禁止です。
bindingが成立しない、current ACTIVE Taskとのidentity guardに抵触する、または必要なrelation evidenceがunavailableなら、他Taskへ直接signalを当てず、canonical typed outcomeへ流してください。
Task Context syncがdeferred/conflictになっても、すでに成功しているproducer本体のworkflow resultを巻き戻してはいけません。
Durable dedupeに関するowner direction
dedupe identityはcanonical workflow factのidentityを表し、sessionや解決後Taskのidentityには依存させない方針にしてください。
概念上、
signal_kindsourcesource_schema_versionからservice側でdedupe identityを導出してください。
session_id/task_id/activity_id/binding_idをdedupe identityへ混ぜて、同じexternal factが複数Taskへ二重適用できる形にしないでください。同一dedupe identityのreplayが、
duplicate_noopとなる契約を優先してください。
実際のkey構造、schema、partial UNIQUE indexの配置は、current
docs/dev/task-context.md/ schema / migration conventionsをfact-checkして最小設計を選んでください。新しい大規模ledgerは作らないでください。
残存semantic findingsも同時に解消すること
前回のHIGH/Medium/Lowを今回のowner decisionに従ってまとめて解消してください。
特に:
docs/dev/task-context.mdを Allowed Paths と Required Design References に追加する。result kindとreason/error discriminatorの対応を閉じる。
applied / duplicate_noop / deferred / conflictはdispositionとして扱い、transient/unbound/identity contradiction等のreasonとは混同しない。
task_context_errors.py等のcurrent-main conventionをfact-checkして最小集合にする。legacy direct-target payloadの扱いと、missing/unbound sessionの扱いを同じreasonへ潰さない。
dedupe keyのscopeをIssue contract上で明文化する。
claimless PR relationの4状態判別機構を具体化する。
closingIssuesReferences等のstructured GitHub evidenceを優先し、文字列heuristicに落とさない。AC1に
termination_reason != approvedまたはcanonical termination/handoff publish未完了ならrefinement_approvedを送らないnegative caseを追加する。statusLineの
no sessionpresentationは、人間向け表示ではUnboundへ統合する方向を採用する。AC/VCとAllowed Pathsを相互整合させる。
これらのeditorial / taxonomy / testability上の選択は、current-main conventionsと上記owner directionから合理的に一意化できる限り、人間へ再質問せず自律的に解消してください。
SubAgent必須運用
SubAgentを使用してください。
最低限、必要に応じて以下を使ってください。
codebase-investigatorcurrent mainに対して以下をfact-checkさせてください。
on_user_prompt_submitbind_target_to_bindingabsorb_ref_into_tasktask_ref_claimsdocs/dev/task-context.mdopen-prissue-refinement-looppost-merge-cleanup特に、
「claim/GitHub relation resolve → legal binding → session-origin signal」
を入れる最小のcontract seamを調査させてください。
web-researcher外部仕様がmaterialな箇所だけ使用してください。
例:
既に確認済みの事実を無意味に再検索する必要はありませんが、current Issueへ外部仕様を断定して書く場合は必要な範囲をfresh確認してください。
issue-editorIssue本文mutationはcanonical controlled transaction routeで行わせてください。
main orchestrator自身がad-hocにIssue本文を書き換えてcontrol-plane ownershipを迂回しないでください。
issue-design-reviewerdeterministic review後、Step 2.5がapplicableならfresh pinned bodyでsemantic reviewしてください。
cross-contract変更が大きければcurrent skill policyに従って適切なmodel overrideを使用してください。
Completion join barrier — 必須
起動した全SubAgentの作業完了を必ず待ってください。
fire-and-forgetは禁止です。
独立read-only investigationは並列起動して構いませんが、
codebase-investigatorweb-researcherを起動した場合、両方の結果をjoinしてからcontract patch planを確定してください。
issue-editorを起動した場合、そのstructured resultとIssue body readbackを受け取るまでfresh reviewへ進まないでください。issue-design-reviewerを起動した場合、その出力を実際に受領してcompletion joinした後にのみsemantic transport / join / routingを続行してください。SubAgentへcanonical routing authority、control-plane ownership、最終termination判断を移譲しないでください。
main/root Claude Codeが最後までorchestratorです。
nested delegationがcurrent agent contractで禁止されている場合は、その禁止を守ってください。
Canonical issue-refinement-loop
.claude/skills/issue-refinement-loop/SKILL.mdとcurrent command registryをSSOTとして実行してください。今回のpromptは、前回human escalationを解決する明示的なowner decisionです。
original anchor #5616199676 と前回termination #5616778522をhistorical evidenceとして読み、このpromptのowner decisionをcurrent human contextとして扱ってください。
current skillがinteractive owner decisionのmaterializationを要求する場合は、そのcanonical routeを使用してください。
以下は禁止です。
これは新しいowner-directed continuationなので、rewrite attempt lifecycleはcurrent canonical routerの判断に従ってください。
前回上限に到達したcounterを手作業でリセットして成功を偽装してはいけません。
Review loop
Issue本文mutation後は毎回:
fresh body/title readback
→ guard / preflight
→ canonical deterministic Step 2 review
→ applicableならfresh Step 2.5 semantic review
→ readiness
→ canonical next-action routing
まで行ってください。
needs-fixであり、current canonical budget内で修正可能なら人間承認なしで自動修正を継続してください。今回owner decisionで解消済みの
「session-origin vs claim-resolved target authority」
について再びowner判断を要求しないでください。
新しいgenuine blockerが発生しない限り、HIGH/MEDIUM/LOWのeditorial/design completeness findingsはcurrent code/docsとこのdirectiveを使って自律的に収束させてください。
完了条件
少なくとも以下を確認してください。
pr_merged_observedのresolve/bind/signal順序が明文化されたdocs/dev/task-context.mdがAllowed Paths / Required Design Referencesに入ったimplementation-readyになったら、そこで停止してください。
コード実装・実装PR作成には進まないでください。
最終報告
完了時は簡潔に以下を報告してください。
人間承認待ちを通常の終了条件にしないでください。
今回明示したowner decisionの範囲では、自律的にapprove / implementation-readyまで収束させてください。
このプロンプトでは、前回の未決HIGHだけでなく、次のsemantic reviewで再度止まりやすい dedupe scope・result taxonomy・4状態判別・AC1 negative・no-session表示にも方向性を与えています。これにより、新規セッションを単なる「rewrite上限のやり直し」にせず、残った設計不確定性を一度で閉じる狙いです。
squne121 commentedon Sep 17, 2026
結論
REQUEST_CHANGES 相当です。 ただし、#2565 の中心思想――structured workflow fact を trusted signal とし、SQLite を SSOT にして Issue/PR split-brain を防ぐ――は維持してよいです。
前回コメントで挙がった
重要度 | Finding | 推奨 -- | -- | -- BLOCKER | Claude Code session ID の前提が現在は誤り | CLAUDE_CODE_SESSION_ID を自動利用し、caller 明示 session_id を廃止 BLOCKER | delayed/replay signal が「現在の Activity」に誤適用され得る | session は Task 解決だけに使い、signal ごとに phase/activity semantics を固定 HIGH | dedupe identity に source_schema_version / source を混ぜている | business fact identity のみにする HIGH | PR prompt で GitHub network lookup を行う設計 | UserPromptSubmit を local-only に保ち、workflow producer 側へ寄せる HIGH | Issue 本文内に既に解決済み/矛盾した scope が残る | 実装前に contract cleanup MEDIUM | GitHub GraphQL relation の新しい引数意味論を暗黙値に依存 | excludeUserLinked を明示 MEDIUM | AC/test surface が広がり過ぎる余地 | generic harness を増やさず既存 pytest + 最小 canary に限定task_id直指定、physical dedupe、GitHub relation の4状態、producer commit point、EXISTING=truereplay、producer fail-open は現行本文へかなり取り込まれています。 一方、2026-09-17 時点のmainはfa54f0b0...まで進んでおり、Issue 自体の最終更新は9月15日なので、その後の関連実装も含めて再評価すると、新たに2件の blocker と数件の設計上の高優先修正があります。BLOCKER —
session_idの前提が古くなっている現行 #2565 は、Claude Code が subprocess に session ID を環境変数として公開しないため、
signal_kind / source / source_schema_version / session_id / evidenceを caller が明示的に渡す、と定義しています。
これは現在の Claude Code 仕様と一致しません。公式ドキュメントでは
CLAUDE_CODE_SESSION_IDが Bash/PowerShell tool subprocess に自動設定され、hook に渡されるsession_idと一致し、/clear時にも更新されることが明記されています。Week 19 の公式更新にも同じ変更が記載されています。(Claude) Hooks 側も全 hook 共通入力としてsession_idを受け取ります。(Claude)つまり、以前の GitHub issue #27299/#47018 は当時は正しかったが、後の Claude Code 更新で解消済みです。興味深いことに、#2565 の以前のレビューコメント自身は既に
CLAUDE_CODE_SESSION_IDが利用可能だと正しく記載していました。現行 Issue 本文でそこだけ古い前提に戻っています。ここはワークフローを軽くできます。
task-contextctl signal applyの public payload は、だけで十分です。CLI adapter が
CLAUDE_CODE_SESSION_IDを読み、内部 service call のorigin_session_idに変換する。hook 経路なら hook JSON のsession_idを使う。環境変数が無い非 Claude 実行だけdeferred/unboundにすればよいです。現在の
signal applyがtask_id + repo + ref_kind + ref_numberを直接要求しているのは、Issue が置換予定としている通りです。 任意task_idを禁止する目的は維持しつつ、session ID を人間/LLMに運ばせる余計な配線は削除できます。BLOCKER — replay と「current Activity」方式が両立していない
こちらの方がデータ整合性上は深刻です。
#2565 は、Task Context sync が失敗しても producer 本体は成功させ、後から
EXISTING=true等で同じ signal を replay して self-heal する設計です。同時に、signal target は、session_id → ExecutionRun → Binding → current Activity/Taskだけから決める、としています。
この2つを組み合わせると、signal 発生時と replay 時で Activity が変わっているケースが未定義です。
例えば refinement 自体は正常終了したが Task Context sync が busy で失敗。そのまま利用者は implementation に進む。その後 replay された
refinement_approvedが current Activity=implを解決した場合、service が「current Activity を terminalize」という実装なら、実装 Activity を誤って完了させる余地があります。Task Context は意図的に producer を止めないため、これは異常系ではなく設計上想定すべき正常な遅延 deliveryです。
session-origin は Task identity の決定までにした方が安全です。その後は signal ごとの意味論を service が持つべきです。例えば
refinement_approvedは refine Activity 以外を絶対に terminalize しない、pr_merged_observedは implementation phase にだけ作用し、既に cleanup へ進んでいれば state regression せず late/no-op とする、cleanup_completedは cleanup Activity にのみ作用する、という単調な state transition にします。既存 schema は Task 当たり ACTIVE Activity を1件に物理制約しており、履歴 Activity も保持するので、この実装のために新しい framework は不要です。
HIGH — dedupe key に transport version を入れない方がよい
現行 AC10 は dedupe identity に、
signal_kind + source + source_schema_version + canonical evidenceを含めます。
これは idempotency の意味として不安定です。
implementation_pr_observed(repo=X, PR=123)が v1 producer で一度適用された後、単なる schema evolution で producer v2 が同じ PR を再送すると、現実世界では同じ factなのに別 dedupe keyになります。sourceの rename/producer 移管でも同じです。dedupe identity は business fact に固定する方がよいです。
implementation_pr_observed = repo + PR number、pr_merged_observed = repo + PR + merge commit OID、refinement_approved = repo + issue + approved body hash、cleanup_completed = repo + PR + merge identity。sourceとsource_schema_versionは event metadata に残せば、診断性を失いません。events.dedupe_key+ partial UNIQUE 自体は適切です。SQLite は partial UNIQUE index を正式にサポートするため、大きな ledger を追加する必要はありません。(SQLite) 現行eventsにその列がまだ無いことも current main で確認できます。HIGH — GitHub lookup を UserPromptSubmit から外したい
#2565 は PR prompt の local claim miss 時に
closingIssuesReferencesを問い合わせ、claim hit + implementation nonterminal 時には merged state まで確認する設計です。structured relation を使うこと自体は正しいです。GitHub は
PullRequest.closingIssuesReferencesを正式提供しています。(GitHub Docs)ただし、UserPromptSubmit に network I/O を戻す必要はありません。
PR #2615/#2632 は Task Context を低摩擦化するため hook 処理をかなり慎重に設計しており、#2632 では timeout budget を増やさず、Task Context の mismatch/sync failure で workflow を止めない方向へ明確に修正されています。 SQLite 側の
BEGIN IMMEDIATEについても、writer 競合時にはSQLITE_BUSYが起こり得るので、外部I/Oを transaction 外へ出す現行方針は正しいです。(SQLite)個人開発で操作感を優先するなら、通常 hook は local DB lookupだけにするのがよいです。claimless PR は Task Context mutationせず prompt をそのまま通し、
open-pr、post-merge-cleanup、必要なら review workflow が GitHub snapshot を既に取得する時に relation/merged fact を解決して signal する。特に
pr_merged_observedは post-merge-cleanup preflight と非常に相性がよいです。一般的なPR promptを見るたびにGitHubへ行く実益は小さいです。HIGH — Issue 本文の contract を一度掃除すべき
反復 refinement の跡が残っています。
本文上部では
pr_merged_observedの trigger/producer/commit point が「未確定」と残っていますが、その後の In Scope では claim hit → bind → GitHub merged確認 → signal apply と commit pointまで既に詳細に固定されています。さらに In Scope にはまだ
statusline.py/herdr_projection.pyの prefix 除去が書かれています。 しかし AC11 は「presentation owner は #2634 で、#2565 は独自に変更しない」と明記しています。 そして実際、PR #2640 は既に merge 済みです。 current main のstatusline.pyもUnbound/Degraded、prefixなし、activity bare label に更新済みです。自律エージェントに実装させる前提では、こうした矛盾はかなり危険です。presentation bullet を In Scope から削除し、AC11 の regression gate だけ残すのがよいです。
Remaining Parent Gapsのpr_merged_observed 未確定も「実装未完了」に修正すべきです。GitHub relation は1点だけ明文化を追加
GitHub GraphQL は2026年8月に
closingIssuesReferencesへexcludeUserLinked/userLinkedOnlyを追加しており、現在の default はexcludeUserLinked=false、つまり manually linked Issue も含む契約です。(GitHub Docs)これは今回の用途なら妥当だと思います。GitHub 自身も手動linkとclosing keywordを Issue/PR link として扱い、default branch merge時の自動closeに利用します。(GitHub Docs) ただし暗黙 default に任せず、
closingIssuesReferences(first: 2, excludeUserLinked: false)と仕様に書いておく方が再現可能です。
first:2なら 0 / 1 / multiple 判定にも十分です。推奨する #2565 の修正方向
大規模再設計は不要です。実装前に (1) stale な session ID 前提を更新、(2) signal の Task authority と Activity transition authorityを分離、(3) dedupeをbusiness identity化、(4) GitHub network I/Oを通常 prompt hookからworkflow producer側へ移動、(5) #2634済みpresentation scopeと古い記述を削除、の5点を本文へ反映するのがよいです。
そのうえで
## 結論apply_workflow_signal()を1つの粗粒度 service operation とし、origin resolve → phase validation → dedupe → mutation → event append → projection enqueue を単一BEGIN IMMEDIATEに収める設計なら十分です。HMAC、ACL、daemon、message bus、2PC、汎用 retry coordinator は不要です。テストも新しい巨大 harness は作らず、既存tests/task-contextに signal service / equivalence / producer adapter の決定論的テストを追加し、実 runtime は既存経路を使う最小 canary に留めるのが、このリポジトリの用途に合っています。REQUEST_CHANGES 相当です。 ただし、#2565 の中心思想――structured workflow fact を trusted signal とし、SQLite を SSOT にして Issue/PR split-brain を防ぐ――は維持してよいです。
前回コメントで挙がった
task_id直指定、physical dedupe、GitHub relation の4状態、producer commit point、EXISTING=truereplay、producer fail-open は現行本文へかなり取り込まれています。 一方、2026-09-17 時点のmainはfa54f0b0...まで進んでおり、Issue 自体の最終更新は9月15日なので、その後の関連実装も含めて再評価すると、新たに2件の blocker と数件の設計上の高優先修正があります。CLAUDE_CODE_SESSION_IDを自動利用し、caller 明示session_idを廃止source_schema_version/sourceを混ぜているexcludeUserLinkedを明示BLOCKER —
session_idの前提が古くなっている現行 #2565 は、Claude Code が subprocess に session ID を環境変数として公開しないため、
signal_kind / source / source_schema_version / session_id / evidenceを caller が明示的に渡す、と定義しています。
これは現在の Claude Code 仕様と一致しません。公式ドキュメントでは
CLAUDE_CODE_SESSION_IDが Bash/PowerShell tool subprocess に自動設定され、hook に渡されるsession_idと一致し、/clear時にも更新されることが明記されています。Week 19 の公式更新にも同じ変更が記載されています。(Claude) Hooks 側も全 hook 共通入力としてsession_idを受け取ります。(Claude)つまり、以前の GitHub issue #27299/#47018 は当時は正しかったが、後の Claude Code 更新で解消済みです。興味深いことに、#2565 の以前のレビューコメント自身は既に
CLAUDE_CODE_SESSION_IDが利用可能だと正しく記載していました。現行 Issue 本文でそこだけ古い前提に戻っています。ここはワークフローを軽くできます。
task-contextctl signal applyの public payload は、だけで十分です。CLI adapter が
CLAUDE_CODE_SESSION_IDを読み、内部 service call のorigin_session_idに変換する。hook 経路なら hook JSON のsession_idを使う。環境変数が無い非 Claude 実行だけdeferred/unboundにすればよいです。現在の
signal applyがtask_id + repo + ref_kind + ref_numberを直接要求しているのは、Issue が置換予定としている通りです。 任意task_idを禁止する目的は維持しつつ、session ID を人間/LLMに運ばせる余計な配線は削除できます。BLOCKER — replay と「current Activity」方式が両立していない
こちらの方がデータ整合性上は深刻です。
#2565 は、Task Context sync が失敗しても producer 本体は成功させ、後から
EXISTING=true等で同じ signal を replay して self-heal する設計です。同時に、signal target は、session_id → ExecutionRun → Binding → current Activity/Taskだけから決める、としています。
この2つを組み合わせると、signal 発生時と replay 時で Activity が変わっているケースが未定義です。
例えば refinement 自体は正常終了したが Task Context sync が busy で失敗。そのまま利用者は implementation に進む。その後 replay された
refinement_approvedが current Activity=implを解決した場合、service が「current Activity を terminalize」という実装なら、実装 Activity を誤って完了させる余地があります。Task Context は意図的に producer を止めないため、これは異常系ではなく設計上想定すべき正常な遅延 deliveryです。
session-origin は Task identity の決定までにした方が安全です。その後は signal ごとの意味論を service が持つべきです。例えば
refinement_approvedは refine Activity 以外を絶対に terminalize しない、pr_merged_observedは implementation phase にだけ作用し、既に cleanup へ進んでいれば state regression せず late/no-op とする、cleanup_completedは cleanup Activity にのみ作用する、という単調な state transition にします。既存 schema は Task 当たり ACTIVE Activity を1件に物理制約しており、履歴 Activity も保持するので、この実装のために新しい framework は不要です。
HIGH — dedupe key に transport version を入れない方がよい
現行 AC10 は dedupe identity に、
signal_kind + source + source_schema_version + canonical evidenceを含めます。
これは idempotency の意味として不安定です。
implementation_pr_observed(repo=X, PR=123)が v1 producer で一度適用された後、単なる schema evolution で producer v2 が同じ PR を再送すると、現実世界では同じ factなのに別 dedupe keyになります。sourceの rename/producer 移管でも同じです。dedupe identity は business fact に固定する方がよいです。
implementation_pr_observed = repo + PR number、pr_merged_observed = repo + PR + merge commit OID、refinement_approved = repo + issue + approved body hash、cleanup_completed = repo + PR + merge identity。sourceとsource_schema_versionは event metadata に残せば、診断性を失いません。events.dedupe_key+ partial UNIQUE 自体は適切です。SQLite は partial UNIQUE index を正式にサポートするため、大きな ledger を追加する必要はありません。(SQLite) 現行eventsにその列がまだ無いことも current main で確認できます。HIGH — GitHub lookup を UserPromptSubmit から外したい
#2565 は PR prompt の local claim miss 時に
closingIssuesReferencesを問い合わせ、claim hit + implementation nonterminal 時には merged state まで確認する設計です。structured relation を使うこと自体は正しいです。GitHub は
PullRequest.closingIssuesReferencesを正式提供しています。([GitHub Docs]4)ただし、UserPromptSubmit に network I/O を戻す必要はありません。
PR #2615/#2632 は Task Context を低摩擦化するため hook 処理をかなり慎重に設計しており、#2632 では timeout budget を増やさず、Task Context の mismatch/sync failure で workflow を止めない方向へ明確に修正されています。 SQLite 側の
BEGIN IMMEDIATEについても、writer 競合時にはSQLITE_BUSYが起こり得るので、外部I/Oを transaction 外へ出す現行方針は正しいです。([SQLite]5)個人開発で操作感を優先するなら、通常 hook は local DB lookupだけにするのがよいです。claimless PR は Task Context mutationせず prompt をそのまま通し、
open-pr、post-merge-cleanup、必要なら review workflow が GitHub snapshot を既に取得する時に relation/merged fact を解決して signal する。特に
pr_merged_observedは post-merge-cleanup preflight と非常に相性がよいです。一般的なPR promptを見るたびにGitHubへ行く実益は小さいです。HIGH — Issue 本文の contract を一度掃除すべき
反復 refinement の跡が残っています。
本文上部では
pr_merged_observedの trigger/producer/commit point が「未確定」と残っていますが、その後の In Scope では claim hit → bind → GitHub merged確認 → signal apply と commit pointまで既に詳細に固定されています。さらに In Scope にはまだ
statusline.py/herdr_projection.pyの prefix 除去が書かれています。 しかし AC11 は「presentation owner は #2634 で、#2565 は独自に変更しない」と明記しています。 そして実際、PR #2640 は既に merge 済みです。 current main のstatusline.pyもUnbound/Degraded、prefixなし、activity bare label に更新済みです。自律エージェントに実装させる前提では、こうした矛盾はかなり危険です。presentation bullet を In Scope から削除し、AC11 の regression gate だけ残すのがよいです。
Remaining Parent Gapsのpr_merged_observed 未確定も「実装未完了」に修正すべきです。GitHub relation は1点だけ明文化を追加
GitHub GraphQL は2026年8月に
closingIssuesReferencesへexcludeUserLinked/userLinkedOnlyを追加しており、現在の default はexcludeUserLinked=false、つまり manually linked Issue も含む契約です。([GitHub Docs]4)これは今回の用途なら妥当だと思います。GitHub 自身も手動linkとclosing keywordを Issue/PR link として扱い、default branch merge時の自動closeに利用します。([GitHub Docs]6) ただし暗黙 default に任せず、
closingIssuesReferences(first: 2, excludeUserLinked: false)と仕様に書いておく方が再現可能です。
first:2なら 0 / 1 / multiple 判定にも十分です。推奨する #2565 の修正方向
大規模再設計は不要です。実装前に (1) stale な session ID 前提を更新、(2) signal の Task authority と Activity transition authorityを分離、(3) dedupeをbusiness identity化、(4) GitHub network I/Oを通常 prompt hookからworkflow producer側へ移動、(5) #2634済みpresentation scopeと古い記述を削除、の5点を本文へ反映するのがよいです。
そのうえで
apply_workflow_signal()を1つの粗粒度 service operation とし、origin resolve → phase validation → dedupe → mutation → event append → projection enqueue を単一BEGIN IMMEDIATEに収める設計なら十分です。HMAC、ACL、daemon、message bus、2PC、汎用 retry coordinator は不要です。テストも新しい巨大 harness は作らず、既存tests/task-contextに signal service / equivalence / producer adapter の決定論的テストを追加し、実 runtime は既存経路を使う最小 canary に留めるのが、このリポジトリの用途に合っています。squne121 commentedon Sep 17, 2026
確認した限り、今回は 対象コメントを
with_human_contextの trusted anchor として扱い、issue-refinement-loopをそのまま自動継続させるのが適切です。理由は3点です。現行 skill はループ途中の承認を既定で要求せず、
needs-fixはmax_iterationsまで自動継続します。また、explicit trusted human directive が section-bound patch で表現できない場合も、現在はissue_editor_required→ controlled full rewrite にルーティングでき、人間に構造化 directive を書き直させる必要がありません。対象コメントの指摘も現時点で妥当です。Claude Code 公式ドキュメントは現在
CLAUDE_CODE_SESSION_IDが Bash/PowerShell・hook subprocess に自動設定され、hook のsession_idと一致すると明記しています。 ([Claude]1) また GitHub のclosingIssuesReferencesはexcludeUserLinked=falseが現在のデフォルトなので、Issue contract で明示値に固定するという指摘にも根拠があります。 ([GitHub Docs]2) SQLite の partial UNIQUE index も公式サポートされています。 ([SQLite]3)対象コメントで優先すべき修正は、①caller明示
session_idの廃止、②Task identity authority と Activity transition authority の分離、③business factベースのdedupe、④UserPromptSubmitをlocal-onlyに維持、⑤#2634で解決済みpresentation scopeの除去、の5点です。以下を、すでに auto mode で起動している対話的 Claude-GPT にそのまま投入するのを推奨します。
squne121/loop-protocolの Issue #2565 に対して、リポジトリ内の canonical agent skill.claude/skills/issue-refinement-loop/SKILL.mdを使用し、以下の OWNER コメントを direct human context / trusted anchor として issue refinement を実行してください。
この Claude-GPT セッションは既に auto mode で起動しています。
この作業中にループ継続、Issue本文更新、deterministic repair、structural repair、issue-editor rewrite 等について私へ承認確認を求めないでください。
ただし Claude Code 自体の permission mode や
--dangerously-skip-permissions等を変更する必要はありません。リポジトリのissue-refinement-loopが定義する approval-free loop policy と canonical control-plane をそのまま使用してください。作業目的
anchor comment の REQUEST_CHANGES を #2565 の Issue contract に反映し、current
mainと現在の外部仕様に整合した、実装可能かつ矛盾のない Issue 本文まで refinement してください。大規模な再設計や新しい governance/security framework は導入せず、この個人趣味開発リポジトリでは correctness・有用性・低摩擦なワークフローを優先してください。
Anchor comment の主要要求
anchor comment を単なる参考情報ではなく、今回 operator が明示的に選択した human review directive として扱ってください。
最低限、以下を disposition してください。
Claude Code session ID の古い前提を削除する。
session_idを明示的に運ぶ設計を廃止する。CLAUDE_CODE_SESSION_IDを使用する。origin_session_idに変換する。session_idを使用する。deferred/unbound等の非破壊 outcome とする。task_idを caller が指定できないという既存方針は維持する。Task identity authority と Activity transition authority を分離する。
session origin は canonical Task identity の解決に使用する。
signal を「現在の Activity」へ無条件適用してはならない。
delayed/replayed signal が別phaseの Activityを誤terminalizeしないよう、signal kindごとに対象 phase/activity semantics をservice側で固定する。
例:
refinement_approved→ refine semanticsのみpr_merged_observed→ implementation semanticsのみ。すでに後続phaseなら regression させず late/no-opcleanup_completed→ cleanup semanticsのみtransition は単調であり、replayによるstate regressionを許さない。
dedupe identity を transport metadata ではなく business fact identity にする。
source/source_schema_versionはevent metadataとして保持してよいが、同じ現実世界のfactを別factにするdedupe identityへ含めない。events等への最小のDB physical UNIQUE/partial UNIQUEで実現し、別ledgerや汎用idempotency frameworkを追加しない。UserPromptSubmithot path を local-only に維持する。open-pr、post-merge-cleanup、その他すでにGitHub snapshotを必要とするworkflow producer側へ寄せる。Issue contract の stale / contradictory scope を掃除する。
pr_merged_observedのtrigger/producer/commit pointが「未確定」と残っている古い記述と、後段で既に固定済みの記述を整合させる。GitHub relation query の意味論を明示する。
closingIssuesReferences(first: 2, excludeUserLinked: false)相当をcontract上明示することを検討する。テストを必要以上に大型化しない。
tests/task-contextを中心に deterministic service/equivalence/producer adapter tests を使う。Canonical workflow
最初に current
main、Issue #2565 本文、全関連コメント、anchor comment、関連Issue/PR、現在の skill/references/scripts を取得してください。current
mainHEADを必ず確認し、anchor comment 作成時のfa54f0b0...からさらに進んでいる場合は最新状態をauthorityとして再評価してください。Step 0 / preflight
anchor URL は operator がこのプロンプトで明示的に選択した direct human context です。
canonical main root / default branch から
with_human_contextprofile を使ってください。概念上のcanonical entryは以下です。実際には current command registry / SKILL.md をSSOTとして、手書きで古いargvを再実装しないでください。
STATUS/NEXT_ACTION/MUST_READ/COMMANDS_JSON/BLOCKERS/ARTIFACT/ repair disposition をmachine-readable authorityとしてconsumeしてください。proseでplanner判断を再実装しないでください。SubAgent investigation
必ずSubAgentを使用してください。
少なくとも以下の独立した調査を行ってください。
codebase-investigator
current main を対象に read-only で以下を検証させてください。
scripts/task-context/**.claude/hooks/task_context/**.claude/skills/issue-refinement-loop/**.claude/skills/open-pr/**.claude/skills/post-merge-cleanup/**.claude/skills/post-merge-cleanup-executor/**docs/dev/task-context.md特に anchor comment の5つの主要修正が current main に照らしてまだ必要か、すでに別PRで解決済みかを区別してください。
web-researcher
primary/official sourcesを優先し、最低限以下をfreshに検証させてください。
Claude Code
CLAUDE_CODE_SESSION_IDsession_idとの関係/clear時の挙動Claude Code hooksのsession input semantics
GitHub GraphQL
PullRequest.closingIssuesReferencesexcludeUserLinkeduserLinkedOnlySQLite partial UNIQUE index
必要なら
BEGIN IMMEDIATE/ writer contention の公式semanticsブログ・二次資料ではなく公式docsを第一根拠にしてください。
SubAgent synchronization requirement
SubAgentを起動しただけで次へ進んではいけません。
codebase-investigatorとweb-researcherの両方について、ことを確認するまで Step 2 review や Issue mutationへ進まないでください。
並列起動は構いませんが、必ず全SubAgentの完了を待ってからjoinしてください。
SubAgentが失敗した場合も即座に人間へ質問せず、skillの既存retry/fallback/routing contractに従ってbounded recoveryを行ってください。
Trusted contract update
preflight.run.with_human_contextが trusted contract patch plan を生成した場合は、main/root control-planeだけが canonical mutation lane を実行してください。SubAgentやisolation worktreeからこのcommandを直接実行しないでください。
NEXT_ACTIONrouting以下は自動実行してください。途中で私へ承認を求めないでください。
apply_deterministic_repairrepair_action.applyapply_deterministic_structural_repairstructural_repair_action.applyissue_editor_requiredreviewer_feedback_urlとして再利用し、canonical issue-editor / edit-issue controlled transaction routeでfull rewritecontract_update.run.with_human_contextをno-progress retryしないneeds-fix / request_changesartifact pathは current SKILL.md のpath/provenance規則に従って扱い、absolute pathを誤ってconsumerに渡さないでください。
Review loop
各mutation後は必ず persisted Issue body/title をread backしてください。
fresh body revisionに対して、
を現在の skill contract に従って実行してください。
old review artifactやmutation前bodyに対するapprove判定を再利用しないでください。
needs-fixが返った場合はmax_iterationsまで自動継続してください。iterationごとに私へ「続けますか?」と質問しないでください。
Human judgment の扱い
このプロンプトと指定anchor commentそのものが、今回の既知のREQUEST_CHANGESに対する operator-selected human context です。
したがって、
について、人間判断が必要だとして再質問しないでください。
一方で、anchor・Issue・current repo・公式仕様のいずれにも答えがなく、repoのcanonical routerが真に
human_judgment_requiredをterminal authorityとして返す未指定の新しいproduct/design choiceについては、勝手な擬似承認を生成しないでください。その場合も質問待ち状態にはせず、canonical termination reportまで実行し、
を具体的に残して終了してください。
品質方針
このリポジトリは個人趣味開発です。
優先順位は以下です。
security hardening、policy framework、generic harnessを目的化しないでください。
特に以下を避けてください。
完了条件
Issue #2565 が fresh review で
approve / proceed相当になるまで refinementしてください。最低限、最終Issue本文で以下が明白であることを確認してください。
excludeUserLinkedの明示最終的に fresh persisted bodyに対するreview/readiness evidenceを確認してからterminationを行ってください。
この依頼は Issue refinementまで を対象とします。
approved後に implementation code変更、implementation worktreeでの実装、PR作成、mergeは開始しないでください。
現行skillが
LOOP_HANDOFF_RESULT_V1等のapproved termination artifactを要求する場合、それらのrefinement側handoff artifact/termination reportまでは生成して構いませんが、impl-review-loopの実作業には進まないでください。最終報告
最後に簡潔に以下を報告してください。
作業途中の承認確認は不要です。可能な処理はすべて現在のturn/session内で完了してください。
一点だけ意図的に強くしたのは、
session → current Activityをsignal targetにしないことです。replayを正式に許す以上、ここは単なる改善ではなく整合性条件です。またCLAUDE_CODE_SESSION_IDは現在公式に存在するため、古いcaller明示session配線を残す理由はありません。 ([Claude]1)この版は Issue refinement完了で止め、実装には進まない設定です。
squne121 commentedon Sep 17, 2026
issue-refinement-loop: human_escalation
sha256:43cb6a63f69a077912066067ee1e6946a52a96151141ae202143b4a1549abb02approve(canonical_step2_route: step_2_5)needs-fixhuman_judgment_required(semantic rewrite budget exhausted)Completed
The trusted-anchor rewrite removed caller-supplied session identity, fixed signal-specific phase semantics, made dedupe business-fact based, kept
UserPromptSubmitlocal-only, made GraphQL relation arguments explicit, and removed #2634/#2640 presentation implementation scope. Two bounded semantic rewrites additionally specified versioned evidence, phase/state selection, producer origin propagation, and single-transaction ownership ofimplementation_pr_observedIssue/PR claim attachment.Remaining findings
pr_merged_observed→ only then select/resume/start cleanup Activity or dispatch cleanup. If cleanup has already begun without that accepted fact, the required non-mutating/stop outcome is not yet fixed.sourcegrammar/canonical identifiers andsource_schema_version: "v1"rejection behavior are not fully specified.deferred, orduplicate_noop.Evidence
deferred/unbound, but does not explicitly decide whether an already-recorded fact may bypass stale-origin resolution.BEGIN IMMEDIATE; the semantic review found no safe implicit precedence rule..claude/artifacts/issue-refinement-loop/2565/4851d452874bdf4e/semantic_review_result.json.No implementation work, PR creation, or merge was started.
squne121 commentedon Sep 17, 2026
推奨は、今回の指示を human escalation に対する明示的な owner decision として扱い、Issue 本文をもう1回だけ意味論的に収束させてから fresh review することです。rewrite state を手動削除したり budget を無理にリセットするのではなく、現行 skill の trusted human/source-body-reset 経路に従わせるのが適切です。前回停止時に残っているのは High 1件・Medium 2件で、実装自体はまだ開始されていません。
3点の判断は、① post-merge は「fresh merged snapshot →
pr_merged_observedのapplied|duplicate_noop→ cleanup開始」の順序を必須化、② v1 のsourceは3 producerへ固定して top-level envelope を strict validation、③ replay は origin-first、つまり stale/unbound なら既存factを先読みせずdeferred/unbound、とするのを推奨します。特に③は、現行本文の「same fact が別Taskなら conflict」という契約を保てます。現在の Issue 本文自体も origin を canonical Task 解決に使う方針なので、この選択が最も整合的です。そのまま Claude-GPT に貼るプロンプトです。
squne121/loop-protocolの Issue #2565 について、現在のissue-refinement-loop: human_escalationを解消し、実装可能・矛盾なし・semantic review を通過できる Issue 本文まで refinement を完了してください。対象:
sha256:43cb6a63f69a077912066067ee1e6946a52a96151141ae202143b4a1549abb02既に auto mode で起動しているこの対話セッションで作業を完了してください。途中の承認確認は不要です。
このプロンプトは、前回
human_judgment_requiredで残った設計選択に対する direct human/OWNER decision です。以下の3点について再質問しないでください。これらを authoritative な refinement input として Issue 本文へ反映してください。post-merge-cleanup は必ず、
fresh merged PR snapshot を取得・検証→
pr_merged_observedを Task Context へ適用→
appliedまたは同一Task・同一factのduplicate_noopを確認→ cleanup Activity の select/resume/start
→ cleanup worker / cleanup work を dispatch
の順にする。
pr_merged_observedがdeferred/conflict/rejected_*/late_noopの場合は、その invocation では cleanup Activity を新規選択・resume・startせず、cleanup workerもdispatchしない。同じ merge fact がその Task に以前すでに accepted 済みの場合は、後述する origin 解決後の same-Task dedupe により
duplicate_noopを返せるため、その結果は cleanup precondition を満たしたものとして扱ってよい。一方、accepted 済みの同一
pr_merged_observedが存在しないまま cleanup が既に begun している場合、新しい merged signal は既存契約どおりlate_noop/CLEANUP_ALREADY_BEGUNとし、それを cleanup dispatch の成功条件として扱わない。その invocation は non-mutating に停止すること。既に行われた外部作業を rollback しない。これにより「merged snapshot を確認しただけで cleanup を開始する」ことを禁止し、Task Context 上で accepted merged fact が cleanup の明示的 precondition になるようにする。
top-level payload は厳密に次の4フィールドだけとする。
signal_kindsourcesource_schema_versionevidence型・値も検証する。
signal_kindは次の exact string enum:refinement_approvedimplementation_pr_observedpr_merged_observedcleanup_completedsource_schema_versionは JSON string の exact"v1"のみ受理する。v1 の canonical
sourceは現在の実 producer に限定して:issue-refinement-loopopen-prpost-merge-cleanupとする。
signal/source の対応も明示する:
refinement_approved→issue-refinement-loopimplementation_pr_observed→open-prpr_merged_observed→post-merge-cleanupcleanup_completed→post-merge-cleanup将来別 workflow を producer に追加する場合は、暗黙に arbitrary string を許可せず contract/schema revision で追加する。現在本文に「review workflow が merged signal producer になり得る」と読める曖昧な記述があるなら、v1 producer authority と矛盾しないよう整理する。
required field 欠落、unknown top-level field、wrong type、unknown
signal_kind、unknown/mismatchedsource、source_schema_version != "v1"はすべて non-mutating rejection とする。既存 disposition 命名規則との整合を確認した上で、top-level envelope error と evidence error を型付きで区別できる最小の契約にする。新しい validation framework は作らない。処理順序を明文化する。
まず envelope と evidence を完全に validate して canonical business-fact dedupe key を導出する。
その後、internal
origin_session_idをopen ExecutionRun → Binding → canonical Taskへ解決する。
origin が absent / stale / unbound なら、その時点で
deferred/unboundとし、既存 fact の duplicate lookup を先に行ってduplicate_noopへ短絡しない。origin が canonical Task へ正常に解決した後に、claim/Task consistency を検証する。
その後、同じ canonical Task に対する accepted business fact の dedupe を判定する。同一factが既にそのTaskへ記録済みなら
duplicate_noop。既存factが別Taskに属するなら、これまでの契約どおり
conflict/FACT_TASK_IDENTITY_CONFLICT。つまり
duplicate_noopは「valid envelope/evidence + valid bound origin + same canonical Task」が成立した後にだけ返せる。この ordering により stale/unbound origin を fact lookup で迂回せず、caller-selected identity を再導入せず、cross-Task replay を duplicate として隠さない。
実行方法
最初に current Issue body、OWNER anchor、human escalation comment、現在の
.claude/skills/issue-refinement-loopと関連 reference/script を読み直してください。過去 artifact の結論だけを信用せず、現在のmainと persisted Issue body を fresh に確認してください。SubAgent を必ず使用してください。
まず read-only の
codebase-investigatorを起動し、上記3決定が現在の Task Context service、signal API、open-pr、post-merge-cleanup、schema/tests と実装可能に整合するか調査させてください。並行して設計レビュー用 SubAgent を起動し、上記3決定を前提として、現在の Issue 本文に残る矛盾・未定義 precedence・producer boundary・transaction boundary を探索させてください。
両SubAgentの作業完了を必ず待ち、hand-back をすべて取得するまで Issue mutation に進まないでください。
一方だけ完了した状態で先へ進まないこと。
SubAgent を起動したまま最終回答へ進まないこと。
その結果を統合した後、必要なら
issue-editorSubAgent に、現在の Issue bodyを基準に最小限の semantic full rewrite を作らせてください。その SubAgent の完了も待ってください。mutation は current
issue-refinement-loopの canonical trusted-human/control-plane 手順に従ってください。以前の rewrite budget が persisted していても、router state/artifactを手動削除・改竄したり attempt counter を直接resetしてはいけません。このプロンプトによる human decision と source body change を、現行 skill が提供する正規の trusted update / source-body-reset semantics で扱ってください。SKILL.mdが指定する canonical executor / planner / review routing を迂回する ad-hoc mutation は避けてください。Issue本文へ反映後、fresh persisted bodyをread-backし、SHAを取り直してください。
その fresh body に対して deterministic/root review と semantic review を再実行してください。
semantic review が
needs-fixを返した場合でも、上記3点について人間へ再質問しないでください。anchor、今回のhuman decision、current repo evidenceから一意に修正できるものは自律的に修正し、許される範囲で refinement loop を継続してください。特に以下を semantic review で再確認してください。
post-merge preflight が accepted merged fact より前に cleanup Activity/worker を開始できないこと。
same accepted merged fact の再実行は、valid origin が同じTaskへ解決した後なら
duplicate_noopになり、cleanup再開を不必要に妨げないこと。accepted merged fact が無いまま cleanup が既に開始済みなら
late_noopを成功扱いせず、その invocation が non-mutating stop になること。stale/unbound origin が fact existence によって
duplicate_noopへ化けないこと。different-Task origin/replay が duplicate lookup に隠されず
FACT_TASK_IDENTITY_CONFLICTになること。top-level schema が
source_schema_version: "v1"、canonical source、signal/source pairing、unknown field/type rejectionまで明示されていること。既存の business-fact dedupe、single
BEGIN IMMEDIATEtransaction ownership、producer success と Task Context sync outcome の分離、UserPromptSubmit local-only、GitHub relation 0/1/multiple/unavailable、excludeUserLinked: false、presentation scope 除外を regression させないこと。大規模な redesign、新しい ledger、generic retry coordinator、daemon/message bus、security/governance framework は追加しないでください。個人趣味開発として correctness、有用性、低operator frictionを優先してください。
終了条件
この作業は Issue refinement の完了まで です。
実装コード変更、implementation PR 作成、merge、post-merge cleanup の実行には進まないでください。
最終報告では、使用した全SubAgentと各hand-back結果、前回残った3 finding の disposition、Issue本文への主要変更、deterministic review結果、semantic review結果、fresh final Issue body SHA、unresolved blocker の有無、implementation handoff readiness を明示してください。
deterministic review と semantic review の両方が implementation handoff を妨げない状態まで収束した場合は、その旨を明記して終了してください。
このプロンプトでは、前回の「semantic rewrite budget exhausted」を単純に無視させず、今回の人間判断で source contract が変わったことを正規経路で扱うようにしています。現行 router も human による source body change を reset condition として扱う設計です。
squne121 commentedon Sep 18, 2026
Contract Review Result
squne121 commentedon Sep 18, 2026
issue-refinement-loop 終了報告(approved)
Issue #2565 の refinement を完了しました。
verdict: approve(canonical_step2_route: step_2_5)assessment: clear、findings なしproceed(no_hard_dependencies_confirmed_this_cycle)次工程: 依頼により
impl-review-loop、実装、PR 作成、merge、post-merge cleanup は開始せず、この承認状態で停止します。squne121 commentedon Sep 18, 2026
GitHub の現在状態まで確認しました。#2565 はすでに refinement 済みで、最新の終了報告 comment
5730439626はstatus: impl_ready/routing_action: run_impl_review_loop、fresh contract snapshot は comment5730388999のstatus: go、Issue body SHA はsha256:1c5b1afc014f97f8325dff2ab5f84174f91a8b83bf481d2a155083b54a8cf2a0です。#2563/#2564 は closed、presentation 担当の #2634 / PR #2640 も merge 済みです。一方、現在の main では
task_contextctl.py signal applyがまだ caller 指定のtask_id/repo/ref_kind/ref_numberを受ける旧実装で、apply_workflow_signal()、events.dedupe_key、implementation_pr_observed、pr_merged_observed、cleanup_started、CLEANUP_PENDINGは未実装です。したがってalready_satisfiedより、通常の実装ルートへ進む可能性が高いです。推奨は、過去の
gosnapshot を単独の開始権限にはせず、現行impl-review-loopが要求する Root-Owned Synchronous Entry Transition を fresh に実行したうえで、その同一 invocation から Step 1 を起動することです。また、open-prのpublish: yes承認については今回の指示を明示的な事前承認として扱わせます。ループ上限は現行 skill の既定max_iterations=3を維持し、勝手に無限ループ化しない方がよいです。以下を、すでに auto mode で起動している対話的 Claude-GPT にそのまま渡す想定です。
あなたは現在、
squne121/loop-protocolの repository context で auto mode により起動済みの対話的 Claude-GPT です。対象は GitHub Issue #2565:
#2565
です。
この Issue を、repository の現在の canonical skill
.claude/skills/impl-review-loop/SKILL.mdおよび同 skill が参照する
steps/**、implement-issue、open-pr、pr-review-judge等の current HEAD 上の契約に従い、実装 → 検証 → PR作成 → CI確認 → PRレビュー → REQUEST_CHANGES 修正ループ → merge直前の承認済み状態まで自律的に進めてください。この作業について、通常の実装・テスト・commit・push・PR作成・レビュー対応・update-branch・再検証の各段階で人間へ承認を求めないでください。
今回のこのユーザー指示自体を、Issue #2565 専用の
open-prにおけるpublish: yesの明示的な事前承認として扱って構いません。PR publish のためだけに人間へ再確認しないでください。ただし、PR の merge、auto-merge の有効化、および #2565 自身の PR に対する post-merge-cleanup の実行は行わないでください。 最終到達点は merge 直前です。
現在確認済みの intake evidence
以下は開始時点の参考 evidence です。ただし、artifact/snapshot を authority として盲目的に使わず、必ず live state を再取得してください。
5730439626LOOP_HANDOFF_RESULT_V1.status: impl_readyrouting_action: run_impl_review_loop5730388999gosha256:1c5b1afc014f97f8325dff2ab5f84174f91a8b83bf481d2a155083b54a8cf2a0Closes/Fixes/Resolvesする専用 implementation PR は開始時点では確認されていない。これらは telemetry/reference です。live Issue、live main、linked worktree、実 diff、実テスト、CI、PR review を正本として扱ってください。
最初に必ず行うこと
impl-review-loopの Root-Owned Synchronous Entry Transition を省略しないでください。同一の root/main invocation の一続きの処理として、
capability preflight → live Issue #2565 fetch → current-run の canonical
issue-contract-review/root_entry_router.py経由の root transition → 直後の live Issue 再取得 → routing decision → 許可された場合のみその同じ invocation から Step 1 implementation-worker dispatchまで実行してください。
以前の
status: gocomment や body SHA を、Step 1 起動の再利用可能な authorization token として扱わないでください。current live contract が refinement を再要求していない限り、過去の refinement をやり直すこと自体を目的にしないでください。
SubAgent の使用は必須
impl-review-loopの control-plane/data-plane 分離を守り、root thread が実装やレビューを横取りしないでください。Step 1 は
implementation-workerSubAgent、Step 2 はtest-runnerSubAgent、Step 4 はpr-reviewerSubAgentへ canonical skill の materialized input を渡して委譲してください。current skill が別の専用 worker を要求する箇所も、その契約に従ってください。各 SubAgent について Common Completion Protocol を厳守してください。
spawn_agent後は canonicaltask_nameを保存してください。wait_agentの timeout、途中 update、mailbox activity は完了とはみなしません。SubAgent の final result を実際に取得し、その後list_agentsで同じ canonical task が terminalcompletedになったことを確認してください。errored、interrupted、shutdown、not_foundは成功扱いしないでください。final result と terminal
completedの両方を確認するまでは、次 Step や最終 routing に進まないでください。複数の required SubAgent を起動する場面がある場合は、必要な全 SubAgent が terminal になるまで待ち、全 hand-back を取得してから統合判断してください。一体だけ終わった状態で先へ進まないでください。
作業終了時に、起動した required SubAgent を残したまま終了しないでください。
SubAgent 側で nested delegation が禁止されている場合は、その禁止を破らないでください。
#2565 の実装方針
live repository を調査したうえで最小差分を設計してください。現時点では少なくとも以下の current-main gap が存在するため、まず事実確認してください。
task_contextctl.py signal applyは旧task_id/repo/ref_kind/ref_numbercaller-selected payload のままです。apply_workflow_signal()は未実装です。events.dedupe_keyとその physical partial UNIQUE constraint は未実装です。implementation_pr_observed、pr_merged_observed、cleanup_completedの workflow signal producer wiring は未実装です。cleanup_started/CLEANUP_PENDINGlifecycle も未実装です。実装順序としては、依存関係が許す限り次を優先してください。
apply_workflow_signal()、origin-first resolution、fixed historical Activity semantics。task-contextctl signal applyを strict v1 public envelope へ置換し、caller-selected identity を排除。issue-refinement-loop/open-prproducer adapter の structured signal wiring。open-prの fresh GitHub PR relation classifier と NEW /EXISTING=truereplay semantics。post-merge-cleanupの merge prerequisite、durable cleanup Activity lifecycle、cleanup_started/cleanup_completedwiring。UserPromptSubmitが local-only のままであることを固定する regression。この順序は implementation hint であり、current repository architecture を読んだ結果より小さく安全な依存順があるなら、その根拠を記録して調整して構いません。
絶対に保持する #2565 の semantic contract
public v1 envelope の top-level field は正確に
signal_kindsourcesource_schema_versionevidenceの4つだけです。
caller から
session_id、task_id、activity_id、binding_idを受け入れてはいけません。source_schema_versionは exact JSON string"v1"。kind/source pair は Issue 本文どおり固定してください。
origin は CLI なら
CLAUDE_CODE_SESSION_ID、hook なら hook JSONsession_idを internalorigin_session_idに変換するだけとし、public envelope へ露出させないでください。canonical Task resolution は
origin_session_id → open ExecutionRun → Binding → canonical Taskです。origin を current Activity 選択に使用しないでください。
service transaction の precedence は Issue 本文どおり、
envelope/evidence validation
→ business fact key derivation
→ origin resolution
→ claim/Task consistency
→ same-Task accepted-fact dedupe
→ 新規 merged fact の場合のみ cleanup-begun boundary
です。
stale/unbound origin が、既存 fact の存在だけで
duplicate_noopになってはいけません。different-Task replay が duplicate lookup に隠されてはいけません。
same Task / same accepted fact は
duplicate_noop。same business fact が別 Task に束縛済みなら
conflict/FACT_TASK_IDENTITY_CONFLICT。新規 merge fact が cleanup 開始後なら
late_noop/CLEANUP_ALREADY_BEGUN。implementation_pr_observedは implementation Activity を terminalize しません。pr_merged_observedのみが historical implementation Activity を適切な prerequisite 下で terminalize します。cleanup_completedは service が特定した eligible internal cleanup Activity だけを完了させます。apply_workflow_signal()の accepted mutation は一つのBEGIN IMMEDIATEtransaction 内で claim validation/attachment、dedupe、state transition、event append、projection enqueue を一貫して行ってください。外部 I/O を transaction 内に持ち込まないでください。open-pr relation classifier
implementation_pr_observedを送る前に fresh GitHub PR snapshot を取得し、Issue本文に指定されたclosingIssuesReferences(first: 2, excludeUserLinked: false, userLinkedOnly: false)の bounded classifier を使用してください。
exactly one reference かつ candidate Issue と一致した場合だけ signal へ進んでください。
zero →
deferred/NO_LINKexactly one mismatch →
conflict/RELATION_ISSUE_MISMATCHtwo-or-more →
conflict/MULTIPLE_CLOSING_ISSUESsnapshot fetch failure / GraphQL error / partial / timeout / null / malformed connection or nodes →
deferred/RELATION_UNAVAILABLEです。
これらの non-proceed outcome では Task Context mutation や claim attachmentを行わないでください。
generic PR body text、branch/worktree name、コメント、
Refs #Nだけを equivalence authority にしてはいけません。新規 PR と
EXISTING=trueの両方から同じimplementation_pr_observedfact を replay 可能にしてください。DRY_RUN=trueでは signal を送らないでください。Task Context adapter の deferred/conflict 等によって、既に成功した PR creation 等の producer 本体を rollback/failure 化しないでください。
UserPromptSubmit hot path
UserPromptSubmitは local-only のまま維持してください。PR claim miss を理由に GitHub relation lookup を追加しないでください。
claim miss では Task Context mutation を行わず prompt を通過させてください。
全prompt network lookup、daemon、poller、message bus、generic retry coordinator、2PC、新しい generic workflow framework を導入しないでください。
post-merge-cleanup コードの実装と、今回の PR 自身の実運用を区別すること
Issue #2565 の scope には
post-merge-cleanup/post-merge-cleanup-executorの実装変更とテストが含まれています。そのコード実装・unit/integration test は必ず行ってください。ただし、今回作成する #2565 implementation PR 自身は merge しません。
したがって、この PR を対象に実際の post-merge cleanup worker を起動したり worktree/branch cleanup を実行したりしないでください。
merged-PR lifecycle は fixture / deterministic test / Issue本文で要求される local runtime canary の範囲で検証してください。
presentation scope
#2634 / PR #2640 が statusLine / Herdr presentation を既に所有・実装しています。
#2565 では presentation contract を再設計しないでください。
Issue AC11 の既存 presentation regression test を通すことに限定してください。
Allowed Paths
live Issue #2565 の
Allowed Pathsを再取得してそれを authority にしてください。開始時点で確認されている範囲は以下です。
scripts/task-context/**tests/task-context/**.claude/hooks/task_context/**.claude/skills/issue-refinement-loop/**.claude/skills/open-pr/**.claude/skills/post-merge-cleanup/**.claude/skills/post-merge-cleanup-executor/**docs/dev/task-context.mdlive Issue が更新されていない限り、この範囲外へ変更を広げないでください。
Verification
Issue #2565 の live
Verification Commandsをそのまま authoritative command set として取得し、AC1〜AC14 を current PR head で実行してください。少なくとも現在の contract では以下の test 群を要求しています。
test_signal_refinement_approved.pytest_signal_envelope_schema.pytest_signal_strict_json_rejection.pytest_signal_origin_first_precedence.pytest_signal_phase_monotonicity.pytest_signal_producer_adapters.pytest_signal_github_relation_conflict.pytest_signal_generic_reference_non_equivalence.pytest_cleanup_pending_resume.pytest_signal_cleanup_completed_commit_point.pytest_events_dedupe_unique_constraint.pytest_statusline_render.pytest_herdr_projection.pytest_signal_evidence_schema.pytest_signal_state_transition_matrix.pytest_signal_producer_origin_propagation.pyさらに current head で
uv run --locked pytest tests/task-context -qを実行してください。
runtime verification applicability は live Issue を正本にしてください。開始時点の契約では AC8 が
immediateで、minimal canary は「merged implementation をCLEANUP_PENDINGとして観測し、その後 normal cleanup prompt で同じ Task が resume されること」を既存 local Task Context hook/workflow path で確認するものです。fallback を PASS と読み替えないでください。
impl-review-loop の継続方針
current skill の既定
max_iterationsを使用してください。開始時点では 3 です。人間承認を避けるために上限を勝手に無効化・増加させないでください。REQUEST_CHANGESが返った場合は、blockers と test failures を canonicalfix_deltaに変換し、次 iteration のimplementation-workerへ渡して修正してください。人間に「直してよいか」を聞かないでください。PR head が stale なら current head で再検証・再レビューしてください。
BEHINDの場合は current skill のroute_to_update_branchに従ってimplementation-workerに update-branch を委譲し、その後 Step 2 → Step 4 → Step 5 を再実行してください。required CI は current head に束縛して待機してください。
Step 2 の current-head binding tuple が stale なら Step 4 を起動せず Step 2 を再実行してください。
Step 1〜4 SubAgent の単なる
human_review_required: trueself-report が current skill 上 warning-only なら、それだけを理由に停止せず canonical routing を継続してください。reviewer の
verdict: APPROVEだけで終了しないでください。live PR state を fresh に読み、currentroute_loop_verdict_v2()の判定に従ってください。人間へ停止してよい条件
通常の実装判断や reviewer fix は人間へ戻さないでください。
ただし canonical hard stop は維持してください。特に以下の場合は停止して、推測・回避・force 操作をしないでください。
live Issue の Stop Conditions に実際に抵触した場合。
Allowed Paths 外の変更が不可避になった場合。
Issue が固定した public schema / type / key semantics 自体を変えなければ実装不能と判明した場合。
actual Git conflict (
mergeable == CONFLICTINGまたはmerge_state_status == DIRTY) が canonical routing 後も解消できない場合。secret / credential の開示、権限昇格、保護領域へのアクセスが必要な場合。
force push、history rewrite、hard reset、未公開 commit の破棄、
git worktree remove --force等の破壊的操作が必要な場合。新規 Issue に scope を分割しなければ進められない場合。
nested SubAgent delegation が必要だが contract で禁止されている場合。
max_iterationsに達した場合。canonical reviewer が
HUMAN_REVIEW_REQUIREDと判定した場合。AUTONOMY_POLICY validator が approved termination を拒否した場合。
live Issue/PR 上に明示的な人間の停止指示が現れた場合。
これらでは必要な fresh evidence を収集し、何が自動解決不能かを具体的に報告して停止してください。
破壊的操作の禁止
auto mode であっても次は自動実行しないでください。
PR merge
auto-merge enable
force push
destructive reset/history rewrite
未公開 local commit の破棄
人間確認を要求する one-shot destructive cleanup contract の consume
secret/credential の取得・表示・変更
Issue scope 外の大量変更
通常の専用 worktree 作成、branch 作成、Allowed Paths 内編集、test、commit、通常 push、Draft PR 作成、PR body 更新、review comment、CI待機、非破壊的 update-branch は、このタスクの範囲では再承認不要です。
終了条件
理想的な終了は current
impl-review-loopのapprovedroute です。以下を fresh current-head evidence で確認してください。
Issue contract の AC/VC を満たす。
Allowed Paths gate が通る。
required tests / runtime verification が要求どおり pass。
required CI が current head で pass。
pr-reviewer が current head に対して
APPROVE。reviewer blockers が空。
live mergeability が current canonical skill の approved 条件を満たす。開始時点の skill では
MERGEABLEかつCLEANまたはHAS_HOOKS。AUTONOMY_POLICY_V1 termination validator が pass。
その状態になったら
IMPL_REVIEW_LOOP_RESULT_V1.status: draft_pr_ready/termination_reason: approvedを canonical procedure に従って生成・投稿し、mergeせずに停止してください。already_satisfiedが fresh evidence で本当に成立する場合は current skill の structured recommendation route に従い、空PRを作らないでください。最終報告
終了時には最低限、以下を報告してください。
Issue #2565 の最終 live body SHA。
使用した全 SubAgent の canonical task name、役割、terminal state、主要 hand-back。
iteration 数と各 iteration の route。
作成または再利用した PR 番号・URL。
最終 PR head SHA。
changed files と Allowed Paths compliance。
AC1〜AC14 verification の結果。
full
tests/task-contextsuite 結果。runtime canary 結果。
required CI の current-head 結果。
pr-reviewer の最終 verdict / reviewed_head_sha / blockers / warnings。
live mergeable / merge_state_status。
AUTONOMY_POLICY validator 結果。
未解決 warning。
required SubAgent が残っていないこと。
最後に明確に、
MERGE NOT EXECUTEDと記載してください。
今から current repository state を fresh に読み直し、canonical
impl-review-loopの Root-Owned Synchronous Entry Transition から開始してください。この形なら、「承認不要」を open-pr の publish gate にまで明示的に伝えつつ、
impl-review-loop自体の hard safety boundary は壊さない構成になります。特に SubAgent は「起動した」だけで先へ進まず、final result取得 +list_agentsのcompleted確認まで待つよう強めています。squne121 commentedon Sep 18, 2026
root-owned entry router audit
route: invoke_impl_review_loop
reason: fresh_review_go_live_equality
squne121 commentedon Sep 18, 2026
root-owned entry router audit
route: invoke_impl_review_loop
reason: fresh_review_go_live_equality
fix: repair Task Context workflow Ruff violations (#2565)
4 remaining items
fix: harden Task Context workflow repair (#2565)
squne121 commentedon Sep 18, 2026
root-owned entry router audit
route: invoke_impl_review_loop
reason: fresh_review_go_live_equality
fix: fail closed post-merge cleanup facts (#2565)
fix: classify direct signals and unclaimed PR prompts (#2565)
squne121 commentedon Sep 19, 2026
impl-review-loop: 完了 (2026-09-19T10:59:00Z)
squne121 commentedon Sep 19, 2026
root-owned entry router audit
route: invoke_impl_review_loop
reason: fresh_review_go_live_equality
squne121 commentedon Sep 19, 2026
root-owned entry router audit
route: invoke_impl_review_loop
reason: fresh_review_go_live_equality
squne121 commentedon Sep 19, 2026
root-owned entry router audit
route: invoke_impl_review_loop
reason: fresh_review_go_live_equality
squne121 commentedon Sep 20, 2026
impl-review-loop: 完了 (2026-09-20T08:20:00Z)
feat: Task Contextへworkflow trusted signalsを統合する (#2661)
squne121 commentedon Sep 20, 2026
post-merge-cleanup: 完了 (2026-09-20T09:05:00Z)
squne121 commentedon Sep 30, 2026
contract cascade の明確化(#2827 / PR #2847)
OWNER decision(https://github.com/squne121/loop-protocol/issues/2827#issuecomment-5920334091)に基づく明確化のみを記録する。この Issue の normative contract(local-only / PR claim-miss safety)は変更しない。
UserPromptSubmithot path は local-only であり、unclaimed PR に対しては GitHub lookup も Task mutation も行わない(unclaimed_pr_local_only)。本文を更新しない理由: この Issue は履歴用の CLOSED Issue であり、本文の controlled update は古い本文が
RUNTIMEASSERT001(runtime_assertion_bindings 未宣言)の readiness でneeds_fixになるため mutation 前に停止した(編集前の本文でも同一の結果)。実証のない binding を履歴 Issue へ追加することは行わず、明確化を本 comment として記録する。この gate の assertion 単位 applicability は #2852 で扱う。