pi-ds-anchor.ts A developer released pi-ds-anchor.ts, an extension for the Pi coding agent that adds two commands—/new-ds-anchored-session and /ds-anchor—to send a tool-free 'who are you' probe with a minimal system prompt to DeepSeek models. The extension restricts the probe to DeepSeek v4 flash and pro models, rewrites the provider payload to strip tools, and stores anchoring state as a custom session entry for persistence. | / | | | DS Anchored Session Extensions | | | | | | Provides two commands that send a single "who are you" probe with: | | | - a minimal system prompt "You are a helpful software engineer assistant" | | | - no tools in the provider payload | | | | | | /new-ds-anchored-session | | | Creates a new session, then runs the anchored probe as its first message. | | | | | | /ds-anchor | | | Runs the anchored probe in the current session. Fails if the session | | | already has conversation history or the current model is not supported. | | | | | | The anchoring state is stored as a custom session entry so it survives | | | session persistence; before provider request rewrites only the probe turn. | | | / | | | import type { | | | ExtensionAPI, | | | ExtensionCommandContext, | | | ExtensionContext, | | | SessionEntry, | | | } from "@earendil-works/pi-coding-agent"; | | | const ALLOWED PROVIDER = "deepseek"; | | | const ALLOWED MODEL IDS = new Set "deepseek-v4-flash", "deepseek-v4-pro" ; | | | const SINGLE SYSTEM PROMPT = "You are a helpful software engineer assistant"; | | | const ANCHOR CUSTOM TYPE = "ds-anchored-session"; | | | const ANCHOR WIDGET ID = "ds-anchored-session"; | | | interface AnchorState { | | | phase: "anchoring" | "done"; | | | } | | | interface ModelIdentity { | | | provider: string; | | | id: string; | | | } | | | function isAllowedModel model: ModelIdentity | undefined | null : boolean { | | | return | | | model == undefined && | | | model == null && | | | model.provider === ALLOWED PROVIDER && | | | ALLOWED MODEL IDS.has model.id | | | ; | | | } | | | function modelLabel model: ModelIdentity : string { | | | return ${model.provider}/${model.id} ; | | | } | | | function findLatestAnchorEntry entries: SessionEntry : AnchorState | undefined { | | | for let i = entries.length - 1; i = 0; i-- { | | | const entry = entries i ; | | | if entry.type === "custom" && entry.customType === ANCHOR CUSTOM TYPE { | | | return entry.data as AnchorState; | | | } | | | } | | | return undefined; | | | } | | | function hasConversationHistory entries: SessionEntry : boolean { | | | return entries.some entry = entry.type === "message" || entry.type === "compaction" ; | | | } | | | function isAnchoring entries: SessionEntry : boolean { | | | return findLatestAnchorEntry entries ?.phase === "anchoring"; | | | } | | | function rewritePayloadForAnchoring payload: unknown : unknown { | | | if typeof payload == "object" || payload === null { | | | return payload; | | | } | | | const request = payload as Record