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

# OpenClaw

> Use Nia in OpenClaw through a ClawHub skill for indexed search, source-aware answers, and research workflows.

The Nia integration for [OpenClaw](https://docs.openclaw.ai/tools/clawhub) is distributed through [ClawHub](https://clawhub.ai), the public skill registry for OpenClaw. It gives your OpenClaw workspace direct access to Nia for indexing and searching code repositories, documentation, research papers, and HuggingFace datasets.

<Info>
  **OpenClaw uses skills through ClawHub**: the integration is delivered as a skill, but the day-to-day experience is still an agent-native Nia workflow inside OpenClaw.
</Info>

***

## Install with ClawHub

<CardGroup cols={2}>
  <Card title="ClawHub Listing" icon="paw" href="https://www.clawhub.ai/arlanrakh/nia">
    Open the Nia listing in ClawHub and add it to your OpenClaw workspace.
  </Card>

  <Card title="OpenClaw Skill Docs" icon="book-open" href="https://docs.openclaw.ai/tools/clawhub">
    Learn how ClawHub installs and syncs skills into your OpenClaw workspace.
  </Card>
</CardGroup>

***

## Features

<CardGroup cols={2}>
  <Card title="Repository Indexing" icon="code-branch">
    Index GitHub repositories and search through code with semantic and regex search.
  </Card>

  <Card title="Documentation Search" icon="book">
    Index entire documentation sites and search across all pages.
  </Card>

  <Card title="Research Papers" icon="file-lines">
    Index arXiv papers by ID, URL, or PDF link for AI-powered research.
  </Card>

  <Card title="HuggingFace Datasets" icon="database">
    Index and search HuggingFace datasets by name or URL.
  </Card>
</CardGroup>

***

## Configure Nia

### 1. Get Your API Key

Either run the guided wizard:

```bash theme={null}
npx nia-wizard@latest
```

Or sign up at [trynia.ai](https://trynia.ai) to get your key.

### 2. Store the Key

```bash theme={null}
mkdir -p ~/.config/nia
echo "your-api-key-here" > ~/.config/nia/api_key
```

### 3. Requirements

* `curl`
* `jq`

<Note>
  Most systems have these pre-installed. On macOS, install with `brew install jq` if needed.
</Note>

***

## Nia-First Workflow

Before using web fetch or web search, you should:

1. **Check indexed sources first** using `repos-list.sh` or `sources-list.sh`
2. **If source exists**: Use `search-universal.sh`, `repos-grep.sh`, `sources-read.sh` for targeted queries
3. **If source doesn't exist but you know the URL**: Index it with `repos-index.sh` or `sources-index.sh`, then search
4. **Only if source unknown**: Use `search-web.sh` or `search-deep.sh` to discover URLs, then index

<Info>
  **Why this matters**: Indexed sources provide more accurate, complete context than web fetches. Web fetch returns truncated/summarized content while Nia provides full source code and documentation.
</Info>

***

## Available Scripts

All scripts are in `./scripts/`. Base URL: `https://apigcp.trynia.ai/v2`

### Repositories

| Script                                      | Description        |
| ------------------------------------------- | ------------------ |
| `repos-list.sh`                             | List indexed repos |
| `repos-index.sh "owner/repo" [branch]`      | Index a repo       |
| `repos-status.sh "owner/repo"`              | Get repo status    |
| `repos-tree.sh "owner/repo" [branch]`       | Get repo tree      |
| `repos-read.sh "owner/repo" "path/to/file"` | Read file          |
| `repos-grep.sh "owner/repo" "pattern"`      | Grep code          |

### Data Sources (Docs, Papers, Datasets)

| Script                                        | Description                                                         |
| --------------------------------------------- | ------------------------------------------------------------------- |
| `sources-list.sh [type]`                      | List sources (documentation, research\_paper, huggingface\_dataset) |
| `sources-index.sh "https://docs.example.com"` | Index docs                                                          |
| `sources-tree.sh "source_id_or_name"`         | Get source tree                                                     |
| `sources-read.sh "source_id" "/path"`         | Read from source                                                    |
| `sources-grep.sh "source_id" "pattern"`       | Grep content                                                        |

### Research Papers (arXiv)

| Script                         | Description                       |
| ------------------------------ | --------------------------------- |
| `papers-list.sh`               | List indexed papers               |
| `papers-index.sh "2312.00752"` | Index paper (ID, URL, or PDF URL) |

### HuggingFace Datasets

| Script                      | Description                                 |
| --------------------------- | ------------------------------------------- |
| `datasets-list.sh`          | List indexed datasets                       |
| `datasets-index.sh "squad"` | Index dataset (name, owner/dataset, or URL) |

### Search

| Script                                | Description                |
| ------------------------------------- | -------------------------- |
| `search-universal.sh "query"`         | Search ALL indexed sources |
| `search-web.sh "query" [num_results]` | Web search                 |
| `search-deep.sh "query"`              | Deep research (Pro)        |

### Package Search

| Script                                    | Description                                           |
| ----------------------------------------- | ----------------------------------------------------- |
| `package-grep.sh "npm" "react" "pattern"` | Grep package (npm, py\_pi, crates\_io, golang\_proxy) |
| `package-hybrid.sh "npm" "react" "query"` | Semantic search in packages                           |

### Oracle Research (Pro)

| Script                       | Description             |
| ---------------------------- | ----------------------- |
| `oracle.sh "research query"` | Run autonomous research |
| `oracle-sessions.sh`         | List research sessions  |

***

## API Reference

| Type                | Endpoint                     | Identifier Examples              |
| ------------------- | ---------------------------- | -------------------------------- |
| Repository          | `POST /repositories`         | `owner/repo`, `microsoft/vscode` |
| Documentation       | `POST /data-sources`         | `https://docs.example.com`       |
| Research Paper      | `POST /research-papers`      | `2312.00752`, arXiv URL          |
| HuggingFace Dataset | `POST /huggingface-datasets` | `squad`, `owner/dataset`         |

***

## Links

<CardGroup cols={2}>
  <Card title="ClawHub Listing" icon="paw" href="https://www.clawhub.ai/arlanrakh/nia">
    View the Nia skill on ClawHub
  </Card>

  <Card title="OpenClaw Docs" icon="book-open" href="https://docs.openclaw.ai/tools/clawhub">
    Learn how OpenClaw loads and syncs skills
  </Card>
</CardGroup>

***

<Warning>
  **Need Help?** Join our [Discord community](https://discord.gg/BBSwUMrrfn) or reach out through [app.trynia.ai](https://app.trynia.ai/) for support.
</Warning>
