Skip to main content

tibet-cobol

COBOL legacy encapsulation with TIBET provenance and JIS capability gating.

The sarcophagus for COBOL: encapsulate without replacing.

License: MIT

The Problem

220 billion lines of COBOL power $3 trillion/day in transactions. Banks, governments, and insurers cannot rewrite it — too risky, too expensive, too critical. But without audit trails and capability gating, they cannot safely integrate AI either.

COBOL is the asbestos of programming languages. You can't remove it. You can encapsulate it.

The Solution

tibet-cobol provides three layers for safe legacy modernization:

1. Bridge — Encapsulation

Wrap COBOL procedures with JIS capability gates and TIBET provenance chains. The business logic stays identical — zero changes to decades-tested rules.

from tibet_cobol import COBOLBridge, PICType

bridge = COBOLBridge("FUNDS-TRANSFER")

# COBOL DATA DIVISION → Python (type-safe PIC fields)
bridge.define_storage(
    ("ACCOUNT-BAL", PICType.NUMERIC, 7, 2, 5000.00),
    ("TRANSFER-AMT", PICType.NUMERIC, 7, 2, 1500.00),
    ("TRANSFER-STAT", PICType.ALPHANUMERIC, 10, 0, ""),
)

# COBOL PROCEDURE DIVISION → Python (exact same logic)
def funds_transfer(ws):
    if ws.get("ACCOUNT-BAL") >= ws.get("TRANSFER-AMT"):
        ws.set("ACCOUNT-BAL", ws.get("ACCOUNT-BAL") - ws.get("TRANSFER-AMT"))
        ws.set("TRANSFER-STAT", "SUCCESS")
    else:
        ws.set("TRANSFER-STAT", "INSUFF-FND")

bridge.register_procedure("BEGIN-TRANSFER", funds_transfer)

# Execute with JIS gate + TIBET provenance
result = bridge.execute(
    procedure="BEGIN-TRANSFER",
    actor="ai-agent-001",
    model_id="qwen2.5:32b",   # 32B → gate OPEN (L2 access)
    required_level=2,
)
# result.status == "SUCCESS"
# result.tibet_tokens == [gate_check, pre_state, post_state]

A 3B model trying the same operation:

result = bridge.execute(
    procedure="BEGIN-TRANSFER",
    actor="small-model",
    model_id="qwen2.5:3b",    # 3B → gate CLOSED (only L0)
    required_level=2,
)
# result.status == "DENIED"
# Violation logged in TIBET chain, state unchanged

2. Shadow — Parallel Execution

Run COBOL and the new system side by side. Compare outputs. Build trust over time.

from tibet_cobol import ShadowRunner, ShadowMode

runner = ShadowRunner("FUNDS-TRANSFER")
runner.register_cobol(cobol_function)
runner.register_new(modern_function)

# Phase 1: Observe (COBOL master, new system watches)
result = runner.run({"balance": 5000, "amount": 1500}, mode=ShadowMode.SHADOW)

# Phase 2: Verify (both run, compare outputs)
result = runner.run({"balance": 5000, "amount": 1500}, mode=ShadowMode.VERIFY)
print(result.match)       # True — outputs identical
print(result.rag_entry)   # Knowledge captured for RAG

# Trust builds over many runs
for i in range(100):
    runner.run(test_data[i], mode=ShadowMode.VERIFY)
print(runner.trust.trust_score)     # 0.98
print(runner.trust.suggested_mode)  # ShadowMode.PARALLEL

3. Manifest — Field Mapping

Track which COBOL fields map to modern data stores. Bidirectional.

from tibet_cobol import Manifest, MigrationStatus

manifest = Manifest("FUNDS-TRANSFER")

# Define mappings
manifest.map("ACCOUNT-BAL", "001-007", "9(7)V99",
             modern_path="accounts.balance", modern_type="decimal")
manifest.map("TRANSFER-AMT", "008-014", "9(7)V99",
             modern_path="transfers.amount", modern_type="decimal")
manifest.map("TRANSFER-STAT", "015-024", "X(10)")
# ^ No modern_path → stays COBOL_ONLY

# Update from shadow results
manifest.record_shadow("ACCOUNT-BAL", matched=True)  # ×100 runs

# Check migration readiness
print(manifest.coverage)           # 0.66 (2/3 fields mapped)
print(manifest.verification_score) # 0.95
print(manifest.ready_for_cutover)  # False (TRANSFER-STAT unmapped)

# Bidirectional lookup
manifest.cobol_to_modern("ACCOUNT-BAL")  # "accounts.balance"
manifest.modern_to_cobol("accounts.balance")  # "ACCOUNT-BAL"

Migration Phases

Phase 0: SHADOW     COBOL master, new system observes
Phase 1: VERIFY     Both run, outputs compared
Phase 2: PARALLEL   New system serves, COBOL validates
Phase 3: CUTOVER    New system master, COBOL decommissioned

Every phase transition is:

  • JIS-gated — requires proven capability
  • TIBET-tracked — immutable provenance chain
  • Trust-based — must reach threshold before advancing

Installation

pip install tibet-cobol

Requires Python 3.10+ and tibet-context >= 0.2.0.

Tests

pytest tests/ -v

Relation to TIBET Ecosystem

tibet-core        (Token, Chain, Provider)
    │
tibet-context     (Layers, Gate, Builder)
    │
tibet-cobol       (Bridge, Shadow, Manifest)  ← you are here
    │
Legacy COBOL      (FUNDS-TRANSFER, etc.)

License

MIT — Humotica

Credits

Designed by Jasper van de Meent. Built by Jasper and Root AI as part of HumoticaOS.


Stack-positie: Groep specialized · Eigen tijdlijn — niet onderdeel van de ainternet/evidence-spine · ← tibet-gateway · tibet-y2k38 → · See STACK.md · See demo/golden-path/ for the spine end-to-end.

Enterprise

For private hub hosting, SLA support, custom integrations, or compliance guidance:

Enterprise enterprise@humotica.com
Support support@humotica.com
Security security@humotica.com

See ENTERPRISE.md for details.

Metadata

Release files for tibet-cobol 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tibet-cobol 0.1.1
File Size Uploaded Provenance Actions
tibet_cobol-0.1.1.tar.gz 20.2 kB Without provenance Details for tibet_cobol-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tibet-cobol 0.1.1
File Interpreter ABI Platform Actions
tibet_cobol-0.1.1-py3-none-any.whl Python 3 none any Details for tibet_cobol-0.1.1-py3-none-any.whl

Total release size: 37.7 kB

Release files / tibet_cobol-0.1.1.tar.gz

Download URL tibet_cobol-0.1.1.tar.gz
Size 20.2 kB
Tags Source
SHA-256 checksum
How to use checksums
b3a45a19374c7842113a02534757b15a03e0fa3f41ba35696bb6c7104e7cd9e4
BLAKE2b-256 checksum
How to use checksums
ce8263996bc8800d3847d09bf49bcc4555e1a4eb0b29dfa7d9fed89841432cd9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release files / tibet_cobol-0.1.1-py3-none-any.whl

Download URL tibet_cobol-0.1.1-py3-none-any.whl
Size 17.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b4d6226c65d3d956efbc51a63e6ef7d6e50652aed80d33f5edfce9e07a09971f
BLAKE2b-256 checksum
How to use checksums
f5c39d68f8ee52d93ec65d07db7d6e485b86b041a5ef14252cd8029c112c5bd7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Security for tibet-cobol 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page