Shared agent instructions, skills, and small portable helpers for Peter's local workspaces.
This repo is the canonical place for:
AGENTS.MD: shared hard rules for Codex/Claude-style agentsagent-tooling/: code-agent and skill update machinery — matrix generator, staging acquire, surface distribute, verify/validate gates,skill-authors.json,sources.json(the one tracked list of skill-bearing sources),skills-matrix.md- repository root: upstream-complete overlay of
steipete/agent-scripts:main; every recorded upstream path remains present while local additions and modifications coexist skills/: exact tracked mirror ofsteipete/agent-scripts:mainother-skills/: owner-grouped tracked holding area for foreign skills; each source dir carries.source.jsonprovenancecodex-skills/: repo-owned Codex-only authoring sourcescripts/: dependency-light personal helpers used across projectshooks/: local guardrails such as skill validation
Skills are the main routing layer. Each skills/<name>/SKILL.md or codex-skills/<name>/SKILL.md has YAML front matter:
---
name: skill-name
description: "Short generic trigger phrase."
---Rules:
- Keep descriptions short and generic; optimize for routing, not documentation.
- Keep skill bodies terse and operational.
- Prefer helper scripts under
skills/<name>/scripts/when a workflow has repeatable commands. - Validate after edits:
agent-tooling/validate-skills. - Quote
descriptionin front matter.
Global discovery — one skills root per CLI:
- Claude Code:
~/.claude/skillsonly;agent-tooling/update-skill-topology.shacquires upstream inventories into tracked staging;agent-tooling/sync-skill-surfaces.shdistributes matrix-selected, marker-owned copies offline. Native plugins are user-managed per-machine state refreshed best-effort byagent-tooling/update-plugins.sh(ADR-0009). - Codex:
~/.agents/skillsonly; the same matrix selects everyType: skillrow independently for Claude and Codex.Type: pluginrows remain report-only. - The old
~/.codex/skillsroot is legacy. Distribute migrates every non-system entry into collision-safe timestamped backups and verifies that only Codex's.systementry may remain. - Evidence note:
C:\Users\<user>\.codex\skills-migrated-20260707-091501was the local backup that shaped the migration tests (legacy skill dirs plus plain pointer files). It is documentation evidence only; scripts and tests must synthesize their own fixtures instead of depending on that path. - Recovery from migrated backups:
docs/codex-skill-backup-recovery.md. Upstream mirror rollback:docs/upstream-skills-mirror-rollback.md.
Tracked skills/ content mirrors steipete/agent-scripts:main exactly, including upstream-owned symlinks. Tracked mirror names win source collisions. Source-only and npx-only inventories stage under tracked other-skills/<owner>/ (no per-skill copy markers; provenance in .source.json), never directly in an agent surface.
Shared hard rules live in AGENTS.MD.
Topic detail lives in rules/. AGENTS.MD links to it as ~/.claude/rules/<name>.md: home-relative, so no machine-specific path appears in a tracked file and the links still resolve when the agent runs in some other project. A repo-relative link would resolve against the agent's cwd and break everywhere except this checkout; the test suite rejects one.
Codex has no import syntax and does not reliably open a file it is only linked to, so it reads AGENTS.codex.md: AGENTS.MD with every rules/ file inlined. That artifact is tracked, so git pull refreshes it like any other file and no install step can go stale (ADR-0010). Rebuild it with agent-tooling/build-codex-instructions.sh after editing AGENTS.MD or rules/; --check fails when it drifts, and the test suite enforces that.
Run agent-tooling/setup-agent-instructions.sh explicitly once per machine. It creates missing pointers, preserves real files and foreign symlinks, and is never called by routine skill updates. A pointer that already resolves to the right place counts as correct, so a relative symlink you made yourself is left alone without a warning. Claude Code reads CLAUDE.md and Pi reads ~/.pi/agent/AGENTS.md, so setup creates the pointers below. Each is a relative symlink, computed from the pointer's physically resolved directory because ~/.claude, ~/.codex, and ~/.pi are themselves symlinks into other checkouts; an existing pointer that already resolves correctly but is spelled absolutely is normalized in place. Targets are relative to this repository's checkout:
~/.claude/CLAUDE.md -> AGENTS.MD~/.codex/AGENTS.md -> AGENTS.codex.md~/.pi/agent/AGENTS.md -> AGENTS.MD, because Pi resolves and opens the topic links like Claude Code~/.claude/rules -> rules, one directory symlink, so the~/.claude/rules/*.mdlinks resolve from any cwd
Downstream repos should use a pointer-style AGENTS.MD:
READ ~/Projects/agent-scripts/AGENTS.MD BEFORE ANYTHING (skip if missing).
Repo-specific rules go below that pointer. Do not copy the shared blocks into downstream repos.
agent-tooling/sync-upstream-overlay.sh
- Public upstream sync command. Requires a clean worktree, fetches and merges
steipete/agent-scripts:main, restores upstream paths deleted by local history, and records the verified source commit without overwriting local additions or committed modifications. --checkis offline. It verifies that the recorded commit is merged intoHEADand that every path in that commit remains present.
agent-tooling/update-all.sh — the one command on the main machine
- Five ordered steps:
update-agents.sh,update-plugins.sh,update-skill-topology.sh(acquire),generate-skills-matrix.sh, thensync-skill-surfaces.sh(distribute). - No fail-fast; prints a
✓/✗summary and exits non-zero if any step failed. - Ships by default: requires a clean worktree, pulls first, validates the update, adds an Unreleased changelog entry, commits the refresh, pushes, pulls with fast-forward only, and verifies the final worktree state.
--no-shipruns the update steps only.
agent-tooling/update-local.sh — the one command on every other machine
- Fast-forward pulls the repo, then three ordered steps:
update-agents.sh,update-plugins.sh, thensync-skill-surfaces.sh(distribute). No staging acquire and no matrix refresh; this machine distributes already-committed staging. - Runs on macOS and on Windows under Git Bash. Windows needs
jqandrgon PATH once. - No fail-fast; prints a
✓/✗summary and exits non-zero if any step failed.
agent-tooling/update-plugins.sh
- Best-effort native plugin refresh on every machine: runs the native
claude/codexupdate commands for each plugin source insources.json, skips marketplaces marked"codexUpgrade": "manual"(ADR-0007), reports each failure in one line, and never fails the run. - It never installs a plugin and never repairs a registry. First-time installs are native commands you run once; a desynced Codex registry is
agent-tooling/repair-codex-registry.sh.
agent-tooling/verify.sh
- Single local/CI verifier: upstream-overlay completeness, skill validation, Bash syntax, topology cutover policy, updater/copy regressions, Bash maintainer policy, browser helper tests/runtime smoke, and video-downloader smoke checks; the maintainer policy path does not require Ruby.
- Missing tools or installed dependencies fail early with setup guidance.
agent-tooling/update-skill-topology.sh / agent-tooling/sync-skill-surfaces.sh
- Both commands are Bash and neither invokes nor requires Node. Browser-helper verification keeps its unrelated Node requirement.
- Acquire (
update-skill-topology.sh) refreshes one cached shallow clone per source under~/.cache/agent-scripts/source-clones/, mirrors complete foreign inventories into trackedother-skills/staging with.source.jsonprovenance, and removes staged skills that left upstream. It is selection-blind, never manages agent surfaces, and runs no native plugin commands (ADR-0009).--checkpreviews staging drift and writes nothing at all, including underHOME. - Distribute (
sync-skill-surfaces.sh) is fully offline and matrix-owned. It resolves selected names from tracked repo and staging content, reconciles both surfaces under one marker owner, adopts known pre-cutover agent-scripts owners, removes owned unselected copies, preserves and reports foreign entries, and reads only the matrix and tracked content. - Both print their result plus per-skill actions, keep diagnostics on standard error, and support
--checkfor a non-mutating preview or--jsonfor one JSON document. Acquire exit codes are0reconciled/check-clean,1drift or staging failure,2invalid usage or sources list,3decision required (unexpected skills-lock entries), and130interrupted. Distribute uses0for reconciled/check-clean,1for drift or reconciliation failure,2for invalid usage or matrix, and130for interruption. - Plugin sources (OpenAI Codex, Waza, mattpocock-skills, visual-explainer) carry only a
pluginblock insources.json, read byupdate-plugins.sh,repair-codex-registry.sh, and matrix reporting.Type: pluginmatrix rows stay report-only. Tooling never substitutes a surface copy for a broken plugin. - The matrix currently selects most Matt skills for both surfaces, with
code-reviewCodex-only because Claude supplies that built-in. Unknown npx lock sources return decision-required; known legacy npx lock entries also require an explicit decision and remain byte-identical. - Exit
3from acquire means a skills-lock entry needs an explicit decision; the lock is never mutated. Inspect--jsondecisions, act deliberately, then rerun.
agent-tooling/update-agents.sh
- Updates the agent CLIs:
claude update(native),npm install -g @openai/codex, andpi updatepluspi update --extensions; installs a missing Pi with its native installer. - Tries all installed CLIs even if one fails.
Removed public commands: update-repo-skills.sh, update-cc-plugins.sh, update-cli-skills.sh, update-waza.sh, update-claude-mem.sh, update-mattpocock-skills.sh, update-visual-explainer.sh, update-khazix-skills.sh, update-anthropic-skills.sh, and repair-claude-mem-marker.sh. No aliases or shims. scripts/sync-skills is a retired stub kept only for upstream-path completeness (ADR-0008/0009).
Topology authoring:
- Run
agent-tooling/sync-upstream-overlay.shto merge the latest upstream root and restore every upstream path before local topology updates. - Refresh tracked
skills/from the upstreamsteipete/agent-scripts:mainmirror; do not add fork-only content there. Mirrored skills default to Claude. - Put repo-owned Codex-only skills under
codex-skills/; they default to Codex. - Select Claude/Codex destinations by editing
Y/NonType: skillrows inagent-tooling/skills-matrix.md; the sources list has no distribution overrides. - Review newly appended skill rows and change
N/Nonly when the skill should reach a surface. Selected rows that no longer resolve fail loudly; unselected rows do not block reconciliation. Plugin rows and their destination cells are report-only. - For an external skill-bearing source, add exactly one
agent-tooling/sources.jsonentry:id,classification,repo, plussubroot/staging/discoveryfor staged sources or apluginblock for plugin sources. Stage source-only and npx-only inventories under the matchingother-skills/<owner>/; never write them directly intoskills/. Never add another public updater. - Preview upstream/staging drift with
agent-tooling/update-skill-topology.sh --check; run it to acquire. Regenerateagent-tooling/skills-matrix.mdto append new skills without changing selections, then preview surfaces offline withagent-tooling/sync-skill-surfaces.sh --check. Runagent-tooling/verify.shbefore commit.
agent-tooling/setup-agent-instructions.sh
- Explicit one-machine setup for the shared
AGENTS.MD/CLAUDE.md/rulespointers; not part of topology reconciliation or routine updates. - Idempotent; preserves real user files and foreign symlinks, including dangling ones.
- Refuses to run until
AGENTS.codex.mdexists.
agent-tooling/build-codex-instructions.sh
- Regenerates the tracked
AGENTS.codex.mdfromAGENTS.MDplusrules/. --checkexits non-zero when the artifact is stale; wired into the test suite.
agent-tooling/validate-skills
- Checks every repo-owned
skills/*/SKILL.mdandcodex-skills/*/SKILL.md. - Verifies YAML front matter plus required
nameanddescription. - Enable as a local hook with
git config core.hooksPath hooks. - Requires Python 3 with PyYAML (
pip install pyyaml; add--break-system-packageson an externally-managed Python).
scripts/docs-list.ts
- Walks
docs/. - Enforces
summaryandread_whenfront matter. - Prints onboarding summaries for repos that wire it in.
scripts/browser-tools.ts
- Standalone Chrome DevTools helper.
- Common commands:
start --profile,nav <url>,eval '<js>',screenshot,console,network,search --content "<query>",content <url>,inspect,kill --all --force. - Requires Node.js 22.18 or newer; run with
node scripts/browser-tools.ts --help.
Treat this repo as canonical for shared agent rules and portable helper scripts.
When syncing downstream repos:
- Pull latest here first.
- Ensure each target repo starts with the pointer-style
AGENTS.MD. - Preserve repo-local rules below the pointer.
- Copy helper changes both directions only when the helper is meant to stay byte-identical.
- Keep scripts dependency-free and portable; no repo-specific imports or path aliases.
For submodules, repeat the pointer check inside each subrepo, push those changes, then bump submodule SHAs in the parent repo.