npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

compose-agentsmd

v3.2.7

Published

CLI tools for composing per-project AGENTS.md files from modular rule sets

Readme

Compose AGENTS.md

This repository contains CLI tooling for composing per-project AGENTS.md files from modular rule sets.

Release notes

See CHANGELOG.md for release notes.

It is intended to be used together with shared rule modules such as the public agent-rules repository.

Install (global CLI)

After publishing to npm, install globally:

npm install -g compose-agentsmd

This provides the compose-agentsmd command.

Rules setup (this repository)

The default ruleset for this repository is agent-ruleset.json and currently composes the node domain into AGENTS.md from the shared GitHub source.

Compose

From each project root, run:

compose-agentsmd

The tool reads agent-ruleset.json from the given root directory (default: current working directory), and writes the output file specified by the ruleset. If output is omitted, it defaults to AGENTS.md.

The tool prepends a small "Tool Rules" block to every generated AGENTS.md so agents know how to regenerate or update rules. Each composed rule section is also prefixed with the source file path that produced it.

When the output file is AGENTS.md, the CLI also prints a unified diff for AGENTS.md when it changes (and prints AGENTS.md unchanged. when it does not). This works even when the project is not under git. --quiet and --json suppress this output.

Setup (init)

For a project that does not have a ruleset yet, bootstrap one with init:

compose-agentsmd init --root path/to/project --yes

Defaults:

  • source: github:owner/repo@latest
  • domains: empty
  • extra: empty
  • global: omitted (defaults to true)
  • output: AGENTS.md

Use --dry-run to preview actions, --force to overwrite existing files, and --compose to generate AGENTS.md immediately.

Updating shared rules

For GitHub sources, the tool keeps two locations:

  • Cache: ~/.agentsmd/cache/<owner>/<repo>/<ref>/ (read-only, used for compose)
  • Workspace: ~/.agentsmd/workspace/<owner>/<repo>/ (editable)

Update flow:

compose-agentsmd edit-rules
# edit files under rules/ in the workspace
compose-agentsmd apply-rules

edit-rules clones the GitHub source into the workspace (or reuses it), then prints the workspace path, rules directory, and next steps. apply-rules pushes the workspace (if clean) and regenerates AGENTS.md by refreshing the cache. If your source is a local path, edit-rules points to the local workspace and apply-rules skips the push.

Project ruleset format

Ruleset files accept JSON with // or /* */ comments.

{
  // Rules source. Use github:owner/repo@ref or a local path.
  "source": "github:owner/repo@latest",
  // Domain folders under rules/domains.
  "domains": ["node", "unreal"],
  // Additional local rule files to append.
  "extra": ["agent-rules-local/custom.md"],
  // Output file name.
  "output": "AGENTS.md"
}

Ruleset keys:

  • source (required): rules source. Use github:owner/repo@ref or a local path.
  • global (optional): include rules/global (defaults to true). Omit this unless you want to disable globals.
  • domains (optional): domain folders under rules/domains/<domain>.
  • extra (optional): additional local rule files to append.
  • output (optional): output file name (defaults to AGENTS.md).

Ruleset schema validation

compose-agentsmd validates rulesets against agent-ruleset.schema.json on every run. If the ruleset does not conform to the schema, the tool exits with a schema error.

Cache

Remote sources are cached under ~/.agentsmd/cache/<owner>/<repo>/<ref>/. Use --refresh to re-fetch or --clear-cache to remove cached rules.

Optional arguments

  • --root <path>: project root (defaults to current working directory)
  • --ruleset <path>: only compose a single ruleset file
  • --ruleset-name <name>: override the ruleset filename (default: agent-ruleset.json)
  • --refresh: refresh cached remote rules
  • --clear-cache: remove cached remote rules and exit
  • --version / -V: show version and exit
  • --verbose / -v: show verbose diagnostics
  • --source <source>: rules source for init
  • --domains <list>: comma-separated domains for init
  • --extra <list>: comma-separated extra rules for init
  • --output <file>: output filename for init
  • --no-domains: initialize with no domains
  • --no-extra: initialize without extra rule files
  • --no-global: initialize without global rules
  • --compose: compose AGENTS.md after init
  • --dry-run: show init plan without writing files
  • --yes: skip init confirmation prompt
  • --force: overwrite existing files during init
  • edit-rules: prepare or locate a writable rules workspace
  • apply-rules: push workspace changes (if GitHub source) and regenerate rules with refresh
  • init: generate a new ruleset and optional local rules file

Development

npm install
npm run lint
npm run build
npm test

Overview

This repository contains the compose-agentsmd project.

Requirements and Configuration

  • No required environment variables are documented.