# Phase 165.4-06 Summary

Status: implemented in working tree

## Goal

Open `165.4 / 999.78` by turning the topic-state artifact contract into a
machine-readable manifest instead of leaving it implicit across scattered
runtime surfaces.

The slice should make it mechanically checkable that a topic claiming a given
state actually has the required artifacts on disk, so drift like "verify mode
but validation contract note missing" becomes explicit protocol state.

## What Landed

- new manifest module:
  - `knowledge_hub/protocol_manifest.py`
- new durable runtime artifact:
  - `runtime/topics/<topic_slug>/protocol_manifest.active.json`
  - `runtime/topics/<topic_slug>/protocol_manifest.active.md`
- the manifest now derives a declared topic state from existing runtime truth:
  - `runtime_mode`
  - `topic_state`
  - `promotion_gate`
  - `topic_completion`
- currently declared manifest states:
  - `bootstrapped`
  - `exploring`
  - `verifying`
  - `promoting`
  - `completed`
- the manifest now declares which artifact ids must exist for each state and
  checks the active state's requirements against the actual filesystem
- runtime bundle now exposes top-level `protocol_manifest`
- `runtime_protocol.generated.md` now renders a dedicated `Protocol manifest`
  section
- when manifest drift is detected, `protocol_manifest.active.md` is appended to
  `must_read_now`
- `topic_status(...)` and adjacent runtime-status surfaces now expose
  `protocol_manifest` directly from the bundle
- `capability_audit(...)` now consumes the manifest result instead of silently
  trusting the declared runtime state
- capability audit now reports:
  - `sections.capabilities.protocol_manifest`
  - overall status `drift_detected` when the manifest fails

## Verification

- `python -m pytest research/knowledge-hub/tests/test_runtime_profiles_and_projections.py -k protocol_manifest -q`
- `python -m pytest research/knowledge-hub/tests/test_aitp_service.py -k 'protocol_manifest or capability_audit_writes_registry' -q`
- `python -m pytest research/knowledge-hub/tests/test_schema_contracts.py -k progressive_disclosure_runtime_schema_exposes_stable_trigger_contract -q`
- `python -m pytest research/knowledge-hub/tests -q`

## Outcome

`165.4` is now closed as a mechanical-governance phase:

- schema-level agent isolation already constrained what agents can write
- context injection and loop detection already shaped how theorem-facing work is
  resumed
- the new manifest now makes the runtime's claimed state auditable against the
  actual artifact set on disk

This means agent governance for the runtime no longer depends on a human
remembering which files "should probably exist" at each state transition.

## Notes

- maintainability budget for `knowledge_hub/runtime_bundle_support.py` was
  adjusted from `2360` to `2380` lines after adding the new protocol-manifest
  governance surface; rationale was updated in
  `research/knowledge-hub/maintainability_budgets.json`

## Remaining Open Work After 165.4

- move to `165.5 / 999.79` post-registration source enrichment via DeepXiv
  progressive reading
