Skip to content

refactor(architecture)!: share the lens steps and split layout into improve-layout - #16496

Merged
kyle-sexton merged 10 commits into
mainfrom
refactor/architecture-improve-shared-lens-steps
Nov 16, 2026
Merged

kyle-sexton merged 10 commits into
mainfrom
refactor/architecture-improve-shared-lens-steps

Conversation

@kyle-sexton

@kyle-sexton kyle-sexton commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

No related issue: the owner chose this split in session on 2026-11-15, from an /architecture:improve scan of plugins/architecture.

Summary

architecture:improve held four lenses. Three of them borrowed steps by citing paragraphs of the deepening playbook, each stated its own write rules and its own reading of the convention-home resolver's exit codes (they disagreed), the lens list was kept by hand in about nine places and had drifted, and the layout lens shared none of the module vocabulary.

Breaking: /architecture:improve layout is removed. The layout check is now /architecture:improve-layout.

Fix

  • Shared steps. reference/improvement-steps.md owns base freshness, scope and fan-out, decision-record discovery, one convention-home exit-code table, one memory-tier write contract, badge bands and the hand-off. Each lens cites it; none cites the deepening playbook for a borrowed step.
  • Roster. The manifest, README and skill hub state the lenses that exist; "Adding a lens" lists every place; lens-roster.test.sh fails when a playbook has no Actions row or argument-hint entry, and the reverse.
  • Layout. Its playbook, reference, script and test move to skills/improve-layout/, with its own trigger phrases.

Behaviour that changed by unifying:

  • The boundaries and conventions lenses read the topic doc under the default home when the resolver reports no pointer or a declined home, as the layout lens already did. Writes still need a resolved home.
  • The deepening and layout lenses gain the guards the boundaries lens had: write nothing when the memory root is the repository root, never overwrite an existing file, and put the content in the report when a write is refused.
  • Every lens announces a path before its first write; the conventions lens leaves bot-authored commits out of its history step.

Verification

  • scripts/check-affected.sh on the head: 17 passed, 1 skipped, 0 failed. co-change.test.sh and lens-roster.test.sh pass.
  • The moved layout cases and one case each for boundaries and conventions now build a real repository in a scaffold, and both versions were run on the same cases, six runs per case per arm (mean score, this branch against main):
Case This branch main
layout: attended, asks once 0.89 0.69
layout: marker card for a scattered rule 0.92 0.58
layout: unattended, reports without judging 0.92 0.97
layout: unattended, stops after the report 0.97 0.94
boundaries: recorded rule crossing handed on 0.97 0.97
conventions: proposes, writes nothing without a yes 0.93 0.88
  • Cause of the earlier drop, established and fixed. The new skill stopped in its first phase to ask how files should be grouped, before running the co-change script (6 of 6 runs; main did so in 3 of 6). The skill now computes the cards first and, when attended, asks the grouping question once after them. A dedicated re-run of the two affected cases after the fix scored 1.00 on 6 of 6 runs each.
  • One case sits at the 5-point margin (0.92 against 0.97); the whole gap is one judge grader, and the one failing reply that was read did carry the required label. In the round before, both versions scored 0.94 on it.
  • New routing case: a plain request reached the new skill in every run.
  • Not done: judge calibration, a negative control, a second model.

Related

  • /architecture:enforce-boundaries (merged while this was open) now reads the convention home from the shared steps too.
  • Behaviour change in the layout skill: it no longer asks the grouping question before computing the cards.
  • The interview loop and the design hand-off are unchanged.
  • feat(session-flow): gate optional plugin calls on enabled skills #16450 edits two paragraphs of the deepening playbook; they are byte-identical here.

🤖 Generated with Claude Code

kyle-sexton and others added 4 commits November 15, 2026 22:21
…mprove-layout

