---
phase: 55-paired-backend-alignment-and-drift-audit
plan: 01
type: execute
wave: 1
depends_on:
  - 54-control-plane-ontology-freeze-and-runtime-contracts
files_modified:
  - research/knowledge-hub/knowledge_hub/aitp_service.py
  - research/knowledge-hub/knowledge_hub/runtime_bundle_support.py
  - research/knowledge-hub/knowledge_hub/capability_audit_support.py
  - research/knowledge-hub/knowledge_hub/aitp_cli.py
  - research/knowledge-hub/tests/test_aitp_service.py
  - research/knowledge-hub/tests/test_aitp_cli.py
  - research/knowledge-hub/tests/test_runtime_profiles_and_projections.py
autonomous: true
requirements:
  - REQ-BACKEND-01
  - REQ-BACKEND-02
  - REQ-VERIFY-01
must_haves:
  truths:
    - paired-backend alignment must become a production audit surface, not only a doctrinal note
    - consultation, promotion, and sync semantics must remain explicitly distinct
    - this phase closes only with production behavior and tests, not docs alone
---

<objective>
Materialize the first production paired-backend alignment and drift-audit
surface for the theoretical-physics backend pair.
</objective>

<execution_context>
@D:/BaiduSyncdisk/Theoretical-Physics/.codex-home/get-shit-done/workflows/execute-plan.md
@D:/BaiduSyncdisk/Theoretical-Physics/.codex-home/get-shit-done/templates/summary.md
</execution_context>

<context>
@.planning/phases/55-paired-backend-alignment-and-drift-audit/55-CONTEXT.md
@research/knowledge-hub/canonical/backends/THEORETICAL_PHYSICS_PAIRED_BACKEND_CONTRACT.md
@research/knowledge-hub/canonical/L2_PAIRED_BACKEND_MAINTENANCE_PROTOCOL.md
@research/knowledge-hub/knowledge_hub/runtime_bundle_support.py
@research/knowledge-hub/knowledge_hub/capability_audit_support.py
@research/knowledge-hub/knowledge_hub/aitp_service.py
@research/knowledge-hub/knowledge_hub/aitp_cli.py
</context>

<tasks>

<task type="auto">
  <name>Task 1: Add failing tests for paired-backend audit and runtime exposure</name>
  <files>research/knowledge-hub/tests/test_aitp_service.py, research/knowledge-hub/tests/test_aitp_cli.py, research/knowledge-hub/tests/test_runtime_profiles_and_projections.py</files>
  <read_first>research/knowledge-hub/tests/test_aitp_service.py, research/knowledge-hub/tests/test_aitp_cli.py, research/knowledge-hub/tests/test_runtime_profiles_and_projections.py</read_first>
  <action>Add failing tests that require a production paired-backend audit payload plus explicit runtime/audit exposure of pairing roles, drift status, backend debt, and semantic separation from consultation/promotion.</action>
  <verify>python -m pytest research/knowledge-hub/tests/test_aitp_service.py research/knowledge-hub/tests/test_aitp_cli.py research/knowledge-hub/tests/test_runtime_profiles_and_projections.py -q</verify>
  <acceptance_criteria>
    - tests fail before implementation
    - failures prove the absence of the paired-backend audit surface
  </acceptance_criteria>
  <done>A real failing contract exists for Phase `55`.</done>
</task>

<task type="auto">
  <name>Task 2: Implement paired-backend support and service entrypoint</name>
  <files>research/knowledge-hub/knowledge_hub/aitp_service.py, research/knowledge-hub/knowledge_hub/runtime_bundle_support.py, research/knowledge-hub/knowledge_hub/capability_audit_support.py</files>
  <read_first>research/knowledge-hub/knowledge_hub/aitp_service.py, research/knowledge-hub/knowledge_hub/runtime_bundle_support.py, research/knowledge-hub/knowledge_hub/capability_audit_support.py</read_first>
  <action>Implement a bounded paired-backend audit surface that reports pair members, roles, pairing status, drift/debt status, maintenance protocol visibility, and semantic separation from consultation/promotion/sync.</action>
  <verify>python -m pytest research/knowledge-hub/tests/test_aitp_service.py research/knowledge-hub/tests/test_runtime_profiles_and_projections.py -q</verify>
  <acceptance_criteria>
    - service can emit a production paired-backend audit payload
    - capability audit and runtime surfaces can expose the paired-backend status honestly
  </acceptance_criteria>
  <done>Paired-backend governance is now inspectable through production code.</done>
</task>

<task type="auto">
  <name>Task 3: Add a CLI audit entrypoint and keep semantics explicit</name>
  <files>research/knowledge-hub/knowledge_hub/aitp_cli.py, research/knowledge-hub/knowledge_hub/aitp_service.py</files>
  <read_first>research/knowledge-hub/knowledge_hub/aitp_cli.py, research/knowledge-hub/knowledge_hub/aitp_service.py</read_first>
  <action>Add a CLI entrypoint for paired-backend audit so operators can inspect pair status without opening backend cards by hand.</action>
  <verify>python -m pytest research/knowledge-hub/tests/test_aitp_cli.py research/knowledge-hub/tests/test_aitp_service.py -q</verify>
  <acceptance_criteria>
    - CLI can reach the paired-backend audit payload
    - consultation, promotion, and sync semantics remain distinct in returned data
  </acceptance_criteria>
  <done>Operators have a bounded audit entrypoint for paired-backend governance.</done>
</task>

<task type="auto">
  <name>Task 4: Re-run the targeted integrated slice</name>
  <files>research/knowledge-hub/tests/test_aitp_service.py, research/knowledge-hub/tests/test_aitp_cli.py, research/knowledge-hub/tests/test_runtime_profiles_and_projections.py</files>
  <read_first>.planning/REQUIREMENTS.md</read_first>
  <action>Re-run the targeted integrated slice to prove the paired-backend audit surface lands cleanly in the runtime stack.</action>
  <verify>python -m pytest research/knowledge-hub/tests/test_aitp_service.py research/knowledge-hub/tests/test_aitp_cli.py research/knowledge-hub/tests/test_runtime_profiles_and_projections.py -q</verify>
  <acceptance_criteria>
    - the targeted slice exits 0
  </acceptance_criteria>
  <done>Phase `55` lands on a stable tested baseline.</done>
</task>

</tasks>
