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

# Quickstart: connect an agent to Dench

> Connect Cursor, Claude Code, Codex, or a custom AI agent to a Dench workspace in under five minutes using the dench CLI sign in flow.

The published package is `@dench.com/cli` and the binary is `dench`. Run it with
`npx -y -p @dench.com/cli dench <command>` or install it globally.

<Steps>
  <Step title="Sign in">
    Start the approval flow. Pick the command for your agent:

    <CodeGroup>
      ```bash Cursor theme={null}
      npx -y -p @dench.com/cli dench signin --kind cursor --name "Cursor Agent - Project"
      ```

      ```bash Claude Code theme={null}
      npx -y -p @dench.com/cli dench signin --kind claude_code --name "Claude Code - Project"
      ```

      ```bash Codex theme={null}
      npx -y -p @dench.com/cli dench signin --kind codex --name "Codex - PR Review"
      ```

      ```bash New workspace theme={null}
      npx -y -p @dench.com/cli dench signin --new-workspace --org-name "Example" --kind cursor --name "Cursor Agent - Project"
      ```
    </CodeGroup>

    <Warning>
      An agent cannot approve its own sign-in. The approval must come from a
      human in the browser.
    </Warning>
  </Step>

  <Step title="Approve in the browser">
    Open the printed link, confirm the workspace, and click **Approve**. No
    browser? Add `--email you@example.com` to get a 6-digit code instead.
  </Step>

  <Step title="Verify">
    Confirm the session and CRM access:

    ```bash theme={null}
    npx -y -p @dench.com/cli dench context --json
    npx -y -p @dench.com/cli dench crm objects list --json
    npx -y -p @dench.com/cli dench crm entries list task --json
    ```

    <Check>Setup is complete once approval succeeds and these commands return data.</Check>
  </Step>
</Steps>

## Stable identity

For a long-lived agent, set a stable session key before signing in:

```bash theme={null}
DENCH_SESSION_KEY=project-agent \
  npx -y -p @dench.com/cli dench signin --kind cursor --name "Cursor Agent - Project"
```

<Tip>
  Do not set `DENCH_SESSION_KEY` to internal `auto:` or `explicit:` values.
  Switch between existing sessions with `dench use <key-or-slug>`.
</Tip>

## Headless and CI

Skip the browser flow with a workspace API key from your settings:

```bash theme={null}
export DENCH_API_KEY="<workspace key>"
npx -y -p @dench.com/cli dench crm entries list people --json
```

## Troubleshooting

<AccordionGroup>
  <Accordion title="dench: command not found" icon="triangle-exclamation">
    Use `npx -y -p @dench.com/cli dench <command>`. A bare
    `npx -y @dench.com/cli …` fails because npx can't find a bin matching the
    package name.
  </Accordion>

  <Accordion title="status says no session" icon="user-slash">
    Run `dench signin` once and ask the human to approve it.
  </Accordion>

  <Accordion title="Multiple sessions exist" icon="layer-group">
    Run `dench sessions --json`, ask which to use, then `dench use <key-or-slug>`.
  </Accordion>

  <Accordion title="402 upgrade_required" icon="lock">
    Chat, files, enrichment, and image-gen are paid. Run `dench upgrade --tier pro`
    and share the link. See [Billing](/billing).
  </Accordion>
</AccordionGroup>

## Next

<CardGroup cols={2}>
  <Card title="CRM playbook" icon="database" href="/crm">
    Model people, companies, tasks, and custom objects.
  </Card>

  <Card title="API playground" icon="code" href="/api/overview">
    Try every endpoint live with your bearer token.
  </Card>
</CardGroup>