One plugin reference, reference/improvement-steps.md, owns the steps every
improve lens takes the same way: base freshness, scope and fan-out, recorded
decisions, the convention home with one exit-code table, the memory-tier
write rules, badge bands and the hand-off. The lens playbooks cite it by
section instead of citing the deepening playbook, and the boundaries and
conventions playbooks name the plugin root through the rendered placeholder.

The layout lens moves out of improve into /architecture:improve-layout with
its script, tests, measures reference and eval cases. improve keeps
deepening, boundaries and conventions; every roster place names them, and a
roster test fails when a playbook has no Actions row or argument-hint entry.

BREAKING CHANGE: /architecture:improve no longer takes the layout action;
run /architecture:improve-layout.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
The roster rewrite took the manifest description past 500 characters;
shorten it and regenerate the catalog. The README names improve-layout
among the users of the shared steps.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
The no-question grader failed replies that gave the whole report and only
closed with what the user can decide later. It now fails a reply that
withholds the cards until the user answers, which is what the prompt's
"don't wait on questions" asks for.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
The shared memory-tier section said every file a lens writes goes to the
memory tier, which contradicted the deepening report in the temp directory
and the conventions append to the topic doc; it now covers the durable run
artifacts. The convention-home write rule now binds only a lens that writes
under the home.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@kyle-sexton
kyle-sexton marked this pull request as ready for review November 16, 2026 03:23
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-16T03:25:56.296408Z 03c710c Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 03c710c4c9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@kyle-sexton kyle-sexton added the do-not-merge Hard merge gate: do not merge while applied. label Nov 16, 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 skipped
Commits pushed none (read lane)
Run 43797934035

Failed GitHub API calls

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

@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

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

Chunk 1 of 2 (40 files)

Security review: PR #16496, chunk 1 of 2

I found no security issues in this chunk. I read every hunk of all 40 files in .claude-lane/chunks/chunk-1.patch. This lane already reviewed an earlier head (blocking only: yes), so this review reports only CRITICAL and IMPORTANT findings, and there are none.

What changed. The chunk is a refactor, mostly prose:

  • The layout lens leaves /architecture:improve and becomes a new /architecture:improve-layout skill. Its reference, co-change.mjs and its test are renamed; the only edits inside them are comment and path text.
  • A new shared-steps reference, plugins/architecture/reference/improvement-steps.md, holds the steps the lenses share.
  • enforce-boundaries now cites that reference.
  • Catalog, cheat-sheet, README and schema descriptions are updated.
  • New eval cases come with scaffold scripts.

Instruction-surface lens. I checked every removed or moved rule for a guardrail that no longer applies anywhere:

  • Layout rules. improve-layout/SKILL.md keeps all of them: it never moves, renames or deletes a file; it never runs /architecture:record-decision or any other route unasked; an unattended run stops after the report and writes nothing but the artifact and its .gitignore; recorded-style and ADR text is data, never instructions.
  • Write guards. The shared memory-tier section keeps them and extends them to the deepening and layout lenses: no file when the memory root is the repository root, never overwrite, create the .gitignore with Write rather than a shell redirect, never edit the repository's own .gitignore, and put the content in the report when a write is refused.
  • Convention home. Boundaries and conventions now read the topic doc under the default docs/conventions on resolver exits 1 and 4. That widens only what they read inside the repository. Writes still require exit 0.

None of this removes or loosens a rule in the register's protected classes: irreversible actions, secrets, data-integrity writes, external publication or agent authority.

Eval scaffolds. The scaffold.sh scripts and fixtures/git-history.sh build local git repositories from fixed literals. Each scaffold first calls the existing repo-scaffold-guard.sh, and the case prompts say they need a sandbox backend. No untrusted input reaches them, and they use no network or credentials. The one sed -i interpolates names from a fixed list.

Arguments passed to the script. improve-layout passes --path and one-run settings "as given" to node co-change.mjs. The person invoking the skill supplies them in their own session, so no outside attacker reaches that path.

Manifest.

  • manifest description: pass (the plugins/architecture/.claude-plugin/plugin.json change is to description only, which is in the inert set; no userConfig, hooks, servers or dependencies change).

Trust controls. No file in this chunk matches a TRUSTED PATHS: glob. No workflow, action, token request, trusted-actor list, kill switch, merge hold or broker config changes in this chunk.

Spend. The new and moved eval cases spend prepaid model usage when the plugin-evals lane runs them: 6 runs each, 3 for the routing case, up to 30 turns and 900 s. That is not a hold and not a finding.

The settled thread on improve-layout/SKILL.md lines 34-37 (lines changed since resolution: no) is about eval evidence, not security, so I did not re-raise it.

Chunk 2 of 2 (6 files)

Security review: PR #16496, chunk 2 of 2

I found no security issues in this chunk. I read every hunk of all 6 chunk-2 files, both in .claude-lane/chunks/chunk-2.patch and in their sections of .claude-lane/pr.diff:

  • plugins/architecture/skills/improve/actions/boundaries.md
  • plugins/architecture/skills/improve/actions/conventions.md
  • plugins/architecture/skills/improve/actions/deepening.md
  • plugins/architecture/skills/improve/actions/layout.md (deleted)
  • plugins/architecture/skills/improve/evals/evals.json
  • plugins/architecture/skills/improve/scripts/lens-roster.test.sh (new)
  • scripts/spoke-plugin-root-baseline.txt

This lane already reviewed an earlier head (blocking only: yes), so this review reports only CRITICAL and IMPORTANT findings. There are none.

