Skip to content

Codify duplication-consolidation doctrine (test-ordered matrix subsuming Rule of Three) in engineering-philosophy #263

Closed

Description

@kyle-sexton

This was generated by AI during triage (operator-ratified decision, 2026-07-24).

Summary

Codify the org-wide duplication-consolidation doctrine in conventions/engineering/engineering-philosophy.md: copy-count thresholds (Rule of Three vs threshold-of-two) are subordinated to an ordered test sequence. Ratified by the owner after a deep-research pass (24 sources, 25 claims adversarially verified, 1 refuted); origin: melodic-software/claude-code-plugins#252.

The ratified decision matrix

Run in order; first decisive test wins:

  1. T1 — Same knowledge or coincidental? Identical text encoding different knowledge is a coincidence, not duplication (Hunt/Thomas); never consolidate — consolidation actively harms.
  2. T2 — Crosses an encapsulation boundary? Bounded contexts, services, availability seams: duplication is correct by design (DDD divergent models; event-carried state transfer). Consolidate only via an explicit shared-kernel-style decision with an owner.
  3. T3 — Change-together acid test. One fact forcing edits in multiple places/formats (including code+docs pairs) is true knowledge duplication — consolidate now, even at two copies; count is irrelevant.
  4. T4 — Abstraction namable and stable? Cannot name it → the Rule-of-Three brake applies (wrong-abstraction avoidance); can name it → two copies suffice.
  5. T5 — Reversibility. Cheap to inline back → early consolidation is low-risk; load-bearing/hard-to-unwind abstraction → demand the third occurrence as evidence.
  6. T6 — Churn/friction. High co-change frequency multiplies drift cost → consolidate earlier; static content tolerates copies longer.

Prose overlay: knowledge-bearing docs content (values, procedures, policy) consolidates from first reuse (DITA single-sourcing posture — no Rule-of-Three wait exists in tech-writing doctrine); audience-, context-, or SEO-sensitive prose is legitimately duplicated (Write the Docs); reuse-eligibility alone never justifies consolidation.

Constraints for the doctrine text

  • Do not present the Rule of Three as a cost calculus — the claim that three copies makes maintenance cost definitively outweigh refactoring cost was refuted (0-3 adversarial vote). It is a heuristic brake against premature wrong abstractions, permissive about two, never a prohibition on earlier extraction.
  • Cite Metz ("The Wrong Abstraction"), Dodds (AHA), Swett (counter-argument), and Pike (Go proverb) as links, not load-bearing attributions, until a targeted primary-source verify pass — these camps had no surviving primary-verified claims in the research run.

Key sources (verified)

Acceptance

  • engineering-philosophy.md carries the ordered matrix and prose overlay as the org duplication posture.
  • Consumers of the posture (e.g. claude-code-plugins docs-hygiene skills, point-dont-copy corrector) can cite it as the single source of truth instead of restating thresholds.

Activity

  1. self-assigned this
    on Jul 27, 2026
  2. kyle-sexton commented on Jul 27, 2026

    @kyle-sexton
    MemberAuthor

    This was generated by AI during triage.

    The triage lane has claimed this item for triage.

  3. kyle-sexton commented on Jul 27, 2026

    @kyle-sexton
    MemberAuthor

    This was generated by AI during triage.

    Triage brief

    Verified against the working tree at 861060b4 (chore: raise loop-lane merge rung to c3-autonomous (#281)). Every line number below was read, not inferred.

    Goal

    Land the owner-ratified duplication-consolidation doctrine (ordered tests T1–T6 plus the prose overlay) as the org's single authoritative duplication posture in conventions/engineering/, and reconcile every existing catalog statement that currently gates consolidation on a copy count.

    Verdict: real and actionable, with one placement decision reserved to the owner

    The content decision is settled — the body reads as a ratified matrix, not an open question. What is not settled is which file the body lands in, and the issue body never engages the repo's file architecture. See Open questions. Do not start authoring before that one word is answered; it changes which files the diff touches.

    Exact files and insertion points

    The placement candidates (pick per Open questions):

    • conventions/engineering/engineering-philosophy.md — 35 lines total. It is a priors index, not a body. Its ## Cross-cutting design defaults section (lines 28–35) already delegates this exact concern:

      - A single source of truth for every fact, cited rather than copied — see reference-dont-duplicate.md. (line 35)

      Two catalog rules push against putting the body here. conventions/engineering/README.md:7 states this file's charter as "the default posture: explicit, fail-fast, resilient, idempotent, simple, cross-platform, cosmetic findings as real work" — duplication is not in that charter, and README.md:16 assigns it to reference-dont-duplicate.md. conventions/engineering/progressive-disclosure.md:17-18 calls inlining a full body into a headline surface "the core anti-pattern". AGENTS.md ("Before changing anything here") holds a change in this repo to the bar the catalog prescribes downstream, so both apply to this diff.

    • conventions/engineering/reference-dont-duplicate.md — 45 lines. Already owns in-repo duplication (README.md:16), already distinguishes literal vs semantic duplication (lines 5–10) and the Describe/Use/Expose roles (lines 18–24). The matrix slots naturally as a new ## section between ## Smell signals (line 12) and ## Classify a file's role before flagging (line 18), because the matrix supersedes the smell signals it would sit above.

    Text that must be edited or removed under either placement — these are contradictions, not cross-link opportunities:

    1. conventions/engineering/reference-dont-duplicate.md:12-16 — the sharpest conflict in the repo. Currently:

      ## Smell signals — any one triggers the rule
      1. You edit the same idea in three or more files in a single change.
      2. A search finds three or more near-matches saying almost-but-not-quite the same thing.
      3. Two files assert the same rule with contradicting nuance.

      Signals 1 and 2 gate the rule on three copies. T3 says one fact forcing edits in multiple places is knowledge duplication to consolidate "even at two copies; count is irrelevant." Rewrite, do not cross-link.

    2. conventions/engineering/simpler-code.md:25 — "A reduction is right when it removes copy-paste duplication after three uses agree on shape". Must be re-anchored to T4 (namable/stable abstraction) and T5 (reversibility), not a count.

    3. conventions/engineering/simpler-code.md:10 — cites Metz as a load-bearing attribution: "The wrong abstraction — an abstraction extracted before three concrete uses agree on its shape. Duplication is cheaper than the wrong abstraction". This collides directly with this issue's own constraint that Metz is a link, not a load-bearing attribution. The constraint forces an edit here; it cannot be satisfied by only touching the new text.

    4. conventions/engineering/code-organization.md:12 — "This governs verbatim reuse of identical logic; deciding the shape of a new abstraction follows the rule of three — see simpler-code.md." Repoint if doctrine ownership moves. Note code-organization.md:5-12 ("Share at the second consumer") is already threshold-of-two and is consistent with T3/T4 — keep it, but make the composition explicit rather than leaving two unlinked thresholds.

    5. conventions/review/code-design.md:30 — "repeated field/property/method scaffolding across three or more classes signals a missing base or helper... (Rule of three; see ../engineering/simpler-code.md.)" Repoint and reconcile the count language.

    6. conventions/engineering/README.md — the charter table row changes under either placement (row 7 gains duplication, or row 16 broadens).

    Content contract

    Non-negotiable; these are acceptance criteria, not suggestions:

    • All six tests survive intact, in order, with first-decisive-test-wins semantics preserved: T1 same-knowledge-vs-coincidental, T2 encapsulation boundary, T3 change-together acid test, T4 namable/stable abstraction, T5 reversibility, T6 churn/friction. Subordinating copy count to the sequence is the doctrine's whole point — do not reduce it to a threshold rule.
    • The prose overlay survives intact: knowledge-bearing docs content consolidates from first reuse; audience-, context-, or SEO-sensitive prose is legitimately duplicated; reuse-eligibility alone never justifies consolidation.
    • Constraint 1. The Rule of Three is never presented as a cost calculus. It is a heuristic brake against premature wrong abstractions — permissive about two, never a prohibition on earlier extraction. This must hold in the new text and in the edits to simpler-code.md:10 and :25.
    • Constraint 2. Metz, Dodds, Swett, and Pike appear as links only, never as load-bearing attributions, pending a targeted primary-source verify pass. Existing prose already violates this at simpler-code.md:10.
    • Verified sources go in a ## Sources section, matching the existing pattern (progressive-disclosure.md:26-28).
    • The doctrine is reasoning-only prose and stays in conventions/engineering/ — conventions/engineering/README.md:3 and enforceability-tiers.md reserve mechanically-enforceable rules for components/.

    Out of scope

    • The targeted primary-source verify pass for Metz/Dodds/Swett/Pike. This issue lands the doctrine with those as links; promoting any to a load-bearing attribution is separate work.
    • Any change in melodic-software/claude-code-plugins (the docs-hygiene skills, the point-dont-copy corrector, or the standards-contract.md surface indexes). Downstream re-pointing is a follow-up in that repo, not this diff.
    • Creating a new convention file. Both placement candidates are existing files; a third file is not on the table.
    • distribution/sync-manifest.yml. No conventions/ path appears in it (verified: zero matches for conventions across all 259 lines); this change adds none.

    Acceptance criteria

    • Placement answered by the owner (see Open questions) before authoring.
    • T1–T6 present, ordered, first-decisive-wins, in the agreed file.
    • Prose overlay present with all three clauses.
    • reference-dont-duplicate.md:14-16 no longer gates the rule on three copies.
    • simpler-code.md:10 and :25 no longer make three uses the trigger, and Metz is a link rather than a load-bearing attribution.
    • code-organization.md:12 and conventions/review/code-design.md:30 repointed and count-language reconciled.
    • conventions/engineering/README.md charter row updated.
    • Governance gate. distribution/governance-process.md:46-76 makes cross-doc reconciliation a required self-review checklist item for any conventions/ change (required_approving_review_count is 0 org-wide, so nothing else backstops it). The PR body must state that no other normative doc was left contradicting the change.
    • Stable anchor fixed as contract. reference-dont-duplicate.md:32-34 requires citation by a documented heading, and this issue's own acceptance says downstream consumers will cite this doctrine as the single source of truth. The PR must state the exact heading text as the contract anchor.
    • Gates pass (as found in the repo, not guessed): npm run lint:md — the documented markdown gate in README's Validation section, running markdownlint-cli2 --config .markdownlint-cli2.jsonc. Style constraints that bite prose: MD004 dash bullets, MD049/MD050 asterisk emphasis/strong, MD003 ATX headings; MD013 is disabled so there is no wrap limit. lefthook runs the fast pre-commit subset (lefthook.yml extends components/lefthook-base/lefthook.yml, which pulls editorconfig-checker, gitleaks, markdownlint, typos/_typos.toml, repository-text). Link checking is load-bearing here because the doctrine carries eight external URLs: lychee.toml sets include_fragments = "full" and its header documents an offline CI lane plus an online advisory lane.
    • Conventional Commits PR title (pr-title is a required status per AGENTS.md); squash-only merge.

    Blast radius

    Read-at-source, single repo. distribution/sync-manifest.yml contains zero conventions/ entries across all 259 lines — every component it materializes is executable policy (lefthook-*, markdownlint, gitleaks, runner-policy, dotnet-analysis, and so on). conventions/engineering/README.md:3 and conventions/README.md position this tier as reasoning-only prose adopted by pointer or by copy, not by managed materialization. So no downstream materialization PR follows this change.

    Two qualifiers:

    • distribution/governance-process.md:8-44 documents a sanctioned manual copy path for reasoning-only prose, with back-link and drift-check requirements owned by the adopting repo. Any consumer that copied these files owns noticing this change; this repo does not push it.
    • In the local melodic-software/claude-code-plugins clone, the only matches for reference-dont-duplicate/engineering-philosophy are a CHANGELOG.md entry and an illustrative example fence inside plugins/{review,planning}/reference/standards-contract.md (line 62, a sample index table) — not a live normative citation. Downstream therefore has no citation to break today, but also no row to inherit: if the doctrine body lands in reference-dont-duplicate.md, a consumer's standards-contract.md index would need a row for it, since the sample only carries an engineering-philosophy surface.

    Open questions

    One, reserved to the owner, blocking authoring:

    Where does the doctrine body land?

    • RECOMMENDED — body in conventions/engineering/reference-dont-duplicate.md, with a one-line headline bullet added to engineering-philosophy.md's existing ## Cross-cutting design defaults slot pointing at it. This is what the catalog's own rules prescribe: README.md:16 already assigns duplication to that file, progressive-disclosure.md:17-18 forbids inlining a body into a headline surface, and engineering-philosophy.md:35 already delegates there. It also puts the matrix directly above the smell signals it supersedes.
    • Body in engineering-philosophy.md, as this issue's acceptance criterion literally reads ("engineering-philosophy.md carries the ordered matrix and prose overlay"). Honors the ratified wording exactly, at the cost of a self-inflicted dogfooding finding against progressive-disclosure.md and the README.md:7 charter row.

    The ratification covered the matrix content after a DRY research pass; nothing in the issue body engages this repo's file architecture or names a single existing line to change, which is why this reads as unresolved rather than decided.

  4. removed their assignment
    on Jul 27, 2026
  5. added
    needs-human
    on Jul 27, 2026
  6. kyle-sexton commented on Aug 11, 2026

    @kyle-sexton
    MemberAuthor

    Frontier consensus (Fable + Sol) — ACCEPT

    Decision: Place consolidation-doctrine body in conventions/engineering/reference-dont-duplicate.md (not engineering-philosophy.md).

    Implementing in-session.

    🤖

  7. self-assigned this
    on Aug 11, 2026
  8. kyle-sexton commented on Aug 11, 2026

    @kyle-sexton
    MemberAuthor

    Lease claim for in-session drain. Implementing now. 🤖

  9. added 3 commits that reference this issue on Aug 11, 2026
    f23a8ae
    76c65f2
    b987a0e
  10. added a commit that references this issue on Aug 12, 2026
    e8f7dda
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

needs-humanneeds-owner-decision

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions