Skip to content

Releases: unpingable/nlai

nlai 0.3.0

Choose a tag to compare

@unpingable unpingable released this 07 Mar 23:15

Sentence-level claim extraction. Contradiction detection now works end-to-end.

Changed

  • extract_claims() returns sentence-level text — not just the matched keyword. Claims now carry enough context for contradiction detection to work through gate().
  • When multiple keywords appear in one sentence, the sentence appears once with the strongest strength (assertive > hedged).
  • assertiveness_score() still counts individual keyword matches to preserve 0.1.0 scoring semantics.

End-to-end contradiction detection

from nlai import gate, Evidence, attach_evidence

# Extract and support a claim
result = gate("The system definitely passes all tests.")
claim = attach_evidence(result.claims[0], Evidence(kind="test_result", reference="exit 0"))

# Later, gate contradicting text against the prior
result2 = gate("The system definitely fails all tests.", prior_claims=[claim])
print(result2.contested_claims[0].status)          # "contested"
print(result2.contested_claims[0].conflicts_with)  # ("The system definitely passes all tests",)
print(result2.verdict)                              # "pass" (contradictions don't block)

198 tests. Zero dependencies.

nlai 0.2.1

Choose a tag to compare

@unpingable unpingable released this 07 Mar 20:17

Hardening release. Golden fixture parity, cross-version verification, roundtrip hygiene.

Added

  • Golden fixture parity — 11 canonical JSON vectors vendored from Agent Governor (canonical_vectors.json). Parametrized tests verify byte-for-byte canonical JSON and SHA-256 hash agreement. If governor updates its vectors, nlai's tests fail (not silent drift).
  • Cross-version receipt fixture — frozen 0.1.0 receipt (receipt_v010.json) verified against current code. Subject hash, evidence hash, and receipt ID all reproduced from source data.
  • GateResult.from_dict() — full roundtrip serialization for gate results.

Fixed

  • Copyright year in LICENSE (2024 → 2026).

194 tests (up from 153). Zero dependencies.

nlai 0.2.0

Choose a tag to compare

@unpingable unpingable released this 07 Mar 20:16

Evidence attachment and contradiction detection.

New

  • Evidence dataclass — opaque records (kind + reference). The kernel records that evidence was attached; it does not validate or fetch references.
  • attach_evidence(claim, evidence) — promotes UNSUPPORTED → SUPPORTED. CONTESTED stays CONTESTED.
  • contest_claim(claim, conflicting_text) — marks as CONTESTED (sticky — only humans resolve).
  • find_contradictions(claims, prior_claims) — opposing-pair detection with word-boundary regex matching.
  • gate(..., prior_claims=...) — contradiction checking wired into the gate function.
  • GateResult.contested_claims — convenience property for contested claims.

Status semantics

Status Meaning
unsupported No evidence attached (default)
supported Evidence record(s) attached — not independently validated
contested Conflicting claims detected — sticky until human resolution

Details

  • 9 hand-curated opposing pairs (improves/degrades, faster/slower, passes/fails, etc.)
  • Canonical sorted serialization for stable receipt hashes
  • Idempotent: duplicate evidence/conflicts silently deduplicated
  • Backward compatible with 0.1.0 claim dicts (from_dict handles missing fields)

153 tests (up from 79). Zero dependencies.

nlai 0.1.0

Choose a tag to compare

@unpingable unpingable released this 07 Mar 20:16

Initial release. Evidence-gated claims, continuity anchors, and deterministic receipts for agent workflows.

Language is a proposal, not an authority.

  • Claims: assertive/hedged extraction with span tracking
  • Anchors: required/forbidden lexical constraints with severity levels
  • Receipts: content-addressed (receipt_id = H(schema_version + gate + subject_hash + evidence_hash))
  • Gate: gate(text, *, anchors=None) → GateResult — the entire kernel surface
  • Verdicts: pass / warn / block / observe

79 tests. Zero dependencies. Python 3.10+.

pip install nlai
from nlai import gate, Anchor

result = gate("The tests definitely pass.")
print(result.verdict)       # "pass"
print(result.claims)        # [Claim("definitely", assertive)]
print(result.receipt.receipt_id)  # content-addressed hex