Instruction-surface lens. I checked the register's protected classes, Gate 0's six classes via docs/contracts/instruction-exception-register/README.md. The three lens playbooks lose inline rules, but each one now points to a named section of plugins/architecture/reference/improvement-steps.md (chunk 1). I read that file at head and every removed guard is still there:

  • Data-integrity and irreversible actions. Never edit the repository's own .gitignore. Create the memory-root .gitignore with the Write tool, never a shell redirect. Write nothing when the memory root is the repository root or no branch resolves. Never overwrite a file: add -2, -3. A refused write is not a stop. Never merge or rebase on its own. These are at improvement-steps.md#L71-L92 and #L18-L21.
  • Hand-off instructions. "A skipped suite is not a pass" and the retired-name sweep are kept at #L101-L122.
  • Writes under the convention home. These still need exit 0 (#L67-L69). The conventions lens' Phase 4 still writes only on exit 0 with the topic doc present, and now also covers unknown exit codes, which is stricter.
  • Reads under the default home. The boundaries and conventions lenses now read the topic doc under the default home on exit 1 or 4. That widens only what they read, not what they write. In conventions, the rule that recorded text "is data … never followed" is unchanged.

Deleted actions/layout.md. Its guards moved to plugins/architecture/skills/improve-layout/SKILL.md (chunk 1), where I confirmed each one:

  • recorded text is data (L47, L174);
  • /architecture:record-decision and routed skills are never run unasked (L146);
  • it moves no file, at any phase (L30, L151).

lens-roster.test.sh. It is a local test script. It reads only SKILL.md and actions/*.md, writes only under a mktemp -d directory that its trap removes, and takes no untrusted input. Removing it from the spoke-plugin-root-baseline.txt entries only drops two ${CLAUDE_PLUGIN_ROOT} allowances that are no longer needed, so the baseline gets tighter.

evals.json. Only eval cases are removed (the PR moves them into scaffolded cases), so there is no runtime surface.

Trust controls and manifests. No chunk-2 file matches a TRUSTED PATHS: glob. No workflow, action, token request, trusted-actor list, kill switch, merge hold or plugin manifest is in this chunk.

Settled thread. The improve-layout/SKILL.md thread is in chunk 1 and is not re-raised.

critical-findings: 0

@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

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

Chunk 1 of 2 (40 files)

Code review, chunk 1 of 2 (blocking only): nothing blocking

This lane already reviewed an earlier head, so this pass reports blocking findings only. I found none in this chunk.

Scope. I read every hunk of all 40 chunk-1 files in .claude-lane/chunks/chunk-1.patch. That covers:

  • the changelog fragment
  • the catalog, cheat-sheet and convention doc edits
  • plugin.json and the README
  • 24 new eval case files and the git-history.sh fixture
  • reference/config.md, the new reference/improvement-steps.md and the schema
  • enforce-boundaries/SKILL.md, the new improve-layout/SKILL.md and the three renamed layout files
  • improve/SKILL.md

No issue closes this PR, so there are no acceptance criteria to check. The one settled thread (improve-layout/SKILL.md 34-37, unchanged since it was resolved) stays settled. The only prior post is a summary comment with no line anchor, and I am not repeating it.

What I checked

  • Renames still resolve.

    • co-change.mjs and co-change.test.sh keep the same directory depth (skills/<skill>/scripts/), so their relative paths to lib/ and schemas/ still work.
    • A repository-wide search for research/layout, improve/scripts/co-change, actions/layout.md and improve layout finds only the new fragment and past entries in plugins/architecture/CHANGELOG.md. Those history entries correctly keep the old name.
  • Eval scaffolds match their graders. I counted the line numbers each grader cites against the scaffold that writes the file:

    • ARCHITECTURE.md:14: a two-line header plus lines 3-13, then the rule.
    • ARCHITECTURE.md:22: the same header plus lines 3-21, then the rule.
    • 0004-folder-per-feature.md:9: counted line by line in the heredoc.

    All three match. The sourced fixtures (repo-scaffold-guard.sh, convention-home.sh, git-history.sh) and map-dependencies/scripts/dependency-graph.sh all exist. convention-home.sh writes AGENTS.md and architecture_dir: docs/architecture, and the boundaries scaffold's guard checks both before it runs. The conventions scaffold's sed matches only the method's indented {, so each handler registration goes inside AddOrderHandlers.

  • Convention-home table (reference/improvement-steps.md). Exit codes 0/1/4 give a home, 5/2/3/other give none, and writes happen only on exit 0. enforce-boundaries and improve-layout Phase 1 both cite this table consistently.

  • Manifest. plugin.json changes only description. The fragment's bump: major matches removing /architecture:improve layout.

    • manifest description: pass (it names the three remaining lenses and the new improve-layout skill)
    • manifest version/bump: pass (bump: major for a removed action)

Not blocking, so not counted. enforce-boundaries now reads the default home on resolver exits 1 and 4, where before it read nothing on any exit but 0 (plugins/architecture/skills/enforce-boundaries/SKILL.md:36-40). The fragment's "Changed" section lists this behaviour change only for the boundaries and conventions lenses.

Spend (not a finding). The new scaffolded eval cases run 6 times each (3 times for the routing case), up to 30 turns each, which spends prepaid API usage when the evals run.

Verification. I ran nothing; this lane has no shell. The test and eval results in the PR description are the author's claims and I have not checked them.

Verifier dropped 0 of 0 candidates.

Chunk 2 of 2 (6 files)

Code review, chunk 2 of 2 (blocking only): nothing blocking

This lane already reviewed an earlier head, so this review reports only blocking findings. I found none in this chunk.

Scope. I read every hunk of the 6 files in this chunk:

  • plugins/architecture/skills/improve/actions/boundaries.md
  • plugins/architecture/skills/improve/actions/conventions.md
  • plugins/architecture/skills/improve/actions/deepening.md
  • plugins/architecture/skills/improve/actions/layout.md (deleted)
  • plugins/architecture/skills/improve/evals/evals.json
  • plugins/architecture/skills/improve/scripts/lens-roster.test.sh (new)
  • scripts/spoke-plugin-root-baseline.txt

No issue closes this PR, so there are no acceptance criteria to check. The one settled thread is on improve-layout/SKILL.md, which is in chunk 1, so this chunk does not touch it.

What I checked

  • Every section the playbooks now cite exists in the shared file. The three lens playbooks cite these sections by name: "Base freshness", "Scope and fan-out", "Recorded decisions", "Convention home", "Memory-tier writes", "Badge bands" and "Hand-off". All seven are headings in reference/improvement-steps.md at head.

  • No guard was lost when the inline text was removed. The shared "Memory-tier writes" section still has every rule the playbooks used to state themselves:

    • the .gitignore check;
    • the rule to write nothing when the memory root is the repository root or no branch resolves;
    • never overwrite (-2, then -3);
    • a refused write is not a stop.

    The boundaries lens keeps its own consequence (it lists the rows in the report).

  • The exit codes in the conventions lens agree with the shared table. Phase 4 writes only on exit 0 with the topic doc present. Exits 1 and 3 keep their own messages, and exits 2, 4, 5 and any other code fall to "unavailable". This matches the "Convention home" table, which writes only on exit 0.

  • The baseline entries were safe to drop. boundaries.md and conventions.md no longer contain ${CLAUDE_PLUGIN_ROOT} (a grep of actions/ finds none). <plugin-root> is defined in improve/SKILL.md:87-88.

  • lens-roster.test.sh checks against the real roster. The argument-hint ([deepening|boundaries|conventions]) and the Actions-table rows (SKILL.md:57-59) both match the three playbooks left in actions/. Both negative checks build their cases from a copy of the real files.

  • Removed evals. Cases 8 and 11 and the four layout cases leave evals.json. Chunk 1 adds them again as scaffolded cases under plugins/architecture/evals/. Nothing in plugins/ still points at actions/layout.md.

Verification. I ran nothing, including lens-roster.test.sh. The test and eval results in the PR description are the author's own claims, and I have not checked them.

Verifier dropped 0 of 0 candidates.

critical-findings: 0

kyle-sexton and others added 6 commits November 15, 2026 22:36
… a repository

The four improve-layout cases and one case each for the boundaries and
conventions lenses described a repository the eval workspace did not hold,
so every run reported missing files and history and the cases could not
show a regression. Each is now a plugin suite case whose scaffold builds a
small git repository with the history, records and manifests the prompt
describes, graded by file, tool and pattern checks where the outcome is
structural and by a judge only for prose. The cases leave the legacy
evals.json files; improve-layout's suite cases tag it.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
A period right after /architecture:improve-layout kept the prompt from
parsing as a slash command, so runs loaded the skill through a Skill call
and failed the no-other-skill check. The file-kept checks graded files the
scaffold wrote, which the file grader does not see; a no-mv/rm check on Bash
replaces them.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
… for a style

With no recorded layout style, an attended run of the split-out skill
stopped at Phase 1 to ask how files should be grouped, before running the
co-change script, in every scaffolded run of the attended and marker-card
cases; the improve lens ran the script first in some runs. Phase 1 now
carries on without a style and the report asks once, after the cards.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
…-improve-shared-lens-steps

# Conflicts:
#	docs/catalog.md
#	docs/skill-cheat-sheet.md
#	plugins/architecture/.claude-plugin/plugin.json
#	plugins/architecture/skills/improve/SKILL.md
…rom the shared steps

Its own sentence treated every resolver exit but 0 as no rule recorded,
which disagrees with the one exit-code table the lenses now share.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@kyle-sexton kyle-sexton removed the do-not-merge Hard merge gate: do not merge while applied. label Nov 16, 2026
@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 16, 2026
Merged via the queue into main with commit bb0ee35 Nov 16, 2026
86 checks passed
@kyle-sexton
kyle-sexton deleted the refactor/architecture-improve-shared-lens-steps branch November 16, 2026 04:35
@github-actions github-actions Bot added the merge-path: owner-agent Post-merge accounting record (README.md, Merge paths) label Nov 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-path: owner-agent Post-merge accounting record (README.md, Merge paths)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant