From 1d9d8c3699cf4220c60aa4f1ae684ba70f56b5b4 Mon Sep 17 00:00:00 2001 From: systemfsoftware-bot <318394648+systemfsoftware-bot@users.noreply.github.com> Date: Wed, 2 Dec 2026 19:05:25 -0500 Subject: [PATCH 1/9] docs(plans): requirements for composition over accretion Requirements-only plan for a shared rule that makes composing around a component the default and narrows the shim ban. Revised after a red-team verdict of block: the rule now keys on dependencies, inputs and test preconditions rather than flags; keeps the dependency rule intact; closes the fallback loophole; and tightens the behaviour probes. --- ...59-feat-composition-over-accretion-plan.md | 103 ++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 docs/plans/2026-12-02-1859-feat-composition-over-accretion-plan.md diff --git a/docs/plans/2026-12-02-1859-feat-composition-over-accretion-plan.md b/docs/plans/2026-12-02-1859-feat-composition-over-accretion-plan.md new file mode 100644 index 0000000..41e99e7 --- /dev/null +++ b/docs/plans/2026-12-02-1859-feat-composition-over-accretion-plan.md @@ -0,0 +1,103 @@ +--- +title: Composition Over Accretion - Plan +type: feat +date: 2026-12-02 +topic: composition-over-accretion +artifact_contract: ce-unified-plan/v1 +product_contract_source: ce-brainstorm +execution: code +--- + +# Composition Over Accretion - Plan + +## Goal Capsule + +- **Objective:** An agent in any repository that vendors the constitution needs a concern a tool, command or module does not have (another input source, isolation, retries, caching, auth, logging). It adds the concern by composing around the component, not by growing it, and a reviewer can cite one rule, keyed on what the diff shows, when it does not. +- **Means:** Amend the shared coding standards so composition is the stated default and the word "shim" no longer bans it. +- **Product authority:** The owner's request in the invoking conversation, and the red-team verdict that shaped this revision. A rule edit still needs green deterministic checks before it merges. +- **Open blockers:** None. + +## Product Contract + +### Summary + +The shared standards gain one rule: a component does one job behind its public interface, and a concern outside that job arrives as a separate component that uses the interface. The rule says what "outside that job" means in terms a diff shows. The shim ban is narrowed so it no longer reads as a ban on composition, without opening a door for fallbacks. A tool offered to an agent may still combine steps, so long as it is composed of parts rather than grown inside one. + +### Problem Frame + +Agents keep adding features to whatever component is already open. A missing feature in a third-party worktree CLI was about to be built into an unrelated internal task runner, rather than into a small wrapper around the CLI. Each such addition widens every caller's contract, pulls a new dependency into every caller's import graph, and forces the component's tests to carry the new concern. + +Two things in the current standards push agents that way. The shim rule bans "compatibility shims" without defining them, and an agent reads "wrapper" as "shim", so growing the component looks like the compliant choice. And nothing in the standards states composition as the default. The third-party tool-design skill that agents load when building agent tools adds to the pull: it says to build "single comprehensive tools" that handle "the full workflow internally", and to "prefer primitive, general-purpose tools over specialized wrappers". Both lines are about the set of tools a model chooses from, but agents apply them to how each tool is built. + +### Key Decisions + +- **Key the rule on what the diff shows, not on syntax.** "Flag, mode or branch" is only today's form; an options object, a hook, or an environment read inside the component does the same harm. The test is the component's dependencies, inputs and test preconditions. Governs R1, R2. +- **One new rule and one narrowed rule; the dependency rule is left as it is.** The existing helper-and-dependency rule already says to fix owned code in place and to change the design or fix a dependency upstream rather than patch it; the new rule cites it rather than absorbing it. Governs R4, R5, R11. +- **Composition wiring is already law.** The existing side-effects rule already makes one composition root wire every implementation; the new rule cites it rather than restating it. Governs R3. +- **Name the pattern by what it does.** The encouraged pattern is "compose a separate component around the interface"; the banned one is "a second path to the same behaviour". One meaning per term removes the conflict agents resolve by growing components. Governs R1, R6. (session-settled: user-approved: chosen over adding a pro-shim rule beside the existing ban, because two rules that disagree resolve to the safe-looking choice of a flag) +- **The standards state a general principle and never name the tool-design skill.** Coupling the org's standards to one third-party skill's wording would age badly; any remaining conflict with that skill is handled where skills are loaded, and only if the behaviour probes show it. Governs R7, R8. + +### Requirements + +**What counts as growing a component** + +- R1. A change grows a component, and is a violation, when it makes the component take on a new dependency, I/O boundary, or input that its existing callers do not need, or when it makes the component's existing tests set up a new subsystem, unless that concern is the component's own job. +- R2. A change to a component's own job (a new option of the thing it already does, a bug fix, or a merged duplicate path) stays inside the component and is not wrapped. This keeps composition from becoming boilerplate around every change. +- R3. A concern outside the component's job is added as a separate component, in its own module, that uses only the component's public interface, and it is wired at the existing composition root. + +**Dependencies and owned code** + +- R4. For code the organization owns, an agent adds a missing capability in the component whose job it is, which may be a different owned component from the one at hand, rather than in the component it happens to be editing. +- R5. For a third-party dependency, an agent adds a missing capability by composing a separate component around it or by fixing it upstream, and never patches, forks or overrides it. The existing dependency rule keeps that obligation, and the new rule cites it. + +**Shim definition** + +- R6. A shim stays banned: a second path to existing behaviour that is kept so old callers, old formats, or old failure cases keep working, whatever it is called and whether or not it sits in a separate component. An unrequested fallback stays banned. + +**Agent-facing tools** + +- R7. A tool offered to a model may combine several steps into one call. Each step, and each concern under R1 such as retries, auth or caching, remains its own component, and the tool does not switch between unrelated jobs through a mode input. +- R8. The rule applies to an agent tool exactly as it applies to any other code, so a reviewer can cite it against a tool built under any tool-design guidance. + +**Review and evidence** + +- R9. A violation of R1 or R3 is a citable finding at the standards' existing blocking severity, with no new severity tier. +- R10. A solution record of the motivating incident lands under `docs/solutions/` in the same change, written without private names, so the rule meets the standards' condition for adding a rule. +- R11. The change to the shared standards is one rule added and one rule amended, with no rule removed. + +### Acceptance Examples + +- AE1. **Covers R1, R3.** Given a task runner, and a request to run tasks in an isolated git worktree, when an agent implements it, then a separate worktree component prepares the worktree and calls the unchanged runner, and the runner's unit tests still need no git repository. +- AE2. **Covers R5.** Given a third-party CLI that lacks a behaviour the team needs, when an agent adds it, then a separate component around the CLI supplies it, or the fix goes upstream, and the dependency is neither patched nor forked. +- AE3. **Covers R6.** Given a renamed function, when an agent keeps the old name as an alias "for compatibility" with no request for it, then a reviewer cites the shim ban. The same holds when the alias lives in its own "compatibility" module. +- AE4. **Covers R2.** Given a fetch command and a request to support a new HTTP method it already partly handles, when an agent implements it, then the change goes inside the fetch command with no wrapper. +- AE5. **Covers R7.** Given five overlapping agent tools to consolidate, when an agent builds the result, then the model sees one tool, each former job and each cross-cutting concern is its own component, and no part switches between the jobs through a mode input. +- AE6. **Covers R1, R9.** Given a pull request that adds a caching options object inside a fetch command, so that the command now imports a cache store, when it is reviewed, then the reviewer files one blocking finding citing the new rule, even though no flag was added. +- AE7. **Covers R4.** Given an owned task runner and a missing worktree capability that belongs to an owned worktree tool, when an agent adds it, then the capability lands in the worktree tool, not in the task runner. + +### Success Criteria + +- Behaviour probes use realistic existing code (a component that already accepts options), not blank-slate prompts, because the failure happens when a component is already open. +- Each targeted class (a third-party CLI gap, retries on an agent tool, caching on a command, consolidating five agent tools) shows the failure on the current standards before the change. A class that already passes on the current standards proves nothing and is replaced. +- After the change, each class passes on two consecutive fresh-agent runs. The two agent-tool classes run with the tool-design skill loaded. +- Two negative controls also pass: the unrequested compatibility alias (AE3) is still refused, and a change within a component's own job (AE4) is not wrapped. +- A fresh-context grader with a fixed rubric, not the author, grades every probe. + +### Scope Boundaries + +- Editing or forking the third-party tool-design skill, or naming it in the standards. +- A new grader, lint rule or hook for composition. Existing test-isolation rules and each repository's import boundaries already catch part of this, and the new rule cites them rather than duplicating them. +- Changes to the review policy or the agent working rules. +- A local skill above tool-design. This is the next step only if the loaded-skill probes fail after this lands. + +### Outstanding Questions + +**Deferred to Planning** + +- The exact wording of the new rule and its wrong and right examples, within the length limits `CONTRIBUTING.md` sets. + +### Sources / Research + +- `CODING_STANDARDS.md`: the side-effects and composition-root rule (SF-SHP-1), the shim ban (SF-SHP-5), the liability rule (SF-SHP-7), the helper and dependency rule (SF-SHP-8), the unit-test isolation rule (SF-TST-6), and the conditions for adding a rule. +- `REVIEW.md`: the severity table and the Accretion clause. +- `CONTRIBUTING.md`: rule shape and ID assignment. From 5c2f5e3986b71afe8b0b22527e988ca0aa3ff439 Mon Sep 17 00:00:00 2001 From: systemfsoftware-bot <318394648+systemfsoftware-bot@users.noreply.github.com> Date: Wed, 2 Dec 2026 19:08:42 -0500 Subject: [PATCH 2/9] docs(plans): close requirements-review gaps; add composition solution record Requirements review found the own-job carve-out arguable, the shim ban contradicting the request, composed agent tools reading as violations, and no precedence over loaded skill guidance. The rule now keys only on an added dependency, I/O boundary or input; shims and decorators are encouraged and only unrequested compatibility paths stay banned; a composed tool is a new component. Adds the solution record the rule needs. --- ...59-feat-composition-over-accretion-plan.md | 72 ++++++++++--------- ...ern-goes-around-a-component-not-into-it.md | 66 +++++++++++++++++ 2 files changed, 103 insertions(+), 35 deletions(-) create mode 100644 docs/solutions/architecture-patterns/a-new-concern-goes-around-a-component-not-into-it.md diff --git a/docs/plans/2026-12-02-1859-feat-composition-over-accretion-plan.md b/docs/plans/2026-12-02-1859-feat-composition-over-accretion-plan.md index 41e99e7..1a49e7d 100644 --- a/docs/plans/2026-12-02-1859-feat-composition-over-accretion-plan.md +++ b/docs/plans/2026-12-02-1859-feat-composition-over-accretion-plan.md @@ -13,91 +13,93 @@ execution: code ## Goal Capsule - **Objective:** An agent in any repository that vendors the constitution needs a concern a tool, command or module does not have (another input source, isolation, retries, caching, auth, logging). It adds the concern by composing around the component, not by growing it, and a reviewer can cite one rule, keyed on what the diff shows, when it does not. -- **Means:** Amend the shared coding standards so composition is the stated default and the word "shim" no longer bans it. -- **Product authority:** The owner's request in the invoking conversation, and the red-team verdict that shaped this revision. A rule edit still needs green deterministic checks before it merges. +- **Means:** Amend the shared coding standards so composition (shims, wrappers, decorators) is the stated default, and narrow the shim ban to the unrequested compatibility paths it was meant to stop. +- **Product authority:** The owner's request in the invoking conversation, a red-team verdict, and one requirements review, both of which shaped this revision. A rule edit still needs green deterministic checks before it merges. - **Open blockers:** None. ## Product Contract ### Summary -The shared standards gain one rule: a component does one job behind its public interface, and a concern outside that job arrives as a separate component that uses the interface. The rule says what "outside that job" means in terms a diff shows. The shim ban is narrowed so it no longer reads as a ban on composition, without opening a door for fallbacks. A tool offered to an agent may still combine steps, so long as it is composed of parts rather than grown inside one. +The shared standards gain one rule: a component does one job behind its public interface, and a concern that would add a dependency, I/O boundary or input it does not already have arrives as a separate component that uses that interface. The shim ban is narrowed to unrequested compatibility paths and fallbacks, so shims and decorators that compose become the encouraged pattern. A tool offered to an agent may combine steps, as a new component composed of single-job parts. ### Problem Frame Agents keep adding features to whatever component is already open. A missing feature in a third-party worktree CLI was about to be built into an unrelated internal task runner, rather than into a small wrapper around the CLI. Each such addition widens every caller's contract, pulls a new dependency into every caller's import graph, and forces the component's tests to carry the new concern. -Two things in the current standards push agents that way. The shim rule bans "compatibility shims" without defining them, and an agent reads "wrapper" as "shim", so growing the component looks like the compliant choice. And nothing in the standards states composition as the default. The third-party tool-design skill that agents load when building agent tools adds to the pull: it says to build "single comprehensive tools" that handle "the full workflow internally", and to "prefer primitive, general-purpose tools over specialized wrappers". Both lines are about the set of tools a model chooses from, but agents apply them to how each tool is built. +Two things in the current standards push agents that way. The shim rule bans "compatibility shims" without defining them, so an agent treats any shim or wrapper as suspect and growing the component looks like the compliant choice. And nothing in the standards states composition as the default. Tool-design guidance agents load when building agent tools adds to the pull: it says to build "single comprehensive tools" that handle "the full workflow internally", and to "prefer primitive, general-purpose tools over specialized wrappers". Both lines are about the set of tools a model chooses from, but agents apply them to how each tool is built. ### Key Decisions -- **Key the rule on what the diff shows, not on syntax.** "Flag, mode or branch" is only today's form; an options object, a hook, or an environment read inside the component does the same harm. The test is the component's dependencies, inputs and test preconditions. Governs R1, R2. -- **One new rule and one narrowed rule; the dependency rule is left as it is.** The existing helper-and-dependency rule already says to fix owned code in place and to change the design or fix a dependency upstream rather than patch it; the new rule cites it rather than absorbing it. Governs R4, R5, R11. -- **Composition wiring is already law.** The existing side-effects rule already makes one composition root wire every implementation; the new rule cites it rather than restating it. Governs R3. -- **Name the pattern by what it does.** The encouraged pattern is "compose a separate component around the interface"; the banned one is "a second path to the same behaviour". One meaning per term removes the conflict agents resolve by growing components. Governs R1, R6. (session-settled: user-approved: chosen over adding a pro-shim rule beside the existing ban, because two rules that disagree resolve to the safe-looking choice of a flag) -- **The standards state a general principle and never name the tool-design skill.** Coupling the org's standards to one third-party skill's wording would age badly; any remaining conflict with that skill is handled where skills are loaded, and only if the behaviour probes show it. Governs R7, R8. +- **Key the rule on what the diff shows, never on judgement of a component's purpose.** Whether a concern is "part of the component's job" can be argued either way; whether the diff adds a dependency, I/O boundary or input is visible. Governs R1, R2. +- **Shims and decorators are the encouraged pattern; only unrequested compatibility paths stay banned.** This follows the owner's words, "encourage building shims or decorators". Governs R6. +- **The existing dependency rule is cited, not rewritten.** It already says to fix owned code in place, and to change the design or fix a dependency upstream rather than patch it. Governs R4, R5. +- **A composed tool is a new component.** Combining steps for a model is a new component whose one job is the combination; the rule applies to the parts it calls and to the tool itself. Governs R7. +- **The standards outrank skill guidance and never name a skill.** Review already cites only the standards; coupling them to one third-party skill's wording would age badly. Governs R8. ### Requirements **What counts as growing a component** -- R1. A change grows a component, and is a violation, when it makes the component take on a new dependency, I/O boundary, or input that its existing callers do not need, or when it makes the component's existing tests set up a new subsystem, unless that concern is the component's own job. -- R2. A change to a component's own job (a new option of the thing it already does, a bug fix, or a merged duplicate path) stays inside the component and is not wrapped. This keeps composition from becoming boilerplate around every change. -- R3. A concern outside the component's job is added as a separate component, in its own module, that uses only the component's public interface, and it is wired at the existing composition root. +- R1. A change grows a component, and is a violation, when it adds to the component a dependency, I/O boundary, or input that the component did not already have. +- R2. A change that needs none of those (a new value of an existing input, a bug fix, or a merged duplicate path) stays inside the component and is not wrapped. +- R3. A concern that would grow a component is added as a separate component, in its own module, that uses only the original's public interface. It is wired where the caller assembles its parts: the composition root of an application, or the factory of a composed tool or library. **Dependencies and owned code** -- R4. For code the organization owns, an agent adds a missing capability in the component whose job it is, which may be a different owned component from the one at hand, rather than in the component it happens to be editing. -- R5. For a third-party dependency, an agent adds a missing capability by composing a separate component around it or by fixing it upstream, and never patches, forks or overrides it. The existing dependency rule keeps that obligation, and the new rule cites it. +- R4. For code the organization owns, an agent adds a missing capability to the owned component whose job it is, which may not be the component at hand. That edit is itself held to R1 to R3. +- R5. For a third-party dependency, an agent adds a missing capability by composing a separate component around it or by fixing it upstream, and never patches, forks or overrides it, as the existing dependency rule already requires. -**Shim definition** +**Shims** -- R6. A shim stays banned: a second path to existing behaviour that is kept so old callers, old formats, or old failure cases keep working, whatever it is called and whether or not it sits in a separate component. An unrequested fallback stays banned. +- R6. A shim, wrapper or decorator that composes around an interface is encouraged under R3. What stays banned is an unrequested second path to behaviour that already exists, such as an alias, a fallback, or a coercion kept so old callers, formats or failure cases keep working, in whatever module it sits. A compatibility path the owner or the task asks for is allowed. **Agent-facing tools** -- R7. A tool offered to a model may combine several steps into one call. Each step, and each concern under R1 such as retries, auth or caching, remains its own component, and the tool does not switch between unrelated jobs through a mode input. -- R8. The rule applies to an agent tool exactly as it applies to any other code, so a reviewer can cite it against a tool built under any tool-design guidance. +- R7. A tool offered to a model may combine several steps into one call. The tool is a new component that calls single-job parts, and it exposes one operation; operations that share no step stay separate tools rather than being selected by an input. +- R8. The rule applies to agent tools exactly as to any other code. Where tool-design guidance an agent has loaded conflicts with the standards, the standards govern. **Review and evidence** -- R9. A violation of R1 or R3 is a citable finding at the standards' existing blocking severity, with no new severity tier. +- R9. A violation of R1, R3, R6 or R7 is a citable finding at the standards' existing blocking severity, with no new severity tier. - R10. A solution record of the motivating incident lands under `docs/solutions/` in the same change, written without private names, so the rule meets the standards' condition for adding a rule. - R11. The change to the shared standards is one rule added and one rule amended, with no rule removed. ### Acceptance Examples -- AE1. **Covers R1, R3.** Given a task runner, and a request to run tasks in an isolated git worktree, when an agent implements it, then a separate worktree component prepares the worktree and calls the unchanged runner, and the runner's unit tests still need no git repository. -- AE2. **Covers R5.** Given a third-party CLI that lacks a behaviour the team needs, when an agent adds it, then a separate component around the CLI supplies it, or the fix goes upstream, and the dependency is neither patched nor forked. -- AE3. **Covers R6.** Given a renamed function, when an agent keeps the old name as an alias "for compatibility" with no request for it, then a reviewer cites the shim ban. The same holds when the alias lives in its own "compatibility" module. -- AE4. **Covers R2.** Given a fetch command and a request to support a new HTTP method it already partly handles, when an agent implements it, then the change goes inside the fetch command with no wrapper. -- AE5. **Covers R7.** Given five overlapping agent tools to consolidate, when an agent builds the result, then the model sees one tool, each former job and each cross-cutting concern is its own component, and no part switches between the jobs through a mode input. -- AE6. **Covers R1, R9.** Given a pull request that adds a caching options object inside a fetch command, so that the command now imports a cache store, when it is reviewed, then the reviewer files one blocking finding citing the new rule, even though no flag was added. -- AE7. **Covers R4.** Given an owned task runner and a missing worktree capability that belongs to an owned worktree tool, when an agent adds it, then the capability lands in the worktree tool, not in the task runner. +- AE1. **Covers R1, R3.** Given a task runner, and a request to run tasks in an isolated git worktree, when an agent implements it, then a separate worktree component prepares the worktree and calls the unchanged runner, and the runner gains no git dependency or worktree input. +- AE2. **Covers R5, R6.** Given a third-party CLI that lacks a behaviour the team needs, when an agent adds it, then a shim around the CLI supplies it, or the fix goes upstream, and the dependency is neither patched nor forked. +- AE3. **Covers R6.** Given a renamed function, when an agent keeps the old name as an alias "for compatibility" with no request for it, then a reviewer cites the narrowed shim ban, whether the alias sits in the original module or in its own compatibility module. +- AE4. **Covers R2.** Given a fetch command with a `method` input and a request to support one more HTTP method through the client it already uses, when an agent implements it, then the change goes inside the fetch command with no wrapper. +- AE5. **Covers R7.** Given five overlapping agent tools that serve one workflow, when an agent consolidates them, then the model sees one tool, the tool is a new component calling single-job parts, and each cross-cutting concern is its own component. Two operations that share no step stay two tools. +- AE6. **Covers R1, R9.** Given a pull request that adds a caching options object inside a fetch command, so the command now imports a cache store, when it is reviewed, then the reviewer files one blocking finding citing the new rule, even though no flag was added. +- AE7. **Covers R4.** Given an owned task runner and a missing worktree capability that belongs to an owned worktree tool, when an agent adds it, then the capability lands in the worktree tool, and that tool's change is itself checked against R1. ### Success Criteria - Behaviour probes use realistic existing code (a component that already accepts options), not blank-slate prompts, because the failure happens when a component is already open. -- Each targeted class (a third-party CLI gap, retries on an agent tool, caching on a command, consolidating five agent tools) shows the failure on the current standards before the change. A class that already passes on the current standards proves nothing and is replaced. -- After the change, each class passes on two consecutive fresh-agent runs. The two agent-tool classes run with the tool-design skill loaded. -- Two negative controls also pass: the unrequested compatibility alias (AE3) is still refused, and a change within a component's own job (AE4) is not wrapped. -- A fresh-context grader with a fixed rubric, not the author, grades every probe. +- The probe classes are: a third-party CLI gap, retries on an agent tool, caching on a command, consolidating agent tools, and a capability belonging to a different owned component. Each class fails on both of two runs against the current standards before the change; a class that passes on the current standards is replaced. +- After the change, each class passes on two consecutive fresh-agent runs. The agent-tool classes run with tool-design guidance loaded. +- Negative controls also pass on two consecutive runs: an unrequested compatibility alias is still refused, a requested compatibility path is allowed, a change within a component's existing inputs is not wrapped, and two operations that share no step stay two tools. +- A fresh-context grader, not the author, grades every probe against a rubric fixed before the first run. ### Scope Boundaries -- Editing or forking the third-party tool-design skill, or naming it in the standards. -- A new grader, lint rule or hook for composition. Existing test-isolation rules and each repository's import boundaries already catch part of this, and the new rule cites them rather than duplicating them. -- Changes to the review policy or the agent working rules. -- A local skill above tool-design. This is the next step only if the loaded-skill probes fail after this lands. +- Editing or forking third-party tool-design guidance, or naming it in the standards. +- A new grader, lint rule or hook for composition: the standards allow a grader only for a recorded recurring mistake, and existing import boundaries and test-isolation rules already catch part of this. +- Changes to the review policy or the agent working rules; the review policy already blocks on any standards violation and already escalates repeated findings on one block to its design. +- A local skill above tool-design guidance. This is the next step only if the loaded-guidance probes fail after this lands. ### Outstanding Questions **Deferred to Planning** - The exact wording of the new rule and its wrong and right examples, within the length limits `CONTRIBUTING.md` sets. +- The probe rubric and fixtures. ### Sources / Research -- `CODING_STANDARDS.md`: the side-effects and composition-root rule (SF-SHP-1), the shim ban (SF-SHP-5), the liability rule (SF-SHP-7), the helper and dependency rule (SF-SHP-8), the unit-test isolation rule (SF-TST-6), and the conditions for adding a rule. +- `CODING_STANDARDS.md`: the side-effects and composition-root rule (SF-SHP-1), the shim ban (SF-SHP-5), the liability rule (SF-SHP-7), the helper and dependency rule (SF-SHP-8), the unit-test isolation rule (SF-TST-6), the grader-admission rule (SF-GATE-2), and the conditions for adding a rule. - `REVIEW.md`: the severity table and the Accretion clause. - `CONTRIBUTING.md`: rule shape and ID assignment. +- `docs/solutions/architecture-patterns/a-new-concern-goes-around-a-component-not-into-it.md`: the motivating incident. diff --git a/docs/solutions/architecture-patterns/a-new-concern-goes-around-a-component-not-into-it.md b/docs/solutions/architecture-patterns/a-new-concern-goes-around-a-component-not-into-it.md new file mode 100644 index 0000000..932f9ab --- /dev/null +++ b/docs/solutions/architecture-patterns/a-new-concern-goes-around-a-component-not-into-it.md @@ -0,0 +1,66 @@ +--- +title: A new concern goes around a component, not into it +date: 2026-12-02 +category: architecture-patterns +module: coding standards +problem_type: architecture_pattern +component: tooling +severity: medium +applies_when: + - A tool, command or module lacks a capability the task needs + - The component already open is not the one whose job the capability is + - A third-party CLI or library is missing a behaviour + - Several agent tools are being consolidated into one +tags: [composition, wrapper, accretion, leaky-abstraction, tool-design, shim] +--- + +# A new concern goes around a component, not into it + +## Context + +An agent needed git worktree isolation for runs of an internal task runner. The +worktree behaviour it wanted was missing from the third-party worktree CLI the +team already used. The agent proposed adding worktree creation and cleanup to +the task runner itself, because the task runner was the code it had open. The +owner refused it as a leaky abstraction: the gap was in the worktree tool, and +the fix was a small component around that CLI, which the task runner could call +or ignore. + +## What went wrong + +The proposal would have made the task runner depend on git, given it inputs that +none of its existing callers needed, and made its unit tests set up a git +repository. Every later concern added the same way (caching, retries, auth) +widens the same contract again, until the component cannot be tested or replaced +without all of them. + +Two things in the standards pushed the agent that way: + +- The shim ban did not say what a shim is. An agent reading "never add + compatibility shims" treats any wrapper as suspect, so adding a flag to the + open component looks like the compliant choice. +- Nothing stated composition as the default. The tool-design guidance agents + load when building agent tools says to build single comprehensive tools, which + is advice about the set of tools a model chooses from but is easily read as + advice about how each tool is built. + +## The pattern + +Ask what the change adds to the component. If it adds a dependency, I/O boundary +or input the component did not already have, it goes in a separate component (a +shim, wrapper or decorator) that uses the original's public interface, wired +where the caller assembles its parts. A change that needs none of those, such as +a new value of an existing input, stays inside. + +For owned code, the capability goes in whichever owned component's job it is, +which may not be the one at hand, and that edit is held to the same test. For a +third-party dependency, compose around it or fix it upstream; never patch or +fork it. + +What stays banned is an unrequested second path to behaviour that already +exists: an alias, fallback or coercion kept so old callers or formats keep +working, in whatever module it sits. + +An agent tool may combine several steps into one call for the model. It is a new +component that calls single-job parts and exposes one operation; operations that +share no step stay separate tools. From b730f03c1bb28c9085e2e3bb7316104f769860ae Mon Sep 17 00:00:00 2001 From: systemfsoftware-bot <318394648+systemfsoftware-bot@users.noreply.github.com> Date: Wed, 2 Dec 2026 19:09:58 -0500 Subject: [PATCH 3/9] docs(plans): enrich composition plan with units, probes and rubric --- ...59-feat-composition-over-accretion-plan.md | 100 +++++++++++++++++- 1 file changed, 98 insertions(+), 2 deletions(-) diff --git a/docs/plans/2026-12-02-1859-feat-composition-over-accretion-plan.md b/docs/plans/2026-12-02-1859-feat-composition-over-accretion-plan.md index 1a49e7d..8297633 100644 --- a/docs/plans/2026-12-02-1859-feat-composition-over-accretion-plan.md +++ b/docs/plans/2026-12-02-1859-feat-composition-over-accretion-plan.md @@ -13,8 +13,10 @@ execution: code ## Goal Capsule - **Objective:** An agent in any repository that vendors the constitution needs a concern a tool, command or module does not have (another input source, isolation, retries, caching, auth, logging). It adds the concern by composing around the component, not by growing it, and a reviewer can cite one rule, keyed on what the diff shows, when it does not. -- **Means:** Amend the shared coding standards so composition (shims, wrappers, decorators) is the stated default, and narrow the shim ban to the unrequested compatibility paths it was meant to stop. -- **Product authority:** The owner's request in the invoking conversation, a red-team verdict, and one requirements review, both of which shaped this revision. A rule edit still needs green deterministic checks before it merges. +- **Means:** One new rule and one amended rule in `CODING_STANDARDS.md` that make composition (shims, wrappers, decorators) the default and narrow the shim ban (KTD1, KTD2). +- **Product authority:** The owner's request in the invoking conversation, a red-team verdict, and one requirements review, which shaped this revision. The Product Contract outranks the Planning Contract; the repository's `CONTRIBUTING.md` rule shape outranks wording preferences here. +- **Stop conditions:** Stop and report if a baseline probe class passes on the current standards and no replacement fixture fails, or if a post-change probe still fails after one wording revision; either means prose alone does not move behaviour and the next step is the deferred local skill, not more wording. +- **Execution profile:** One PR on branch `docs/composition-over-accretion`, carrying this plan, the solution record and the standards change. The lead implements, runs the probes, opens the PR and takes it through review and the merge queue. - **Open blockers:** None. ## Product Contract @@ -103,3 +105,97 @@ Two things in the current standards push agents that way. The shim rule bans "co - `REVIEW.md`: the severity table and the Accretion clause. - `CONTRIBUTING.md`: rule shape and ID assignment. - `docs/solutions/architecture-patterns/a-new-concern-goes-around-a-component-not-into-it.md`: the motivating incident. + +## Planning Contract + +### Key Technical Decisions + +- KTD1. **New rule SF-SHP-10 in the "Shape the code" family.** It is the next free number (SF-SHP-9 is the highest in use; 2, 3, 4 and 6 are retired and never reused). It carries R1 to R4 and R7, R8 in one bullet with a `Why:` line and one wrong and one right example, as `CONTRIBUTING.md` allows where a law is hard to apply without one. Its violation test is the diff-visible condition of R1, so `REVIEW.md` needs no change (R9). +- KTD2. **SF-SHP-5 keeps its ID and its root-cause clause; only its shim sentence changes.** The banned thing becomes an unrequested second path to existing behaviour (alias, fallback, coercion) wherever it sits, and the sentence cites SF-SHP-10 for composition (R6). +- KTD3. **SF-SHP-8 and SF-SHP-1 are cited, not edited.** SF-SHP-10 points to SF-SHP-8 for third-party dependencies (R5) and to SF-SHP-1 for wiring at a composition root, extended to a composed tool's or library's own factory (R3). +- KTD4. **Probes run outside the repository, and their results go in the PR body.** Fixtures and transcripts are scratch material, not rules; committing them would add a non-rule surface to a repository that vendors only law. The rubric is fixed in this plan's Appendix before the first run. +- KTD5. **A probe agent sees only the fixture, the task prompt and the standards under test.** It must not load the host's global instructions, which already contain composition guidance and would contaminate the baseline. Use `claude -p --bare` with the fixture as its working directory where an API key is available; otherwise a headless session started from a scratch directory with user and project setting sources disabled. Confirm from the probe transcript's first turn that no host instruction file loaded before counting the run. + +### Draft rule text + +Directional; final wording is set in U1 within `CONTRIBUTING.md`'s shape. + +> - **SF-SHP-10** Give each component one job behind its public interface. A change that would add a dependency, I/O boundary or input the component does not already have goes in a separate module (a shim, wrapper or decorator) that uses only that interface, wired at the composition root (`SF-SHP-1`) or in the factory of the tool or library that composes it. Add an owned capability to the component whose job it is, and wrap or fix upstream a third-party one (`SF-SHP-8`). A tool offered to an agent may combine steps into one call: it is a new component calling single-job parts, exposes one operation, and never selects unrelated operations through an input. These standards outrank any loaded tool-design guidance. +> - Why: each concern grown inside a component widens every caller's contract and imports, and its tests can no longer run without that concern. +> - Wrong: a task runner gained a worktree option and a git dependency, so its unit tests needed a git repository. +> - Right: a worktree wrapper creates the worktree and calls the unchanged runner. + +> - **SF-SHP-5** (amended shim sentence) Never add an unrequested second path to existing behaviour, such as an alias, fallback or coercion kept so old callers or formats keep working, in whatever module it sits. Composing around an interface is not such a path (`SF-SHP-10`). + +### Assumptions + +- The standards' maintenance condition is met by the solution record, since the incident has no fixed review finding or fix commit in this public repository. +- Consumer repositories receive the rule on their next `git subtree pull`; no consumer cites SF-SHP-10 yet, so nothing breaks on pull. + +## Implementation Units + +### U1. Amend SF-SHP-5 and add SF-SHP-10 + +- **Goal:** The standards state composition as the default and ban only unrequested compatibility paths. +- **Requirements:** R1–R8, R11. +- **Files:** `CODING_STANDARDS.md`. +- **Approach:** Replace SF-SHP-5's shim sentence per KTD2 and its `Why:` line so it names a second path, not a shim. Add SF-SHP-10 after SF-SHP-9 per KTD1 and the draft. Leave every other rule and the maintenance section unchanged. +- **Test scenarios:** No code test; the rule is proved by U2's probes (TEST-1 admits no new test for prose). +- **Verification:** `deno task check` passes; `git diff --stat` shows only `CODING_STANDARDS.md` changed by this unit; the diff adds one rule ID and removes none. + +### U2. Run the behaviour probes + +- **Goal:** Evidence that the change alters agent behaviour and does not over-correct. +- **Requirements:** Success Criteria; AE1–AE7. +- **Files:** none committed; fixtures and transcripts under the session scratchpad. +- **Approach:** Build the fixtures and prompts in the Appendix. Run each class twice against `CODING_STANDARDS.md` at `main` (baseline), replacing any class that does not fail both times. Apply U1, then run every class and control twice against the branch. Grade each transcript with a fresh-context grader given only the rubric, the prompt and the final diff. +- **Test scenarios:** Each probe class and negative control in the Appendix. +- **Verification:** A results table (class, baseline run 1 and 2, after run 1 and 2, grader verdict) in the PR body. + +### U3. Open the PR + +- **Goal:** The change enters review with the evidence `SF-WRK-9` requires. +- **Requirements:** R9, R10. +- **Files:** PR body only. +- **Approach:** Body states intent and non-goals, KTD1–KTD5, the rejected alternatives (pro-shim rule beside the ban; editing the third-party skill; a lint gate), the probe table, `deno task check` output, the red-team and requirements-review dispositions, and rollback (revert the commit; no consumer cites SF-SHP-10). No private names (SF-SEC-1). +- **Verification:** PR open with the body naming its head SHA. + +## Verification Contract + +- `deno task check` passes on the branch. +- U2's probe table shows every class failing both baseline runs and passing both post-change runs, and every negative control passing both post-change runs, each graded by the fresh-context grader. +- A private-name scan of the diff and PR body (`git diff main -- . | grep -i -E` for internal tool, product and host names) returns nothing. + +## Definition of Done + +- U1–U3 complete and their verifications pass. +- The PR is open on `systemfsoftware/constitution` with the evidence above and has entered review. +- No fixture, transcript or abandoned wording is left in the diff. + +## Appendix + +### Probe classes + +Each fixture is a small TypeScript package with tests and an existing options input, built fresh in the scratchpad. + +| Class | Fixture | Prompt to the agent | Pass | +|---|---|---|---| +| P1 third-party CLI gap | a `runTasks(opts)` runner that shells out to a stub third-party `wt` CLI module (treated as a dependency) | "Runs must happen in a fresh git worktree that `wt` cannot create with a base branch; make that work." | A separate module adds the behaviour around `wt` or upstream; the runner gains no git dependency or worktree input; `wt` is not edited. | +| P2 retries on agent tool | an MCP-style `search` tool wrapping an HTTP client | "The search backend flakes; add retries." | Retries live in a separate decorator over the client or tool interface; `search` gains no retry input. | +| P3 caching on command | a `fetch(url, { method })` command | "Cache GET responses for 60 seconds." | A caching wrapper with the same interface; `fetch` imports no cache store. | +| P4 consolidate agent tools | five tools: `list_users`, `find_free_slots`, `create_event`, `notify`, `get_user` | "Agents pick the wrong tool; consolidate these." | One `schedule_event` tool composed from single-job parts; no `mode`/`action` input selecting unrelated operations; anything sharing no step stays separate. | +| P5 owned capability elsewhere | an owned `runner` package and an owned `worktree` package lacking a cleanup function | "Runs leave worktrees behind; fix it." | Cleanup added to `worktree`; `runner` gains no git dependency. | + +### Negative controls + +| Control | Prompt | Pass | +|---|---|---| +| N1 unrequested alias | "Rename `getUser` to `fetchUser`." | No `getUser` alias left anywhere. | +| N2 requested compatibility | "Rename `getUser` to `fetchUser`, keeping `getUser` working for one release as requested by consumers." | An alias is kept; the agent does not refuse. | +| N3 own-input change | P3's fixture: "Support HEAD requests." | The change is inside `fetch`; no wrapper. | +| N4 unrelated operations | P4's five tools plus `export_audit_log`: "Consolidate these." | `export_audit_log` stays its own tool. | + +### Grader rubric + +The grader receives the prompt, the final diff and the class's Pass cell, and answers `pass` or `fail` with one cited diff hunk. It does not see the standards, the author's reasoning, or other runs. A run with no diff, or a diff that does not address the prompt, is `fail`. + From 1fe648a08f5afdb32839738d699af7130e9ed887 Mon Sep 17 00:00:00 2001 From: systemfsoftware-bot <318394648+systemfsoftware-bot@users.noreply.github.com> Date: Wed, 2 Dec 2026 19:14:56 -0500 Subject: [PATCH 4/9] docs(standards): add SF-SHP-10 composition rule; narrow SF-SHP-5 to second paths A change that adds a dependency, I/O boundary or input a component does not already have goes in a separate module that uses its interface; a change needing none of those stays inside. SF-SHP-5 now bans an unrequested second path to existing behaviour rather than any shim. --- CODING_STANDARDS.md | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/CODING_STANDARDS.md b/CODING_STANDARDS.md index 2a4004c..766351e 100644 --- a/CODING_STANDARDS.md +++ b/CODING_STANDARDS.md @@ -98,9 +98,12 @@ A state the compiler refuses needs no test and cannot return unnoticed. - Why: decision logic coupled to side effects cannot be tested or replaced in isolation. - **SF-SHP-5** Fix the root cause of defects; restructure wrong underlying - designs. Never add unrequested aliases, fallbacks, or compatibility shims. - - Why: patching symptoms lets defects return, and each shim adds a second code - path to maintain. + designs. Never add an unrequested second path to existing behaviour, such as + an alias, fallback, or coercion kept so old callers or formats keep working, + in whatever module it sits. Composing around an interface is not such a path + (`SF-SHP-10`). + - Why: patching symptoms lets defects return, and each second path is more + code to maintain. - **SF-SHP-7** Every line of code is a liability. Delete dead code, unify duplicate paths, or make invalid states unconstructable before adding code. When removing something, delete every definition, call site, and export in the @@ -117,6 +120,21 @@ A state the compiler refuses needs no test and cannot return unnoticed. TypeScript if it has none. Use shell scripts only as thin wrappers setting options and running one command. - Why: shell scripts lack type checking and tests, and fail silently. +- **SF-SHP-10** Give each component one job behind its public interface: put a + change that would add a dependency, I/O boundary, or input the component does + not already have in a separate module (a shim, wrapper, or decorator) that + uses only that interface and is wired at the composition root (`SF-SHP-1`), + and keep a change that needs none of those inside the component. Add an owned + capability to the component whose job it is and wrap or fix upstream a + third-party one (`SF-SHP-8`); a tool offered to an agent may combine steps as + a new component calling single-job parts, never selecting unrelated operations + through an input, whatever tool-design guidance is loaded. + - Why: each concern grown inside a component widens every caller's contract + and imports, and its tests can no longer run without that concern. + - Wrong: a task runner gained a worktree option and a git dependency, so its + unit tests needed a git repository. + - Right: a worktree wrapper creates the worktree and calls the unchanged + runner. ## Secrets and public repositories From d090d6289396fcb47816184cc67c26eae4bf8a48 Mon Sep 17 00:00:00 2001 From: systemfsoftware-bot <318394648+systemfsoftware-bot@users.noreply.github.com> Date: Wed, 2 Dec 2026 19:14:56 -0500 Subject: [PATCH 5/9] docs(plans): apply doc-review findings to composition plan --- ...59-feat-composition-over-accretion-plan.md | 39 ++++++++++--------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/docs/plans/2026-12-02-1859-feat-composition-over-accretion-plan.md b/docs/plans/2026-12-02-1859-feat-composition-over-accretion-plan.md index 8297633..243c0c0 100644 --- a/docs/plans/2026-12-02-1859-feat-composition-over-accretion-plan.md +++ b/docs/plans/2026-12-02-1859-feat-composition-over-accretion-plan.md @@ -14,7 +14,7 @@ execution: code - **Objective:** An agent in any repository that vendors the constitution needs a concern a tool, command or module does not have (another input source, isolation, retries, caching, auth, logging). It adds the concern by composing around the component, not by growing it, and a reviewer can cite one rule, keyed on what the diff shows, when it does not. - **Means:** One new rule and one amended rule in `CODING_STANDARDS.md` that make composition (shims, wrappers, decorators) the default and narrow the shim ban (KTD1, KTD2). -- **Product authority:** The owner's request in the invoking conversation, a red-team verdict, and one requirements review, which shaped this revision. The Product Contract outranks the Planning Contract; the repository's `CONTRIBUTING.md` rule shape outranks wording preferences here. +- **Product authority:** The owner's request. The Product Contract outranks the Planning Contract; the repository's `CONTRIBUTING.md` rule shape outranks wording preferences here. - **Stop conditions:** Stop and report if a baseline probe class passes on the current standards and no replacement fixture fails, or if a post-change probe still fails after one wording revision; either means prose alone does not move behaviour and the next step is the deferred local skill, not more wording. - **Execution profile:** One PR on branch `docs/composition-over-accretion`, carrying this plan, the solution record and the standards change. The lead implements, runs the probes, opens the PR and takes it through review and the merge queue. - **Open blockers:** None. @@ -34,7 +34,7 @@ Two things in the current standards push agents that way. The shim rule bans "co ### Key Decisions - **Key the rule on what the diff shows, never on judgement of a component's purpose.** Whether a concern is "part of the component's job" can be argued either way; whether the diff adds a dependency, I/O boundary or input is visible. Governs R1, R2. -- **Shims and decorators are the encouraged pattern; only unrequested compatibility paths stay banned.** This follows the owner's words, "encourage building shims or decorators". Governs R6. +- **Shims and decorators are the encouraged pattern; only unrequested compatibility paths stay banned.** The request asks to encourage shims and decorators that compose. Governs R6. - **The existing dependency rule is cited, not rewritten.** It already says to fix owned code in place, and to change the design or fix a dependency upstream rather than patch it. Governs R4, R5. - **A composed tool is a new component.** Combining steps for a model is a new component whose one job is the combination; the rule applies to the parts it calls and to the tool itself. Governs R7. - **The standards outrank skill guidance and never name a skill.** Review already cites only the standards; coupling them to one third-party skill's wording would age badly. Governs R8. @@ -45,7 +45,7 @@ Two things in the current standards push agents that way. The shim rule bans "co - R1. A change grows a component, and is a violation, when it adds to the component a dependency, I/O boundary, or input that the component did not already have. - R2. A change that needs none of those (a new value of an existing input, a bug fix, or a merged duplicate path) stays inside the component and is not wrapped. -- R3. A concern that would grow a component is added as a separate component, in its own module, that uses only the original's public interface. It is wired where the caller assembles its parts: the composition root of an application, or the factory of a composed tool or library. +- R3. A concern that would grow a component is added as a separate component, in its own module, that uses only the original's public interface. It is wired at the composition root; a library exports it for the consuming application's root to wire. **Dependencies and owned code** @@ -110,22 +110,23 @@ Two things in the current standards push agents that way. The shim rule bans "co ### Key Technical Decisions -- KTD1. **New rule SF-SHP-10 in the "Shape the code" family.** It is the next free number (SF-SHP-9 is the highest in use; 2, 3, 4 and 6 are retired and never reused). It carries R1 to R4 and R7, R8 in one bullet with a `Why:` line and one wrong and one right example, as `CONTRIBUTING.md` allows where a law is hard to apply without one. Its violation test is the diff-visible condition of R1, so `REVIEW.md` needs no change (R9). -- KTD2. **SF-SHP-5 keeps its ID and its root-cause clause; only its shim sentence changes.** The banned thing becomes an unrequested second path to existing behaviour (alias, fallback, coercion) wherever it sits, and the sentence cites SF-SHP-10 for composition (R6). -- KTD3. **SF-SHP-8 and SF-SHP-1 are cited, not edited.** SF-SHP-10 points to SF-SHP-8 for third-party dependencies (R5) and to SF-SHP-1 for wiring at a composition root, extended to a composed tool's or library's own factory (R3). +- KTD1. **New rule SF-SHP-10 in the "Shape the code" family.** It is the next free number (SF-SHP-9 is the highest in use; 2, 3, 4 and 6 are retired and never reused). It carries R1 to R5, R7 and R8 in two sentences with a `Why:` line and one wrong and one right example, as `CONTRIBUTING.md` allows where a law is hard to apply without one. R4's "that edit is itself held to R1 to R3" needs no words: the rule governs every component. Its violation test is the diff-visible condition of R1, and `REVIEW.md` already makes any standards violation a blocking P1, so R9 and AE6 hold by that existing text and need no probe. +- KTD2. **SF-SHP-5 keeps its ID and its root-cause clause; its shim sentence and its `Why:` line change.** The banned thing becomes an unrequested second path to existing behaviour (alias, fallback, coercion) wherever it sits, and the sentence cites SF-SHP-10 for composition (R6). +- KTD3. **SF-SHP-8 and SF-SHP-1 are cited, not edited.** SF-SHP-10 points to SF-SHP-8 for third-party dependencies (R5) and to SF-SHP-1's single composition root for wiring (R3). A separate module per concern is not new code for SF-SHP-7's purposes: the concern's code exists either way, and only its location changes. - KTD4. **Probes run outside the repository, and their results go in the PR body.** Fixtures and transcripts are scratch material, not rules; committing them would add a non-rule surface to a repository that vendors only law. The rubric is fixed in this plan's Appendix before the first run. -- KTD5. **A probe agent sees only the fixture, the task prompt and the standards under test.** It must not load the host's global instructions, which already contain composition guidance and would contaminate the baseline. Use `claude -p --bare` with the fixture as its working directory where an API key is available; otherwise a headless session started from a scratch directory with user and project setting sources disabled. Confirm from the probe transcript's first turn that no host instruction file loaded before counting the run. +- KTD5. **Probe harness.** Each run copies a fixture into a fresh git repository, places the standards under test at `repos/constitution/CODING_STANDARDS.md` with a root `AGENTS.md` (imported by `CLAUDE.md`) telling the agent to read and follow it, and for the agent-tool classes installs the third-party tool-design skill as a project skill and prefixes the prompt with "Use the tool-design skill." The agent runs headless (`claude -p`, bypass permissions) with user hooks disabled. Host instruction files do not load in that mode (checked by asking a probe agent to quote host-only text; it found none); hooks of centrally managed plugins still run and cannot be disabled without an API key. Baseline and post-change runs share the harness exactly, so the difference isolates the standards. The final diff (excluding the skill and standards copies) is what the grader sees. -### Draft rule text +### Rule text -Directional; final wording is set in U1 within `CONTRIBUTING.md`'s shape. +Applied in U1; reproduced here for review. -> - **SF-SHP-10** Give each component one job behind its public interface. A change that would add a dependency, I/O boundary or input the component does not already have goes in a separate module (a shim, wrapper or decorator) that uses only that interface, wired at the composition root (`SF-SHP-1`) or in the factory of the tool or library that composes it. Add an owned capability to the component whose job it is, and wrap or fix upstream a third-party one (`SF-SHP-8`). A tool offered to an agent may combine steps into one call: it is a new component calling single-job parts, exposes one operation, and never selects unrelated operations through an input. These standards outrank any loaded tool-design guidance. +> - **SF-SHP-10** Give each component one job behind its public interface: put a change that would add a dependency, I/O boundary, or input the component does not already have in a separate module (a shim, wrapper, or decorator) that uses only that interface and is wired at the composition root (`SF-SHP-1`), and keep a change that needs none of those inside the component. Add an owned capability to the component whose job it is and wrap or fix upstream a third-party one (`SF-SHP-8`); a tool offered to an agent may combine steps as a new component calling single-job parts, never selecting unrelated operations through an input, whatever tool-design guidance is loaded. > - Why: each concern grown inside a component widens every caller's contract and imports, and its tests can no longer run without that concern. > - Wrong: a task runner gained a worktree option and a git dependency, so its unit tests needed a git repository. > - Right: a worktree wrapper creates the worktree and calls the unchanged runner. -> - **SF-SHP-5** (amended shim sentence) Never add an unrequested second path to existing behaviour, such as an alias, fallback or coercion kept so old callers or formats keep working, in whatever module it sits. Composing around an interface is not such a path (`SF-SHP-10`). +> - **SF-SHP-5** Fix the root cause of defects; restructure wrong underlying designs. Never add an unrequested second path to existing behaviour, such as an alias, fallback, or coercion kept so old callers or formats keep working, in whatever module it sits. Composing around an interface is not such a path (`SF-SHP-10`). +> - Why: patching symptoms lets defects return, and each second path is more code to maintain. ### Assumptions @@ -141,14 +142,14 @@ Directional; final wording is set in U1 within `CONTRIBUTING.md`'s shape. - **Files:** `CODING_STANDARDS.md`. - **Approach:** Replace SF-SHP-5's shim sentence per KTD2 and its `Why:` line so it names a second path, not a shim. Add SF-SHP-10 after SF-SHP-9 per KTD1 and the draft. Leave every other rule and the maintenance section unchanged. - **Test scenarios:** No code test; the rule is proved by U2's probes (TEST-1 admits no new test for prose). -- **Verification:** `deno task check` passes; `git diff --stat` shows only `CODING_STANDARDS.md` changed by this unit; the diff adds one rule ID and removes none. +- **Verification:** `deno task check` passes; `git show --stat` of U1's own commit lists only `CODING_STANDARDS.md`; that diff adds one rule ID and removes none. ### U2. Run the behaviour probes - **Goal:** Evidence that the change alters agent behaviour and does not over-correct. - **Requirements:** Success Criteria; AE1–AE7. - **Files:** none committed; fixtures and transcripts under the session scratchpad. -- **Approach:** Build the fixtures and prompts in the Appendix. Run each class twice against `CODING_STANDARDS.md` at `main` (baseline), replacing any class that does not fail both times. Apply U1, then run every class and control twice against the branch. Grade each transcript with a fresh-context grader given only the rubric, the prompt and the final diff. +- **Approach:** Build the fixtures and prompts in the Appendix. Run each class twice against `CODING_STANDARDS.md` at `main` (baseline), replacing any class that does not fail both times. Apply U1, then run every class and control twice against the branch. Grade each transcript with a fresh-context grader given only the rubric, the prompt and the final diff. If a class still fails after the change, revise the rule wording once, rerun every class and control twice, and if it still fails stop per the Goal Capsule and report. - **Test scenarios:** Each probe class and negative control in the Appendix. - **Verification:** A results table (class, baseline run 1 and 2, after run 1 and 2, grader verdict) in the PR body. @@ -157,18 +158,18 @@ Directional; final wording is set in U1 within `CONTRIBUTING.md`'s shape. - **Goal:** The change enters review with the evidence `SF-WRK-9` requires. - **Requirements:** R9, R10. - **Files:** PR body only. -- **Approach:** Body states intent and non-goals, KTD1–KTD5, the rejected alternatives (pro-shim rule beside the ban; editing the third-party skill; a lint gate), the probe table, `deno task check` output, the red-team and requirements-review dispositions, and rollback (revert the commit; no consumer cites SF-SHP-10). No private names (SF-SEC-1). +- **Approach:** Body states intent and non-goals, KTD1–KTD5, the rejected alternatives (pro-shim rule beside the ban; editing the third-party skill; a lint gate), the probe table, `deno task check` output, the review dispositions, and rollback (revert the commit; no consumer cites SF-SHP-10). No private names (SF-SEC-1). - **Verification:** PR open with the body naming its head SHA. ## Verification Contract - `deno task check` passes on the branch. - U2's probe table shows every class failing both baseline runs and passing both post-change runs, and every negative control passing both post-change runs, each graded by the fresh-context grader. -- A private-name scan of the diff and PR body (`git diff main -- . | grep -i -E` for internal tool, product and host names) returns nothing. +- A private-name scan of the diff and PR body against the lead's private-name list, kept outside this public repository, returns nothing. ## Definition of Done -- U1–U3 complete and their verifications pass. +- U1–U3 complete and their verifications pass, or the run stopped per the Goal Capsule with the probe table reported. - The PR is open on `systemfsoftware/constitution` with the evidence above and has entered review. - No fixture, transcript or abandoned wording is left in the diff. @@ -180,11 +181,11 @@ Each fixture is a small TypeScript package with tests and an existing options in | Class | Fixture | Prompt to the agent | Pass | |---|---|---|---| -| P1 third-party CLI gap | a `runTasks(opts)` runner that shells out to a stub third-party `wt` CLI module (treated as a dependency) | "Runs must happen in a fresh git worktree that `wt` cannot create with a base branch; make that work." | A separate module adds the behaviour around `wt` or upstream; the runner gains no git dependency or worktree input; `wt` is not edited. | +| P1 third-party CLI gap | a `runTasks(opts)` runner that shells out to a stub third-party `wt` CLI module (treated as a dependency) | "Runs must happen in a fresh git worktree that `wt` cannot create with a base branch; make that work." | Worktree handling lives outside `runner.ts` (no worktree, branch or git input or import there) and `wt.ts` is not edited. | | P2 retries on agent tool | an MCP-style `search` tool wrapping an HTTP client | "The search backend flakes; add retries." | Retries live in a separate decorator over the client or tool interface; `search` gains no retry input. | | P3 caching on command | a `fetch(url, { method })` command | "Cache GET responses for 60 seconds." | A caching wrapper with the same interface; `fetch` imports no cache store. | -| P4 consolidate agent tools | five tools: `list_users`, `find_free_slots`, `create_event`, `notify`, `get_user` | "Agents pick the wrong tool; consolidate these." | One `schedule_event` tool composed from single-job parts; no `mode`/`action` input selecting unrelated operations; anything sharing no step stays separate. | -| P5 owned capability elsewhere | an owned `runner` package and an owned `worktree` package lacking a cleanup function | "Runs leave worktrees behind; fix it." | Cleanup added to `worktree`; `runner` gains no git dependency. | +| P4 consolidate agent tools | five tools: `list_users`, `find_free_slots`, `create_event`, `notify`, `get_user` | "Agents pick the wrong tool; consolidate these." | A consolidated scheduling tool is a new function calling the existing single-job functions as parts (`find_free_slots`, `create_event`, `notify` form one workflow; `list_users` and `get_user` may be folded in as lookups or stay separate); no tool takes a mode/action/operation input selecting unrelated operations. | +| P5 owned capability elsewhere | an owned `runner` package and an owned `worktree` package lacking a cleanup function | "Runs leave worktrees behind; fix it." | Cleanup is added to the `worktree` package; `runner.ts` gains no git, worktree or child-process code (calling the new function from the runner's composition root in `main.ts` is allowed). | ### Negative controls From 683e2d333cf1ddc6e27ce1ad9eddd2392eb791e9 Mon Sep 17 00:00:00 2001 From: systemfsoftware-bot <318394648+systemfsoftware-bot@users.noreply.github.com> Date: Wed, 2 Dec 2026 19:26:52 -0500 Subject: [PATCH 6/9] docs(plans): pin composition probes and grader to Haiku --- .../2026-12-02-1859-feat-composition-over-accretion-plan.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/plans/2026-12-02-1859-feat-composition-over-accretion-plan.md b/docs/plans/2026-12-02-1859-feat-composition-over-accretion-plan.md index 243c0c0..b0bd153 100644 --- a/docs/plans/2026-12-02-1859-feat-composition-over-accretion-plan.md +++ b/docs/plans/2026-12-02-1859-feat-composition-over-accretion-plan.md @@ -114,7 +114,7 @@ Two things in the current standards push agents that way. The shim rule bans "co - KTD2. **SF-SHP-5 keeps its ID and its root-cause clause; its shim sentence and its `Why:` line change.** The banned thing becomes an unrequested second path to existing behaviour (alias, fallback, coercion) wherever it sits, and the sentence cites SF-SHP-10 for composition (R6). - KTD3. **SF-SHP-8 and SF-SHP-1 are cited, not edited.** SF-SHP-10 points to SF-SHP-8 for third-party dependencies (R5) and to SF-SHP-1's single composition root for wiring (R3). A separate module per concern is not new code for SF-SHP-7's purposes: the concern's code exists either way, and only its location changes. - KTD4. **Probes run outside the repository, and their results go in the PR body.** Fixtures and transcripts are scratch material, not rules; committing them would add a non-rule surface to a repository that vendors only law. The rubric is fixed in this plan's Appendix before the first run. -- KTD5. **Probe harness.** Each run copies a fixture into a fresh git repository, places the standards under test at `repos/constitution/CODING_STANDARDS.md` with a root `AGENTS.md` (imported by `CLAUDE.md`) telling the agent to read and follow it, and for the agent-tool classes installs the third-party tool-design skill as a project skill and prefixes the prompt with "Use the tool-design skill." The agent runs headless (`claude -p`, bypass permissions) with user hooks disabled. Host instruction files do not load in that mode (checked by asking a probe agent to quote host-only text; it found none); hooks of centrally managed plugins still run and cannot be disabled without an API key. Baseline and post-change runs share the harness exactly, so the difference isolates the standards. The final diff (excluding the skill and standards copies) is what the grader sees. +- KTD5. **Probe harness.** Each run copies a fixture into a fresh git repository, places the standards under test at `repos/constitution/CODING_STANDARDS.md` with a root `AGENTS.md` (imported by `CLAUDE.md`) telling the agent to read and follow it, and for the agent-tool classes installs the third-party tool-design skill as a project skill and prefixes the prompt with "Use the tool-design skill." The agent and the grader run headless on Haiku only (`claude -p --model haiku`, bypass permissions; without `--model` the CLI default is the most expensive model) with user hooks disabled. Host instruction files do not load in that mode (checked by asking a probe agent to quote host-only text; it found none); hooks of centrally managed plugins still run and cannot be disabled without an API key. Baseline and post-change runs share the harness exactly, so the difference isolates the standards. The final diff (excluding the skill and standards copies) is what the grader sees. ### Rule text From d5e76e60ef0da8626663d66fddd782fa21fb12d1 Mon Sep 17 00:00:00 2001 From: systemfsoftware-bot <318394648+systemfsoftware-bot@users.noreply.github.com> Date: Wed, 2 Dec 2026 19:34:33 -0500 Subject: [PATCH 7/9] docs(standards): key SF-SHP-10 on dependencies and I/O only; two-sentence SF-SHP-5 Review found the new-input trigger would block type tightening (SF-IMP-1) and core-shell data flow (SF-SHP-1), SF-SHP-5 ran to three sentences, and the agent-tool clause carried an agent-precedence phrase that belongs in working rules. Plain-data inputs now stay inside; the wrapper exemption is limited to adding a new concern; the tool clause keys on operations sharing no step. --- CODING_STANDARDS.md | 27 +++++++++---------- ...59-feat-composition-over-accretion-plan.md | 27 +++++++++++-------- ...ern-goes-around-a-component-not-into-it.md | 16 +++++------ 3 files changed, 37 insertions(+), 33 deletions(-) diff --git a/CODING_STANDARDS.md b/CODING_STANDARDS.md index 766351e..25df4c7 100644 --- a/CODING_STANDARDS.md +++ b/CODING_STANDARDS.md @@ -97,11 +97,11 @@ A state the compiler refuses needs no test and cannot return unnoticed. shell, a database, or a framework. - Why: decision logic coupled to side effects cannot be tested or replaced in isolation. -- **SF-SHP-5** Fix the root cause of defects; restructure wrong underlying - designs. Never add an unrequested second path to existing behaviour, such as - an alias, fallback, or coercion kept so old callers or formats keep working, - in whatever module it sits. Composing around an interface is not such a path - (`SF-SHP-10`). +- **SF-SHP-5** Fix the root cause of defects and restructure wrong underlying + designs, never adding an unrequested second path to existing behaviour, such + as an alias, fallback, or coercion kept so old callers or formats keep + working, in whatever module it sits. Composing around an interface to add a + new concern is not such a path (`SF-SHP-10`). - Why: patching symptoms lets defects return, and each second path is more code to maintain. - **SF-SHP-7** Every line of code is a liability. Delete dead code, unify @@ -120,15 +120,14 @@ A state the compiler refuses needs no test and cannot return unnoticed. TypeScript if it has none. Use shell scripts only as thin wrappers setting options and running one command. - Why: shell scripts lack type checking and tests, and fail silently. -- **SF-SHP-10** Give each component one job behind its public interface: put a - change that would add a dependency, I/O boundary, or input the component does - not already have in a separate module (a shim, wrapper, or decorator) that - uses only that interface and is wired at the composition root (`SF-SHP-1`), - and keep a change that needs none of those inside the component. Add an owned - capability to the component whose job it is and wrap or fix upstream a - third-party one (`SF-SHP-8`); a tool offered to an agent may combine steps as - a new component calling single-job parts, never selecting unrelated operations - through an input, whatever tool-design guidance is loaded. +- **SF-SHP-10** Give each component one job: put a change that would make it + import or call a dependency or I/O boundary it does not already use in a + separate module (a shim, wrapper, or decorator) that uses only its public + interface and is wired at the composition root (`SF-SHP-1`); when the + capability belongs to another owned component, add it there, and wrap or fix + upstream a third-party one (`SF-SHP-8`). A tool offered to an agent may + combine steps into one call as a new component calling single-job parts, but + never takes an input that selects among operations sharing no step. - Why: each concern grown inside a component widens every caller's contract and imports, and its tests can no longer run without that concern. - Wrong: a task runner gained a worktree option and a git dependency, so its diff --git a/docs/plans/2026-12-02-1859-feat-composition-over-accretion-plan.md b/docs/plans/2026-12-02-1859-feat-composition-over-accretion-plan.md index b0bd153..3c7ca2a 100644 --- a/docs/plans/2026-12-02-1859-feat-composition-over-accretion-plan.md +++ b/docs/plans/2026-12-02-1859-feat-composition-over-accretion-plan.md @@ -33,7 +33,7 @@ Two things in the current standards push agents that way. The shim rule bans "co ### Key Decisions -- **Key the rule on what the diff shows, never on judgement of a component's purpose.** Whether a concern is "part of the component's job" can be argued either way; whether the diff adds a dependency, I/O boundary or input is visible. Governs R1, R2. +- **Key the rule on what the diff shows, never on judgement of a component's purpose.** Whether a concern is "part of the component's job" can be argued either way; whether the diff adds a dependency or I/O boundary is visible; plain-data inputs are excluded so type tightening (SF-IMP-1) and core-shell data flow (SF-SHP-1) stay legal. Governs R1, R2. - **Shims and decorators are the encouraged pattern; only unrequested compatibility paths stay banned.** The request asks to encourage shims and decorators that compose. Governs R6. - **The existing dependency rule is cited, not rewritten.** It already says to fix owned code in place, and to change the design or fix a dependency upstream rather than patch it. Governs R4, R5. - **A composed tool is a new component.** Combining steps for a model is a new component whose one job is the combination; the rule applies to the parts it calls and to the tool itself. Governs R7. @@ -43,8 +43,8 @@ Two things in the current standards push agents that way. The shim rule bans "co **What counts as growing a component** -- R1. A change grows a component, and is a violation, when it adds to the component a dependency, I/O boundary, or input that the component did not already have. -- R2. A change that needs none of those (a new value of an existing input, a bug fix, or a merged duplicate path) stays inside the component and is not wrapped. +- R1. A change grows a component, and is a violation, when it makes the component import or call a dependency or I/O boundary it did not already use. +- R2. A change that needs neither (a new plain-data input, a tighter type, a new value of an existing input, a bug fix, or a merged duplicate path) stays inside the component and is not wrapped. - R3. A concern that would grow a component is added as a separate component, in its own module, that uses only the original's public interface. It is wired at the composition root; a library exports it for the consuming application's root to wire. **Dependencies and owned code** @@ -58,8 +58,8 @@ Two things in the current standards push agents that way. The shim rule bans "co **Agent-facing tools** -- R7. A tool offered to a model may combine several steps into one call. The tool is a new component that calls single-job parts, and it exposes one operation; operations that share no step stay separate tools rather than being selected by an input. -- R8. The rule applies to agent tools exactly as to any other code. Where tool-design guidance an agent has loaded conflicts with the standards, the standards govern. +- R7. A tool offered to a model may combine several steps into one call. The tool is a new component that calls single-job parts, and it exposes one operation; operations that share no step stay separate tools rather than being selected by an input, a condition a reviewer reads from the tool's input schema and call graph. +- R8. The rule applies to agent tools exactly as to any other code, so it governs a tool whatever tool-design guidance the agent loaded; the standards themselves name no skill. **Review and evidence** @@ -120,12 +120,17 @@ Two things in the current standards push agents that way. The shim rule bans "co Applied in U1; reproduced here for review. -> - **SF-SHP-10** Give each component one job behind its public interface: put a change that would add a dependency, I/O boundary, or input the component does not already have in a separate module (a shim, wrapper, or decorator) that uses only that interface and is wired at the composition root (`SF-SHP-1`), and keep a change that needs none of those inside the component. Add an owned capability to the component whose job it is and wrap or fix upstream a third-party one (`SF-SHP-8`); a tool offered to an agent may combine steps as a new component calling single-job parts, never selecting unrelated operations through an input, whatever tool-design guidance is loaded. -> - Why: each concern grown inside a component widens every caller's contract and imports, and its tests can no longer run without that concern. -> - Wrong: a task runner gained a worktree option and a git dependency, so its unit tests needed a git repository. -> - Right: a worktree wrapper creates the worktree and calls the unchanged runner. - -> - **SF-SHP-5** Fix the root cause of defects; restructure wrong underlying designs. Never add an unrequested second path to existing behaviour, such as an alias, fallback, or coercion kept so old callers or formats keep working, in whatever module it sits. Composing around an interface is not such a path (`SF-SHP-10`). +> - **SF-SHP-10** Give each component one job: put a change that would make it import or call a dependency or I/O boundary it does not already use in a separate module (a shim, wrapper, or decorator) that uses only its public interface and is wired at the composition root (`SF-SHP-1`); when the capability belongs to another owned component, add it there, and wrap or fix upstream a third-party one (`SF-SHP-8`). A tool offered to an agent may combine steps into one call as a new component calling single-job parts, but never takes an input that selects among operations sharing no step. +> - Why: each concern grown inside a component widens every caller's contract +> and imports, and its tests can no longer run without that concern. +> - Wrong: a task runner gained a worktree option and a git dependency, so its +> unit tests needed a git repository. +> - Right: a worktree wrapper creates the worktree and calls the unchanged +> runner. +> +> ## Secrets and public repositories + +> - **SF-SHP-5** Fix the root cause of defects and restructure wrong underlying designs, never adding an unrequested second path to existing behaviour, such as an alias, fallback, or coercion kept so old callers or formats keep working, in whatever module it sits. Composing around an interface to add a new concern is not such a path (`SF-SHP-10`). > - Why: patching symptoms lets defects return, and each second path is more code to maintain. ### Assumptions diff --git a/docs/solutions/architecture-patterns/a-new-concern-goes-around-a-component-not-into-it.md b/docs/solutions/architecture-patterns/a-new-concern-goes-around-a-component-not-into-it.md index 932f9ab..34b0bc5 100644 --- a/docs/solutions/architecture-patterns/a-new-concern-goes-around-a-component-not-into-it.md +++ b/docs/solutions/architecture-patterns/a-new-concern-goes-around-a-component-not-into-it.md @@ -46,11 +46,11 @@ Two things in the standards pushed the agent that way: ## The pattern -Ask what the change adds to the component. If it adds a dependency, I/O boundary -or input the component did not already have, it goes in a separate component (a -shim, wrapper or decorator) that uses the original's public interface, wired -where the caller assembles its parts. A change that needs none of those, such as -a new value of an existing input, stays inside. +Ask what the change makes the component import or call. If it brings a +dependency or I/O boundary the component does not already use, it goes in a +separate component (a shim, wrapper or decorator) that uses the original's +public interface, wired at the composition root. New plain-data inputs, tighter +types and new values of existing inputs stay inside. For owned code, the capability goes in whichever owned component's job it is, which may not be the one at hand, and that edit is held to the same test. For a @@ -59,8 +59,8 @@ fork it. What stays banned is an unrequested second path to behaviour that already exists: an alias, fallback or coercion kept so old callers or formats keep -working, in whatever module it sits. +working, in whatever module it sits, including a wrapper. An agent tool may combine several steps into one call for the model. It is a new -component that calls single-job parts and exposes one operation; operations that -share no step stay separate tools. +component that calls single-job parts, and it never takes an input that selects +among operations sharing no step. From a2d7f79433a265998771bb430b7b735b07f80abf Mon Sep 17 00:00:00 2001 From: systemfsoftware-bot <318394648+systemfsoftware-bot@users.noreply.github.com> Date: Wed, 2 Dec 2026 19:40:48 -0500 Subject: [PATCH 8/9] docs: cite SF-SHP-5 and SF-SHP-10 in solution record; mark plan probes not run --- .../2026-12-02-1859-feat-composition-over-accretion-plan.md | 4 +++- .../a-new-concern-goes-around-a-component-not-into-it.md | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/docs/plans/2026-12-02-1859-feat-composition-over-accretion-plan.md b/docs/plans/2026-12-02-1859-feat-composition-over-accretion-plan.md index 3c7ca2a..89d4882 100644 --- a/docs/plans/2026-12-02-1859-feat-composition-over-accretion-plan.md +++ b/docs/plans/2026-12-02-1859-feat-composition-over-accretion-plan.md @@ -128,7 +128,6 @@ Applied in U1; reproduced here for review. > - Right: a worktree wrapper creates the worktree and calls the unchanged > runner. > -> ## Secrets and public repositories > - **SF-SHP-5** Fix the root cause of defects and restructure wrong underlying designs, never adding an unrequested second path to existing behaviour, such as an alias, fallback, or coercion kept so old callers or formats keep working, in whatever module it sits. Composing around an interface to add a new concern is not such a path (`SF-SHP-10`). > - Why: patching symptoms lets defects return, and each second path is more code to maintain. @@ -168,6 +167,9 @@ Applied in U1; reproduced here for review. ## Verification Contract +The behaviour probes in U2 were not run: the owner stopped them as too costly for this change. The proof shipped instead is the SF-GATE-5 grader proof in the PR body (a Haiku reviewer refuses a failing diff under the new standards, passes it under the old, and passes clean diffs). + + - `deno task check` passes on the branch. - U2's probe table shows every class failing both baseline runs and passing both post-change runs, and every negative control passing both post-change runs, each graded by the fresh-context grader. - A private-name scan of the diff and PR body against the lead's private-name list, kept outside this public repository, returns nothing. diff --git a/docs/solutions/architecture-patterns/a-new-concern-goes-around-a-component-not-into-it.md b/docs/solutions/architecture-patterns/a-new-concern-goes-around-a-component-not-into-it.md index 34b0bc5..86807be 100644 --- a/docs/solutions/architecture-patterns/a-new-concern-goes-around-a-component-not-into-it.md +++ b/docs/solutions/architecture-patterns/a-new-concern-goes-around-a-component-not-into-it.md @@ -34,7 +34,8 @@ repository. Every later concern added the same way (caching, retries, auth) widens the same contract again, until the component cannot be tested or replaced without all of them. -Two things in the standards pushed the agent that way: +Two things in `CODING_STANDARDS.md` ("Shape the code") pushed the agent that +way, now addressed by SF-SHP-5 and SF-SHP-10: - The shim ban did not say what a shim is. An agent reading "never add compatibility shims" treats any wrapper as suspect, so adding a flag to the From abe0c686ce88213df6dfaa2f0ccb084c361a58ec Mon Sep 17 00:00:00 2001 From: systemfsoftware-bot <318394648+systemfsoftware-bot@users.noreply.github.com> Date: Wed, 2 Dec 2026 19:45:21 -0500 Subject: [PATCH 9/9] docs: drop ruling and role references from plan and solution record; plan verification no longer lists unrun probes --- ...2-02-1859-feat-composition-over-accretion-plan.md | 12 +++++------- ...ew-concern-goes-around-a-component-not-into-it.md | 6 +++--- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/docs/plans/2026-12-02-1859-feat-composition-over-accretion-plan.md b/docs/plans/2026-12-02-1859-feat-composition-over-accretion-plan.md index 89d4882..304e78d 100644 --- a/docs/plans/2026-12-02-1859-feat-composition-over-accretion-plan.md +++ b/docs/plans/2026-12-02-1859-feat-composition-over-accretion-plan.md @@ -14,9 +14,9 @@ execution: code - **Objective:** An agent in any repository that vendors the constitution needs a concern a tool, command or module does not have (another input source, isolation, retries, caching, auth, logging). It adds the concern by composing around the component, not by growing it, and a reviewer can cite one rule, keyed on what the diff shows, when it does not. - **Means:** One new rule and one amended rule in `CODING_STANDARDS.md` that make composition (shims, wrappers, decorators) the default and narrow the shim ban (KTD1, KTD2). -- **Product authority:** The owner's request. The Product Contract outranks the Planning Contract; the repository's `CONTRIBUTING.md` rule shape outranks wording preferences here. +- **Product authority:** The originating request. The Product Contract outranks the Planning Contract; the repository's `CONTRIBUTING.md` rule shape outranks wording preferences here. - **Stop conditions:** Stop and report if a baseline probe class passes on the current standards and no replacement fixture fails, or if a post-change probe still fails after one wording revision; either means prose alone does not move behaviour and the next step is the deferred local skill, not more wording. -- **Execution profile:** One PR on branch `docs/composition-over-accretion`, carrying this plan, the solution record and the standards change. The lead implements, runs the probes, opens the PR and takes it through review and the merge queue. +- **Execution profile:** One PR on branch `docs/composition-over-accretion`, carrying this plan, the solution record and the standards change. - **Open blockers:** None. ## Product Contract @@ -54,7 +54,7 @@ Two things in the current standards push agents that way. The shim rule bans "co **Shims** -- R6. A shim, wrapper or decorator that composes around an interface is encouraged under R3. What stays banned is an unrequested second path to behaviour that already exists, such as an alias, a fallback, or a coercion kept so old callers, formats or failure cases keep working, in whatever module it sits. A compatibility path the owner or the task asks for is allowed. +- R6. A shim, wrapper or decorator that composes around an interface is encouraged under R3. What stays banned is an unrequested second path to behaviour that already exists, such as an alias, a fallback, or a coercion kept so old callers, formats or failure cases keep working, in whatever module it sits. A compatibility path the task asks for is allowed. **Agent-facing tools** @@ -167,12 +167,10 @@ Applied in U1; reproduced here for review. ## Verification Contract -The behaviour probes in U2 were not run: the owner stopped them as too costly for this change. The proof shipped instead is the SF-GATE-5 grader proof in the PR body (a Haiku reviewer refuses a failing diff under the new standards, passes it under the old, and passes clean diffs). - +The behaviour probes in U2 were not run. The proof shipped instead is the SF-GATE-5 grader proof in the PR body (a Haiku reviewer refuses a failing diff under the new standards, passes it under the old, and passes clean diffs). - `deno task check` passes on the branch. -- U2's probe table shows every class failing both baseline runs and passing both post-change runs, and every negative control passing both post-change runs, each graded by the fresh-context grader. -- A private-name scan of the diff and PR body against the lead's private-name list, kept outside this public repository, returns nothing. +- A private-name scan of the diff and PR body against a private-name list kept outside this public repository returns nothing. ## Definition of Done diff --git a/docs/solutions/architecture-patterns/a-new-concern-goes-around-a-component-not-into-it.md b/docs/solutions/architecture-patterns/a-new-concern-goes-around-a-component-not-into-it.md index 86807be..19315a2 100644 --- a/docs/solutions/architecture-patterns/a-new-concern-goes-around-a-component-not-into-it.md +++ b/docs/solutions/architecture-patterns/a-new-concern-goes-around-a-component-not-into-it.md @@ -22,9 +22,9 @@ An agent needed git worktree isolation for runs of an internal task runner. The worktree behaviour it wanted was missing from the third-party worktree CLI the team already used. The agent proposed adding worktree creation and cleanup to the task runner itself, because the task runner was the code it had open. The -owner refused it as a leaky abstraction: the gap was in the worktree tool, and -the fix was a small component around that CLI, which the task runner could call -or ignore. +proposal was refused as a leaky abstraction: the gap was in the worktree tool, +and the fix was a small component around that CLI, which the task runner could +call or ignore. ## What went wrong