Skip to main content
Export writes your settings and a list of your skills to a file. Import restores the settings on another machine and tells you what that machine can bring back on its own. An export holds no skill content. It records where each skill came from, never what is in it. Content comes back from your account repo, or from installing the skill again.

Export this machine

The file holds: The file is readable by you alone, because it holds your settings. Treat it as you treat settings.json. agentx refuses to overwrite a file that is already there. Pass --force to replace it:
A path that names a directory is refused whether or not you pass --force: give the path of the file to write. Two exports of an unchanged machine are the same file, byte for byte.

Import onto another machine

Import writes your settings and nothing else. It creates no account repo, fetches nothing, installs nothing and places nothing. Your source list comes back with its pins, but no source is fetched. Before you install anything from a source, run the agentx source add line import prints for it, which it prints even when the export lists no skills. For a pinned source that line is agentx source add <url>#<pin>: agentx source add <url> alone unpins the source. When the URL or the pin holds anything but letters, digits and ._/:@%+=,#-, import puts it in single quotes, so the line runs as printed in a POSIX shell such as bash or zsh. The export file supplies both, and quoting keeps a $, & or quote in them from running as a command. The listing says what this machine’s account repo has of each skill:

Confirm without a terminal

Import replaces settings, so it asks first. Pass --yes to answer in advance:
Use --yes in scripts and wherever there is no terminal. Without it, and without a terminal to ask at, import exits with code 6 and changes nothing. Answering anything but y or yes does the same.

Move to a new machine

  1. On the old machine, run agentx export ~/agentx-export.json.
  2. Copy the file to the new machine.
  3. On the new machine, run agentx import ~/agentx-export.json.
  4. Run each agentx source add line the import printed, exactly as printed. It names the pin of a pinned source, <url>#<pin>, and agentx source list shows the pins too.
  5. Install what the listing calls missing with agentx skill add <source>.
Import restores the settings and nothing else, so the sources it lists are not yet on the new machine. Until you add one again, agentx source fetch and agentx skill add exit with code 5, say the source was not fetched and name the same agentx source add line, pin included, so following that hint keeps the pin too.

Script it

Add --json to get events instead of text. Import needs --yes in JSON mode, since it cannot ask.
The run emits a settings event with the settings it wrote, then one import_skill event per record with its state, then result. A record names a version and never carries one. Its base_hash is the version the skill was installed at, the same field under the same name that agentx skill list reports. An export holds no content_hash: that name always means what a machine holds right now, and an export reads no library directory.

When an import is refused

A refused import changes nothing: your settings stay exactly as they were.