agent-repair-loop
Skill14 starsChanged 8 months agoMITView on GitHub
The order of operations for changing a live package safely — diagnose, patch, publish, converge, verify, roll back. Use whenever you are about to modify an agent package that something is already running on.
We split this skill into the rules it gives an agent
8 rules. About 0 are common, 6 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 15
Never patch on a hypothesis.
- Very specific: line 31
Run list_agent_packages and look at scope and shadowed.
- Distinctive: line 35
If the user has no copy of a shared package, editing means publishing their own — which changes behaviour for them alone, not the …
- Distinctive: line 45
Do this even when the change is small.
- Distinctive: line 75
Do not add an agent or create a durable session solely to test a skill or tool.
- Distinctive: line 101
Do not delete a package to "clean up" a bad publish.
- Very specific: line 103
Do not promote to shared to make a fix reach more people.
- Distinctive: line 105
Do not chain publish → regenerate without the convergence check between.
≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Repairing a live package
The steps are ordered because each one exists to catch a specific failure.
1. Diagnose
Never patch on a hypothesis. Pull the evidence first:
| Question | Tool |
| What did the agent actually do? | read_agent_events |
| Where did the orchestration go? | read_execution_history |
| Is it a context/token problem? | read_session_metric_summary |
| Is it a retrieval problem? | read_session_retrieval_usage |
| What does the agent's prompt currently say? | read_agent_package |
State what the evidence shows and what it rules out. "The turn failed after the third tool call" is a finding. "The prompt is probably confusing" is a guess.
2. Establish which copy you are editing
Run list_agent_packages and look at scope and shadowed.
shadowed: trueon a shared package means the user's own copy is overriding it. Editing the shared one will appear to do nothing.- If the user has no copy of a shared package, editing means publishing their own — which changes behaviour for them alone, not the deployment.
Tell the user which of these is about to happen before you do it.
3. Propose the change as a diff
propose_agent_patch writes ordered .patch artifacts to the session. The
portal renders them with gutter markers.
Do this even when the change is small. A one-line prompt edit that the user can see is a decision they made; the same edit described in prose is one they took on trust.
4. Publish
Versions are immutable: republishing the same semver with different content is refused outright. Bump.
- Content unchanged → identical hash → the publish is a no-op. That is a success, not a failure.
- Publishing to
sharedaffects everyone. Publishing user-scope affects only the owner. Prefer the narrower one unless the user asked otherwise.
5. Wait for convergence — do not sleep
Publishes land on workers at the next registry poll (observed under 30s). Anything that runs before convergence runs the old definition, silently. That failure looks exactly like "the edit did nothing", and it has cost real debugging time.
Poll read_agent_package until activeVersionId matches what you published.
Then proceed. A fixed sleep is not a convergence check.
6. Verify the changed capabilities
Packages can contain reusable skills, executable tools/MCP integrations, and authored agent workflows. Zero-agent packages are valid. Verify the surfaces that changed: discover and load skills, activate permitted integrations, and check real tool/MCP execution evidence in a representative permissions context. Do not add an agent or create a durable session solely to test a skill or tool.
For an authored workflow, also use create_agent_session to test a top-level
session bound to the new version. Do not substitute spawn_agent: its child
preamble differs from the entry point a user runs. Tag the test with test_of,
reuse its key when appropriate, and observe its events and actual outputs.
Respect the session owner's authorization before messaging or ending it.
The named-entry-point check is mandatory when you were spawned by the agent you are editing. In that arrangement you are the child and the thing you are about to break is your own parent — the argument that "the publisher still runs the old version and can pin itself back" does not hold, because the publisher is not the victim.
7. Know the rollback
pin_agent_package_version restores a previous version; the fleet converges
on the next poll. Two other levers:
- Disable the user's copy → resolution falls back to shared. Fastest way out of a bad personal copy.
- Pin, then investigate. Restore service first. The broken version is still there to look at.
What not to do
- Do not delete a package to "clean up" a bad publish. Deletion destroys every version, including the good one you would have rolled back to.
- Do not promote to
sharedto make a fix reach more people. Promotion hands your change to the whole deployment and is refused if the name is taken. - Do not chain publish → regenerate without the convergence check between.
In this repository50 other files it gives its agents.
- packages/sdk/examples/repo-workspaces/seed/home/AGENTS.mdAGENTS.md
- .github/copilot-instructions.mdCopilot instructions
- duroxide-orchestration-versioningSkill
- editorial-standardsSkill
- finance-research-standardsSkill
- valuation-methodsSkill
- pilotswarm-architectureSkill
- deployment-safetySkill
- incident-responseSkill
- add-activitySkill
- add-eventSkill
- add-testSkill
- add-toolSkill
- agent-versioningSkill
- azure-ps-test-runner-vmSkill
- debug-orchestrationSkill
- debug-testSkill
- horizondb-idiosyncrasiesSkill
- horizon-facts-eval-sweepSkill
- investigate-duroxide-runtimeSkill
- pilotswarm-aks-deploySkill
- pilotswarm-aks-resetSkill
- pilotswarm-new-env-deploySkill
- pilotswarm-perfSkill
- pilotswarm-portal-app-regSkill
- pilotswarm-portal-auth-assignmentsSkill
- pilotswarm-releaseSkill
- pilotswarm-tuiSkill
- pilotswarm-vpn-client-profileSkill
- schema-migrationSkill
- notesSkill
- share-a-fileSkill
- cost-latency-analysisSkill
- graph-debugSkill
- orchestration-session-lifecycleSkill
- resourcemgrSkill
- sweeperSkill
- canvas-appsSkill
- html-visualsSkill
- pilotswarm-agent-versioningSkill
- pilotswarm-aks-identitySkill
- pilotswarm-azure-deployerSkill
- pilotswarm-azure-lessonsSkill
- pilotswarm-cli-builderSkill
- pilotswarm-duroxide-versioningSkill
- pilotswarm-hybrid-datastoreSkill
- pilotswarm-knowledge-harvesterSkill
- pilotswarm-portal-builderSkill
- pilotswarm-sdk-builderSkill
- pilotswarm-three-tierSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

