---
title: "alis context"
url: "https://docs.alisx.com/reference/cli/context/"
---
# alis context

Workspace context and telemetry for local coding-agent sessions: what the CLI resolves from the working directory, and how a session transcript reaches your Alis history.

## Synopsis

```bash
alis context view [<org>.<product>] [flags]
alis context push-session [flags]
alis context scan [flags]
```

## Description

The CLI resolves the build environment, product and service from the working directory when it is inside `~/alis.build/<org>/build/<product>/…`. `view` shows that resolution together with the product's deployment environments; `push-session` and `scan` feed coding-agent session data to your Alis history.

### Package IDs

A service's package ID `<org>.<product>.<path>.<vN>` maps deterministically to:

| | Example for `acme.shop.orders.v1` |
|---|---|
| resource | `organisations/acme/products/shop/neurons/orders-v1` (the service id is the path with `/` replaced by `-`) |
| implementation folder | `~/alis.build/acme/build/shop/orders/v1` |
| definitions folder | `~/alis.build/acme/define/acme/shop/orders/v1` |

Multi-segment paths and higher versions exist: `acme.shop.internal.api.v2` maps to `internal/api/v2`, id `internal-api-v2`.

### Omitting arguments

Inside a product directory, commands resolve the build environment and product; inside a service folder they also resolve the service, so `alis build` with no argument builds the service you are in. Dot references fill right-aligned: `alis environment refresh <env-id>` expands to `<org>.<product>.<env-id>`. Outside `~/alis.build`, always pass the full reference.

### Commits and branches

`define` uses the latest pushed commit of the definitions repo; `build` uses the latest pushed commit touching the service folder on the checked-out branch. Push first. `--branch` chooses another pushed branch; `--commit` pins one. A detached checkout must use `--branch`.

### Workstations

Inside a workstation the CLI is locked to that workstation's build environment; commands for another build environment fail with exit 1.

## Subcommands

### alis context view

Show the context the CLI resolves from the current working directory and an optional explicit reference: build environment, product, service package ID, local folders, and the product's deployment environments with their ids, production flag and Google Cloud project id. Run this before deploying instead of guessing deployment environment ids.

```bash
alis context view [<org>.<product>] [flags]
```

Sections that cannot be resolved are omitted, with the reason listed in `notes`: outside `~/alis.build` there is no local context; when not signed in the deployment environments are omitted.

No flags beyond the global flags.

### alis context push-session

Locate a local coding-agent session transcript (Claude Code, Codex or Gemini CLI), gzip it and save it to your Alis session history. The transcript is visible only to you and becomes searchable from the TUI's Sessions page. Credentials are masked as `[REDACTED:<kind>]` before the transcript leaves the machine. Transcripts larger than the 10 MiB cap (after compression) are tail-truncated to their most recent entries. Saved sessions are exempt from history garbage collection.

```bash
alis context push-session [flags]
```

| Flag | Type | Default | Meaning |
|---|---|---|---|
| `--harness <name>` | string | | Narrow the transcript search: `claude-code`, `codex`, `gemini` or `alis-agent`. |
| `--session <id>` | string | | Coding agent session id whose transcript to save. |
| `--yes` | bool | false | Skip the save confirmation prompt (same as `--approve`). |

### alis context scan

Run one pass of the context telemetry scanner: read new activity from local Claude Code, Codex and Gemini transcripts (scoped per the `contextTelemetry` setting in `~/.alis/settings.json`) and push the derived events to your sessions. The same scanner runs continuously inside the TUI; this command exists for headless environments such as cron on a workstation. A cross-process lock guarantees a single scanner per machine.

```bash
alis context scan [flags]
```

No flags beyond the global flags.

## Examples

```bash title="Terminal"
alis context view --json
alis --cwd ~/alis.build/acme/build/shop/orders/v1 context view --json
alis context view acme.shop --json
alis context push-session --harness claude-code --session <id> --json
```

## JSON output

`view` returns:

```json
{
  "organisation": "acme",
  "product": "shop",
  "packageId": "acme.shop.orders.v1",
  "serviceFolder": "/home/me/alis.build/acme/build/shop/orders/v1",
  "defineFolder": "/home/me/alis.build/acme/define/acme/shop/orders/v1",
  "environments": [
    {"id": "<env-id>", "displayName": "Development", "status": "ACTIVE", "production": false, "projectId": "<project-id>"},
    {"id": "<env-id>", "displayName": "Production", "status": "ACTIVE", "production": true, "projectId": "<project-id>"}
  ]
}
```

Outside a workspace only `notes` is returned.
