---
phase: 141-l1-three-layer-vault-and-flowback
plan: 01
type: execute
wave: 1
depends_on:
  - 140-01
files_modified:
  - research/knowledge-hub/intake/README.md
  - research/knowledge-hub/intake/L1_VAULT_PROTOCOL.md
  - research/knowledge-hub/knowledge_hub/l1_vault_support.py
  - research/knowledge-hub/knowledge_hub/topic_shell_support.py
  - research/knowledge-hub/knowledge_hub/runtime_read_path_support.py
  - research/knowledge-hub/knowledge_hub/runtime_bundle_support.py
  - research/knowledge-hub/knowledge_hub/kernel_markdown_renderers.py
  - research/knowledge-hub/runtime/schemas/progressive-disclosure-runtime-bundle.schema.json
  - schemas/research-question.schema.json
  - research/knowledge-hub/runtime/scripts/run_l1_vault_acceptance.py
  - research/knowledge-hub/tests/test_aitp_service.py
  - research/knowledge-hub/tests/test_runtime_scripts.py
  - research/knowledge-hub/tests/test_schema_contracts.py
  - research/knowledge-hub/tests/test_l1_vault_contracts.py
  - research/knowledge-hub/README.md
  - research/knowledge-hub/runtime/README.md
  - research/knowledge-hub/runtime/AITP_TEST_RUNBOOK.md
autonomous: true
requirements:
  - REQ-L1VAULT-01
  - REQ-L1VAULT-02
  - REQ-L1VAULT-03
  - REQ-L1VAULT-04
must_haves:
  truths:
    - raw inputs stay anchored to existing source-layer truth; do not clone them into another writable memory surface
    - the wiki layer must be Obsidian-compatible and visibly non-authoritative
    - output flowback must be explicit and inspectable
    - runtime compatibility artifacts must remain linked rather than replaced
---

<objective>
Materialize one production `L1` raw/wiki/output vault and flowback surface on
the existing topic-shell path, with docs/tests/acceptance that keep its
non-authoritative status honest.
</objective>

<tasks>

<task type="auto">
  <name>Task 1: Materialize the topic-scoped L1 vault</name>
  <files>research/knowledge-hub/knowledge_hub/l1_vault_support.py, research/knowledge-hub/knowledge_hub/topic_shell_support.py, research/knowledge-hub/knowledge_hub/kernel_markdown_renderers.py, research/knowledge-hub/knowledge_hub/runtime_read_path_support.py, research/knowledge-hub/knowledge_hub/runtime_bundle_support.py</files>
  <read_first>research/knowledge-hub/knowledge_hub/topic_shell_support.py</read_first>
  <action>Create `raw/wiki/output` vault artifacts under `intake/topics/<topic_slug>/vault/`, wire them into the topic-shell and runtime status path, and preserve the existing runtime compatibility refs.</action>
  <verify>python -m pytest research/knowledge-hub/tests/test_aitp_service.py -q -k "l1_vault or ensure_topic_shell_surfaces"</verify>
  <acceptance_criteria>
    - `ensure_topic_shell_surfaces()` writes one `L1` vault manifest plus raw/wiki/output sub-surfaces
    - the wiki layer uses frontmatter, lowercase filenames, and wikilinks
    - the output layer writes one explicit flowback ledger
    - `status --json` and `runtime_protocol.generated.md` expose the new vault surface
  </acceptance_criteria>
  <done>L1 vault generation is production-wired on the topic-shell path.</done>
</task>

<task type="auto">
  <name>Task 2: Document and acceptance-test the L1 vault</name>
  <files>research/knowledge-hub/intake/README.md, research/knowledge-hub/intake/L1_VAULT_PROTOCOL.md, research/knowledge-hub/runtime/scripts/run_l1_vault_acceptance.py, research/knowledge-hub/tests/test_runtime_scripts.py, research/knowledge-hub/tests/test_schema_contracts.py, research/knowledge-hub/tests/test_l1_vault_contracts.py, research/knowledge-hub/README.md, research/knowledge-hub/runtime/README.md, research/knowledge-hub/runtime/AITP_TEST_RUNBOOK.md</files>
  <read_first>research/knowledge-hub/runtime/AITP_TEST_RUNBOOK.md</read_first>
  <action>Document the new vault contract, add an isolated acceptance script, and lock the new schema/runtime/doc surfaces with targeted tests.</action>
  <verify>python research/knowledge-hub/runtime/scripts/run_l1_vault_acceptance.py --json</verify>
  <acceptance_criteria>
    - runtime docs and runbook reference the new acceptance script and vault rules
    - research-question and runtime-bundle schemas admit the new `l1_vault` structure
    - the isolated acceptance proves raw/wiki/output surfaces and flowback on a temp kernel root
  </acceptance_criteria>
  <done>Phase `141` is ready to summarize and verify.</done>
</task>

</tasks>
