pi-english-practice
v0.1.0
Published
Practice English coding prompts before Pi executes them
Maintainers
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-practicePi 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-onenables practice for the current TUI session./english-offdisables practice and clears the footer indicator./english-statusreports 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:
- Code blocks, inline code, URLs, and paths are protected byte-for-byte.
- The current Pi model creates a concise coding-agent English reference.
- The reference stays visible while you rewrite it in the multiline editor.
- 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.
- A failed rewrite shows specific missing or changed meaning and lets you retry without a limit.
- 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./retranslateasks for another natural version./cancelor 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.
