Skip to content

feat(pi): add standalone Calm presentation mode - #29

Merged
kunchenguid merged 5 commits into
mainfrom
fm/dotpub-pi-calm-standalone-r1
Aug 1, 2026
Merged

feat(pi): add standalone Calm presentation mode#29
kunchenguid merged 5 commits into
mainfrom
fm/dotpub-pi-calm-standalone-r1

Conversation

@kunchenguid

Copy link
Copy Markdown
Owner

Intent

Build the captain-authorized standalone Pi Calm extension in the public kunchenguid/dotfiles repository. It must auto-load from the repository-managed global Pi extensions directory, register /calm, default off, and persist only a local untracked preference at ~/.pi/agent/calm. While active it must preserve genuine user and assistant text, hide only collapsed thinking and Pi's seven known built-in tool call/result shells gaplessly, replace the stock working row with a resize-safe animated blue-water/yellow-boat widget, preserve Ctrl+O expansion state, and restore stock rendering when off. It must leave custom tools and unsupported transcript rows visible, keep session/model/tool semantics and /share and /export content unchanged, have zero Firstmate runtime coupling, retain the required MIT attribution for adapted code, document all boundaries, and include deterministic plus isolated credential-free real Pi 0.82 TUI coverage. Do not activate or rebuild a live system.

What Changed

  • Add an auto-loaded standalone Pi Calm extension with a /calm toggle, off-by-default behavior, and local untracked preference persistence.
  • Hide collapsed thinking and Pi’s seven built-in tool shells while preserving transcript content, custom tools, tool semantics, export/share output, Ctrl+O state, and stock rendering when disabled; replace the working row with a resize-safe animated boat widget.
  • Document runtime boundaries and MIT attribution, with deterministic contract coverage and an isolated credential-free Pi 0.82 TUI test.

Risk Assessment

✅ Low: The change is now presentation-only and well-bounded: stock built-ins are identified without replacing execution definitions, while extension collisions, SDK custom tools, and SDK base-tool overrides retain their rendering.

Testing

Confirmed the baseline environment uses real Pi 0.82.0, then passed the focused deterministic contracts and isolated credential-free real Pi TUI flow twice; visual terminal captures confirmed auto-loading, genuine transcript visibility, and resize-safe Calm boat rendering, with the worktree left clean.

