cli

v8.13.1
@planu/cli Checked 3 days ago Published 20 hours ago

Planu — MCP server for Spec Driven Development.

Planu v8 is a thin MCP sandbox + cognitive skills stack for Spec Driven Development. Its supported runtime is FEAT-only and exposes exactly nine canonical tools. Canonical design: PLANU_V8_MANIFESTO.txt. Authentication is not required. Do not call mcp_auth. Install Node.js >=22.13.0 with npm/npx available to your MCP client. Register Planu once using a host option below, then restart its MCP connection so the nine tools are available. Open the project you intend to set up.

Summary extracted from the README.

Planu

The high-performance SDD Engine for AI coding agents.

npm version Node License

What is Planu?

Planu v8 is a thin MCP sandbox + cognitive skills stack for Spec Driven Development. Its supported runtime is FEAT-only and exposes exactly nine canonical tools. Canonical design: PLANU_V8_MANIFESTO.txt.

Spec first, always. No locked trinity means no product code.

  • The Holy Trinity — .sdd/features/{FEAT-*}/[spec.md, plan.md, tasks.md]
  • Zero-Freedom Execution — mutations and exact DELETE: operations go through sdd_apply_file_patch; the File Manifest is the sandbox
  • Single Task Window — sdd_get_active_task + sdd_read_file_slice
  • 9 Canonical MCP Tools — listed below
  • Cognitive gates — host skills under .claude/skills/planu-*, .cursor/skills/planu-*, and .agents/skills/planu-* replace challenge_spec / check_readiness / validate
  • Git Hygiene — git-janitor.md skill (the server does not mutate Git)

Authentication is not required. Do not call mcp_auth.


Installation

Install Node.js >=22.13.0 with npm/npx available to your MCP client. Register Planu once using a host option below, then restart its MCP connection so the nine tools are available. Open the project you intend to set up.

Claude Code plugin

Claude Code users can install Planu as a plugin instead of hand-editing .mcp.json:

/plugin marketplace add planu-dev/planu
/plugin install planu@planu

This registers the same npx -y @planu/cli@latest server. planu-dev/planu is not a public source repository. Use a project .mcp.json and do not point the server at $HOME. The plugin also ships planu-guard hooks: while a locked feature has an unchecked task, native Write/Edit inside the workspace is denied in favor of sdd_apply_file_patch; git ... --no-verify is denied; and session start re-injects the active task. Disable them with the plugin manager.

Codex plugin

Codex CLI reads the same marketplace:

codex plugin marketplace add planu-dev/planu
codex plugin add planu@planu

This registers the same npx -y @planu/cli@latest server as MCP server planu. The planu-guard hooks are Claude Code only.

Cursor one-click install

Open this link in a browser with Cursor installed. It installs the server below with PLANU_WORKSPACE bound to ${workspaceFolder}:

cursor://anysphere.cursor-deeplink/mcp/install?name=planu&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBwbGFudS9jbGlAbGF0ZXN0Il0sImVudiI6eyJQTEFOVV9XT1JLU1BBQ0UiOiIke3dvcmtzcGFjZUZvbGRlcn0ifX0=

Paste this into Claude Code, Cursor, Windsurf, Codex, Copilot, Gemini CLI, OpenCode, or any stdio MCP client. Prefer a project config so the host can bind the open folder. A user-global server with no workspace interpolation will start in $HOME and fail closed.

{
  "mcpServers": {
    "planu": {
      "command": "npx",
      "args": ["-y", "@planu/cli@latest"],
      "env": {
        "PLANU_WORKSPACE": "${workspaceFolder}"
      }
    }
  }
}
Host Where to put it How the project is bound
Cursor .cursor/mcp.json (project) or ~/.cursor/mcp.json ${workspaceFolder} is interpolated into PLANU_WORKSPACE (absolute or ~/...). Cursor user-global cwd is not reliable.
Claude Code .mcp.json in the project Process cwd is the launch directory; unexpanded ${workspaceFolder} is ignored.
Codex .codex/config.toml (trusted project) or ~/.codex/config.toml TOML [mcp_servers.planu]. ChatGPT desktop, Codex CLI, and Codex IDE share this file. Set cwd to the repo. JSON mcpServers is the wrong format.
Copilot / VS Code .vscode/mcp.json Top-level key is servers. ${workspaceFolder} is interpolated.
Gemini CLI .gemini/settings.json mcpServers JSON. No ${workspaceFolder} interpolation; use repo cwd.
Windsurf ~/.codeium/windsurf/mcp_config.json User-global Cascade config. Prefer an absolute project PLANU_WORKSPACE; do not use $HOME.
OpenCode opencode.json mcp.planu with type: "local" and a command array.
Claude Desktop claude_desktop_config.json mcpServers JSON. Set PLANU_WORKSPACE to an absolute project path.
ChatGPT web Plugins / remote MCP only Cannot spawn local stdio. Use Codex desktop or CLI for Planu.
Other stdio Cline, Zed, JetBrains, Amazon Q Same npx -y @planu/cli@latest process; bind via cwd, roots, or PLANU_WORKSPACE.

npx @planu/cli starts the MCP stdio server (cli, planu, and sdd-engine are the same binary). Each host restart resolves latest from npm.

Local development in this repo:

{
  "mcpServers": {
    "planu": {
      "command": "node",
      "args": ["${workspaceFolder}/dist/sdd-engine/cli.js"],
      "env": {
        "PLANU_WORKSPACE": "${workspaceFolder}"
      }
    }
  }
}

The published server asks the host for MCP roots and binds to the open project that owns .sdd/. Unexpanded ${workspaceFolder} and a PLANU_WORKSPACE equal to $HOME are ignored. A ~/... workspace path is expanded against $HOME so hosts that interpolate tildes still bind the open folder. If the process cwd is still the user home directory, project-scoped tools return ERR_WORKSPACE_UNRESOLVED instead of creating .sdd under $HOME. sdd_init_workspace always writes Planu-owned Cursor, Claude, and Gemini host rules. Existing AGENTS.md is preserved unless force: true or the file still requires planu/specs/SPEC-* or instructs calling create_spec. sdd_lock_spec refuses empty skeletons and can reseal with relock: true and reason. Do not set a shell-global PLANU_WORKSPACE. pnpm start runs the MCP server.

Set up the open project

After the one-time client registration above, ask your agent:

Set up Planu in this project and tell me the next step.

The guided route starts with sdd_list_features. Inspect hostSkills for installed role issues. When project setup is authorized and the installed pack needs repair, use sdd_init_workspace(scope=project) without force for the identified project. The setup request already supplies that project's setup intent; catalog: "unverified" alone does not establish a file problem or authorize setup. Keep the MCP server bound to the project through roots or cwd, rather than $HOME.

Immediately after init, use the canonical sdd_read_file_slice tool to read .agents/skills/planu-preflight-guardian/SKILL.md and the installed role for the next action, such as .agents/skills/planu-spec-architect/SKILL.md for planning. Init installs role files; native discovery in the client's skill catalog may require a client reload or a new session. That catalog reload is separate from restarting MCP. The instructions guide an agent; the server cannot guarantee that a host has loaded a role or that a model follows it.

Windows retains planning, catalogue and file operations. Automated server verification through sdd_complete_task requires macOS/Linux (POSIX) and fails closed before command execution on Windows. Native Windows execution has not been validated.


Selective delegation

Roles guide compact handoffs to available native agents for independent work. The parent alone applies canonical patches and certifies; otherwise work stays sequential. Model bridges need verified access, model and sharing/cost permission.

The bounded protocol lives in the installed spec-executor.md role, with workstream routing in spec-architect.md and provenance checks in verification-auditor.md. Handoffs carry only the active task identity, snapshot, selected evidence, constraints and acceptance; parent history is disabled or controlled. Child results are untrusted proposals that the parent inspects before canonical writes and server-run verification. Host safety instructions and existing limits remain in force.

This is role guidance, not a runtime dispatcher or a guarantee that a host loads or follows it. No bridge is installed or authenticated automatically. Availability and performance depend on the host and task; there is no universal speedup or every-host/model promise.

Trusted verification budget

