add-pi
Skill1 starsChanged 41 days agoMITView on GitHub
Install, authenticate, switch, validate, and troubleshoot Pi as a NanoClaw agent provider for xAI subscription and OpenRouter models. Use when replacing OpenCode with Pi or configuring a non-OpenAI group to use Pi while retaining Codex as a fallback.
- Reads credentials
In this repository54 other files it gives its agents.
- container/AGENTS.mdAGENTS.md
- container/CLAUDE.mdCLAUDE.md
- add-atomic-chat-toolSkill
- add-codexSkill
- add-dashboardSkill
- add-deltachatSkill
- add-discordSkill
- add-emacsSkill
- add-gcal-toolSkill
- add-gchatSkill
- add-githubSkill
- add-gmail-toolSkill
- add-imessageSkill
- add-karpathy-llm-wikiSkill
- add-linearSkill
- add-macos-statusbarSkill
- add-matrixSkill
- add-mnemonSkill
- add-ollama-providerSkill
- add-ollama-toolSkill
- add-opencodeSkill
- add-resendSkill
- add-rtkSkill
- add-signalSkill
- add-slackSkill
- add-teamsSkill
- add-telegramSkill
- add-vercelSkill
- add-webexSkill
- add-wechatSkill
- add-whatsapp-cloudSkill
- add-whatsappSkill
- archive-tripSkill
- customizeSkill
- debugSkill
- get-qodo-rulesSkill
- init-first-agentSkill
- init-onecliSkill
- learnSkill
- manage-channelsSkill
- manage-mountsSkill
- migrate-from-openclawSkill
- migrate-from-v1Skill
- migrate-memorySkill
- migrate-nanoclawSkill
- nano-pvt-hubSkill
- new-knowledge-graph-tutorSkill
- new-tripSkill
- qodo-pr-resolverSkill
- reflectSkill
- setupSkill
- update-nanoclawSkill
- update-skillsSkill
- use-native-credential-proxySkill
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 4 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 12
Treat Pi as installed only when all checks pass:
- Distinctive: line 23
Run the focused contracts first, then all project checks:
- Distinctive: line 55
Use Ops Center's provider switch when available.
- Very specific: line 57
Before switching a critical group, save its intended fallback provider profile in the Ops Center snapshot ledger.
- Distinctive: line 66
Never log prompts, tool arguments/results, headers, environment values, or credentials.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Add Pi provider
Pi runs as a headless JSONL RPC child process. NanoClaw owns the MCP bridge, session lifecycle, liveness receipts, and provider registration; Pi owns model execution and xAI OAuth state.
Preflight
Treat Pi as installed only when all checks pass:
src/providers/pi.tsexists and the host provider barrel imports it.container/agent-runner/src/providers/{pi,pi-rpc,pi-mcp-bridge,pi-mcp-extension}.tsexist and the container barrel importspi.container/cli-tools.jsoncontains exactly@earendil-works/pi-coding-agent@0.87.0withoutonlyBuilt.- The host and container registration tests pass.
Reapplying is idempotent: do not add duplicate barrel imports or manifest entries. The provider payload is fork-owned; restore the files from the fork revision that contains this skill when any preflight file is absent.
Validate and build
Run the focused contracts first, then all project checks:
cd container/agent-runner
bun test src/providers/pi-mcp-bridge.test.ts src/providers/pi-rpc.test.ts src/providers/pi.test.ts src/providers/pi.factory.test.ts src/providers/pi-cli-tools.test.ts
cd ../../..
./scripts/run-node22.sh node_modules/vitest/vitest.mjs run src/providers/pi-host-contribution.test.ts src/providers/pi-registration.test.ts ops-center/provider-switch.test.ts ops-center/pi-observability.test.ts
pnpm run build
pnpm exec tsc -p container/agent-runner/tsconfig.json --noEmit
pnpm exec tsc -p ops-center/tsconfig.json --noEmit
./container/build.shProbe the built image with pi --version. Rebuild the host after the image succeeds so the Pi mount/env contribution is registered.
Authentication
For OpenRouter, keep the real API key only in OneCLI with an openrouter.ai host pattern. Pi receives OPENROUTER_API_KEY=onecli-managed; the gateway substitutes the secret on the wire.
For xAI subscription, use Pi's provider-owned OAuth state. Run the image interactively with the group state mounted at /home/node/.pi/agent, enter /login xai, choose subscription login, and finish the displayed browser/device flow. Never copy this credential into .env, chat, or OneCLI.
The group-scoped state path is data/v2-sessions/<group-id>/.pi-shared/auth.json and must remain mode 0600. Authentication does not require a session reset.
Switch a group
Preserve the full model/tier profile. Pi expects canonical provider/model IDs such as xai/grok-4.6 or openrouter/z-ai/glm-5.3-flash.
ncl groups config update --id <group-id> --provider pi
ncl groups restart --id <group-id> --freshUse Ops Center's provider switch when available. It saves provider profiles, runs an isolated model probe, and automatically executes and verifies the prior-provider rollback if the probe fails. Switching to Pi from OpenCode carries the current model tiers on the first visit.
Before switching a critical group, save its intended fallback provider profile in the Ops Center snapshot ledger. For Jeeves, keep a Codex profile (gpt-5.6-sol / gpt-5.6-terra / gpt-5.6-luna) so “Use Codex / ChatGPT” is a one-action fallback.
MCP and observability contract
- Preserve tool names as
mcp__<server>__<tool>so existing instructions and memories remain valid. nanoclawtools are eager. External tool schemas are registered but deferred behindToolSearch; activation is additive.- Forward every MCP tool call exactly once. Never retry a call after an unknown outcome.
- A missing required
nanoclawserver fails startup. Optional servers degrade independently. - Health goes to each session's
pi-observability/mcp-health.json; bounded structural events go toevents.jsonl. - Never log prompts, tool arguments/results, headers, environment values, or credentials.
Ops Center reads these receipts and shows server readiness, catalog/active counts, calls, errors, latency, and the last event. A missing receipt means Pi has not started in that session; it is not proof of health.
Troubleshooting
spawn pi ENOENT: rebuild the image; the CLI manifest pin is not deployed.Invalid Pi continuation path: start fresh; only/workspace/pi-sessions/*.jsonlis accepted.- Required
nanoclawMCP failure: inspect the container exit tail and the session health receipt before retrying. - xAI auth errors: rerun Pi
/login xaiagainst the exact group's.pi-sharedmount. - OpenRouter auth errors: inspect OneCLI secret matching and agent secret mode; do not paste the key into container config.
- A failed switch probe should end as
rolled_backin the Ops Center operation ledger. If it does not, use the saved Codex provider profile explicitly and restart fresh.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

