@tryglen/cli
v0.9.4
Published
Glen CLI — memory for coding agents
Readme
@tryglen/cli
Glen CLI — shared team memory for coding agents.
Install
npm install -g @tryglen/cli
glen loginCommands
| Command | Description |
|---|---|
| glen login | Connect via browser sign-in; writes credentials and initial session state. |
| glen logout | Sign out and remove credentials + session state. |
| glen status | Show connection status, active org, incognito state, and CLI version. |
| glen search "<query>" | Search the team's shared glen memory. |
| glen incognito on\|off | Toggle incognito mode: while on, nothing is recorded (recall keeps working). |
| glen org list | List your organizations; active one is marked with ✓. |
| glen org switch [slug] | Switch the active organization for this machine (interactive picker without slug). |
| glen ingest [--agent <name>] | Ingest a turn from stdin — used by agent hooks (claude-code or codex). |
| glen install [--agent <claude\|codex>] | Set up or update glen for detected coding agents (plugin + hooks); idempotent, so re-running repairs a broken setup. --claude-path <path> / --codex-path <path> point at a binary when auto-detection fails. |
| glen update | Update the glen CLI and any installed glen plugins, and re-verify the Codex hook registration. Never installs a plugin that isn't already installed — that's glen install's job. |
| glen doctor [--auto] | Print machine-readable status: lines (CLI version/latest/channel, login + org, per-agent plugin + hook state) plus → remedy lines — the setup skill branches on them. --auto runs background updates silently (used by hooks). |
| glen statusline | Output a single status line for the agent's UI status bar — used by hooks. |
| glen session-start [--agent <name>] | Output hook JSON for the agent's SessionStart event — used by hooks. |
| glen version | Print the CLI version. |
Files
| File | Description |
|---|---|
| ~/.glen/credentials.json | API key credential — mode 0600, never logged or sent to anyone but tryglen.com. |
| ~/.glen/state.json | Client-owned session state: { activeOrgId, activeOrgSlug, activeOrgName, incognito }. Non-secret. |
The state file is what the CLI sends as x-glen-org-id / x-glen-incognito headers on every request. The server validates org membership on every call — no state is stored server-side.
Environment variables
| Variable | Default | Description |
|---|---|---|
| GLEN_BASE_URL | https://app.tryglen.com | Override the glen server URL (useful for local dev). |
| GLEN_CREDENTIALS_PATH | ~/.glen/credentials.json | Override credentials file location. |
| GLEN_STATE_PATH | ~/.glen/state.json | Override state file location. |
| GLEN_NO_AUTO_UPDATE | unset | Set to 1 to disable automatic background updates. Also disabled when CI=true. |
Update behavior
The CLI uses layered silent auto-update so you stay current without thinking about it:
- Background TTL check (daily): once per 24 hours, when installed via npm globally, the CLI spawns a detached
npm install -g @tryglen/cli@latestprocess that doesn't block your turn. A~/.glen/update-check.jsontimestamp controls the cadence. - SessionStart hook (
glen doctor --auto): on every agent session start, the hook also triggers background update + plugin upgrade hints. Same detached, non-blocking approach. - Server-driven 426 floor: if the server requires a newer CLI version (breaking API change), it responds with
HTTP 426 Upgrade Required. The CLI then runs a synchronous self-update and re-execs your original command withGLEN_REEXEC=1set to prevent infinite loops. If the update fails or you are below the minimum after re-exec, it exits with a message to runnpm i -g @tryglen/cli@latestmanually.
Escape hatches:
GLEN_NO_AUTO_UPDATE=1disables all background update attempts.CI=true(set automatically in GitHub Actions and most CI systems) also disables them.- The CLI only self-updates when installed globally via npm (it detects this by comparing the binary's real path against
npm prefix -g). If you installed via another package manager, you get a hint to update with your own tooling instead.
Troubleshooting
glen status shows "not connected"
Run glen login to authenticate via browser.
glen search / glen ingest prints "no active organization"
Run glen org switch (or glen login if you've never connected) to pick an organization.
426 error in CI or non-npm installs
The server requires a newer CLI version. Run npm i -g @tryglen/cli@latest (or equivalent for your package manager) and retry.
Stuck update lock If a previous update was interrupted, a stale lock can prevent future auto-updates:
rm -rf ~/.glen/update.lockglen doctor for a full picture
Run glen doctor to see your version, the latest available, install channel, and session state in one place.
