feat(rule): source-before-shape — edit-time reuse/scope discipline + capability-reuse-auditor - #863
Merged
Merged
Conversation
…capability-reuse-auditor Ships the "source-before-shape" mechanism: read the authoritative source (SSOT + existing skills/agents, or the spec) as an INPUT to a new capability's shape / a dispatch's scope — not a post-hoc trailer or correction. Origin: two same-family AI-laziness incidents (2026-07-02), operator-confirmed as a cross-session recurrence — the promotion trigger: 1. BFR-reinvention: PR #858 shipped .claude/skills/night-mode/SKILL.md re-describing the executor+dual-reviewer loop SSOT #64 already owns; its Prior-art trailer correctly said "ADAPT #64" while the body re-described the loop, and it PASSED principle 11 F1 (F1 checks trailer presence, not reuse substance). #parallel-evolution-creep + #consult-as-trailer-not-input. 2. scope-from-memory: a launch prompt scoped to "implement D1" from recall when spec §9 defines the chain D1 -> B. #claim-from-memory-not-source. Both disciplines already existed (build-first-reuse-default.md §4, phase-research-coverage.md §1.11) but were delivered always-on / path-scoped- to-research-files — neither fired at the authoring moment. This adds the action-scoped (edit-time) delivery those parents lacked. Mechanism (judgment -> injection, not a gate, per rule-enforcement-channel- selection.md §1): - Layer A: .claude/rules/source-before-shape.md carries <!-- globs: -->/ <!-- inject: --> markers -> inject-matching-rule.sh surfaces the reminder at edit-time on .claude/skills/**, agents/**, .claude/orchestrator-prompts/**. REUSE of the existing injector, zero new engine. Honest limitation disclosed (§3): Layer A is once-per-session -> a routine skill/agent edit earlier in the session "spends" it, so it is a best-effort first-touch nudge, carried on those surfaces by Layer B + the always-on parent BFR (it would not have fired on its own origin incident #858). - Layer B: agents/capability-reuse-auditor.md — AI-agnostic overlap + trailer<->body verdict-consistency auditor (no-paid-llm-in-ci §1), doing the semantic pass F1 structurally cannot. Run before handoff. Also: SSOT #189 (ADAPT, records the 6-item BFR-consult); principle 09 REQUIRED_HEADER_DOCS +2; install.sh SHIPPED_DOCS +1 (agent copied to consumers) + regenerated byte-identical baselines (+1 line each, the shipped agent); AGENTS.md portable rule-index +1; research-patch Resolution section. Independently reviewed (3-lens Workflow: top-down + bottom-up approve; one adversarial revise applied — the spent-before-creation disclosure asymmetry). Verified: principles 275/275, byte-identical 8/8, injection dogfooded live. The candidate T-trap #consult-as-trailer-not-input is surfaced-not-applied to ai-laziness-traps.md (its §5 T-addition criterion does not fire; the discipline now has a dedicated rule home) — Artifact Ownership Contract respected. §1.7: Forward+backward in source-before-shape.md §6 — complies with no-paid-llm-in-ci.md §1, build-first-reuse-default.md §4, phase-research-coverage.md §1.11, doc-authority-hierarchy.md §2-§3; registered at 09-doc-authority-hierarchy.ts:54; self-applies (authored source-before-shape, the SSOT #189 consult drove the shape, not memory). Prior-art: prior-art-evaluations.md#189 (source-before-shape mechanism — ADAPT: REUSE inject-matching-rule.sh channel + BUILD the AI-agnostic capability-reuse-auditor; dedup-first ADOPT-VOCABULARY from CyberEvolver/AlignEvoSkill; code-clone tools REJECT on T16 problem-class miss; Superpowers writing-skills REFERENCE — no automated overlap gate).
…-reuse-auditor agent Shipped artefacts must pass prettier --check (audit-self.yml GH #531 dogfood). The two new shipped files needed emphasis-marker + list normalization; the globs/inject markers and doc-authority headers are unchanged. No behaviour change. Prior-art: skipped — formatting only, no new capability (prettier normalization of shipped markdown).
…ettier fix) Prior-art: skipped — empty commit to re-trigger CI, no code change and no new capability introduced.
Resolves SSOT conflict: staging's #862 took IDs #189-#195 (D1 diagnostics + #861 backward-sweep-auditor); this branch's capability-reuse entry renumbered #189 -> #196 with all in-file references updated (rule, agent, research-patch). install.sh auto-merged (both SHIPPED_DOCS additions kept). Baselines regenerated for the current agent content. principle 09/11/21 + byte-identical + format:check re-verified green post-merge.
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Ships source-before-shape — an edit-time discipline that catches two recurring AI-laziness failures at authoring time, closing a recursive-self-application gap in the project's own operating rules.
Origin (2026-07-02, operator-confirmed cross-session recurrence = the promotion trigger):
.claude/skills/night-mode/SKILL.mdre-describing the executor+dual-reviewer loop SSOT chore(skills+agents): cleanup batch from 2026-05-16 skills+agents audit #64 already owns. ItsPrior-art:trailer correctly said "ADAPT chore(skills+agents): cleanup batch from 2026-05-16 skills+agents audit #64" while the body re-described the loop — and it passed principle 11 F1, which checks trailer presence, not reuse substance.#parallel-evolution-creep+#consult-as-trailer-not-input.D1 → B.#claim-from-memory-not-source.Both disciplines already existed (
build-first-reuse-default.md §4,phase-research-coverage.md §1.11) but were delivered always-on / path-scoped-to-research-files — neither fired at the authoring moment. No earliest-reachable channel caught either; the human was the de-facto gate, twice. This adds the action-scoped (edit-time) delivery those parents lacked.How (judgment → injection, not a gate)
.claude/rules/source-before-shape.mdcarries<!-- globs: -->/<!-- inject: -->markers → the existinginject-matching-rule.shsurfaces the reminder at edit-time on.claude/skills/**,agents/**,.claude/orchestrator-prompts/**. REUSE of the injector, zero new engine. Honestly disclosed limitation (§3): Layer A is once-per-session → a routine skill/agent edit earlier in the session "spends" it — a best-effort first-touch nudge, not a reliable gate (it would not have fired on its own origin incident feat(skill): night-mode — reusable autonomous-overnight orchestration protocol #858).agents/capability-reuse-auditor.md, an AI-agnostic overlap + trailer↔body verdict-consistency auditor (no-paid-llm-in-ci), doing the semantic pass F1 structurally cannot. Run before handoff.Also: SSOT #189 (ADAPT, records the 6-item BFR-consult); principle 09
REQUIRED_HEADER_DOCS+2;install.shSHIPPED_DOCS +1 (agent shipped to consumers) + regenerated byte-identical baselines;AGENTS.mdportable rule-index +1; research-patch Resolution section.Testing
npx vitest run packages/core/principles/→ 275/275 (incl. 09 sentinels, 11 F1 via SSOT docs(planning): guard-liveness-gate research-patch #189, 21 rules-autoload).bash tests/install-sh/byte-identical.test.sh→ 8/8 stack×mode byte-identical + shellcheck clean (baselines regenerated: +1 line each, the shipped agent).packages/core/**confirmed excluded.check-rule-globs.sh(consumer-side ESLint boundary, skipped in maintainer repo) andlayer-units.test.sh×2 (macOS dry-runsource failed).§1.7 Forward-check applied
Complies with each active layer. no-paid-llm-in-ci — Layer A is deterministic bash on the existing hook; Layer B is an AI-agnostic sub-agent (
agents/capability-reuse-auditor.md:14states no API call). build-first-reuse-default — REUSE verdict; the 6-item BFR-consult ran DeepWiki + WebSearch ≥3 phrasings, recorded atdocs/meta-factory/prior-art-evaluations.md:262(SSOT #189: code-clone tools REJECT on T16 problem-class miss, CodeAnt REJECT-as-gate, CyberEvolver/AlignEvoSkill ADOPT-VOCABULARY, Superpowerswriting-skillsREFERENCE) — not asserted from memory. rule-enforcement-channel-selection — detectability axis → injection not gate (.claude/rules/source-before-shape.md:42). doc-authority-hierarchy — both new files carry headers and are registered atpackages/core/principles/09-doc-authority-hierarchy.ts:54. language-discipline — machinery English-only (agents/capability-reuse-auditor.md:1).§1.7 Backward-check applied
Complete sweep of the scoped surfaces. Parent-rule integrity —
source-before-shape.mddoes not edit or supersedebuild-first-reuse-default.md §4orphase-research-coverage.md §1.11(subordinate delivery layer; Artifact Ownership Contract respected —.claude/rules/source-before-shape.md:15). Install consistency — the shipped agent is enforced end-to-end: header (packages/core/principles/09-doc-authority-hierarchy.ts:132), install list (install.sh:122), byte-identical baseline (tests/install-sh/baselines/react-next/greenfield.fingerprint:12), lockstep sentinel bumps (packages/core/principles/09-doc-authority-hierarchy.test.ts:93). Self-application (T15) — the rule was authored source-before-shape: the SSOT #189 consult drove its shape, and its own Prior-art provenance (REUSE + ADAPT) is true of the body, not a re-description. Falsifier — wrong if a 3rd occurrence exposes a structural trailer↔body signature a deterministic gate would catch, flipping the promotion target from injection to a narrow gate.