# task-2644+1 — ANU_CALLBACK_COLLECTOR_CONTROL_PLANE_CLEAN_REPLACEMENT

- Level: Lv.4 (clean replacement re-run · fresh worktree · task-2646 helper 기준 강제)
- 담당: 회장 결정 dev4 비슈누 우선 (★ dev1 헤르메스 금지 · dev2 오딘 task-2645 closeout 대기 제외 · dev6 페룬 revalidation contamination 우려 시 dev4 우선)
- base: origin/main 최신
- 단일소스 spec: 본 task md (회장 verbatim 11 원칙)
- 회장 결정 (2026-05-24 verbatim): task-2644 = CODE_ARTIFACT_PRESERVED_BUT_AUTHORITY_FAILED → clean replacement 재발행

## 결함명
`SELF_COLLECTOR_REPLACEMENT_REQUIRED`

## 목표 (회장 verbatim)
task-2644 기능 자체가 필요하므로, **clean replacement re-run을 별도 task로 발행**한다. 원본 task-2644 산출물은 참고만 가능하며 acceptance 금지.

## 11 필수 원칙 (회장 verbatim 1:1)
1. **원 task-2644 산출물은 참고만 가능** (read-only · 복붙·재사용 금지)
2. **dev1 헤르메스 재투입 금지**
3. **실제 구현은 독립 executor가 fresh worktree에서 수행**
4. **task-2646 helper/authority validator 기준 필수** (`utils/callback_registration.py` + `utils/callback_authority_validator.py` + `utils/callback_source_cross_checker.py`)
5. **ANU key actual owner 검증 필수** (등록 직후 actual schedule owner key == `c119085addb0f8b7`)
6. **self-key callback이면 즉시 FAIL** (회장 박제 SELF_COLLECTOR_FORBIDDEN)
7. **4 source cross-check 필수** (schedule_history + cron-history + envelope + result artifact)
8. **result artifact self-attestation만으로 acceptance 금지** (collector_session_id 자가 박제 무효)
9. **source attribution 8 enum 유지** (task-2644 spec 그대로 + `LOG_LOOKUP_OR_SCHEDULE_HISTORY_VERIFICATION` 포함)
10. **next_action_result 4 필드 유지** (decided / attempted / result / evidence_path + 6 enum)
11. **.anu_state freshness 유지** (state_version / snapshot_id stale 시 SAFE_DEGRADED_MODE 또는 HOLD_FOR_CHAIR fail-closed)

추가 12. **merge execution hardcoded 0 유지** (MERGE_READY → REQUEST_CHAIR_MERGE_APPROVAL only)

## 구현 범위 (task-2644 spec 1:1 재이행 + task-2646 helper 통합)
- 15 산출물 재구현 (SessionStart + Stop + UserPromptSubmit hook draft / callback adjudicator / next_action runner / source attribution guard / 4 schema / telegram template / fixture 8 / regression / rollback plan / staged settings template)
- 회장 보강 5 모두 반영 (source enum 8 / next_action 3 분기 mutually exclusive / merge policy lock / .anu_state freshness / next_action_result evidence)
- frozen anchor 15 모두 보존
- **callback registration은 task-2646 helper 사용 강제** (자체 구현 금지)
- **registration helper bypass 시 fail-closed**

## 원본 task-2644 산출물 참고 위치 (read-only)
- `/home/jay/workspace/.worktrees/task-2644-dev1/` (read-only)
- `/home/jay/workspace/memory/reports/task-2644.md` (read-only)
- `/home/jay/workspace/memory/specs/system_anu_callback_collector_control_plane_spec_260524.md` (read-only · 회장 보강 5 + fixture 8 박제)

## 자동 진행 허용
- task-2644 spec 1:1 재이행 (참고 가능)
- task-2646 helper 통합 (의무)
- ANU-Codex loop 자동수렴
- 4 Track 병렬 fan-out

## 자동 진행 금지 (회장 verbatim 8)
- task-2644 acceptance 금지
- task-2644 산출물 삭제 금지
- task-2644 기반 live activation 금지
- dev1 헤르메스 재투입 금지
- self-key callback 수용 금지
- live settings/cokacdir/dispatch.py operational activation 금지
- BOT App token / chair_authorization / real auto-merge / PR #141 pilot 금지
- merge execution 금지

## expected_files (~32 file · task-2644 15 산출물 + task-2646 helper 통합 wiring)
- hooks 3 (SessionStart + Stop + UserPromptSubmit) — fresh implementation
- utils 4 (callback_adjudicator + next_action_runner + source_attribution_guard + helper integration wiring)
- schemas 4 (callback_ledger + next_action_decision + anu_state + batch_aggregation)
- fixtures 8 (회장 보강 5 + §15 fixture 8 박제)
- regression 8 (각 fixture × adjudicator + next_action + Stop hook + source guard + helper integration)
- spec/template 4 (task md + rollback plan + staged settings template + telegram packet)
- INDEX 1

## finalize 프로토콜 (★ BOT App token 부재 — 로컬 한정)
1. base = origin/main 최신 clean (fresh worktree task-2644+1-{bot})
2. 신규 helper + schema + fixture + regression PASS · 기존 baseline 유지 · full new fail 0
3. **로컬 commit 만** (push/PR/merge 금지)
4. `/home/jay/workspace/memory/events/task-2644+1.done` 생성
5. `/home/jay/workspace/memory/reports/task-2644+1.md` 보고서 (16 필드 1:1)
6. ANU normal callback cron 강제 등록 (★ task-2646 helper 사용 self-test):
   - collector key: `c119085addb0f8b7` (ANU)
   - helper.register_callback() 사용 → actual owner key 검증 등록 직후 → OWNER_KEY_VERIFIED
   - envelope UTF-8 ≤3900 bytes hard limit (3500~3900 WARNING_BUT_ALLOWED 발사 가능 · wc -c 기준)
   - canonical_root=/home/jay/workspace
   - result.json 9 필드 + actual_owner_key_verified + replacement_verdict
7. validate_spawn_callback_contract + task-2646 helper self-test
8. executor ts + commit SHA 명기

## 회장 보고 형식 (16 필드 1:1 + replacement_verdict)
- branch / commit / changed files count / expected_files exact / regression / source enum / SessionStart hook / Stop hook / callback adjudicator / next_action runner / .callback ledger / batch aggregation / control-plane fixture 8 / closeout grade / live infra modified / PR created / PR number / forbidden action count / **replacement_verdict** (AUTHORITATIVE_CLEAN_REPLACEMENT / NON_AUTHORITATIVE_SELF_COLLECTOR / REPLACEMENT_FAIL)

## frozen anchor
- ANCHOR-1: "원 task-2644 산출물 참고만 가능 · 복붙·재사용 금지 · acceptance 금지"
- ANCHOR-2: "task-2646 helper/authority validator 기준 필수 · 자체 구현 금지"
- ANCHOR-3: "ANU key actual owner 검증 필수 · self-key 즉시 FAIL"
- ANCHOR-4: "4 source cross-check 필수 · result self-attestation acceptance 금지"
- ANCHOR-5: "source attribution 8 enum + next_action_result 4 필드 + .anu_state freshness 유지"
- ANCHOR-6: "merge execution hardcoded 0 · MERGE_READY → REQUEST_CHAIR_MERGE_APPROVAL only"
- ANCHOR-7: "fresh worktree · 독립 executor · dev1 헤르메스 금지"
- ANCHOR-8: "원본 task-2644 spec 박제 (회장 보강 5 + fixture 8 + frozen anchor 15) 1:1 재이행"

## allowed_resources (본 task의 capability)

