pi-english-practice

Practice English coding prompts before Pi executes them

Packages

Package details

extension

Install pi-english-practice from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:pi-english-practice
Package
pi-english-practice
Version
0.1.0
Published
Aug 13, 2026
Downloads
149/mo · 8/wk
Author
bbnopromo
License
MIT
Types
extension
Size
25.8 KB
Dependencies
0 dependencies · 2 peers
Pi manifest JSON
{
  "extensions": [
    "./src/index.ts"
  ]
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

README

Pi English Practice

Pi English Practice is a Pi Coding Agent extension that turns Chinese coding instructions into practical English exercises before Pi executes them. It shows a natural reference translation, asks you for a close English rewrite, and executes only the reference translation after your rewrite preserves the important meaning.

Requires Node.js 22.19 or newer and Pi Coding Agent 0.83.0 or newer. The MVP supports only Pi's interactive terminal UI (TUI).

Install and run

For local development, start Pi from this directory:

pi -e .

To install the package from a local checkout:

pi install /absolute/path/to/pi-english-practice

Pi extensions run with the same full local permissions as Pi itself. Review extension source before installing it, just as you would any other locally executable package.

Commands

  • /english-on enables practice for the current TUI session.
  • /english-off disables practice and clears the footer indicator.
  • /english-status reports whether the mode is on or off.

The mode starts OFF in every new, restored, switched, or reloaded session. While enabled, the footer shows English Practice: ON.

Training flow

When the mode is on, English input and input that is primarily code continue to Pi unchanged. A primarily Chinese instruction is intercepted before the agent starts:

  1. Code blocks, inline code, URLs, and paths are protected byte-for-byte.
  2. The current Pi model creates a concise coding-agent English reference.
  3. The reference stays visible while you rewrite it in the multiline editor.
  4. Your rewrite may use common synonyms, abbreviations, small word-order changes, and harmless grammar mistakes. It must retain every action, target, important constraint, negation, scope boundary, and required technical literal.
  5. A failed rewrite shows specific missing or changed meaning and lets you retry without a limit.
  6. A passing rewrite may show up to two brief corrections. Pi then receives only the reference English, never the source Chinese or your practice attempt.

Large fenced code or log blocks are carried into the final instruction automatically and do not need to be retyped. Short inline code, paths, URLs, and similar required literals must remain exact. Original image attachments are preserved on a successful transformation.

Inside an exercise:

  • /retranslate <note> asks for a new reference using your note.
  • /retranslate asks for another natural version.
  • /cancel or Esc cancels without executing anything.

Model use, privacy, and failures

Translation and rewrite validation reuse Pi's currently selected model and authentication configuration, so they consume that provider's tokens and may incur normal provider charges. Each Chinese task usually needs one translation call plus one validation call per attempt. A malformed structured response may cause one additional repair call.

Side-channel requests contain only the current masked instruction or the current reference and rewrite. They have no tools, conversation history, project files, or Pi system prompt. The extension stores no learning history, scores, attempts, or statistics and writes no extension state to session entries, files, or a database.

The behavior is fail-closed. Missing models, authentication errors, timeouts, provider errors, malformed JSON, altered protected fragments, unsupported modes, and concurrent exercises stop the task without starting the agent. On non-cancel failures, the original text is restored to Pi's editor. Because Pi cannot restore consumed attachments to the editor, the extension explicitly asks you to reattach any original images.

Steer and follow-up input submitted while the agent is running does not start an exercise; wait until Pi is idle and submit it again.