Metadata-Version: 2.4
Name: inferenceledger
Version: 0.1.0
Summary: Bounded inference-change assurance with reconstructable quality, reliability, latency, and economic evidence
Author: Mohammad Atashi
Project-URL: Repository, https://github.com/TensorScholar/inferenceledger
Requires-Python: <3.13,>=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: fastapi<1,>=0.115
Requires-Dist: uvicorn[standard]<1,>=0.30
Requires-Dist: pydantic<3,>=2.4
Requires-Dist: pydantic-settings<3,>=2
Requires-Dist: structlog<25,>=23
Requires-Dist: numpy<2,>=1.26
Provides-Extra: dev
Requires-Dist: pytest<10,>=8; extra == "dev"
Requires-Dist: pytest-asyncio<1,>=0.23; extra == "dev"
Requires-Dist: pytest-cov<8,>=5; extra == "dev"
Requires-Dist: ruff<1,>=0.16.6; extra == "dev"
Requires-Dist: mypy<2,>=1.10; extra == "dev"
Provides-Extra: providers
Requires-Dist: openai<2,>=1.0; extra == "providers"
Requires-Dist: text-generation<1,>=0.7; extra == "providers"
Provides-Extra: local-serving
Requires-Dist: vllm>=0.6; extra == "local-serving"
Dynamic: license-file

# InferenceLedger

InferenceLedger is a research-oriented engineering project for **bounded inference-change assurance**.

Its primary question is not "which model is cheapest?" and it is not intended to become another generic inference gateway, router, evaluation platform, dashboard, provider leaderboard, or universal billing system.

Instead:

> Does a specific model, provider, or execution-policy change satisfy predeclared quality, reliability, latency, and economic requirements for a defined workload and accounting basis, and can the supporting evidence and remaining uncertainty be reconstructed?

## Current strategic status

The strategic thesis is **NARROWED — bounded inference-change assurance**.

The current research question is:

> Does explicit inference-specific evidence semantics improve consequential migration decisions versus a strong conventional workflow at acceptable decision coverage, effort, abstention, and delay?

The comparator is intentionally allowed to be competent: evaluation + telemetry + accounting + manual review with materially equivalent evidence access.

This thesis is **not externally validated, customer validated, commercially validated, or production guaranteed**.

See:

- [Strategy Brief](./docs/00_STRATEGY_BRIEF.md)
- [Market and Product Decision](./docs/05_MARKET_AND_PRODUCT_DECISION_2026-09.md)
- [Canonical Project Map](./docs/06_CANONICAL_PROJECT_MAP.md)
- [Decision Evidence Completeness Contract](./docs/13_DECISION_EVIDENCE_COMPLETENESS.md)
- [Comparative External Pilot Protocol](./docs/14_COMPARATIVE_EXTERNAL_PILOT_PROTOCOL.md)
- [Authoritative Pilot Decision Path](./docs/16_AUTHORITATIVE_PILOT_DECISION_PATH.md)
- [Pilot Evidence Contract](./docs/17_PILOT_EVIDENCE_CONTRACT.md)
- [Task-5 External Pilot Acquisition and Qualification Package](./docs/18_TASK5_EXTERNAL_PILOT_ACQUISITION.md)
- [Task-5 Candidate Intake / Pre-Freeze Template](./docs/19_TASK5_CANDIDATE_INTAKE_TEMPLATE.md)
- [Progress Tracker](./docs/PROGRESS_TRACKER.md)

## Current engineering status

**Pilot-critical engineering for the first comparative external pilot path is complete and ENGINEERING_VERIFIED.**

That statement is deliberately narrower than "engineering is complete."

| Task | PR | Current meaning |
| --- | --- | --- |
| Task 1 | #28 | fail-closed decision-evidence completeness contract |
| Task 2 | #41 | frozen comparative external pilot protocol v1 |
| Task 3 | #42 | one authoritative pilot execution/import → compare → report path |
| Task 4 | #43 | pilot-specific exact money, acquisition semantics, attempt visibility, evidence manifest, evaluator/comparator contracts, and non-inference health checks |

The latest code-bearing main anchor before this repository-truth synchronization PR is `3ca56334d5136c58853554e9cbcf078761ba7160` (PR #43 merge). Main CI #210 passed on that exact SHA.

The selected pilot path now has:

- durable provider-attempt evidence with explicit unknown-cost behavior;
- provider/pricing provenance needed by the selected evidence path;
- workload identity, pairing, segment evidence, and non-compensatory Change Gate semantics;
- a single pilot-authoritative run-persistence and migration-decision owner;
- prospective exact decimal-string monetary evidence for the pilot path;
- separate measurement / collection / assignment semantics for pilot evidence;
- deterministic `pilot-evidence-manifest-v1`;
- evaluator, pairing, comparator-parity, study-output, and semantics-ablation contracts;
- OpenAI-compatible health checks that use non-inference model metadata rather than Chat Completions.

These capabilities do **not** imply generic repository-wide completion. In particular, generic orchestration consolidation, branch governance, gateway-era ownership cleanup, post-change revalidation, a generic non-pilot manifest/evidence-mode contract, and a repository-wide migration away from legacy float/SQLite `REAL` monetary fields remain separate backlog items. Repository CI/dev dependency reproducibility is handled separately by the checked-in Python 3.12/macOS ARM64 constraint contract.

## Current phase — Task 5

Current phase: **Task 5 — Comparative External Decision-Value Pilot**.

| Surface | Status |
| --- | --- |
| Task-5 preparation | STARTED |
| Concrete pilot instance | NOT FROZEN |
| Execution readiness | BLOCKED — EXTERNAL FACTS REQUIRED |
| Pilot execution | NOT STARTED |
| Provider/customer calls for Task 5 | 0 |
| Authorized Task-5 paid spend | $0 |
| External decision-value evidence | NOT_STARTED |
| Customer validation | NOT_STARTED |
| Commercial validation | NOT_STARTED |

PR #44, **Gate Task 5 concrete pilot instance freeze**, was a draft Task-5 preparation/freeze-gate artifact. Its useful preparation semantics are superseded by the canonical Task-5 preparation surfaces below, and the PR is **CLOSED / UNMERGED / SUPERSEDED**. Closing it did not freeze or execute a pilot, create customer evidence, or increase readiness.

A real pilot still requires independently supplied external facts: an accountable collaborator and decision owner, a genuine migration decision, approved workload and selection procedure, consent and retention rules, baseline/candidate definitions, predeclared requirements and critical segments, a calibrated evaluator with known-good/known-bad controls, a strong conventional comparator with materially equivalent evidence access, acquisition/assignment semantics, a retry/fallback evidence plan, and explicit paid-spend authorization if paid execution is required.

The canonical Task-5 preparation surfaces are the [External Pilot Acquisition and Qualification Package](./docs/18_TASK5_EXTERNAL_PILOT_ACQUISITION.md) and the [Candidate Intake / Pre-Freeze Template](./docs/19_TASK5_CANDIDATE_INTAKE_TEMPLATE.md). They are preparation artifacts only: they do not supply external facts, freeze a pilot instance, authorize spend, execute a pilot, or establish customer/commercial validation. PR #44 is retained only as historical preparation context and is **CLOSED / UNMERGED / SUPERSEDED**.

## Evidence boundary

InferenceLedger uses explicit evidence levels. They must not be collapsed:

- **ENGINEERING_VERIFIED** — code/contracts/tests passed the stated engineering environment.
- **EXTERNALLY_EXECUTED** — a real external system/provider participated; the target claim may still be unsupported.
- **EXTERNALLY_VALIDATED** — a predeclared external claim was tested and supported within scope.
- **PILOT_VALIDATED** — a real external decision owner/workload plus preregistered comparative use produced decision/effort evidence.
- **COMMERCIALLY_VALIDATED** — genuine buyer/commercial evidence.
- **PRODUCTION_GUARANTEED** — not claimed by this repository.

Prototype capability ≠ validated behavior ≠ production guarantee.

## Historical evidence

Historical experiment outcomes are immutable.

- Mission 4 remains `INCONCLUSIVE`.
- Mission 5 remains `INCONCLUSIVE`.
- Mission 6B-OR remains **EXTERNALLY_EXECUTED / VALIDATED_MISMATCH**.
- Mission 6C is a post-hoc engineering clarification and does not relabel Mission 6B-OR.

Mission 6B-OR's monetary R2–R5 surfaces matched exactly within its frozen experiment, while its historical R1 token-field comparison mismatched. That result is not direct OpenAI billing-ledger validation, final-invoice validation, customer validation, or a Change Gate approval.

Historical artifacts are not regenerated to fit newer semantics.

## Distribution and CLI identity

The installable Python distribution is `inferenceledger`. The internal Python import package remains `inference_engine` by design; renaming imports would create migration cost without improving the distribution-facing product contract.

The canonical console surface is:

```bash
inferenceledger smoke --prompt "hello"
```

The historical flat command remains available as a compatibility alias:

```bash
inference-smoke --prompt "hello"
```

`inference-smoke` is retained for the `0.1.x` line. Its earliest removal is `0.2.0`, and only after repository/supported-workflow evidence shows that no maintained consumer still depends on it. Historical experiment commands and artifact paths are not renamed.

## Development and CI

The repository CI workflow runs on the repository-scoped self-hosted runner using `[self-hosted, macOS, ARM64]`.

The CI job is `lint-type-test` and runs Ruff, mypy, and pytest.

The workflow retains `permissions: contents: read` and `actions/checkout` with `persist-credentials: false`.

For reproducible repository verification, CI pins the resolver and consumes `requirements/ci-py312-macos-arm64.txt`; see [CI Dependency Reproducibility](./docs/20_CI_DEPENDENCY_REPRODUCIBILITY.md). `pyproject.toml` remains the package compatibility/intention surface, and provider/local-serving extras remain outside ordinary CI.

Passing CI is engineering evidence only. It is not external/customer/commercial validation.

## Current non-pilot repository debt

The first external pilot is blocked by external facts, not by a missing pilot-critical subsystem. Separate repository debt remains tracked in issues #29–#39. Issue #40 is closed/completed after an acceptance audit of the non-inference health-check implementation.

- generic orchestration consolidation beyond the selected pilot path (#31);
- main protection and self-hosted-runner governance (#33);
- gateway-era ownership cleanup (#35);
- post-change revalidation (#36);
- generic non-pilot manifest/evidence-mode/monetary migration scope (#37–#39).

Do not add infrastructure merely because it is technically interesting. The immediate strategic objective is to determine whether InferenceLedger creates measurable incremental decision value on a real external inference migration.
