CLI for hiring prompt repositories and resolving prompts from the currently active agency.
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.
agency: a registered prompt source, backed by either a git repository URL or a local directorycurrent agency: the default agency used when you run prompt lookup commandsselectors: positional arguments used to walk folders and prompts inside the active agencylocal store: a JSON file under.agency/that tracks agencies, config values, and the current selection
Prerequisites:
- Node.js 20+
pnpmgitavailable on yourPATHfor cloning and pull-based refreshes
Install dependencies:
pnpm installBuild the CLI:
pnpm buildRun the installed CLI directly:
the-agency --helpSmoke test the local build:
pnpm local:testThe smoke test rebuilds the project, prints CLI help, and runs agencies list against an empty local store.
Show help:
the-agency --helpList registered agencies:
the-agency agencies listRegister a remote prompt repo and make it active:
the-agency hire git@github.com:your-org/agency-prompts.gitRegister a local prompt directory and make it active:
the-agency hire ../agency-promptsSwitch the active agency:
the-agency agencies use your-org-agency-promptsBrowse the root of the active agency:
the-agencyBrowse a folder inside the active agency:
the-agency engineeringResolve a specific prompt from selectors:
the-agency engineering technical-writerLimit output fields when browsing or resolving:
the-agency --fields name,description engineering technical-writerList local config values:
the-agency config listSet and read a local config value:
the-agency config set default_model gpt-5
the-agency config get default_modelBy default, the CLI stores its state in a project-local folder:
./.agency/
That directory contains:
store.json: agency registry, current agency, and config valuesrepos/: cloned copies of remote prompt repositories
You can override the storage location with AGENCY_HOME:
AGENCY_HOME="$HOME/.agency-dev" the-agency agencies listBehavior 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-onlyat 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.gitas the default agency
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.
Use a prompt repo from git:
the-agency hire git@github.com:your-org/agency-prompts.git
the-agency engineering
the-agency engineering technical-writerUse a prompt repo from a local checkout while editing prompts:
the-agency hire ../agency-prompts
the-agency agencies list
the-agency product product-managerStore local defaults for your wrapper scripts:
the-agency config set model gpt-5
the-agency config set temperature 0.2
the-agency config listBuild:
pnpm buildRun the smoke test:
pnpm local:testRun the test suite:
pnpm testpnpm test exercises frontmatter parsing, local store behavior, prompt resolution, ambiguity handling, helper utilities, and root-level filtering rules.
pnpm install fails with packages field missing or empty:
- ensure
pnpm-workspace.yamlincludes a validpackagesentry - 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-onlyonce 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_HOMEto move.agencyelsewhere
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