Skip to content

aft-pi: hoisted read/write/edit reuse Pi built-in names but render incompatibly in Pi chat #15

Closed

Description

@kseikyo

What happened?

With @cortexkit/aft-pi 0.14.0 and the default tool_surface: "recommended", the hoisted read / write / edit tools reuse Pi built-in names but do not provide custom renderers.

In Pi main chat, those same-name tools then pick up Pi's built-in renderers automatically. For edit and write, the payload shape is not compatible with the built-in renderer expectations, so rendering degrades.

For example, edit succeeds but can render as just:

edit ...

or otherwise miss the expected built-in preview/result rendering.

This is reproducible in pi 0.68.0 with AFT installed, and does not reproduce for me with a clean pi config and no AFT package.

Steps to reproduce

  1. Install @cortexkit/aft-pi 0.14.0.
  2. Keep default AFT config with tool_surface: "recommended".
  3. Start pi main chat.
  4. Send:
    Use only the built-in write and edit tools. First, create note.txt with exactly one line: hello. Second, use the built-in edit tool to change hello to world. When complete, reply with exactly: done

Observed in AFT-backed setup:

write ...

hello

edit ...

done

But with a clean PI_CODING_AGENT_DIR and no AFT package, I get normal built-in rendering:

write note.txt

hello

edit note.txt

-1 hello
+1 world

Why I think this is happening

AFT hoists tools named exactly read, write, and edit.

From the installed package:

  • README.md says recommended includes hoisted read / write / edit
  • dist/index.js registers those exact tool names

But the AFT tool payload shape differs from Pi built-ins:

  • AFT write / edit use filePath
  • AFT edit uses oldString / newString
  • AFT result details do not include the built-in edit details.diff shape

Since AFT does not provide custom renderCall / renderResult for those same-name tools, Pi appears to reuse its built-in renderer automatically, and the renderer mismatch produces degraded output.

Expected behavior

One of these should happen:

  • AFT hoisted read / write / edit should provide custom renderers
  • or AFT hoisted tools should align their arg/result shape with Pi built-in renderer expectations
  • or AFT should avoid same-name hoisting where renderer compatibility is not intended

Temporary local workaround

Disabling hoisted conflicting tools in ~/.pi/agent/aft.jsonc fixes it for me:

{
  "tool_surface": "recommended",
  "disabled_tools": ["edit", "write", "read"]
}

Version

  • @cortexkit/aft-pi: 0.14.0
  • pi: 0.68.0

Activity

  1. ualtinok commented on Apr 22, 2026

    @ualtinok
    Collaborator

    Hi @kseikyo — fix shipped in v0.14.1 (@cortexkit/aft-pi@0.14.1 on npm).

    Hoisted write and edit now ship Pi-native renderCall + renderResult (using @mariozechner/pi-tui primitives and Pi-format line-numbered diffs) so they render properly in Pi chat instead of falling back to Pi's built-in renderers and producing garbled output. Hoisted read and grep keep Pi's text fallback since their payload already matches Pi's expected shape.

    We also added promptSnippet and promptGuidelines for the hoisted tools, so the model sees AFT's parameter schema (filePath, oldString/newString, occurrence, replaceAll) directly in the system prompt instead of having to guess from training data of Pi's built-in conventions.

    To pick up the fix, restart Pi after upgrading. Thanks for the detailed report — really helpful to have the renderer-fallback behavior documented from the user side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions