pi-caveman 1.0.10 → 1.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -82,7 +82,7 @@ When active, a status bar displays caveman level and an animated campfire flicke
82
82
 
83
83
  ## How It Works
84
84
 
85
- The extension hooks `before_agent_start` to append caveman communication rules to the system prompt at the selected intensity. Within a session, the active level is stored as a custom session entry and restored on resume. Across sessions, persistent config (`~/.pi/agent/caveman.json` by default, or `$XDG_CONFIG_HOME/pi/agent/caveman.json` when `XDG_CONFIG_HOME` is set; `PI_CODING_AGENT_DIR` overrides both) provides the default level and status bar preference. Auto-clarity rules tell the model to drop caveman mode for security warnings or irreversible actions.
85
+ The extension hooks `before_agent_start` to add caveman communication rules at the selected intensity. On Pi hosts with `systemPromptOptions.sections`, it writes a `caveman` section so later extensions can still add their own prompt sections, and removes that section when disabled. Older hosts use whole-prompt replacement, preserving ordered prompt blocks on OMP. Within a session, the active level is stored as a custom session entry and restored on resume. Across sessions, persistent config (`~/.pi/agent/caveman.json` by default, or `$XDG_CONFIG_HOME/pi/agent/caveman.json` when `XDG_CONFIG_HOME` is set; `PI_CODING_AGENT_DIR` overrides both) provides the default level and status bar preference. Auto-clarity rules tell the model to drop caveman mode for security warnings or irreversible actions.
86
86
 
87
87
  ## Warning
88
88
 
@@ -439,13 +439,25 @@ export default function caveman(pi: ExtensionAPI) {
439
439
 
440
440
  pi.on("before_agent_start", async (event) => {
441
441
  await ensureConfigLoaded();
442
- if (level === "off") return;
442
+ // Use a structural check so older Pi/OMP hosts can still use the legacy path.
443
+ const sections = (event as { systemPromptOptions?: { sections?: Record<string, string> } })
444
+ .systemPromptOptions?.sections;
445
+ const hasSections = sections !== null && typeof sections === "object" && !Array.isArray(sections);
446
+ if (level === "off") {
447
+ if (hasSections) delete sections.caveman;
448
+ return;
449
+ }
443
450
  const addition =
444
451
  level === "micro"
445
452
  ? MICRO_PROMPT
446
453
  : level === "lite"
447
454
  ? `${INTENSITY.lite}\n\n${SAFETY}`
448
455
  : `${BASE}\n\n${INTENSITY[level]}\n\n${SAFETY}`;
456
+ if (hasSections) {
457
+ // Returning a whole prompt freezes it before later handlers add their sections.
458
+ sections.caveman = addition;
459
+ return;
460
+ }
449
461
  return {
450
462
  systemPrompt: appendSystemPrompt(
451
463
  event.systemPrompt as string | string[] | null | undefined,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-caveman",
3
- "version": "1.0.10",
3
+ "version": "1.0.11",
4
4
  "description": "Why use many token when few do trick. Caveman mode for pi — cuts ~75% output tokens while keeping full technical accuracy.",
5
5
  "keywords": [
6
6
  "pi-package",