Skip to content

feat(rule): source-before-shape — edit-time reuse/scope discipline + capability-reuse-auditor - #863

Merged
artyhoo merged 4 commits into
stagingfrom
claude/dreamy-sanderson-95b3f1
Jul 3, 2026
Merged

feat(rule): source-before-shape — edit-time reuse/scope discipline + capability-reuse-auditor#863
artyhoo merged 4 commits into
stagingfrom
claude/dreamy-sanderson-95b3f1

Conversation

@artyhoo

@artyhoo artyhoo commented Jul 3, 2026

Copy link
Copy Markdown
Owner

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):

  1. BFR-reinvention — PR feat(skill): night-mode — reusable autonomous-overnight orchestration protocol #858 shipped .claude/skills/night-mode/SKILL.md re-describing the executor+dual-reviewer loop SSOT chore(skills+agents): cleanup batch from 2026-05-16 skills+agents audit #64 already owns. Its Prior-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.
  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. 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)

  • Layer A.claude/rules/source-before-shape.md carries <!-- globs: -->/<!-- inject: --> markers → the existing inject-matching-rule.sh surfaces 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).
  • Layer Bagents/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.sh SHIPPED_DOCS +1 (agent shipped to consumers) + regenerated byte-identical baselines; AGENTS.md portable 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.sh8/8 stack×mode byte-identical + shellcheck clean (baselines regenerated: +1 line each, the shipped agent).
  • Injection dogfooded live on all three globs; packages/core/** confirmed excluded.
  • Independent 3-lens Workflow review (top-down + bottom-up approve; one adversarial revise applied — the spent-before-creation disclosure asymmetry).
  • Pre-existing/out-of-scope (identical on base, not this diff): check-rule-globs.sh (consumer-side ESLint boundary, skipped in maintainer repo) and layer-units.test.sh ×2 (macOS dry-run source 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:14 states no API call). build-first-reuse-default — REUSE verdict; the 6-item BFR-consult ran DeepWiki + WebSearch ≥3 phrasings, recorded at docs/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, Superpowers writing-skills REFERENCE) — 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 at packages/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 integritysource-before-shape.md does not edit or supersede build-first-reuse-default.md §4 or phase-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.

test22345 added 2 commits July 3, 2026 08:10
…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).
@artyhoo artyhoo closed this Jul 3, 2026
@artyhoo artyhoo reopened this Jul 3, 2026
test22345 added 2 commits July 3, 2026 08:37
…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.
@artyhoo
artyhoo merged commit b0c6698 into staging Jul 3, 2026
34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants