Skip to main content

AI Change Impact

Find recorded RAG questions that retrieved a changed passage, then replay those questions against your updated pipeline. AI Change Impact stores provenance locally in SQLite and has no runtime dependencies.

Status: alpha prototype. Its API may change. It reports known line-level dependencies, not every potentially affected answer.

How it works

RAG application                       Document update
  |                                      |
  | record question, source,             | before and after text
  | document hash and line span          |
  v                                      v
Local SQLite observations ----------> line diff + span matching
                                             |
                                             v
                               affected observations + stale versions
                                             |
                               optional caller-provided replay

Your application supplies the source text, a stable source identifier, and the line range it retrieved. The package hashes the source text and records the observation. During comparison, it computes a line diff and finds observations whose recorded spans overlap changed lines. It reports records for a different document version separately. Insertions are matched against adjacent old lines.

Replay is opt-in and calls your function once per affected observation. It compares returned strings with stored answers; it does not evaluate factual correctness or automatically update an index.

Installation

Requires Python 3.10 or newer. Install from PyPI:

python -m pip install ai-change-impact-prototype

Alternatively, install from the source checkout:

git clone https://github.com/Shubham-786/ai-change-impact.git
cd ai-change-impact
python -m pip install .

To build a local wheel, run python -m pip install build and then python -m build.

Record and replay from Python

No external service is required for recording or comparison.

from change_impact import ImpactStore, replay

before = "# Refund policy\nRefunds within 30 days.\n"
after = "# Refund policy\nRefunds within 14 days.\n"

with ImpactStore("impact.sqlite3") as store:
    store.record(source="refund-policy", document=before, question="Refund period?",
                 start_line=2, end_line=2, answer="30 days")
    report = store.compare(source="refund-policy", before=before, after=after)

    # Your callable must use the candidate index or document version.
    results = replay(report, lambda question: "14 days")
    print(results[0]["changed"])  # True

replay calls the supplied function for each affected observation; it does not update your index, run an evaluator, or verify correctness. Your function can make network calls, incur costs, or have side effects. Repeated observations are replayed separately. Version mismatches appear in the report and require review. The database stores questions, answers, and metadata in plaintext; handle access, retention, and deletion yourself.

Command-line example

From the repository directory, compare the included example documents:

impact-prototype examples/before.md examples/after.md examples/records.json --source policy

The JSON report includes changed lines, affected questions, and records whose document hash does not match the provided old version. The example identifies the refund-period question as affected by the change from 30 to 14 days.

Direct comparison without SQLite

Record the exact source identifier, document_hash(text), question, and 1-based inclusive line range for each retrieved passage. Hash the exact Unicode text passed to analyze.

from impact_prototype import analyze, document_hash

before = "Refunds within 30 days.\n"
records = [{"source": "policy", "question": "Refund period?", "start_line": 1,
            "end_line": 1, "document_hash": document_hash(before)}]
report = analyze(before, "Refunds within 14 days.\n", records, source="policy")

Scope and validation

This only identifies recorded retrievals overlapping line-level edits; insertions conservatively touch neighboring lines. It cannot identify indirect dependencies, newly relevant documents, changes in retrieval behavior, or semantic effects. Missing or stale provenance must not be treated as unaffected. Replay requires a user-supplied function; the package does not test answer correctness, parse PDFs, or connect to tracing systems. Run full evaluation suites as well. Source text and questions remain local unless the supplied function sends them elsewhere; reports can contain sensitive content.

Line numbers are 1-based and inclusive in the exact source text your application recorded. Document identity uses the SHA-256 hash of its UTF-8 text, so a version mismatch requires separate review. Diffing uses Python's splitlines(): changes that affect only line endings or the final newline do not produce changed line spans even though the document hashes differ. The matching algorithm can flag unchanged material around insertions and may align repeated lines in unexpected ways. An empty affected list is not a guarantee that no answer is impacted.

Data and security

The SQLite database contains source identifiers, questions, optional answers, line ranges, document hashes, and metadata in plaintext. It does not store the full source document, but reports include the changed text. Protect database files and reports using your environment's access controls and retention procedures. The SDK does not send telemetry or make network requests; your replay function may do both. See SECURITY.md for reporting vulnerabilities.

The store uses SQLite's default thread behavior: use a separate ImpactStore instance per thread. Database schema migrations, multi-process coordination beyond SQLite's own behavior, and compatibility guarantees across alpha versions are not yet provided.

Next validate with real users: compare the effort needed to find affected cases in Phoenix, Langfuse, and DeepEval against this approach on the same document changes. Measure setup time, relevant cases found and missed, and developer time saved. No user interviews or competitor hands-on benchmark have yet been conducted.

Development

Run the test suite with python -m unittest discover -s tests -v. Build distributions with python -m pip install build followed by python -m build. Contributions should include a focused test for behavior changes and avoid collecting user data or sending it over the network without explicit configuration.

License

MIT. See LICENSE.

Metadata

Release files for ai-change-impact-prototype 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ai-change-impact-prototype 0.1.0
File Size Uploaded Provenance Actions
ai_change_impact_prototype-0.1.0.tar.gz 7.2 kB Without provenance Details for ai_change_impact_prototype-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ai-change-impact-prototype 0.1.0
File Interpreter ABI Platform Actions
ai_change_impact_prototype-0.1.0-py3-none-any.whl Python 3 none any Details for ai_change_impact_prototype-0.1.0-py3-none-any.whl

Total release size: 15.5 kB

Release files / ai_change_impact_prototype-0.1.0.tar.gz

Download URL ai_change_impact_prototype-0.1.0.tar.gz
Size 7.2 kB
Tags Source
SHA-256 checksum
How to use checksums
47c82ae4dbd1a5d15fce382a4f681a3d28ff49de329f17e49d1e0533c1ca4b9d
BLAKE2b-256 checksum
How to use checksums
edfb7c5bdd6f02da5758856b4fcc1982cc7b9f86fa497a110537358c2fb1afd7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.6

Release files / ai_change_impact_prototype-0.1.0-py3-none-any.whl

Download URL ai_change_impact_prototype-0.1.0-py3-none-any.whl
Size 8.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
617b76a5549850c1cd65b3710deea24977f040962a9cd14683ccea95ffe32787
BLAKE2b-256 checksum
How to use checksums
8d4723cbac72230e1febe063e3d8c288ee01d2547f104a3a494a4d6d8cfa31a6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.6

Security for ai-change-impact-prototype 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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page