Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AGENTS.md
8 changes: 4 additions & 4 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ not repeat them here.
| e2e, live tier | `npm run test:e2e -- --grep @smoke` (`AGENTAGE_SITE_FQDN` = target; CI: dispatch `e2e.yml`) |
| Pack smoke | `scripts/pack-smoke.sh`, `scripts/update-smoke.sh` (reads npm) on a packed tarball (`ci.yml`) |
| Mutation check | `node scripts/mutate.mjs [ids]`; it edits `src`, so never run it beside verify |
| Release | dispatch `prepare-release.yml`; `release.yml` publishes on the merge (see README "Release") |
| Release | dispatch `prepare-release.yml`; `release.yml` publishes on the merge (see `docs/release.md`) |

## Where facts live

Each row names the doc first, then the code that proves it. Read the doc before `src/`.

- Install, sign-in, command list, config dir: `README.md`; `src/program.ts`, `src/lib/fs/config.ts`.
- Install, sign-in, command list: `README.md`; config dir: `docs/reference.md` "Files"; `src/program.ts`, `src/lib/fs/config.ts`.
- `setup`, `status`, `update`: `docs/reference.md` sections of those names; `src/commands/auth/`,
`status/`, `update/`, `extension/setup.ts`.
- The lifecycle (C1: install, list, update, disable, enable, configure, remove) and the move from
Expand Down Expand Up @@ -125,11 +125,11 @@ Drives the built `dist/cli.js` as a subprocess. Tiers are tags in the test title
auth and account routes; `e2e/registry/` npm serving `fixtures/`). `@p0` is the hermetic
`setup --no-browser` sign-in round trip, also `@offline`.
- `@smoke`: read-only against a live target; nothing signs in or writes.
- The agentage/e2e cli tier (`_e2e-cli.yml`, `--project=cli --grep @smoke`) runs on the packed
- The cli tier of the shared end-to-end gate (in a private repo) (`_e2e-cli.yml`, `--project=cli --grep @smoke`) runs on the packed
cli: on every PR (`e2e.yml`, not required) and before each publish (`release.yml`, blocking).
`scripts/candidate-registry.mjs` serves the tarball as npm `latest` on loopback. The tier reads
prod, so a prod outage blocks a publish. A cli change that the tier pins (a help line, a renamed
command) needs its agentage/e2e test first, version-gated on the release that changes it.
command) needs its gate test first, version-gated on the release that changes it.

## Conventions

Expand Down
216 changes: 79 additions & 137 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,171 +2,113 @@

