Upgrade Agent-Native
Rule
When an older Agent-Native app/branch needs to run on current packages, use
agent-native upgrade. Never "fix" upgrade breakage with
pnpm patch, pnpm patch-commit, pnpm.patchedDependencies,
pnpm.overrides, patchedDependencies, resolutions, local patch artifacts,
or edits under node_modules/@agent-native/* — especially not against
@agent-native/core or @agent-native/dispatch.
Why
Agents often respond to a failed core bump by inventing framework patches and
dispatch behavior overrides. That hides the real app-level break, drifts from
upstream, and makes the next upgrade worse. The supported path is bump →
install → refresh scaffold skills → verify, then fix app code only.
How
Preview migration codemods first
npx @agent-native/core@latest upgrade --codemods
Codemods are preview-by-default: read the diff before applying it. Do not
manually edit imports before running this command; the migration manifest is
the source of truth for renamed specifiers and symbols.
Apply the reviewed codemods, then run the upgrade
npx @agent-native/core@latest upgrade --codemods --yes
npx @agent-native/core@latest upgrade
Or from an already-installed CLI: pnpm exec agent-native upgrade /
agent-native upgrade.
What it does:
- Blocks (unless
--force) when @agent-native/* overrides/patches exist
- Rewrites non-local
@agent-native/* dependency pins to latest
- Runs the package manager install
- Rewrites those pins to the exact versions the install resolved, so the
committed manifest names one release instead of re-resolving next install
- Runs
skills update scaffold --project
- Runs
typecheck when the project has that script
Pull upstream template changes (optional, separate from the bump)
agent-native upgrade moves package versions. It never touches files that
were copied out of a template at scaffold time, so template fixes and
improvements do not arrive with a bump.
agent-native template status # recorded ref vs latest, drift counts
agent-native template diff # what upstream changed, read-only
agent-native template sync # 3-way merge it into the app
sync defaults to the ref matching the installed @agent-native/core, so
run it after upgrade. It merges per file against a pristine baseline
stored in refs/agent-native/template-baseline/<app-path>; files upstream
did not touch are left alone, and real collisions get conflict markers.
After resolving markers, run agent-native template accept — the baseline
deliberately does not advance past an unresolved merge.
Apps scaffolded before provenance existed have no baseline. Create one
with agent-native template baseline before the first sync.
If upgrade or typecheck fails
- Read the concrete error
- Fix app source, actions, config, or env — not framework packages
- Re-run
agent-native upgrade or pnpm typecheck
- Stop and ask the user if you cannot fix the app-level error
Intentional app-level UI customization is a separate workflow. Read
customizing-agent-native when the product needs to own a selectively
copied component; do not use that path to reproduce framework runtime
behavior or hide version skew.
Dry-run / partial runs
agent-native upgrade --dry-run
agent-native upgrade --skip-verify
agent-native upgrade --skip-install # package.json bumps only
agent-native doctor --only migration-manifest
migration-manifest has no opt-out. Run it in CI before upgrading to find
imports that will break, then use npx @agent-native/core@latest upgrade --codemods
to preview the supported rewrite.
Don't
- Don't add
pnpm.overrides, overrides, resolutions, or
patchedDependencies for any @agent-native/* package
- Don't run
pnpm patch or pnpm patch-commit, or commit files under
patches/, for any dependency
- Don't edit
node_modules/@agent-native/core or
node_modules/@agent-native/dispatch
- Don't invent local "dispatch behavior" shims to paper over version skew
- Don't keep iterating with more framework patches after a failed install
- Don't skip
skills update scaffold --project after a core bump (the
upgrade command does this for you)
Related Skills
- self-modifying-code — Tier 4: framework packages are off limits
- agent-native-docs — version-matched docs after the bump
- customizing-agent-native — intentional app-owned UI copies, not upgrade patches
- portability — keep app code provider-agnostic across upgrades
1---2name: upgrade-agent-native3description: Bring an older Agent-Native app or workspace current. Use when updating @agent-native/core, fixing a broken upgrade, or when tempted to patch or override core/dispatch packages to make an old branch run.4---56# Upgrade Agent-Native78## Rule910When an older Agent-Native app/branch needs to run on current packages, use11`agent-native upgrade`. Never "fix" upgrade breakage with12`pnpm patch`, `pnpm patch-commit`, `pnpm.patchedDependencies`,13`pnpm.overrides`, `patchedDependencies`, `resolutions`, local patch artifacts,14or edits under `node_modules/@agent-native/*` — especially not against15`@agent-native/core` or `@agent-native/dispatch`.1617## Why1819Agents often respond to a failed core bump by inventing framework patches and20dispatch behavior overrides. That hides the real app-level break, drifts from21upstream, and makes the next upgrade worse. The supported path is bump →22install → refresh scaffold skills → verify, then fix **app** code only.2324## How25261. **Preview migration codemods first**2728 ```bash29 npx @agent-native/core@latest upgrade --codemods30 ```3132 Codemods are preview-by-default: read the diff before applying it. Do not33 manually edit imports before running this command; the migration manifest is34 the source of truth for renamed specifiers and symbols.35362. **Apply the reviewed codemods, then run the upgrade**3738 ```bash39 npx @agent-native/core@latest upgrade --codemods --yes40 npx @agent-native/core@latest upgrade41 ```4243 Or from an already-installed CLI: `pnpm exec agent-native upgrade` /44 `agent-native upgrade`.4546 What it does:4748 - Blocks (unless `--force`) when `@agent-native/*` overrides/patches exist49 - Rewrites non-local `@agent-native/*` dependency pins to `latest`50 - Runs the package manager install51 - Rewrites those pins to the exact versions the install resolved, so the52 committed manifest names one release instead of re-resolving next install53 - Runs `skills update scaffold --project`54 - Runs `typecheck` when the project has that script55563. **Pull upstream template changes (optional, separate from the bump)**5758 `agent-native upgrade` moves package versions. It never touches files that59 were copied out of a template at scaffold time, so template fixes and60 improvements do not arrive with a bump.6162 ```bash63 agent-native template status # recorded ref vs latest, drift counts64 agent-native template diff # what upstream changed, read-only65 agent-native template sync # 3-way merge it into the app66 ```6768 `sync` defaults to the ref matching the installed `@agent-native/core`, so69 run it after `upgrade`. It merges per file against a pristine baseline70 stored in `refs/agent-native/template-baseline/<app-path>`; files upstream71 did not touch are left alone, and real collisions get conflict markers.72 After resolving markers, run `agent-native template accept` — the baseline73 deliberately does not advance past an unresolved merge.7475 Apps scaffolded before provenance existed have no baseline. Create one76 with `agent-native template baseline` before the first sync.77784. **If upgrade or typecheck fails**7980 - Read the concrete error81 - Fix **app** source, actions, config, or env — not framework packages82 - Re-run `agent-native upgrade` or `pnpm typecheck`83 - Stop and ask the user if you cannot fix the app-level error8485 Intentional app-level UI customization is a separate workflow. Read86 `customizing-agent-native` when the product needs to own a selectively87 copied component; do not use that path to reproduce framework runtime88 behavior or hide version skew.89905. **Dry-run / partial runs**9192 ```bash93 agent-native upgrade --dry-run94 agent-native upgrade --skip-verify95 agent-native upgrade --skip-install # package.json bumps only96 agent-native doctor --only migration-manifest97 ```9899 `migration-manifest` has no opt-out. Run it in CI before upgrading to find100 imports that will break, then use `npx @agent-native/core@latest upgrade --codemods`101 to preview the supported rewrite.102103## Don't104105- Don't add `pnpm.overrides`, `overrides`, `resolutions`, or106 `patchedDependencies` for any `@agent-native/*` package107- Don't run `pnpm patch` or `pnpm patch-commit`, or commit files under108 `patches/`, for any dependency109- Don't edit `node_modules/@agent-native/core` or110 `node_modules/@agent-native/dispatch`111- Don't invent local "dispatch behavior" shims to paper over version skew112- Don't keep iterating with more framework patches after a failed install113- Don't skip `skills update scaffold --project` after a core bump (the114 upgrade command does this for you)115116## Related Skills117118- **self-modifying-code** — Tier 4: framework packages are off limits119- **agent-native-docs** — version-matched docs after the bump120- **customizing-agent-native** — intentional app-owned UI copies, not upgrade patches121- **portability** — keep app code provider-agnostic across upgrades