Skip to main content

COBOL legacy encapsulation with TIBET provenance and JIS capability gating

Project description

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.

Project details


Download files

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

Source Distribution

tibet_cobol-0.1.1.tar.gz (20.2 kB view details)

Uploaded Source

Built Distribution

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

tibet_cobol-0.1.1-py3-none-any.whl (17.5 kB view details)

Uploaded Python 3

File details

Details for the file tibet_cobol-0.1.1.tar.gz.

File metadata

  • Download URL: tibet_cobol-0.1.1.tar.gz
  • Upload date:
  • Size: 20.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for tibet_cobol-0.1.1.tar.gz
Algorithm Hash digest
SHA256 b3a45a19374c7842113a02534757b15a03e0fa3f41ba35696bb6c7104e7cd9e4
MD5 03d3a1b7ee0f3e096244dd51d4049665
BLAKE2b-256 ce8263996bc8800d3847d09bf49bcc4555e1a4eb0b29dfa7d9fed89841432cd9

See more details on using hashes here.

File details

Details for the file tibet_cobol-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: tibet_cobol-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 17.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for tibet_cobol-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b4d6226c65d3d956efbc51a63e6ef7d6e50652aed80d33f5edfce9e07a09971f
MD5 ff01ef97308ed4f354b2c654c0972b9c
BLAKE2b-256 f5c39d68f8ee52d93ec65d07db7d6e485b86b041a5ef14252cd8029c112c5bd7

See more details on using hashes here.

Supported by

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