Share agent skills via a floating agents submodule - #677
Conversation
Move the 16 flat shared guideline files (coding-guidelines, safety-rules, testing, _TOC, project.template, the widow-runt diagram, etc.) into `.agents/guidelines/` and rewrite every reference to the new paths across skills, AGENTS.md, README.md, .junie, scripts, .claude/commands, and the migrate script. First step toward distributing shared agent content via a Git submodule (see .agents/tasks/share-skills-via-submodule.md): grouping the guidelines lets a single symlink later expose them from the shared repo instead of 16. Behaviour is unchanged here — migrate still copies the files, now from the subdirectory. Cross-directory links in _TOC.md and version-policy.md are repo-rooted so they resolve whether guidelines/ is a real directory or a submodule symlink. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add `adopt-shared-agents`, the one-time per-repo script that swaps copied agent content for the floating `.agents/shared` submodule plus symlinks, and the task plan tracking the migration. Not yet wired into `migrate` — applied once SpineEventEngine/agents exists. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Switch config's own agent tooling to the floating .agents/shared submodule (the SpineEventEngine/agents repo) via symlinks, replacing the copied skills, scripts, guidelines, and Claude commands/agents. Add docs/project.md (config's real description) linked from .agents/project.md. Rewrite migrate: instead of copying .agents and .claude, it runs the idempotent adopt-shared-agents against the consumer (bootstrapping a fresh repo, converting an old copied one, or floating an existing one to agents@master) and copies only the Claude settings. Drop all per-repo pruning; stop rm -rf .agents so repo-local memory/ and tasks/ survive. .junie is now a selective copy. adopt-shared-agents: default to HTTPS; allow bootstrapping a repo with no pre-existing .agents. README and AGENTS document the submodule model and how to initialize it. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
CONTRIBUTING.md is identical and static across the org, so migrate now uses the initialize (copy-if-absent) pattern for it instead of overwriting on every pull — which also avoids clobbering a deliberately customized copy. The initialize helper is hoisted to the top of the Common section so it is available at that point. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a69d1bdb81
ℹ️ 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".
Address review-docs should-fixes on the agents-submodule docs: - Convert external SpineEventEngine/agents links to footnote style ([agents-repo]) per the writer convention, in README.md, AGENTS.md, and docs/project.md. - Drop .claude/skills from the README symlink enumeration: it is a 2-hop alias of .agents/skills, not a direct submodule path, and the sibling docs already omit it. - Reflow the split 'git submodule update --remote' code span in docs/project.md onto one line. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Moves shared AI-agent assets (skills, scripts, guidelines, Claude commands/agents) out of per-repo copies and into a floating Git submodule (.agents/shared) that tracks SpineEventEngine/agents@master, exposed via symlinks to eliminate cross-repo churn when updating skills.
Changes:
- Introduce
adopt-shared-agentsand wiremigrateto initialize/float the shared submodule + symlinks. - Update entrypoint docs/references (
README.md,AGENTS.md, Copilot/Junie docs) to point at.agents/guidelines/**. - Remove in-repo copies of shared skills/scripts/guidelines (now provided by
.agents/shared).
Reviewed changes
Copilot reviewed 106 out of 107 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| README.md | Documents shared agent content coming from floating .agents/shared submodule and exposed via symlinks. |
| migrate | Stops copying shared agent content; delegates setup to adopt-shared-agents; preserves repo-local memory/tasks. |
| docs/project.md | Adds repo-local project description for config and describes the shared-agents submodule model. |
| AGENTS.md | Updates references to .agents/guidelines/** and documents submodule initialization. |
| adopt-shared-agents | New idempotent migration script to add submodule + create symlinks + seed/move project.md. |
| .junie/guidelines.md | Updates TOC link to .agents/guidelines/_TOC.md. |
| .gitmodules | Adds floating submodule definition for .agents/shared tracking master and ignoring gitlink changes. |
| .github/copilot-instructions.md | Updates guidelines index reference to .agents/guidelines/_TOC.md. |
| .claude/commands/write-docs.md | Removed (now provided via shared submodule symlink). |
| .claude/commands/update-copyright.md | Removed (now provided via shared submodule symlink). |
| .claude/commands/run-build.md | Removed (now provided via shared submodule symlink). |
| .claude/commands/review-docs.md | Removed (now provided via shared submodule symlink). |
| .claude/commands/raise-coverage.md | Removed (now provided via shared submodule symlink). |
| .claude/commands/pre-pr.md | Removed (now provided via shared submodule symlink). |
| .claude/commands/move-files.md | Removed (now provided via shared submodule symlink). |
| .claude/commands/java-to-kotlin.md | Removed (now provided via shared submodule symlink). |
| .claude/commands/dependency-update.md | Removed (now provided via shared submodule symlink). |
| .claude/commands/bump-version.md | Removed (now provided via shared submodule symlink). |
| .claude/commands/bump-gradle.md | Removed (now provided via shared submodule symlink). |
| .claude/agents/review-docs.md | Removed (now provided via shared submodule symlink). |
| .claude/agents/kotlin-review.md | Removed (now provided via shared submodule symlink). |
| .claude/agents/dependency-audit.md | Removed (now provided via shared submodule symlink). |
| .agents/version-policy.md | Removed (now provided via shared submodule symlink). |
| .agents/testing.md | Removed (now provided via shared submodule symlink). |
| .agents/tasks/enforce-max-line-length.md | Updates task-plan references to the new .agents/guidelines/** layout. |
| .agents/skills/writer/SKILL.md | Removed (now provided via shared submodule symlink). |
| .agents/skills/writer/assets/templates/kotlin-java-example.md | Removed (now provided via shared submodule symlink). |
| .agents/skills/writer/assets/templates/kdoc-example.md | Removed (now provided via shared submodule symlink). |
| .agents/skills/writer/assets/templates/doc-page.md | Removed (now provided via shared submodule symlink). |
| .agents/skills/writer/agents/openai.yaml | Removed (now provided via shared submodule symlink). |
| .agents/skills/version-bumped/SKILL.md | Removed (now provided via shared submodule symlink). |
| .agents/skills/version-bumped/scripts/version-bumped.sh | Removed (now provided via shared submodule symlink). |
| .agents/skills/version-bumped/agents/openai.yaml | Removed (now provided via shared submodule symlink). |
| .agents/skills/update-copyright/tests/test_update_copyright.py | Removed (now provided via shared submodule symlink). |
| .agents/skills/update-copyright/SKILL.md | Removed (now provided via shared submodule symlink). |
| .agents/skills/update-copyright/scripts/update_copyright.py | Removed (now provided via shared submodule symlink). |
| .agents/skills/update-copyright/agents/openai.yaml | Removed (now provided via shared submodule symlink). |
| .agents/skills/review-docs/SKILL.md | Removed (now provided via shared submodule symlink). |
| .agents/skills/review-docs/agents/openai.yaml | Removed (now provided via shared submodule symlink). |
| .agents/skills/raise-coverage/SKILL.md | Removed (now provided via shared submodule symlink). |
| .agents/skills/raise-coverage/references/coverage-signals.md | Removed (now provided via shared submodule symlink). |
| .agents/skills/raise-coverage/agents/openai.yaml | Removed (now provided via shared submodule symlink). |
| .agents/skills/pre-pr/SKILL.md | Removed (now provided via shared submodule symlink). |
| .agents/skills/pre-pr/agents/openai.yaml | Removed (now provided via shared submodule symlink). |
| .agents/skills/move-files/SKILL.md | Removed (now provided via shared submodule symlink). |
| .agents/skills/move-files/agents/openai.yaml | Removed (now provided via shared submodule symlink). |
| .agents/skills/kotlin-review/SKILL.md | Removed (now provided via shared submodule symlink). |
| .agents/skills/kotlin-review/agents/openai.yaml | Removed (now provided via shared submodule symlink). |
| .agents/skills/kotlin-engineer/SKILL.md | Removed (now provided via shared submodule symlink). |
| .agents/skills/kotlin-engineer/references/idioms.md | Removed (now provided via shared submodule symlink). |
| .agents/skills/kotlin-engineer/references/coroutines.md | Removed (now provided via shared submodule symlink). |
| .agents/skills/kotlin-engineer/references/build-setup.md | Removed (now provided via shared submodule symlink). |
| .agents/skills/kotlin-engineer/agents/openai.yaml | Removed (now provided via shared submodule symlink). |
| .agents/skills/java-to-kotlin/SKILL.md | Removed (now provided via shared submodule symlink). |
| .agents/skills/java-to-kotlin/agents/openai.yaml | Removed (now provided via shared submodule symlink). |
| .agents/skills/gradle-review/spine-task-conventions.md | Removed (now provided via shared submodule symlink). |
| .agents/skills/gradle-review/SKILL.md | Removed (now provided via shared submodule symlink). |
| .agents/skills/gradle-review/practices/tasks.md | Removed (now provided via shared submodule symlink). |
| .agents/skills/gradle-review/practices/README.md | Removed (now provided via shared submodule symlink). |
| .agents/skills/gradle-review/agents/openai.yaml | Removed (now provided via shared submodule symlink). |
| .agents/skills/dependency-update/SKILL.md | Removed (now provided via shared submodule symlink). |
| .agents/skills/dependency-update/agents/openai.yaml | Removed (now provided via shared submodule symlink). |
| .agents/skills/dependency-audit/SKILL.md | Removed (now provided via shared submodule symlink). |
| .agents/skills/dependency-audit/agents/openai.yaml | Removed (now provided via shared submodule symlink). |
| .agents/skills/check-links/SKILL.md | Removed (now provided via shared submodule symlink). |
| .agents/skills/check-links/agents/openai.yaml | Removed (now provided via shared submodule symlink). |
| .agents/skills/bump-version/SKILL.md | Removed (now provided via shared submodule symlink). |
| .agents/skills/bump-version/agents/openai.yaml | Removed (now provided via shared submodule symlink). |
| .agents/skills/bump-gradle/SKILL.md | Removed (now provided via shared submodule symlink). |
| .agents/skills/bump-gradle/agents/openai.yaml | Removed (now provided via shared submodule symlink). |
| .agents/skills/api-discovery/SKILL.md | Removed (now provided via shared submodule symlink). |
| .agents/skills/api-discovery/agents/openai.yaml | Removed (now provided via shared submodule symlink). |
| .agents/scripts/update-copyright.sh | Removed (now provided via shared submodule symlink). |
| .agents/scripts/sanitize-source-code.sh | Removed (now provided via shared submodule symlink). |
| .agents/scripts/publish-version-gate.sh | Removed (now provided via shared submodule symlink). |
| .agents/scripts/protect-version-file.sh | Removed (now provided via shared submodule symlink). |
| .agents/scripts/pre-pr-gate.sh | Removed (now provided via shared submodule symlink). |
| .agents/scripts/api-discovery/update-sibling | Removed (now provided via shared submodule symlink). |
| .agents/scripts/api-discovery/README.md | Removed (now provided via shared submodule symlink). |
| .agents/scripts/api-discovery/lib/common.sh | Removed (now provided via shared submodule symlink). |
| .agents/scripts/api-discovery/extract-sources | Removed (now provided via shared submodule symlink). |
| .agents/scripts/api-discovery/discover | Removed (now provided via shared submodule symlink). |
| .agents/scripts/api-discovery/clean-cache | Removed (now provided via shared submodule symlink). |
| .agents/scripts/api-discovery/.gitignore | Removed (now provided via shared submodule symlink). |
| .agents/safety-rules.md | Removed (now provided via shared submodule symlink). |
| .agents/running-builds.md | Removed (now provided via shared submodule symlink). |
| .agents/refactoring-guidelines.md | Removed (now provided via shared submodule symlink). |
| .agents/quick-reference-card.md | Removed (now provided via shared submodule symlink). |
| .agents/project.template.md | Removed (now provided via shared submodule symlink). |
| .agents/project-structure-expectations.md | Removed (now provided via shared submodule symlink). |
| .agents/jvm-project.md | Removed (now provided via shared submodule symlink). |
| .agents/documentation-tasks.md | Removed (now provided via shared submodule symlink). |
| .agents/documentation-guidelines.md | Removed (now provided via shared submodule symlink). |
| .agents/common-tasks.md | Removed (now provided via shared submodule symlink). |
| .agents/coding-guidelines.md | Removed (now provided via shared submodule symlink). |
| .agents/advanced-safety-rules.md | Removed (now provided via shared submodule symlink). |
| .agents/_TOC.md | Removed (now provided via shared submodule symlink as .agents/guidelines/_TOC.md). |
- adopt-shared-agents: during adoption, also remove the pre-regroup flat .agents/*.md guideline files a consumer carried under the old copied layout, so migrating repos don't retain stale shared config (Codex). - adopt-shared-agents: recreate .claude/skills and .junie/skills unconditionally so a stale real directory from an old copy-based setup is replaced by the symlink (Copilot). - docs/project.md: make the jvm-project.md link relative (../) so it resolves from the docs/ directory instead of docs/.agents/... (Copilot). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- adopt-shared-agents: link() no longer rm -rf's untracked content — a non-symlink in the way is removed only if tracked (recoverable via Git), otherwise the script stops and asks the user to move it aside, preventing data loss (Copilot). - adopt-shared-agents: set submodule branch=master unconditionally so an already-registered .agents/shared that lacks/misconfigures it is corrected before --remote runs (Copilot). - migrate: treat an adopt-shared-agents failure as fatal (exit) instead of warning-and-continuing, so a half-migrated repo is never reported as success (Copilot). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- adopt-shared-agents: persist submodule.url and run 'git submodule sync' so an already-registered .agents/shared pointing at a different URL is corrected to the requested AGENTS_URL before --remote runs (Copilot). - migrate: remove any stale ../.claude/settings-hugo.json left by a previous migrate; it is a config-internal template, never distributed as-is (Copilot). - AGENTS.md: scope the fresh-clone init command to '.agents/shared' instead of '--remote --recursive' so it does not float other submodules such as config/ (Copilot). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
@codex, review. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5799da5e05
ℹ️ 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".
- adopt-shared-agents: preflight now asserts the CWD is the repository root (git toplevel == pwd), so running from a subdirectory can't create/remove paths in the wrong place (Copilot). - adopt-shared-agents: stop staging the submodule gitlink — only .gitmodules and the symlinks are staged. The initial pin is recorded by 'git submodule add'; re-staging the floated commit would commit pin bumps on every run, the churn this design avoids (Copilot). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- adopt-shared-agents: never overwrite an existing repo-local docs/project.md. Seed it from the shared template only when absent; otherwise just (re)create the .agents/project.md symlink. A legacy real .agents/project.md is moved to docs/ only if no docs/project.md already exists, else it's removed in favour of the existing one (Codex). The other Codex thread (staging floated submodule pins) was already addressed in round 4 (7333202), which removed 'git add $SHARED_PATH'. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- adopt-shared-agents: link() now refuses to remove a tracked directory that contains untracked files — git rm -r would drop only tracked files and the following rm -rf would destroy the untracked ones. Abort with a clear message (gitignored cruft still allowed) so 'untracked content is never destroyed' actually holds (Copilot). - AGENTS.md: project.md guidance now points at docs/project.md (which .agents/project.md symlinks to), so users edit the real file instead of replacing the symlink or fighting the migration script (Copilot). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- adopt-shared-agents: apply the same untracked-files guard to remove_tracked that link() got in round 10, so the script fails fast (before any git rm) if a tracked directory holds untracked, non-ignored files — preventing a partial migration where tracked content is removed and a later step aborts (Copilot). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Re: the 7 comments about These are repo-rooted paths for agents working in a checked-out tree (Claude/Codex/Junie), where The suggested fix — pointing at So the local |
- adopt-shared-agents: fail clearly when `.agents/shared` exists on disk or in the index but is not a registered submodule, instead of letting `git submodule add` abort with an opaque error. - adopt-shared-agents: handle an untracked legacy `.agents/project.md` — relocate it with plain mv/rm + `git add` rather than `git mv`/`git rm`, which would abort the migration on an untracked path. - migrate: correct comment wording (`adopt-shared-agents` runs earlier in the script, not "below"). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
adopt-shared-agents: collapse the "path exists but is not a registered submodule" error onto a single, properly quoted guidance line so both the `rm -rf` and `git rm --cached` commands read and copy cleanly. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- migrate: pass the canonical `agents` remote URL explicitly to `adopt-shared-agents` so an ambient `AGENTS_URL` in a shell/CI environment cannot silently redirect a consumer to an unintended fork during an automatic `./config/pull`. An explicit argument wins over the env var. - copilot-instructions.md: drop the stale "Hugo repos do not include this file" note about `_TOC.md`. Shared guidelines (including the TOC) are now mounted via the `.agents/shared` submodule for every repo, Hugo included. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
What & why
Shared agent skills, scripts, and guidelines were copied into every consumer repo by
migrate, so each skill edit churned ~40 repos and competed with production/test diffs in pull requests. This moves them into a dedicated repository —SpineEventEngine/agents— mounted as a floating Git submodule at.agents/shared(trackingmaster) and exposed through symlinks. Updates now propagate on./config/pullwith no file churn in consumer pull requests.Commits
.agents/guidelines/— move the 16 flat guideline files into one directory (so a single symlink can later expose them) and rewrite all references. Pure reorganization;migratestill copies at this point.adopt-shared-agents(idempotent: bootstraps a fresh repo, converts one that still has the old copies, or floats an existing one toagents@master) and the task plan.configconsumes theagentssubmodule — config dogfoods.agents/shared;migrateis rewritten to delegate toadopt-shared-agentsand copy only the Claude settings; drops all per-repo pruning and therm -rf .agents(repo-localmemory/andtasks/now survive); README/AGENTS document the model; addsdocs/project.md.CONTRIBUTING.mdcopy-if-absent —migrateuses theinitializepattern for the static, org-wideCONTRIBUTING.md.Rollout (no per-repo manual step)
Each consumer's next
./config/pullrunsadopt-shared-agents, which removes the old copies, adds the.agents/sharedsubmodule, creates the symlinks, and floats toagents@master.Notes
SpineEventEngine/agentsis created, seeded with history, initialized (README, docs, theauthor-skillmeta-skill, dogfood.agents/.claude), andmasteris ruleset-protected..gitmodulesusesbranch = master,ignore = all— no pin bumps ever land in consumers.--remote. Theagentsrepo is public, so cross-repo submodule checkout needs no extra token.build-on-windows.yml).🤖 Generated with Claude Code