Normal task verification still has a 180000 ms limit. An operator may authorize one pinned task in an isolated Darwin/Linux server with a strict startup-only budget of 180001–600000 ms. The grant binds the canonical workspace, feature, task, raw lock SHA-256 and exact command SHA-256. It is consumed before the first spawn, including failed attempts; uncertain cleanup or persistence quarantines that feature.

There is no timeout tool argument. The nine tool names are unchanged. The optional verification_receipts field carries signed evidence and grants no extra time. The programmatic factory ignores the CLI environment unless its optional typed policy is explicitly supplied. Agents must not create or widen grants themselves.

The reviewed operator procedure is in the repository guide docs/verification-budget.md: finite local-build fingerprint, exact policy schema, per-process Node 24.22.1 PATH, SDK request budget of 660000 ms, one-use launch and safe disable/reconciliation. The grant is not a global registration or a cache replacement. Barbuno acceptance remains a separate handoff.

Read-only diagnostics

The existing nine tools expose additive diagnostics since 8.4.0; 8.5.0 adds compact resume and history views. An ordinary sdd_get_active_task request keeps its previous response shape.

sdd_list_features includes hostSkills. For example, a missing installed role can produce this field (other installed files match the available bundled reference):

{
  "version": 1,
  "bundledVersion": "8.5.1",
  "baseline": "available",
  "catalog": "unverified",
  "issues": [{
    "path": ".agents/skills/planu-spec-executor/SKILL.md",
    "status": "missing",
    "cause": "not_found"
  }],
  "nextAction": "review_project_setup"
}

Issues use the fixed workspace-relative paths of the nine roles across four hosts and concrete causes such as content_mismatch, access_denied or unsafe_path. bundledVersion identifies the shipped reference, not the installed role or client. An unavailable reference reports baseline: "unavailable" and inspect_installation rather than inferring project mismatches. Inspect unsafe paths before setup; use the explicit project setup route for repair only when authorized. A matching pack still leaves catalog: "unverified"; client catalogue reload and MCP restart remain separate actions.

sdd_lock_spec keeps existing rejection codes and legacy details, adding bounded error.details.issues. For a protected manifest declaration on the fifth source line, the diagnostic includes:

{
  "artifact": "plan.md",
  "rule": "protected_write",
  "line": 5
}

That structural rejection keeps ERR_TRINITY_INCOMPLETE. Lines are 1-based original source locations. Missing sections and ambiguous cross-declaration failures omit line; errors do not echo the manifest path or source text. A rejected initial lock or relock writes no lock. Diagnostics do not authorize automatic relocking.

Request preflight explicitly through sdd_get_active_task:

{"feature_id":"FEAT-EXAMPLE","view":"verification_preflight"}

Optionally supply verification_receipts with the signed receipt array described below. Receipts require an explicit verification_preflight or resume view. For an opted-in task with one required gate named contents, no supplied receipts and otherwise available inputs, data.verificationPreflight is:

{
  "version": 1,
  "taskId": "TASK-1",
  "status": "blocked",
  "gates": [{"gateId":"contents","state":"receipt_missing","reason":"receipt_missing"}],
  "blockers": [],
  "integration": "not_run",
  "nextAction": "obtain_receipts"
}

Check version: 1 on the requested response: an older server may ignore optional arguments. Inspect both per-gate states and aggregate blockers. Preflight can identify rejected evidence, unavailable inputs, changed observed baselines, missing commands, unsupported platforms or matching scoped receipt grants, and lock/guard problems. Follow nextAction; a changed observed baseline requires restoring the input or the existing reviewed relock route. An ordinary task rejects supplied receipts with receipt_not_configured.

ready_to_attempt with attempt_integration means these read-only checks passed for the current candidate. Runtime prerequisites, write access and integration remain unverified. not_applicable means a locked feature has no active task. Preflight runs no command, consumes no grant, writes no artifact and issues no certificate; setup, relock and completion remain explicit actions.

Resume a task from one compact checkpoint

{"feature_id":"FEAT-EXAMPLE","view":"resume"}

