What the CLI remembers
The CLI saves the active context to~/.ish/config.json (or wherever ISH_HOME
points). Four handles live there:
| Field | Set by | Falls back for |
|---|---|---|
workspace | ish workspace use <id> | --workspace |
study | ish study use <id> | --study |
ask | ish ask use <id> | the ask positional argument |
chat_endpoint | ish chat endpoint use <id> | the endpoint argument / --endpoint |
study, ask, and chat_endpoint are all scoped
to one workspace, so switching workspaces clears the other three (more on that
below).
How a flag resolves
When a command needs a workspace, study, or ask and you didn’t pass it, the CLI resolves it in a fixed order. The first source that has a value wins:Explicit flag
--workspace <id>, --study <id>, or --ask <id> on the command. An
explicitly empty value (--study "") is a usage error, not a fall-through,
so a typo never silently attaches work to the active study.Environment variable
ISH_WORKSPACE, ISH_STUDY, or ISH_ASK. Set one for the length of a shell
session or a CI job without touching the saved config.no_active_workspace, no_active_study, or no_active_ask) at exit code 1
(general error), and the message names the exact command to fix it. The error
carries suggestions so an agent can branch on the code instead of scraping prose.
An explicitly empty flag (--study "") is different: it’s a usage error at exit
code 2. See JSON mode and exit codes for the envelope shape.
An explicit flag or env var overrides the saved value for that one invocation
without changing the config. Use
--workspace <id> to poke at another workspace
and leave your active selection intact.Inspecting it
ish status (alias ish whoami) is the canonical way to see the active context.
Run it first on a cold start: it confirms you’re signed in and prints the active
workspace, study, ask, and chat endpoint.
status is safe to run unconditionally. When you’re logged out it does not error;
it returns user: null with a hint field telling you to run ish login. The
full command, including the JSON shape, is on the
session reference page.
Orphan and stale refs
An active handle can outlive the thing it points at: the study gets deleted, moves workspace, or belongs to an account you’ve since logged out of. Rather than silently drop the name,status attaches a warning and a hint to that ref
telling you to switch or clear it.
⚠ line under the row.
Setting and clearing it
<entity> use accepts a UUID or an alias. Under --json it
prints { id, alias, name, active } to stdout, so you can capture the active
selection in one step:
- Switching workspace (
ish workspace use <other>) clears the active study, ask, and chat endpoint. They belonged to the previous workspace, and keeping them would point later commands at the wrong place. The CLI prints a notice. - Creating auto-activates the new entity, so the natural next command just
works.
ish study createprints a notice (Active study set to ...), but only in human output, not under--json.ish ask createandish ask run --newauto-activate the new ask without a dedicated active-context notice, so checkish statusif you need to confirm what’s active after creating an ask. - Deleting (
ish workspace delete,ish study delete,ish ask delete,ish chat endpoint delete) clears any matching active ref so later commands don’t render an orphan, and prints a notice. Deleting a workspace clears all its children. ish logoutclears the whole active context alongside the tokens. A selection made as one account is meaningless for the next one that logs in.
The MCP server has no active context
The MCP server is stateless. There is no saved workspace. The agent carries each handle the previous call returned. Discovery and creation tools (workspace_get, study_get, study_create) take an explicit workspace_id;
once a call hands back a study_id, downstream tools (study_add_iteration,
study_run) key off that id instead.
w-6ec, s-b2c, i-d4e), and
any parameter that takes a UUID accepts the alias in its place, so an agent reuses
what the last call handed back rather than threading a 36-character UUID. The
alias cache is in-memory and resets on server restart, so re-list before reusing a
handle from an earlier session.
Related
- Workspace, study, and the run vs ask distinction, the three things active context tracks.
- Session reference for the full
status/whoamioutput and JSON shape. - Global flags for
--workspace/--study/--ask, aliases, capture mode, and exit codes. - Tool conventions for how aliases carry identity across MCP calls.