@yurin_nowhere/pi-anchored-standard

pi coding agent extension: two-stage RL-anchored scaffold (anchored-standard) for DeepSeek V4 Pro

Packages

Package details

extension

Install @yurin_nowhere/pi-anchored-standard from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:@yurin_nowhere/pi-anchored-standard
Package
@yurin_nowhere/pi-anchored-standard
Version
0.1.2
Published
Aug 14, 2026
Downloads
114/mo · 25/wk
Author
yurin_nowhere
License
MIT
Types
extension
Size
17.3 KB
Dependencies
0 dependencies · 1 peer
Pi manifest JSON
{
  "extensions": [
    "./src/index.ts"
  ]
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

README

@yurin_nowhere/pi-anchored-standard

A pi coding agent extension that ports the anchored-standard DeepSeek Harness preset, giving DeepSeek V4 Pro its RL-aligned request scaffold inside pi.

Why

DeepSeek V4 Pro is highly sensitive to the agent scaffold it runs in. On the Project2 V4.1b engineering-maintenance benchmark (xiaobright/modeltest):

Harness configuration Ability
Generic agent harness (25-tool catalog, full system prompt) 91–96 across 4 runs (mean 92.8)
Official minimal preset (one-line prompt, 2 tools) 99 / 96
anchored-standard (this recipe) 98 / 99

(The 98/99 is n=2 on one benchmark; see Caveats.)

The official minimal preset reproduces the "exact RL prompt and schemas" the model was trained against (per the upstream repo's own snapshot tests). The experiment that matters: keep that training-aligned first request, then restore the full tool catalog — the model keeps the strong trajectory without losing standard capabilities.

What it does

For sessions whose provider/model matches deepseek (case-insensitive, see MODEL_MATCH in src/index.ts):

  1. System prompt — the whole session uses the Minimal preset's one-liner, byte-identical to upstream:

    You are a helpful software engineer assistant.

    This suppresses pi's harness identity, per-tool guidance, runtime context, and auto-loaded context files (AGENTS.md etc.) — the model reads what it needs itself, which is exactly the validated condition.

  2. Tool catalog, two-stage — the first model request only exposes bash + read. After the session's first durable tool call, the full active tool set (built-ins, MCP, other extensions' tools) is restored for every subsequent request.

  3. State — derived per session branch and persisted via a session entry; resuming a session never re-restricts tools after the first tool call, and anchoring never leaks across sessions.

Non-matching models pass through completely untouched (no prompt change, no tool change).

Install

pi install npm:@yurin_nowhere/pi-anchored-standard

Then restart pi. If you already have DeepSeek V4 Pro available through a model catalog (e.g. the opencode-go provider in ~/.pi/agent/models-store.json exposes deepseek-v4-pro), anchoring turns on automatically — nothing else to configure.

To add DeepSeek's official API as your own provider, edit ~/.pi/agent/models.json (DeepSeek's API is OpenAI-compatible), e.g.: ~/.pi/agent/models.json (DeepSeek's API is OpenAI-compatible), e.g.:

{
  "providers": {
    "deepseek": {
      "baseUrl": "https://api.deepseek.com/v1",
      "api": "openai-completions",
      "apiKey": "<your key>",
      "models": [
        {
          "id": "deepseek-v4-pro",
          "reasoning": true,
          "contextWindow": 128000,
          "maxTokens": 32768
        }
      ]
    }
  }
}

Control

  • Automatic by model match (mode: auto, default).
  • PI_ANCHOR_MODE=on|off|auto — initial mode for a session (useful for headless/print and evaluator runs).
  • /anchor — show status (mode, model match, phase, tool counts).
  • /anchor on|off|auto — force-enable, disable, or return to model matching. Takes effect immediately; disabling mid-bootstrap restores the full tool set.

Verify

Run with PI_ANCHOR_DEBUG=1; every provider request is appended to ~/.pi/agent/anchored-standard-debug.jsonl with the exact system prompt and tool names. A correct bootstrap looks like:

{"tools":["bash","read"],"systemPrompt":"You are a helpful software engineer assistant.",...}
{"tools":["bash","read","edit","write","grep","glob",...],"systemPrompt":"You are a helpful software engineer assistant.",...}

First request: two tools. After the first tool call: full catalog, same one-line prompt.

Caveats

  • The 98/99 evidence is n=2 on a single benchmark (Project2). The recipe is DeepSeek-specific: V4 Flash shows no gain, and other models may be hurt by losing pi's system-prompt guidance — hence auto mode only matches DeepSeek.
  • While anchored, pi's default prompt features (AGENTS.md auto-load, tool guidance, runtime context) are intentionally suppressed for the session.
  • Tool restore is best-effort if other extensions (e.g. plan-mode) also swap the active tool set during the bootstrap phase.
  • --thinking max/high is recommended for V4 Pro; this extension does not touch thinking levels.

Credits

Recipe and evidence from xiaobright/modeltest (harness analysis, trigger experiments) and xiaobright/dsh-anchored-standard (MIT). The minimal persona text originates from deepseek-ai/deepseek-harness (MIT).

License

MIT — see LICENSE.