Skip to content

Add prompt-enhancer Mini App - #193

Open
skypata wants to merge 3 commits into
MiniMax-AI:mainfrom
skypata:add-prompt-enhancer
Open

skypata wants to merge 3 commits into
MiniMax-AI:mainfrom
skypata:add-prompt-enhancer

Conversation

@skypata

@skypata skypata commented Dec 1, 2026 •

Copy link
Copy Markdown

Adds Prompt Enhancer, a Mini App that rewrites a one-line request into a complete prompt for a
coding assistant. The rewrite template is fixed and bundled with the package; the model list and
the reasoning levels come from MiniMax Code's own runtime configuration, and each rewrite runs
through the local mcode CLI so it uses the account the user is already signed in to.

Changes in this revision

  • --permission off is no longer passed by default. The command now carries no --permission
    flag, so the CLI applies its own smart policy. The page has an "免确认执行" switch that adds
    --permission off when it is turned on; it starts unchecked on every launch and is not
    remembered between launches. The README documents the flag, the switch and what each one means.
  • User input is inserted verbatim. The template substitution used String.replace with a string
    replacement, so $&, $1, $' and $$ inside the typed text were treated as replacement
    patterns and the input was rewritten on its way to the model. It now uses a function
    replacement, and tests/prompts.test.mjs covers it.
  • The step cap is now --max-steps 2: with the default permission policy the agent may take one
    exploratory step before answering, and a cap of 1 turned that into a limit_exceeded error.

Tested environment

  • MiniMax Code 3.1.20 on macOS 15.8.1 (arm64), installed from this directory and opened through the
    Agent.
  • Client acceptance exercised: the model list loaded from the runtime configuration; the model
    picker opened and drilled from models into reasoning levels; a rewrite round-tripped - original
    sentence in, rewritten prompt out, undo restored the original sentence; the selected reasoning
    level reached the CLI as --effort; the permission switch is off on launch and adds
    --permission off only when turned on.
  • A rewrite was run with the default permission policy (no --permission flag) and completed.
  • The typed text was captured from the CLI's stdin and matched the input byte for byte, including
    $& and $1.
  • Not verified: Windows; a host with no configured model; a host where the mcode CLI is not on
    PATH.

npm run check

  • plugins/skypata/prompt-enhancer: OK - 0 errors, 0 warnings for this package.
  • The repository's own suite reports 2 failures in test/files.test.mjs ("files: two paths that
    differ only in letter case collide" and "files: a directory and a file that differ only in letter
    case collide"). They fail identically on the untouched HEAD: on a case-insensitive filesystem the
    test cannot create both spellings, so the expected diagnostics never appear. They are unrelated to
    this package and are not addressed here.

Access this Mini App declares

None. The package declares no agentAccess, toolAccess, deviceAccess or hostAccess. It
reads the runtime configuration file to build the model list, spawns the mcode CLI once per
rewrite, and keeps the typed text in the page's local storage as view state.

Written by MiniMax-M3.1-Flash

What the Mini App does

One text box, one model picker, one send button, one switch. The picker is a two-level drill-down:
it lists the models first, and picking a model that declares reasoning levels opens that model's
level list. After a rewrite the text box holds the rewritten prompt and an undo button appears in its
corner; one click puts the original sentence back.

The rewrite itself uses a fixed two-part prompt template bundled in miniapp/node/prompts/. It
keeps the user's language, refuses to answer the request, and expands it into scope, deliverable,
format and acceptance criteria.

How it reaches a model

The Node service spawns mcode exec once per rewrite with the bundled system prompt, the user
template filled with the typed text, and the selected model. It waits for the final message, strips
the wrapping quotes the model sometimes adds, and returns the rewritten prompt to the page.

The command is:

mcode exec --model <provider/model> --system-prompt-file <bundled system prompt> --input - \
         --input-format text --cwd <scratch dir> --max-steps 2 --output-format text -o <temp file> \
         [--effort <level>] [--permission off]

--permission off is only present when the page's switch is on. The child runs with --cwd pointing
at a scratch directory inside the Host-provided data directory, so it never starts in your project,
and it is killed on timeout and when the board is disposed. The temporary file it writes stays in
that data directory and is deleted right after it is read.

The model list is read from the MiniMax Code runtime configuration file config.yaml, located
through MAVIS_DATA_DIR, MINIMAX_DATA_DIR, __MAVIS_PARENT_DATA_DIR or
MCODE_CONFIG_DIR, otherwise ~/.minimax/config.yaml. That layout is not a supported API and
may change between releases; the package README says so.

Files

plugins/skypata/prompt-enhancer/.minimax-plugin/plugin.json
plugins/skypata/prompt-enhancer/package.json
plugins/skypata/prompt-enhancer/README.md
plugins/skypata/prompt-enhancer/README.zh-CN.md
plugins/skypata/prompt-enhancer/LICENSE
plugins/skypata/prompt-enhancer/icon.png
plugins/skypata/prompt-enhancer/miniapp/miniapp.json
plugins/skypata/prompt-enhancer/miniapp/client/index.html
plugins/skypata/prompt-enhancer/miniapp/client/styles.css
plugins/skypata/prompt-enhancer/miniapp/client/app.js
plugins/skypata/prompt-enhancer/miniapp/node/server.mjs
plugins/skypata/prompt-enhancer/miniapp/node/prompts/system-prompt.md
plugins/skypata/prompt-enhancer/miniapp/node/prompts/user-prompt-template.md
plugins/skypata/prompt-enhancer/tests/prompts.test.mjs

Sensitive information

Scanned the package for credentials, private keys, local paths, e-mail addresses, private IP
ranges and leftovers from the machine it was built on: none found. The package contains no API key
and no token; it never handles one.

@MyPrototypeWhat MyPrototypeWhat left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding the prompt-enhancer Mini App. The current head 280e0a9a is not ready to merge.

Every time the user clicks send, the rewrite spawns mcode exec with --permission off. Official docs list off and full as options that should only be used in an isolated workspace. The README says the app launches mcode exec and uses the signed-in account, but it does not mention --permission off. There is also no switch to keep this off by default, or to ask for confirmation first. Please document --permission off in the README, and keep this off by default or require confirmation before it runs.

userTemplate.replace('{input}', text) also follows JavaScript's replace rules for sequences such as $&. I reproduced this locally, and user input can be rewritten. Please fix the substitution so user input is inserted unchanged.

Please update the branch, and we will look at the new head.

@skypata

skypata commented Dec 2, 2026

Copy link
Copy Markdown
Author

Updated - new head f7774df. Two changes, both covered by the new tests/prompts.test.mjs.

1. --permission off is now opt-in. The command no longer carries --permission by default, so
the CLI applies its own smart policy. The page has an "免确认执行" switch that adds
--permission off when turned on; it is unchecked on every launch and is not remembered between
launches. Both READMEs now document the flag, the switch, and what each one means. The child still
runs with --cwd pointing at a scratch directory inside the Host-provided data directory.

2. User input is inserted verbatim. The template substitution used String.replace with a string
replacement, so $&, $1, $' and $$ inside the typed text were treated as replacement patterns
and the input was rewritten on its way to the model. It now uses a function replacement.

Also raised the step cap from --max-steps 1 to 2: under the default permission policy the agent
can take one exploratory step before answering, and a cap of 1 surfaced that as limit_exceeded.

Verified: a rewrite completes under the default permission policy; the typed text was captured from
the CLI's stdin and matched the input byte for byte, including $& and $1; npm run validate
reports this package as OK.

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.

2 participants