version: 1
status: canonical
enforcement: Enforced
retention:
  max_records: 1000
  max_age_days: 7
origins:
  - planned
  - ad_hoc
  - automatic
  - manual
codex_hook_integration:
  canonical_model: runtime_work_session
  hook_state_owner: runtime_work_registration
  project_config_status: project_hook_source_present_unified_exec_incomplete
  project_hook_source: .codex/hooks.json
  enforced_events:
    - UserPromptSubmit
    - PreToolUse
    - PermissionRequest
    - PostToolUse
    - Stop
  known_limitations:
    - Codex PreToolUse/PostToolUse interception is incomplete for unified_exec; Runtime wrappers and close/coverage validation remain required.
    - Hosted Codex tool invocations may bypass project-local hooks for non-shell tools such as apply_patch; adapter classification must still cover them for environments that do invoke hooks, and cfd-0029 tracks fallback capture/proof.
  rule: Codex hooks are lightweight triggers into Runtime work registration and must not create a second work store.
hosted_tool_call_map:
  - tool: functions.exec_command
    classification: command_pattern
    expected_registration: read commands register visible diagnosis; tests/validation/service/lifecycle commands register required Runtime work
  - tool: functions.write_stdin
    classification: shell_read
    expected_registration: visible diagnosis/heartbeat for ongoing shell interaction
  - tool: functions.apply_patch
    classification: filesystem_write
    expected_registration: required Developer work registration with file-change expectation
  - tool: apply_patch
    classification: filesystem_write
    expected_registration: required Developer work registration with file-change expectation
  - tool: multi_tool_use.parallel
    classification: nested_tool_uses
    expected_registration: classify nested commands; filesystem writes remain required and read-only batches remain visible
  - tool: functions.view_image
    classification: read_only
    expected_registration: visible read-only work when hook invocation is available
  - tool: web.run
    classification: read_only
    expected_registration: visible read-only work when hook invocation is available
execution_policy:
  canonical: true
  assertive_solving_default_for_local_runtime: true
  close_gate_coverage_validation: Enforced
  raw_shell_evidence_policy: Runtime_import_required
  shell_truth_policy: forbidden_outside_facade_bootstrap_or_emergency
  daemon_freshness_after_runtime_source_change: Enforced
  typed_supervisor_for_service_actions: Enforced
  runtime_graphql_truth: Enforced
  socket_io_invalidation_only: Enforced
role_preflight:
  canonical_helper: runtime.roleWorkPreflight
  rule: Role-owned meaningful work must first validate fresh matching Runtime work registration, auto-register where policy allows, or fail fast with a registration violation.
  roles:
    - Requirements
    - Requirements Review
    - Prompt Synthesizer
    - Consultant Checkpoint
    - Orchestrator
    - Chunk Planner
    - Developer
    - QA
    - Runtime Executor
    - Runtime Supervisor
    - Dispatcher
    - Operator
tool_classes:
  - class: read_only
    requires_registration: false
    visibility_registration: true
    role_policy: codex_unknown_fallback
  - class: filesystem_read
    requires_registration: false
    visibility_registration: true
    role_policy: codex_unknown_fallback
  - class: filesystem_write
    requires_registration: true
    role_policy: active_chunk_owner_or_codex_unknown
    ad_hoc_allowed: true
  - class: shell_read
    requires_registration: false
    visibility_registration: true
    role_policy: codex_unknown_fallback
  - class: shell_execute
    requires_registration: true
    role_policy: policy_or_codex_unknown
    ad_hoc_allowed: true
  - class: test_execute
    requires_registration: true
    role_policy: Runtime Executor
    ad_hoc_allowed: true
  - class: validation_execute
    requires_registration: true
    role_policy: Runtime Executor
    ad_hoc_allowed: true
  - class: service_action
    requires_registration: true
    role_policy: Runtime Supervisor
    ad_hoc_allowed: false
  - class: authority_sensitive
    requires_registration: true
    role_policy: canonical_authority_owner_only
    ad_hoc_allowed: false
  - class: unknown
    requires_registration: true
    role_policy: codex_unknown_fallback
    ad_hoc_allowed: false
required_operations:
  - operation: orchestration_repo_work
    role: Orchestrator
    required: true
    auto_register: false
    ad_hoc_allowed: true
  - operation: requirements_artifact_work
    role: Requirements
    required: true
    auto_register: true
    ad_hoc_allowed: true
  - operation: requirements_review_work
    role: Requirements Review
    required: true
    auto_register: true
    ad_hoc_allowed: true
  - operation: prompt_synthesis_work
    role: Prompt Synthesizer
    required: true
    auto_register: true
    ad_hoc_allowed: true
  - operation: consultant_checkpoint_work
    role: Consultant Checkpoint
    required: true
    auto_register: true
    ad_hoc_allowed: false
  - operation: chunk_planning_work
    role: Chunk Planner
    required: true
    auto_register: true
    ad_hoc_allowed: true
  - operation: implementation
    role: Developer
    required: true
    auto_register: false
    ad_hoc_allowed: true
  - operation: qa_review
    role: QA
    required: true
    auto_register: true
    ad_hoc_allowed: true
  - operation: validation_runner
    role: Runtime Executor
    required: true
    auto_register: true
    ad_hoc_allowed: false
  - operation: summary_validation
    role: Runtime Executor
    required: true
    auto_register: true
    ad_hoc_allowed: false
  - operation: governance_validation
    role: Runtime Executor
    required: true
    auto_register: true
    ad_hoc_allowed: false
  - operation: runtime_tests
    role: Runtime Executor
    required: true
    auto_register: true
    ad_hoc_allowed: false
  - operation: backend_tests
    role: Runtime Executor
    required: true
    auto_register: true
    ad_hoc_allowed: false
  - operation: frontend_tests
    role: Runtime Executor
    required: true
    auto_register: true
    ad_hoc_allowed: false
  - operation: browser_smoke
    role: Runtime Executor
    required: true
    auto_register: true
    ad_hoc_allowed: false
  - operation: supervisor_action
    role: Runtime Supervisor
    required: true
    auto_register: true
    ad_hoc_allowed: false
  - operation: dispatcher_execution
    role: Dispatcher
    required: true
    auto_register: true
    ad_hoc_allowed: false
  - operation: operator_notification
    role: Runtime Executor
    required: true
    auto_register: true
    ad_hoc_allowed: false
  - operation: bounded_maintenance
    role: Runtime Executor
    required: true
    auto_register: true
    ad_hoc_allowed: false
rule: UI components render Runtime/GraphQL work registration truth; services/facades own state coordination; Socket.IO invalidates only.
