agentfiles
Sync AI tool configurations for OpenCode
pip install agentfiles
agentfiles is a CLI that keeps your OpenCode AI coding assistant configurations — agents, skills, commands, and plugins — in sync. Treat a source repository as the single source of truth and propagate changes to your local OpenCode config.
Why?
You manage OpenCode agents, skills, commands, and plugins across multiple machines or projects. agentfiles lets you maintain one repository and sync everywhere:
source repo ──────── OpenCode (~/.config/opencode/)
(agents/skills/
commands/plugins)
Features
- OpenCode support — agents, skills, commands, plugins, configs, and workflows
- Bidirectional sync — pull and push with conflict detection
- Surgical filtering —
--only,--except,--type,--item agent/coder,--scope - PR creation —
push --create-prto auto-create a pull request viagh - Smart cloning — shallow clone + sparse checkout for remote sources
- Dry-run — preview changes without applying
- Diagnostics —
doctor,verify(CI drift detection), shell completions - One dependency —
pyyamlonly
Quick Start
pip install agentfiles
# Initialize a new repository
agentfiles init
# Pull to OpenCode
agentfiles pull /path/to/source-repo
# Pull only agents
agentfiles pull --type agent
# Preview without applying
agentfiles pull --dry-run
Commands
| Command | Description |
|---|---|
pull |
Install/update items from source to local OpenCode config |
push |
Push local items back to source (with conflict detection) |
status |
Show installed items (--list, --diff) |
clean |
Remove orphaned items |
init |
Scaffold a new repository |
verify |
CI-friendly drift detection (exit 1 if drift) |
doctor |
Run environment diagnostics |
completion |
Generate shell completion scripts |
pull
Install or update items from a source repository to your local OpenCode config.
agentfiles pull # interactive (default)
agentfiles pull --yes # non-interactive
agentfiles pull --update # git pull source, then sync
agentfiles pull --type agent # only agents
agentfiles pull --only coder,solid-principles # specific items
agentfiles pull --item agent/coder # single item by key
agentfiles pull --dry-run --verbose # preview with details
agentfiles pull --symlinks # use symlinks instead of copies
agentfiles pull --full-clone # disable shallow clone optimization
agentfiles pull --scope global # only global-scope items
agentfiles pull --scope project --project-dir . # project-scope items to current dir
push
Push locally-installed items back into the source repository. Useful when you've edited configs on one machine and want to propagate.
agentfiles push # interactive (with conflict detection)
agentfiles push --yes # non-interactive (skips conflicts)
agentfiles push --dry-run # preview
agentfiles push --item agent/coder # push a single item
agentfiles push --create-pr # auto-create PR via gh
agentfiles push --create-pr --pr-title "Update agents" --pr-branch my-branch
status
Show installed-item information. Supports two sub-modes via flags:
--list— list items available in the source repository--diff— compare source vs installed items
agentfiles status # show overview
agentfiles status --format json # JSON output
# --list mode: list source items
agentfiles status --list # text table
agentfiles status --list --tokens # include token estimates
agentfiles status --list --format json # machine-readable
# --diff mode: compare source vs installed
agentfiles status --diff # show differences
agentfiles status --diff --verbose # content-level diffs
agentfiles status --diff --format json # machine-readable
clean
Remove installed items whose source no longer exists in the repository.
agentfiles clean --dry-run # preview
agentfiles clean --yes # non-interactive
init
Scaffold a new agentfiles repository with agents/, skills/, commands/, plugins/ directories and a .agentfiles.yaml config.
agentfiles init # current directory
agentfiles init /path/to/project # specific directory
agentfiles init --yes # skip confirmation
verify
CI-friendly drift detection. Compares source vs installed items, exits 0 if in sync, 1 if drift detected.
agentfiles verify # human-readable output
agentfiles verify --format json # machine-readable
agentfiles verify --quiet # silent, exit code only
doctor
Run environment diagnostics — checks config, source dir, git, platform directory, state file, and tool binaries.
agentfiles doctor
completion
Generate shell completion scripts.
agentfiles completion bash # bash completions
agentfiles completion zsh # zsh completions
agentfiles completion fish # fish completions
# Example: add to .bashrc
eval "$(agentfiles completion bash)"
Global Options
--color {always,auto,never} Color output control (respects NO_COLOR/FORCE_COLOR)
--verbose, -v Verbose output
--quiet, -q Quiet mode (errors only)
--version Show version
Filter Options
Most commands support surgical filtering:
--type {agent,skill,command,plugin,config,workflow,all} Item type
--only coder,solid-principles Only these items (by name)
--except old-plugin,deprecated Exclude these items
--item agent/coder Specific item by type/name key
--scope {global,project,local,all} Filter by scope
Source Repository Structure
my-agents/
├── agents/
│ ├── coder/
│ │ └── coder.md # YAML frontmatter + prompt
│ └── debugger/
│ └── debugger.md
├── skills/
│ ├── solid-principles/
│ │ ├── SKILL.md
│ │ └── references/
│ └── dry-principle/
│ └── SKILL.md
├── commands/
│ └── autopilot/
│ └── autopilot.md
├── plugins/
│ └── patterns.yaml
├── configs/
│ └── global-settings.yaml
├── workflows/
│ └── deploy-pipeline/
│ └── workflow.md
└── .agentfiles.yaml # Config (auto-generated)
Supported Platform
| Platform | Config path | Agents | Skills | Commands | Plugins | Configs | Workflows |
|---|---|---|---|---|---|---|---|
| OpenCode | ~/.config/opencode/ |
✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
Architecture
graph LR
A["Source Resolution<br/><code>source.py</code>"] --> B["Scanner<br/><code>scanner.py</code>"]
B --> C["Differ<br/><code>differ.py</code>"]
C --> D["Engine<br/><code>engine.py</code>"]
D --> E["SyncResult[]"]
E --> F["SyncReport"]
G["Target<br/><code>target.py</code>"] --> C
H["Config<br/><code>config.py</code>"] --> D
| Module | Purpose |
|---|---|
source.py |
Resolve user input → local directory (local dir, git URL, git clone) |
scanner.py |
Walk source dirs → list[Item] |
differ.py |
Compare source vs installed: existence → metadata → SHA-256 |
engine.py |
Plan actions (INSTALL/UPDATE/SKIP) → execute → collect results |
target.py |
Discover OpenCode config directory, manage installed items |
config.py |
YAML config + sync-state persistence |
cli.py |
Argparse CLI with all subcommands |
CI Pipeline
graph TD
Lint["ruff check + format"] --> Gate{"CI Gate"}
TypeCheck["mypy strict"] --> Gate
Security["bandit"] --> Gate
Test["pytest × 4 Pythons"] --> Gate
Gate -->|on Release| Publish["PyPI Publish"]
Extending
Add a new item type:
- Add
ItemTypeenum value inmodels.py - Write a scanner function in
scanner.py - Register via
_register_scanner()
No other modules need changes (Open/Closed Principle).
Development
# Install with dev dependencies
uv sync --dev
# Lint & format
uv run ruff check src/ tests/
uv run ruff format --check src/ tests/
# Type check
uv run mypy src/
# Security scan
uv run bandit -r src/ -c pyproject.toml
# Test
uv run pytest tests/ -v
# Test with coverage
uv run pytest tests/ -v --cov=agentfiles --cov-report=term-missing
# Build package
uv run python -m build
License
Metadata
Release files for agentfiles 0.5.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| agentfiles-0.5.4.tar.gz | 199.3 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| agentfiles-0.5.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 310.2 kB
Release files / agentfiles-0.5.4.tar.gz
| Download URL | agentfiles-0.5.4.tar.gz |
|---|---|
| Size | 199.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f56c9758f8a74d5cdc17de6b11171eaf48072477b15e62795b8f180d91ebe706
|
|
BLAKE2b-256 checksum How to use checksums |
b72689692166e88825f6f6ea22c1865f1fbe606f34fecee7ec817c7e329467b8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 4, 2026.
Transparency logRelease files / agentfiles-0.5.4-py3-none-any.whl
| Download URL | agentfiles-0.5.4-py3-none-any.whl |
|---|---|
| Size | 110.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
eaea00101670f57f24308a424011883ca9e6546d0a451328e31f138207805dab
|
|
BLAKE2b-256 checksum How to use checksums |
bfa154cb6b77642eaaa913a51a5901da6c2bdfcefd092138798db23ce940a453
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 4, 2026.
Transparency logSecurity for agentfiles 0.5.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for agentfiles-0.5.4.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 4, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.