Skip to main content
Glama
origin-count

origin-count

by jacob-adm

origin-count

Release Python Licence

An agent that researches a claim often finds one wire report republished on several sites and counts each copy as another confirmation. origin-count takes the text or HTML of the pages the agent has fetched and reports how many separate sources they come from. Republished copies of one report count once, and every match is listed with the evidence for it.

It is made to be called by a coding agent or a script. It does not search and it does not fetch, so a scan runs offline on what it is given. The same scan is a command with text output, one JSON object with --json, and an MCP tool with origin-count mcp.

Pages from the open web may have been written to mislead the agent that reads them. No wording from a page is in the result, so an instruction hidden in a page cannot reach the agent through this tool. Characters and elements that do not show are removed before anything is compared, and every input has a size limit. See Limitations and security.

It counts sources. It does not judge whether a report is true, and it does not detect a copy that was rewritten. See Other tools for where it fits.

Example output

Five made-up articles (the data the tests use; no outlet, person or place in them exists): a wire report, two copies of it, another outlet's own report of the same event, and an unrelated story.

Two of them with --json (first lines of the result):

As text:

1	0,1,2	AP	shared-text,same-wire
2	3	-	-
3	4	-	-

Each line is origin TAB documents TAB wire TAB evidence. Documents are named by their position in the input, starting at 0, and a field with nothing to say is -. With --json the same scan is one origin-scan/1 object; Commands shows it in full.

Related MCP server: genpark-agent-context-dynamic-compressor-skill

Requirements

  • Python 3.9 or later, standard library only.

  • No network access and no key.

Install

From GitHub:

pip install git+https://github.com/jacob-adm/origin-count

From a clone:

git clone https://github.com/jacob-adm/origin-count
cd origin-count
pip install .

Either way pip installs origin-count as a console script. Check the install:

origin-count --version
origin-count 0.1.1

Without installing, it also runs from a clone as python3 -m origin_count.

How it works

  1. Read each document. From HTML it takes the paragraphs, the canonical link and the structured data, and leaves out navigation, forms, scripts and elements a browser would not show. Text is taken as given.

  2. Normalize. Text is put in Unicode compatibility form and case-folded, and characters that do not show are removed and counted.

  3. Compare. The body becomes a set of hashes of eight-word runs. Two documents share text when half or more of the shorter one's runs are in the other.

  4. Join on evidence. Documents become one origin on any of four kinds of evidence, and every join is listed.

    Evidence

    Meaning

    shared-text

    Half or more of the shorter document's text is in the other.

    same-wire

    Both pages name the same wire service in a dateline or in their structured data.

    canonical

    One page names the other's site as its canonical address.

    same-site

    Both documents come from one site.

  5. Read the result. The command exits 0 when every document stands alone, 1 when documents share an origin and 2 on an error. With --json the object is printed in all three cases.

Commands

origin-count [--json] [--overlap SHARE] FILE...          count the origins among files, one document each
origin-count [--json] [--overlap SHARE] --bundle FILE    the same for a JSON bundle of documents (- for standard input)
origin-count mcp                                         serve the same scan as an MCP tool over stdio

See Commands for the arguments, both outputs, the result format, the MCP tool and the exit status.

Quick start

Saved pages, one file each:

origin-count a.html b.html c.txt

Pages saved by other programs can be read as they are: the HTML snapshots a reference manager such as Zotero keeps, with their images embedded, and the Markdown notes a web clipper such as Obsidian Web Clipper writes.

Documents an agent holds, as one object on standard input:

origin-count --json --bundle - < documents.json

As an MCP server, in the configuration of an agent that starts servers over stdio:

{"mcpServers": {"origin-count": {"command": "origin-count", "args": ["mcp"]}}}

Documentation

License

Apache License 2.0; see LICENSE.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      B
      maintenance
      Russian-text AI-trace detection and typography normalization over stdio MCP: finds chatbot copy-paste artifacts and invisible marks, counts soft AI-style signals; four tools, stdlib-only, no keys required.
      12
      7
      164
      MIT
    • F
      license
      Not graded
      quality
      B
      maintenance
      Enables AI agents and MCP-compliant clients to dynamically shrink long-horizon context windows, pruning verbose tool outputs, HTML boilerplate, and semantic redundancy by roughly 40-70% without frontier LLM round-trips. Runs deterministically as a zero-dependency Python stdio server, accepting a payload plus optional compression and risk-bound options.
      7
      -
    • A
      license
      A
      quality
      B
      maintenance
      Enables agents to submit request/response header literals over stdio and receive deterministic, specification-derived verdicts on CORS, RFC 9111 cache freshness, RFC 9110 conditional requests, and Vary matching, complete with rule IDs and clause references. Runs entirely offline with no third-party runtime dependencies, returning byte-identical output for identical input.
      5
      MIT