Skip to content

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

Description

@kyle-sexton

Decision (owner, 2026-11-14; answers researched and recorded 2026-11-15)

Source: the talk "All Code Is Slop (Except Mine)" (Lauren Tan, AI Engineer Code Summit, 2026-11-11), slides 17 and 19 and the transcript at 1:07:27 to 1:07:56: "context through directory structure" (two top-level folders with imports between them banned, one folder per feature, a file suffix that signals a rule). None of this is in her public plugin.

The owner asked for each interview question to be researched and the recommendation the evidence supports to be taken (2026-11-14). The answers below were recorded on 2026-11-15.

Owner: "Not organizing files by technical concern, but by the principles of cohesion, looking at the points of coupling, and structuring it so the agents can easily find what they need."

  • Name. A fourth lens, /architecture:improve layout. Adding it edits no existing lens (plugins/architecture/skills/improve/SKILL.md, "Adding a lens").
  • Evidence. A tested, deterministic script under the improve skill reads git log --no-merges --name-only once and computes co-change. /coupling:reduce is unchanged.
  • Measures and defaults, each a setting: code-maat's coupling defaults (code-maat, option table): at least 5 commits per file, 5 shared commits per pair, coupling degree between 30 and 100 percent, change sets of more than 30 files left out; a window of the last 500 commits; author names containing [bot] left out by default.
  • What counts as a feature and as scattered. A feature is a cluster of files joined by passing pairs. A cluster needs at least 4 files by default. Each cluster gets spread (folders touched) and focus (0 to 1), the distribution-map measures of Ducasse et al. (2006) as the co-change cluster research uses them (ModularityCheck, arXiv 1506.05754). A cluster gets a pattern name only where a published rule applies; the published cutoffs are approximate, so they are settings whose defaults are our judgment, and every other cluster reads unclassified. A folder touched by two or more clusters is a mixed folder. A folder is a file's parent folder unless folder_depth groups it higher.
  • Style. The lens judges against the style the repository recorded (decision records, the architecture topic doc, its layers and boundary rules) and cites it. With none recorded it asks once and offers /architecture:record-decision; unattended it reports the evidence without judging it.
  • Flow. The deepening lens's flow: a report of candidate cards, the user's pick, an interview on the target layout, then the deepening lens's hand-off (/planning:design when enabled). Each card names its route: the boundaries lens, the conventions lens, /corrections:codify or /instruction-placement:audit. It never moves files; unattended it only proposes.
  • The talk's file-suffix half. Kept, narrowly: a recorded rule whose files share no folder and no file-name part gets a card proposing a marker, routed to the conventions lens.
  • Settings. One layout object in <home>/architecture.yaml and architecture.local.yaml (the plugin's existing cascade, with schema entries), no userConfig entries; a one-run change is a skill argument.
  • Dogfood. This repository excludes its release, sync and dependency bots by name, not every [bot] author, because the lanes bot's commits are real feature work.

Done when

  • /architecture:improve layout runs the new lens from actions/layout.md and research/layout/; the argument hint, description and Actions table name it; actions/deepening.md, actions/boundaries.md and actions/conventions.md are unchanged.
  • The co-change script has a test that builds a fixture repository and asserts hand-computed pair counts, degree, citing commits (up to five), clusters, spread, focus and mixed folders; two runs give identical output.
  • Each filter has a passing test: an oversized change set, an excluded author, a file below the commit minimum, a pair below the shared-commit minimum, and a pair outside the coupling range are each left out.
  • With too little history to pass the minimums, the lens says so, with the window and the surviving commit count, and shows no candidate.
  • schemas/architecture.schema.json has a layout object with these keys and their defaults (history_commits, min_revs, min_shared_revs, min_coupling, max_coupling, max_changeset_size, exclude_authors, folder_depth), plus the minimum cluster size and the pattern cutoffs under names the plan picks; a valid file passes, an unknown layout key fails; plugin.json userConfig is unchanged; plugins/architecture/reference/config.md documents them.
  • With no recorded style, an attended run asks once and offers /architecture:record-decision, and an unattended run reports the evidence without judging it; an eval case covers each.
  • Every candidate card shows the cluster's files and folders, spread, focus and pattern name (or unclassified), pair counts with citing commits, any mixed folder, the recorded style with its source line, a one-sentence proposed layout with a before and after folder tree, its route and a badge; every number on it comes from the script.
  • After the pick, the lens interviews the target layout, records it in a durable candidate artifact and hands off as the deepening lens does; SKILL.md ## Next gains a line for an agreed layout candidate.
  • A recorded rule whose files share no folder and no file-name part gets a card proposing a marker, routed to the conventions lens; an eval case covers it.
  • No run moves, renames or deletes a file, and an unattended run stops after the report; an eval case asserts it.
  • docs/conventions/architecture.yaml sets layout.exclude_authors to melodic-release[bot], melodic-plugin-release[bot], melodic-standards-sync[bot] and dependabot[bot], and passes the schema.
  • The pull request names the candidates a run on plugins/ reported.

Out of scope

Activity

  1. added
    needs-human
    on Nov 13, 2026
  2. github-actions commented on Nov 13, 2026

    @github-actions
    Contributor

    Size: Medium
    Complexity: Medium
    Uncertainty: Knowable
    Flags: none
    Blocked by: none

    Understood: add a fourth, style-agnostic "layout" lens to /architecture:improve. It would measure co-change from version-control history, report where the layout disagrees with it, and propose candidates without moving files. Boundaries, conventions, corrections and instruction-placement findings would be handed off by slash reference only.

    The issue leaves the lens name, measures, defaults, co-change source and card contents to a /planning:interview before build. Those are implementation choices within the stated design, so I set no intent flag. I found no open duplicate and no merged pull request that already covers this.

    Automated triage. A maintainer reviews it.

  3. melodic-automation-lanes commented on Nov 13, 2026

    @melodic-automation-lanes
    Contributor

    The triage verdict left this issue at needs-owner-decision:

    • held by needs-human
    • no lanes App verdict comment shows whether an earlier verdict was flagged

    Reason: intent

  4. removed
    needs-human
    on Nov 15, 2026
  5. github-actions commented on Nov 15, 2026

    @github-actions
    Contributor
    No description provided.
  6. github-actions commented on Nov 15, 2026

    @github-actions
    Contributor
    No description provided.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Fields

    Work status

    needs-triage

    Priority

    medium

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions