> ## Documentation Index
> Fetch the complete documentation index at: https://docs.agentlinkops.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Connect with the CLI

> Use the agentlinkops CLI to call AgentLinkOps with a scoped credential, inspect the command catalog and optionally connect a local ledger to your project.

`agentlinkops` is the command-line client for AgentLinkOps: `npm install -g agentlinkops` (Node.js 22 or later), or `npx -y agentlinkops …` without installing. Source and issues: [sunlover7/agentlinkops-cli](https://github.com/sunlover7/agentlinkops-cli), Apache-2.0.

The `linktrail` command, the `LINKTRAIL_*` variables and an existing `.linktrail/` directory keep working as compatibility aliases during the pilot window, each with a one-line notice. They are removed in a separate dated release after pilot customers are notified (DP-0029-T05); use the AgentLinkOps names in new setups. [CLI configuration](/reference/local/configuration) lists the alias rules.

```bash theme={null}
agentlinkops --help
```

If you have hosted access and no CLI package, [connect through MCP](/guides/connect-mcp) or use the [HTTP API](/guides/connect-http). For a local check with the supplied CLI, use [check one backlink](/guides/first-result).

## Connect a hosted project

In the app, select your workspace and open Agent access to create an API credential. Grant access to the intended project and the scopes needed by your task. The project-list example below requires `projects:read`. Supply it through `AGENTLINKOPS_TOKEN` in your environment, and set `AGENTLINKOPS_API_URL` to `https://app.agentlinkops.com`.

`AGENTLINKOPS_API_KEY` is also accepted. If both credential variables are set to different values, the command fails. Keep credentials out of committed files.

## Call a shared operation

A documented command can be absent from your connected server. Read the catalog first, and check [availability](/capability-status) when a command is missing.

```bash theme={null}
agentlinkops tools
agentlinkops call list_projects \
  --args '{}'
```

The catalog lists input schemas and required scopes. Use `call NAME --file arguments.json` for a larger JSON object. Reference examples show the executable as `agentlinkops`; use your linked command or the full `node` path above.

Choose a project from the response before any write. Then follow [check a placement](/guides/check-placement).

## Optional: connect a ledger

Run these commands from the directory that will own the [ledger files](/ledger). Sync requires `projects:read`, `watches:read`, `watches:write`, `events:read` and `exports:create`.

```bash theme={null}
agentlinkops init
agentlinkops connect \
  --workspace YOUR_WORKSPACE_ID \
  --project-id YOUR_PROJECT_ID \
  --origin https://app.agentlinkops.com
agentlinkops sync --dry-run
```

`init` creates `.agentlinkops/`; if the directory already exists under its old name, run `agentlinkops migrate` first. `connect` reads the workspace and project before saving connection metadata. It stores no credential. A ledger connected to another identity needs a separate ledger so its cursors and mappings stay coherent.

[Sync and export](/guides/sync-and-export) explains what crosses the connection. Run `doctor` for configuration or cloud-access failures, then use [troubleshooting](/guides/troubleshooting).

## Discovery verbs and agent setup

The CLI has the same three verbs the hosted views use: `agentlinkops tools [TOOLSET]` prints the command index from a bundled catalog snapshot with no account (`--refresh` reads the live catalog), `agentlinkops describe NAME` prints one command's exact input schema (retired names resolve and say so), and `agentlinkops call NAME --args JSON` runs it, with `--set path=value`, `--dry-run` and `-y`. `agentlinkops agent setup` installs the skill pack and the right MCP view for each detected client (Claude Code, Codex, Cursor, Gemini CLI, Hermes) and stores no credential; `agentlinkops agent status` shows what is configured. `agentlinkops skill` prints the [agent reference](/reference/agent-reference) an agent reads once per session; `init`, `tools` and `agent setup` remind it to. The hosted side of these verbs is live since release ba77c919 (2026-09-16) and the CLI is `agentlinkops` 0.5.0 on npm (source: [sunlover7/agentlinkops-cli](https://github.com/sunlover7/agentlinkops-cli)).