Require data.resume.version=1: older servers may ignore the requested view. The checkpoint identifies task and progress, captured contract hashes, candidate and observed-input digests when available, per-gate evidence, blockers, pending integration and a safe next action. Read the ordinary active task next to obtain its authorized body and File Manifest. Optional verification_receipts are checked against that captured candidate; observed receipts are not certification. Missing evidence is pending and does not prove a verifier never ran. candidate:null does not establish successful checks. Integration remains pending for an active task; the compact read never certifies it.

history_cursor is accepted only with view="relock_history". If history is null, follow nextAction without requesting history. If history.firstCursor is null, there are no records; do not request history. Otherwise use the checkpoint's history.firstCursor as history_cursor with view="relock_history", then follow data.relockHistory.nextCursor until null. Require data.relockHistory.version=1. Pages contain at most eight records in descending zero-based storage-index order. A stale cursor requires rereading the checkpoint; never silently continue with a different lock. Empty history has no cursor. Resume references the history without loading reasons or the full task; malformed selected history fails without a partial page.

Every handler-produced compact result, including controlled failures, contains exactly one content[0].text of at most 8,192 UTF-8 bytes and no structuredContent or auxiliary content. SDK/JSON-RPC validation before handler dispatch is a separate boundary. Neither compact view executes verification, consumes a grant, writes an artifact, acquires a lease or issues a certificate. Guard presence never proves an owner stopped. Locks, File Manifest authority, receipt inputs, stored history and verification budgets remain unchanged.

For an authorized reader holding the original .lock bytes, the exact digest calculations are:

import { createHash } from 'node:crypto';
const sha256 = (value) => createHash('sha256').update(value).digest('hex');
const lockSha256 = sha256(rawLockBytes);
const record = JSON.parse(rawLockBytes.toString('utf8')).relockHistory[index];
const recordSha256 = sha256(Buffer.from(JSON.stringify(record), 'utf8'));
const reasonSha256 = sha256(Buffer.from(record.reason, 'utf8'));

recordSha256 hashes the complete parsed record, including extra fields. ECMAScript JSON parse/stringify normalization applies: numeric-key ordering, normalized numbers and escapes, and last duplicate key wins. Raw byte identity belongs to lockSha256. Node UTF-8 encoding replaces lone UTF-16 surrogates with U+FFFD, so reasonSha256 is not a unique UTF-16-string identity; record and raw-lock hashes retain their separate correspondence. Hashes reference stored bytes, not the author or provenance of historical actions. Original reasons and records remain in the lock.

Reusable verification receipts

Opt in by adding a level-two Verification Receipts v1 heading to the locked plan, followed by a single JSON fence with the policy formatted using JSON.stringify(policy, null, 2). It contains:

  • publicKey, the operator's Ed25519 SPKI public key in canonical unpadded base64url.
  • tasks, the opted-in entries with taskId, gates, observed, and observedBaselineSha256. Each gate has an id, procedureSha256, and environmentSha256.
  • candidateCreates, with one { path, requiredFromTaskId } for each exact CREATE path. The due task is identified by its explicit ID and its position in the task list.

Use exactly one literal Verification (receipts v1): command on each opted-in task. Use exact CREATE and MODIFY paths for candidate inputs. Observed files are separate and carry no write authority. A future create is hashed as absent until it exists, and must exist at its due task. Keep an ordinary Verification: task for a later integration step if the feature requires one.

For observed baseline and candidate digests, sort exact relative paths in ASCII order. Use the SHA-256 of the UTF-8 compact JSON ["planu.verification-inputs.v1", category, entries]. A present entry is [path, "present", mode & 0o7777, sha256(rawBytes)]. A future create that is absent before its due task is [path, "absent"]. An empty observed list has the digest of ["planu.verification-inputs.v1","observed",[]].

Read verificationEvidence from sdd_get_active_task after sealing. A trusted issuer measures the inputs, runs the reviewed checks against that challenge, and compares the inputs again before signing. It attests the exact procedure, measured immutable environment, outcome, and digest of complete evidence. Keep the signing key outside the workspace, Planu process, integration command, and agents. Only use receipts for checks whose inputs and environment are stable across attempts. Live checks belong in the fresh integration command.

