mirror of
https://github.com/paperclipai/paperclip
synced 2026-04-25 17:25:15 +02:00
Merge pull request #1655 from paperclipai/pr/pap-795-company-portability
feat(portability): improve company import and export flow
This commit is contained in:
@@ -253,17 +253,7 @@ owner: cto
|
||||
name: Monday Review
|
||||
assignee: ceo
|
||||
project: q2-launch
|
||||
schedule:
|
||||
timezone: America/Chicago
|
||||
startsAt: 2026-03-16T09:00:00-05:00
|
||||
recurrence:
|
||||
frequency: weekly
|
||||
interval: 1
|
||||
weekdays:
|
||||
- monday
|
||||
time:
|
||||
hour: 9
|
||||
minute: 0
|
||||
recurring: true
|
||||
```
|
||||
|
||||
### Semantics
|
||||
@@ -271,58 +261,30 @@ schedule:
|
||||
- body content is the canonical markdown task description
|
||||
- `assignee` should reference an agent slug inside the package
|
||||
- `project` should reference a project slug when the task belongs to a `PROJECT.md`
|
||||
- tasks are intentionally basic seed work: title, markdown body, assignee, and optional recurrence
|
||||
- `recurring: true` marks the task as ongoing recurring work instead of a one-time starter task
|
||||
- tasks are intentionally basic seed work: title, markdown body, assignee, project linkage, and optional `recurring: true`
|
||||
- tools may also support optional fields like `priority`, `labels`, or `metadata`, but they should not require them in the base package
|
||||
|
||||
### Scheduling
|
||||
### Recurring Tasks
|
||||
|
||||
The scheduling model is intentionally lightweight. It should cover common recurring patterns such as:
|
||||
- the base package only needs to say whether a task is recurring
|
||||
- vendors may attach the actual schedule / trigger / runtime fidelity in a vendor extension such as `.paperclip.yaml`
|
||||
- this keeps `TASK.md` portable while still allowing richer runtime systems to round-trip their own automation details
|
||||
- legacy packages may still use `schedule.recurrence` during transition, but exporters should prefer `recurring: true`
|
||||
|
||||
- every 6 hours
|
||||
- every weekday at 9:00
|
||||
- every Monday morning
|
||||
- every month on the 1st
|
||||
- every first Monday of the month
|
||||
- every year on January 1
|
||||
|
||||
Suggested shape:
|
||||
Example Paperclip extension:
|
||||
|
||||
```yaml
|
||||
schedule:
|
||||
timezone: America/Chicago
|
||||
startsAt: 2026-03-14T09:00:00-05:00
|
||||
recurrence:
|
||||
frequency: hourly | daily | weekly | monthly | yearly
|
||||
interval: 1
|
||||
weekdays:
|
||||
- monday
|
||||
- wednesday
|
||||
monthDays:
|
||||
- 1
|
||||
- 15
|
||||
ordinalWeekdays:
|
||||
- weekday: monday
|
||||
ordinal: 1
|
||||
months:
|
||||
- 1
|
||||
- 6
|
||||
time:
|
||||
hour: 9
|
||||
minute: 0
|
||||
until: 2026-12-31T23:59:59-06:00
|
||||
count: 10
|
||||
routines:
|
||||
monday-review:
|
||||
triggers:
|
||||
- kind: schedule
|
||||
cronExpression: "0 9 * * 1"
|
||||
timezone: America/Chicago
|
||||
```
|
||||
|
||||
Rules:
|
||||
|
||||
- `timezone` should use an IANA timezone like `America/Chicago`
|
||||
- `startsAt` anchors the first occurrence
|
||||
- `frequency` and `interval` are the only required recurrence fields
|
||||
- `weekdays`, `monthDays`, `ordinalWeekdays`, and `months` are optional narrowing rules
|
||||
- `ordinalWeekdays` uses `ordinal` values like `1`, `2`, `3`, `4`, or `-1` for “last”
|
||||
- `time.hour` and `time.minute` keep common “morning / 9:00 / end of day” scheduling human-readable
|
||||
- `until` and `count` are optional recurrence end bounds
|
||||
- tools may accept richer calendar syntaxes such as RFC5545 `RRULE`, but exporters should prefer the structured form above
|
||||
- vendors should ignore unknown recurring-task extensions they do not understand
|
||||
- vendors importing legacy `schedule.recurrence` data may translate it into their own runtime trigger model, but new exports should prefer the simpler `recurring: true` base field
|
||||
|
||||
## 11. SKILL.md Compatibility
|
||||
|
||||
@@ -449,7 +411,7 @@ Suggested import UI behavior:
|
||||
- selecting an agent auto-selects required docs and referenced skills
|
||||
- selecting a team auto-selects its subtree
|
||||
- selecting a project auto-selects its included tasks
|
||||
- selecting a recurring task should surface its schedule before import
|
||||
- selecting a recurring task should make it clear that the import target is a routine / automation, not a one-time task
|
||||
- selecting referenced third-party content shows attribution, license, and fetch policy
|
||||
|
||||
## 15. Vendor Extensions
|
||||
@@ -502,6 +464,12 @@ agents:
|
||||
kind: plain
|
||||
requirement: optional
|
||||
default: claude
|
||||
routines:
|
||||
monday-review:
|
||||
triggers:
|
||||
- kind: schedule
|
||||
cronExpression: "0 9 * * 1"
|
||||
timezone: America/Chicago
|
||||
```
|
||||
|
||||
Additional rules for Paperclip exporters:
|
||||
@@ -520,7 +488,7 @@ A compliant exporter should:
|
||||
- omit machine-local ids and timestamps
|
||||
- omit secret values
|
||||
- omit machine-specific paths
|
||||
- preserve task descriptions and recurrence definitions when exporting tasks
|
||||
- preserve task descriptions and recurring-task declarations when exporting tasks
|
||||
- omit empty/default fields
|
||||
- default to the vendor-neutral base package
|
||||
- Paperclip exporters should emit `.paperclip.yaml` as a sidecar by default
|
||||
@@ -569,11 +537,11 @@ Paperclip can map this spec to its runtime model like this:
|
||||
- `TEAM.md` -> importable org subtree
|
||||
- `AGENTS.md` -> agent identity and instructions
|
||||
- `PROJECT.md` -> starter project definition
|
||||
- `TASK.md` -> starter issue/task definition, or automation template when recurrence is present
|
||||
- `TASK.md` -> starter issue/task definition, or recurring task template when `recurring: true`
|
||||
- `SKILL.md` -> imported skill package
|
||||
- `sources[]` -> provenance and pinned upstream refs
|
||||
- Paperclip extension:
|
||||
- `.paperclip.yaml` -> adapter config, runtime config, env input declarations, permissions, budgets, and other Paperclip-specific fidelity
|
||||
- `.paperclip.yaml` -> adapter config, runtime config, env input declarations, permissions, budgets, routine triggers, and other Paperclip-specific fidelity
|
||||
|
||||
Inline Paperclip-only metadata that must live inside a shared markdown file should use:
|
||||
|
||||
|
||||
@@ -48,7 +48,8 @@
|
||||
"guides/board-operator/managing-tasks",
|
||||
"guides/board-operator/approvals",
|
||||
"guides/board-operator/costs-and-budgets",
|
||||
"guides/board-operator/activity-log"
|
||||
"guides/board-operator/activity-log",
|
||||
"guides/board-operator/importing-and-exporting"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
203
docs/guides/board-operator/importing-and-exporting.md
Normal file
203
docs/guides/board-operator/importing-and-exporting.md
Normal file
@@ -0,0 +1,203 @@
|
||||
---
|
||||
title: Importing & Exporting Companies
|
||||
summary: Export companies to portable packages and import them from local paths or GitHub
|
||||
---
|
||||
|
||||
Paperclip companies can be exported to portable markdown packages and imported from local directories or GitHub repositories. This lets you share company configurations, duplicate setups, and version-control your agent teams.
|
||||
|
||||
## Package Format
|
||||
|
||||
Exported packages follow the [Agent Companies specification](/companies/companies-spec) and use a markdown-first structure:
|
||||
|
||||
```text
|
||||
my-company/
|
||||
├── COMPANY.md # Company metadata
|
||||
├── agents/
|
||||
│ ├── ceo/AGENT.md # Agent instructions + frontmatter
|
||||
│ └── cto/AGENT.md
|
||||
├── projects/
|
||||
│ └── main/PROJECT.md
|
||||
├── skills/
|
||||
│ └── review/SKILL.md
|
||||
├── tasks/
|
||||
│ └── onboarding/TASK.md
|
||||
└── .paperclip.yaml # Adapter config, env inputs, routines
|
||||
```
|
||||
|
||||
- **COMPANY.md** defines company name, description, and metadata.
|
||||
- **AGENT.md** files contain agent identity, role, and instructions.
|
||||
- **SKILL.md** files are compatible with the Agent Skills ecosystem.
|
||||
- **.paperclip.yaml** holds Paperclip-specific config (adapter types, env inputs, budgets) as an optional sidecar.
|
||||
|
||||
## Exporting a Company
|
||||
|
||||
Export a company into a portable folder:
|
||||
|
||||
```sh
|
||||
paperclipai company export <company-id> --out ./my-export
|
||||
```
|
||||
|
||||
### Options
|
||||
|
||||
| Option | Description | Default |
|
||||
|--------|-------------|---------|
|
||||
| `--out <path>` | Output directory (required) | — |
|
||||
| `--include <values>` | Comma-separated set: `company`, `agents`, `projects`, `issues`, `tasks`, `skills` | `company,agents` |
|
||||
| `--skills <values>` | Export only specific skill slugs | all |
|
||||
| `--projects <values>` | Export only specific project shortnames or IDs | all |
|
||||
| `--issues <values>` | Export specific issue identifiers or IDs | none |
|
||||
| `--project-issues <values>` | Export issues belonging to specific projects | none |
|
||||
| `--expand-referenced-skills` | Vendor skill file contents instead of keeping upstream references | `false` |
|
||||
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
# Export company with agents and projects
|
||||
paperclipai company export abc123 --out ./backup --include company,agents,projects
|
||||
|
||||
# Export everything including tasks and skills
|
||||
paperclipai company export abc123 --out ./full-export --include company,agents,projects,tasks,skills
|
||||
|
||||
# Export only specific skills
|
||||
paperclipai company export abc123 --out ./skills-only --include skills --skills review,deploy
|
||||
```
|
||||
|
||||
### What Gets Exported
|
||||
|
||||
- Company name, description, and metadata
|
||||
- Agent names, roles, reporting structure, and instructions
|
||||
- Project definitions and workspace config
|
||||
- Task/issue descriptions (when included)
|
||||
- Skill packages (as references or vendored content)
|
||||
- Adapter type and env input declarations in `.paperclip.yaml`
|
||||
|
||||
Secret values, machine-local paths, and database IDs are **never** exported.
|
||||
|
||||
## Importing a Company
|
||||
|
||||
Import from a local directory, GitHub URL, or GitHub shorthand:
|
||||
|
||||
```sh
|
||||
# From a local folder
|
||||
paperclipai company import ./my-export
|
||||
|
||||
# From a GitHub URL
|
||||
paperclipai company import https://github.com/org/repo
|
||||
|
||||
# From a GitHub subfolder
|
||||
paperclipai company import https://github.com/org/repo/tree/main/companies/acme
|
||||
|
||||
# From GitHub shorthand
|
||||
paperclipai company import org/repo
|
||||
paperclipai company import org/repo/companies/acme
|
||||
```
|
||||
|
||||
### Options
|
||||
|
||||
| Option | Description | Default |
|
||||
|--------|-------------|---------|
|
||||
| `--target <mode>` | `new` (create a new company) or `existing` (merge into existing) | inferred from context |
|
||||
| `--company-id <id>` | Target company ID for `--target existing` | current context |
|
||||
| `--new-company-name <name>` | Override company name for `--target new` | from package |
|
||||
| `--include <values>` | Comma-separated set: `company`, `agents`, `projects`, `issues`, `tasks`, `skills` | auto-detected |
|
||||
| `--agents <list>` | Comma-separated agent slugs to import, or `all` | `all` |
|
||||
| `--collision <mode>` | How to handle name conflicts: `rename`, `skip`, or `replace` | `rename` |
|
||||
| `--ref <value>` | Git ref for GitHub imports (branch, tag, or commit) | default branch |
|
||||
| `--dry-run` | Preview what would be imported without applying | `false` |
|
||||
| `--yes` | Skip the interactive confirmation prompt | `false` |
|
||||
| `--json` | Output result as JSON | `false` |
|
||||
|
||||
### Target Modes
|
||||
|
||||
- **`new`** — Creates a fresh company from the package. Good for duplicating a company template.
|
||||
- **`existing`** — Merges the package into an existing company. Use `--company-id` to specify the target.
|
||||
|
||||
If `--target` is not specified, Paperclip infers it: if a `--company-id` is provided (or one exists in context), it defaults to `existing`; otherwise `new`.
|
||||
|
||||
### Collision Strategies
|
||||
|
||||
When importing into an existing company, agent or project names may conflict with existing ones:
|
||||
|
||||
- **`rename`** (default) — Appends a suffix to avoid conflicts (e.g., `ceo` becomes `ceo-2`).
|
||||
- **`skip`** — Skips entities that already exist.
|
||||
- **`replace`** — Overwrites existing entities. Only available for non-safe imports (not available through the CEO API).
|
||||
|
||||
### Interactive Selection
|
||||
|
||||
When running interactively (no `--yes` or `--json` flags), the import command shows a selection picker before applying. You can choose exactly which agents, projects, skills, and tasks to import using a checkbox interface.
|
||||
|
||||
### Preview Before Applying
|
||||
|
||||
Always preview first with `--dry-run`:
|
||||
|
||||
```sh
|
||||
paperclipai company import org/repo --target existing --company-id abc123 --dry-run
|
||||
```
|
||||
|
||||
The preview shows:
|
||||
- **Package contents** — How many agents, projects, tasks, and skills are in the source
|
||||
- **Import plan** — What will be created, renamed, skipped, or replaced
|
||||
- **Env inputs** — Environment variables that may need values after import
|
||||
- **Warnings** — Potential issues like missing skills or unresolved references
|
||||
|
||||
Imported agents always land with timer heartbeats disabled. Assignment/on-demand wake behavior from the package is preserved, but scheduled runs stay off until a board operator re-enables them.
|
||||
|
||||
### Common Workflows
|
||||
|
||||
**Clone a company template from GitHub:**
|
||||
|
||||
```sh
|
||||
paperclipai company import org/company-templates/engineering-team \
|
||||
--target new \
|
||||
--new-company-name "My Engineering Team"
|
||||
```
|
||||
|
||||
**Add agents from a package into your existing company:**
|
||||
|
||||
```sh
|
||||
paperclipai company import ./shared-agents \
|
||||
--target existing \
|
||||
--company-id abc123 \
|
||||
--include agents \
|
||||
--collision rename
|
||||
```
|
||||
|
||||
**Import a specific branch or tag:**
|
||||
|
||||
```sh
|
||||
paperclipai company import org/repo --ref v2.0.0 --dry-run
|
||||
```
|
||||
|
||||
**Non-interactive import (CI/scripts):**
|
||||
|
||||
```sh
|
||||
paperclipai company import ./package \
|
||||
--target new \
|
||||
--yes \
|
||||
--json
|
||||
```
|
||||
|
||||
## API Endpoints
|
||||
|
||||
The CLI commands use these API endpoints under the hood:
|
||||
|
||||
| Action | Endpoint |
|
||||
|--------|----------|
|
||||
| Export company | `POST /api/companies/{companyId}/export` |
|
||||
| Preview import (existing company) | `POST /api/companies/{companyId}/imports/preview` |
|
||||
| Apply import (existing company) | `POST /api/companies/{companyId}/imports/apply` |
|
||||
| Preview import (new company) | `POST /api/companies/import/preview` |
|
||||
| Apply import (new company) | `POST /api/companies/import` |
|
||||
|
||||
CEO agents can also use the safe import routes (`/imports/preview` and `/imports/apply`) which enforce non-destructive rules: `replace` is rejected, collisions resolve with `rename` or `skip`, and issues are always created as new.
|
||||
|
||||
## GitHub Sources
|
||||
|
||||
Paperclip supports several GitHub URL formats:
|
||||
|
||||
- Full URL: `https://github.com/org/repo`
|
||||
- Subfolder URL: `https://github.com/org/repo/tree/main/path/to/company`
|
||||
- Shorthand: `org/repo`
|
||||
- Shorthand with path: `org/repo/path/to/company`
|
||||
|
||||
Use `--ref` to pin to a specific branch, tag, or commit hash when importing from GitHub.
|
||||
Reference in New Issue
Block a user