跳到正文
GitHub·· 6 天前AI 评分65

agentpack 发布:用一份清单跨 Claude Code、Cursor、Codex 等六个编码智能体同步技能与插件

OlegHQ/agentpack

AI 导读

agentpack 是一个面向 AI 编码智能体的包管理器,通过 agentpack.toml 声明依赖,解析到精确 commit 并写入 pack.lock 锁文件,再按各智能体的原生格式重新渲染后启动 Claude Code、Cursor、OpenCode、Codex、Grok 和 Antigravity。

正文

The package manager for AI coding agents

Pin, resolve, and sync skills & plugins across Claude Code, Cursor, OpenCode, Codex, Grok, and Antigravity — from one manifest.

Documentation Writeup MIT License Version Built with Go

Documentation · Writeup · Quick Start · How It Works · CLI Reference

brew install --cask OlegHQ/tap/agentpack

Prefer a prebuilt binary or source build? See all install options.


The Problem

Every coding agent manages skills, plugins, commands, and rules its own way — different file layouts, config formats, and discovery rules. Run more than one agent, or share a curated toolset across a team, and you end up pasting the same files into each agent's config by hand and watching the copies drift apart. There's no lockfile to say which version everyone is actually on.

What agentpack Does

Declare your agent dependencies once in agentpack.toml. agentpack resolves them to exact commits, pins those in a lockfile, caches the content, re-renders each artifact into the target agent's native format, and launches the agent with everything staged. Your repo stays clean: nothing is copied into it, and nothing is written to your global agent config. Portable external environments can keep the manifest and lock outside the checkout (env / --env / preflight / probe); see the environments docs.

agentpack.toml  ──>  pack.lock  ──>  staged bundles  ──>  launch
   (you write)        (pinned)        (per-harness)        (agent runs)

Install

Prebuilt binaries are published for every release. Pick whichever fits your platform.

Installer script

macOS and Linux:

curl --proto '=https' --tlsv1.2 -LsSf https://github.com/OlegHQ/agentpack/releases/latest/download/agentpack-installer.sh | sh

Windows PowerShell:

irm https://github.com/OlegHQ/agentpack/releases/latest/download/agentpack-installer.ps1 | iex

Both installers write only the executable to $HOME/.local/bin by default. They do not edit shell profiles or the user PATH; use AGENTPACK_INSTALL_DIR to select another userspace directory.

Homebrew — macOS & Linux (recommended)

brew install --cask OlegHQ/tap/agentpack

Upgrade with brew upgrade --cask agentpack. Served from the shared tap OlegHQ/homebrew-tap (brew tap OlegHQ/tap && brew install --cask agentpack also works).

Prebuilt binaries

Download an archive for your platform from the latest release, extract it, and put agentpack on your PATH. Supported targets:

Platform Target
macOS (Apple Silicon) darwin_arm64
macOS (Intel) darwin_amd64
Linux (x86-64) linux_amd64
Linux (ARM64) linux_arm64
Windows (x86-64) windows_amd64

Each release includes a SHA-256 checksums.txt covering every archive.

From source

go install ./cmd/agentpack
# or
make install   # release build to ~/.local/bin (override: make install INSTALL_DIR=/usr/local/bin)

Prerequisites (source builds only): Go 1.26 or newer.

Quick Start

# Initialize agentpack in your project
agentpack init

# Add a skill from GitHub (resolves, locks, and syncs in one step)
agentpack add anthropics/skills/skills/canvas-design

# Pin to a branch, tag, or commit with an @ref, or edit the entry to a table like { version = "^1.0.0" }
agentpack add anthropics/claude-plugins-official/plugins/hookify@main

# Launch Claude Code with everything bundled
agentpack claude

# Or launch any other agent
agentpack agent     # Cursor Agent (alias: cursor-agent)
agentpack opencode  # OpenCode
agentpack codex     # Codex
agentpack grok      # Grok
agentpack agy       # Antigravity

Experimental Claude Proxy Mode

agentpack --proxy claude starts Claude Code through an experimental, supervised Anthropic-compatible proxy backed by OpenAI/Codex credentials. The proxy is started for that Claude session, ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN are injected into the child process, and the proxy is shut down when Claude exits.

agentpack --proxy claude

Authentication is resolved from OPENAI_API_KEY first, then from Codex auth (~/.codex/auth.json, the Codex keychain entry, or agentpack's shared Codex auth file). The Go proxy core follows the Codex/OpenAI path in raine/claude-code-proxy; thanks to @raine for the original project and reference behavior.

Proxy diagnostics are written as JSONL under $AGENTPACK_HOME/projects/<project-hash>/proxy-logs/ by default. Set AGENTPACK_PROXY_LOG_DIR to override the directory. Logs omit request payloads unless AGENTPACK_PROXY_LOG_PAYLOADS=1 is set.

How It Works

  1. agentpack.toml — Declare dependencies (GitHub repos, subdirectories, single-plugin marketplace repos, or local paths) with version constraints.
  2. pack.lock — Deterministic lockfile pins every package to an exact commit and a content hash of its file tree, and records what each MCP server runs.
  3. sync — Downloads, caches, verifies the cache against the lock, and converts artifacts into per-harness staging directories.
  4. Launchers — agentpack claude, agent, opencode, codex, grok, agy each start the target agent with the staged bundle injected via that agent's native extension mechanism.

Cross-Harness Artifact Conversion

agentpack does not just copy files — it parses each artifact and re-renders it in the target format:

Source artifact Claude Code Cursor OpenCode Codex
Commands Claude frontmatter Plain markdown OpenCode frontmatter Skill fallback
Agents Claude agent MD Cursor agent MD OpenCode agent MD Skill fallback
Skills Normalized skill Normalized skill Normalized skill Codex skill
Rules Skill fallback .mdc preserved Skill fallback Skill fallback

Grok mirrors Claude's command/agent formats; Antigravity preserves rules natively like Cursor. See the conversion guide for the full matrix.

Manifest Example

name = "my-project"
version = "0.1.0"

[dependencies]
"github.com/anthropics/skills/skills/canvas-design" = { branch = "main" }
"github.com/anthropics/claude-plugins-official/plugins/hookify" = { branch = "main" }
"github.com/my-org/internal-tools/skills/deploy" = { tag = "v2.1.0" }

[modes.default]
base = "all"
disable = ["package-path:github.com/my-org/internal-tools/skills/deploy:commands/noise.md"]

[modes.design]
base = "all"
disable = ["mcp:filesystem"]

Key Features

  • One manifest, six agents — Write agentpack.toml once; launch Claude, Cursor, OpenCode, Codex, Grok, or Antigravity with the same skill set.
  • Deterministic lockfile — pack.lock pins every package, direct and transitive, to an exact commit and content hash, so resolution matches across machines and CI.
  • Verified on every use — The cache is re-hashed against the lock before anything is staged; a changed file stops sync and the launchers, and sync --repair re-fetches the pinned commit.
  • MCP servers in the lock — npx-style servers are resolved to an exact version and staged as that version; other launchers are recorded with an explicit pinned / unpinned / unpinnable status.
  • Transitive resolution — A package can declare its own agentpack.toml; agentpack walks the full graph and resolves conflicts.
  • Shared cache — Each package is fetched once into $AGENTPACK_HOME/cache/<cache_key>/, keyed by repository, path and commit, and shared by every project on the machine.
  • No workspace pollution — Pack content stays in staging trees outside your repo, and never symlinks into your real ~/.claude or ~/.cursor.
  • Resilient resolution — Cached metadata and a local/ mirror cut network calls; when the GitHub REST API is throttled, agentpack falls back to the Git protocol.
  • Fast launch path — When the manifest, lock, and ./.agents/ are unchanged, launchers verify staging and skip the full re-sync.
  • Project-local modes — agentpack --mode <name> enables or disables packages, individual files, and MCP servers per task.

Comparison

Feature agentpack Manual copy Symlinks Git submodules
Multi-agent support Claude, Cursor, OpenCode, Codex, Grok, Antigravity One at a time One at a time One at a time
Version pinning Semver, branch, tag, commit None None Commit only
Transitive deps Yes No No Manual
Artifact conversion Automatic per-harness Manual No No
Cache / dedup Per commit, content-verified None N/A Partial
Workspace isolation Full (staging dirs) Files in repo Symlinks in repo Dirs in repo
Lockfile Deterministic None None .gitmodules

Commands

Command Description
init Create agentpack.toml and pack.lock in the current project
add <spec> Add a dependency, resolve, lock, and sync
remove <spec> Remove a dependency and re-sync
lock Resolve manifest and regenerate pack.lock (--update advances floating pins)
sync Download, cache, and rebuild staging for all harnesses
mode ... Create, inspect, edit, and manage project-local modes
mcp ... Add, remove, and list MCP servers
extra sync-claude Reconcile local skills between .claude/skills and .agents/skills
claude Sync + launch Claude Code with --plugin-dir
agent Sync + launch Cursor Agent with staged HOME (alias: cursor-agent)
opencode Sync + launch OpenCode with OPENCODE_CONFIG_DIR
codex Sync + launch Codex with CODEX_HOME
grok Sync + launch Grok with GROK_HOME
agy Sync + launch Antigravity with the project as a workspace dir
completion <shell> Generate Bash, Zsh, Fish, or PowerShell completions

Redirected harness homes do not make resume history temporary: Codex history is shared with ~/.codex, Grok sessions with ~/.grok/sessions, and legacy temp-staging history is imported on upgrade without overwriting native files.

Documentation

Full docs live at https://oleghq.github.io/agentpack — getting started, core concepts (manifest, lockfile, resolution, cache, staging, modes, MCP), a guide per harness, and a complete CLI / manifest / environment reference.

The book source is in docs/. To preview changes locally, install mdbook and run:

mdbook serve docs   # http://localhost:3000

For internals, AGENTS.md is the contributor-facing source of truth: data layout, staging internals, per-harness mechanics, and the lockfile format.

Releasing (maintainers)

Releases are automated by GoReleaser: pushing a v* tag triggers .github/workflows/release.yml, which builds per-platform binaries (macOS arm64/x86_64, Linux x86_64/arm64, Windows x86_64), creates archives and checksums, publishes the GitHub Release, and pushes the generated Homebrew cask to OlegHQ/homebrew-tap.

Goal Command
Bump minor + tag + push (→ CI release) make ship-minor
Bump patch + tag + push (→ CI release) make ship-patch
Bump version only (no release) make minor / make patch

Requires a repo secret HOMEBREW_TAP_TOKEN (a PAT with write access to OlegHQ/homebrew-tap) so CI can push the cask across repos.

License

MIT — see LICENSE.

For the research artifact, see the evaluation fixtures and demo storyboard and contract/evidence reference. Native discovery evidence is scoped; package integrity, generated configuration, and model behavior are separate claims.

来源:GitHub · github.com