---
phase: 166.1
plan: 01
type: execute
wave: 1
depends_on:
  - 166
files_modified:
  - research/knowledge-hub/source-layer/scripts/register_arxiv_source.py
  - research/knowledge-hub/source-layer/scripts/discover_and_register.py
  - research/knowledge-hub/intake/ARXIV_FIRST_SOURCE_INTAKE.md
  - research/knowledge-hub/L0_SOURCE_LAYER.md
  - research/knowledge-hub/README.md
  - research/knowledge-hub/runtime/scripts/run_first_run_topic_acceptance.py
  - research/knowledge-hub/tests/test_source_discovery_contracts.py
  - research/knowledge-hub/tests/test_aitp_cli_e2e.py
  - research/knowledge-hub/tests/test_runtime_scripts.py
autonomous: false
requirements:
  - REQ-L0HAND-03
  - REQ-VERIFY-01
must_haves:
  truths:
    - arXiv registration must attempt content acquisition by default while preserving honest failure reporting
    - discovery-first registration must inherit the same semantics as direct registration
    - the milestone must close with one bounded fresh-topic proof of bootstrap to handoff to registration on the repository kernel root
---

<objective>
Make the concrete `L0` source-acquisition handoff from Phase `166` useful
immediately by switching arXiv registration to contentful-by-default, aligning
discovery forwarding and docs to that same default, and leaving one bounded
fresh-topic proof of `bootstrap -> handoff -> registration` without widening
into automatic queue execution or fake content success.
</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/166.1-contentful-source-registration-default/166.1-CONTEXT.md
@.planning/phases/166.1-contentful-source-registration-default/166.1-RESEARCH.md
@.planning/phases/166.1-contentful-source-registration-default/166.1-VALIDATION.md
@research/knowledge-hub/source-layer/scripts/register_arxiv_source.py
@research/knowledge-hub/source-layer/scripts/discover_and_register.py
@research/knowledge-hub/runtime/scripts/run_first_run_topic_acceptance.py
</context>

<tasks>

<task type="auto">
  <name>Task 1: Flip direct arXiv registration to contentful-by-default with an explicit opt-out</name>
  <files>research/knowledge-hub/source-layer/scripts/register_arxiv_source.py, research/knowledge-hub/tests/test_source_discovery_contracts.py</files>
  <read_first>research/knowledge-hub/source-layer/scripts/register_arxiv_source.py, research/knowledge-hub/tests/test_source_discovery_contracts.py, .planning/phases/166.1-contentful-source-registration-default/166.1-CONTEXT.md, research/knowledge-hub/intake/ARXIV_FIRST_SOURCE_INTAKE.md</read_first>
  <action>Change `register_arxiv_source()` so the shared helper default is `download_source=True`, then update the CLI parser to expose `--metadata-only` as the explicit negative override while preserving `--download-source` as a compatibility-positive alias. The parser semantics must stay deterministic and mutually exclusive: no ambiguous final value if both flags are attempted together. Keep the existing graceful fallback behavior unchanged: source registration still succeeds when download or extraction fails, and `snapshot.md` must continue to report `download_status`, `extraction_status`, and any error note honestly. Add or update unit coverage in `test_source_discovery_contracts.py` so the direct helper default is contentful-by-default, `--metadata-only` forces the lightweight path, and compatibility callers that still pass `download_source=False` remain supported.</action>
  <verify>python -m pytest research/knowledge-hub/tests/test_source_discovery_contracts.py -q</verify>
  <acceptance_criteria>
    - `register_arxiv_source()` defaults to `download_source=True`
    - the CLI exposes `--metadata-only`
    - `--download-source` still parses successfully as an explicit positive flag
    - fallback registration still writes artifacts and reports failed download/extraction honestly
  </acceptance_criteria>
  <done>The canonical Layer 0 registration helper now matches the milestone's contentful default.</done>
</task>

<task type="auto">
  <name>Task 2: Align discovery-to-registration forwarding with the same default semantics</name>
  <files>research/knowledge-hub/source-layer/scripts/discover_and_register.py, research/knowledge-hub/tests/test_source_discovery_contracts.py</files>
  <read_first>research/knowledge-hub/source-layer/scripts/discover_and_register.py, research/knowledge-hub/tests/test_source_discovery_contracts.py, .planning/phases/166-public-front-door-l0-source-handoff/166-01-SUMMARY.md, .planning/phases/166.1-contentful-source-registration-default/166.1-CONTEXT.md</read_first>
  <action>Update `discover_and_register.py` so the query-first bridge inherits the same contentful-by-default behavior as direct registration. Add `--metadata-only` to the bridge CLI, preserve `--download-source` as a compatibility-positive override, and make sure the default forwarding path no longer injects metadata-only behavior into `register_arxiv_source()`. Extend regression coverage in `test_source_discovery_contracts.py` so discovery-driven registration proves the new default, the opt-out still works, and the bridge does not diverge from direct registration semantics.</action>
  <verify>python -m pytest research/knowledge-hub/tests/test_source_discovery_contracts.py -q</verify>
  <acceptance_criteria>
    - discovery-driven registration attempts content acquisition by default
    - `discover_and_register.py` exposes `--metadata-only`
    - discovery and direct registration agree on the final `download_status` / `extraction_status` semantics
    - no bridge path silently forces `download_source=False` when the user did not ask for metadata-only mode
  </acceptance_criteria>
  <done>The primary Phase `166` handoff path now lands on the same useful default as direct registration.</done>
</task>

