---
title: Export a routine
description: Turn any routine folder into one pack file with pack export. What it reads, the defaults without a pack.json, and what is lost.
sidebar:
  order: 6
---

> Since 0.6.0.

## What it is

`pack export <dir> [--out FILE]` reads a routine folder and writes one pack. Without `--out` it prints the pack.

## Why it exists

Routines are built as folders. Export makes sharing one a single command, and a round trip (export then install) gives the same folder back.

## How it works

Export reads:

- `routine.toml`, `prompt.md`, `README.md`, `definition.json`;
- `pack.json` for the metadata, if present;
- every file under `lib/` and `skills/`, skipping `__pycache__`, `.pyc` and `.DS_Store`.

It refuses a symlink or a path that resolves outside the folder. The result is validated like any pack.

Without a `pack.json`, export uses these defaults: version `0.1.0`, title the routine name, summary "The <name> routine.", category `general`, maturity `unpiloted`, one model stage `run` ("Follows prompt.md."), and no connectors.

`routine.toml` is stored as data and written back by a TOML emitter, so **comments in `routine.toml` are lost** on a round trip.

## Worked example

```
$ routineos.py pack export templates/jobs-watch --out jobs-watch.pack.json
wrote jobs-watch.pack.json (15882 bytes)
```

The pack's keys: `format, id, version, title, summary, category, maturity, license, routine, prompt, readme, definition, stages, connectors`. The size matches the `bytes` the catalog lists for `jobs-watch.json`.

## Common pitfalls

- **Expecting comments to survive.** They do not; keep notes in `README.md`.
- **Exporting a routine with an address in its prompt.** Validation refuses it.
- **Forgetting `pack.json`.** The pack is `unpiloted` and `general` by default.

## Related

- [Writing a pack](/templates/writing-a-pack)
- [Install a pack](/templates/install)
