From agents-system-setup
Bootstrap, update, improve, or replicate a multi-agent system across GitHub Copilot CLI, Claude Code, OpenCode, and OpenAI Codex CLI. Generates AGENTS.md (Directory Architecture, Agent Roster, Capability Matrix), an orchestrator + N subagents, project-scoped skills, and opt-in plugin/MCP recommendations sourced from vendor-official catalogs. Detects existing systems on entry; bidirectional replication via a single Canonical IR (no pairwise rewrites). Cross-OS (Linux/macOS/Windows). Mandatory MCP approval gate. Recommends GitHub Spec-Kit for software-dev domains. USE FOR: "set up agents", "scaffold AGENTS.md", "init agents system", "improve my agents", "audit agent setup", "port agents from copilot to claude code", "replicate agents", "configure copilot/claude/opencode/codex for this repo", "discover plugins/MCP servers". DO NOT USE FOR: editing a single existing agent file, unrelated coding work, MCP server implementation.
npx claudepluginhub ytthuan/agents-system-setup --plugin agents-system-setupThis skill uses the workspace's default tool permissions.
Scaffold or update a complete agent system for the current project across **Copilot CLI**, **Claude Code**, and/or **OpenCode**. Produces a canonical `AGENTS.md` (with **Directory Architecture**, **Agent Roster**, **Capability Matrix**), an **orchestrator + N subagents**, project-scoped **skills**, and **approved** plugins/MCP servers — derived from a structured interview.
assets/AGENTS.md.templateassets/directory-architecture.snippet.mdassets/gitattributes.templateassets/gitignore.templateassets/orchestrator.agent.md.templateassets/skill.template.mdassets/spec-kit-block.snippet.mdassets/subagent.agent.md.templatereferences/agent-format.mdreferences/cross-platform.mdreferences/interview.mdreferences/marketplaces.mdreferences/parallelism.mdreferences/platforms.mdreferences/plugin-discovery.mdreferences/replication.mdreferences/skill-format.mdreferences/spec-kit.mdreferences/topology.mdreferences/wrapup.mdGuides Next.js Cache Components and Partial Prerendering (PPR) with cacheComponents enabled. Implements 'use cache', cacheLife(), cacheTag(), revalidateTag(), static/dynamic optimization, and cache debugging.
Migrates code, prompts, and API calls from Claude Sonnet 4.0/4.5 or Opus 4.1 to Opus 4.5, updating model strings on Anthropic, AWS, GCP, Azure platforms.
Automates semantic versioning and release workflow for Claude Code plugins: bumps versions in package.json, marketplace.json, plugin.json; verifies builds; creates git tags, GitHub releases, changelogs.
Scaffold or update a complete agent system for the current project across Copilot CLI, Claude Code, and/or OpenCode. Produces a canonical AGENTS.md (with Directory Architecture, Agent Roster, Capability Matrix), an orchestrator + N subagents, project-scoped skills, and approved plugins/MCP servers — derived from a structured interview.
ask_user. Never assume project type, language, scope, or target platform.AGENTS.md, CLAUDE.md, opencode.json, .github/agents/, .claude/agents/, .opencode/agents/, ~/.codex/AGENTS.md exists, present mode choice with improve and replicate as first-class options — never silently jump to update.ask_user choice — never bulk-applied silently..mcp.json, opencode.json › mcp, agent mcp-servers:), render the proposal and call ask_user for approval. No silent MCP writes — ever. Replication re-triggers this gate per new target.[Tier · Vendor] — never invent names or URLs.cp <file> <file>.bak before any edit; merge into managed blocks, preserve user-authored content..sh for POSIX shells, .ps1 for native PowerShell. Forward slashes in generated docs. Never symlink on Windows. Bundle .gitattributes so line endings stay correct on every clone.ask_user.AGENT-TEAMS.md per parallelism. Sequential-only topologies are an error.ask_user, never auto-install. See spec-kit.First question after detecting cwd. Use ask_user:
"Which agent runtime(s) should I configure?" Choices:
["Copilot CLI only (Recommended for GitHub-centric teams)", "Claude Code only", "OpenCode only", "OpenAI Codex CLI only", "Copilot CLI + Claude Code", "All four (Copilot + Claude Code + OpenCode + Codex)"]
Persist the selection. All later phases loop over selected platforms using platforms.md as the source of truth for paths and frontmatter.
Inspect cwd and detect runtime footprint:
package.json, *.csproj, Package.swift, build.gradle, pyproject.toml, go.mod, Cargo.toml, mkdocs.yml, .git/.AGENTS.md, .github/agents/, .github/skills/, .mcp.jsonCLAUDE.md, .claude/agents/, .claude/skills/, .claude/settings.jsonopencode.json, .opencode/agents/, .opencode/skills/## <Name> headings in AGENTS.md, ~/.codex/AGENTS.mdDecide mode with ask_user — show what was detected:
| Detected footprint | Default offer | Choices |
|---|---|---|
| Nothing | init | ["Init (Recommended)", "Cancel"] |
| One runtime, looks healthy | improve | ["Improve current setup (Recommended)", "Update (regenerate managed blocks)", "Replicate to another runtime", "Init alongside (additive)"] |
| One runtime, gaps | update | ["Update (Recommended)", "Improve (audit + targeted fixes)", "Replicate to another runtime"] |
| Two+ runtimes | improve | ["Improve current setup (Recommended)", "Replicate / sync between runtimes", "Update one runtime"] |
Run the interview — see interview script. One question per ask_user call. Skip questions already answered by detection (project type, framework). For improve/replicate, jump straight to Phase 1.5.
If the user picked improve → run the improve procedure (audit → score → propose deltas → opt-in apply). Skip Phases 2–4; jump to Phase 5 mechanics for backups + write.
If the user picked replicate → run the replication procedure:
ask_user for source runtime (single-select among detected).ask_user for target runtimes (multi-select; source excluded).ask_user to approve dropped fields per target.<!-- agents-system-setup:replicated-from: <source> --> markers.agent-replication.log).For both branches, finish with Phase 7 (verify & summarize).
Run after Phase 1 (and 1.5 if branched), before Phase 2. Inspect the project brief gathered during interview against this software-development keyword set:
app, application, api, service, microservice, library, sdk, cli, tool, devtool, backend, frontend, fullstack, web, mobile, ios, android, desktop, framework, plugin, extension, package, module, infrastructure, infra, terraform, pulumi, kubernetes, helm, compiler, parser, runtime, database, orm.
If any keyword matches (case-insensitive, word-boundary), or the project already has source-language signals (package.json, pyproject.toml, go.mod, Cargo.toml, *.csproj, pom.xml, Package.swift, build.gradle, mix.exs, composer.json), classify as software-dev. Otherwise non-dev (marketing, research, content, data-analysis).
If software-dev, call ask_user:
"This looks like a software project. Would you like to install GitHub Spec-Kit (Spec-Driven Development:
/specify→/plan→/tasks→/implementslash commands) alongside the agent system?" Choices:["Yes — install for this runtime (Recommended)", "Just print the install command", "No, skip"]
On approval, emit the runtime-matched command from spec-kit (uv tool install specify-cli --from git+https://github.com/github/spec-kit.git then specify init --here --ai <copilot|claude|codex|opencode>). Print, never silently shell-out unless the user picked "install".
Record the choice in the plan so Phase 4 orchestrator output can reference the /specify workflow when appropriate.
Build the plan and show it before writing anything. The plan must include:
path glob | purpose | owner agent | edit rule. Derived from project type + frameworks. Always covers: source dirs, tests, docs, infra, agent files, generated artifacts.name | role | owns | triggers | model (optional) | parallel-safe | wave. Use topology guide. Compute parallel-safety per parallelism: a subagent is parallel-safe iff its owns glob doesn't overlap any other's, it doesn't write outside owns, and it doesn't depend on another subagent's output in the same wave.Wave N → [parallel-safe subagents]; the orchestrator fans out per wave and awaits each before the next.End the phase with ask_user: ["Proceed", "Edit plan first"].
For every capability the user named (e.g., "playwright", "azure", "postgres"):
name, source_tier, repo_url, bundles (agents/skills/hooks/MCP/LSP), why_recommended, tradeoffs, install_command_per_platform. Empty rationale ⇒ drop the candidate.ask_user:
"For capability , which would you like?" Choices:
["<candidate 1 — short label>", "<candidate 2>", "<candidate 3>", "Show more (Tier-3 fallback search)", "None — skip this capability"]
See plugin discovery for the comparison-table format and rationale schema.
If any user-selected candidate from Phase 3 includes an MCP server:
.mcp.json (mcpServers key)opencode.json (mcp key)ask_user:
"I'm about to write the MCP configuration above to
<paths>. Approve?" Choices:["Approve all (Recommended)", "Approve selectively (per-server)", "Skip MCP entirely"]
["Include", "Skip"].mcp-servers: from generated agents and do not write .mcp.json / opencode.json mcp key.For each selected platform, look up paths and frontmatter in platforms.md, then render:
AGENTS.md at repo root → template. Fill Directory Architecture, Agent Roster, Capability Matrix, Skills, Plugins/MCP tables.{{OWNED_PATHS}} / {{READONLY_PATHS}} from the Directory Architecture.spec_kit_installed = true, render assets/spec-kit-block.snippet.md into the {{SPEC_KIT_BLOCK}} placeholder of AGENTS.md (substituting {{RUNTIME}} per platform: copilot|claude|codex|opencode). If false, replace the placeholder with an empty string. See spec-kit.team-suitable (independent + benefits from peer challenge), emit AGENT-TEAMS.md documenting: opt-in env var (CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1), settings.json snippet, suggested teammate roster, token-cost warning, and when to fall back to parallel subagents.Project-memory linking (after AGENTS.md is written):
bash ./scripts/link-project-memory.sh → symlinks CLAUDE.md → AGENTS.md.pwsh -File ./scripts/link-project-memory.ps1 → tries symlink (Developer Mode/admin), falls back to copy with regenerable header (re-runs keep them in sync).AGENTS.md natively — no linking required.Frontmatter rules (silent-failure traps):
name MUST match filename basename (kebab-case).description containing colons.description MUST start with "Use when...".mcp-servers:, Claude uses comma-string tools:, OpenCode uses mode: and bool-keyed tools: map).model: line is optional in every platform — emit only if the user specified an override.For every existing target file:
cp <file> <file>.bak via bash before any edit.<!-- agents-system-setup:managed:start --> … <!-- agents-system-setup:managed:end --> markers — replace the block, never duplicate.Only if user confirmed in Phase 1 AND no .git/ exists. Pick the script that matches the host OS — see cross-platform:
# macOS / Linux / Git Bash / WSL
bash ./scripts/git-init.sh
# Windows native PowerShell (PowerShell 7+ recommended)
pwsh -File ./scripts/git-init.ps1
# or, on stock Windows PowerShell 5.1:
powershell.exe -ExecutionPolicy Bypass -File ./scripts/git-init.ps1
Both forms initialize main, write a stack-aware .gitignore (covering .github/, .claude/, .opencode/ local state, .DS_Store, Thumbs.db, desktop.ini), drop a .gitattributes for line endings, stage, and commit.
name matches filename, description present, no unquoted colons, frontmatter parses for the target platform's schema.AGENTS.md contains non-empty Directory Architecture, Agent Roster, Capability Matrix.copilot, claude, opencode).Run after Phase 7, before exiting. One multi-select question presents a curated, source-cited menu of well-known add-ons (Spec-Kit, evals, OpenTelemetry GenAI, OWASP LLM Top-10, Claude Code hooks, prompt versioning, cost budgets, additional subagent catalogs). Filtered by signals from Phase 1.7 (domain), Phase 3 (plugins), Phase 3.5 (MCP), and selected target platforms — never show items already installed. Each selected item dispatches to a dedicated skill if available, else runs the inline action documented in wrap-up.
AGENTS.md; then execute.✅ Wrap-up add-ons selected/skipped lines to the Output Contract.Skip the entire phase only when mode == update and no agents/plugins/MCP changed.
AGENTS.md-only setups. Multi-target if uncertain — files coexist cleanly via shared AGENTS.md + .mcp.json.update vs improve vs replicate?
update regenerates managed blocks against the current plan (still asks before writing).improve audits the existing system and proposes a checklist of targeted fixes — user picks which to apply.replicate ports an existing system from one runtime to others using the Canonical IR.ask_user approval.CLAUDE.md on Windows (use the .ps1 fallback-copy path)..gitattributes — Windows users get CRLF in *.sh and break execution.AGENTS.md / opencode.json without .bak.[Tier · Vendor] from marketplaces.## <Name> headings inside AGENTS.md).✅ Mode: <init|update|improve|replicate>
✅ Platforms: <copilot-cli, claude-code, opencode, codex-cli>
✅ Detected footprint: <list of pre-existing artifacts, or "none">
✅ Files created: <count> (per platform: <breakdown>)
✅ Files updated (with .bak): <count>
✅ Subagents: <list>
✅ Skills: <list>
✅ Plugins selected: <list with [Tier · Vendor] and /plugin install (or platform-equivalent)>
✅ Plugins skipped: <list>
✅ MCP servers: <selected list> (approval: <approve-all | selective | skipped>)
✅ Project memory link: <symlink | copy | n/a>
✅ Git: <initialized | left untouched | already present>
✅ Wrap-up add-ons selected: <list with source URL, or "none">
✅ Wrap-up add-ons skipped: <list, or "none">
# replicate mode adds:
✅ Source runtime: <copilot-cli | claude-code | opencode | codex-cli>
✅ Target runtimes: <list>
✅ Lossy field drops: <list per target>
✅ Round-trip verify: <pass | drift on <fields>>
✅ Replication ledger: <path>
# improve mode adds:
✅ Audit findings: <ok / warn / fail counts>
✅ Deltas applied: <count>
✅ Deltas skipped: <count>
✅ Requires-human: <count>
Try it:
copilot # then: "@orchestrator <task>"
claude # then: invoke a subagent
opencode # then: pick an agent
codex # then: reference an AGENTS.md heading
Suggested next customizations:
- <suggestion 1>
- <suggestion 2>