```yaml
allowed_resources:
  paths:
    - "hooks/session_start_anu_callback_collector_v2.py"
    - "hooks/stop_anu_callback_collector_verifier_v2.py"
    - "hooks/user_prompt_submit_hook_callback_inbox_v2.py"
    - "utils/callback_adjudicator_v2.py"
    - "utils/callback_next_action_runner_v2.py"
    - "utils/source_attribution_guard_v2.py"
    - "utils/callback_collector_helper_integration.py"
    - "schemas/callback_ledger_v2.json"
    - "schemas/callback_next_action_decision_v2.json"
    - "schemas/anu_state_v2.json"
    - "schemas/callback_batch_aggregation_v2.json"
    - "memory/specs/telegram_chair_report_packet_template_v2_260524.json"
    - "memory/specs/task_2644_plus_1_rollback_plan_260524.md"
    - "memory/specs/staged_settings_template_anu_callback_collector_v2_260524.json"
    - "tests/fixtures/callback_control_plane_v2/**"
    - "tests/regression/callback_control_plane_v2/**"
    - "tests/test_callback_adjudicator_v2*.py"
    - "tests/test_callback_next_action_runner_v2*.py"
    - "tests/test_source_attribution_guard_v2*.py"
    - "tests/test_session_start_anu_callback_collector_v2*.py"
    - "tests/test_stop_anu_callback_collector_verifier_v2*.py"
    - "tests/test_user_prompt_submit_hook_callback_inbox_v2*.py"
    - "tests/test_callback_collector_helper_integration*.py"
    - "memory/tasks/task-2644+1.md"
    - "memory/reports/task-2644+1.md"
    - "memory/events/task-2644+1.done"
    - "INDEX.md"
  forbidden_paths:
    - "/home/jay/.claude/settings.json"
    - "/home/jay/.claude/settings.local.json"
    - "/usr/local/bin/cokacdir"
    - ".github/**"
    - "memory/events/*.cron-*"
    - "memory/tasks/task-2644.md"
    - "memory/tasks/task-2644.revalidation*"
    - "memory/tasks/task-2645*"
    - "memory/tasks/task-2646*"
    - "memory/tasks/task-2643*"
    - "memory/tasks/task-2641*"
    - "memory/tasks/task-2642*"
    - "memory/reports/task-2644.md"
    - "memory/events/task-2644.done"
    - "memory/events/task-2644.callback-authority-260524.json"
    - "memory/events/task-2644.final-disposition-260524.json"
    - "memory/events/task-2644.revalidation*"
    - "memory/system/.callback_ledger.jsonl"
    - "memory/specs/system_anu_callback_collector_control_plane_spec_260524.md"
    - "memory/specs/system_real_merge_executor_wiring_spec_260523.md"
    - "scripts/finish-task.sh"
    - "utils/callback_registration.py"
    - "utils/callback_authority_validator.py"
    - "utils/callback_source_cross_checker.py"
    - "utils/replacement_pr_runner.py"
    - "dispatch.py"
    - "hooks/session_start_anu_callback_collector.py"
    - "hooks/stop_anu_callback_collector_verifier.py"
    - "hooks/user_prompt_submit_hook_callback_inbox.py"
    - "utils/callback_adjudicator.py"
    - "utils/callback_next_action_runner.py"
    - "utils/source_attribution_guard.py"
    - "schemas/callback_ledger_v1.json"
    - "schemas/callback_next_action_decision_v1.json"
    - "schemas/anu_state_v1.json"
    - "schemas/callback_batch_aggregation_v1.json"
    - "**/.env*"
    - "**/credentials*"
  commands:
    - "pytest"
    - "python3 -m py_compile"
    - "python3 -m json.tool"
    - "git status"
    - "git diff"
    - "git add"
    - "git commit"
    - "git log"
    - "git checkout"
    - "git branch"
    - "git worktree"
    - "sha256sum"
    - "wc"
    - "printf"
    - "ls"
    - "grep"
    - "find"
  merge_policy: "local_only"
  ttl_hours: 96
```

끝
