Skip to content

chore(plugin): decide the root .claude-plugin/plugin.json and memory/ — second manifest kept in sync by hand since ./plugin ships #1301

Closed

Description

@admarble

Tier: judgment Found: 2026-10-04, #1271 spec Open Question 2 and QA follow-up ledger (PR #1299)

Problem. Since #1265, the marketplace serves ./plugin (.claude-plugin/marketplace.json "source": "./plugin"), so users install plugin/.claude-plugin/plugin.json. The repo-root .claude-plugin/plugin.json is still a full second manifest. Today its JSON is identical to the plugin copy (both at 2.19.0). Several places still treat it as live:

  • /release: bumps its version (release/SKILL.md:285-295), validates it (:126) and stages it (:537).
  • ci.yml:213-322: existence, required fields, and the version-sync check against package.json.
  • plugin-install-test.yml:43-49, :180: reads it for the structure checks.
  • plugin-install-test.yml:11,22: the memory/** path filter. Root memory/ (constitution.md) still exists alongside plugin/memory/.

Two manifests kept in version sync by hand are the same drift class #1271 retired for skills/ and hooks/. Before deleting the root manifest, decide whether anything outside the repo (the directory portal's repo-root listing, older marketplace caches, claude plugin marketplace add ./) still reads it.

AC

  • AC-1: Owner decision 2026-10-05: the root .claude-plugin/plugin.json is retired, unless /release --dry-run, CI, or claude plugin marketplace add ./ + claude plugin install sequant@sequant from a clean config dir shows a consumer that still reads it; then it is kept, that consumer is named, and a test checks every field against plugin/.claude-plugin/plugin.json. Evidence: the issue comment naming each consumer checked and its result
  • AC-2: If retired, /release, ci.yml and plugin-install-test.yml read plugin/.claude-plugin/plugin.json only, and no doc or script outside plugin/ refers to the root manifest as live. Evidence: git grep -n '\.claude-plugin/plugin\.json' -- . ':!plugin' ':!CHANGELOG.md' matches only history, reviewed in QA
  • AC-3: Root memory/ stays as this repo's own constitution (decided in fix(plugin): ship a slim ./plugin folder — the repo-root plugin pulls ~700 MB of dev dependencies into every install and fails directory review limits #1265), and the plugin-install-test.yml path filters replace root memory/** with templates/memory/**, the producer of the shipped plugin/memory/, or keep it with a one-line reason. Evidence: the workflow diff, or the reason in the AC-1 decision comment

Non-Goals

  • .claude-plugin/marketplace.json, which must stay at the repo root.

Graph metadata

Activity

  1. added
    refactor
    on Oct 4, 2026
  2. admarble commented on Oct 5, 2026

    @admarble
    ContributorAuthor

    Upstream context (2026-10-05)

    This is a planned leftover, not a defect. source: "./" (#185) made the dev repo the plugin. #1265 moved to ./plugin and kept the root copies so the change could be reverted with a one-line flip. #1271 retired skills/ and hooks/ and left this item. Two findings narrow it.

    1. Root memory/ is already decided. #1265's Decision section says: "The root memory/constitution.md stays as this repo's own constitution." plugin/memory/ is generated from templates/memory/. Only the path filter is left:

    • plugin-install-test.yml:11,22 triggers on root memory/**. That file isn't shipped, so it is the wrong trigger.
    • templates/memory/**, the producer of the shipped copy, isn't in the filter.

    AC-3 now asks only for that change.

    2. The repo's own constitution decides the manifest. Row #1250 says: "One producer per artifact; a second producer needs a parity test on every field and a recorded reason." The two manifests are byte-identical today (diff is empty). src/lib/plugin-version-sync.ts:101-125 checks only version. The repo is therefore out of compliance now, so the choice is:

    • add a full-field parity test with a named reason, or
    • retire the root manifest.

    What's checked: CI's plugin load no longer reads the root. plugin-install-test.yml:267 runs claude --plugin-dir ./plugin. The portal submission also used path plugin (#1287). External consumers (older marketplace caches, claude plugin marketplace add ./) are not checked. AC-1's install from a clean config dir is still the evidence for that.

  3. admarble commented on Oct 5, 2026

    @admarble
    ContributorAuthor

    Runner context (2026-10-05, before sequant run)

    • AC-1 is now a rule, not an open question. Retire the root manifest unless a check finds a consumer. Run each check and record the result in the issue comment:
      • Release dry-run: run /release --dry-run (.claude/skills/release/SKILL.md:41, "Dry Run Mode" at :716). It mutates nothing. Never run /release without --dry-run.
      • Clean-config install: CLAUDE_CONFIG_DIR=$(mktemp -d) claude plugin marketplace add ./, then claude plugin install sequant@sequant in the same env. Run it twice: first with the root manifest present, then with it moved aside. If the CLI needs auth that isn't available, say so; don't guess the result.
      • CI readers: ci.yml:213-322, plugin-install-test.yml:43-49,180, src/lib/plugin-version-sync.ts.
    • AC-3. Root memory/ stays (fix(plugin): ship a slim ./plugin folder — the repo-root plugin pulls ~700 MB of dev dependencies into every install and fails directory review limits #1265). Only the path filter changes, at plugin-install-test.yml:11,22.
    • AC-2 grep: git grep -n '\.claude-plugin/plugin\.json' -- . ':!plugin' ':!CHANGELOG.md'.

    Phase rules (all phases):

  4. admarble commented on Oct 5, 2026

    @admarble
    ContributorAuthor

    Complexity: Complex (3 ACs, 6 directories): refactor label; the work itself is a mechanical retarget

    AC Quality Check

    lintAcceptanceCriteria: all 3 ACs pass. Each AC has an Evidence: clause. AC-2's grep is not vacuous: it matches about 60 lines today across live readers.

    ⚠️ AC-2 still relies on judgment ("matches only history, reviewed in QA"). Some lines will still match after the change and are correct to keep (see the Derived AC below):

    • .claude/hooks/pre-tool.sh:744 (and its templates/ mirror). It resolves ${_STALE_SCRIPT_DIR%/hooks}/.claude-plugin/plugin.json inside the installed plugin cache, not the repo root. That is the shipped manifest, so leave it as is.
    • __tests__/plugin-staleness-warning.integration.test.ts:6,72: the same cache path.
    • __tests__/fixtures/hook-corpus.jsonl, ADR 0006/0008 and docs/internal/graph-2026-09/*: history.

    Scope Assessment

    Non-Goals: .claude-plugin/marketplace.json stays at the repo root.

    Metric Value Status
    Feature count 1 (retire one manifest) ✅
    AC items 3 ✅
    Directory spread 6 (.github/, .claude/skills + 2 mirrors, scripts/, src/lib/, docs/) ⚠️

    Verdict: ✅ SCOPE_OK. The spread comes from mirrored copies, not from separate features.


    Pre-spec evidence (AC-1 consumer checks, partly run)

    Consumer Check Result
    claude plugin marketplace add ./ + install sequant@sequant, clean CLAUDE_CONFIG_DIR, root manifest present git archive HEAD into a temp dir, Claude Code 2.1.289 ✔ installed 2.19.0, Read from: …/plugin
    Same, root manifest deleted same ✔ installed 2.19.0, Read from: …/plugin. Does not read the root
    claude plugin validate .claude-plugin/marketplace.json / plugin/.claude-plugin/plugin.json / ., root deleted same temp dir ✔ all three pass
    CI plugin load plugin-install-test.yml:267 --plugin-dir ./plugin does not read the root
    scripts/prepare-marketplace.ts --validate-only, root deleted same temp dir ❌ .claude-plugin/plugin.json not found. An internal reader that must be retargeted, not an external consumer
    /release --dry-run not run yet. Exec runs it after the retarget and records the result n/a

    No external consumer of the root manifest was found. AC-1 resolves to "retire" unless the exec-time /release --dry-run shows otherwise.

    Live bug found along the way: /release Step 4.5 (release/SKILL.md:285-295) bumps only the root manifest, and the git add at :537 stages only the root. The shipped plugin/.claude-plugin/plugin.json is bumped only by scripts/release.sh:88-94. So a release driven by the skill leaves the manifest users actually install at the old version. Retargeting fixes this.


    Acceptance Criteria

    AC-1: Retire the root manifest unless a consumer reads it

    Verification: Manual Test (the evidence is the issue comment)
    Scenario: Given the root file is deleted → When the exec branch runs /release --dry-run, CI runs, and the clean-config install runs twice (root present / root absent) → Then each consumer and its result are recorded in an issue comment, and none of them read the root.
    Assumptions: The probe above holds on the exec branch. Re-run it there and paste the output. Never run /release without --dry-run.

    AC-2: Every reader targets plugin/.claude-plugin/plugin.json

    Verification: Integration Test (grep reviewed in QA, plus the Derived AC-4 gate)
    Scenario: Given the retarget → When git grep -n '\.claude-plugin/plugin\.json' -- . ':!plugin' ':!CHANGELOG.md' runs → Then every match is either history or the cache-relative hook/test path listed above.

    AC-3: The path filter triggers on the shipped memory's producer

    Verification: Manual Test (workflow diff)
    Scenario: Given plugin-install-test.yml:11,22 → When memory/** is replaced with templates/memory/** → Then a change to templates/memory/constitution.md triggers the workflow and a change to root memory/ does not. Root memory/ stays (#1265).


    Implementation Plan

    Phase 1: Retarget readers (one commit)

    1. /release skill: edit .claude/skills/release/SKILL.md:
      • :126: validate plugin/.claude-plugin/plugin.json.
      • Step 4.5 :285-295: Read/Edit plugin/.claude-plugin/plugin.json.
      • :537: git add plugin/.claude-plugin/plugin.json in place of the root path.
      • :683: summary line.
      • Then npm run sync:skills so templates/skills/ and plugin/skills/ match. Read all three copies afterwards.
    2. src/lib/__tests__/release-plugin-validate-skill.test.ts:36: PLUGIN_MANIFEST = "plugin/.claude-plugin/plugin.json".
    3. scripts/release.sh:82-94: delete the root sed block. Keep the plugin/ block and drop its "byte-identical copy" comment.
    4. scripts/prepare-marketplace.ts:98-108,169: read and copy from plugin/.claude-plugin/plugin.json. The dist copy at :266 keeps its own path, because that is the output layout.
    5. src/lib/plugin-version-sync.ts: make plugin/.claude-plugin/plugin.json the primary pluginJsonPath and delete the pluginFolder* second check (:101-125) and pluginFolderVersion from VersionSyncResult. Update plugin-version-sync.test.ts mocks to match.

    Phase 2: CI

    1. ci.yml:213-327: the existence, JSON, required-field, version-sync and negative-test steps all use plugin/.claude-plugin/plugin.json. That includes the .bak backup/restore and the printed fix-up command.
    2. plugin-install-test.yml:
      • :43-49, :180: retarget to plugin/.claude-plugin/plugin.json.
      • :11,22: memory/** → templates/memory/** (AC-3).
      • The .claude-plugin/** filter stays, because it still covers marketplace.json.

    Phase 3: Delete, docs, evidence

    1. git rm .claude-plugin/plugin.json.
    2. Docs: retarget docs/internal/plugin-updates.md:12 and docs/internal/release-checklist.md:23,33-35. Add a dated Update (#1301) line to docs/adr/0008-retire-root-plugin-mirrors.md:50 ("Revisit if nothing reads it" → retired; the consumer checks are in chore(plugin): decide the root .claude-plugin/plugin.json and memory/ — second manifest kept in sync by hand since ./plugin ships #1301).
    3. Run the targeted vitest files, the AC-2 grep and /release --dry-run, then post the AC-1 consumer comment.

    Design Review

    1. Where does this belong? In the release and CI tooling that reads the manifest. Runtime src/ is not involved, apart from plugin-version-sync.ts, which has no production callers today (only its own test).
    2. Simplest correct approach: retarget every reader to the single shipped manifest and delete the root one. The rejected alternative is to keep the root file plus a full-field parity test: two producers with nothing reading one of them, which constitution row feat(spec): Design Review stops on recurrence and lists producers; spec can halt before exec when the AC's lever is wrong #1250 forbids without a reason, and no reason exists.
    3. Pattern and re-patch count: this is the "one producer per artifact" class.
    4. What a senior reviewer would challenge:
      • "Old marketplace caches?" A cache stores its own copy of plugin/ under plugins/cache/…/<version>/, which the hook reads. It never reads the source repo's root manifest. The probe shows that install reads …/plugin.
      • "Why not delete plugin-version-sync.ts if it's dead?" Out of scope. Retarget it and see Open Question 2.
    5. Producers and consumers (whole-repo grep):
      • Producers today: the root file and plugin/ file (both edited by hand), release.sh (stamps both), /release Step 4.5 (stamps the root only, which is the bug).
      • Consumers: ci.yml, plugin-install-test.yml, prepare-marketplace.ts, plugin-version-sync.ts, the /release validate step plus its test, and the installed-cache hook (pre-tool.sh:744, which reads the shipped copy).
      • After the change there is one producer. No parity test is needed.

    ADR: the issue already decides the design, so no new ADR. Amend ADR 0008 instead (step 9).


    Feature Quality Planning

    All standard checks pass. Notable items:

    • Mirrors: release SKILL.md exists in 3 dirs (.claude/, templates/, plugin/). Edit the .claude copy and sync. lint:skill-sync gates this.
    • CI negative test: it mutates and restores the plugin/ copy now. Make sure the restore also runs on failure paths, as it does today.
    • sed -i '' in release.sh is macOS-only. That is unchanged and out of scope.

    Derived ACs

    Source Derived AC Priority
    AC-2 judgment gap AC-4: A vitest gate asserts that root .claude-plugin/plugin.json does not exist and that none of ci.yml, plugin-install-test.yml, scripts/release.sh, scripts/prepare-marketplace.ts, src/lib/plugin-version-sync.ts or the 3 release SKILL.md copies contains .claude-plugin/plugin.json without a plugin/ prefix. Mutation-verified: restore one root reference in ci.yml; the test fails. Record a SEQUANT_MUTATION marker in exec's ## Summary with the test file path first. Medium
    Release correctness AC-5: /release Step 4.5 and the :537 git add bump and stage plugin/.claude-plugin/plugin.json (the bug above). Covered by step 1. High

    Open Questions

    1. Add Derived AC-4 to the issue? Recommendation: yes. It turns AC-2 from a judgment call into a gate. Impact if skipped: a future edit could reintroduce a root reader without CI noticing.
    2. plugin-version-sync.ts has no production callers. Recommendation: retarget it here and file a follow-up to delete it or wire it in. Impact if wrong: a little dead code stays.
    3. ADR 0008 amendment instead of a new ADR? Recommendation: amend it. The decision is the "Revisit" item ADR 0008 already names.

    Recommended Workflow

    Phases: exec → qa
    Quality Loop: disabled
    Reasoning:

    • This is a mechanical retarget plus a delete, and the evidence is grep and probe based.
    • No testgen: the only new test is the single gate (AC-4), which exec writes directly.
    • No UI and no security surface.

    Label Review

    Current: refactor
    Recommended: refactor, planned
    Reason: The scope is confirmed and no new labels are needed.

    Conflict check: stale worktrees for #1271 and #1289 touch release/SKILL.md, ci.yml and plugin-install-test.yml, but both PRs (#1299, #1303) are merged. No live overlap.

  5. added
    planned
    on Oct 5, 2026
  6. admarble commented on Oct 5, 2026

    @admarble
    ContributorAuthor

    AC-1 consumer checks (exec branch feature/1301-…, 2026-10-05)

    Decision: root .claude-plugin/plugin.json retired. No consumer reads it. Each check was run on the exec branch:

    Consumer Check Result
    Clean-config install, root present git archive origin/main into a temp dir; CLAUDE_CONFIG_DIR=$(mktemp -d) claude plugin marketplace add ./ then claude plugin install sequant@sequant; Claude Code 2.1.289 ✔ marketplace added; ✔ installed; cache plugins/cache/sequant/sequant/2.19.0; claude plugin validate plugin/.claude-plugin/plugin.json ✔
    Clean-config install, root absent same, git archive HEAD (root file deleted) ✔ marketplace added; ✔ installed; cache 2.19.0; validate ✔. Same result as with the root file present
    /release --dry-run pre-flight ran the pre-flight fences on the exec branch claude plugin validate plugin/.claude-plugin/plugin.json ✔; claude plugin validate .claude-plugin/marketplace.json ✔; main CI push run success; npm pack --dry-run ships plugin/.claude-plugin/plugin.json and no root manifest; Step 4.5's target and every Step 6 git add path exist. Expected non-results: branch ≠ main (exec branch), npm whoami not logged in, 2.19.0 already published (no bump in a dry run). Nothing was published, tagged or pushed to main
    scripts/prepare-marketplace.ts (internal) build, then --validate-only, with the root file deleted ✔ "Marketplace package is valid!". It had failed before the retarget (.claude-plugin/plugin.json not found)
    CI (ci.yml plugin job, plugin-install-test.yml) static: retargeted to plugin/.claude-plugin/plugin.json; --plugin-dir ./plugin was already root-free covered by this PR's CI run

    The /release Step 4.5 bug from the spec is fixed. The skill now bumps and stages plugin/.claude-plugin/plugin.json, the manifest users install.

  7. admarble commented on Oct 5, 2026

    @admarble
    ContributorAuthor

    QA Verdict: AC_MET_BUT_NOT_A_PLUS

    AC coverage: 5/5 met

    Gaps:

  8. admarble commented on Oct 5, 2026

    @admarble
    ContributorAuthor

    Runner verification (2026-10-05): PR #1321

    QA returned AC_MET_BUT_NOT_A_PLUS (5/5).

    AC Checked by the runner Result
    AC-1 Read exec's consumer comment ✅ The clean-config install works with the root manifest present and absent. The release dry-run pre-flight and the prepare-marketplace check passed. No consumer was found, so the root manifest is retired per the owner rule
    AC-2 Ran the AC grep in the worktree ✅ Every hit is plugin/-prefixed, the plugin-cache-relative path in pre-tool.sh, history (ADRs, graph docs, hook corpus), or the new test
    AC-3 Read plugin-install-test.yml ✅ memory/** → templates/memory/** in both push and pull_request
    AC-4 (derived) Ran the gate, plugin-version-sync and release-validate tests ✅ 27/27. I re-ran one mutation myself: restoring the root manifest failed "the root manifest is gone and version sync reads plugin/"; restored

    Fixed beyond exec's work: the PR body's SEQUANT_MUTATION marker was cut off mid-JSON (#1311 class). The unclosed comment hid Fixes #1301, so closingIssuesReferences was empty. I rebuilt both markers from the prose records. Both parse with parseMutationMarkers, and the PR now closes this issue.

    Follow-up ledger:

  9. added a commit that references this issue on Oct 5, 2026
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

    plannedrefactor

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions