Skip to main content

AgentSquire

A reusable Python library + CLI that lets a Python package carry its own agent integrations (Agent Skills) and install them into whatever agent harness is present - the executable is the framework.

Your CLI ships its skills as package data inside its own wheel, adds agentsquire as a plain pip dependency, and mounts a ready-made subcommand group. Your users only ever see your tool:

$ awiki skills install
installed awiki-search -> /home/you/.claude/skills/awiki-search

Supported harnesses at launch: Claude Code, pi, Hermes, and opencode. Detection is by marker directory; every operation is local (no network in any verb). Each harness's directories, scopes, and behaviour are recorded in docs/harnesses.md.

Installation

pip install agentsquire

This installs the library and its own CLI, squire (aliased agentsquire). As a consumer you normally add agentsquire to your package's dependencies rather than having users install it directly - it rides in your wheel, and your users only ever see your tool.

agentsquire dogfoods its own contract: it carries the developing-with-agentsquire skill and its reference docs as package data. When you build an app on agentsquire, install that skill into your own agent harness so the harness has the integration know-how on hand while it works:

squire skills install

That copies developing-with-agentsquire (how to ship skills, mount the group, and wire the staleness hook) into every detected harness. The same reference docs are served at the terminal from the installed wheel - no checkout needed:

squire guide              # topics: api, harnesses, integration
squire guide api          # the Python API reference
squire guide integration  # this consumer integration guide

From source

Clone the repository and install it into your environment:

git clone https://github.com/TacoTakumi/AgentSquire.git
cd AgentSquire
pip install .

Add -e (pip install -e .) for an editable install if you plan to work on agentsquire itself. The repo uses uv: uv sync provisions a dev environment and uv run pytest runs the test suite.

Consumer integration guide

1. Ship skills as package data

Lay each skill out as a directory containing a SKILL.md (the agentskills.io format) under a skills/ resource inside your importable package:

your_pkg/
    __init__.py
    skills/
        my-skill/
            SKILL.md
            reference.md

The skills ride inside your wheel; make sure your build backend includes package data (hatchling includes it by default, setuptools needs include-package-data). No source checkout is needed at run time - skills are enumerated straight from the installed wheel.

2. Mount the subcommand group

One call returns a click group with install, status, update, and uninstall subcommands, parameterized by your package name, the resource path (default "skills"), and the default scope.

For a click CLI:

import click

from agentsquire.cli import skills_command_group


@click.group()
def cli():
    """Your CLI."""


cli.add_command(skills_command_group("your_pkg", default_scope="user"))

For a typer CLI, mount onto the underlying click command:

import typer
import typer.main

from agentsquire.cli import skills_command_group

app = typer.Typer()


@app.callback()
def main():
    """Your CLI."""


cli = typer.main.get_command(app)
cli.add_command(skills_command_group("your_pkg", default_scope="user"))

Your users now run your-cli skills install and friends. Every subcommand takes --scope user|project (overriding your declared default) and --harness NAME (default: all detected harnesses).

Choosing the default scope: user installs into the harness's per-user skills directory and follows the user everywhere - right for general-purpose tools. project installs into the current project's directory - right for skills that only make sense inside a repository that uses your tool.

3. Surface updates proactively (optional)

Place the one-call staleness hook at your CLI entry point. When installed skills have updates available it prints a single advisory line on stderr, for example:

your-cli: a skills update is available for 1 skill (alpha); run `your-cli skills update`

The hook is notice-only: it never prompts, never reads stdin, and never updates anything itself - the explicit skills update verb stays the sole updater. It writes nothing to stdout, never changes your exit code, and swallows its own errors, so it can never break the command it runs inside:

from agentsquire import check_stale, default_source


def main():
    check_stale(
        default_source("your_pkg"),
        prog_name="your-cli",
        update_command="your-cli skills update",
    )
    # ... the rest of your entry point

default_source("your_pkg") is the same source the skills subcommands use by default: your package-data skills plus, when you ship them, your repo-level skills (section 5). The notice therefore covers every skill your CLI installs.

The notice shows unless a suppression gate holds: CI set to a non-empty value, or AGENTSQUIRE_NO_UPDATE_CHECK set to a non-empty value. It is not gated on an interactive terminal - it fires on non-TTY stderr too, so an agent harness that runs your CLI with captured stderr still sees that an update is available. Suppression is presence-disables, the NO_COLOR convention: any non-empty value disables the notice (CI=false and AGENTSQUIRE_NO_UPDATE_CHECK=0 both suppress), while an empty string is treated as unset.

4. Mark your package as skill-carrying (optional)

One pyproject line registers your package under the agentsquire.skills entry-point group. Nothing reads it today - it is reserved for a future environment-wide listing of skill-carrying packages and changes no behaviour:

[project.entry-points."agentsquire.skills"]
your_pkg = "your_pkg"

5. Ship repo-level skills from your repo root (optional)

Skills can also live at your repo root - in a top-level skills/ directory outside your importable package - and still ship to your users. This suits skills that are developed and used from the repository itself. agentsquire resolves the union of your package-data skills (Root A, section 1) and these repo-level skills (Root B), so skills install and friends see both.

Root B resolves wheel-first then checkout: in a built wheel it is read from a fixed in-package location your_pkg/_repo_skills; in an editable checkout it is read straight from <repo>/skills (found by walking up to the first directory with a pyproject.toml and a skills/ subdir). To copy the repo-root skills/ into your wheel at that location, add this single force-include line to your pyproject:

[tool.hatch.build.targets.wheel.force-include]
"skills" = "your_pkg/_repo_skills"

This is the only packaging change agentsquire requires: agentsquire ships no build-hook plugin and adds no build-time dependency to your project.

Monorepo note: the walk does not stop at your package's own project directory. If that directory has no skills/ subdir and a directory above it has both a pyproject.toml and a skills/ subdir (for example the top level of a monorepo), your package resolves that higher skills/ as its Root B in a checkout. The risk is bounded: the packaged your_pkg/_repo_skills copy is always tried first, so the walk decides the result only in a checkout, never in a built wheel. To prevent it, give the sub-package its own skills/ directory (one that holds only a .gitkeep is enough).

The two roots must be disjoint - a skill name present in both roots is a packaging mistake, not an override, and raises DuplicateSkillError. Enforce it in your test suite in one line (it runs wherever agentsquire is already a runtime dependency, so it protects editable installs too, where a build hook cannot run):

from agentsquire import verify_skill_roots


def test_skill_roots_are_disjoint():
    verify_skill_roots("your_pkg")

Optional completeness guard: force-include copies the directory, but a stray ignore rule could still drop a skill from the wheel. To fail the build loudly if that ever happens, drop this self-contained hatch_build.py beside your pyproject and point hatchling at it:

[tool.hatch.build.targets.wheel.hooks.custom]
path = "hatch_build.py"
# hatch_build.py - force-include every repo-root skill and fail the build if the
# skills/ directory has been dropped or emptied. Self-contained; not an
# agentsquire dependency.
from pathlib import Path

from hatchling.builders.hooks.plugin.interface import BuildHookInterface


class CustomBuildHook(BuildHookInterface):
    def initialize(self, version, build_data):
        skills = Path(self.root) / "skills"
        if not skills.is_dir():
            raise ValueError("hatch_build.py: repo-root skills/ is missing")
        found = [d for d in sorted(skills.iterdir()) if d.is_dir()]
        if not found:
            raise ValueError("hatch_build.py: repo-root skills/ has no skills")
        force_include = build_data.setdefault("force_include", {})
        for skill in found:
            force_include[str(skill)] = f"your_pkg/_repo_skills/{skill.name}"

agentsquire never wires itself into your build: the completeness hook is your own optional file, and the force-include line above is the only mandatory change.

6. Tell users about a new release of your CLI (optional)

Sections 1 to 5 are about your skills. This one is about your package itself: agentsquire can tell your users that a newer release of your CLI is on PyPI. It has two parts, a startup notice and an explicit check-update command:

import click

from agentsquire import check_update_command, notify_update
from your_pkg import __version__


@click.group(name="your-cli")
def cli():
    """Your CLI."""


cli.add_command(check_update_command("your-dist", __version__, prog_name="your-cli"))


