# @signetai/connector-openclaw

Signet connector for OpenClaw (and its earlier names: clawdbot, moltbot).

## Overview

Unlike other harnesses, OpenClaw reads `~/.agents/AGENTS.md` directly, so no
generated output file is needed. Instead, this connector patches the JSON
config to point OpenClaw at the Signet workspace and configures the Signet
memory plugin.

## Installation

```bash
npm install @signetai/connector-openclaw
# or
bun add @signetai/connector-openclaw
```

## Usage

```typescript
import { OpenClawConnector } from '@signetai/connector-openclaw';

const connector = new OpenClawConnector();
await connector.install('~/.agents');
```

## What It Does

- Patches JSON config files: `~/.openclaw/openclaw.json`,
  `~/.clawdbot/clawdbot.json`, `~/.moldbot/moldbot.json`,
  `~/.moltbot/moltbot.json`
- Also discovers config via modern env vars used by OpenClaw:
  `OPENCLAW_CONFIG_PATH`, `CLAWDBOT_CONFIG_PATH`,
  `OPENCLAW_STATE_DIR`, `CLAWDBOT_STATE_DIR`
- State-dir discovery follows OpenClaw compatibility behavior and may
  detect legacy config filenames in that directory (`clawdbot.json`,
  `moldbot.json`, `moltbot.json`) in addition to `openclaw.json`
- Preserves legacy env compatibility used by older installs:
  `OPENCLAW_HOME`, `CLAWDBOT_HOME`, `MOLDBOT_HOME`, `MOLTBOT_HOME`,
  `OPENCLAW_STATE_HOME`
- Sets `agents.defaults.workspace` to point at `~/.agents`
- Selects `signet-memory-openclaw` as the memory plugin and adds it to
  `plugins.allow`
- Grants the plugin the explicit `hooks.allowConversationAccess` permission
  required for `agent_end` transcript capture
- Disables OpenClaw's built-in memory search and the legacy `signet-memory`
  internal hook to prevent duplicate memory paths
- Creates hook handler files in `~/.agents/hooks/agent-memory/` for
  legacy `/remember`, `/recall`, and `/context` command compatibility

## API

### `install(basePath: string, options?: OpenClawInstallOptions): Promise<InstallResult>`

Install the connector. Patches all found OpenClaw config files and installs
hook handler files. The plugin runtime is the default; pass
`{ runtimePath: "legacy" }` only for an older OpenClaw runtime.

### `uninstall(basePath?: string): Promise<UninstallResult>`

Uninstall the connector. Disables the `signet-memory` hook in all configs
and removes hook handler files.

### `isInstalled(): boolean`

Check whether any OpenClaw config has signet-memory enabled.

## Idempotent

Safe to run multiple times. Re-running `install()` will update configs and
hook files to the current expected state without duplicating or corrupting
existing configuration.

## License

Apache-2.0
