feat(templates): add import/export system for agent systems

This commit is contained in:
Kjell Tore Guttormsen 2026-04-12 06:47:14 +02:00
commit ea3ff53d2c
4 changed files with 372 additions and 0 deletions

View file

@ -0,0 +1,64 @@
# Import / Export System
Portable packaging for agent systems. Export a working agent system from one
project and import it into another, with automatic placeholder substitution.
## Export
Pack your current agent system into a tarball:
```bash
bash scripts/templates/transfer/export-system.sh my-project-name
# Creates: agent-system-my-project-name-2026-04-11.tar.gz
```
### What is included
| Included | Excluded |
|---------|---------|
| `.claude/agents/` | `.env` (secrets) |
| `.claude/skills/` | `*.local.*` files |
| `.claude/hooks/` | `audit.log` |
| `.claude/settings.json` | `cost-events.jsonl` |
| `hooks/` | `memory/` (machine-specific state) |
| `automation/` | `.git/` |
| `scripts/` | |
| `CLAUDE.md` | |
## Import
Extract a tarball into a new project directory:
```bash
# Dry run first: inspect without extracting
tar -tzf agent-system-my-project-name-2026-04-11.tar.gz
# Import (will stop if files conflict)
bash scripts/templates/transfer/import-system.sh agent-system-my-project-name-2026-04-11.tar.gz
# Import and overwrite existing files
bash scripts/templates/transfer/import-system.sh agent-system-my-project-name-2026-04-11.tar.gz --force
```
The import script will:
1. Read `MANIFEST.md` and verify the archive
2. Check for conflicts with existing files (stops unless `--force`)
3. Extract all files
4. Replace `{{PROJECT_DIR}}` and `{{PROJECT_NAME}}` placeholders
5. Make `.sh` files executable
6. Validate agent frontmatter and hook syntax
## Customization after import
1. **Update `CLAUDE.md`** — replace project-specific context, goals, and constraints
2. **Add secrets** — create `.env` with `ANTHROPIC_API_KEY=sk-ant-...`
3. **Review hooks** — check that paths in hook scripts match your environment
4. **Run `/agent-factory:status`** — verify all components load correctly
5. **Run `/agent-factory:evaluate`** — check capability coverage
## Manifest
Each export includes `MANIFEST.md` listing every file with a SHA256 checksum
(first 16 hex characters). Use this to verify file integrity after transfer.
Template manifest: `scripts/templates/transfer/MANIFEST.md`