CLI reference — myai
Auto-generated from the
COMMANDStable inbin/myai.cjs— do not edit by hand.
The myai CLI (aliased ai-manage, npm package ai-management) is a thin dispatcher: each subcommand shells into the repo's scripts/*.sh playbooks, which remain the single source of truth. It has zero required runtime dependencies — myai --help and myai doctor work before any npm install.
| Command | Arguments | What it does | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
myai setup | [args...] | Global first-run wizard (once per machine, BEFORE any repo work): the ONE question — connect an existing brain (--brain <url> / $MYAI_BRAIN_REMOTE) or provision a new one (local by default, states the ownership/data-locality deal + consent, optional private remote). --yes for non-interactive consent. Auto-triggered by any other stateful command when ~/.myai/config is missing (see needsAutoSetup below) — never re-triggers once set up; --force redoes it. setup --machine is the separate machine-arrival path: idempotently checks/fixes Dropbox conflicts, git re-attach across the repo fleet, the Docker stack, npm's global prefix, and runner registration in one pass — reports fixed vs. needs-operator (--dry-run/--yes/--install-runner/--rebuild-docker/--json) | ||||||||||||||
myai init | [path] | Greenfield by default: drop a ~30-line kernel CLAUDE.md + gitignored .myai-local (no AI/ folder) — framework resolves from the installed module. --managed forces the legacy AI/-scaffold (portable docker-compose + .env + guided wizard); --force replaces a non-kernel CLAUDE.md; --zero-prompt (or env MYAI_ZERO_PROMPT=1) guarantees a scripted/headless run never blocks on stdin, regardless of TTY state | ||||||||||||||
myai up | [args...] | Start the self-contained stack (gateway + dashboard + mongo) on localhost, wait for health, print the dashboard URL | ||||||||||||||
myai down | [args...] | Stop the stack cleanly (--volumes also drops the mongo data volume) | ||||||||||||||
myai status | [args...] | Gateway/runner/queue health at a glance: gateway/dashboard HTTP health, docker compose ps, task-queue counts, continuity meter, and the local off-hours runner's installed/active state (--json for scripts; exit 0 = healthy) | ||||||||||||||
myai boot | [args...] | TOKEN-FREE session boot — the deterministic spine of agent mode -min with zero LLM cost: git sync (ff-only pull), brain delta since last boot (pure git) INCLUDING the compiled brief.md/working.md read straight off brain main on disk (zero gateway dependency, BRAIN_OFFLINE.md Layer 3), schedule banner, remote-control status. Run BEFORE opening Claude. --no-fetch \ | --no-pull \ | --working (also print working.md) \ | --offline (skip git fetch + the two gateway-backed banners entirely — guaranteed to complete with the stack fully down) \ | --quiet | ||||||||||
myai logs | [service...] | Live-tail stack logs — wraps docker compose logs -f (optionally one service: gateway \ | dashboard \ | mongo; --no-follow, --tail N); --runner also tails the local off-hours CLI runner's latest job log alongside it, prefixed [runner] | ||||||||||||
myai queue | [args...] | Inspect and control the runner task queue — the CLI mirror of the dashboard /work orchestration view. queue / queue list [--repo][--status][--priority][--all][--json]; queue cancel <taskId> [--reason][--force] marks it blocked (reversible); `queue reprioritize <taskId> <P0\ | P1\ | P2\ | P3>` changes its priority | |||||||||||
myai open | [target...] | Jump from the terminal to the right dashboard view in one keystroke: open/open dashboard (root), open board (THIS repo's /work board — repo auto-detected from the git checkout, --repo overrides), open task <id> (deep-link a queue task — tab + repo resolved via the gateway when reachable, graceful /work fallback when not), open repo (App Directory /apps), or any named dashboard page (work \ | fleet \ | apps \ | brain \ | memory \ | system \ | …). Localhost vs hosted resolves from DASHBOARD_URL / MYAI_DASHBOARD_PORT (env wins over .env). Cross-platform launcher: macOS open / Linux xdg-open / WSL wslview / Windows start, MYAI_OPEN_CMD override, $BROWSER fallback; --print prints the URL instead of launching | ||||||||
myai scan | [path] | Spider git repos under a dir → register each in the gateway directory + seed RAG awareness (--register also lists in managed_repos.txt; --dry-run previews) | ||||||||||||||
myai demo | [args...] | Seed the dashboard with realistic sample data — tasks, schedules, plan, repo cards, memory, budget rows (idempotent; --clean removes, --force re-seeds) | ||||||||||||||
myai new-app | [args...] | Two modes, one verb: new-app <path> scaffolds a full-stack app offline from the powerhouse blueprint (init_blueprint.sh flags all still work — --gh-create, --vercel, --mode, etc.); new-app "<idea>" (or --idea "<idea>") drives agentFlow's headless idea→app pipeline (POST /api/headless/new-app, x-gateway-local-token) and self-registers the produced repo via repos_upsert (ADR-021). Dispatches on argument shape: any whitespace in the first arg means idea mode | ||||||||||||||
myai connect | [path] | Install the Connect Hub module into a project | ||||||||||||||
myai plug | [agent...] | Plug ANY agent into your brain — one front door over both tiers. myai plug lists every agent + its one-liner; myai plug <agent> routes (claude\ | cursor\ | windsurf\ | codex\ | gemini\ | opencode = MCP auto-boot; ollama\ | chatgpt\ | print = blank-agent wrap) and forwards extra flags; myai plug proof runs the live continuity round-trip with no agent installed | |||||||
myai connect-agent | [args...] | Cooperating (MCP) tier of myai plug — print/install MCP config (claude \ | cursor \ | windsurf \ | codex \ | all) pointing at the local gateway, then verify the context_boot round-trip (--install writes, --no-verify skips) | ||||||||||
myai shim | [args...] | Wrap-it tier of myai plug — fetch the operator context bundle and PREPEND it for a non-MCP agent: launch Ollama pre-loaded, or compose a paste-ready ChatGPT primer; a prompt is forwarded as a lazy-recall query (--model, --repo, --no-deep, --copy) | ||||||||||||||
myai schedule | [args...] | Queue an autonomous task for the CLI runner (pass --title, etc.) | ||||||||||||||
myai login | [args...] | Authenticate this terminal against a hosted myAI gateway — validates a per-tenant API key via GET /api/auth/whoami and persists it (--key <apiKey> or $MYAI_API_KEY or an interactive hidden prompt; --gateway-url URL; --json). End-user session identity — distinct from myai config (local schema-validated key editing, no gateway round-trip) and tenant-key rotation (operator CRUD) | ||||||||||||||
myai whoami | [args...] | Print the active org/tenant/plan/quota for the session myai login established — always round-trips to the gateway for live quota (--gateway-url URL override; --json) | ||||||||||||||
myai config | [args...] | Safe front-end for the per-user ~/.myai/config store — view/set keys (org, gateway URL, brain wiring, model routing) with SCHEMA VALIDATION instead of hand-editing the JSON: config/config list [--json][--reveal] (values redacted where secret-shaped, unknown keys flagged); config keys (the schema: every known key + type + description); config get <key>; config set <key> <value> (per-key validation — URL/enum/path/model-id; unknown keys refused unless --force; secret-named keys ALWAYS refused — credentials live in ~/.myai/credentials via myai login/myai rotate-keys, never in config); config unset <key>; config path. Purely local (no gateway round-trip) | ||||||||||||||
myai mcp | [args...] | Propagate the MCP server config through the installed module (not update_all): mcp repo [path] writes/refreshes a repo .mcp.json from the bundled template (deep-merge — framework servers canonical, custom preserved); mcp vscode [path] does the same for the VS Code .vscode/mcp.json (Copilot/Codex-in-VS-Code agent mode); `mcp sync [museum\ | tech\ | personal\ | all] refreshes the per-org Claude config dirs from the template; mcp print` shows the base config. --dry-run supported | |||||||||||
myai mirror | [args...] | Keep a LOCAL copy of the gateway memory + registry so localhost is not single-point-of-failure on Atlas. Streams mongodump→mongorestore (Atlas → local by default) in a throwaway mongo:7 container — no host mongo tools. --dry-run previews; --collections a,b scopes; --reverse (local → Atlas) is guarded behind --yes; --install-schedule [--every-minutes N] / --schedule-status / --uninstall-schedule manage the periodic (hourly default) launchd/cron refresh | ||||||||||||||
myai sync | [args...] | ADR-022 local-first mongo mode: converge Atlas and the local myai-mongo in whichever direction is designated PRIMARY. Plain call syncs PRIMARY → SECONDARY (idempotent); sync status shows primary + last successful sync; `sync set-primary atlas\ | local flips the designation; --dry-run previews; --collections a,b scopes. sync schedule install\ | status\ | uninstall [--every-minutes N\ | --every-hours N]` installs/inspects/removes BOTH the periodic sync job and an independent staleness canary that raises a notification-engine alert once the last successful sync exceeds a threshold — never installed automatically | ||||||||||
myai rotate-keys | `<local | tenant> [args...]` | Self-rotate a gateway credential with a dual-valid grace window (zero-downtime): rotate-keys local [--grace-minutes N] rewrites GATEWAY_LOCAL_TOKEN in .env, keeping the old value valid for the grace window; `rotate-keys tenant <tenantId> [--grace-minutes N] [--env live\ | test]` mints a new tenant bootstrap API key via the gateway (local-trust only), old key stays valid server-side until grace elapses — new key is shown ONCE | ||||||||||||
myai tenant | `<create | list | suspend | reactivate | rotate-key> [args...]` | Operator tenant lifecycle CRUD, scriptable from the terminal (wraps the gateway's admin-gated /api/tenants endpoints — needs ADMIN_API_TOKEN configured on the gateway): `tenant create --tenant-id <id> --name <name> [--plan free\ | solo\ | team\ | scale] [--owner-email <email>] [--env live\ | test] provisions a tenant + first API key (shown ONCE); tenant list [--status active\ | suspended\ | deleted] [--plan <plan>] [--limit N]; tenant suspend <tenantId> [--reason "..."] blocks every key call instantly; tenant reactivate <tenantId> restores it; tenant rotate-key <tenantId> [--grace-minutes N] [--env live\ | test] delegates to rotate-keys tenant` (local-trust only, zero-downtime grace window) | |||
myai runner | [args...] | Manage the local off-hours CLI runner schedule (launchd/systemd) — install [--every-minutes N\ | --every-hours N] \ | uninstall \ | start \ | stop \ | status (+ next-fire) \ | logs [-f] [-n N]. Distinct from myai status/myai logs (gateway health) — this controls the local worker | ||||||||
myai brain | [args...] | Git-versioned agent memory — init \ | status \ | write \ | stash \ | pop \ | branch \ | checkout \ | merge \ | log \ | diff \ | blame \ | revert \ | gc \ | session \ | distill (sessions = commits, wrap up = merge; walkthrough: TRY_BRAIN.md) |
myai wrapup | [args...] | The mechanical half of wrap up in ONE call (BRAIN W4.2): rotate_state.sh + repo_card.sh + memory_reindex + brain atom/merge/verify + the WRAPPED UP banner. wrapup --mechanical runs all five; pipe the ~300-token session summary on stdin (or --atom-file <path>) to also write + merge the brain atom (--no-atom skips it). Every step is individually non-fatal — a missing script or unreachable gateway degrades that one step and the run continues; exits 0. --topic <t> --repo <name> --slug <s> --profile <p> --reindex-scope master\ | all --no-rotate --no-card --no-reindex --quiet | |||||||||||||
myai memory | [args...] | Portable memory bundle — export [dir] pulls the corpus (state/handoff/patterns source texts) as JSON manifest + markdown; import <dir> re-embeds on this gateway with dedup-by-hash | ||||||||||||||
myai context | [args...] | FULL portable context bundle — export [dir] tars memory corpus + vectors (embeddings) + brain atoms + config into ONE versioned, checksummed, secret-redacted .tar.gz; import <archive> verifies integrity and re-imports (memory always, brain/config opt-in); import-external <source> ingests FROM ChatGPT/Claude export, Obsidian, markdown, or a raw vector store (re-embed + dedup, tenant-scoped). Own + download your whole context. | ||||||||||||||
myai recall | <query...> | TOKEN-FREE semantic recall over the repo-local SQLite index (code symbols + brain atoms) via sparse BM25 + local embeddings — NO LLM, NO network, NO tokens. Builds the index on first use. --k N \ | --json \ | --rebuild | ||||||||||||
myai ctx | <query...> | TOKEN-FREE context lookup — the primitive that replaces bulk Read/Grep: bare file:line pointers + atom:<ref> refs, one per line, over the same repo-local SQLite index recall uses (NO LLM, NO network, NO tokens, fully offline — works with the gateway down). --k N \ | --json \ | --rebuild \ | --db PATH | |||||||||||
myai backup | [args...] | Snapshot the git-versioned brain repo + ~/.myai config files into one dated .tar.gz archive (--out <file> or [dir] to place it; round-trips with myai restore) | ||||||||||||||
myai restore | [args...] | Restore a myai backup archive — brain repo → this machine's resolved dir (or --to <dir>) + config → ~/.myai; refuses to clobber without --force (existing state → .bak; --dry-run previews) | ||||||||||||||
myai upgrade | [args...] | Self-update the global CLI (npm update -g) then run pending config + brain schema migrations idempotently (--check reports without applying, exit 20 if pending; --dry-run previews; --no-self-update skips the npm step; --json for scripts) | ||||||||||||||
myai doctor | [args...] | Run preflight checks: docker (+engine), node, claude CLI, ANTHROPIC_API_KEY, cloud reachability, ollama availability, brain freshness, mongo mirror schedule (+last run), ports free. --dry-run previews the safe auto-fixes; --fix applies them idempotently (backfill non-secret .env keys from .env.example, redeploy statusline, correct runner cadence, pull latest gateway image) — never touches secrets or restarts the shared stack (--json for CI/scripts; exit 0 = passed) | ||||||||||||||
myai root | [args...] | Print the installed ai-management module path — the framework-as-module resolver a kernel-only repo (no per-repo AI/ copy) uses to find agents/skills/hooks/rule bodies. Fails loud (exit 1) if the resolved dir is not a valid install, so safety hooks never silently go missing (--json for scripts) | ||||||||||||||
myai release | [args...] | One-command release cut: `release [patch\ | minor\ | major] bumps package.json + CHANGELOG.md from Conventional Commits, clean-room-validates (shell unit suite + publish_guard.sh leak scan + a Docker install/smoke check), and commits locally — any validation failure auto-reverts the bump. release --tag (run on main after the commit merges) tags + pushes the release and prints the gh release create` follow-up. --dry-run previews; --skip-tests/--skip-guard/--skip-docker skip a validation stage; --json for scripts | ||||||||||||
myai completions | <shell> | Generate a shell completion script (commands, flags, and dynamic --repo names) for bash \ | zsh \ | fish. Prints to stdout; install instructions are inline as comments in the generated script. Command list is read straight off this table, so it can never drift from myai --help — enforced by runtime/tests/unit/cli-dispatch.test.ts | ||||||||||||
myai repos | [--paths] [--json] | Fleet roster (ADR-021 Phase 3 resolver shim): gateway DB repos collection preferred, config/managed_repos.txt bootstrap-seed fallback. Default prints repo names; --paths prints one absolute checkout path per line (for shell consumers); --json prints entries with name/path/source plus which resolver answered. MYAI_REPOS_NO_GATEWAY=1 forces the seed file | ||||||||||||||
myai __repos | [args...] | Internal: list managed repo names (one per line) from config/managed_repos.txt — used by shell completion to fill in --repo values |
Details
myai setup [args...]
Global first-run wizard (once per machine, BEFORE any repo work): the ONE question — connect an existing brain (--brain <url> / $MYAI_BRAIN_REMOTE) or provision a new one (local by default, states the ownership/data-locality deal + consent, optional private remote). --yes for non-interactive consent. Auto-triggered by any other stateful command when ~/.myai/config is missing (see needsAutoSetup below) — never re-triggers once set up; --force redoes it. setup --machine is the separate machine-arrival path: idempotently checks/fixes Dropbox conflicts, git re-attach across the repo fleet, the Docker stack, npm's global prefix, and runner registration in one pass — reports fixed vs. needs-operator (--dry-run/--yes/--install-runner/--rebuild-docker/--json)
Dispatches to scripts/myai_setup.sh.
myai init [path]
Greenfield by default: drop a ~30-line kernel CLAUDE.md + gitignored .myai-local (no AI/ folder) — framework resolves from the installed module. --managed forces the legacy AI/-scaffold (portable docker-compose + .env + guided wizard); --force replaces a non-kernel CLAUDE.md; --zero-prompt (or env MYAI_ZERO_PROMPT=1) guarantees a scripted/headless run never blocks on stdin, regardless of TTY state
Dispatches to scripts/myai_init.sh.
myai up [args...]
Start the self-contained stack (gateway + dashboard + mongo) on localhost, wait for health, print the dashboard URL
Dispatches to scripts/myai_up.sh.
myai down [args...]
Stop the stack cleanly (--volumes also drops the mongo data volume)
Dispatches to scripts/myai_down.sh.
myai status [args...]
Gateway/runner/queue health at a glance: gateway/dashboard HTTP health, docker compose ps, task-queue counts, continuity meter, and the local off-hours runner's installed/active state (--json for scripts; exit 0 = healthy)
Dispatches to scripts/myai_status.sh.
myai boot [args...]
TOKEN-FREE session boot — the deterministic spine of agent mode -min with zero LLM cost: git sync (ff-only pull), brain delta since last boot (pure git) INCLUDING the compiled brief.md/working.md read straight off brain main on disk (zero gateway dependency, BRAIN_OFFLINE.md Layer 3), schedule banner, remote-control status. Run BEFORE opening Claude. --no-fetch | --no-pull | --working (also print working.md) | --offline (skip git fetch + the two gateway-backed banners entirely — guaranteed to complete with the stack fully down) | --quiet
Dispatches to scripts/myai_boot.sh.
myai logs [service...]
Live-tail stack logs — wraps docker compose logs -f (optionally one service: gateway | dashboard | mongo; --no-follow, --tail N); --runner also tails the local off-hours CLI runner's latest job log alongside it, prefixed [runner]
Dispatches to scripts/myai_logs.sh.
myai queue [args...]
Inspect and control the runner task queue — the CLI mirror of the dashboard /work orchestration view. queue / queue list [--repo][--status][--priority][--all][--json]; queue cancel <taskId> [--reason][--force] marks it blocked (reversible); queue reprioritize <taskId> <P0|P1|P2|P3> changes its priority
Dispatches to scripts/myai_queue.sh.
myai open [target...]
Jump from the terminal to the right dashboard view in one keystroke: open/open dashboard (root), open board (THIS repo's /work board — repo auto-detected from the git checkout, --repo overrides), open task <id> (deep-link a queue task — tab + repo resolved via the gateway when reachable, graceful /work fallback when not), open repo (App Directory /apps), or any named dashboard page (work | fleet | apps | brain | memory | system | …). Localhost vs hosted resolves from DASHBOARD_URL / MYAI_DASHBOARD_PORT (env wins over .env). Cross-platform launcher: macOS open / Linux xdg-open / WSL wslview / Windows start, MYAI_OPEN_CMD override, $BROWSER fallback; --print prints the URL instead of launching
Dispatches to scripts/myai_open.sh.
myai scan [path]
Spider git repos under a dir → register each in the gateway directory + seed RAG awareness (--register also lists in managed_repos.txt; --dry-run previews)
Dispatches to scripts/myai_scan.sh.
myai demo [args...]
Seed the dashboard with realistic sample data — tasks, schedules, plan, repo cards, memory, budget rows (idempotent; --clean removes, --force re-seeds)
Dispatches to scripts/myai_demo.sh.
myai new-app [args...]
Two modes, one verb: new-app <path> scaffolds a full-stack app offline from the powerhouse blueprint (init_blueprint.sh flags all still work — --gh-create, --vercel, --mode, etc.); new-app "<idea>" (or --idea "<idea>") drives agentFlow's headless idea→app pipeline (POST /api/headless/new-app, x-gateway-local-token) and self-registers the produced repo via repos_upsert (ADR-021). Dispatches on argument shape: any whitespace in the first arg means idea mode
Dispatches to scripts/myai_new_app.sh.
myai connect [path]
Install the Connect Hub module into a project
Dispatches to scripts/init_connect.sh.
myai plug [agent...]
Plug ANY agent into your brain — one front door over both tiers. myai plug lists every agent + its one-liner; myai plug <agent> routes (claude|cursor|windsurf|codex|gemini|opencode = MCP auto-boot; ollama|chatgpt|print = blank-agent wrap) and forwards extra flags; myai plug proof runs the live continuity round-trip with no agent installed
Dispatches to scripts/myai_plug.sh.
myai connect-agent [args...]
Cooperating (MCP) tier of myai plug — print/install MCP config (claude | cursor | windsurf | codex | all) pointing at the local gateway, then verify the context_boot round-trip (--install writes, --no-verify skips)
Dispatches to scripts/myai_connect_agent.sh.
myai shim [args...]
Wrap-it tier of myai plug — fetch the operator context bundle and PREPEND it for a non-MCP agent: launch Ollama pre-loaded, or compose a paste-ready ChatGPT primer; a prompt is forwarded as a lazy-recall query (--model, --repo, --no-deep, --copy)
Dispatches to scripts/betac_shim.sh.
myai schedule [args...]
Queue an autonomous task for the CLI runner (pass --title, etc.)
Dispatches to scripts/schedule_task.sh.
myai login [args...]
Authenticate this terminal against a hosted myAI gateway — validates a per-tenant API key via GET /api/auth/whoami and persists it (--key <apiKey> or $MYAI_API_KEY or an interactive hidden prompt; --gateway-url URL; --json). End-user session identity — distinct from myai config (local schema-validated key editing, no gateway round-trip) and tenant-key rotation (operator CRUD)
Dispatches to scripts/myai_login.sh.
myai whoami [args...]
Print the active org/tenant/plan/quota for the session myai login established — always round-trips to the gateway for live quota (--gateway-url URL override; --json)
Dispatches to scripts/myai_whoami.sh.
myai config [args...]
Safe front-end for the per-user ~/.myai/config store — view/set keys (org, gateway URL, brain wiring, model routing) with SCHEMA VALIDATION instead of hand-editing the JSON: config/config list [--json][--reveal] (values redacted where secret-shaped, unknown keys flagged); config keys (the schema: every known key + type + description); config get <key>; config set <key> <value> (per-key validation — URL/enum/path/model-id; unknown keys refused unless --force; secret-named keys ALWAYS refused — credentials live in ~/.myai/credentials via myai login/myai rotate-keys, never in config); config unset <key>; config path. Purely local (no gateway round-trip)
Dispatches to scripts/myai_config.sh.
myai mcp [args...]
Propagate the MCP server config through the installed module (not update_all): mcp repo [path] writes/refreshes a repo .mcp.json from the bundled template (deep-merge — framework servers canonical, custom preserved); mcp vscode [path] does the same for the VS Code .vscode/mcp.json (Copilot/Codex-in-VS-Code agent mode); mcp sync [museum|tech|personal|all] refreshes the per-org Claude config dirs from the template; mcp print shows the base config. --dry-run supported
Dispatches to scripts/myai_mcp.sh.
myai mirror [args...]
Keep a LOCAL copy of the gateway memory + registry so localhost is not single-point-of-failure on Atlas. Streams mongodump→mongorestore (Atlas → local by default) in a throwaway mongo:7 container — no host mongo tools. --dry-run previews; --collections a,b scopes; --reverse (local → Atlas) is guarded behind --yes; --install-schedule [--every-minutes N] / --schedule-status / --uninstall-schedule manage the periodic (hourly default) launchd/cron refresh
Dispatches to scripts/mongo_mirror.sh.
myai sync [args...]
ADR-022 local-first mongo mode: converge Atlas and the local myai-mongo in whichever direction is designated PRIMARY. Plain call syncs PRIMARY → SECONDARY (idempotent); sync status shows primary + last successful sync; sync set-primary atlas|local flips the designation; --dry-run previews; --collections a,b scopes. sync schedule install|status|uninstall [--every-minutes N|--every-hours N] installs/inspects/removes BOTH the periodic sync job and an independent staleness canary that raises a notification-engine alert once the last successful sync exceeds a threshold — never installed automatically
Dispatches to scripts/mongo_sync.sh.
myai rotate-keys <local|tenant> [args...]
Self-rotate a gateway credential with a dual-valid grace window (zero-downtime): rotate-keys local [--grace-minutes N] rewrites GATEWAY_LOCAL_TOKEN in .env, keeping the old value valid for the grace window; rotate-keys tenant <tenantId> [--grace-minutes N] [--env live|test] mints a new tenant bootstrap API key via the gateway (local-trust only), old key stays valid server-side until grace elapses — new key is shown ONCE
Dispatches to scripts/myai_rotate_keys.sh.
myai tenant <create|list|suspend|reactivate|rotate-key> [args...]
Operator tenant lifecycle CRUD, scriptable from the terminal (wraps the gateway's admin-gated /api/tenants endpoints — needs ADMIN_API_TOKEN configured on the gateway): tenant create --tenant-id <id> --name <name> [--plan free|solo|team|scale] [--owner-email <email>] [--env live|test] provisions a tenant + first API key (shown ONCE); tenant list [--status active|suspended|deleted] [--plan <plan>] [--limit N]; tenant suspend <tenantId> [--reason "..."] blocks every key call instantly; tenant reactivate <tenantId> restores it; tenant rotate-key <tenantId> [--grace-minutes N] [--env live|test] delegates to rotate-keys tenant (local-trust only, zero-downtime grace window)
Dispatches to scripts/myai_tenant.sh.
myai runner [args...]
Manage the local off-hours CLI runner schedule (launchd/systemd) — install [--every-minutes N|--every-hours N] | uninstall | start | stop | status (+ next-fire) | logs [-f] [-n N]. Distinct from myai status/myai logs (gateway health) — this controls the local worker
Dispatches to scripts/myai_runner.sh.
myai brain [args...]
Git-versioned agent memory — init | status | write | stash | pop | branch | checkout | merge | log | diff | blame | revert | gc | session | distill (sessions = commits, wrap up = merge; walkthrough: TRY_BRAIN.md)
Dispatches to scripts/myai_brain.sh.
myai wrapup [args...]
The mechanical half of wrap up in ONE call (BRAIN W4.2): rotate_state.sh + repo_card.sh + memory_reindex + brain atom/merge/verify + the WRAPPED UP banner. wrapup --mechanical runs all five; pipe the ~300-token session summary on stdin (or --atom-file <path>) to also write + merge the brain atom (--no-atom skips it). Every step is individually non-fatal — a missing script or unreachable gateway degrades that one step and the run continues; exits 0. --topic <t> --repo <name> --slug <s> --profile <p> --reindex-scope master|all --no-rotate --no-card --no-reindex --quiet
Dispatches to scripts/myai_wrapup.sh.
myai memory [args...]
Portable memory bundle — export [dir] pulls the corpus (state/handoff/patterns source texts) as JSON manifest + markdown; import <dir> re-embeds on this gateway with dedup-by-hash
Dispatches to scripts/myai_memory.sh.
myai context [args...]
FULL portable context bundle — export [dir] tars memory corpus + vectors (embeddings) + brain atoms + config into ONE versioned, checksummed, secret-redacted .tar.gz; import <archive> verifies integrity and re-imports (memory always, brain/config opt-in); import-external <source> ingests FROM ChatGPT/Claude export, Obsidian, markdown, or a raw vector store (re-embed + dedup, tenant-scoped). Own + download your whole context.
Dispatches to scripts/myai_context.sh.
myai recall <query...>
TOKEN-FREE semantic recall over the repo-local SQLite index (code symbols + brain atoms) via sparse BM25 + local embeddings — NO LLM, NO network, NO tokens. Builds the index on first use. --k N | --json | --rebuild
Dispatches to scripts/myai_recall.sh.
myai ctx <query...>
TOKEN-FREE context lookup — the primitive that replaces bulk Read/Grep: bare file:line pointers + atom:<ref> refs, one per line, over the same repo-local SQLite index recall uses (NO LLM, NO network, NO tokens, fully offline — works with the gateway down). --k N | --json | --rebuild | --db PATH
Dispatches to scripts/myai_ctx.sh.
myai backup [args...]
Snapshot the git-versioned brain repo + ~/.myai config files into one dated .tar.gz archive (--out <file> or [dir] to place it; round-trips with myai restore)
Dispatches to scripts/myai_backup.sh.
myai restore [args...]
Restore a myai backup archive — brain repo → this machine's resolved dir (or --to <dir>) + config → ~/.myai; refuses to clobber without --force (existing state → .bak; --dry-run previews)
Dispatches to scripts/myai_restore.sh.
myai upgrade [args...]
Self-update the global CLI (npm update -g) then run pending config + brain schema migrations idempotently (--check reports without applying, exit 20 if pending; --dry-run previews; --no-self-update skips the npm step; --json for scripts)
Dispatches to scripts/myai_upgrade.sh.
myai doctor [args...]
Run preflight checks: docker (+engine), node, claude CLI, ANTHROPIC_API_KEY, cloud reachability, ollama availability, brain freshness, mongo mirror schedule (+last run), ports free. --dry-run previews the safe auto-fixes; --fix applies them idempotently (backfill non-secret .env keys from .env.example, redeploy statusline, correct runner cadence, pull latest gateway image) — never touches secrets or restarts the shared stack (--json for CI/scripts; exit 0 = passed)
Runs in-process (no shell script).
myai root [args...]
Print the installed ai-management module path — the framework-as-module resolver a kernel-only repo (no per-repo AI/ copy) uses to find agents/skills/hooks/rule bodies. Fails loud (exit 1) if the resolved dir is not a valid install, so safety hooks never silently go missing (--json for scripts)
Runs in-process (no shell script).
myai release [args...]
One-command release cut: release [patch|minor|major] bumps package.json + CHANGELOG.md from Conventional Commits, clean-room-validates (shell unit suite + publish_guard.sh leak scan + a Docker install/smoke check), and commits locally — any validation failure auto-reverts the bump. release --tag (run on main after the commit merges) tags + pushes the release and prints the gh release create follow-up. --dry-run previews; --skip-tests/--skip-guard/--skip-docker skip a validation stage; --json for scripts
Dispatches to scripts/myai_release.sh.
myai completions <shell>
Generate a shell completion script (commands, flags, and dynamic --repo names) for bash | zsh | fish. Prints to stdout; install instructions are inline as comments in the generated script. Command list is read straight off this table, so it can never drift from myai --help — enforced by runtime/tests/unit/cli-dispatch.test.ts
Runs in-process (no shell script).
myai repos [--paths] [--json]
Fleet roster (ADR-021 Phase 3 resolver shim): gateway DB repos collection preferred, config/managed_repos.txt bootstrap-seed fallback. Default prints repo names; --paths prints one absolute checkout path per line (for shell consumers); --json prints entries with name/path/source plus which resolver answered. MYAI_REPOS_NO_GATEWAY=1 forces the seed file
Runs in-process (no shell script).
myai __repos [args...]
Internal: list managed repo names (one per line) from config/managed_repos.txt — used by shell completion to fill in --repo values
Runs in-process (no shell script).
Global options: -h, --help · -v, --version.