---
phase: 166
plan: 01
type: execute
wave: 1
depends_on:
  - 165.6
files_modified:
  - research/knowledge-hub/runtime/scripts/orchestrate_topic.py
  - research/knowledge-hub/knowledge_hub/runtime_bundle_support.py
  - research/knowledge-hub/knowledge_hub/topic_shell_support.py
  - research/knowledge-hub/knowledge_hub/topic_replay.py
  - research/knowledge-hub/tests/test_aitp_mcp_server.py
  - research/knowledge-hub/tests/test_aitp_service.py
  - research/knowledge-hub/tests/test_topic_replay.py
autonomous: false
requirements:
  - REQ-L0HAND-01
  - REQ-L0HAND-02
must_haves:
  truths:
    - a fresh bootstrap blocked on missing sources must name one concrete source-acquisition lane instead of only generic prose
    - dashboard, runtime protocol, and replay must expose the same concrete `L0` handoff facts from one shared runtime truth
    - the handoff must stay advisory and honest about missing sources rather than auto-creating progress
---

<objective>
Turn the honest post-bootstrap `l0_source_expansion` result into one concrete,
shared, operator-facing source-acquisition handoff across dashboard, runtime
protocol, and replay without widening into automatic source recovery or Phase
`166.1` registration-default changes.
</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-public-front-door-l0-source-handoff/166-CONTEXT.md
@.planning/phases/166-public-front-door-l0-source-handoff/166-RESEARCH.md
@.planning/phases/166-public-front-door-l0-source-handoff/166-VALIDATION.md
@research/knowledge-hub/L0_SOURCE_LAYER.md
@research/knowledge-hub/README.md
@research/knowledge-hub/runtime/scripts/orchestrate_topic.py
</context>

<tasks>

<task type="auto">
  <name>Task 1: Make the bootstrap-seeded `L0` next action concrete</name>
  <files>research/knowledge-hub/runtime/scripts/orchestrate_topic.py, research/knowledge-hub/tests/test_aitp_mcp_server.py</files>
  <read_first>research/knowledge-hub/runtime/scripts/orchestrate_topic.py, research/knowledge-hub/tests/test_aitp_mcp_server.py, .planning/phases/166-public-front-door-l0-source-handoff/166-CONTEXT.md, research/knowledge-hub/L0_SOURCE_LAYER.md, .planning/phases/165.6/165.6-ISSUE-LEDGER.md</read_first>
  <action>In `research/knowledge-hub/runtime/scripts/orchestrate_topic.py`, replace the bootstrap-created `next_actions.md` line `Convert the topic statement into explicit source and candidate artifacts.` with one explicit sentence that names the concrete shipped `L0` entry surfaces: `source-layer/scripts/discover_and_register.py` as the primary query-first lane, `source-layer/scripts/register_arxiv_source.py` as the direct arXiv-id lane, and `intake/ARXIV_FIRST_SOURCE_INTAKE.md` as the command-form runbook. Keep the resulting action classified as `l0_source_expansion` and keep it non-auto-runnable. Update `research/knowledge-hub/tests/test_aitp_mcp_server.py` so the bootstrap/loop fixture and assertions require the new concrete handoff wording rather than the old generic prose.</action>
  <verify>rg -n "discover_and_register.py|register_arxiv_source.py|ARXIV_FIRST_SOURCE_INTAKE.md" research/knowledge-hub/runtime/scripts/orchestrate_topic.py research/knowledge-hub/tests/test_aitp_mcp_server.py</verify>
  <acceptance_criteria>
    - `orchestrate_topic.py` writes a bootstrap next action that contains `source-layer/scripts/discover_and_register.py`
    - the same seeded action text also contains `source-layer/scripts/register_arxiv_source.py` and `intake/ARXIV_FIRST_SOURCE_INTAKE.md`
    - `test_aitp_mcp_server.py` no longer expects `Convert the topic statement into explicit source and candidate artifacts.`
    - the selected action in MCP-facing loop output remains `action_type == "l0_source_expansion"`
  </acceptance_criteria>
  <done>The first visible post-bootstrap action points to the real shipped `L0` entry surfaces.</done>
</task>

<task type="auto">
  <name>Task 2: Add one shared `L0` handoff payload to runtime truth surfaces</name>
  <files>research/knowledge-hub/knowledge_hub/runtime_bundle_support.py, research/knowledge-hub/knowledge_hub/topic_shell_support.py</files>
  <read_first>research/knowledge-hub/knowledge_hub/runtime_bundle_support.py, research/knowledge-hub/knowledge_hub/topic_shell_support.py, .planning/phases/166-public-front-door-l0-source-handoff/166-CONTEXT.md, .planning/phases/166-public-front-door-l0-source-handoff/166-RESEARCH.md, research/knowledge-hub/L0_SOURCE_LAYER.md</read_first>
  <action>Introduce one shared helper or payload named consistently for this phase, for example `l0_source_handoff`, in the runtime-truth path. It must activate only when the selected action is `l0_source_expansion` or the topic is honestly returning to `L0` because `requires_l0_return` is true. The payload must contain at least: a status value indicating missing sources, a one-line summary, `primary_path = "source-layer/scripts/discover_and_register.py"`, `primary_when = "Use when you have a topic query rather than a fixed arXiv id."`, and alternate entries for `source-layer/scripts/register_arxiv_source.py` and `intake/ARXIV_FIRST_SOURCE_INTAKE.md`. Keep `selected_action_summary`, `return_to_L0`, and other existing runtime-focus truth fields intact; the new payload augments them instead of replacing them.</action>
  <verify>rg -n "l0_source_handoff|discover_and_register.py|register_arxiv_source.py|ARXIV_FIRST_SOURCE_INTAKE.md" research/knowledge-hub/knowledge_hub/runtime_bundle_support.py research/knowledge-hub/knowledge_hub/topic_shell_support.py</verify>
  <acceptance_criteria>
    - `runtime_bundle_support.py` defines or writes one shared handoff payload for `L0` source recovery
    - the shared payload contains `source-layer/scripts/discover_and_register.py` as the primary path
    - the shared payload also includes `source-layer/scripts/register_arxiv_source.py` and `intake/ARXIV_FIRST_SOURCE_INTAKE.md`
    - `topic_shell_support.py` reads the same handoff payload instead of inventing an unrelated prose-only path
  </acceptance_criteria>
  <done>The concrete handoff facts exist once in runtime truth and are ready for multiple surfaces to consume.</done>
