Ai agents generation and release

From rjmurillo/ai-agents · View interactive version

Ai agents generation and release is an AI agent skill from the GitHub repository rjmurillo/ai-agents. Operate and edit the ai-agents generation and release machinery, covering the seven build_all.py generators, generate_agents.py, customer-facing generated artifacts (references/rule-generated-artifacts.md), drift gates, version-free plugin manifests, and the npm publish path. Use when you say `regen

How to use this skill

Skill file

ai-agents Generation and Release

<!-- vendor-portability: contributor-facing knowledge pack for the rjmurillo/ai-agents repo itself; intentionally references upstream paths because its audience is repo contributors, not plugin consumers. Declared paths: .claude/lib, .project-toolkit/architecture/ADR-036-two-source-agent-template-architecture.md, .project-toolkit/architecture/ADR-052-template-strategy.md, build/generate_agents.py, build/scripts/build_all.py, build/scripts/check_plugin_manifest_parity.py, build/scripts/detect_agent_drift.py, build/scripts/lib_mirror.py, build/scripts/validate_plugin_version_bump.py, build/scripts/yaml_loader.py, scripts/ai_review_common, scripts/github_core, scripts/hook_utilities, templates/agents, templates/platforms/binplace.yaml -->

Runbook for the build, generation, mirroring, versioning, and release machinery. Facts that change (generator list, owned prefixes, skill counts, gate wiring) come from the script in Phase 1, not from this prose.

Reached from ai-agents-build-and-env, which names this skill back. No root router exists; enter by trigger phrase.

Jargon, defined once:

Triggers

Before changing a generator or a customer-facing generated artifact, read generated-artifacts.

When NOT to Use This Skill

| You want | Use instead |

|----------|-------------|

| Set up the dev environment, uv, hooks | ai-agents-build-and-env |

| WHY the seam is shaped this way, invariants | ai-agents-architecture-contract |

| Triage a red CI gate you do not understand | ai-agents-debugging-playbook |

| Change classification, commit caps, review gates | ai-agents-change-control |

| Escape hatches like the drift allowlist | ai-agents-config-catalog |

Process

Phase 1: Know the Seam Before You Edit

The generation seam is ASYMMETRIC (ADR-072, accepted and not yet implemented, refines it; the running system is what follows). Find your file BEFORE editing. Editing a generated tree is the classic failure (see Anti-Patterns).

( for d in "${CLAUDE_PLUGIN_ROOT}" "${COPILOT_PLUGIN_ROOT}" .claude; do if [ -n "$d" ] && [ -f "$d/lib/ptk_run.py" ]; then exec python3 "$d/lib/ptk_run.py" skills/ai-agents-generation-and-release/scripts/generator_inventory.py --repo . path <repo-path>; fi; done; echo "ptk_run: no plugin root holds lib/ptk_run.py" >&2; exit 2 )
( for d in "${CLAUDE_PLUGIN_ROOT}" "${COPILOT_PLUGIN_ROOT}" .claude; do if [ -n "$d" ] && [ -f "$d/lib/ptk_run.py" ]; then exec python3 "$d/lib/ptk_run.py" skills/ai-agents-generation-and-release/scripts/generator_inventory.py --repo . generators; fi; done; echo "ptk_run: no plugin root holds lib/ptk_run.py" >&2; exit 2 )
( for d in "${CLAUDE_PLUGIN_ROOT}" "${COPILOT_PLUGIN_ROOT}" .claude; do if [ -n "$d" ] && [ -f "$d/lib/ptk_run.py" ]; then exec python3 "$d/lib/ptk_run.py" skills/ai-agents-generation-and-release/scripts/generator_inventory.py --repo . skills; fi; done; echo "ptk_run: no plugin root holds lib/ptk_run.py" >&2; exit 2 )

Rules that hold across the rows (the tables are in references/seam-tables.md):

Phase 2: Regenerate After Editing a Canonical Surface

Commit the canonical edit and the regenerated output TOGETHER, or the drift gates go red.

Interpreter: build/generate_agents.py and build_all.py import PyYAML through build/scripts/yaml_loader.py. Run them as uv run python <script> locally. CI can use bare python3 because .github/actions/setup-code-env installs the locked dependencies first.

| You edited | Run | Then |

|------------|-----|------|

| templates/agents/*.shared.md | uv run python build/generate_agents.py, then uv run python build/scripts/build_all.py | commit the template and every regenerated file, including src/claude/agents/. |

| templates/skills/<name>.SKILL.md.tmpl or templates/rules/ | uv run python build/scripts/build_all.py | commit the template and both rendered copies. No manifest edit (Phase 4). |

| templates/hooks/ (including settings.tmpl and hooks.json) | uv run python build/scripts/build_all.py | same. Regenerate BEFORE pushing: no pre-push job runs --check, so the first red is CI. |

| scripts/hook_utilities/, scripts/github_core/, scripts/ai_review_common/ | uv run python build/scripts/build_all.py | one command writes both lib trees and binplaces .claude/lib/. |

| src/claude/AGENTS.md, src/claude/claude-instructions.template.md | nothing to regenerate | commit directly. |

Flags, read from source:

Phase 3: Run the Drift Gates Locally Before Pushing

( for d in "${CLAUDE_PLUGIN_ROOT}" "${COPILOT_PLUGIN_ROOT}" .claude; do if [ -n "$d" ] && [ -f "$d/lib/ptk_run.py" ]; then exec python3 "$d/lib/ptk_run.py" skills/ai-agents-generation-and-release/scripts/generator_inventory.py --repo . gates; fi; done; echo "ptk_run: no plugin root holds lib/ptk_run.py" >&2; exit 2 )
( for d in "${CLAUDE_PLUGIN_ROOT}" "${COPILOT_PLUGIN_ROOT}" .claude; do if [ -n "$d" ] && [ -f "$d/lib/ptk_run.py" ]; then exec python3 "$d/lib/ptk_run.py" skills/ai-agents-generation-and-release/scripts/instruments.py --repo . run build-all-check; fi; done; echo "ptk_run: no plugin root holds lib/ptk_run.py" >&2; exit 2 )

gates maps each drift gate to the lefthook job or workflow job that runs it and exits 1 for a gate with no wiring. The gate list, local commands, and caveats are in references/drift-gates.md. Its answer does not say a gate is green, only where it runs.

When a gate is red, the output shows the DIFFERENCE, not the DIRECTION. Ask which side is canonical before touching anything. Fix is always: edit canonical, rerun the generator, commit both. The 2025-12-15 incident (edited source to match generated) is in drift-gates.md. An emergency bypass marker exists; see ai-agents-config-catalog and route the decision through ai-agents-change-control.

The installed-plugin Copilot hook E2E must run in an isolated HOME and COPILOT_HOME, never the live Copilot home. The commands and the incident are in drift-gates.md.

Phase 4: Plugin Manifests Carry No Version

Two Claude-plugin manifests exist; .claude/.claude-plugin/plugin.json is retired. Other plugin.json files under src/ belong to other hosts and are out of scope here.

| Tree | Manifest |

|------|----------|

| src/claude/ | src/claude/.claude-plugin/plugin.json |

| src/copilot-cli/ | src/copilot-cli/.claude-plugin/plugin.json |

.claude/ is not a marketplace-listed root. Its template-owned files are binplaced from src/claude/; skill scripts/, references/, and tests/ stay hand-maintained.

The rule (docstring of build/scripts/validate_plugin_version_bump.py): neither manifest, and no entry in any marketplace.json, may carry a version field. Claude Code then resolves freshness from the git commit SHA, which moves on every merge. ADR-092 reverses ADR-079's hand-bumped rule (ADR-079 was superseded by ADR-091, and ADR-091 by ADR-092) after ADR-092 measured 14 of 22 conflicting PRs conflicting on that one line.

( for d in "${CLAUDE_PLUGIN_ROOT}" "${COPILOT_PLUGIN_ROOT}" .claude; do if [ -n "$d" ] && [ -f "$d/lib/ptk_run.py" ]; then exec python3 "$d/lib/ptk_run.py" skills/ai-agents-generation-and-release/scripts/instruments.py --repo . run version-field; fi; done; echo "ptk_run: no plugin root holds lib/ptk_run.py" >&2; exit 2 )
( for d in "${CLAUDE_PLUGIN_ROOT}" "${COPILOT_PLUGIN_ROOT}" .claude; do if [ -n "$d" ] && [ -f "$d/lib/ptk_run.py" ]; then exec python3 "$d/lib/ptk_run.py" skills/ai-agents-generation-and-release/scripts/instruments.py --repo . run manifest-parity; fi; done; echo "ptk_run: no plugin root holds lib/ptk_run.py" >&2; exit 2 )

version-field fails when a manifest or marketplace entry carries version. manifest-parity checks description component counts only. Neither lists which manifests exist; the table above does.

Consequences:

Phase 5: npm Release Path

The npm surface is packages/ai-agents-cli (package

@rjmurillo/ai-agents; read package.json for the current version). It vendors

the Claude kit into consumer repos.

RELEASING.md (repo root) owns the release procedure: setup, publish, dry run,

verification, rollback, and troubleshooting. Follow it step by step and do not

copy its steps here, because they change with the publish gate.

Durable distinctions to keep in mind:

Scripts

Both scripts are read-only, print JSON with an examined count, and answer --help. Exit 0 ok, 1 findings, 2 bad arguments or configuration. Exit 3 means instruments.py could not start a run target; generator_inventory.py reserves it and never returns it.

( for d in "${CLAUDE_PLUGIN_ROOT}" "${COPILOT_PLUGIN_ROOT}" .claude; do if [ -n "$d" ] && [ -f "$d/lib/ptk_run.py" ]; then exec python3 "$d/lib/ptk_run.py" skills/ai-agents-generation-and-release/scripts/instruments.py --repo . list; fi; done; echo "ptk_run: no plugin root holds lib/ptk_run.py" >&2; exit 2 )

Anti-Patterns

| Anti-pattern | Why it burns you | Do instead |

|--------------|------------------|------------|

| Hand-editing src/copilot-cli/, src/vs-code-agents/, .github/instructions/, .claude/lib/ | Next regen silently overwrites your edit; ruff exempts generated Python under src/copilot-cli/{hooks,skills}/**/*.py (pyproject.toml [tool.ruff.lint.per-file-ignores]), so lint will not look at it | Edit the canonical tree (path command), regenerate |

| Editing source to make a drift gate green | The 2025-12-15 disaster; drift output shows difference, not direction | Identify the canonical side first, regenerate outward |

| Editing .claude/lib/ or src/copilot-cli/lib/ by hand | Both are generated; the next build_all.py run reverts you | Edit scripts/{hook_utilities,github_core,ai_review_common}, run build_all.py |

| Bumping the two manifests in lockstep to satisfy version parity | Parity retired with the field (ADR-092); the bump itself now fails the gate | Nothing to bump; leave both manifests version-free |

| Re-adding a version to a manifest to clear a red gate | The gate fails on the field's presence, so the red is permanent | Delete the field; freshness already tracks the commit SHA |

| Treating Dropped: N as normal without checking the source | Current source registrations all map to Copilot events; an unexplained drop means contract drift | Read the generation audit log, identify the source registration, require an explicit eventDrop decision |

| Running build_all.py with bare python3 in a fresh shell | PyYAML lives in the venv; import fails | uv run python build/scripts/build_all.py |

| Running installed-plugin E2E against live ~/.copilot | Version skew and ambiguous uninstall mutate active hooks; a missing hook root can deny every matching tool | Isolate HOME and COPILOT_HOME (see drift-gates.md) |

| Treating src/claude/ as wholly hand-maintained | Its agents/, rules/, hooks/, settings.json, and skills/*/SKILL.md are generated (ADR-109); the ADR-036 exception is superseded | Run the path command; hand-edit only AGENTS.md, claude-instructions.template.md, and non-SKILL skill files |

Verification

Before pushing a change that touched a canonical or generated surface:

Provenance and Maintenance

Volatile facts come from the script in Phase 1, not from this file. reverify.json holds the checks that pin the paths and source strings this skill cites. Run the drift command after any edit here:

( for d in "${CLAUDE_PLUGIN_ROOT}" "${COPILOT_PLUGIN_ROOT}" .claude; do if [ -n "$d" ] && [ -f "$d/lib/ptk_run.py" ]; then exec python3 "$d/lib/ptk_run.py" skills/skill-bootstrap/scripts/bootstrap_drift.py check --repo . --skills-root .claude/skills --name ai-agents-generation-and-release --require; fi; done; echo "ptk_run: no plugin root holds lib/ptk_run.py" >&2; exit 2 )

( for d in "${CLAUDE_PLUGIN_ROOT}" "${COPILOT_PLUGIN_ROOT}" .claude; do if [ -n "$d" ] && [ -f "$d/lib/ptk_run.py" ]; then exec python3 "$d/lib/ptk_run.py" skills/ai-agents-generation-and-release/scripts/instruments.py --repo . list; fi; done; echo "ptk_run: no plugin root holds lib/ptk_run.py" >&2; exit 2 ) prints every linked instrument and exits 1 when one is missing.

| Fact | Source | Re-verify |

|------|--------|-----------|

| .claude/ no-write invariant | CLAUDE_GUARD_PREFIX, the claude_baseline snapshot in run, assert_no_claude_writes in build/scripts/build_all.py | grep -n "REQ-003-010" build/scripts/build_all.py |

| generate_agents flags and exit codes | build/generate_agents.py docstring | uv run python build/generate_agents.py --help |

| lib mirror pairs | PACKAGES in build/scripts/lib_mirror.py | grep -n PACKAGES build/scripts/lib_mirror.py |

| Version-field prohibition and ADR-092 reversal | build/scripts/validate_plugin_version_bump.py docstring | grep -n "WHY THE FIELD MUST BE ABSENT" build/scripts/validate_plugin_version_bump.py |

| Weekly semantic drift cron, threshold 80 | .github/workflows/drift-detection.yml; argparse default in detect_agent_drift.py | grep -n "cron" .github/workflows/drift-detection.yml && grep -n "default=80" build/scripts/detect_agent_drift.py |

| Git hook jobs and filters | lefthook.yml | uv run --frozen lefthook validate |

| npm package, bun build, dispatch-only publish route (re-verified 2026-10-14) | packages/ai-agents-cli/package.json; RELEASING.md; the header comment of .github/workflows/publish.yml | grep -n '"build":' packages/ai-agents-cli/package.json && grep -n "dormant" RELEASING.md .github/workflows/publish.yml |

| Audit log path, gitignored | .gitignore | grep -n "build/audit" .gitignore |

| ADR-036 and ADR-052 superseded, ADR-108 and ADR-109 accepted | the four ADR records | grep -l "^status: superseded$" .project-toolkit/architecture/ADR-036-two-source-agent-template-architecture.md .project-toolkit/architecture/ADR-052-template-strategy.md |

Maintenance: when a generator is added or removed, when a Claude-plugin manifest appears or leaves, or when a drift gate moves, update GATES in generator_inventory.py and the Phase 4 table, then rerun the drift command.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.