@rulemetric/cli
v0.11.0
Published
The RuleMetric CLI. Manages instructions, sessions, evals, and (as of the user-management release) organizations.
Readme
@rulemetric/cli
The RuleMetric CLI. Manages instructions, sessions, evals, and (as of the user-management release) organizations.
Auth
rulemetric auth login # interactive — writes ~/.config/rulemetric/env
rulemetric auth create-key # generate a long-lived API key
rulemetric auth status # show the current auth state (email / API key)Credentials are read from (first match wins):
RULEMETRIC_API_URL+RULEMETRIC_API_KEY(orRULEMETRIC_ACCESS_TOKEN)~/.config/rulemetric/env~/.config/rulemetric/auth.json(JSON fallback, requiresjq).env.localin the project root (development)
Local mode (all data on your machine)
By default the CLI talks to the hosted service at rulemetric.com. local up
runs the whole product on your own machine instead — API, dashboard, and
database — with no cloud contact at all.
rulemetric local up # start (downloads the local runtime on first run)
rulemetric local up --foreground # run in this terminal instead of as a service
rulemetric local up --port 3210 # non-default port
rulemetric local up --email [email protected] --password '<pw>' # provision the first user
rulemetric local down # stop; data is preserved
rulemetric local down --delete-data # stop and wipe the local database (irreversible)Requires Docker (the database runs in it) and the
Supabase CLI —
brew install supabase/tap/supabase. First run downloads @rulemetric/local
(~10 MB: bundled API server, dashboard, and migrations) at a version locked to
your CLI; add --yes to skip the confirmation. Cloud-only users never download it.
The dashboard is then at http://localhost:3000 (or your --port), and
rulemetric hooks install points capture at it like any other API URL.
To guarantee nothing ever reaches the cloud — including implicit fallbacks — set strict mode, which turns every unconfigured cloud call into a loud failure instead of a silent upload:
echo 'RULEMETRIC_STRICT_LOCAL=1' >> ~/.config/rulemetric/envlocal down leaves your data on disk; local up picks it back up.
Org commands
The org commands let you list and switch the "active org" used by every
subsequent CLI invocation. Sessions captured by hooks/proxy/MCP while an
active org is set will stamp sessions.org_id to that org.
rulemetric org list # list orgs you belong to; star marks the active one
rulemetric org current # print the active org's slug and id
rulemetric org switch <slug> # set the active org (cached locally)
rulemetric org switch --clear # clear the active org (back to personal mode)Active-org resolution order:
RULEMETRIC_ORG_IDenvironment variable (process-scoped override)- Local cache at
~/.config/rulemetric/active-org(written byrulemetric org switch) - None (sessions captured without an org_id)
A background prefetch refreshes the cache on a TTL so a slug change in the
web UI is picked up by the next CLI run without an explicit org switch.
Creating an org: Currently web-only — visit /orgs/new in the
dashboard. The CLI will adopt the org once you org switch <slug> (or set
the active org in the web UI, which the CLI cache picks up).
Other top-level commands
rulemetric instructions ...— list, get, create, delete, fork, promote, pull, upstream, versionsrulemetric skills search|install ...— install a skill to.agents/skills/+.claude/skills/rulemetric sessions ...— list, start, end, import, analyzerulemetric evals ...— eval target/case/run/optimize commands +agent(background worker)rulemetric hooks install|uninstall|run <name>— manage tool hook scriptsrulemetric proxy ...— start/stop the mitmproxy capture layerrulemetric service install|status|uninstall— background services (--worker-onlyinstalls just the worker)
Session insights are enriched automatically (hooks + the background worker) —
there is no manual insights command.
Tests
pnpm --filter @rulemetric/cli test:unit # unit tests (no creds needed)
pnpm --filter @rulemetric/cli test:e2e # e2e (needs Supabase creds)E2E tests start a real Hono API on port 3001 and create a temp Supabase
user; see apps/cli/e2e/global-setup.ts.