Evidence: Real Pi 0.82 Calm TUI at 100 columns

 �[1m�[38;2;138;190;183mpi�[0m�[38;2;102;102;102m v0.82.0�[39m
 �[38;2;102;102;102mescape�[38;2;128;128;128m interrupt · �[38;2;102;102;102mctrl+c/ctrl+d�[38;2;128;128;128m clear/exit · �[38;2;102;102;102m/�[38;2;128;128;128m commands · �[38;2;102;102;102m!�[38;2;128;128;128m bash · �[38;2;102;102;102mctrl+o�[38;2;128;128;128m more�[39m
 �[38;2;102;102;102mPress ctrl+o to show full startup help and loaded resources.�[39m

 �[38;2;102;102;102mPi can explain its own features and look up its docs. Ask it how to use or extend Pi.�[39m

�[38;2;240;198;116m[Extensions]�[39m
�[38;2;102;102;102m  calm, provider.ts�[39m

�[48;2;52;53;65m
 �[38;2;212;212;212mCALM_SMOKE_GENUINE_USER�[39m


�[49m �[33m<|�[39m
�[33m\__/�[34m~~-~~~-~~~-~~~-~~~-~~~-~~~-~~~-~~~-~~~-~~~-~~~-~~~-~~~-~~~-~~~-~~~-~~~-~~~-~~~-~~~-~~~-~~~-~~~-~
�[38;2;80;80;80m────────────────────────────────────────────────────────────────────────────────────────────────────
�[7m�[39m �[0m
�[38;2;80;80;80m────────────────────────────────────────────────────────────────────────────────────────────────────
�[38;2;102;102;102m/private/var/folders/5x/4nqprlbx0518k3ybcb1sz6gr0000gn/T/no-mistakes-evidence/01KYXRWDVAN3WZ65M1P...
0.1%/4.1k (auto)                                                                       deterministic
Evidence: Real Pi 0.82 Calm TUI resized to 40 columns

 �[1m�[38;2;138;190;183mpi�[0m�[38;2;102;102;102m v0.82.0�[39m
 �[38;2;102;102;102mescape�[38;2;128;128;128m interrupt · �[38;2;102;102;102mctrl+c/ctrl+d�[38;2;128;128;128m
�[39m �[38;2;128;128;128mclear/exit · �[38;2;102;102;102m/�[38;2;128;128;128m commands · �[38;2;102;102;102m!�[38;2;128;128;128m bash ·
�[39m �[38;2;102;102;102mctrl+o�[38;2;128;128;128m more�[39m
 �[38;2;102;102;102mPress ctrl+o to show full startup help
�[39m �[38;2;102;102;102mand loaded resources.�[39m

 �[38;2;102;102;102mPi can explain its own features and
�[39m �[38;2;102;102;102mlook up its docs. Ask it how to use or
�[39m �[38;2;102;102;102mextend Pi.�[39m

�[38;2;240;198;116m[Extensions]�[39m
�[38;2;102;102;102m  calm, provider.ts�[39m

�[48;2;52;53;65m
 �[38;2;212;212;212mCALM_SMOKE_GENUINE_USER�[39m


�[49m �[33m<|�[39m
�[33m\__/�[34m~~-~~~-~~~-~~~-~~~-~~~-~~~-~~~-~~~-~
�[38;2;80;80;80m────────────────────────────────────────
�[7m�[39m �[0m
�[38;2;80;80;80m────────────────────────────────────────
�[38;2;102;102;102m/private/var/folders/5x/4nqprlbx0518k...
0.1%/4.1k (auto)           deterministic

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

🔧 **Review** - 1 issue found → auto-fixed (3) ✅
  • 🚨 home/.pi/agent/extensions/calm/index.ts:181 - Intent requires Calm to keep "tool semantics ... unchanged," but these registrations replace Pi's built-in definitions by name and line 185 executes fresh factory-created tools even while Calm is off. This bypasses supported base behavior such as read auto-resize settings, bash shell path/command prefix, SDK base-tool overrides, and competing same-name extension definitions. Confirm whether semantic replacement is authorized; otherwise preserve the active tool definitions and apply Calm at a shared renderer-only boundary.

🔧 Fix: Preserve Pi tool semantics in Calm rendering
1 error still open:

  • 🚨 home/.pi/agent/extensions/calm/lib/built-in-tool-shells.ts:62 - Intent requires Calm to "leave custom tools ... visible," but builtInToolDefinition is populated by Pi solely from toolName. Therefore, an extension or SDK override named read, bash, etc. satisfies this condition and its custom row is hidden while Calm is active. Identify the active definition's source at the earliest boundary that retains source metadata, rather than treating every row with a built-in name as a built-in tool.

🔧 Fix: Preserve built-in-named custom tool rendering
1 error still open:

  • 🚨 home/.pi/agent/extensions/calm/lib/built-in-tool-shells.ts:76 - The durable fix still misses Pi's supported SDK base-tool override path. When baseToolsOverride supplies a custom read/bash definition, Pi places it in _baseToolDefinitions and labels it with source: &#34;builtin&#34;; this lookup therefore adds that custom definition to builtInDefinitions, and Calm hides its custom renderer. This contradicts "leave custom tools ... visible" and the file's claim that SDK overrides render unchanged. At this AgentSession boundary, also exclude names present in the session's base-tools override before marking a definition as stock.

🔧 Fix: Preserve SDK base-tool override rendering
✅ Re-checked - no issues remain.

✅ **Test** - passed

✅ No issues found.

  • Preflight: pi --version, command -v tmux, and installed Pi package inspection
  • bash tests/pi-calm.test.sh
  • TMPDIR=/var/folders/5x/4nqprlbx0518k3ybcb1sz6gr0000gn/T/no-mistakes-evidence/01KYXRWDVAN3WZ65M1PCVTVHWT KEEP_TMP=1 bash tests/pi-calm.test.sh
  • Manual review of working-wide.current.ansi.txt and working-narrow.current.ansi.txt
  • git status --short after testing
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

@kunchenguid
kunchenguid merged commit 5f1bd7f into main Aug 1, 2026
1 check passed
@kunchenguid
kunchenguid deleted the fm/dotpub-pi-calm-standalone-r1 branch August 1, 2026 05:32
Aviator-Coding pushed a commit to Aviator-Coding/dotfiles that referenced this pull request Aug 1, 2026
* feat(pi): add standalone Calm extension

* no-mistakes(review): Preserve Pi tool semantics in Calm rendering

* no-mistakes(review): Preserve built-in-named custom tool rendering

* no-mistakes(review): Preserve SDK base-tool override rendering

* no-mistakes(document): Document Pi Calm autoload and runtime boundaries
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant