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

# Local Development

> Develop, test, and iterate on teams locally with cliqd --no-login — including HUG gates.

<div className="cliq-kicker">Tutorial</div>

This guide walks through the **local development loop**: build a team on your machine, run it, test human gates, iterate, and publish when ready. No CliqHub account needed until you publish.

***

## Start the daemon locally

```bash theme={"theme":{"light":"github-light","dark":"one-dark-pro"}}
cliqd --no-login
```

`--no-login` (alias `--standalone`) starts cliqd in **local-only mode**: no CliqHub enrollment, no sync, no realm. Everything runs on your machine. Teams install under the `@local` scope by default.

Leave this terminal open. Open a new terminal for the CLI.

***

## The local dev loop

### 1. Create a team directory

```bash theme={"theme":{"light":"github-light","dark":"one-dark-pro"}}
mkdir my-team && cd my-team
```

Create `team.yml`:

```yaml theme={"theme":{"light":"github-light","dark":"one-dark-pro"}}
name: my-team
version: 0.1.0
description: My first team

inputs:
  task:
    type: string
    required: true
    description: What to work on

phases:
  - name: work
    type: standard
    agent: cursor
    role: |
      You are a senior engineer.
      Implement the task the user describes.
```

### 2. Install the team

```bash theme={"theme":{"light":"github-light","dark":"one-dark-pro"}}
cliq team install .
```

This installs the team from the current directory into cliqd's catalog. cliqd validates the manifest, checks that the referenced agents exist, and stores it.

### 3. Set up a workspace

```bash theme={"theme":{"light":"github-light","dark":"one-dark-pro"}}
cliq init .
cliq assemble @local/my-team
```

`cliq init` registers the directory as a workspace. `cliq assemble` binds the installed team to it.

### 4. Run

```bash theme={"theme":{"light":"github-light","dark":"one-dark-pro"}}
cliq run -i task="Write a hello world script in Python"
```

cliq streams progress as phases execute. Exit code `0` = success, `1` = failure, `3` = missing inputs.

### 5. Iterate

Edit `team.yml`, then reinstall and run:

```bash theme={"theme":{"light":"github-light","dark":"one-dark-pro"}}
cliq team install . --force
cliq run -i task="Write unit tests for the hello world script"
```

`--force` overwrites the existing installation. The workspace assembly stays bound — no need to re-assemble.

***

## Testing human gates (HUG) locally

When cliqd runs in local mode, HUG gates use a **local review flow** instead of CliqHub. The daemon creates a local review and polls for a verdict.

### Add a gate to your team

```yaml theme={"theme":{"light":"github-light","dark":"one-dark-pro"}}
phases:
  - name: implement
    type: standard
    agent: cursor
    role: |
      Implement the feature described in the task.

  - name: review
    type: gate
    agent: hug
    depends_on: [implement]
    review:
      reviewers:
        - channels: ["{{inputs.reviewer}}"]
      timeout: 60
      on_timeout: escalate

inputs:
  task:
    type: string
    required: true
  reviewer:
    type: string
    required: true
```

### Run with inputs

```bash theme={"theme":{"light":"github-light","dark":"one-dark-pro"}}
cliq team install . --force
cliq run -i task="Add error handling" -i reviewer=elan
```

The run pauses at the `review` gate. In local mode, use the daemon's HUG API to submit a verdict:

```bash theme={"theme":{"light":"github-light","dark":"one-dark-pro"}}
# Check the review status
curl -s http://127.0.0.1:4900/v1/hug/get_review \
  -H 'Content-Type: application/json' \
  -d '{"run_id": "<run_id>"}' | jq .

# Approve it
curl -s http://127.0.0.1:4900/v1/hug/verdict \
  -H 'Content-Type: application/json' \
  -d '{"review_id": "<review_id>", "action": "approve", "comment": "Looks good"}'
```

The run resumes after the verdict. This lets you test the full gate flow without CliqHub.

***

## Validate before publishing

Check your team for errors without installing:

```bash theme={"theme":{"light":"github-light","dark":"one-dark-pro"}}
cliq team validate
```

This runs the same validation pipeline as `cliq team publish --dry-run`: schema checks, DAG validation, input scanning, and agent requirement checks. Exit code `1` means something is wrong.

### Bump the version

```bash theme={"theme":{"light":"github-light","dark":"one-dark-pro"}}
cliq team version --patch    # 0.1.0 → 0.1.1
cliq team version --minor    # 0.1.0 → 0.2.0
```

***

## Viewing logs

```bash theme={"theme":{"light":"github-light","dark":"one-dark-pro"}}
cliq logs              # latest run
cliq logs -f           # follow live
cliq logs --last 5     # list recent runs
```

Per-run logs are stored at `~/.cliqrc/logs/runs/<daemon_id>/<run_id>.log`.

***

## Going from local to CliqHub

When your team is ready for production:

### 1. Start cliqd with CliqHub

Stop the `--no-login` daemon and start a normal one:

```bash theme={"theme":{"light":"github-light","dark":"one-dark-pro"}}
cliqd
cliq login --realm myorg.production
```

The first login enrolls cliqd in a realm. See [Realms](/realms) for what happens during enrollment.

### 2. Publish

```bash theme={"theme":{"light":"github-light","dark":"one-dark-pro"}}
cliq team publish ./my-team --access public
```

The team is now in the CliqHub catalog. Other daemons in your realm can install and run it.

### 3. Add to realm

A realm admin adds the team to the realm's team list in CliqHub. Once added, runs from any daemon in the realm appear in the CliqHub dashboard.

***

## Tips

* **Agent credentials**: Set them with `cliq settings set agents.<name>.<key> <value>` (e.g. `agents.cursor.api_key`). They persist across restarts.
* **Multiple teams**: A workspace can hold several teams. Use `cliq run -t @local/my-team` to pick one.
* **Reset state**: `cliqd --reset-db --yes` wipes workspaces, runs, and teams but keeps your identity and login.
* **Export a team**: `cliq team export @local/my-team -d ./export` writes the installed manifest to disk for editing.
* **No daemon needed**: `cliq team validate` and `cliq team version` work on local files without cliqd running.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.