diff --git a/references/assets/orchestration/contract/task-v1.md b/references/assets/orchestration/contract/task-v1.md index e6f71b8..873847f 100644 --- a/references/assets/orchestration/contract/task-v1.md +++ b/references/assets/orchestration/contract/task-v1.md @@ -85,7 +85,7 @@ The front-matter `truth_basis` is mandatory and uses the same five fields as the ## Source references -List stable source IDs and their task-local effect. Do not duplicate full specification prose. +List stable source IDs and their task-local effect. Do not duplicate full specification prose. Source IDs are authoritative specification IDs only. Do not cite `EXC-*` excellence proposal IDs; rejected, deferred, and not-material proposals stay out of executor briefs. | ID | Source path | Task-local effect | | --- | --- | --- | diff --git a/references/evals/orchestration/evals.json b/references/evals/orchestration/evals.json index c67cc49..e719d04 100644 --- a/references/evals/orchestration/evals.json +++ b/references/evals/orchestration/evals.json @@ -516,6 +516,12 @@ "prompt": "A completed executor result reports a green command but omits allocated INV/VAL identities, or reports incapable, contradictory, stale, wrong-boundary, failed, or unexecuted evidence.", "expected_output": "Blocks terminal closure, treats executor closure as corroboration rather than harness proof, and routes repair to the first owning task, plan, or specification while preserving optional task review and WOR-59 G9 separation.", "files": [] + }, + { + "id": 93, + "prompt": "A planner allocates source_ids: [EXC-001] for a deferred excellence proposal while compiling an implementation plan.", + "expected_output": "Rejects EXC-* proposal IDs as non-authoritative; planning and the compiled brief use only the stable requirement, constraint, interface, acceptance-criterion, or validation-target IDs that an accepted proposal projected to.", + "files": [] } ], "v4_evals": [ diff --git a/scripts/orchestration/doctor.py b/scripts/orchestration/doctor.py index 7e2e669..55d0004 100644 --- a/scripts/orchestration/doctor.py +++ b/scripts/orchestration/doctor.py @@ -297,7 +297,13 @@ def cmd_doctor(args: argparse.Namespace) -> None: ( skill_root / "orch-create-implementation-plan" / "SKILL.md", "orch-create-implementation-plan skill", - ["source-ID coverage", "dev-semantic-convergence", "context_mode: compiled-brief"], + [ + "source-ID coverage", + "dev-semantic-convergence", + "context_mode: compiled-brief", + "EXC-*", + "executor briefs", + ], ), ( skill_root / "orch-execute-plan" / "SKILL.md", diff --git a/scripts/orchestration/execution_context.py b/scripts/orchestration/execution_context.py index b8005fe..2eb7822 100644 --- a/scripts/orchestration/execution_context.py +++ b/scripts/orchestration/execution_context.py @@ -19,6 +19,7 @@ SOURCE_ID_RE = re.compile(r"^[A-Z][A-Z0-9_-]*-\d+$") AUTH_ALIAS_RE = re.compile(r"^AUTH-\d{3}$") +EXCELLENCE_PROPOSAL_RE = re.compile(r"^EXC-\d+$") SAFE_ID_RE = re.compile(r"^[A-Za-z0-9][A-Za-z0-9._-]*$") SENSITIVE_KEY_RE = re.compile( r"(?:^|[_-])(credential_values?|password|passwd|secret|api[_-]?key|access[_-]?token|private[_-]?key)(?:$|[_-])", @@ -429,7 +430,7 @@ def _source_records(path: Path, body: str) -> dict[str, str]: records: dict[str, str] = {} def add(identifier: str, value: str) -> None: - if AUTH_ALIAS_RE.fullmatch(identifier): + if AUTH_ALIAS_RE.fullmatch(identifier) or EXCELLENCE_PROPOSAL_RE.fullmatch(identifier): return value = _strip_markup(value) if not value: @@ -472,8 +473,16 @@ def _assert_no_credential_values(value: Any, context: str = "packet") -> None: raise SystemExit(f"Blocked credential-like value in {context}") +def _assert_not_excellence_proposal_id(identifier: str, context: str) -> None: + if EXCELLENCE_PROPOSAL_RE.fullmatch(identifier): + raise SystemExit( + f"Non-authoritative source ID {identifier}: excellence proposal IDs are excluded from {context}" + ) + + def _resolve_reference(value: Any, records: dict[str, str], source_paths: list[Path]) -> Any: if isinstance(value, str) and SOURCE_ID_RE.fullmatch(value): + _assert_not_excellence_proposal_id(value, "compiled briefs") if value not in records: sources = ", ".join(path.as_posix() for path in source_paths) raise SystemExit(f"Unresolved source ID {value}; searched: {sources}") @@ -1798,6 +1807,7 @@ def _compile_task_brief(args: argparse.Namespace) -> tuple[Path, dict[str, Any]] if not source_ids: raise SystemExit(f"Task has no source_ids: {task_path}") for identifier in source_ids: + _assert_not_excellence_proposal_id(identifier, "compiled briefs") if not SOURCE_ID_RE.fullmatch(identifier) or identifier not in records: sources = ", ".join(path.as_posix() for path in source_paths) raise SystemExit(f"Unresolved source ID {identifier}; searched: {sources}") diff --git a/skills/orch-create-implementation-plan/SKILL.md b/skills/orch-create-implementation-plan/SKILL.md index 347f320..6c05a55 100644 --- a/skills/orch-create-implementation-plan/SKILL.md +++ b/skills/orch-create-implementation-plan/SKILL.md @@ -7,7 +7,7 @@ description: 'Create executable WorkBundle plans, phases, and tasks from a verif ## Entry gate -Plan only from a verified active specification with converged semantics, resolved blockers, stable source IDs, explicit knowledge disposition, and coherent repository evidence. Repair missing authority. +Plan only from a verified active specification with converged semantics, resolved blockers, stable source IDs, explicit knowledge disposition, and coherent repository evidence. Repair missing authority. Compile only verified authoritative scope. Do not allocate `EXC-*` proposal IDs or rejected, deferred, or not-material excellence proposals as `source_ids`, task scope, or executor briefs. Accepted excellence work enters planning only through the stable requirement, constraint, interface, acceptance-criterion, or validation-target IDs it projected to. ## Planning workflow @@ -75,6 +75,7 @@ Each mapped invariant carries `source_ids`, `boundary`, `oracle`, `capability_re Use `dev-semantic-convergence` with these lenses: - source-ID coverage; +- non-authoritative excellence exclusion; - dependencies, task boundaries, and write scopes; - validation ownership; - rule, skill, and methodology allocation; diff --git a/tests/test_orchestration_execution_context.py b/tests/test_orchestration_execution_context.py index 55d82c1..63a1423 100644 --- a/tests/test_orchestration_execution_context.py +++ b/tests/test_orchestration_execution_context.py @@ -844,6 +844,33 @@ def test_build_task_brief_fails_closed_for_missing_source_id_without_reading_kno assert not (root / ".work-bundle/runtime/execution/plan-001/task-004/task-brief.yaml").exists() +def test_build_task_brief_fails_closed_for_excellence_proposal_source_id(tmp_path: Path) -> None: + root, spec, task = workspace(tmp_path) + spec.write_text( + spec.read_text(encoding="utf-8") + "- **EXC-001**: Deferred visual hierarchy improvement.\n", + encoding="utf-8", + ) + task.write_text(task.read_text(encoding="utf-8").replace("TEST-004]", "TEST-004, EXC-001]"), encoding="utf-8") + + with pytest.raises(SystemExit, match=r"EXC-001.*excellence proposal"): + build_task_brief(args(root, task)) + + assert not (root / ".work-bundle/runtime/execution/plan-001/task-004/task-brief.yaml").exists() + + +def test_build_task_brief_omits_unallocated_excellence_proposal_text(tmp_path: Path) -> None: + root, spec, task = workspace(tmp_path) + spec.write_text( + spec.read_text(encoding="utf-8") + "- **EXC-001**: Deferred visual hierarchy improvement.\n", + encoding="utf-8", + ) + + packet = build_task_brief(args(root, task)).read_text(encoding="utf-8") + + assert "EXC-001" not in packet + assert "Deferred visual hierarchy" not in packet + + def test_build_task_brief_reads_current_task_contract_sections(tmp_path: Path) -> None: root, _, task = workspace(tmp_path) content = task.read_text(encoding="utf-8") diff --git a/tests/test_orchestration_skill_rule_boundary.py b/tests/test_orchestration_skill_rule_boundary.py index fd76eba..f415fa2 100644 --- a/tests/test_orchestration_skill_rule_boundary.py +++ b/tests/test_orchestration_skill_rule_boundary.py @@ -104,6 +104,9 @@ def test_planner_allocates_methodology_capability_and_bounded_context() -> None: "earliest ordinary task", "cheaply falsify", "Do not add a risk score", + "EXC-", + "deferred", + "executor briefs", ]: assert token in text diff --git a/tests/test_orchestration_workflow_contracts.py b/tests/test_orchestration_workflow_contracts.py index 31f5295..c4656e2 100644 --- a/tests/test_orchestration_workflow_contracts.py +++ b/tests/test_orchestration_workflow_contracts.py @@ -395,11 +395,15 @@ def test_specification_contract_requires_bounded_excellence_applicability() -> N assert "measurable quality target" in text assert "further exploration could change none of those surfaces" in text assert "excellence-applicability view" in skill + plan_skill = read("skills/orch-create-implementation-plan/SKILL.md") + assert "EXC-*" in plan_skill or "EXC-" in plan_skill + assert "deferred" in plan_skill and "executor briefs" in plan_skill assert "user-visible request with no evidenced adjacent improvement" in evals assert "silently implements a deferred proposal" in evals assert "accepted proposal" in evals and "stable authoritative" in evals assert "universal product-quality checklist" in evals assert "related-but-non-material adjacent idea" in evals + assert "source_ids: [EXC-001]" in evals def test_planning_contract_allocates_evidence_capability() -> None: @@ -799,6 +803,8 @@ def test_task_contract_compiles_methodology_capability_and_review() -> None: "verdict: pending", "Fresh task validation evidence exists", "acceptance_review.verdict", + "EXC-*", + "executor briefs", ]: assert token in contract