mantra / README.md
SNAPKITTYWEST's picture
Metadata: discovery tags (collection, languages)
5d8d87b verified
|
Raw History Blame Contribute Delete
4.63 kB
metadata
license: agpl-3.0
language:
  - en
tags:
  - sovereign
  - snapkitty
  - programming-language
  - deterministic
  - ledger
  - cryptography
  - sha256
  - mumps
  - ibm-i
  - worm-sealed
  - zero-dependencies
  - pure-python
  - formal-verification
  - compilers
  - mantra
task_categories:
  - text-generation
size_categories:
  - n<1K
pretty_name: MANTRA — Deterministic Auditable Language

MANTRA

A deterministic, auditable programming language for ledger operations, cryptographic sealing, and verified integer computation.

Zero external dependencies. Pure Python. Auditable SHA-256. MUMPS gateway.

SnapKitty West / SNAPKITTYWEST — Evidence or Silence — 2026


What It Is

MANTRA is a purpose-built language for sovereign ledger operations. Every computation is deterministic and traceable. Every output can be cryptographically sealed. No external dependencies — the SHA-256 implementation is pure Python and auditable line by line.

# Constants and variables
const GENESIS = "0000000000000000000000000000000000000000000000000000000000000000"
let amount = 450000

# Annotated deterministic function
@deterministic
define seal(tx)
  let h = sha256(tx)
  Result::ok(h)
end

# Run
python mantra.py run examples/ledger.m
python mantra.py hash "hello world"

Test Status

Suite Tests
test_sha256 passing
test_integer passing
test_bytes passing
test_evaluator passing
Total 23/23

Architecture

mantra/
├── mantra.py                   CLI (run / eval / hash / test)
├── lexer/lexer.py              Tokenizer (HEX, BYTES, annotations, keywords)
├── mantra_ast/nodes.py         AST dataclasses
├── parser/parser.py            Pratt parser + field access + dict literals
├── runtime/
│   ├── types.py                Integer, Boolean, Bytes, String, DictValue, Option, Result
│   ├── evaluator.py            Tree-walking evaluator with closures + builtins
│   ├── runtime.py              run_source / run_file
│   └── stdlib/
│       ├── integer.py          add/sub/mul/div/mod/pow with overflow checking
│       ├── bit.py              band/bor/bxor/bnot/shl/shr/rotl/rotr
│       ├── bytes.py            concat/slice/len/get_byte
│       ├── string.py           to_bytes/from_bytes/concat
│       ├── hex.py              bytes_to_hex/hex_to_bytes
│       ├── sha256.py           sha256/sha256_hex (wraps auditable impl)
│       ├── collections.py      list_len/list_get/dict_get
│       ├── result.py           ok/err/some/none
│       └── testing.py          assert_eq/assert_true/assert_false
├── sha256/
│   ├── sha256_impl.py          Pure-Python SHA-256 (no hashlib, fully auditable)
│   └── vectors.py              NIST canonical test vectors
├── gateway/
│   └── mumps_gateway.py        300-byte binary record pack/unpack/dispatch (IBM i bridge)
└── examples/
    ├── ledger.m                Transaction seal (end-to-end working)
    └── treasury.m              Multi-step ledger chain

Key Properties

Property Detail
Deterministic Same inputs always produce same outputs
Auditable SHA-256 Pure Python, no hashlib, every round visible
Zero dependencies Nothing to install beyond Python 3.10+
MUMPS gateway 300-byte binary record bridge to IBM i
Fail-closed types Option and Result — no silent nulls
Overflow checking Integer arithmetic bounds-checked

License

Trilicensed: AGPL-3.0 / MIT / Sovereign-Source-1.0 (see LICENSES/)


💼 Commercial License

Snapkitty code is free and open under AGPL-3.0 for open-source use. Building a commercial product or service? A proprietary commercial license from Snapkitty Collective LLC lets you ship this code without the AGPL's source-sharing and network-use obligations.

→ Get a commercial license · A.parr@belespritdaccord.uk

Related Repos

Repo Description
SNAPKITTYWEST/sov Sovereign Package Switchboard
SNAPKITTYWEST/devflow-finance-twin IBM i BaaS ledger stack
SNAPKITTYWEST/sovereign-training-corpus Training corpus
GitHub Source repository