version: 1
status: target_canonical
enforcement: Pending Enforcement
execution_owners:
  - approved-action-dispatcher
  - operator-daemon
  - runtime-supervisor
  - operator-questions
allowed_approval_channels:
  - telegram_operator_question
  - local_operator_question
mandatory_rule:
  name: policy_memory_rule
  enforcement: Pending Enforcement
  statement: Required approval policy must not live only in chat history, one-off prompts, role files, final summaries, or untested markdown.
actions:
  close_commit:
    approval_required: true
    allowed_channels:
      - telegram_operator_question
      - local_operator_question
    execution_owner: approved-action-dispatcher
    trusted_executor: operator-daemon
    dispatcher_action: close_commit
    destructive: true
    requires_fresh_question: true
    autonomous_continuation:
      supported: true
      mode: deemed
      operator_delegation_required: true
      prompt_required: false
      audit_label: authority_to_continue_autonomously
      operator_note: closed and committed autonomously
      summary_heading: Chunk finished
      approval_note_heading: Chunk autonomously approved
      approval_note_actionability: non_actionable
      allowed_when:
        - explicit_current_operator_delegation
        - runtime_validation_passed
        - active_chunk_ready_for_human_review
        - no_serious_carry_forward_debt_blocks_following_chunks
        - runtime_state_authoritative_and_healthy
      forbidden_when:
        - architecture_uncertainty_high
        - serious_carry_forward_debt_impacts_next_chunks
        - runtime_state_uncertain_or_degraded
        - validation_failure_requires_strategy_change
        - production_or_secret_touching_action
    cannot_be_implied_by:
      - summary_recommendation
      - recent_chat_context
      - codex_memory
    stale_rules:
      reject_if_git_status_changed: true
      reject_if_target_chunks_changed: true
      reject_if_validation_state_changed: true
      reject_if_runtime_degraded: true
      reject_if_expired: false
      expiry_is_advisory_only: true
      reject_if_already_executed: true
      reject_if_target_cannot_be_reconstructed: true
    lifetime_policy:
      validity_model: state_fingerprint
      expires_because:
        - git_status_changed
        - target_chunks_changed
        - validation_state_changed
        - runtime_state_changed
        - superseded
        - consumed
        - explicit_invalidation
      does_not_expire_because:
        - short_wall_clock_duration
      advisory_age_seconds_default: 172800
      operator_surface_rule: show age as advisory, not as blocking expiration
    timeline_events:
      - approval_requested
      - approval_accepted
      - approved_action_started
      - approved_action_executed
      - approved_action_failed
      - approved_action_blocked
    docs:
      - ai/standards/runtime-tooling-governance.md
      - ai/standards/operator-questions.md
      - ai/tools/approved-action-dispatcher/README.md

  git_add_approved:
    approval_required: true
    allowed_channels:
      - telegram_operator_question
      - local_operator_question
    execution_owner: operator-daemon
    trusted_executor: operator-daemon
    daemon_action: git_add_approved
    destructive: true
    rules:
      allow_tracked_deletions: true
      reject_untracked_missing_files: true
      reject_env_tmp_secret_db_runtime_artifacts: true
      reviewed_file_list_required: true
    docs:
      - ai/standards/trusted-operator-daemon.md
      - ai/tools/operator-daemon/README.md

  git_commit:
    approval_required: true
    allowed_channels:
      - telegram_operator_question
      - local_operator_question
    execution_owner: operator-daemon
    trusted_executor: operator-daemon
    daemon_action: git_commit
    destructive: true
    stale_rules:
      reject_if_git_status_changed_after_staging: true
      reject_if_message_missing: true
      reject_if_unreviewed_files_present: true
    docs:
      - ai/standards/trusted-operator-daemon.md
      - ai/tools/operator-daemon/README.md

  complete_chunk:
    approval_required: true
    allowed_channels:
      - telegram_operator_question
      - local_operator_question
    execution_owner: operator-daemon
    trusted_executor: operator-daemon
    daemon_action: complete_chunk
    destructive: true
    stale_rules:
      reject_if_chunk_missing: true
      reject_if_chunk_not_ready: true
      reject_if_validation_evidence_missing: true
    docs:
      - ai/standards/runtime-tooling-governance.md
      - ai/tools/operator-daemon/README.md

  local_dev_status:
    approval_required: false
    execution_owner: operator-daemon
    trusted_executor: operator-daemon
    daemon_action: local_dev_status
    destructive: false
    docs:
      - ai/standards/local-dev-runtime.md
      - ai/tools/operator-daemon/README.md

  dev_server_status:
    approval_required: false
    execution_owner: operator-daemon
    trusted_executor: operator-daemon
    daemon_action: dev_server_status
    destructive: false
    docs:
      - ai/standards/local-dev-runtime.md
      - ai/tools/operator-daemon/README.md

  dev_server_restart:
    approval_required: true
    allowed_channels:
      - telegram_operator_question
      - local_operator_question
    execution_owner: operator-daemon
    trusted_executor: operator-daemon
    daemon_action: dev_server_restart
    destructive: false
    docs:
      - ai/standards/local-dev-runtime.md
      - ai/tools/operator-daemon/README.md

  capture_screenshots:
    approval_required: true
    allowed_channels:
      - telegram_operator_question
      - local_operator_question
    execution_owner: operator-daemon
    trusted_executor: operator-daemon
    daemon_action: capture_screenshots
    destructive: false
    rules:
      screenshot_output_root: /tmp
      no_repo_screenshot_artifacts: true
    docs:
      - ai/standards/ui-review.md
      - ai/tools/operator-daemon/README.md

  telegram_bridge_restart:
    approval_required: false
    execution_owner: runtime-supervisor
    trusted_executor: runtime-supervisor
    supervisor_action: telegram_bridge_restart
    destructive: false
    requires_bounded_health_wait: true
    restart_verification:
      command: node ai/runtime/dist/cli.js telegram status --json
      expected:
        running: true
        restart_required: false
    docs:
      - ai/tools/runtime-supervisor/README.md
      - ai/tools/telegram/README.md

  operator_daemon_restart:
    approval_required: false
    execution_owner: runtime-supervisor
    trusted_executor: runtime-supervisor
    supervisor_action: operator_daemon_restart
    destructive: false
    requires_bounded_health_wait: true
    docs:
      - ai/tools/runtime-supervisor/README.md
      - ai/standards/local-dev-runtime.md