![Connect this machine to agentage from the terminal](https://github.com/agentage/cli/raw/master/docs/banner.svg)

The agentage CLI connects each machine you use to your agentage account, a shared place for your
AI tools. Use it from a terminal, a server or CI. It also installs extensions: npm packages that
add commands to `agentage`. You need Node.js 22 or newer.
The `agentage` command connects each machine you use to your agentage account and runs
extensions on it. It is also the tool to make and release your own extension. Use it from a
terminal, a server or CI. You need Node.js 22 or newer.

```bash
npm install -g @agentage/cli && agentage setup
npm i -g @agentage/cli
agentage setup # sign in in your browser, then start the local daemon
```

## What is this?

The CLI stays **small**: sign-in, status, update and an extension manager. Sign-in uses OAuth 2.1
with PKCE: you type nothing into the terminal. Everything else, memory included, arrives as an
extension.

## Get started

`agentage setup` opens your browser for sign-in. Check the session with `agentage status`.
Installing and running extensions needs no sign-in. On a new machine, a signed-in `setup` installs
the extensions of your account's profile once; after that each machine keeps its own list.

### On a server or in CI (no browser)

`agentage setup --no-browser` prints the sign-in URL. Open it in a browser on this same machine,
because sign-in returns to `localhost`. On a server, use a personal access token from the
dashboard (**Settings**, then **API tokens**):

```bash
AGENTAGE_TOKEN=aga_... agentage status
```

More: [docs/reference.md](docs/reference.md#token-auth-ci-and-headless).
Status: before 1.0. Extensions run on the local daemon (`127.0.0.1:4243`) of each machine.

## Commands

| Command | What it does |
| ----------------------------- | ---------------------------------------------------------------------------------- |
| `agentage setup` | Sign in, install your account's profile, show status, start the daemon |
| `agentage setup --no-browser` | Print the sign-in URL instead of opening a browser |
| `agentage setup --reauth` | Force a fresh sign-in |
| `agentage setup --disconnect` | Sign out and remove local credentials |
| `agentage status` | Version, update, target, sign-in, endpoint, then machine, profile, extensions |
| `agentage update` | Install the latest published version (`--check` only reports) |
| `agentage daemon status` | The local daemon on 127.0.0.1:4243 (`start`, `stop`, `restart`); `setup` starts it |
| `agentage extension ...` | Manage extensions, see [Extensions](#extensions) |
| any command with `--json` | One JSON object on stdout: `{ success, data }` or `{ success, error }` |

More: [author commands](docs/extensions.md#author-commands) and
[the lifecycle](docs/reference.md#extension-lifecycle).

## Extensions

- A **profile** lists what your account wants: extensions, version ranges, and which are off
per machine.
- On a new machine, `setup` installs the profile's extensions through the daemon, once. No
command pushes your changes back to the account: each machine keeps its own list.
- `extension install`, `list`, `update`, `disable`, `enable`, `configure` and `remove` manage
one extension in the local daemon (`127.0.0.1:4243`), which runs each as its own process.
- Nothing installs on a timer: the machine changes only when you run a command.

```bash
agentage extension install probe # the market's newest version, then it runs
agentage extension configure probe echo.prefix=hey # settings, no daemon restart
agentage extension list # id, version, source, state
agentage probe ping # run a command by its extension id
agentage extension remove probe # take it out again; --purge also deletes its data
```

Extensions run with your privileges, in the daemon and in the CLI process, so install only ones
you trust. npm runs with `--ignore-scripts`. The account token leaves the environment before
extension code loads.

More: [docs/profiles.md](docs/profiles.md).

### Write and run your own extension

`create` needs git and network. `build --container`, `up --docker` and `release` also need
Docker and a committed tree; `release` needs the `gh` CLI.
Each command has `--help`. The full reference is [docs/reference.md](docs/reference.md).

| Command | What it does |
| ------------------------------ | ------------------------------------------------------------------------ |
| `agentage setup` | Sign in and connect this machine to your account; start the daemon |
| `agentage status` | Show the cli, account, endpoint, machine, profile and extension status |
| `agentage update` | Update `@agentage/cli` to the latest published version |
| `agentage daemon` | Start, show, stop or restart the local daemon that runs extensions |
| `extension install <name>` | Install an extension (`<id>`, `<id>@<version>` or a folder) and run it |
| `extension list` | Show each installed extension: id, version, source, state |
| `extension update [id]` | Move each market extension, or one, to its newest version |
| `extension disable <id>` | Stop an extension, keep its data |
| `extension enable <id>` | Run a disabled extension again |
| `extension configure <id> k=v` | Set settings (or `--secret` secrets) of an extension, no restart |
| `extension remove <id>` | Stop and remove an extension; its data stays unless `--purge` |
| `extension doctor` | Load every extension once and refresh its state: ok or failed |
| `extension create <id>` | Create `./extension-<id>` from the extension template |
| `extension check [dir]` | Check that an extension package conforms, as every build does first |
| `extension build` | Build the extension package; `--container` builds one image of all parts |
| `extension release` | Release an extension in CI; `--changed` releases each changed extension |
| `extension up` | Run the working copy on the daemon and reload each change |
| `extension down` | Stop what `extension up` started here |
| `extension token` | Print a token from the dev issuer that `extension up --docker` started |

`extension ...` means `agentage extension ...`. Add `--json` to most commands for one JSON object
on stdout: `{ success, data }` or `{ success: false, error }`. On a server with no browser, use a
personal access token: `AGENTAGE_TOKEN=aga_... agentage status`.

## Make your first extension

![Make your first extension: create, verify, check, merge, released](https://github.com/agentage/cli/raw/master/docs/first-extension.svg)

You need git and network. Run these in an empty folder:

```bash
agentage extension create example api # makes ./extension-example with the api part
cd extension-example && npm ci # installs the pinned cli
npx agentage extension up # runs it on the daemon, reloads each saved change
npx agentage extension down # removes the row up added (its data stays)
agentage extension create my-ext
cd extension-my-ext
npm ci
npm run verify
npx agentage extension check # PASS my-ext 0.1.2 conforms (6 rules)
git init -b master && git add -A && git commit -m "feat: my-ext extension"
```

In the extension folder, use `npx agentage`: the project's pinned cli and the global one can differ.

More: [docs/extensions.md](docs/extensions.md#run-it-locally).

## Where things live
`create` copies the template from `agentage/kit:template` and writes your id into every file. In
the folder, use `npx agentage`: it runs the cli version that the folder pins. The guide of the new
folder is its own `README.md`. `check` may end with an `update available` line when the cli that
runs it is older than the newest on npm.

Everything lives in the config directory, `~/.agentage` by default:
`create` builds the folder and gives it to the local daemon, so it runs at once. Add `--no-install`
to only create the files: CI and agents always do. Two more commands change the local daemon:
`npx agentage extension up` runs the folder there and reloads each change, and
`agentage extension install ./extension-my-ext` installs it there.

| Path | What |
| ------------------------------- | ----------------------------------------------------- |
| `~/.agentage/auth.json` | your sign-in, owner-only |
| `~/.agentage/profile.json` | the profile: what this account wants |
| `~/.agentage/machine.json` | this machine's id, name, dev extensions and account |
| `~/.agentage/installation.json` | this machine's extension list, written by the daemon |
| `~/.agentage/daemon.json` | the running daemon: pid, port, host token; owner-only |
| `~/.agentage/extensions/` | installed extensions, one tree per id and version |
| `~/.agentage/state/` | the last run of each extension |
| `~/.agentage/commands.json` | cli 0.51's command holders; read, never written |
| `~/.agentage/secrets.json` | extension secrets, owner-only |
| `~/.agentage/data/<id>/` | what each extension keeps |
| `~/.agentage/logs/` | `daemon.log` and each extension's log |
## How an extension is released

`status` writes `machine.json` even before you sign in.
Push the repo to GitHub. A release runs in CI in one of two modes:

To uninstall, run `agentage setup --disconnect`, then `npm uninstall -g @agentage/cli`, then
delete `~/.agentage`.
- A repo with one or several extensions: each merge to master runs `agentage extension release --changed`. This is what a new repo from `create` does.
- A repo with one extension can instead release by a pushed tag `v<version>`: `agentage extension release`.

## How it works
With `--changed`, a changed extension gets a date version
`YYYY.MDD.N` (for example `2026.1122.1`), the tag `<id>@<version>`, its images and its records on
the GitHub release. A change only in a root `*.md` file, `docs/` or `.github/` releases nothing.
A `.release-ignore` file adds more patterns. The new package is private: it goes to npm only when
you remove `"private": true`. The rule in full: [docs/reference.md](docs/reference.md#extension-release).

- `setup` registers a one-off OAuth client and waits for the browser on a localhost callback.
- Tokens land in `~/.agentage/auth.json` (owner-only) and refresh automatically.
- `status` checks the session against the account's introspection endpoint.
- The daemon is the only background process. It starts when a command needs it and runs until
`agentage daemon stop`. Nothing installs on a timer.

## Configuration

| Env | Default | Purpose |
| ------------------------- | --------------------- | -------------------------------------------------- |
| `AGENTAGE_SITE_FQDN` | `agentage.io` | Target host |
| `AGENTAGE_CONFIG_DIR` | `~/.agentage` | Config and credentials directory |
| `AGENTAGE_TOKEN` | - | Personal access token for CI and headless machines |
| `AGENTAGE_EXTENSIONS_DIR` | `<config>/extensions` | Where extensions are installed |
| `AGENTAGE_DAEMON_PORT` | `4243` | The daemon's port on 127.0.0.1 |
| `NO_COLOR` | - | Disable colored output |

## Develop
## How to work on this repo

```bash
npm ci
npm run verify
npm run build && npm run test:e2e -- --grep @offline
npm run verify # type-check, lint, format, test, build
npm run build && npm run test:e2e -- --grep @offline # e2e with a loopback npm registry
```

Each e2e title under `e2e/core/` names a command and what must hold. The tests use a loopback
npm registry that serves `fixtures/`.
## How a change is released

## Release
A merge of a normal change releases nothing. The `chore(release): X.Y.Z` PR from
`prepare-release.yml` changes `package.json`; its merge runs `release.yml`, which publishes to npm
with OIDC trusted publishing and pushes the tag `vX.Y.Z`. Details: [docs/release.md](docs/release.md).

Dispatch `prepare-release.yml` (a weekly schedule also dispatches it). It opens a
`chore(release): X.Y.Z` PR and arms auto-merge. On the merge, `release.yml` runs verify and the
agentage/e2e cli tier on the packed cli, then publishes to npm with OIDC trusted publishing and
provenance, and pushes the tag `vX.Y.Z`. It skips a version already on npm.
## For agents

- The publish worked but the tag push failed: push the tag by hand on the release commit
(`git tag vX.Y.Z <release commit> && git push origin vX.Y.Z`); never publish again.
- The cli tier failed: fix the cli or the e2e test, then dispatch `release.yml` again.
- `release.yml` runs only the `@smoke` tests of the agentage/e2e cli tier on the candidate. The
lifecycle, execution and reload tests of agentage/e2e run on its own PRs against the published
cli.
- Before the release PR merges, check: the PR checks of the release commit are green, and the cli
project of agentage/e2e passes in full against the packed tarball of that commit
(`AGENTAGE_CLI_TARBALL=<tgz> npm run test:cli -- --retries=0`).
- Read [AGENTS.md](AGENTS.md) (the same file as `CLAUDE.md`): commands, layout and where each fact lives.
- Never run `setup`, `update`, `extension up` or `extension install` on a shared machine, and always add `--no-install` to `extension create`.
- Never publish to npm by hand: only `release.yml` publishes.

## Documentation
## Links

- [docs/reference.md](docs/reference.md): every flag, exit code and environment variable.
- [docs/profiles.md](docs/profiles.md): profiles, extension states, the plan and updates.
- [docs/reference.md](docs/reference.md): every flag, exit code, environment variable and file.
- [docs/extensions.md](docs/extensions.md): write, check and run your own extension.
- [docs/profiles.md](docs/profiles.md): profiles, extension states, the plan and updates.
- [agentage/kit](https://github.com/agentage/kit): the kit and the extension template.
- [agentage/examples](https://github.com/agentage/examples): the probe and fixture extensions.

## License

MIT - see [LICENSE](./LICENSE).
MIT. See [LICENSE](LICENSE).
2 changes: 1 addition & 1 deletion docs/banner.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading