Adds @magpie-community/middleware-output-strategy 0.2.0. It is middleware only. It appends composable output-style instructions before the model call, and has a small selection page. - Codex `instructions` stay byte-identical. The styles go into a `developer` input item at input[0]. - An existing marker means the body was already applied, and it passes unchanged, so the prompt cache holds across turns. - It writes nothing to disk and has no hooks or telemetry. - PROVENANCE credits OmniRoute v3.8.52. Run at 9b47678ba (mote, Bun 1.4.2, HOME=$(mktemp -d)): - package bun test: 49 pass, 0 fail; - repo bun test: 6555 pass, 0 fail; - scripts/check.mjs output-strategy: ok; - magpie's moejs engine at origin/main 8e350155b: the Claude Code system field is identical over four turns, and the Codex input prefix is stable; - 12 guards broken by hand, each one red. - PR CI (test, on-npm): green. Not tried: real accounts, Codex over websocket, Windows, Linux.
output-strategy
Composable output-style instructions injected before a model call. Seven styles are available in a small selection panel; every style is off by default.
The style texts and the original request-injection design are adapted from OmniRoute's Output Styles, caveman, ponytail, i-have-adhd and 9router. Exact sources, revisions, licenses and adaptations are recorded in PROVENANCE.json; upstream license files are in LICENSES/.
Styles
- Terse prose — remove filler, ceremony and hedging without losing technical content.
- Less code — YAGNI and the smallest working change.
- Ponytail — lazy senior-developer discipline: reuse, root causes and a complete minimal diff.
- I have ADHD — action first, numbered steps and one concrete next action.
- Terse CJK — ultra-terse Classical Chinese, with technical identifiers kept verbatim. Unlike OmniRoute's zh-only automatic use, this is an explicit style available for any locale.
- Antislop UI — purpose-tested visuals rather than template decoration and dead controls.
- Antislop copy — honest, specific copy with accessibility and complete UI states.
Select any combination in the Output Strategy panel and save. Styles are combined in catalog order and duplicate boundaries are included only once.
Options
{
"styles": {
"terse-prose": false,
"less-code": false,
"ponytail": true,
"i-have-adhd": false,
"terse-cjk": false,
"antislop-ui": false,
"antislop-copy": false
}
}
No options, an empty options object, or all styles off leaves a request unchanged.
Request behavior
- Anthropic and Chat Completions: append one static style block to the existing system prompt, or create the protocol-appropriate system field when none exists.
- Responses: leave
instructionscompletely untouched, including Codex's identity and base instructions. Add the style block as a separatedeveloperinput item. - An existing
[Output Strategy]marker: the body is already considered injected and is left unchanged; old blocks are never stripped or replaced. - Cache stability: a selected style injects consistently across turns. The former
autoClarityand media-history bypasses are removed because they made the cached system prefix appear and disappear. - Unknown or unsupported shapes: pass through unchanged. Middleware errors fail open.
This package has no Bun gateway hook, telemetry, prompt logging, or writes to the plugin installation folder. The panel reads and writes only magpie.options and follows magpie.theme.lang.
Verification
bun test
node scripts/gen-page-catalog.mjs
page/catalog.js is generated from catalog.js. From the community repository, output-strategy.test.mjs runs the same cases.json through ../../scripts/middleware.mjs.
中文摘要
7 种输出样式可以自由组合,全部默认关闭。启用后在请求发送前注入固定规则;Responses 不修改 Codex 的 instructions,而是另加 developer 输入项。已有 [Output Strategy] 标记的请求原样通过。为避免提示缓存失效,已移除 autoClarity 和媒体历史绕过;不再提供统计 hook,不保存请求或响应正文,也不写插件安装目录。页面跟随 Magpie 的语言设置。