Skip to main content

Sync AI tool configurations (agents, skills, commands, plugins) for OpenCode

Project description

agentfiles

Sync AI tool configurations for OpenCode

PyPI Python Versions CI Ruff mypy: strict Bandit License: MIT

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 creationpush --create-pr to auto-create a pull request via gh
  • Smart cloning — shallow clone + sparse checkout for remote sources
  • Dry-run — preview changes without applying
  • Diagnosticsdoctor, verify (CI drift detection), shell completions
  • One dependencypyyaml only

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:

  1. Add ItemType enum value in models.py
  2. Write a scanner function in scanner.py
  3. 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

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

agentfiles-0.5.3.tar.gz (199.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

agentfiles-0.5.3-py3-none-any.whl (110.9 kB view details)

Uploaded Python 3

File details

Details for the file agentfiles-0.5.3.tar.gz.

File metadata

  • Download URL: agentfiles-0.5.3.tar.gz
  • Upload date:
  • Size: 199.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for agentfiles-0.5.3.tar.gz
Algorithm Hash digest
SHA256 9028a86f48fded746859c27913aa650fb0821863275fa1609fece03859238811
MD5 114b11cc9c4eeaa714b87a0d9b3657d2
BLAKE2b-256 5d28f1275cfb487ed8d81d68d0e071248aad26cfe3ab9a13706a32f759f0f866

See more details on using hashes here.

Provenance

The following attestation bundles were made for agentfiles-0.5.3.tar.gz:

Publisher: publish.yml on svetlovtech/agentfiles

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file agentfiles-0.5.3-py3-none-any.whl.

File metadata

  • Download URL: agentfiles-0.5.3-py3-none-any.whl
  • Upload date:
  • Size: 110.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for agentfiles-0.5.3-py3-none-any.whl
Algorithm Hash digest
SHA256 45eb76dae63e63fd0ecbde42f6a32bbf45b9f529323dcaa9a6e85420a49ed0e2
MD5 c35b2369d5f9e5245ba4b0f5ea50f792
BLAKE2b-256 af7df792121ffe394030574d6c74e1457ad5557dd4f45e9c7983e1dbd3526e20

See more details on using hashes here.

Provenance

The following attestation bundles were made for agentfiles-0.5.3-py3-none-any.whl:

Publisher: publish.yml on svetlovtech/agentfiles

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page