# Phase 165.4-01 Summary

Status: implemented in working tree

## Goal

Open `165.4 / 999.73` by adding a deterministic mechanical completion
 preflight before the conformance audit surface can claim the topic is clean.

The preflight should block trust-critical completion when cheap file-based
 checks already show unresolved debt, instead of relying on a later expensive
 audit layer.

## What Landed

- `runtime/scripts/audit_topic_conformance.py` now computes a dedicated
  `mechanical_completion_preflight` block
- the new preflight is fully file-based and checks:
  - operation baseline readiness from operation manifests
  - unresolved candidate/follow-up gap debt from active run and parent topic
    files
  - pending follow-up work from queue/manual-followup and unreintegrated child
    follow-up rows
- conformance now fails when the mechanical preflight is blocked
- the conformance report now renders a separate
  `Mechanical completion preflight` section with:
  - status
  - LLM-audit eligibility flag
  - counts
  - per-check outcomes
  - blocking reasons
- this creates an explicit handoff point for later expensive/non-mechanical
  audit layers:
  - `llm_audit_eligible` is now mechanically declared instead of implied

## Verification

- `python -m pytest research/knowledge-hub/tests/test_aitp_service.py -q -k "mechanical_completion_preflight_pass or mechanical_completion_preflight_failures or operation_trust_registry_blocks_until_gate_is_satisfied"`
- `python -m pytest research/knowledge-hub/tests/test_aitp_cli.py -q`
- `python -m pytest research/knowledge-hub/tests/test_aitp_cli_e2e.py -q -k "first_run_bootstrap_loop_status_cli_flow or hello_cli_json_path_creates_demo_topic_and_status or steer_topic_text_cli_json_path_materializes_direction"`

## Outcome

`165.4` is now open with one real governance slice:

- completion can be blocked by deterministic evidence before any later audit
  layer is asked to interpret the topic
- obvious debt such as unsatisfied operation baselines, open gaps, and pending
  follow-ups is now surfaced as mechanical blocker state instead of only
  narrative context

## Remaining Open Work Inside 165.4

- `999.75` schema-level agent isolation
- `999.74` context injection with dedup
- `999.76` JSONL metrics for self-evolution
- `999.77` derivation loop detection
- `999.78` manifest-as-truth-source

## Notes

- a separate pre-existing dirty-worktree failure still exists outside this
  slice:
  - `test_materialize_runtime_protocol_bundle_writes_expected_artifacts`
  - current cause: `progressive-disclosure-runtime-bundle.schema.json` is
    missing `$defs/l1_concept_graph`