def main():
    notify_update("your-dist", __version__, prog_name="your-cli")
    cli()

notify_update is the startup notice. It reads a small cache file and compares the version in it with your version. It makes no network request, so it adds no delay and works offline. When the cache holds a newer release it prints one line on stderr:

your-cli: a new release is available: 1.2.3 -> 1.3.0; run `uv tool upgrade your-dist`

check_update_command builds the your-cli check-update command. Only this command asks PyPI: it makes one request, prints one line with the result and records the newest version in the cache. The startup notice then stays on each run until the user upgrades. A user who never runs check-update gets no notice, because nothing wrote the cache.

To run the same check from Python, for example from a doctor command, call check_for_update("your-dist", __version__). It returns a ReleaseCheck with the installed version, the newest version, a ReleaseStatus and the upgrade command. It never raises: a failed request is a result with the status check-failed and a one-line reason.

What to know:

  • Pass the PyPI distribution name (your-dist above), the name a user gives to pip install. It can differ from the import name (your_pkg).
  • Pass your own __version__. Without it agentsquire reads the version from the install metadata, and an editable install reports a frozen version there: the one from the day of the install.
  • CI or AGENTSQUIRE_NO_UPDATE_CHECK, set to a non-empty value, turns the startup notice off. It does not turn check-update or check_for_update off, because the user asked for that check.
  • The upgrade command (uv tool upgrade your-dist or pipx upgrade your-dist) is in the line only when your CLI runs from a uv tool install or a pipx install. For any other install, and for an editable checkout, the line has no command.
  • Nothing is upgraded. Both parts report only; the user runs the upgrade.
  • Like the staleness hook, notify_update writes nothing to stdout, never changes your exit code and swallows its own errors.

The details are in the "Release check" section of docs/api.md.

The provenance and update model

Installs are plain copies - no symlinks, no lockfile, no references back into site-packages - so an installed skill survives upgrade or removal of your package. Each installed SKILL.md carries a provenance stamp in its frontmatter metadata.agentsquire map: installer, installer_version, source_package, source_version, and content_hash. The skill body is byte-identical to what you shipped.

status classifies every skill by local hash compares only (no network, ever): not-installed, up-to-date, update-available (your shipped copy moved on), or locally-modified (the user edited the install, the directory carries no stamp, or a symlink sits at the target - none of them ours to touch). update refreshes update-available skills and skips locally modified ones unless --force is given; uninstall removes only directories whose stamp names your package. User content is never silently overwritten or deleted - a pre-existing symlink at a target (a common hand-wired setup) is reported and skipped, never followed or clobbered.

Python API

Everything the CLI group does is available as plain Python - enumerate, detect, install, status, update, uninstall, and the staleness check - with no CLI involved. See docs/api.md for the reference.

License

MIT.

Metadata

Release files for agentsquire 0.6.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for agentsquire 0.6.1
File Size Uploaded Provenance Actions
agentsquire-0.6.1.tar.gz 115.5 kB Without provenance Details for agentsquire-0.6.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for agentsquire 0.6.1
File Interpreter ABI Platform Actions
agentsquire-0.6.1-py3-none-any.whl Python 3 none any Details for agentsquire-0.6.1-py3-none-any.whl

Total release size: 177.1 kB

Release files / agentsquire-0.6.1.tar.gz

Download URL agentsquire-0.6.1.tar.gz
Size 115.5 kB
Tags Source
SHA-256 checksum
How to use checksums
d747ec5bbd002a022b6584d6001f17c49b99ea79f2d27a3e07e258f7030ee7e4
BLAKE2b-256 checksum
How to use checksums
6e32ee658574d3f2fb968eb11218ca3f4ea673995b2812f2c775b8d157e816ee
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / agentsquire-0.6.1-py3-none-any.whl

Download URL agentsquire-0.6.1-py3-none-any.whl
Size 61.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7fabc900078e795157f5dae38f0b8fcb0b3e9f0c98fa2c6bf09347d7ce86347c
BLAKE2b-256 checksum
How to use checksums
8de040762583ece59075b2dbfd78a3a56f7a3b4c16a5a2389ffd805727172fff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Security for agentsquire 0.6.1

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page