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

flowchart LR
    A["RAG application"] -->|"Record source, hash and retrieved lines"| B["Local SQLite"]
    C["Before and after documents"] --> D["Line diff"]
    B --> E["Match versions and spans"]
    D --> E
    E --> F["Affected observations"]
    E --> G["Version mismatches"]
    F -.-> H["Optional replay through your pipeline"]

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.

Visualize an impact report

Version 0.2.0 and newer can render an analysis as a Mermaid flowchart:

from change_impact import render_flow

print(render_flow(report))  # report is returned by ImpactStore.compare()

Or generate the Mermaid source from the example files:

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

Paste the output into a Mermaid code block in GitHub Markdown or another compatible viewer. The diagram shows change, affected-observation, and version-mismatch counts; it does not include source text or questions. The optional replay node describes an available next step and does not mean replay was performed. Use the JSON report to inspect the evidence.

For a self-contained local HTML report with clickable sections and the actual changed passages and questions:

impact-prototype examples/before.md examples/after.md examples/records.json --source policy --format html > impact-report.html

Open impact-report.html in a browser. No server or network connection is needed. The report contains potentially sensitive source excerpts and questions; store and share it accordingly. Python callers can use render_html(report) from change_impact.

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.2.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.2.0
File Size Uploaded Provenance Actions
ai_change_impact_prototype-0.2.0.tar.gz 9.1 kB Without provenance Details for ai_change_impact_prototype-0.2.0.tar.gz

Built distribution (wheel)

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

Total release size: 19.3 kB

Release files / ai_change_impact_prototype-0.2.0.tar.gz

Download URL ai_change_impact_prototype-0.2.0.tar.gz
Size 9.1 kB
Tags Source
SHA-256 checksum
How to use checksums
bc2e1fc2aba3ce9a680d62b12d2fe5cc5c03e91c78586a3edbae2d5fd66fea29
BLAKE2b-256 checksum
How to use checksums
649e087abdaa34476a1e440ccf0ddf0807df7a13fb190734d5ab32954170f8d8
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.2.0-py3-none-any.whl

Download URL ai_change_impact_prototype-0.2.0-py3-none-any.whl
Size 10.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6767d164678819ff9c21b34b3b3fda68c31b46bccdfd963517e87d3f49b9c7eb
BLAKE2b-256 checksum
How to use checksums
00374eb1e799e56d07a07b1a232d0c97ac34d936e4a4fd8a717b65779a565c3c
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.2.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