Skip to main content

arcaeon-dedup

Strip near-duplicate text from an agent's context before it costs you tokens. Pure stdlib. No LLM, no embeddings, no network. Cheap enough to run on every call.

pip install arcaeon-dedup

Why

Retrieved chunks, tool outputs, conversation history, and memory stores fill up with near-duplicates — the same passage phrased three ways, the same doc pulled twice, boilerplate repeated across results. Every redundant copy is pure token waste, and you pay for it on every call that carries it.

Most "dedup" tooling is built for training corpora, or needs embeddings + a vector DB to run. For agent context you want something that costs essentially nothing, so you can put it in front of every context assembly without thinking about it.

arcaeon-dedup uses SimHash — a locality-sensitive hash, so almost the same collapses, not just byte-identical — over pure Python. No model call, no API, no dependencies.

Use

from arcaeon_dedup import dedupe

chunks = [
    "The API returned status 200 and the user was created successfully.",
    "Status 200 was returned by the API; the user was created successfully.",  # near-dup
    "The database connection timed out after 30 seconds.",
]

kept, report = dedupe(chunks)
# kept   -> 2 items (the near-duplicate dropped, order preserved)
# report -> deduped: kept 2, removed 1 near-duplicate(s); ~62 chars / ~15 tokens saved

Tuning:

dedupe(chunks, max_hamming=12, k=1, keep="first")
  • max_hamming (default 12, of 64 bits): how close counts as "duplicate." Defaults are calibrated so reordered/lightly-reworded paraphrases (~10-12 bits apart) collapse while genuinely different text (~30+ bits apart) is left alone — a wide, safe margin. Lower = stricter.
  • k (default 1): shingle size. k=1 is order-insensitive (a bag-of-words fingerprint — good for paraphrase); k=2-3 weights word order (only closer-to- verbatim dupes).
  • keep: "first" keeps the earliest of each cluster (best for chronological context — the original stays); "longest" keeps the fullest phrasing.

Also exported: simhash(text), hamming(a, b) if you want the primitives directly.

What it is / isn't

Is: a fast, dependency-free near-duplicate filter for the text you're about to put in a context window — retrieval results, tool outputs, message history, memories.

Isn't: a semantic clusterer or a summarizer. It removes redundant copies, not related-but-distinct content, and it won't rewrite anything. For paraphrase far from the original, raise max_hamming (accepting more false-positives) or reach for an embedding-based tool — this one is deliberately the cheap, safe, zero-dep first pass.

MIT. Built by Arcaeon — the evidence layer for AI.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

arcaeon_dedup-0.1.0.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

arcaeon_dedup-0.1.0-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file arcaeon_dedup-0.1.0.tar.gz.

File metadata

  • Download URL: arcaeon_dedup-0.1.0.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.3

File hashes

Hashes for arcaeon_dedup-0.1.0.tar.gz
Algorithm Hash digest
SHA256 29fcaa6b22a902812ea31541aecd393156e678cc74db2bd2278e02d8b360e1da
MD5 77c361860221588db413701a0bf89c4f
BLAKE2b-256 49e14227a2417c28ad1fce87837128fb0f85df61cd1fee1811f6c4c5aba6cdfa

See more details on using hashes here.

File details

Details for the file arcaeon_dedup-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: arcaeon_dedup-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.3

File hashes

Hashes for arcaeon_dedup-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c2733ea4ae0a683824e2c32f7e1c784597e01dc5eb5bd749f2015ec843676442
MD5 e4d06ab21a5f95d4918b665094c03bf1
BLAKE2b-256 19993e06c1fc4c51083a7e10c4b66d3fe1c9370c6f06b86825a011ddb4a98dc6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page