This repository has been archived on 2026-03-06. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
openclaw-extensions/wecom/node_modules/@mariozechner/pi-coding-agent/examples/extensions/system-prompt-header.ts
T

18 lines
526 B
TypeScript

/**
* Displays a status widget showing the system prompt length.
*
* Demonstrates ctx.getSystemPrompt() for accessing the effective system prompt.
*/
import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
export default function (pi: ExtensionAPI) {
pi.on("agent_start", (_event, ctx) => {
const prompt = ctx.getSystemPrompt();
ctx.ui.setStatus("system-prompt", `System: ${prompt.length} chars`);
});
pi.on("session_shutdown", (_event, ctx) => {
ctx.ui.setStatus("system-prompt", undefined);
});
}