aiwrap configures Codex CLI and Claude Code on macOS with RTK token compression and Hindsight persistent memory, without replacing your existing codex or claude commands.
Install at least one supported AI CLI before running this installer:
- Codex CLI: https://developers.openai.com/codex/cli
- Claude Code: https://docs.anthropic.com/en/docs/claude-code
This project intentionally does not install Codex or Claude for you.
curl -fsSL https://raw.githubusercontent.com/SetuHQ/aiwrap-relay/main/install.sh | sh
aiwrap doctor
codex
claudeIf only Codex is installed, aiwrap configures Codex only. If only Claude is installed, it configures Claude only. If neither exists, install stops with clear guidance.
- Installs
aiwrapunder your home directory. - Installs wrapper-managed RTK under
~/.ai-cli-wrapper/bin/rtk. - Configures RTK using upstream-supported setup:
- Claude:
rtk init -g - Codex:
rtk init -g --codex
- Claude:
- Registers the self-hosted Hindsight MCP endpoint for detected clients.
- Removes the obsolete vendored
hindsight-mcpbinary and its client entries. - Provides
aiwrap doctoras the validation and repair loop.
- Does not install Codex CLI.
- Does not install Claude Code.
- Does not require Homebrew, npm global install, Cargo, pip, or sudo for users.
- Does not replace
codexorclaude. - Does not affect browser/chat apps such as ChatGPT web or Claude.ai.
- Does not run, install, or bundle a Hindsight server — it only points clients at yours.
- Does not configure Hindsight Cloud. It reads the local tenant token from
~/hindsight/.envand never writes to that file. - Does not remove unrelated MCP servers or user config. The one exception is the obsolete
hindsight-mcpentry that earlier versions ofaiwrapcreated themselves.
aiwrap install
aiwrap doctor
aiwrap doctor --verbose
aiwrap repair
aiwrap repair rtk
aiwrap repair mcp
aiwrap uninstallAfter install, continue using your normal codex and claude commands.
aiwrap points detected clients at a self-hosted Vectorize Hindsight server over HTTP. It does not run or bundle a memory server itself — set the service up first (see ~/hindsight/README.md), then:
aiwrap repair mcpConnection details are read from ~/hindsight/.env, overridable per-shell:
| Variable | Default | Meaning |
|---|---|---|
HINDSIGHT_URL |
http://127.0.0.1:8888 |
API base URL |
HINDSIGHT_BANK |
pulkit |
bank the MCP endpoint is pinned to |
HINDSIGHT_TOKEN |
from ~/hindsight/.env |
tenant API key |
Name collision.
hindsight-mcpon npm is a different product (hindsight-ai/hindsight-ai). aiwrap ≤ 0.1.2 vendored it and ran it over stdio.aiwrap installandaiwrap repair mcpnow delete that binary and remove its client registration.
codex / claude
|
+-- RTK configured by upstream init
|
+-- Hindsight MCP (streamable HTTP)
|
+-- http://127.0.0.1:8888/mcp/<bank>/
|
+-- self-hosted Hindsight (docker, ~/hindsight)
~/.ai-cli-wrapper/stores managed binaries, config, logs, and backups.~/.local/bin/aiwrapsymlinks to the managed binary.~/.codex/config.tomlreceives an[mcp_servers.hindsight]table written directly, because the Codex desktop app ships no CLI and, being a GUI app, cannot resolvebearer_token_env_varfrom your shell environment.- Claude Code user MCP config receives a
hindsightentry viaclaude mcp add --scope user. ~/hindsight/.envis read for the API token. It is never written to.
| Symptom | Likely Cause | Fix |
|---|---|---|
aiwrap: command not found |
~/.local/bin is not on PATH |
Add export PATH="$HOME/.local/bin:$PATH" to ~/.zshrc |
| RTK installed but no savings | RTK init not active or client not restarted | Run aiwrap repair rtk, restart Codex/Claude |
| Hindsight unavailable | MCP not registered or client not restarted | Run aiwrap repair mcp, restart Codex/Claude |
| macOS blocks binary | Gatekeeper quarantine | Run xattr -d com.apple.quarantine ~/.ai-cli-wrapper/bin/<binary> |
| Duplicate MCP server | Existing manual config | Run aiwrap doctor --verbose and decide whether to replace manually |
Temporary:
export PATH="$HOME/.local/bin:$PATH"Persistent for zsh:
printf '\nexport PATH="$HOME/.local/bin:$PATH"\n' >> ~/.zshrc
exec zshPrimary acceptance test:
curl -fsSL https://raw.githubusercontent.com/SetuHQ/aiwrap-relay/main/install.sh | sh
aiwrap doctor
codex --version
claude --version
curl -fsS http://127.0.0.1:8888/healthPass criteria:
- No package manager required for user install.
- No
sudo. - Codex and Claude are not installed by
aiwrap. - At least one detected client is configured.
- RTK is configured using upstream mechanisms.
- Hindsight Cloud tokens are not configured or stored by
aiwrap. - The obsolete
hindsight-mcpbinary and client entries are gone after install. - Re-running install is safe and changes nothing.
Build local artifacts:
npm run build:binary
npm run build:hindsight-binary
AIWRAP_PACKAGE_ARCH=arm64 npm run package:release
AIWRAP_PACKAGE_ARCH=x64 npm run package:releaseThis produces:
release/aiwrap-darwin-arm64.tar.gz
release/aiwrap-darwin-x64.tar.gz
release/checksums.txt
Publish the tarballs and checksums.txt to GitLab Releases or GitHub Releases. The bootstrap installer verifies SHA-256 before extracting.
For an alternate GitHub repo, override AIWRAP_REPO_URL:
curl -fsSL https://raw.githubusercontent.com/<owner>/aiwrap-relay/main/install.sh | \
AIWRAP_REPO_URL="https://github.com/<owner>/aiwrap-relay" shVerify release artifacts locally:
npm run verify:releaseSmoke-test the installer from a local tarball:
AIWRAP_LOCAL_TARBALL="$PWD/release/aiwrap-darwin-arm64.tar.gz" ./install.sh --dry-runThe bootstrap script extracts the tarball so it can run the packaged aiwrap binary. With --dry-run, integration setup commands are not executed.
Use aiwrap uninstall after a full local install test if you want to remove managed files.
curl -fsSL https://raw.githubusercontent.com/SetuHQ/aiwrap-relay/main/uninstall.sh | shUninstall removes only aiwrap-managed files and launchers. It does not uninstall Codex, Claude, or your Hindsight account data.
npm install
npm run typecheck
npm test
npm run build
node dist/cli.js doctor --verbosePackage manager usage is for contributors only. User releases should be standalone macOS artifacts published from GitLab Releases.
- We do not replace
codexorclaude. - We do not configure Hindsight Cloud or store Hindsight API tokens.
- We do not overwrite unrelated MCP servers.
- The installer is designed to be safe to re-run.
- The uninstaller removes only wrapper-managed files and config entries.
- Signed and notarized binaries.
- Optional support for more local CLI clients if they expose supported RTK/MCP integration surfaces.