Skip to main content Switch to mobile version tellstrip 0.1.0 Find and remove AI-generated artifacts from Python code. Offline, stdlib only.
pip install tellstrip==0.1.0 Copy PIP instructions
tellstrip finds the stuff AI assistants leave behind in Python code and removes what it safely can. That means comments that narrate the next line (# Loop through the items), chat residue (# Updated as requested), emoji, # Example usage: blocks, and the hedging that comes from models being trained to never crash: except Exception: return None, guessing at customer_id / customerId, code that checks whether pytest is running.
It's a static tool. No AI APIs, no network, no dependencies outside the standard library. Checking a typical change takes under a second. The first run in a big repo takes longer, because the duplicate check fingerprints every function once (about 7 s for CPython's 2,000-file standard library, cached after that). A full scan of 300,000 lines of the standard library takes about 20 s.
The goal is code that's cheaper to read and maintain, not code that "passes" as human. tellstrip won't fake quirks or reshuffle whitespace. docs/research.md explains where each tell comes from and why the rules look the way they do.
Python 3.11 or newer.
pip install tellstrip # or the latest from GitHub: pip install "tellstrip @ git+https://github.com/jam2342/tellstrip@main" Use it
tellstrip # check the lines you've changed (staged, unstaged, untracked) tellstrip --dry-run # same, plus a diff of what --fix would do tellstrip --fix # apply the safe fixes in place tellstrip --staged # check the lines about to be committed, as staged tellstrip --since origin/main # check the lines this branch changed tellstrip src/ scripts/x.py # check whole files tellstrip --all # the whole project The git modes only judge lines you added or changed. If you fix a typo in a five-year-old file, you hear about your typo, not about the file's history. Add --whole-file to see everything in the files you touched. Untracked files count as entirely new.
Output looks like this:
orders.py:31:5: TS102 narration-comment comment repeats the line below it [fixable] orders.py:42:12: TS303 guessing-fallback tries several keys ('customer_id', 'customerId') for one value; pick the real one orders.py:54:9: TS301 swallowed-exception except Exception swallows the error, so callers can't tell failure from an empty result Other formats: --format markdown (PR comments), --format github (inline annotations in Actions), --format json.
Exit codes: 1 when there are fixable issues or errors (TS304) left, 0 otherwise. Warnings alone don't fail unless you pass --strict. --exit-zero always returns 0, and 2 means tellstrip itself hit a problem (bad config, unreadable file, a fix it refused to apply).
Run tellstrip --list-rules for the full list.
Opt-in rules fire about as often on human code as on AI code, by the benchmark. They can still be worth running as house style; turn them on with extend-select.
What it leaves alone
Comments that explain why (because, so that, otherwise, workaround, a ticket or URL), linter directives (noqa, type: ignore, pragma, fmt: off), license and authorship headers, TODOs that say something specific, comments that document a constant or attribute, and commented-out code (that's ruff's ERA001). A __main__ block that reads sys.argv or calls main() is a real entry point and isn't touched.
Every fix is checked before it's written. tellstrip re-parses the result and compares its AST with the original. Removing comments must leave the AST identical; removing an example block must remove exactly those statements and nothing else. If either check fails, the file isn't written and you get an error. Example blocks are only removed when nothing above them uses a name they define. Encoding, BOM and line endings are preserved.
Run it before every commit
With pre-commit, add this to .pre-commit-config.yaml:
repos: - repo: https://github.com/jam2342/tellstrip rev: v0.1.0 hooks: - id: tellstrip # blocks the commit on fixable issues in staged lines # - id: tellstrip-fix # or: fix them automatically # - id: tellstrip-files # whole files, for `pre-commit run --all-files` Without the framework, use the plain git hook:
cp hooks/pre-commit .git/hooks/pre-commit chmod +x .git/hooks/pre-commit It checks the staged version of each file (not your working copy) and blocks the commit when there's something fixable. To clear it, run tellstrip --staged --fix, then git add and commit again. tellstrip --staged --fix won't touch a file that also has unstaged edits, so it can't mix them into the commit. git commit --no-verify skips the hook once.
Run it on pull requests
tellstrip ships as a GitHub Action. It checks the lines each PR changes, adds inline annotations, writes a job summary, and keeps a single comment on the PR up to date with counts by rule, findings per file and the diff --fix would apply. It never pushes changes.
name: tellstrip on: pull_request permissions: contents: read pull-requests: write jobs: tellstrip: runs-on: ubuntu-latest steps: - uses: actions/checkout@v7 with: fetch-depth: 0 - uses: jam2342/tellstrip@v0.1.0 with: fail-on: none # or "fixable", or "any" # args: --ignore TS202 Inputs: since (defaults to the PR's base branch), args (extra tellstrip flags), comment (true), fail-on (none), python-version (3.12). Outputs: findings and fixable counts.
GitHub shows at most 10 inline annotations of each kind per step, so tellstrip uses all three kinds: errors for TS304, warnings for anything --fix can fix, notices for judgement calls. If there are still more, a note says how many were left out, and the comment lists everything. PRs from forks get a read-only token, so there's no comment on those; the annotations and summary still show up.
In pyproject.toml (or a .tellstrip.toml without the [tool.tellstrip] header):
[tool.tellstrip] exclude = ["migrations/", "vendor/", "*_generated.py"] # dirs end with "/" ignore = ["TS202"] # skip rules (prefixes work: "TS2") extend-select = ["TS401", "TS502"] # turn on opt-in rules select = ["TS1"] # or run only these generic-names = ["payload", "blob"] # more names for TS401 allowed-names = ["data"] # names TS401 should accept strip-main = false # let --fix remove demo __main__ blocks narration-threshold = 0.6 # how much of a comment the code must already say max-file-lines = 1000 # TS503 limit .venv/, node_modules/, build/, dist/, __pycache__/, *.egg-info/ and protobuf output are always excluded. Excluded paths stay excluded even when you pass them by name.
To silence one line, add # tellstrip: ignore (every rule) or # tellstrip: ignore[TS401,TS301] to it.
Python only for now. JS/TS would need a real parser (tree-sitter) to tell comments from regex and template literals, so it's not a regex hack away.
The rules are heuristics, and tellstrip is a linter, not an AI detector. bench/ measures each rule two ways. On raw model output (competitive-programming datasets) the gap is huge: narration comments are about 800x more common in AI code. On real merged commits it's much smaller, because people review and clean up what the model wrote. Across 2,800 commits, the default rules fire about twice as often on AI-labelled commits as on human commits from before AI assistants, and swallowed exceptions (TS301) about four times as often. Those numbers are also why six rules are opt-in.
TS501/TS502 count names across the whole repo by plain word matching. That overcounts, so they miss some cases rather than flag code that's used elsewhere.
TS306 reads [project].dependencies, Poetry's dependencies and requirements.txt at the project root. Optional extras and requirements with an environment marker don't count, and neither does from pkg import name, since names move between versions.
TS307 trusts annotations it can see: builtins and classes in the same file. A type alias imported from elsewhere might include None, so it's skipped. assert isinstance(...) and if not isinstance(...): raise TypeError are deliberate (type narrowing, input validation), so they're left alone too.
TS503 needs a git scope (--staged, --changed, --since), because "this change makes the file longer" means nothing for a plain path.
TS701 only catches copies that match once locals are renamed and the docstring and annotations are dropped. A copy with one extra line, or a different constant, slips through. Functions under 4 statements or 5 lines don't count, and neither do test files, which repeat setup on purpose. It only reports new or edited functions, but checking them means fingerprinting the repo. The fingerprints are cached in .tellstrip_cache/, which ignores itself in git. On CPython's standard library (1,836 files) a full TS701 scan takes about 19 s cold and 13 s warm, and finds 48 copies, all real.
python -m venv .venv && .venv/bin/pip install -e ".[dev]" .venv/bin/pytest .venv/bin/tellstrip tellstrip/ # it should pass on its own code To release: bump __version__ in tellstrip/__init__.py, tag vX.Y.Z, and publish a GitHub release for the tag. release.yml checks the tag matches the version, builds, and uploads to PyPI with trusted publishing.
Released: Dec 5, 2026
Both files in this release have provenance metadata.
View provenance details
MIT View SPDX License List
Programming Language Python :: 3
Topic Software Development :: Quality Assurance
Release files for tellstrip 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
Built distribution (wheel)
Total release size: 116.9 kB
Release files / tellstrip-0.1.0.tar.gz
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 Dec 5, 2026.
Release files / tellstrip-0.1.0-py3-none-any.whl
Security for tellstrip 0.1.0
Both files in this release have been uploaded with provenance metadata.
With provenance tellstrip-0.1.0.tar.gz Dec 5, 2026
With provenance tellstrip-0.1.0-py3-none-any.whl Dec 5, 2026
Attestation for tellstrip-0.1.0.tar.gz
Attestation for tellstrip-0.1.0-py3-none-any.whl
A 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.
Release history Release notifications | RSS feed
Dec 5, 2026 2 release files Full provenance
"PyPI", "Python Package Index", and the blocks logos are registered trademarks of the Python Software Foundation.
© 2026 Python Software Foundation
Deployed from 4d99e05











