Best for
- Activation Triggers
- When NOT to Use
- Headless Pi dispatch: use when the task explicitly requests Pi, pi.dev, or the Pi coding agent.
MichelKerkmeester/opencode--skilled-agent-loops-with-spec-kit-memory/.opencode/skills/cli-external-orchestration/cli-pi/SKILL.md
Pi CLI executor for guarded headless coding, JSON/RPC integration, native skills/extensions, and community-package delegation.
Decision brief
CRITICAL — SELF-INVOCATION PROHIBITED This skill dispatches to the Pi CLI binary, pi. If the agent reading this skill is already running inside Pi, refuse to construct a Pi invocation. A running CLI skill never dispatches itself. The cli-X skills are for cross-AI delegation only.
Compatibility matrix
| Platform | Status | Evidence | What to check |
|---|---|---|---|
| Codex | Not declared | No explicit evidence | Portability before use |
| Claude Code | Not declared | No explicit evidence | Portability before use |
| Cursor | Not declared | No explicit evidence | Portability before use |
| Gemini CLI | Not declared | No explicit evidence | Portability before use |
Installation
The source command is displayed only when detected. A safe inspection prompt is always available so your agent can explain every action before execution.
npx skills add https://github.com/MichelKerkmeester/opencode--skilled-agent-loops-with-spec-kit-memory --skill ".opencode/skills/cli-external-orchestration/cli-pi"Inspect the Agent Skill "cli-pi" from https://github.com/MichelKerkmeester/opencode--skilled-agent-loops-with-spec-kit-memory/blob/6f0b93906be829894c38e580010885d54199067f/.opencode/skills/cli-external-orchestration/cli-pi/SKILL.md at commit 6f0b93906be829894c38e580010885d54199067f. List every install step, command, network request, credential, file read/write, external action, and rollback step. Explain whether it fits my task. Do not install or execute anything until I approve.
Workflow
Headless Pi dispatch: use when the task explicitly requests Pi, pi.dev, or the Pi coding agent.
Headless Pi dispatch: use when the task explicitly requests Pi, pi.dev, or the Pi coding agent.
You ARE Pi already. Refuse if process ancestry indicates a Pi process or the local project heuristic indicates an active Pi context. The guard is intentionally conservative.
Run this probe before every dispatch. Do not build a command when it fails.
Run this probe before every dispatch. Do not build a command when it fails.
Permission review
The documentation asks the agent to run terminal commands or scripts.
Run command -v pi before every dispatch.Evidence record
| Signal | Value | Evidence type | Meaning |
|---|---|---|---|
| Quality score | 94/100 | Computed | Documentation, specificity, maintenance, and trust rules |
| Repository stars | 32 | Source | Repository attention, not individual Skill quality |
| Compatibility | 0 platforms | Source | Declared in the catalog source record |
| Usage guide | automated source guide | Editorial | Generated or reviewed according to the visible evidence level |
Pinned source
CRITICAL — SELF-INVOCATION PROHIBITED
This skill dispatches to the Pi CLI binary, pi. If the agent reading this skill is already running inside Pi, refuse to construct a Pi invocation.
A running CLI skill never dispatches itself. The cli-X skills are for cross-AI delegation only.
Orchestrate Pi's terminal coding agent for headless coding, read-only tool-constrained reviews, JSON event-stream integrations, RPC clients, and Pi-native resource discovery. The pinned contract is the source for confirmed command behavior: Pi contract pin. Pi-native skills, prompt templates, and some package surfaces remain documented but unconfirmed unless a source says otherwise.
Core principle: use Pi for the surfaces it exposes, delegate execution to the shared runtime, validate the returned output, and keep the calling AI as conductor.
Run this probe before every dispatch. Do not build a command when it fails.
command -v pi || echo "Not installed. Install @earendil-works/pi-coding-agent before dispatch."
The pinned contract confirms the binary version used for the contract run and the headless entry point. For exact flags and observed failure behavior, load cli-reference.md.
Use the following guard before loading a dispatch template:
def detect_self_invocation():
"""Return a signal when the caller is likely already inside Pi."""
# Process ancestry is a documented-but-unconfirmed signal for this packet.
try:
ancestry = subprocess.check_output(
["ps", "-o", "command=", "-p", str(os.getppid())],
text=True,
)
if "/pi" in ancestry or ancestry.strip().endswith(" pi"):
return ("ancestry", "pi")
except (OSError, subprocess.SubprocessError):
pass
# The .pi directory is a non-conclusive project heuristic, not proof of an active session.
if os.path.isdir(os.path.join(os.getcwd(), ".pi")):
return ("project-heuristic", ".pi")
# No first-party environment signal is treated as confirmed here. Absence of a
# detected signal is not proof that no Pi session is active.
return None
signal = detect_self_invocation()
if signal:
refuse(
"Self-invocation refused: the caller may already be running inside Pi. "
"Use a different runtime or a fresh shell session."
)
The guard deliberately uses only process ancestry and the non-conclusive project heuristic. It does not invent an environment variable or infer safety from a missing signal.
| Level | Load when | Resources |
|---|---|---|
| ALWAYS | Every Pi route | references/cli-reference.md, assets/prompt-quality-card.md |
| CONDITIONAL | Task names the matching surface | One or more intent-mapped references |
| ON_DEMAND | The operator asks for templates or package detail | assets/prompt-templates.md, native-skills-and-extensions.md, mcp-and-third-party-packages.md |
Provider-specific dictionaries (used by the shared helper functions in system-spec-kit/references/cli/shared-smart-router.md):
INTENT_SIGNALS = {
"GENERATION": {"weight": 4, "keywords": ["generate", "create", "build", "write code", "pi coding agent"]},
"REVIEW": {"weight": 4, "keywords": ["review", "audit", "bug", "second opinion", "cross-validate"]},
"HEADLESS": {"weight": 4, "keywords": ["pi cli", "pi agent", "headless", "print mode", "json event"]},
"RPC": {"weight": 4, "keywords": ["rpc", "stdin", "stdout", "jsonl", "persistent process"]},
"AGENT_DELEGATION": {"weight": 4, "keywords": ["delegate", "subagent", "pi-subagents", "agent bridge"]},
"NATIVE_RESOURCES": {"weight": 4, "keywords": ["skill", "prompt template", "extension", "pi-mcp-extension", "package"]},
"PATTERNS": {"weight": 3, "keywords": ["pattern", "workflow", "session", "resume", "continue"]},
"TEMPLATES": {"weight": 3, "keywords": ["template", "prompt", "how to ask", "pi prompt"]},
}
RESOURCE_MAP = {
"GENERATION": ["references/cli-reference.md", "assets/prompt-templates.md"],
"REVIEW": ["references/integration-patterns.md", "references/cli-reference.md"],
"HEADLESS": ["references/cli-reference.md", "assets/prompt-templates.md"],
"RPC": ["references/cli-reference.md", "references/integration-patterns.md"],
"AGENT_DELEGATION": ["references/agent-delegation.md", "references/integration-patterns.md"],
"NATIVE_RESOURCES": ["references/native-skills-and-extensions.md", "references/mcp-and-third-party-packages.md"],
"PATTERNS": ["references/integration-patterns.md", "references/cli-reference.md"],
"TEMPLATES": ["assets/prompt-templates.md", "assets/prompt-quality-card.md"],
}
LOADING_LEVELS = {
"ALWAYS": ["references/cli-reference.md", "assets/prompt-quality-card.md"],
"ON_DEMAND_KEYWORDS": ["full reference", "all templates", "deep dive", "mcp extension", "subagent package", "native skills"],
"ON_DEMAND": ["references/native-skills-and-extensions.md", "references/mcp-and-third-party-packages.md", "assets/prompt-templates.md"],
}
UNKNOWN_FALLBACK_CHECKLIST = [
"Confirm that the user wants Pi rather than another cli-X mode",
"Confirm whether the task is print, JSON, RPC, or interactive",
"Confirm whether project-local resources may be trusted",
"Confirm the required verification command before dispatch",
]
Call sequence (using shared helpers from shared-smart-router.md):
discover_markdown_resources() — recursively enumerate current .md files under existing references/ and assets/ folders at routing time._guard_in_skill() + load_if_available() — sandbox paths to this skill, reject non-markdown loads, skip missing files, and suppress duplicates.score_intents(task) and select_intents(scores, ambiguity_delta=1.0) — preserve provider-specific weighted intent scoring and top-2 ambiguity handling.get_routing_key(task, intents) — derive the provider routing key from task/provider context, then fall back to cli-pi.LOADING_LEVELS["ALWAYS"], then return UNKNOWN_FALLBACK with UNKNOWN_FALLBACK_CHECKLIST when max score is 0.RESOURCE_MAP[intent], ON_DEMAND-load keyword matches, and return a notice when no provider-specific knowledge base is available beyond always-load resources.The route_pi_resources(task) function body lives in shared-smart-router.md — substitute <PROVIDER> = pi.
This packet owns provider-specific routing, the availability probe, prompt construction, and the self-invocation guard. The shared deep-loop runtime owns process construction and execution. The runtime now supports the cli-pi executor kind — its fan-out command builder is implemented (print mode, provider-qualified --model, --thinking from reasoningEffort), so dispatch through the executor kind directly. Do not add a packet-local wrapper, spawn path, or command builder.
The pinned contract confirms that headless Pi uses print mode, that JSON mode emits JSONL events, and that RPC mode is a persistent JSONL protocol. These are different contracts. Do not treat RPC as a one-shot print invocation. See cli-reference.md and integration-patterns.md.
| Requested result | Pi surface | Guardrail |
|---|---|---|
| One prompt and final response | print mode with -p or --print | Inspect output, not exit code alone |
| Structured events | --mode json | Parse one JSON object per line |
| Long-lived integration | --mode rpc | Keep stdin/stdout as a JSONL protocol |
| Read-only review | print mode plus --tools read,grep,find,ls | Treat the tool allowlist as the write boundary |
The print, JSON, RPC, and tool flags above are from the live help capture and the pinned contract. The read-only pattern is a caller-selected restriction, not a separate Pi plan mode.
Pi reports missing provider credentials in output. The pinned contract observed the same failure with different exit codes across otherwise identical invocations. Never use an exit code alone to claim that a dispatch reached a model. If the output reports a missing API key, stop and surface the provider requirement.
Pi's native resource surfaces are documented separately because their discovery behavior is not uniformly live-confirmed:
The caller remains responsible for task scope, files, acceptance criteria, and verification. Use the prompt templates as scaffolds, not as a substitute for reading the target mode's skill contract. Pass an established spec folder to a non-interactive child when the parent workflow requires it.
The full flag glossary and pinned-contract citations are in the ALWAYS-loaded cli-reference.md. Gotchas that silently break a dispatch and must be honored at routing time:
--offline is required for any automated or CI dispatch. pi --verbose without --offline hung for over two minutes with no reachable network path in the pinned contract's live probe. Any non-interactive dispatch through this packet must pass --offline explicitly rather than rely on a fast failure.pi -p dispatch returned exit 0 on the first run and exit 1 on every subsequent run in the pinned contract. Every guard in this packet checks output text (No API key found...), never exit code..pi/extensions/*.ts fails the whole session, not just that extension. The pinned contract confirmed Pi validates extensions must export a factory function; a broken one blocks the entire dispatch with Extension does not export a valid factory function rather than skipping it with a warning.google, not Anthropic. pi --help documents --provider <name> (default: google). Do not assume an Anthropic-first default when composing a dispatch that omits --provider.pi install/pi list require --approve to see or modify project-local package config. Without it, both commands behave as if no packages exist, even when one is installed — the trust gate applies to reads, not only writes.{resolved agent persona + task prompt}, never a bare task. Resolve the persona from the ACTIVE runtime's agent directory (AGENTS.md §7; never hardcode a runtime) and map each subtask to the right agent (code, review, design, deep-research, markdown). Core Pi has no native persona surface on pi -p, so INLINE the persona block into the payload — the child cannot resolve agent paths by reference. A persona-less leaf runs as a generic assistant, dropping its tool-scope, verification gates, and output contract. Canonical contract: ../../sk-prompt/sk-prompt-models/assets/cli-prompt-quality-card.md "Persona Injection".--thinking effort scale, and the GPT-5.6 ceiling cross-mapThe hub owns advisor identity, mode registration, and router policy. This packet owns only the Pi workflow contract. The packet must not add description.json or graph-metadata.json.
The shared runtime is the sole process adapter. The packet supplies the selected mode, validated prompt, and runtime requirements. Runtime support is a prerequisite for an end-to-end dispatch.
sk-code owns surface detection and code verification. system-spec-kit owns Gate 3, spec folders, memory, and continuity. Include the parent spec folder in delegated prompts when the workflow has already established one.
The router discovers markdown resources dynamically. Start with the CLI reference and prompt-quality card, then load only the references matching the task. Use prompt-templates.md for repeatable prompt construction.
Related skills: cli-opencode, cli-claude-code, cli-codex, cli-cursor, and cli-devin for sibling CLI dispatch; sk-code for code standards; system-deep-loop for execution; and system-spec-kit for packet handback.
Frequently asked questions
CRITICAL — SELF-INVOCATION PROHIBITED This skill dispatches to the Pi CLI binary, pi. If the agent reading this skill is already running inside Pi, refuse to construct a Pi invocation. A running CLI skill never dispatches itself. The cli-X skills are for cross-AI delegation only.
The source record exposes this install command: npx skills add https://github.com/MichelKerkmeester/opencode--skilled-agent-loops-with-spec-kit-memory --skill ".opencode/skills/cli-external-orchestration/cli-pi". Inspect the command and pinned source before running it.
Static rules flagged exec-script in the source; the page lists the matching lines and excerpts.
Alternatives
coreyhaines31/marketingskills
When the user wants to plan, design, or implement an A/B test or experiment, or build a growth experimentation program. Also use when the user mentions "A/B test," "split test," "experiment," "test this change," "variant copy," "multivariate test," "hypothesis," "should I test this," "which version is better," "test two versions," "statistical significance," "how long should I run this test," "growth experiments," "experiment velocity," "experiment backlog," "ICE score," "experimentation program
garrytan/gbrain
End-to-end discipline for turning any large data source (audio libraries, email takeouts, document corpora, chat exports, API dumps) into brain pages at scale. The lifecycle spine: SCHEMA → ACCESS → TRIAL → EVALUATE → IMPROVE → CODIFY → TEST → SKILLIFY → BULK → MONITOR. State is tracked in a durable JSON manifest (see MANIFEST-PATTERN.md) so any crash, session boundary, or subagent fan-out resumes from ground truth instead of memory.
alirezarezvani/claude-skills
App Store Optimization (ASO) toolkit for researching keywords, analyzing competitor rankings, generating metadata suggestions, and improving app visibility on Apple App Store and Google Play Store. Use when the user asks about ASO, app store rankings, app metadata, app titles and descriptions, app store listings, app visibility, or mobile app marketing on iOS or Android. Supports keyword research and scoring, competitor keyword analysis, metadata optimization, A/B test planning, launch checklist
dotnet/skills
Migrates .NET test projects from VSTest to Microsoft.Testing.Platform (MTP). Use when user asks to "migrate to MTP", "switch from VSTest", "enable Microsoft.Testing.Platform", "use MTP runner", set OutputType=Exe only for test projects in Directory.Build.props, or mentions EnableMSTestRunner, EnableNUnitRunner, or UseMicrosoftTestingPlatformRunner. USE FOR: MTP behavioral differences vs VSTest (exit code 8, zero tests discovered, --ignore-exit-code, TESTINGPLATFORM_EXITCODE_IGNORE); centralizing