nativeprompt 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Edvard Grishin
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,323 @@
1
+ Metadata-Version: 2.4
2
+ Name: nativeprompt
3
+ Version: 0.1.0
4
+ Summary: Rewrite your prompt into the native dialect of the model you're actually using — by each vendor's OFFICIAL rules, and tell you why.
5
+ Author-email: Edvard Grishin <edvardgrishin001@gmail.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/edvardgrishin27/nativeprompt
8
+ Project-URL: Source, https://github.com/edvardgrishin27/nativeprompt
9
+ Keywords: prompt,prompt-engineering,llm,claude,openai,codex,prompt-optimizer
10
+ Requires-Python: >=3.9
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE
13
+ Dynamic: license-file
14
+
15
+ # nativeprompt
16
+
17
+ **Rewrite your prompt into the native dialect of the model you're actually running — using that vendor's official rules — and show you which rule drove each edit.**
18
+
19
+ ![MIT](https://img.shields.io/badge/license-MIT-black)
20
+ ![Python 3.9+](https://img.shields.io/badge/python-3.9%2B-blue)
21
+ ![zero deps](https://img.shields.io/badge/dependencies-0-brightgreen)
22
+ ![67 tests](https://img.shields.io/badge/tests-63%20passing-brightgreen)
23
+ ![offline](https://img.shields.io/badge/core-deterministic%20%C2%B7%20offline-lightgrey)
24
+
25
+ **English** | [Русский](README.ru.md)
26
+
27
+ Scope: the **agentic CLIs** — Claude Code and Codex. Not the API, not the web chat.
28
+
29
+ ---
30
+
31
+ ## Why
32
+
33
+ The two vendors do not agree on what a good prompt looks like. Their own docs say so.
34
+
35
+ | Same phrase in your prompt | Claude Code | Codex / GPT‑5.x |
36
+ |---|---|---|
37
+ | "think step by step" | acceptable scaffolding | **remove it** — reasoning models plan internally, and prescribed intermediate steps get in the way ([reasoning guide](https://developers.openai.com/api/docs/guides/reasoning)) |
38
+ | "double-check yourself" | **remove it on Opus 5** — the model already verifies, so the reminder buys over-verification, tokens and latency ([Opus 5 prompting](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/prompting-claude-opus-5)) | harmless, but usually redundant |
39
+ | "only report the important stuff" | **rephrase** — Opus 5 follows constraints literally and will genuinely hide the rest; ask for everything, filter in a second pass ([Opus 5 prompting](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/prompting-claude-opus-5)) | same direction, weaker effect |
40
+ | repeated instructions, extra examples | tolerated | **cut them** — lean prompts win on GPT‑5.x ([prompt guidance](https://developers.openai.com/api/docs/guides/prompt-guidance)) |
41
+ | mixed instructions + data + examples | **wrap in XML tags** so the model doesn't blend them ([XML tags](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/use-xml-tags)) | not a documented Codex practice |
42
+ | "CRITICAL: you MUST…" in caps | **drop the caps** — aggressive scaffolding causes over-triggering on new models | **drop it** — GPT‑4.1-era scaffolding, no longer helps ([GPT‑5 prompting guide](https://developers.openai.com/cookbook/examples/gpt-5/gpt-5_prompting_guide)) |
43
+
44
+ So a prompt tuned on one CLI is measurably *mis*-tuned on the other. `nativeprompt` detects which one you're on and applies that vendor's published rules — plus it recommends **how to run** the task (`/goal`, `/loop`, plan mode, dynamic workflow on Claude Code; `/plan`, `/goal`, delegation on Codex).
45
+
46
+ ## What makes it different
47
+
48
+ Both vendors ship a prompt improver, but only for their own model, closed, and frozen at release time. Generic multi-vendor rewriters make *you* pick the target and their rule sets drift out of date. Four properties together are the point:
49
+
50
+ | | Anthropic prompt improver | OpenAI prompt optimizer | Generic multi-vendor rewriters (Rosetta et al.) | **nativeprompt** |
51
+ |---|---|---|---|---|
52
+ | **Auto-detects the model you're on** | n/a — Anthropic only | n/a — OpenAI only | you pick the target manually | yes — family + generation, from the live session, env, or settings files |
53
+ | **Rules sourced from vendor docs** | implicit, not shown | implicit, not shown | usually hand-written folklore | every rule carries a `source` URL you can open |
54
+ | **Explains each edit** | no — silent rewrite | no — silent rewrite | rarely | yes — rule title, rationale, and link per finding |
55
+ | **Stays current** | ships when the vendor ships | ships when the vendor ships | goes stale | `update --diff` shows the exact changed lines in the vendor's doc; weekly CI opens a PR with that diff |
56
+
57
+ Plus: **zero runtime dependencies** (stdlib only), deterministic, works offline, no API key. The only command that touches the network is `update`.
58
+
59
+ > **Note on language.** The CLI's explanations are currently written in Russian (the author's audience); rule titles link to the vendors' English documentation. The code, the API and this README are English. English CLI output is on the roadmap — see [Contributing](#contributing).
60
+
61
+ ## Install
62
+
63
+ `pipx install nativeprompt` / `pip install nativeprompt` — **coming soon**, the package is not on PyPI yet.
64
+
65
+ Until then, install from a clone:
66
+
67
+ ```bash
68
+ git clone https://github.com/edvardgrishin27/nativeprompt
69
+ cd nativeprompt
70
+ pip install -e . # gives you the `nativeprompt` command
71
+ ```
72
+
73
+ Or run it with no install at all — it is stdlib-only:
74
+
75
+ ```bash
76
+ python3 -m nativeprompt improve "your prompt" --model claude-opus-5
77
+ ```
78
+
79
+ Requires Python ≥ 3.9. Nothing else.
80
+
81
+ ## Quick start
82
+
83
+ ```bash
84
+ # 1. Which model does it think you're on?
85
+ nativeprompt detect
86
+ ```
87
+
88
+ ```
89
+ Модель: claude-opus-5[1m] · opus-5
90
+ Семейство/CLI: claude (Claude Code)
91
+ Определено: ~/.claude/settings.json (сессия Claude Code · VS Code)
92
+ ```
93
+
94
+ ```bash
95
+ # 2. Rewrite + explain. Always pass the prompt over stdin —
96
+ # quotes and $substitutions inside a user prompt will otherwise break the command.
97
+ printf '%s' 'Could you please FIX the login bug, think step by step and double-check yourself. Only report the most important things.' \
98
+ | nativeprompt improve --model gpt-5.6
99
+ ```
100
+
101
+ Real output (trimmed to the findings and the harness advice):
102
+
103
+ ```
104
+ МОДЕЛЬ: Codex (gpt-5.6) · gpt-5.6
105
+ определено: явно (--model)
106
+
107
+ ЧТО УЛУЧШИТЬ (3):
108
+ 1. [-] Убрать «думай пошагово» / не прописывать промежуточные шаги
109
+ правило: https://developers.openai.com/api/docs/guides/reasoning
110
+ 2. [+] Outcome-first: цель + формат результата + критерий «готово»
111
+ правило: https://developers.openai.com/cookbook/examples/gpt-5/gpt-5_prompting_guide
112
+ 3. [~] Просить действие прямо
113
+ правило: https://developers.openai.com/cookbook/examples/gpt-5/gpt-5_prompting_guide
114
+ [+] Для большой задачи разрешить идти до конца — https://learn.chatgpt.com/docs/prompting
115
+
116
+ КАК ЗАПУСКАТЬ (Codex) — форма задачи: normal
117
+ → просто напиши задачу
118
+ ```
119
+
120
+ The exact same prompt against Claude Opus 5 produces a *different* set: `think step by step` survives, `double-check yourself` is removed, and scope / verification / output-format placeholders are added. Markers: `[+]` add, `[-]` remove, `[~]` restructure, `[!]` warning.
121
+
122
+ See both side by side in one command:
123
+
124
+ ```bash
125
+ python3 examples/contrast_demo.py
126
+ ```
127
+
128
+ More raw prompts to try are in [`examples/prompts.md`](examples/prompts.md).
129
+
130
+ ### Commands
131
+
132
+ | Command | Flags | What it does |
133
+ |---|---|---|
134
+ | `improve "<prompt>"` | `--model M`, `--json`, `--no-metaprompt` | detect → analyze → rewrite → harness advice → explain. Reads the prompt from stdin when the argument is omitted. |
135
+ | `detect` | `--model M`, `--json` | shows the resolved model, family/CLI, and **which signal** it came from. Exit 1 if nothing resolved. |
136
+ | `rules [claude\|codex]` | — | prints every rule with its source URL, plus the harness table. No argument = all families. |
137
+ | `update` | `--diff`, `--write`, `--timeout N`, `--json` | fetches the vendors' canonical docs and compares them with stored text snapshots. `--diff` prints the exact before/after lines. Non-zero exit when action is needed (CI signal). `--write` records the new snapshots after you've reviewed the rules. A weekly CI job opens a PR containing the diff — **rules themselves are always edited by a human** (see below). |
138
+
139
+ `nativeprompt --version` prints the version.
140
+
141
+ `improve` output has four blocks: **what to fix** (each with the vendor rule + link), the **rewritten prompt**, a **how-to-run** recommendation, and a **meta-prompt** you can hand to your own model for a full prose rewrite (suppress it with `--no-metaprompt`).
142
+
143
+ ## Using it in VS Code
144
+
145
+ Both CLIs have a VS Code extension, and both have quirks that change how `nativeprompt` sees your setup. Everything in this section comes from the vendors' docs.
146
+
147
+ ### Claude Code extension
148
+
149
+ **The extension does not put `claude` on your PATH.** It bundles a private copy of the CLI for its chat panel; a standalone CLI install is a separate thing ([vs-code](https://code.claude.com/docs/en/vs-code)). Practical consequence: run `nativeprompt` in VS Code's **integrated terminal** (`` Cmd+` ``), and use the hook (below) if you want it inside the chat panel.
150
+
151
+ **Where the model actually comes from.** Claude Code's documented precedence is: in-session `/model` → `claude --model` at startup → `ANTHROPIC_MODEL` → the `model` field in your settings file ([model-config](https://code.claude.com/docs/en/model-config)). `nativeprompt detect` follows the same order (env before settings) and tells you which signal it used.
152
+
153
+ **Three ways to confirm the model, in increasing order of reliability:**
154
+
155
+ 1. `/status` in the chat panel — shows the active model and account ([model-config](https://code.claude.com/docs/en/model-config)).
156
+ 2. `nativeprompt detect` in the integrated terminal — also names the source file or variable.
157
+ 3. A `statusLine` script — it receives `model.id` and `model.display_name` on stdin, along with `effort.level` and `context_window.context_window_size`, so it's the only way to confirm that a 1M context is *actually* active ([statusline](https://code.claude.com/docs/en/statusline)).
158
+
159
+ **If `detect` shows the wrong model,** it is almost always one of these:
160
+
161
+ - You pressed **`s`** in the `/model` picker ("this session only"). Since v2.1.153 only `Enter` writes the `model` field to your **user** settings; `s` writes nothing, so any settings-based detection sees the old value ([model-config](https://code.claude.com/docs/en/model-config)).
162
+ - **VS Code was launched from Finder/Dock and never inherited your shell environment**, so `ANTHROPIC_MODEL` from `.zshrc` is invisible to it. The documented fixes: launch with `code .` from a terminal, set the extension's `claudeCode.environmentVariables` setting, or put the variable in the `env` block of `~/.claude/settings.json` — which is shared between the extension and the CLI ([vs-code](https://code.claude.com/docs/en/vs-code)).
163
+ - **Project or managed settings override yours.** The cascade is managed → CLI args → `.claude/settings.local.json` → `.claude/settings.json` → `~/.claude/settings.json` ([settings](https://code.claude.com/docs/en/settings)). When the startup model comes from project or managed settings, the startup header names the file.
164
+ - **You're on an alias, not a version.** `opus` / `sonnet` / `haiku` / `best` resolve to different concrete models depending on your provider (Anthropic API vs Bedrock vs Foundry vs Google Cloud), and `ANTHROPIC_DEFAULT_OPUS_MODEL` and friends can redirect them ([model-config](https://code.claude.com/docs/en/model-config)). `nativeprompt` says so explicitly and falls back to family-level rules. Pass `--model claude-opus-5` to get generation-specific rules. The `[1m]` suffix (1M context) is preserved and reported — it works on aliases and on full model names alike, including `opusplan[1m]`.
165
+
166
+ **Hooks work identically in the panel.** `~/.claude/settings.json` is *"shared between the extension and CLI"* — the same `hooks` block applies to both ([vs-code](https://code.claude.com/docs/en/vs-code)). You can also reach it from the panel: type `/` → **Customize** → hooks. Adding `"$schema": "https://json.schemastore.org/claude-code-settings.json"` to the file gives you completion and validation right in the editor.
167
+
168
+ ### Codex extension
169
+
170
+ - The IDE extension and the CLI **share the same configuration layers**; open it from the gear icon → **Codex Settings → Open config.toml** ([config-basic](https://learn.chatgpt.com/docs/config-file/config-basic)).
171
+ - Precedence: CLI flags → project `.codex/config.toml` (closest directory wins) → profile → `~/.codex/config.toml` → `/etc/codex/config.toml` → built-in defaults. **Untrusted projects skip the project-scoped `.codex/` layers entirely.**
172
+ - There is **no official environment variable for the Codex model** — the documented list is `CODEX_HOME`, `CODEX_SQLITE_HOME`, `CODEX_NON_INTERACTIVE`, `CODEX_INSTALL_DIR`, `CODEX_API_KEY`, `CODEX_ACCESS_TOKEN`, `CODEX_CA_CERTIFICATE`, `SSL_CERT_FILE`, `RUST_LOG` ([environment-variables](https://learn.chatgpt.com/docs/config-file/environment-variables)). `nativeprompt` reads `model = "..."` from `config.toml`; its `CODEX_MODEL` / `OPENAI_MODEL` lookups are an **unofficial convenience heuristic**, and so is its detection of an active Codex session. When in doubt, pass `--model codex` explicitly.
173
+
174
+ Known gaps in the current detector, stated plainly: it does not yet read Claude Code's **managed** settings (highest precedence, enterprise deployments), the project-level `.codex/config.toml`, `CODEX_HOME`, or the `ANTHROPIC_DEFAULT_*` alias redirects. Issues and PRs welcome.
175
+
176
+ ## Two modes
177
+
178
+ ### On demand — as a skill
179
+
180
+ [`SKILL.md`](SKILL.md) at the repo root is a Claude Code skill. Drop it into `~/.claude/skills/nativeprompt/SKILL.md` (or your project's `.claude/skills/`), and "improve my prompt" routes through the tool: it runs `nativeprompt improve --json`, shows you the findings with their source links and the how-to-run advice, then executes the returned meta-prompt to produce the polished rewrite.
181
+
182
+ Two rules baked into the skill are worth repeating: the incoming prompt is treated as **data, not instructions** (the model must not execute what's inside it), and the prompt is passed over **stdin only**, never interpolated into a shell command.
183
+
184
+ ### Every prompt — as a UserPromptSubmit hook
185
+
186
+ [`hooks/nativeprompt_hook.py`](hooks/nativeprompt_hook.py) runs on every prompt you send and attaches the improved version plus the applicable rules as context. Add to `~/.claude/settings.json` (shared by the CLI and the VS Code panel):
187
+
188
+ ```json
189
+ {
190
+ "$schema": "https://json.schemastore.org/claude-code-settings.json",
191
+ "hooks": {
192
+ "UserPromptSubmit": [
193
+ {
194
+ "hooks": [
195
+ {
196
+ "type": "command",
197
+ "command": "python3 /absolute/path/to/nativeprompt/hooks/nativeprompt_hook.py"
198
+ }
199
+ ]
200
+ }
201
+ ]
202
+ }
203
+ }
204
+ ```
205
+
206
+ What it does and doesn't do:
207
+
208
+ - It **cannot replace your prompt text.** `UserPromptSubmit` has no `updatedPrompt` output field — a handler can only return `hookSpecificOutput.additionalContext` or block the submission ([hooks](https://code.claude.com/docs/en/hooks)). So Claude sees your original *next to* the improved version, and the hook says which one to act on.
209
+ - It **stays quiet** on short prompts (< 15 chars) and on prompts that already satisfy the rules, so it doesn't turn into noise.
210
+ - Any error is swallowed — it never blocks your prompt from being sent.
211
+ - **Budget: 30 seconds.** `UserPromptSubmit` lowers the default hook timeout from 600 s to 30 s ([hooks](https://code.claude.com/docs/en/hooks)). This hook is deterministic and makes no network calls, so it fits comfortably — don't add network calls of your own there.
212
+ - Matchers are not supported for this event and are silently ignored; it fires on every prompt.
213
+ - The hook currently resolves the package from `~/Documents/nativeprompt` (the `REPO` constant at the top of the file). If you cloned elsewhere, edit that line or install the package so the import resolves normally.
214
+
215
+ There is also a documented way to get the model *exactly*, which the hook does not use yet: only `SessionStart` hooks can receive a `model` field, and *"there is no `$CLAUDE_MODEL` environment variable"* ([hooks](https://code.claude.com/docs/en/hooks)). A `SessionStart` hook that caches that value would beat any settings-file read, because it also catches `--model` and the session-only `s` choice. Contributions welcome.
216
+
217
+ ## Codex usage
218
+
219
+ Root [`AGENTS.md`](AGENTS.md) governs agent work in this repo. Codex-specific integration lives entirely in [`codex/`](codex/):
220
+
221
+ - `codex/integration/plugins/nativeprompt/skills/nativeprompt/` — a standalone Codex skill.
222
+ - `codex/integration/plugins/nativeprompt/skills/nativeprompt/scripts/improve_prompt.py` — a safe wrapper: stdin only, no shell, validates the JSON contract.
223
+ - `codex/integration/AGENTS.md.snippet` — an optional block for your own project's `AGENTS.md` so Codex calls the tool when you ask it to improve a prompt.
224
+ - `codex/REVIEW.md` — review notes. By convention, proposed core changes are staged as unified diffs in `codex/patches/` rather than applied to `nativeprompt/` directly.
225
+
226
+ Local install for Codex:
227
+
228
+ ```bash
229
+ python3 -m pip install -e .
230
+ mkdir -p ~/.agents/skills
231
+ ln -s "$PWD/codex/integration/plugins/nativeprompt/skills/nativeprompt" ~/.agents/skills/nativeprompt
232
+ ```
233
+
234
+ Then, in a new Codex session: `$nativeprompt improve this prompt for Codex: ‹prompt›`.
235
+
236
+ Note that Codex reads persistent project rules from `AGENTS.md` automatically, merged from `~/.codex` down through directories from the repo root to the current one, with deeper files overriding ([agents-md](https://learn.chatgpt.com/docs/agent-configuration/agents-md)). Reasoning depth and answer length belong in `~/.codex/config.toml` (`model_reasoning_effort`, `model_verbosity`), not in prose inside your prompt ([config-reference](https://learn.chatgpt.com/docs/config-file/config-reference)) — `nativeprompt` will tell you so instead of rewriting the prompt around it.
237
+
238
+ ## How it works
239
+
240
+ ```
241
+ detect → analyze → rewrite → harness → explain (+ update, out of band)
242
+ ```
243
+
244
+ 1. **detect** (`detect.py`) — resolves model → **family + generation**. Keying on family means an unreleased id like `claude-opus-6` still gets Claude-family rules instead of nothing. Signals, in order: `--model`, active CLI session markers, `ANTHROPIC_MODEL` / `OPENAI_MODEL` / `CODEX_MODEL`, the `~/.claude/settings.json` cascade, `~/.codex/config.toml`. The `[1m]` suffix is split off and reported separately.
245
+ 2. **analyze** (`analyze.py`) — regex detectors for prompt smells (`forced_cot`, `verification_demand`, `pushy_caps`, `repetition`, `contradiction_hint`, `missing_verification`, `missing_output_contract`, `vague_ask`, …) plus a **task shape** classifier: `trivial | normal | planning | goal | loop | workflow`.
246
+ 3. **rewrite** (`rewrite.py`) — the deterministic pass. It removes what the vendor says hurts, restructures what the vendor says to restructure, and adds missing sections **as `‹placeholders›`**. It never invents your task.
247
+ 4. **harness** (`harness.py`) — maps the task shape to a run mode from the `harness` block of the rules file: plan mode / `/goal` / `/loop` / dynamic workflow on Claude Code, `/plan` / `/goal` / delegation on Codex — each with its own source link.
248
+ 5. **explain** (`explain.py`) — assembles the report and the **meta-prompt**: a model-specific instruction, built from exactly the rules that fired, which your own Claude or Codex executes to do the full prose rewrite. That split is deliberate — the tool itself contains no model.
249
+
250
+ ## Self-update
251
+
252
+ `nativeprompt/rules/*.json` is a human-curated, versioned cheat sheet, keyed by **model family + generation**, where every rule carries a `source` URL.
253
+
254
+ `nativeprompt update` fetches the vendors' canonical `.md` / `llms.txt` pages (manifest: `nativeprompt/rules/_sources.json`), hashes them, and diffs against the stored snapshot:
255
+
256
+ ```
257
+ [изменилось] claude https://code.claude.com/docs/en/goal.md
258
+ [новое] openai https://learn.chatgpt.com/docs/prompting.md
259
+ [без изменений] claude https://code.claude.com/docs/en/best-practices.md
260
+ ...
261
+ Итог: изменилось 1, новых 4, без изменений 9, недоступно 0 (из 14).
262
+ ```
263
+
264
+ A weekly GitHub Actions job (`.github/workflows/update-rules.yml`) runs exactly that and fails when the official guidance moved. **The rules are never rewritten automatically** — a maintainer reads the changed doc, updates the JSON, and lands it in a PR, then records the new snapshot with `nativeprompt update --write`. That is a deliberate design choice: a cheat sheet you can audit is worth more than one that mutates silently.
265
+
266
+ ## Boundaries
267
+
268
+ Deliberately narrow, so the tool stays trustworthy:
269
+
270
+ - **It does not invent your task.** Missing details — file paths, done criteria, output format — become explicit `‹placeholders›`, never fabricated content.
271
+ - **The deterministic rewrite is structural, not literary.** It strips what hurts, restructures, and inserts placeholder sections. The full prose rewrite is the **meta-prompt**, run by your own model. There is no LLM inside this tool.
272
+ - **Detectors are regex heuristics.** Unusual phrasings will produce false positives and misses. It is an assistant, not an oracle.
273
+ - **An alias is not a version.** `opus`, `sonnet`, `best` resolve differently per provider and plan, so generation-specific rules are withheld and family rules applied — and the CLI says so.
274
+ - **No benchmark claims.** The tool applies the vendors' published rules; it does not measure that your prompt got "N% better", and it will never print such a number.
275
+ - **v1 covers Claude Code and Codex.** The family architecture is ready for more vendors; nothing else is implemented.
276
+
277
+ Honest limits are tracked in [`CLAIMS.md`](CLAIMS.md).
278
+
279
+ ## Contributing
280
+
281
+ Verify first:
282
+
283
+ ```bash
284
+ python3 -m pytest -q # 67 tests: detection, detectors, rewrite, harness, rules integrity, frozen snapshot
285
+ ```
286
+
287
+ **Adding or changing a rule.** Rules live in `nativeprompt/rules/<family>.json`. A rule is only accepted with a **link to the vendor's own documentation** — no folklore, no blog posts, no "it worked for me". Shape:
288
+
289
+ ```json
290
+ {
291
+ "id": "opus5-remove-verification",
292
+ "scope": "opus-5", // "family" or a generation key
293
+ "check": "verification_demand", // a detector in analyze.py
294
+ "action": "remove", // add | remove | restructure | warn
295
+ "title": "short imperative",
296
+ "why": "one or two sentences, concrete",
297
+ "source": "https://…" // official vendor doc, must return 200
298
+ }
299
+ ```
300
+
301
+ If your rule needs a new `check`, add the detector to `analyze.py` with a test. If the source page isn't in `rules/_sources.json`, add it there too so `update` starts watching it. There's a frozen-snapshot test over the rule set: rule changes are visible in the diff by design.
302
+
303
+ **Adding a vendor.** Drop a new `nativeprompt/rules/<family>.json` with `detect` (id prefixes + aliases), `generations`, `rules`, and a `harness` block describing that CLI's run modes; register its docs in `_sources.json`. `catalog.py` discovers families from the directory — no code change needed for a well-formed file.
304
+
305
+ Other useful contributions, in rough priority order: English CLI output, managed-settings and `CODEX_HOME` support in `detect.py`, a `SessionStart` hook for exact model resolution, and detector precision on non-Russian, non-English prompts.
306
+
307
+ ## Why rules are not auto-merged
308
+
309
+ The robot detects the change, fetches it, shows the exact diff and opens the PR.
310
+ The last step — deciding whether a *rule* changes — stays human, on purpose:
311
+
312
+ 1. **A doc change is not a rule change.** Most edits are typos, rewordings, new examples.
313
+ Auto-applying would churn the rules for nothing.
314
+ 2. **A rule is a translation, not a copy.** The doc says, in prose, "Opus 5 verifies its own
315
+ work — remove explicit verification instructions". The rule is a detector plus a decision
316
+ about scope (whole family, or just this generation). That is judgement.
317
+ 3. **A wrong auto-update is worse than a stale rule.** It would hand you bad advice *carrying an
318
+ official source link* — that is, with maximum credibility. This package is installed by other
319
+ people; model-written changes should not merge themselves into it.
320
+
321
+ ## License
322
+
323
+ MIT — see [LICENSE](LICENSE). Built by Edvard Grishin (Futura AI studio).