This offline Node.js example signs one gate in a disposable fixture with one exact candidate named candidate.txt, no observed files, and no future creates. Run the issuer separately with its own key file and the challenge saved to an operator-controlled file. Pin the digests of the example procedure and environment shown below when preparing the fixture policy.

import { createHash, createPrivateKey, sign } from 'node:crypto';
import { readFileSync, statSync } from 'node:fs';

const [keyPath, challengePath] = process.argv.slice(2);
const key = createPrivateKey(readFileSync(keyPath));
const { gates, ...challenge } = JSON.parse(readFileSync(challengePath, 'utf8'));
const gate = gates.find(({ id }) => id === 'contents');
const sha = (bytes) => createHash('sha256').update(bytes).digest('hex');
const hashJson = (value) => sha(JSON.stringify(value));
const procedure = 'Read candidate.txt and require exactly hello followed by LF';
const environment = JSON.stringify([process.platform, process.arch, process.version, 'fixture-v1']);
const snapshot = () => {
  const bytes = readFileSync('candidate.txt');
  const mode = statSync('candidate.txt').mode & 0o7777;
  return { bytes, digest: hashJson(['planu.verification-inputs.v1', 'candidate',
    [['candidate.txt', 'present', mode, sha(bytes)]]]) };
};
const before = snapshot();
if (before.digest !== challenge.candidateSha256 ||
    hashJson(['planu.verification-inputs.v1', 'observed', []]) !== challenge.observedSha256 ||
    sha(procedure) !== gate?.procedureSha256 || sha(environment) !== gate.environmentSha256 ||
    !before.bytes.equals(Buffer.from('hello\n')) || snapshot().digest !== before.digest) {
  throw new Error('The fixture check or reviewed challenge did not match');
}
const outcome = 'pass';
const evidenceSha256 = hashJson({ procedure, environment, outcome, candidate: before.digest });
const message = ['planu.verification-receipt.v1', challenge.featureId, challenge.taskId,
  challenge.workspaceSha256, challenge.lockSha256, challenge.candidateSha256,
  challenge.observedSha256, gate.id, gate.procedureSha256, gate.environmentSha256,
  outcome, evidenceSha256];
const signature = sign(null, Buffer.from(JSON.stringify(message)), key).toString('base64url');
console.log(JSON.stringify({ ...challenge, gateId: gate.id, procedureSha256: gate.procedureSha256,
  environmentSha256: gate.environmentSha256, outcome, evidenceSha256, signature }));

Supply exactly one matching receipt per gate through verification_receipts on sdd_complete_task. Planu verifies the set and reruns the integration command. A failed command leaves the task open. Retry with the same receipts only while the challenge matches. Advancing or resealing the task changes the lock and requires a fresh challenge. If an observed dependency changes, restore the locked baseline or review and record a new baseline using a relock with reason, then obtain fresh receipts. The completion record stores the accepted set digest rather than the receipts or issuer logs.

A matching scoped time grant cannot run an opted-in receipt task in this version. Older Planu versions cannot complete these tasks because the receipt directive has no legacy Verification line. To return a pending task to ordinary verification, use a reviewed relock and run all required checks in the ordinary command.

The SDD Lifecycle (v8)

sdd_init_workspace → sdd_create_feature → architect trinity → sdd_lock_spec → execute tasks → verify → git-janitor
  1. Initialize: sdd_init_workspace writes .sdd/features, stamps host rules, copies cognitive skills into .claude/skills/, .cursor/skills/, .agents/skills/, and .gemini/skills/, and installs the Cursor write guard. Existing AGENTS.md is preserved unless force: true or it is still a v6 host contract.
  2. Architect: Adopt spec-architect.md. Call sdd_create_feature with a title and omit id to reserve the next global FEAT-NNNN-TITLE identifier. Explicit FEAT-* IDs remain supported for imports; SPEC-001 is rejected.
  3. Lock: sdd_lock_spec hashes spec, plan, and tasks. It rejects empty skeletons. Reseal after review with relock: true and reason.
  4. Execute: sdd_get_active_task → sdd_apply_file_patch → sdd_complete_task. sdd_complete_task runs the task Verification command and stores that output. CREATE, MODIFY, and READ_ONLY may use * / ** (dot-prefixed segments require an exact entry). DELETE is an exact path. A CREATE entry accepts search/replace patches after the file exists. .sdd/ and .git/ are never writable.
  5. Verify: independently prove acceptance criteria with verification-auditor.md.
  6. Janitor: prune local branches and orphaned worktrees only with authorization.

sdd_list_features enumerates executable .sdd/features/FEAT-* records only. Historical v6 records are not executed, enumerated, generated, or shipped by the v8 runtime.

Canonical tools

sdd_init_workspace, sdd_list_features, sdd_create_feature, sdd_lock_spec, sdd_read_spec_artifact, sdd_read_file_slice, sdd_get_active_task, sdd_apply_file_patch, sdd_complete_task

Deleted: create_spec, challenge_spec, check_readiness, validate, planu_status, update_status, init_project, package_handoff.


Architecture

src/
└── sdd-engine/       # ultralight execution core

.sdd/                 # project-local SDD storage
├── features/
│   └── FEAT-HEALTH-001/
│       ├── spec.md
│       ├── plan.md
│       ├── tasks.md
│       └── .lock

.claude/skills/planu-*/SKILL.md   # Claude Code
.cursor/skills/planu-*/SKILL.md   # Cursor
.agents/skills/planu-*/SKILL.md   # Codex
.gemini/skills/planu-*.md         # Gemini

Development

Use the exact packageManager pin in package.json (pnpm 12.18.0) and Node 24.22.1 for repository verification. The public runtime floor remains Node >=22.13.0. Install explicitly before running a project command:

pnpm install --frozen-lockfile
pnpm build
pnpm typecheck
pnpm lint
pnpm test tests/sdd-engine
pnpm check:deps:fresh
pnpm validate

verifyDepsBeforeRun: error makes pnpm run, shorthand scripts and pnpm exec reject missing or stale installations instead of installing implicitly. After an authorized declaration or lock change, reconcile the reviewed files and run the explicit frozen installation; do not bypass the policy or substitute the TypeScript 6 library for the TypeScript 7 build compiler.

For an agent maintenance loop, read the active locked task, make only its manifest-authorized changes, run its exact verification command, review the evidence and let the parent certify. Before pushing, the existing hook runs freshness once before all quality gates. Pre-commit inspects only changed dependency declarations and their attributable direct-root advisories; it performs no installation.

pnpm check:deps:fresh exits 0 for complete current evidence, 1 for stable direct dependency drift, or 3 when registry, installed-state, process or metadata evidence is unavailable. It compares installed versions with published stable latest, including exact pins and npm aliases. Only the declared @types/node branch stays on the greatest stable 22.x version; a global newer major does not replace that branch, while a new 22.x patch is drift. Keep release-age settings unchanged and retain unavailable evidence instead of treating it as current.

Workspace overrides protect this repository's resolved graph. They are not shipped as dependency policy for downstream consumers of @planu/cli; consumers must review their own installed graph and advisories.

MCP:

node dist/sdd-engine/cli.js

pnpm eval:skills evaluates planning, execution and test-integrity review in synthetic workspaces through the local claude CLI. Existing executor cases retain locked-task, File Manifest and check enforcement. The repository guide docs/skill-quality-evaluation.md defines the explicit paired operator protocol: eight subjects per reviewed attempt, frozen inputs, retained success/failure evidence and a separate independent quality assessment. These provider-spending evaluations require an operator launch; they are outside pnpm check and CI. Structural success and a scoped review do not certify production behavior.


Reporting bugs

Report a bug at https://planu.dev/report. The form takes a summary, details, the Planu version, the host, and an optional contact email. The engine itself sends nothing. npx still contacts the npm registry. The CLI does not upload the workspace.

License

See the Planu Proprietary Free-Use License and planu.dev/license for the complete terms. Individuals use @planu/cli@latest, which asks npm for the current release on every start. Teams pin one version in a project .mcp.json. The home page renders that pin from the package version.

{
  "mcpServers": {
    "planu": {
      "command": "npx",
      "args": ["-y", "@planu/cli@8.5.1"],
      "cwd": ".",
      "env": {
        "PLANU_WORKSPACE": "."
      }
    }
  }
}