---
phase: 66-global-source-catalog-and-cross-topic-dedup
plan: 01
type: execute
wave: 1
depends_on: []
files_modified:
  - research/knowledge-hub/knowledge_hub/source_catalog.py
  - research/knowledge-hub/knowledge_hub/cli_source_catalog_handler.py
  - research/knowledge-hub/knowledge_hub/aitp_service.py
  - research/knowledge-hub/knowledge_hub/aitp_cli.py
  - research/knowledge-hub/tests/test_source_catalog.py
  - research/knowledge-hub/tests/test_aitp_service.py
  - research/knowledge-hub/tests/test_aitp_cli.py
  - research/knowledge-hub/tests/test_aitp_cli_e2e.py
autonomous: true
requirements:
  - REQ-SCAT-01
  - REQ-SCAT-02
must_haves:
  truths:
    - source reuse must be compiled from real Layer 0 inputs
    - topic-local provenance must remain visible after catalog deduplication
    - the catalog must be reachable through production service/CLI entrypoints
---

<objective>
Compile the first global Layer 0 source catalog and expose it through the real
AITP service and CLI.
</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/66-global-source-catalog-and-cross-topic-dedup/66-CONTEXT.md
@.planning/REQUIREMENTS.md
@research/knowledge-hub/source-layer/README.md
@research/knowledge-hub/knowledge_hub/source_intelligence.py
</context>

<tasks>

<task type="auto">
  <name>Task 1: Add failing tests for source catalog compilation</name>
  <files>research/knowledge-hub/tests/test_source_catalog.py, research/knowledge-hub/tests/test_aitp_service.py, research/knowledge-hub/tests/test_aitp_cli.py, research/knowledge-hub/tests/test_aitp_cli_e2e.py</files>
  <read_first>research/knowledge-hub/tests/test_source_catalog.py, research/knowledge-hub/source-layer/README.md</read_first>
  <action>Add red tests that require a compiled source catalog and production service/CLI access path.</action>
  <verify>python -m pytest research/knowledge-hub/tests/test_source_catalog.py research/knowledge-hub/tests/test_aitp_service.py research/knowledge-hub/tests/test_aitp_cli.py research/knowledge-hub/tests/test_aitp_cli_e2e.py -q</verify>
  <acceptance_criteria>
    - tests fail before implementation
    - failures prove cross-topic source reuse is still invisible
  </acceptance_criteria>
  <done>A red contract exists for Phase `66`.</done>
</task>

<task type="auto">
  <name>Task 2: Implement compiled source catalog and CLI entrypoint</name>
  <files>research/knowledge-hub/knowledge_hub/source_catalog.py, research/knowledge-hub/knowledge_hub/cli_source_catalog_handler.py, research/knowledge-hub/knowledge_hub/aitp_service.py, research/knowledge-hub/knowledge_hub/aitp_cli.py</files>
  <read_first>research/knowledge-hub/knowledge_hub/source_intelligence.py, research/knowledge-hub/knowledge_hub/aitp_cli.py</read_first>
  <action>Compile cross-topic source identity into `source-layer/compiled/` and expose it through `compile-source-catalog`.</action>
  <verify>python -m pytest research/knowledge-hub/tests/test_source_catalog.py research/knowledge-hub/tests/test_aitp_service.py research/knowledge-hub/tests/test_aitp_cli.py research/knowledge-hub/tests/test_aitp_cli_e2e.py -q</verify>
  <acceptance_criteria>
    - source catalog groups rows by canonical source identity
    - cross-topic reuse becomes visible from durable artifacts
    - service and CLI can regenerate the same compiled catalog
  </acceptance_criteria>
  <done>Global source catalog compilation lands in production code.</done>
</task>

<task type="auto">
  <name>Task 3: Re-run source-catalog regressions and full suite</name>
  <files>research/knowledge-hub/tests/test_source_catalog.py, research/knowledge-hub/tests/test_aitp_service.py, research/knowledge-hub/tests/test_aitp_cli.py, research/knowledge-hub/tests/test_aitp_cli_e2e.py, research/knowledge-hub/tests/test_maintainability_budgets.py</files>
  <read_first>.planning/REQUIREMENTS.md</read_first>
  <action>Re-run the targeted source-catalog slice and the full knowledge-hub suite before moving to citation traversal.</action>
  <verify>python -m pytest research/knowledge-hub/tests -q</verify>
  <acceptance_criteria>
    - source-catalog slice exits 0
    - maintainability budgets stay green
    - no full-suite regression is introduced
  </acceptance_criteria>
  <done>Phase `66` lands on a stable verified baseline.</done>
</task>

</tasks>