<task type="auto">
  <name>Task 3: Rewrite operator docs around contentful-by-default registration</name>
  <files>research/knowledge-hub/intake/ARXIV_FIRST_SOURCE_INTAKE.md, research/knowledge-hub/L0_SOURCE_LAYER.md, research/knowledge-hub/README.md, research/knowledge-hub/tests/test_source_discovery_contracts.py</files>
  <read_first>research/knowledge-hub/intake/ARXIV_FIRST_SOURCE_INTAKE.md, research/knowledge-hub/L0_SOURCE_LAYER.md, research/knowledge-hub/README.md, .planning/phases/166.1-contentful-source-registration-default/166.1-CONTEXT.md, research/knowledge-hub/tests/test_source_discovery_contracts.py</read_first>
  <action>Update the operator documentation so contentful registration is described as the normal path. Replace standard command examples that currently require `--download-source` with the new default form, document `--metadata-only` as the lightweight override, and keep `--download-source` only as compatibility context if it remains mentioned at all. Extend doc-contract assertions in `test_source_discovery_contracts.py` so they fail if the primary arXiv-intake docs regress back to teaching `--download-source` as the normal path.</action>
  <verify>python -m pytest research/knowledge-hub/tests/test_source_discovery_contracts.py -q</verify>
  <acceptance_criteria>
    - `ARXIV_FIRST_SOURCE_INTAKE.md` shows a normal registration example without `--download-source`
    - the docs mention `--metadata-only` as the explicit lightweight override
    - top-level Layer 0 docs do not tell operators they must remember a hidden positive flag to get content
  </acceptance_criteria>
  <done>The docs now match the shipped registration semantics instead of the old metadata-only behavior.</done>
</task>

<task type="auto">
  <name>Task 4: Leave one bounded fresh-topic proof of bootstrap to handoff to registration</name>
  <files>research/knowledge-hub/runtime/scripts/run_first_run_topic_acceptance.py, research/knowledge-hub/tests/test_aitp_cli_e2e.py, research/knowledge-hub/tests/test_runtime_scripts.py</files>
  <read_first>research/knowledge-hub/runtime/scripts/run_first_run_topic_acceptance.py, research/knowledge-hub/tests/test_aitp_cli_e2e.py, research/knowledge-hub/tests/test_runtime_scripts.py, .planning/phases/166.1-contentful-source-registration-default/166.1-CONTEXT.md, .planning/REQUIREMENTS.md</read_first>
  <action>Extend the bounded first-run acceptance lane so the milestone can prove one fresh-topic path from `bootstrap` through the new concrete handoff into one registration step. Reuse the existing front-door acceptance harness rather than inventing a second public-entry story, but keep the original bounded bootstrap/loop/status assertions intact. The new continuation must leave a fresh topic registration artifact set on the repository kernel root, or record an honest failure if live content acquisition cannot fully complete, while still proving that the registration default attempted content acquisition and preserved fallback reporting. Add or update subprocess/runtime-script coverage so this proof lane is runnable and cannot silently regress.</action>
  <verify>python research/knowledge-hub/runtime/scripts/run_first_run_topic_acceptance.py --json</verify>
  <acceptance_criteria>
    - the proof starts from a fresh topic created by the public bootstrap path
    - the proof observes the concrete `L0` handoff before registration
    - the proof leaves real registration artifacts for that fresh topic on the intended kernel root
    - the proof does not rely on a pre-existing topic shell or claim TeX success when acquisition actually failed
  </acceptance_criteria>
  <done>`REQ-VERIFY-01` has one bounded evidence lane instead of only isolated helper tests.</done>
</task>

<task type="auto">
  <name>Task 5: Run the targeted regression and acceptance sweep for Phase 166.1</name>
  <files>research/knowledge-hub/tests/test_source_discovery_contracts.py, research/knowledge-hub/tests/test_aitp_cli_e2e.py, research/knowledge-hub/tests/test_runtime_scripts.py</files>
  <read_first>.planning/phases/166.1-contentful-source-registration-default/166.1-VALIDATION.md, research/knowledge-hub/tests/test_source_discovery_contracts.py, research/knowledge-hub/tests/test_aitp_cli_e2e.py, research/knowledge-hub/tests/test_runtime_scripts.py</read_first>
  <action>Run the validation commands declared in `166.1-VALIDATION.md`: first `python -m pytest research/knowledge-hub/tests/test_source_discovery_contracts.py -q`, then `python -m pytest research/knowledge-hub/tests/test_source_discovery_contracts.py research/knowledge-hub/tests/test_aitp_cli_e2e.py -q`, then `python research/knowledge-hub/runtime/scripts/run_first_run_topic_acceptance.py --json`, and finally `python -m pytest research/knowledge-hub/tests/test_source_discovery_contracts.py research/knowledge-hub/tests/test_aitp_cli_e2e.py research/knowledge-hub/tests/test_runtime_scripts.py -q`. If a regression appears, fix only the files already in scope for this plan and rerun until the declared slice is green.</action>
  <verify>python -m pytest research/knowledge-hub/tests/test_source_discovery_contracts.py research/knowledge-hub/tests/test_aitp_cli_e2e.py research/knowledge-hub/tests/test_runtime_scripts.py -q</verify>
  <acceptance_criteria>
    - direct/discovery registration regression coverage exits 0
    - the fresh-topic proof lane exits 0
    - the final phase summary can cite both the proof lane and the targeted regression slice
  </acceptance_criteria>
  <done>The new default sits on a green mechanical baseline instead of on docs-only intent.</done>
</task>

</tasks>
