subedit
Your house style, enforced in the places prose hides inside a codebase.
A subeditor is the person at a publication who makes every piece of copy match its house style. subedit does that job for the prose in your code.
Linters check your code. Almost nothing checks the sentences you write around it. subedit reads the comments and docstrings in your source, lays them out one sentence per line, and only tells you about the sentences a tool cannot fix for you.
Example
An editor wraps a comment at whatever column it reaches, so sentences break mid clause.
# Cap the buffer at the runner limit, because an unbounded
# read faults the job. Retry once, then give up.
subedit fix --write repairs the layout and says nothing.
# Cap the buffer at the runner limit, because an unbounded read faults the job.
# Retry once, then give up.
A sentence that runs past the width with no comma has nowhere legal to break, and only its author knows where the meaning divides. That one comes back to you, or to the agent that wrote it.
1 comment finding needs rewriting in src/cache.py.
Each states the fix. Apply it in place, do not add a suppression comment.
line 2 [unbreakable-sentence]
This sentence runs to 116 characters against a budget of 114 characters and contains no comma, so there is no legal place to break it. Add a comma at a clause boundary, or split it into two sentences.
Installation
Install the command line tool from PyPI.
uv tool install subedit
pipx install subedit and pip install subedit work as well.
Commands
Every command takes files or directories.
| Command | Result |
|---|---|
subedit check src/ |
every finding |
subedit check src/ --output=actionable |
only the sentences that need rewriting |
subedit fix src/ |
the repairs, as a diff |
subedit fix src/ --write |
the repairs, applied |
subedit stats src/ |
comment shapes across the codebase, for setting thresholds from data |
subedit rules |
every rule and who resolves it |
check and fix exit 1 while anything needs an author, so they drop into pre-commit or CI as they are.
Fix Kinds
Every finding says who can resolve it, and the whole design turns on that answer.
| Kind | Resolved by | Reaches you |
|---|---|---|
TARGETED |
the tool, silently | no |
REFLOW |
the tool, silently | no |
REWRITE |
only the author | yes |
Rewriting a sentence needs its meaning, which a deterministic process cannot supply. Everything else is repaired without a word, because each message costs the reader attention.
Agent Hook
subedit-hook runs after every file an agent edits. It repairs the mechanical findings in place, and exits 2 only when a sentence needs rewriting, which hands the message back to the model.
Claude Code
The plugin registers the hook. It cannot install the tool, so install that first.
/plugin marketplace add mroops0111/subedit
/plugin install subedit@mroops
To register it by hand instead, add this to .claude/settings.json.
{
"hooks": {
"PostToolUse": [
{
"matcher": "Edit|Write|MultiEdit|NotebookEdit",
"hooks": [{ "type": "command", "command": "subedit-hook" }]
}
]
}
}
Codex
Add this to ~/.codex/hooks.json.
{
"hooks": {
"PostToolUse": [{ "command": "subedit-hook" }]
}
}
Several Agents
Registering the hook with both agents is the normal case. Each agent names its edit tools differently, so every payload identifies its sender, and a payload from anything else exits 0 untouched. subedit-hook --help prints the payload shapes it accepts.
Configuration
Settings come from subedit.toml, or from [tool.subedit] in pyproject.toml, whichever sits closest above the file being checked.
[subedit]
line-width = 120
exclude = ["tests/fixtures/**"]
[rules]
mid-clause-break = "error"
block-too-long = { severity = "warning", line = 3, doc-public = 20 }
Rule names describe the problem they report. docs/rules.md lists every rule, generated from the rules themselves.
Delegated Tools
subedit check also runs two tools where they are installed, and folds their findings into its own report.
- Vale: punctuation, banned phrasing, and anything a markup aware prose linter already handles
- AutoCorrect: spacing and punctuation width between CJK and Latin text
--no-delegate skips both. fix and the agent hook do not run them.
Surfaces
Code comments are the first surface, and Markdown comes next.
| Surface | Status | Mostly enforces |
|---|---|---|
| Code comments and docstrings | working | layout, since comments sit inside a column limit |
| Markdown | planned | structure, since soft wrapped text barely needs layout |
| Markdown slides | planned | Markdown, with front matter left as it is |
Related Tools
subedit covers the one thing the usual Python tools leave alone.
| Tool | Checks |
|---|---|
| ruff | code structure |
| basedpyright | types |
| subedit | the natural language inside source |
License
MIT
Metadata
Release files for subedit 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| subedit-0.1.0.tar.gz | 81.3 kB | With provenance | Details for subedit-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| subedit-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for subedit-0.1.0-py3-none-any.whl |
Total release size: 126.8 kB
Release files / subedit-0.1.0.tar.gz
| Download URL | subedit-0.1.0.tar.gz |
|---|---|
| Size | 81.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
440bf4cf7640b04e1ff75b2481bb990b177f46aaa1aa227b58da05226fb8cad1
|
|
BLAKE2b-256 checksum How to use checksums |
7d58f76c7b45050b782ae359d9a57c1b97181d87b5a2b638bbf77c2eb5d2b80f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 12, 2026.
Transparency logRelease files / subedit-0.1.0-py3-none-any.whl
| Download URL | subedit-0.1.0-py3-none-any.whl |
|---|---|
| Size | 45.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
54636fe3c2d2a30de1f4d02a80c861f06d6983f87d7f19a867b868dcb754d121
|
|
BLAKE2b-256 checksum How to use checksums |
f3187fbcc35709aed8b3ee42b7f111e3122736dafd486b79f26fb94550dea59f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 12, 2026.
Transparency logSecurity for subedit 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for subedit-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 12, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.