From f534d7f0fa46ef5e7db28e2527bc04876a23b18a Mon Sep 17 00:00:00 2001 From: Bill Date: Thu, 26 Feb 2026 16:56:09 -0700 Subject: [PATCH] Add raw output-shape template control pack (sprint 262) --- docs/constructive_editing_runtime_plan.md | 5 + ...rator_readiness_gap_registry_2026-02-26.md | 2 +- docs/progress_log_2026-02-26.md | 17 ++++ .../sprint262_execution_tracker_2026-02-26.md | 43 +++++++++ editor/src/Sprint262IntegrationSummary.h | 6 ++ sprint262_plan.md | 11 +++ tools/mcp/run_sprint_taskitem_pipeline.sh | 21 +++++ .../synthesize_raw_template_control_pack.py | 93 +++++++++++++++++++ 8 files changed, 197 insertions(+), 1 deletion(-) create mode 100644 docs/sprint262_execution_tracker_2026-02-26.md create mode 100644 editor/src/Sprint262IntegrationSummary.h create mode 100644 sprint262_plan.md create mode 100644 tools/mcp/synthesize_raw_template_control_pack.py diff --git a/docs/constructive_editing_runtime_plan.md b/docs/constructive_editing_runtime_plan.md index ffe28d8..7c9a8af 100644 --- a/docs/constructive_editing_runtime_plan.md +++ b/docs/constructive_editing_runtime_plan.md @@ -242,3 +242,8 @@ Planning runtime controls (active): - `WSTONE_NATIVE_RAW_INTRINSIC_PROMPT_PACK` - `WSTONE_NATIVE_RAW_INTRINSIC_PROMPT_MAX_SIGNALS` - `native_raw_intrinsic_prompt_pack` +- raw candidate generation can inject explicit output-shape template controls: + - `tools/mcp/synthesize_raw_template_control_pack.py` + - `WSTONE_NATIVE_RAW_TEMPLATE_CONTROL_PACK` + - `WSTONE_NATIVE_RAW_TEMPLATE_CONTROL_MAX_SIGNALS` + - `native_raw_template_control_pack` diff --git a/docs/generator_readiness_gap_registry_2026-02-26.md b/docs/generator_readiness_gap_registry_2026-02-26.md index 5bfdc43..7deee06 100644 --- a/docs/generator_readiness_gap_registry_2026-02-26.md +++ b/docs/generator_readiness_gap_registry_2026-02-26.md @@ -47,7 +47,7 @@ This is the canonical dated registry for "not production-ready" generator gaps. | GR-018 | Performance/security/rollout constrained refactor enforcement gap | `docs/gap_hunt_fullstack_multifile_2026-02-26.md`, `logs/taskitem_runs/challenging_fullstack_multifile_20260226_r5/results.jsonl` | `partial` | Hard checks now enforce migration rollback + data-loss policy, security deny-by-default, SLO p95 presence, and rollout staged+abort policy. Enforcement is contract-level; generator capability under these constraints is still weak in C++ AB path. | Constraint-aware generation follow-up | | GR-019 | Parity-blocked readiness load (gating without capability closure) | `logs/taskitem_runs/challenging_fullstack_multifile_20260226_r7/summary.json`, `logs/taskitem_runs/challenging_subset_prod_20260226_r7/summary.json`, `docs/sprint225_227_execution_tracker_2026-02-26.md` | `partial` | Sprint 225-227 reduced blocked parity load from `6` to `0` on both tracked hard catalogs while keeping unresolved divergence at `0`. This closes immediate safety debt for current corpora, but robustness is still contingent on pattern-driven repair classes. | Generalize repairs beyond queue-shaped transpile outputs | | GR-020 | Semantic fallback overuse masks weak native decomposition | `logs/taskitem_runs/TEST_ONLY_sprint236_semantic_fallback_audit_20260226/semantic_fallback_summary.json`, `logs/taskitem_runs/TEST_ONLY_sprint237_semantic_fallback_gate_fail_20260226/semantic_fallback_budget_gate.json`, `logs/taskitem_runs/TEST_ONLY_sprint238_native_gate_fail_20260226.json`, `logs/taskitem_runs/TEST_ONLY_sprint239_semantic_fallback_audit_20260226/semantic_fallback_summary.json`, `logs/taskitem_runs/TEST_ONLY_sprint240_retry_20260226_145631/00_summary.json`, `docs/sprint236_execution_tracker_2026-02-26.md`, `docs/sprint237_execution_tracker_2026-02-26.md`, `docs/sprint238_execution_tracker_2026-02-26.md`, `docs/sprint239_execution_tracker_2026-02-26.md`, `docs/sprint240_execution_tracker_2026-02-26.md` | `partial` | Sprint 236 added deterministic fallback-gap auditing with tool + constraint metadata. Sprint 237 added fallback-budget hard gate (`max-fallback-rate`) and produced expected fail/pass artifacts. Sprint 238 added native decomposition hard gate in pipeline (`min task count`, `min semantic signal count`) so weak native generation can be blocked before fallback masking. Sprint 239 added native reason enrichment and improved semantic signal density (`0 -> 6`). Sprint 240 added native decomposition retry with explicit minimum-task policy; on current sample retry attempted but did not improve depth (`2 -> 2`). | Native decomposition task-depth upgrade (increase native task granularity beyond 2) | -| GR-021 | Impact-specific native decomposition coverage not enforced uniformly | `docs/native_decomposition_impact_list_2026-02-26.md`, `tools/mcp/profiles/native_decomposition_impact_profiles.json`, `logs/taskitem_runs/TEST_ONLY_sprint241_fullstack_impact_20260226_150416/00_summary.json`, `logs/taskitem_runs/TEST_ONLY_sprint241_native_impact_aggregate_20260226/native_impact_coverage_aggregate.json`, `logs/taskitem_runs/TEST_ONLY_sprint242_impact_remediation_loop_20260226/remediation_loop_summary.json`, `logs/taskitem_runs/TEST_ONLY_sprint243_impact_remediation_tasks_loop_20260226_r2/remediation_loop_summary.json`, `logs/taskitem_runs/TEST_ONLY_sprint244_autofill_20260226_151651/00_summary.json`, `logs/taskitem_runs/TEST_ONLY_sprint244_autofill_enforce_20260226_151709/00_summary.json`, `logs/taskitem_runs/TEST_ONLY_sprint245_intrinsic_20260226_151835/00_summary.json`, `logs/taskitem_runs/TEST_ONLY_sprint246_multishot_20260226_153033/00_summary.json`, `logs/taskitem_runs/TEST_ONLY_sprint246_multishot_enforce_20260226_153045/00_summary.json`, `logs/taskitem_runs/TEST_ONLY_sprint247_singleshot_20260226_153230/00_summary.json`, `logs/taskitem_runs/TEST_ONLY_sprint247_singleshot_enforce_20260226_153241/00_summary.json`, `logs/taskitem_runs/TEST_ONLY_sprint248_rawsearch_20260226_153903/00_summary.json`, `logs/taskitem_runs/TEST_ONLY_sprint249_rawguard_20260226_154028/02ae_raw_candidate_search.json`, `logs/taskitem_runs/TEST_ONLY_sprint250_closure_ladder_20260226/closure_ladder_summary.json`, `logs/taskitem_runs/TEST_ONLY_sprint251_rawvariants_20260226_154355/00_summary.json`, `logs/taskitem_runs/TEST_ONLY_sprint252_closure_ladder_policy_skip2_20260226/closure_ladder_summary.json`, `logs/taskitem_runs/TEST_ONLY_sprint253_closure_ladder_batch_20260226/closure_ladder_batch_summary.json`, `logs/taskitem_runs/TEST_ONLY_sprint254_closure_ladder_batch_20260226_r2/raw_gap_backlog.json`, `logs/taskitem_runs/TEST_ONLY_sprint255_rawharden_20260226_161924/00_summary.json`, `logs/taskitem_runs/01a_fallback_intake_spec_20260226_162423/00_summary.json`, `logs/taskitem_runs/01a_fallback_intake_spec_20260226_162633/02ae_raw_candidate_search.json`, `logs/taskitem_runs/01a_fallback_intake_spec_20260226_162924/01e_raw_top_gap_requirements_report.json`, `logs/taskitem_runs/01a_fallback_intake_spec_20260226_163148/02af_raw_adaptive_retry_score.json`, `logs/taskitem_runs/01a_fallback_intake_spec_20260226_163556/02ae_raw_signal_targeted_variants.json`, `logs/taskitem_runs/01a_fallback_intake_spec_20260226_163855/01f_raw_intrinsic_prompt_pack_report.json` | `partial` | Sprint 241 introduced impact profiles/gates; 242-243 remediation loops; 244 first-pass autofill; 245 intrinsic constraints only (no uplift); 246 multishot closure; 247 single-shot shaping closure; 248 raw candidate search no uplift; 249 no-uplift guardrail; 250 closure ladder; 251 richer raw variants no uplift; 252 history-aware ladder routing; 253 batch ladder analytics; 254 raw gap backlog synthesis from `raw_only` attempts identifies top missing raw signals; 255 adds first-pass raw top-gap hardening that closes hard-sample profile coverage (`failing_profile_count 7 -> 0`) by injecting missing ops/contracts/reasons and minimum task depth; 256 adds top-gap weighted candidate selection telemetry and tie-break policy; 257 adds hard fail policy when top-gap uplift is required but absent (`exit 18`); 258 injects backlog-driven top-gap normalized requirements before raw generation; 259 adds adaptive retry with expanded top-gap requirements and deterministic retry scoring; 260 adds signal-targeted variant expansion keyed to missing-signal classes and increases intrinsic search breadth (`available_variants 2 -> 8`); 261 adds intrinsic prompt-pack constraint injection keyed to gap signals. Measured intrinsic output still shows no uplift on this sample (`best_top_gap_score=0`, `failing_profile_count=1`). | Add explicit generator-side output-shape control (schema-guided decoder or task-template synthesis pass) before candidate scoring | +| GR-021 | Impact-specific native decomposition coverage not enforced uniformly | `docs/native_decomposition_impact_list_2026-02-26.md`, `tools/mcp/profiles/native_decomposition_impact_profiles.json`, `logs/taskitem_runs/TEST_ONLY_sprint241_fullstack_impact_20260226_150416/00_summary.json`, `logs/taskitem_runs/TEST_ONLY_sprint241_native_impact_aggregate_20260226/native_impact_coverage_aggregate.json`, `logs/taskitem_runs/TEST_ONLY_sprint242_impact_remediation_loop_20260226/remediation_loop_summary.json`, `logs/taskitem_runs/TEST_ONLY_sprint243_impact_remediation_tasks_loop_20260226_r2/remediation_loop_summary.json`, `logs/taskitem_runs/TEST_ONLY_sprint244_autofill_20260226_151651/00_summary.json`, `logs/taskitem_runs/TEST_ONLY_sprint244_autofill_enforce_20260226_151709/00_summary.json`, `logs/taskitem_runs/TEST_ONLY_sprint245_intrinsic_20260226_151835/00_summary.json`, `logs/taskitem_runs/TEST_ONLY_sprint246_multishot_20260226_153033/00_summary.json`, `logs/taskitem_runs/TEST_ONLY_sprint246_multishot_enforce_20260226_153045/00_summary.json`, `logs/taskitem_runs/TEST_ONLY_sprint247_singleshot_20260226_153230/00_summary.json`, `logs/taskitem_runs/TEST_ONLY_sprint247_singleshot_enforce_20260226_153241/00_summary.json`, `logs/taskitem_runs/TEST_ONLY_sprint248_rawsearch_20260226_153903/00_summary.json`, `logs/taskitem_runs/TEST_ONLY_sprint249_rawguard_20260226_154028/02ae_raw_candidate_search.json`, `logs/taskitem_runs/TEST_ONLY_sprint250_closure_ladder_20260226/closure_ladder_summary.json`, `logs/taskitem_runs/TEST_ONLY_sprint251_rawvariants_20260226_154355/00_summary.json`, `logs/taskitem_runs/TEST_ONLY_sprint252_closure_ladder_policy_skip2_20260226/closure_ladder_summary.json`, `logs/taskitem_runs/TEST_ONLY_sprint253_closure_ladder_batch_20260226/closure_ladder_batch_summary.json`, `logs/taskitem_runs/TEST_ONLY_sprint254_closure_ladder_batch_20260226_r2/raw_gap_backlog.json`, `logs/taskitem_runs/TEST_ONLY_sprint255_rawharden_20260226_161924/00_summary.json`, `logs/taskitem_runs/01a_fallback_intake_spec_20260226_162423/00_summary.json`, `logs/taskitem_runs/01a_fallback_intake_spec_20260226_162633/02ae_raw_candidate_search.json`, `logs/taskitem_runs/01a_fallback_intake_spec_20260226_162924/01e_raw_top_gap_requirements_report.json`, `logs/taskitem_runs/01a_fallback_intake_spec_20260226_163148/02af_raw_adaptive_retry_score.json`, `logs/taskitem_runs/01a_fallback_intake_spec_20260226_163556/02ae_raw_signal_targeted_variants.json`, `logs/taskitem_runs/01a_fallback_intake_spec_20260226_163855/01f_raw_intrinsic_prompt_pack_report.json`, `logs/taskitem_runs/01a_fallback_intake_spec_20260226_165430/01g_raw_template_control_pack_report.json` | `partial` | Sprint 241 introduced impact profiles/gates; 242-243 remediation loops; 244 first-pass autofill; 245 intrinsic constraints only (no uplift); 246 multishot closure; 247 single-shot shaping closure; 248 raw candidate search no uplift; 249 no-uplift guardrail; 250 closure ladder; 251 richer raw variants no uplift; 252 history-aware ladder routing; 253 batch ladder analytics; 254 raw gap backlog synthesis from `raw_only` attempts identifies top missing raw signals; 255 adds first-pass raw top-gap hardening that closes hard-sample profile coverage (`failing_profile_count 7 -> 0`) by injecting missing ops/contracts/reasons and minimum task depth; 256 adds top-gap weighted candidate selection telemetry and tie-break policy; 257 adds hard fail policy when top-gap uplift is required but absent (`exit 18`); 258 injects backlog-driven top-gap normalized requirements before raw generation; 259 adds adaptive retry with expanded top-gap requirements and deterministic retry scoring; 260 adds signal-targeted variant expansion keyed to missing-signal classes and increases intrinsic search breadth (`available_variants 2 -> 8`); 261 adds intrinsic prompt-pack constraint injection keyed to gap signals; 262 adds explicit output-shape template-control pack injection (schema + example + signal mapping) pre-generation. Measured intrinsic output still shows no uplift on this sample (`best_top_gap_score=0`, `failing_profile_count=1`). | Add deterministic post-generation structural projector for raw candidates before scoring (split/normalize schema to enforce missing ops/contracts/reason keywords without full hardening) | ## What Was Covered Today (Sprints 175-184) diff --git a/docs/progress_log_2026-02-26.md b/docs/progress_log_2026-02-26.md index 42273c1..9d88d27 100644 --- a/docs/progress_log_2026-02-26.md +++ b/docs/progress_log_2026-02-26.md @@ -507,3 +507,20 @@ - Current measured result on hard sample: - prompt pack injected (`selected_signal_count=8`) - intrinsic outcome unchanged (`selected_variant=0`, `best_top_gap_score=0`, `failing_profile_count=1`). + +## Sprint 262 Added (Same Day) + +- Added raw output-shape template control pack: + - `tools/mcp/synthesize_raw_template_control_pack.py` + - pipeline controls: + - `WSTONE_NATIVE_RAW_TEMPLATE_CONTROL_PACK` + - `WSTONE_NATIVE_RAW_TEMPLATE_CONTROL_MAX_SIGNALS` + - summary packet: + - `native_raw_template_control_pack` +- Dated A/B artifacts: + - OFF: `logs/taskitem_runs/01a_fallback_intake_spec_20260226_165422/00_summary.json` + - ON: `logs/taskitem_runs/01a_fallback_intake_spec_20260226_165430/00_summary.json` + - report: `logs/taskitem_runs/01a_fallback_intake_spec_20260226_165430/01g_raw_template_control_pack_report.json` +- Current measured result on hard sample: + - template control injected (`requirement_count=3`, `selected_signal_count=8`) + - intrinsic outcome unchanged (`selected_variant=0`, `best_top_gap_score=0`, `failing_profile_count=1`). diff --git a/docs/sprint262_execution_tracker_2026-02-26.md b/docs/sprint262_execution_tracker_2026-02-26.md new file mode 100644 index 0000000..75482df --- /dev/null +++ b/docs/sprint262_execution_tracker_2026-02-26.md @@ -0,0 +1,43 @@ +# Sprint 262 Execution Tracker - 2026-02-26 + +## Scope +- `sprint262_plan.md` + +## Implemented + +New tool: +- `tools/mcp/synthesize_raw_template_control_pack.py` + - Synthesizes output-shape control requirements from top-gap signals: + - schema-level field requirements + - explicit JSON template example + - missing-signal alignment clause + +Pipeline integration in `tools/mcp/run_sprint_taskitem_pipeline.sh`: +- Added: + - `WSTONE_NATIVE_RAW_TEMPLATE_CONTROL_PACK` + - `WSTONE_NATIVE_RAW_TEMPLATE_CONTROL_MAX_SIGNALS` +- Added artifacts: + - `01g_raw_template_control_pack_requirements.json` + - `01g_raw_template_control_pack_report.json` +- Added summary packet: + - `native_raw_template_control_pack` + +## Validation Artifacts + +OFF: +- `logs/taskitem_runs/01a_fallback_intake_spec_20260226_165422/00_summary.json` + +ON: +- `logs/taskitem_runs/01a_fallback_intake_spec_20260226_165430/00_summary.json` +- template-control artifacts: + - `logs/taskitem_runs/01a_fallback_intake_spec_20260226_165430/01g_raw_template_control_pack_report.json` + +Observed result on hard sample: +- template-control pack injected (`requirement_count=3`, `selected_signal_count=8`) +- `selected_variant` remained `0` +- `best_top_gap_score` remained `0` +- `failing_profile_count` remained `1` + +## Explicit Completion Signal + +- Sprint 262: `DONE` (implemented + validated; intrinsic uplift still pending) diff --git a/editor/src/Sprint262IntegrationSummary.h b/editor/src/Sprint262IntegrationSummary.h new file mode 100644 index 0000000..b029652 --- /dev/null +++ b/editor/src/Sprint262IntegrationSummary.h @@ -0,0 +1,6 @@ +#pragma once + +// Sprint 262 integration summary: +// - Added raw output-shape template control pack synthesis from top-gap signals. +// - Pipeline now injects schema-style task template constraints pre-generation. +// - Summary now includes native_raw_template_control_pack telemetry for structure-control audits. diff --git a/sprint262_plan.md b/sprint262_plan.md new file mode 100644 index 0000000..42bd8f6 --- /dev/null +++ b/sprint262_plan.md @@ -0,0 +1,11 @@ +# Sprint 262 Plan: Raw Output-Shape Template Control Pack + +## Goal +Add explicit output-shape control requirements (schema fields + template example + signal alignment) before raw generation to tighten generator structure beyond semantic constraints. + +## Steps +- Step 2358: Add template-control synthesis tool from top-gap signals. +- Step 2359: Inject template-control requirements in pre-generation pipeline stage. +- Step 2360: Emit template-control telemetry in summary packet. +- Step 2361: Validate OFF/ON behavior on hard sample. +- Step 2362: Add `Sprint262IntegrationSummary.h` and execution tracker. diff --git a/tools/mcp/run_sprint_taskitem_pipeline.sh b/tools/mcp/run_sprint_taskitem_pipeline.sh index 5c8165f..4f98fbb 100755 --- a/tools/mcp/run_sprint_taskitem_pipeline.sh +++ b/tools/mcp/run_sprint_taskitem_pipeline.sh @@ -62,6 +62,8 @@ NATIVE_RAW_TOP_GAP_REQUIREMENTS="${WSTONE_NATIVE_RAW_TOP_GAP_REQUIREMENTS:-0}" NATIVE_RAW_TOP_GAP_MAX_SIGNALS="${WSTONE_NATIVE_RAW_TOP_GAP_MAX_SIGNALS:-5}" NATIVE_RAW_INTRINSIC_PROMPT_PACK="${WSTONE_NATIVE_RAW_INTRINSIC_PROMPT_PACK:-0}" NATIVE_RAW_INTRINSIC_PROMPT_MAX_SIGNALS="${WSTONE_NATIVE_RAW_INTRINSIC_PROMPT_MAX_SIGNALS:-8}" +NATIVE_RAW_TEMPLATE_CONTROL_PACK="${WSTONE_NATIVE_RAW_TEMPLATE_CONTROL_PACK:-0}" +NATIVE_RAW_TEMPLATE_CONTROL_MAX_SIGNALS="${WSTONE_NATIVE_RAW_TEMPLATE_CONTROL_MAX_SIGNALS:-8}" NATIVE_RAW_TOP_GAP_ADAPTIVE_RETRY="${WSTONE_NATIVE_RAW_TOP_GAP_ADAPTIVE_RETRY:-0}" NATIVE_RAW_TOP_GAP_RETRY_SIGNALS="${WSTONE_NATIVE_RAW_TOP_GAP_RETRY_SIGNALS:-10}" EXTRA_NORMALIZED_REQUIREMENTS_FILE="${WSTONE_EXTRA_NORMALIZED_REQUIREMENTS_FILE:-}" @@ -130,6 +132,7 @@ NATIVE_RAW_HARDENING_JSON='{}' NATIVE_RAW_SIGNAL_TARGETED_VARIANTS_JSON='{}' NATIVE_RAW_TOP_GAP_REQUIREMENTS_JSON='{}' NATIVE_RAW_INTRINSIC_PROMPT_PACK_JSON='{}' +NATIVE_RAW_TEMPLATE_CONTROL_PACK_JSON='{}' NATIVE_RAW_ADAPTIVE_RETRY_JSON='{}' INTRINSIC_REQS_JSON='[]' EXTRA_NORMALIZED_REQUIREMENTS_JSON='[]' @@ -378,6 +381,22 @@ if [[ "$NATIVE_RAW_INTRINSIC_PROMPT_PACK" == "1" && -n "$NATIVE_RAW_TOP_GAP_BACK else NATIVE_RAW_INTRINSIC_PROMPT_PACK_JSON='{"enabled":false}' fi +if [[ "$NATIVE_RAW_TEMPLATE_CONTROL_PACK" == "1" && -n "$NATIVE_RAW_TOP_GAP_BACKLOG_FILE" && -f "$NATIVE_RAW_TOP_GAP_BACKLOG_FILE" ]]; then + python3 "$ROOT_DIR/tools/mcp/synthesize_raw_template_control_pack.py" \ + --top-gaps "$NATIVE_RAW_TOP_GAP_BACKLOG_FILE" \ + --max-signals "$NATIVE_RAW_TEMPLATE_CONTROL_MAX_SIGNALS" \ + --out "$OUT_DIR/01g_raw_template_control_pack_requirements.json" \ + --out-report "$OUT_DIR/01g_raw_template_control_pack_report.json" >/dev/null + RAW_TEMPLATE_CONTROL_REQS_JSON="$(cat "$OUT_DIR/01g_raw_template_control_pack_requirements.json")" + NORMALIZED_REQS="$(jq -nc --argjson base "$NORMALIZED_REQS" --argjson extra "$RAW_TEMPLATE_CONTROL_REQS_JSON" '$base + $extra')" + NATIVE_RAW_TEMPLATE_CONTROL_PACK_JSON="$(jq -nc \ + --argjson enabled true \ + --arg backlog_file "$NATIVE_RAW_TOP_GAP_BACKLOG_FILE" \ + --argjson report "$(cat "$OUT_DIR/01g_raw_template_control_pack_report.json")" \ + '{enabled:$enabled, backlog_file:$backlog_file, report:$report}')" +else + NATIVE_RAW_TEMPLATE_CONTROL_PACK_JSON='{"enabled":false}' +fi CONFLICTS="$(printf '%s' "$INTAKE_JSON" | jq '.conflicts // []')" GEN_ARGS="$(jq -nc --argjson nr "$NORMALIZED_REQS" --argjson cf "$CONFLICTS" --arg strict "$STRICT_EXECUTION_CONTRACT" \ '{normalizedRequirements:$nr,conflicts:$cf,strictExecutionContract:($strict == "1")}')" @@ -976,6 +995,7 @@ SUMMARY_JSON="$(jq -nc \ --argjson native_intrinsic_boost "$NATIVE_INTRINSIC_BOOST_JSON" \ --argjson native_raw_top_gap_requirements "$NATIVE_RAW_TOP_GAP_REQUIREMENTS_JSON" \ --argjson native_raw_intrinsic_prompt_pack "$NATIVE_RAW_INTRINSIC_PROMPT_PACK_JSON" \ + --argjson native_raw_template_control_pack "$NATIVE_RAW_TEMPLATE_CONTROL_PACK_JSON" \ --argjson native_raw_signal_targeted_variants "$NATIVE_RAW_SIGNAL_TARGETED_VARIANTS_JSON" \ --argjson native_raw_candidate_search "$NATIVE_RAW_CANDIDATE_SEARCH_JSON" \ --argjson native_raw_adaptive_retry "$NATIVE_RAW_ADAPTIVE_RETRY_JSON" \ @@ -1009,6 +1029,7 @@ SUMMARY_JSON="$(jq -nc \ native_intrinsic_boost: $native_intrinsic_boost, native_raw_top_gap_requirements: $native_raw_top_gap_requirements, native_raw_intrinsic_prompt_pack: $native_raw_intrinsic_prompt_pack, + native_raw_template_control_pack: $native_raw_template_control_pack, native_raw_signal_targeted_variants: $native_raw_signal_targeted_variants, native_raw_candidate_search: $native_raw_candidate_search, native_raw_adaptive_retry: $native_raw_adaptive_retry, diff --git a/tools/mcp/synthesize_raw_template_control_pack.py b/tools/mcp/synthesize_raw_template_control_pack.py new file mode 100644 index 0000000..552ae1d --- /dev/null +++ b/tools/mcp/synthesize_raw_template_control_pack.py @@ -0,0 +1,93 @@ +#!/usr/bin/env python3 +import argparse +import json +from pathlib import Path +from typing import List + + +def load_json(path: Path): + with path.open("r", encoding="utf-8") as f: + return json.load(f) + + +def write_json(path: Path, obj) -> None: + with path.open("w", encoding="utf-8") as f: + json.dump(obj, f, indent=2, sort_keys=True) + f.write("\n") + + +def main() -> int: + p = argparse.ArgumentParser(description="Synthesize raw task template control requirements from top-gap signals.") + p.add_argument("--top-gaps", required=True) + p.add_argument("--max-signals", type=int, default=8) + p.add_argument("--out", required=True) + p.add_argument("--out-report", required=True) + args = p.parse_args() + + backlog = load_json(Path(args.top_gaps)) + prioritized = list(backlog.get("prioritized_missing") or [])[: max(0, args.max_signals)] + + signals: List[str] = [str(r.get("missing", "")) for r in prioritized if str(r.get("missing", ""))] + template_example = { + "taskId": "task-example-1", + "title": "Concrete scoped operation", + "prerequisiteOps": ["whetstone_generate_taskitems", "whetstone_queue_ready", "whetstone_validate_taskitem"], + "reasons": ["risk", "contract", "replay"], + "dependencyTaskIds": [], + "executionContract": { + "deterministic": True, + "rollbackRequired": True, + "replayValidationRequired": True, + }, + } + schema_text = ( + "output-shape control: every task must include non-empty taskId/title/prerequisiteOps/reasons/executionContract; " + "executionContract must explicitly set deterministic, rollbackRequired, replayValidationRequired to true; " + "task must include at least one concrete prerequisite op and no umbrella placeholder wording." + ) + example_text = f"required template example: {json.dumps(template_example, sort_keys=True)}" + signal_text = ( + "missing-signal alignment: " + (", ".join(signals) if signals else "no signals") + + "; generated tasks must explicitly close these classes where applicable." + ) + + reqs = [ + { + "requirementId": "raw-template-control-schema", + "kind": "constraint", + "normalizedText": schema_text, + "anchor": "raw_template_control", + "sourceLine": 0, + "ambiguous": False, + }, + { + "requirementId": "raw-template-control-example", + "kind": "constraint", + "normalizedText": example_text, + "anchor": "raw_template_control", + "sourceLine": 0, + "ambiguous": False, + }, + { + "requirementId": "raw-template-control-signals", + "kind": "constraint", + "normalizedText": signal_text, + "anchor": "raw_template_control", + "sourceLine": 0, + "ambiguous": False, + }, + ] + report = { + "status": "ok", + "selected_signal_count": len(signals), + "signals": signals, + "requirement_count": len(reqs), + } + write_json(Path(args.out), reqs) + write_json(Path(args.out_report), report) + print(json.dumps({"status": "ok", "selected_signal_count": len(signals), "requirement_count": len(reqs), "out": args.out}, sort_keys=True)) + return 0 + + +if __name__ == "__main__": + raise SystemExit(main())