</task>

<task type="auto">
  <name>Task 3: Render the shared handoff on dashboard, runtime protocol, and replay with parity tests</name>
  <files>research/knowledge-hub/knowledge_hub/runtime_bundle_support.py, research/knowledge-hub/knowledge_hub/topic_shell_support.py, research/knowledge-hub/knowledge_hub/topic_replay.py, research/knowledge-hub/tests/test_aitp_service.py, research/knowledge-hub/tests/test_topic_replay.py</files>
  <read_first>research/knowledge-hub/knowledge_hub/runtime_bundle_support.py, research/knowledge-hub/knowledge_hub/topic_shell_support.py, research/knowledge-hub/knowledge_hub/topic_replay.py, research/knowledge-hub/tests/test_aitp_service.py, research/knowledge-hub/tests/test_topic_replay.py, .planning/phases/166-public-front-door-l0-source-handoff/166-CONTEXT.md, .planning/phases/166-public-front-door-l0-source-handoff/166-RESEARCH.md</read_first>
  <action>Render the shared handoff facts on all three required surfaces. In `topic_shell_support.py`, add a visible dashboard block for active `L0` handoff state that names the primary lane and the two alternate entry surfaces while keeping the existing `return to L0` gap honesty text. In `runtime_bundle_support.py`, add a matching `## L0 source handoff` section to `runtime_protocol.generated.md` and include the same structured payload in the runtime bundle. In `topic_replay.py`, add replay fields for the same handoff facts, including a summary under `current_position` and the structured payload itself so replay markdown can render the same lane choices. Update `test_aitp_service.py` and `test_topic_replay.py` to assert the presence of the primary path plus the two alternate entry surfaces, and to verify replay / dashboard / runtime protocol expose the same handoff facts instead of diverging prose.</action>
  <verify>python -m pytest research/knowledge-hub/tests/test_aitp_service.py research/knowledge-hub/tests/test_topic_replay.py -q</verify>
  <acceptance_criteria>
    - `topic_dashboard.md` rendering includes a dedicated `L0` source handoff block when `l0_source_expansion` is active
    - `runtime_protocol.generated.md` rendering includes `## L0 source handoff`
    - `topic_replay.py` writes a replay-visible `L0` source handoff summary plus structured handoff payload
    - `test_aitp_service.py` and `test_topic_replay.py` assert `discover_and_register.py`, `register_arxiv_source.py`, and `ARXIV_FIRST_SOURCE_INTAKE.md`
  </acceptance_criteria>
  <done>The same concrete handoff is visible on all required truth surfaces.</done>
</task>

<task type="auto">
  <name>Task 4: Run the targeted parity regression sweep for Phase 166</name>
  <files>research/knowledge-hub/tests/test_aitp_mcp_server.py, research/knowledge-hub/tests/test_aitp_service.py, research/knowledge-hub/tests/test_topic_replay.py, research/knowledge-hub/tests/test_runtime_scripts.py</files>
  <read_first>.planning/phases/166-public-front-door-l0-source-handoff/166-VALIDATION.md, research/knowledge-hub/tests/test_aitp_mcp_server.py, research/knowledge-hub/tests/test_aitp_service.py, research/knowledge-hub/tests/test_topic_replay.py</read_first>
  <action>Run the Phase `166` validation commands exactly as declared in `166-VALIDATION.md`: first `python -m pytest research/knowledge-hub/tests/test_aitp_mcp_server.py research/knowledge-hub/tests/test_aitp_service.py research/knowledge-hub/tests/test_topic_replay.py -q`, then `python -m pytest research/knowledge-hub/tests/test_aitp_mcp_server.py research/knowledge-hub/tests/test_aitp_service.py research/knowledge-hub/tests/test_topic_replay.py research/knowledge-hub/tests/test_runtime_scripts.py -q`. If a parity regression appears, fix only the files already in scope for this plan and rerun until the declared sweep is green.</action>
  <verify>python -m pytest research/knowledge-hub/tests/test_aitp_mcp_server.py research/knowledge-hub/tests/test_aitp_service.py research/knowledge-hub/tests/test_topic_replay.py research/knowledge-hub/tests/test_runtime_scripts.py -q</verify>
  <acceptance_criteria>
    - the targeted three-file pytest sweep exits 0
    - the full Phase `166` parity sweep exits 0
    - the final phase summary can cite a green regression baseline for bootstrap-facing, service/dashboard, and replay surfaces
  </acceptance_criteria>
  <done>The concrete handoff change sits on a green regression baseline.</done>
</task>

</tasks>
