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

the-agency

v1.0.2

Published

CLI for hiring and resolving agency prompt repositories

Downloads

51

Readme

the-agency

CLI for hiring prompt repositories and resolving prompts from the currently active agency.

What This Repo Is

the-agency is a small Node.js CLI that turns a prompt repository into a local, queryable tool. You point it at a git repo or a local directory, the CLI records that source in local state, and then you can:

  • register one or more prompt repositories as agencies
  • mark one agency as the active source
  • browse folders and prompt files inside that source
  • resolve a specific prompt by path-like selectors
  • store local config values alongside agency metadata

The CLI always prints JSON so it can be used interactively or from automation.

Key Concepts

  • agency: a registered prompt source, backed by either a git repository URL or a local directory
  • current agency: the default agency used when you run prompt lookup commands
  • selectors: positional arguments used to walk folders and prompts inside the active agency
  • local store: a JSON file under .agency/ that tracks agencies, config values, and the current selection

Install

Prerequisites:

  • Node.js 20+
  • pnpm
  • git available on your PATH for cloning and pull-based refreshes

Install dependencies:

pnpm install

Build And Run

Build the CLI:

pnpm build

Run the installed CLI directly:

the-agency --help

Smoke test the local build:

pnpm local:test

The smoke test rebuilds the project, prints CLI help, and runs agencies list against an empty local store.

Core Commands

Show help:

the-agency --help

List registered agencies:

the-agency agencies list

Register a remote prompt repo and make it active:

the-agency hire [email protected]:your-org/agency-prompts.git

Register a local prompt directory and make it active:

the-agency hire ../agency-prompts

Switch the active agency:

the-agency agencies use your-org-agency-prompts

Browse the root of the active agency:

the-agency

Browse a folder inside the active agency:

the-agency engineering

Resolve a specific prompt from selectors:

the-agency engineering technical-writer

Limit output fields when browsing or resolving:

the-agency --fields name,description engineering technical-writer

List local config values:

the-agency config list

Set and read a local config value:

the-agency config set default_model gpt-5
the-agency config get default_model

Local Data And Config Behavior

By default, the CLI stores its state in a project-local folder:

./.agency/

That directory contains:

  • store.json: agency registry, current agency, and config values
  • repos/: cloned copies of remote prompt repositories

You can override the storage location with AGENCY_HOME:

AGENCY_HOME="$HOME/.agency-dev" the-agency agencies list

Behavior details:

  • hiring a remote repo clones it into .agency/repos/<derived-key> if it is not already present
  • hiring an already-known remote repo reuses the cached clone
  • cached remote repos are refreshed with git pull --ff-only at most once every 24 hours
  • if refresh fails, the CLI keeps using the existing local clone and returns a warning
  • hiring a local directory uses that directory in place; no clone or pull is attempted
  • when prompt lookup runs against an empty local store, the CLI automatically registers and activates https://github.com/nivoset/agency-agents.git as the default agency

Prompt Repository Expectations

This CLI expects a prompt repository organized as folders plus Markdown files.

Typical shape:

engineering/
  engineering-technical-writer.md
  engineering-code-reviewer.md
design/
  design-ui-designer.md

Prompt files are resolved by selector matching. The resolver supports browsing folders and resolving prompts by file-like names such as technical-writer.

The implementation also filters noise at the repo root, including hidden directories, .git, node_modules, and .gitignored files.

Common Workflows

Use a prompt repo from git:

the-agency hire [email protected]:your-org/agency-prompts.git
the-agency engineering
the-agency engineering technical-writer

Use a prompt repo from a local checkout while editing prompts:

the-agency hire ../agency-prompts
the-agency agencies list
the-agency product product-manager

Store local defaults for your wrapper scripts:

the-agency config set model gpt-5
the-agency config set temperature 0.2
the-agency config list

Development

Build:

pnpm build

Run the smoke test:

pnpm local:test

Run the test suite:

pnpm test

pnpm test exercises frontmatter parsing, local store behavior, prompt resolution, ambiguity handling, helper utilities, and root-level filtering rules.

Troubleshooting

pnpm install fails with packages field missing or empty:

  • ensure pnpm-workspace.yaml includes a valid packages entry
  • this repo expects the workspace file to include packages: ['.']

Lookup returns No agency is active yet:

  • run the-agency hire <git-repo-or-local-dir> first
  • or switch to an existing agency with the-agency agencies use <agency-key>
  • if the store is empty, a lookup command will now bootstrap the default agency automatically; this error only appears when agencies already exist but none is active

An agency key is rejected as unknown:

  • inspect valid keys with the-agency agencies list
  • the key is derived from the repo path or repo URL tail and normalized to lowercase kebab-case

A remote repo does not refresh:

  • the CLI only attempts git pull --ff-only once per 24 hours for cached repos
  • if pull fails, the existing local copy is still used and the response includes a warning

You want storage outside the repo:

  • set AGENCY_HOME to move .agency elsewhere

Output Model

Every command emits JSON. That makes the CLI suitable for shell usage, other CLIs, and agent orchestration layers.

Typical response types include:

  • agency registry listings
  • active agency selection results
  • config set/get/list results
  • prompt listings
  • resolved prompt payloads
  • structured error responses