pi-caveman 1.0.9 → 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
 
@@ -159,7 +159,10 @@ Respond like smart caveman. Cut all filler, keep technical substance.
159
159
 
160
160
  const INTENSITY: Record<Exclude<Level, "off" | "micro">, string> = {
161
161
  lite: `\
162
- No filler/hedging. Keep articles + full sentences. Professional but tight.
162
+ No filler, no hedging, no pleasantries. Keep articles and full sentences.
163
+ Write like a tight senior engineer in chat: complete sentences, plain prose,
164
+ no fragments unless natural. Technical terms exact. Short is good, choppy is not.
165
+ Prefer 2-4 sentence answers over bullet fragments when prose reads better.
163
166
  Example: "Your component re-renders because you create a new object reference each render. Wrap it in \`useMemo\`."`,
164
167
 
165
168
  full: `\
@@ -436,9 +439,25 @@ export default function caveman(pi: ExtensionAPI) {
436
439
 
437
440
  pi.on("before_agent_start", async (event) => {
438
441
  await ensureConfigLoaded();
439
- 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
+ }
440
450
  const addition =
441
- level === "micro" ? MICRO_PROMPT : `${BASE}\n\n${INTENSITY[level]}\n\n${SAFETY}`;
451
+ level === "micro"
452
+ ? MICRO_PROMPT
453
+ : level === "lite"
454
+ ? `${INTENSITY.lite}\n\n${SAFETY}`
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
+ }
442
461
  return {
443
462
  systemPrompt: appendSystemPrompt(
444
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.9",
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",