# Contract Hardening Selector Calibration Implementation Plan

> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.

**Goal:** Harden the third-round model-library contract and selector behavior without adding a third model, upgrading stable status, or processing owner-supplied raw QPI samples before they are available.

**Architecture:** Keep the MVP file-first. Model-specific output contracts live in model JSON and are validated by `scripts/validate_model_library.py`; selector runtime behavior is driven by `selector/selector_rules.json`; per-round CCRA review bundles are stored under dated subdirectories. QPI contextual routing rules are documented now, while real owner case preprocessing remains a later input-dependent step.

**Tech Stack:** JSON, Markdown, Python standard library, PowerShell file operations.

---

### Task 1: Review Bundle Round Structure

**Files:**
- Move existing files under `ccra_review_bundle/round-02_2026-06-16_second-audit/`
- Create `ccra_review_bundle/round-03_2026-06-17_contract-hardening-selector-calibration/`
- Modify `knowledge_assets/08_CCRA模型库MVP质量门与交接协议.md`
- Modify `docs/DECISIONS.md`
- Modify `README.md`

- [ ] Move the second-round flat bundle files into the round-02 directory.
- [ ] Create an empty round-03 directory for the new audit package.
- [ ] Document that `ccra_review_bundle/` is now a per-round archive root.
- [ ] Keep per-round command logs and temporary review materials out of `knowledge_assets/`.

### Task 2: Model-Specific Output Contract Validation

**Files:**
- Modify `schemas/model_card.schema.json`
- Modify `models/qpi.model.json`
- Modify `models/intellectual_archaeology.model.json`
- Modify `scripts/validate_model_library.py`
- Modify `tests/test_validate_model_library.py`

- [ ] Add `structured_output_contract` to the schema properties without adding it to global top-level required.
- [ ] Update QPI definition and output contract for subject-context-dynamic routing.
- [ ] Keep IA contract model-specific and include the required depth-gate fields.
- [ ] Add model-specific required contract checks for `qpi` and `intellectual_archaeology`.
- [ ] Add unit coverage proving missing QPI/IA model-specific output contract fields are reported.

### Task 3: QPI and IA Rules Documentation

**Files:**
- Create `docs/QPI_CONTEXTUAL_ROUTING_RULES.md`
- Create `docs/INTELLECTUAL_ARCHAEOLOGY_DEPTH_GATE.md`
- Modify `reports/content_review_report_v0.2.md`

- [ ] Document QPI as a subject-context expectation-reality gap routing model.
- [ ] Distinguish `intra_frame_mixed` from `inter_viewpoint_divergence`.
- [ ] Document context sufficiency, provisional classification, governance-load issue rules, and misframing risks.
- [ ] Document IA should-call false cases, max-depth derivation, and non-default `philosophical_bedrock`.
- [ ] Fix the QPI report field list to include `classification`.

### Task 4: Selector Runtime Config Source

**Files:**
- Modify `selector/selector_rules.json`
- Modify `scripts/run_selector_demo.py`
- Modify `scripts/run_selector_regression.py`
- Create `selector/selector_calibration_inputs.json`

- [ ] Move scoring signals and hard no-call signals into `selector_rules.json`.
- [ ] Make `run_selector_demo.py` load runtime rules from `selector_rules.json`.
- [ ] Apply hard no-call gating before positive scoring unless an explicit override phrase is present.
- [ ] Add calibration inputs covering fact lookup, rewrite, translation, direct execution, QPI-only, IA-after-QPI, model extraction, false positive traps, and mixed QPI cases.
- [ ] Keep calibration inputs marked as draft and owner-reviewable.

### Task 5: Verification and Third-Round Handoff

**Files:**
- Modify or create reports under `reports/`
- Later create files under `ccra_review_bundle/round-03_2026-06-17_contract-hardening-selector-calibration/`

- [ ] Run `python scripts/rebuild_indexes.py --write` if model/index-relevant fields changed.
- [ ] Run the required full check commands.
- [ ] Record command outcomes in reports.
- [ ] Generate the round-03 CCRA review bundle after validation.
- [ ] Keep `qpi` and `intellectual_archaeology` at `draft / B / pending`.

