Skip to content

Feature/Fix: Add a shadow lineage ledger for Codex token accounting#24

Open
iam-brain wants to merge 1 commit into
mainfrom
iam-brain/shadow-lineage-ledger
Open

Feature/Fix: Add a shadow lineage ledger for Codex token accounting#24
iam-brain wants to merge 1 commit into
mainfrom
iam-brain/shadow-lineage-ledger

Conversation

@iam-brain

Copy link
Copy Markdown
Owner

Summary

Adds a shadow lineage ledger that treats Codex rollout files as overlapping physical views of transitive session families. It admits each complete (last_token_usage, total_token_usage) state once per lineage, keeps identical observations from unrelated lineages additive, and provides separate UTC and local-day projections.

This is the first isolated component of a planned scanner rearchitecture tracked in Map: rearchitect Codex rollout token accounting around lineages. It deliberately does not change production scanner totals yet.

Why

Forked, sibling, archived, and long-lived Codex sessions can copy or re-emit token history across physical rollout files. A small lineage-focused component gives later PRs a testable accounting boundary before discovery, parsing, pricing, shadow comparison, and production promotion are migrated piecemeal.

An independent privacy-safe replay over active and archived local rollout data reproduced the investigated July 9–11 UTC lineage totals and collapsed 1.535 million physical snapshots to 204,547 admitted observations. The remaining gap to OpenAI totals is intentionally not hidden or guessed away; later mapped slices will classify it through shadow diagnostics.

Validation

  • swift test --filter CodexLineageLedgerTests
  • make check
  • SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX26.5.sdk make test
  • 639 full-suite selections passed across 54 groups with no retries or timeouts
  • Repository review gate completed with no implementation defects; fingerprint-dimension coverage was added during review

Known limits

  • No rollout-file adapter or discovery integration yet
  • No production totals or pricing paths use the ledger
  • Missing or malformed evidence policy remains a later isolated slice

Tracks Land the shadow lineage ledger foundation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant