Use pi-coding-agent's getAgentDir helper for extension paths instead of
reconstructing PI_CODING_AGENT_DIR and ~/.pi/agent locally. This keeps
personas and handoff aligned with Pi's own agent directory resolution.
@@ -7,7 +7,7 @@
*
* Switch between agent personas stored as markdown files.
*
- * Personas live in $PI_CODING_AGENT_DIR/personas/ as .md files.
+ * Personas live in the Pi agent directory's personas/ subdirectory as .md files.
* The active persona is appended to the system prompt in a <persona>
* section, independent of SYSTEM.md and AGENTS.md.
*
@@ -16,26 +16,15 @@
* /persona none|unset|clear — Remove active persona
*
* The active persona persists across sessions in a plain text file
- * at $PI_CODING_AGENT_DIR/persona.
+ * at persona in the Pi agent directory.
*/
import * as fs from "node:fs";
import * as path from "node:path";
-import * as os from "node:os";-import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
+import { getAgentDir, type ExtensionAPI } from "@earendil-works/pi-coding-agent";
const CLEAR_KEYWORDS = ["none", "unset", "clear"];
-function getAgentDir(): string {- const envDir = process.env.PI_CODING_AGENT_DIR;- if (envDir) {- if (envDir === "~") return os.homedir();- if (envDir.startsWith("~/")) return path.join(os.homedir(), envDir.slice(2));- return envDir;- }- return path.join(os.homedir(), ".pi", "agent");-}-
function getPersonasDir(): string {
return path.join(getAgentDir(), "personas");
}