83%

plan-dedup-module

Deliver the /create-plan-side twin of bug-dedup-module, additionally covering the plan-vs-bug leg (a proposed plan whose scope is really just a bug fix) in the same module rather than a separate section — both legs share the SAME related-nodes --kind all call and corpus-authoritative/graph-ranks split. Depends on plan-graph-substrate for the plan-vs-plan leg’s real signal; the plan-vs-bug leg (querying against already-populated Bug nodes) does not depend on it and can be authored/tested independently.

Work Items

  • Add scripts/create_plan_runtime/plan_dedup.py: compute_plan_dedup(proposed_text, existing_plans, , open_bugs=(), graph_query=…) -> PlanDedupResult with verdict new|exact_duplicate|related_existing, matched_id, matched_kind (plan|bug), score, shared_symbols, rationale. Corpus SSOT = the plan directory listing (plans/* + bug-tracker/plans/**) plus the open-bugs tracker index; the graph query (related-nodes —kind all) RANKS both plan and bug candidates in one call, mirroring compute_bug_dedup’s corpus-authoritative / graph-ranks split.
  • Add a plan-dedup calibration-evidence test (scripts/create_plan_runtime/tests/test_plan_dedup_calibration.py, mirroring the completed twin’s scripts/add_bug_runtime/tests/test_bug_dedup_calibration.py per the s-6924d386 w-5ea4e8b5 pattern) that derives PLAN_DEDUP_* band constants from live related-nodes distributions covering at minimum: a verbatim re-proposal of a rich-missioned plan, a paraphrased re-proposal, a re-proposal of a FLOOR-full_name plan (the recall-dark case — pins the honest verdict=new / fail-open behavior), a bug-shaped proposal (the plan-vs-bug leg), and unrelated prose. Bands MUST be derived from this live distribution, never transferred from GRAPH_FIRED_THRESHOLD / GRAPH_COVERAGE_THRESHOLD / BUG_DEDUP_RELATED_BAND (calibrated for a different question, index, and input shape per the dossier’s band-transfer audit and constrained-symbols list) and never tuned until fixtures pass — the INVERTED-TDD line the dossier’s hygiene-constraints section names explicitly.
  • Gate verdicts: exact_duplicate (refuse scaffold, surface matched plan/bug id), related_existing with matched_kind=plan (redirect into Existing Plan Mode against the matched plan — the ALREADY-BUILT add-sections/add-work-items machinery IS the enhance path, no new write API needed), related_existing with matched_kind=bug (surface the matched BUG-XX-NNN and recommend /fix-bug instead of a fresh plan — the plan-vs-bug leg), else new (proceed to Phase 1 research).
  • Add a plan-dedup-check —text read-only CLI subcommand to create_plan_runtime/main.py emitting the verdict JSON for pre-flight checks; extend —self-test.
  • Export compute_plan_dedup and PlanDedupResult via scripts/create_plan_runtime/api.py for the /create-plan SKILL.md Phase 0 consumer (s-0d66b1c0) and the workflow-engine-rework consumer (mission.md:55); freeze the PlanDedupResult field shape (verdict/matched_id/matched_kind/score/shared_symbols/rationale) as the verdict-JSON contract the plan-dedup-check CLI (w-d9c886c4) emits, keeping the new duplicate_plan exit_reason lexically distinct from the existing plan_corpus/types.py DUPLICATE_PLAN_NAME (literal same-name scaffold collision) and from relatedness.py’s dedup_into_section (bug subsumed by a plan). Document at the module head that the actual /create-plan Phase 0 fork-decision wiring — calling plan-dedup-check with the user’s opening scope text BEFORE Phase 0.5 classification and Phase 1 research, mirroring /add-bug’s dedup-before-write ordering — is consumed and authored by sibling section s-0d66b1c0; this section delivers the module + CLI + frozen contract, not the SKILL.md prose edit.

Fresh intel (regenerated)

{ “schema_version”: 1, “target”: { “kind”: “plan-section”, “ref”: “graph-native-bug-relatedness/s-b546c83e” }, “generated_at”: “2026-07-14T06:21:32.889980+00:00”, “graph_state”: { “head_sha”: “d281786e3”, “last_code_import_at”: “2026-07-14T05:57:32.892000000+00:00”, “embedding_stale”: false, “insights_stale”: false, “cpg_stale”: false }, “surfaces”: {}, “summary”: “intel-package[plan-section:graph-native-bug-relatedness/s-b546c83e] agent-authored dossier”, “degraded”: false, “dossier”: { “objective_symbols”: [], “tiers”: {}, “agent_authored”: true, “constrained_symbols”: [ “GRAPH_FIRED_THRESHOLD”, “GRAPH_COVERAGE_THRESHOLD”, “BUG_DEDUP_RELATED_BAND”, “compute_relatedness_heuristic” ], “difficulty”: { “class”: “routine”, “research_online”: false, “research_mode”: “auto”, “signals”: [], “plan_dir”: “/home/eric/projects/ori_lang/plans/graph-native-bug-relatedness” } } }

(full dossier: plan-dedup-module—s-b546c83e.intel.json)