Skip to main content

attune-verify

Generation fact-checker for the attune-* family. Verifies named entities in LLM-generated content actually exist — imports import, CLI flags are real, links resolve, counts match source — so hallucinations that pass unit tests are caught before they reach a reader.

Install

pip install attune-verify

With the optional LLM semantic layer (requires attune-rag):

pip install 'attune-verify[rag]'

Quick start

from attune_verify import verify, VerifyContext
from pathlib import Path

ctx = VerifyContext(
    project_root=Path("."),
    allowed_help_cmds=frozenset(["attune"]),
)
result = verify(generated_content, ctx)
if not result.ok:
    for f in result.findings:
        print(f"{f.kind}: {f.detail}")

Part of the attune family

  • attune-rag grounds generation in accurate retrieved sources (input-side)
  • attune-verify checks that named entities in the output actually exist (output-side)

Together they bracket generation: rag verifies "is this claim supported?"; verify checks "does this named thing exist?"

What each checker verifies

Checker Claim it settles Truth source you declare
imports every import in a Python code fence resolves, by full dotted path env_python
flags every --flag in an inline span or shell fence appears in that command's --help help_commands / allowed_help_cmds
links every local markdown link target exists under the project project_root
counts every numeric claim matches the number it names count_sources

Findings are error when a claim is refuted and warning when it cannot be checked — an unverifiable claim is never a silent pass. result.ok is False only on errors; raise_if_failed(result) turns it into a hard gate.

Status

Beta — the deterministic core (imports, flags, links, counts) is stable and guarded by a labeled precision/recall corpus (gated ≥ 0.95 each) and mutation testing (gated ≥ 0.75). The public API above (verify, VerifyContext, VerifyResult, Finding, FindingKind, raise_if_failed, and the Judge protocol) is what beta covers: it will not change shape without a deprecation in a minor release. The LLM semantic layer is optional via the [rag] extra and is the least settled part of the surface.

Links are read from prose only. Inline ([text](target)) and all three reference forms — full [text][label], collapsed [text][], and shortcut [text] — resolve against the document's [label]: target definitions. An explicit reference whose label is never defined is an error: it renders as literal text, so the link does not exist. An undefined shortcut is ordinary prose (the [3] case is not a broken link) and is skipped, as are GFM footnotes, which share the same syntax.

Both --long and -short flags are checked. A single-letter short flag is unambiguous, so an absent one is an error. A longer single-dash token is not: -xzf may be a cluster of three flags, -name a single-dash long option, and -j4 a flag with an attached value. Each reading is tried, and if none verifies the finding is a warning rather than an error — an ambiguous token is unverifiable, not refuted.

Known limitations

  • A dash followed by digits (-5) is read as a negative number, not a flag, so a numeric short flag (head -5) is not checked.
  • A flag written as bare `--flag` in prose is attributed to the nearest preceding word, so it may degrade to a warning rather than resolve.
  • Counts are matched to a source by keyword overlap with the claim's surrounding text; a numeric claim whose context names no source is skipped rather than guessed at.

License

Apache 2.0

Download files

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

Source Distribution

attune_verify-0.5.0.tar.gz (35.4 kB view details)

Uploaded Source

Built Distribution

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

attune_verify-0.5.0-py3-none-any.whl (26.1 kB view details)

Uploaded Python 3

File details

Details for the file attune_verify-0.5.0.tar.gz.

File metadata

  • Download URL: attune_verify-0.5.0.tar.gz
  • Upload date:
  • Size: 35.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for attune_verify-0.5.0.tar.gz
Algorithm Hash digest
SHA256 b569d068b233e6ebabc710ab2c56c513db071c54153c0b57be04e74a7f753121
MD5 d00c7bbc76e7bce76cc8dbafc404f66b
BLAKE2b-256 7dd7fe9689a45a72d0109fd6733cc276b91a06ca4673043b1a7afc94010402df

See more details on using hashes here.

Provenance

The following attestation bundles were made for attune_verify-0.5.0.tar.gz:

Publisher: publish-pypi.yml on Smart-AI-Memory/attune-verify

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file attune_verify-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: attune_verify-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 26.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for attune_verify-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bdf6a7ae2b4bacafcf47441a98277383c03e848b0a128cbcc1c5ddd9625421f6
MD5 aac7ce626c6ea4b7041beedffefd0aa8
BLAKE2b-256 4ba77f37a6b450a47a573028eb66f713ef8d4e4a5094bc2df25ae9472416496a

See more details on using hashes here.

Provenance

The following attestation bundles were made for attune_verify-0.5.0-py3-none-any.whl:

Publisher: publish-pypi.yml on Smart-AI-Memory/attune-verify

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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