Skip to main content

Isnād–Rijāl Framework

Grade the narrators, not just log them. Claim-level provenance for multi-agent knowledge systems — adapted from classical hadith transmission science.

CI Python 3.12+ License: Apache 2.0 DOI: 10.5281/zenodo.21211291

🌐 Full project home: https://alizahidraja.com/isnad


What & Why

In modern AI pipelines, a factual claim passes through many hands — a scraper extracts it, a model compiles it, another serves it. Each hand can drop, distort, or invent. Existing tools record what happened. ISNAD grades who transformed the claim, so it can tell you how much to trust the result.

The framework adapts hadith transmission science — one of history's most rigorous epistemologies, refined over twelve centuries — into a Python library for AI systems. Every claim carries its complete chain of transmitters (isnād); each transmitter is graded in a living registry (rijāl); chains are evaluated by their weakest link; content is criticized independently of transmission quality; and the two combine in a decision matrix that routes claims to serve, review, or quarantine.


60-Second Quickstart

pip install isnad
from isnad import Registry, Chain, ChainLinkSpec, grade_chain, decide
from isnad.types import NarratorGrade, ContentVerdict
from isnad.critics import EmbeddingCritic

# Build a chain: source → scraper → model
chain = Chain([
    ChainLinkSpec("openstax-textbook", 0, domain="physics"),
    ChainLinkSpec("pdf-scraper-v2", 1),
    ChainLinkSpec("ingest-model-v3", 2),
])

# Seed-grade known narrators (required for coverage — see §8 experiment)
reg = Registry()
reg.register("openstax-textbook", "physics", grade=NarratorGrade.RELIABLE)
reg.register("pdf-scraper-v2", "physics", grade=NarratorGrade.RELIABLE)
reg.register("ingest-model-v3", "physics", grade=NarratorGrade.ACCEPTABLE)

# Grade the chain
grades = [reg.get_grade(l.narrator_id, l.domain) for l in chain.links]
transforms = [l.transform_type for l in chain.links]
chain_grade = grade_chain(grades, transforms, is_complete=True)

# Content criticism (now functional — embedding-based)
critic = EmbeddingCritic()
verdict = critic.evaluate("p = h/λ", "p = h/lambda", ["p = mv"])
action = decide(chain_grade, verdict)

print(f"Chain: {chain_grade.value.upper()} | Content: {verdict.value} | Action: {action.value}")

LangChain Integration (5 lines)

pip install isnad[langchain]
from isnad.integrations.langchain import IsnadTracer, seed_registry
from isnad.critics import EmbeddingCritic

reg = seed_registry({"source:docs": "reliable", "model:gpt-4o": "acceptable"})
tracer = IsnadTracer(registry=reg, critic=EmbeddingCritic())
chain.invoke("What is F=ma?", config={"callbacks": [tracer]})
print(tracer.report())

What's Validated vs. What's Not

Component Status Notes
Weakest-link quarantine ✅ Validated 100% of REJECTED narrator claims correctly blocked
jarḥ–taʿdīl discovery ✅ Partial Correctly identifies bad narrators; good ones need seed grades
Seed-grade bootstrapping ✅ Validated Pre-grading sources/models enables practical coverage
Confidence-gating ❌ Useless Self-confidence scores uncorrelated with defects
Content criticism ⚠ Functional, limited Embedding critic catches obvious contradictions; LLM critic available
Corroboration (mutābaʿāt) ❌ Untested Never fired on real corpora across all runs
Coverage (with critic) ~50% Up from ~10% with the non-functional stub (see §8 experiment)

The honesty box is a feature. We tell you exactly what works, what's limited, and where you need to supply your own components.


Concept → Module Map

Concept What it does Module
isnād (chain) Ordered, gap-checked transmission chain per claim isnad/chain.py
rijāl (registry) Graded narrator store per (narrator, domain) isnad/registry.py
jarḥ–taʿdīl Evidence-driven state machine for narrator grades isnad/registry.py
ittiṣāl Completeness as epistemic property (gap → DAIF) isnad/chain.py
Weakest-link grading Chain grade = refined minimum over narrators isnad/grading.py
mutābaʿāt (corroboration) Independent-chain upgrade with correlation detection isnad/corroboration.py
matn criticism Content evaluated independently of chain quality isnad/critics/
Decision matrix 4×2 (chain × content) → action router isnad/matrix.py
ʿadālah / ḍabṭ Integrity and precision as two distinct axes isnad/types.py

The Decision Matrix

Content CONSISTENT Content CONTRADICTION
Ṣaḥīḥ (sound chain) SERVE — cache REVIEW — ʿilal signal (highest-value case)
Ḥasan (good chain) SERVE WITH CAVEAT REVIEW — hold, do not serve
Ḍaʿīf (weak chain) REVIEW — seek corroboration QUARANTINE
Mawḍūʿ (fabricated) REJECT + QUARANTINE NARRATOR REJECT + QUARANTINE NARRATOR

Pluggable Strategies — Extend It

The framework leaves key parameters open by design (paper §4.2/§4.3). Swap any:

Strategy Protocol Default What to provide
GradingStrategy isnad/types.py RefinedWeakestLink How links combine into chain grade
TransitionPolicy isnad/types.py ThresholdTransitionPolicy Evidence → narrator grade transitions
CorroborationPolicy isnad/types.py CappedCorroborationPolicy Independent chains → claim upgrade
CorrelationDetector isnad/types.py SharedLineageDetector True independence between chains
ContentCritic isnad/types.py EmbeddingCritic / LLMCritic Content contradiction detection

Swap a critic in one line:

from isnad.critics import EmbeddingCritic, LLMCritic

critic = EmbeddingCritic()                            # offline, fast
critic = LLMCritic(api_key="sk-...")                  # LLM-backed, higher quality

Good first issues:

  • Implement an alternative critic (sentence-transformers embedding, CrewAI integration)
  • Seed-grade bootstrapper from published benchmark data
  • Corroboration on a warm-grade corpus (the §8 experiment showed it's gated on warm grades)

Ecosystem


Citation

@article{raja2026grading,
  author  = {Ali Zahid Raja},
  title   = {Grading the Narrators: An Isnād–Rijāl Framework for
             Claim-Level Provenance in Multi-Agent Knowledge Systems},
  year    = 2026,
  doi     = {10.5281/zenodo.21211291},
}

@software{raja2026isnad,
  author  = {Ali Zahid Raja},
  title   = {Isnād–Rijāl Framework: Reference Implementation},
  year    = 2026,
  doi     = {10.5281/zenodo.21216873},
  orcid   = {0009-0003-7875-4590},
}

About

Built by Ali Zahid Raja · ORCID 0009-0003-7875-4590

The rigor belongs to twelve centuries of muḥaddithūn. The transfer to AI systems is the contribution claimed here. Built in public — collaborators welcome.

License: Code — Apache 2.0 · Paper & docs — CC BY 4.0

Download files

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

Source Distribution

isnad-1.0.2.tar.gz (39.6 kB view details)

Uploaded Source

Built Distribution

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

isnad-1.0.2-py3-none-any.whl (51.6 kB view details)

Uploaded Python 3

File details

Details for the file isnad-1.0.2.tar.gz.

File metadata

  • Download URL: isnad-1.0.2.tar.gz
  • Upload date:
  • Size: 39.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.25 {"installer":{"name":"uv","version":"0.11.25","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for isnad-1.0.2.tar.gz
Algorithm Hash digest
SHA256 7cdf1696e2bb07bde23f3a5258f8c2de2bcb303edf76ee73aad09b555d33050a
MD5 beaed3308c495953a7e36ed878eb25fd
BLAKE2b-256 7df2c4883db3577c29a02bf48bb0905f7c0844288ae881be12911551307e21a8

See more details on using hashes here.

File details

Details for the file isnad-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: isnad-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 51.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.25 {"installer":{"name":"uv","version":"0.11.25","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for isnad-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ad1d7900ae0f61c4c8fe73252939abcf29939ea613dcbb0621ff2d456d69569c
MD5 46f2792e5fe37304ee8456f1b034b809
BLAKE2b-256 32287e3e7206ce980c6b56a1876a2a2aad0c0fd13f6fbe3c6bbdaaafd57caaa3

See more details on using hashes here.

Release history Release notifications | RSS feed

2.0.14

2 files

2.0.13

2 files

2.0.12

2 files

2.0.11

2 files

2.0.10

2 files

2.0.9

2 files

2.0.8

2 files

2.0.7

2 files

2.0.6

2 files

2.0.5

2 files

2.0.4

2 files

2.0.3

2 files

2.0.2

2 files

2.0.1

2 files

2.0.0

2 files

This release

1.0.2 This release

2 files

1.0.0

2 files

Supported by

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