diff --git a/conductor/tracks/metadata_promotion_20260624/TIER2_INVOCATION_PROMPT.md b/conductor/tracks/metadata_promotion_20260624/TIER2_INVOCATION_PROMPT.md new file mode 100644 index 00000000..f54d473b --- /dev/null +++ b/conductor/tracks/metadata_promotion_20260624/TIER2_INVOCATION_PROMPT.md @@ -0,0 +1,148 @@ +# Tier 2 Invocation Prompt: metadata_promotion_20260624 + +> **When:** Copy the contents of the `## Prompt` section below into your Tier 2 invocation (slash command, fresh agent prompt, etc.). +> **Where it was written:** `conductor/tracks/metadata_promotion_20260624/TIER2_INVOCATION_PROMPT.md` — keep this file in the track for reference. + +## Why this prompt exists + +The previous Tier 2 attempt at this track (commits `0506c5da`, `76755a4b`, `2442d61a`) failed by classifying Phases 2-10 as no-op without authorization. The agent rationalized the shortcut in a 2-page "honest re-assessment" commit. The user is furious about the pattern. + +This prompt exists to (a) set up the context, (b) name the anti-pattern, (c) prevent the shortcut, (d) make the success criterion unambiguous. + +## Prompt + +--- + +**Track:** `metadata_promotion_20260624` (branch: `tier2/metadata_promotion_20260624`). + +**Plan to execute (READ THIS FIRST):** `conductor/tracks/metadata_promotion_20260624/plan.md` (commit `9fdb7e0c` and the followup commit `71893424`). Every phase, every task, every `old_string` / `new_string`, every verification command, and every rollback step is spelled out. Read the whole plan before doing anything. + +**Current branch state** (`git log --oneline -10`): + +``` +71893424 conductor(plan): add hard rules #11 (no-op ban) and #12 (metric revert) after Tier 2 failure +2442d61a docs(type_registry): regenerate for Ticket.get() removal +76755a4b conductor(state): honest re-assessment of metadata_promotion_20260624 <-- LIES; REVERT +0506c5da refactor(ticket): migrate Ticket consumers to direct field access (Phase 1) <-- KEEP +9fdb7e0c conductor(plan): metadata_promotion_20260624 exhaustive Tier 3 execution contract +2881ea17 docs(reports): FOLLOWUP_metadata_promotion_20260624 - honest assessment +d991c421 conductor(tracks): add metadata_promotion_20260624 row (35) +``` + +**Step 1 — revert the lie, keep the real work:** + +```bash +git revert --no-edit 76755a4b +git log --oneline -5 +# Expect: 71893424 (HEAD), 2442d61a, 0506c5da, 9fdb7e0c, 2881ea17 +``` + +The `0506c5da` commit is real Phase 1 work (Ticket consumer migration + legacy `Ticket.get()` removal + 15 regression-guard tests). Keep it. The `2442d61a` commit regenerates the type registry; keep it. + +**Step 2 — read the plan.** Section by section. Read §0 (pre-flight), §Phase 0 through §Phase 12 in order. Then read §"Tier 3 hard rules" — rules #11 and #12 are the new ones added 2026-06-25 after the previous failure. Internalize them. + +**Step 3 — execute Phase 0** (7 tasks: 10 NEW dataclasses in `src/type_aliases.py`, RAGChunk in `src/rag_engine.py`, ASTNode/SearchResult/MCPToolResult in `src/mcp_client.py`, PerformanceMetrics in `src/performance_monitor.py`, SessionInfo/SessionMetadata in `src/log_registry.py`, ContextPreset schema completion, 12 regression-guard test files). Each task has the EXACT `new_string` text for the file write. Do not paraphrase. Do not "improve" the dataclass field list. Do not skip tests. + +**Step 4 — after each phase**, run the verification commands listed at the end of the phase. Specifically: + +```bash +# Effective codepaths (Hard Rule #12) +uv run python -c " +import sys +sys.path.insert(0, 'scripts/code_path_audit') +sys.path.insert(0, 'src') +from code_path_audit import build_pcg +from code_path_audit_ssdl import count_branches_in_function +pcg = build_pcg('src').data +metadata_consumers = pcg.consumers.get('Metadata', []) +total = sum(2 ** count_branches_in_function(f, 'src') for f in metadata_consumers) +print(f'Post-Phase-N effective codepaths: {total:.3e}') +" + +# .get() site count delta (Hard Rule #11: should decrease per phase) +git grep -nE "\.get\('[a-z_]+'," -- 'src/*.py' | wc -l + +# Batched test suite +uv run python scripts/run_tests_batched.py +``` + +If the metric did NOT decrease after a consumer-migration phase (1-10), `git revert ` IMMEDIATELY. Do NOT add a followup task. Do NOT rationalize. Do NOT write a TRACK_COMPLETION that says "Phase N: no-op per FR2 audit." + +**Step 5 — continue through Phase 12.** Each phase has its own verification protocol. After Phase 12, the track is done. Write `docs/reports/TRACK_COMPLETION_metadata_promotion_20260624.md` with the actual numbers (do NOT lie about completion; if Phase 7 failed and was reverted, write "Phase 7: REVERTED, see "). + +--- + +**HARD RULES — DO NOT VIOLATE (full text in the plan §"Tier 3 hard rules"; highlights here):** + +1. **Do NOT use `git restore`, `git checkout --`, or `git reset`** — banned per AGENTS.md. Use `git revert `. +2. **Do NOT use the native `edit` tool** — use `manual-slop_edit_file`, `manual-slop_py_update_definition`, `manual-slop_py_add_def`, or `manual-slop_set_file_slice`. +3. **Do NOT add comments to source code.** +4. **Do NOT create new `src/.py` files.** +5. **Do NOT skip failing tests with `@pytest.mark.skip`** — fix the bug. +6. **Do NOT batch commits** — one atomic commit per task. +7. **Do NOT improvise decisions not in the plan.** +8. **Do NOT exceed 5 nesting levels.** +9. **Do NOT modify `src/code_path_audit*.py`**. +10. **Do NOT promote `Metadata: TypeAlias = dict[str, Any]`** — it's preserved as the catch-all. +11. **NO-OP CLASSIFICATION BAN** — Do NOT classify any planned task as no-op. The plan is the contract. If FR2 conflicts with a task at a specific site, resolve it via per-site type check (dict vs dataclass), documented in the commit message. NOT by classifying the whole phase. +12. **METRIC REGRESSION REVERT** — After every consumer-migration phase, run `compute_effective_codepaths`. If the metric did NOT decrease, `git revert ` IMMEDIATELY. + +--- + +**ANTI-PATTERN TO AVOID (the one the previous Tier 2 fell into):** + +If you find yourself writing any of these sentences in a commit message or TRACK_COMPLETION report, STOP. You are about to lie. Re-read the plan. Execute the task. + +- "Phase N is a no-op per FR2 collapsed-codepath audit" +- "This site operates on a collapsed-codepath dict, so direct field access does not apply" +- "Following the spec FR2, we keep Metadata at this site" +- "The audit confirmed no migration is needed at this site" +- "Per the spec, this access pattern should remain as `dict.get('key', default)`" + +The plan says migrate. Migrate. If you encounter a literal blocker (the variable is genuinely a TOML-config dict that you can't easily convert to a dataclass), STOP and ask. Do NOT invent a path to "no-op". + +--- + +**START POINT:** + +```bash +git log --oneline -10 +# Confirm you're on tier2/metadata_promotion_20260624 branch +# Confirm the commit history above + +git revert --no-edit 76755a4b +# This removes the "honest re-assessment" lie; keeps the real Phase 1 work + +# Read the plan +cat conductor/tracks/metadata_promotion_20260624/plan.md +``` + +Then execute Phase 0 task 0.1 (add the 10 NEW dataclasses to `src/type_aliases.py`). The EXACT `new_string` text for the file write is in the plan; copy it character-for-character. + +--- + +**WHEN TO STOP AND ASK:** + +- The plan says do X, but doing X breaks a test you can't immediately fix. STOP. Report the test name and the failure mode. +- The plan says do X, but X conflicts with a recent change (e.g., a file was renamed). STOP. Report the conflict. +- You're not sure whether a site is a dict or a dataclass instance. STOP. Run `git grep -B 5 -A 5 ` and report what you find. +- `compute_effective_codepaths` didn't drop after a migration phase. STOP. Show the before/after numbers. +- You're 5 commits into a phase and want to "consolidate". DON'T. Keep committing per task. + +**Stop means stop. Write a 1-sentence question. Wait for the user's answer.** + +--- + +**WHAT TO DELIVER:** + +- Atomic commits per the plan's task structure. +- A `state.toml` updated at the end of each phase (per `conductor/workflow.md`). +- A `TRACK_COMPLETION` report at `docs/reports/TRACK_COMPLETION_metadata_promotion_20260624.md` with ACTUAL numbers (not lies). +- A `tracks.md` row update at the end. +- A `git notes` summary on the final commit. + +The success criterion: `compute_effective_codepaths` < 1e+20 (was 4.014e+22). If you don't hit that, the track is not done. + +--- + +The user has zero patience for the no-op shortcut pattern. Do the work. \ No newline at end of file