MCard: Local-first Content Addressable Storage with Content Type Detection
Project description
MCard
MCard is a local-first, content-addressable storage platform with cryptographic integrity, temporal ordering, and a Polynomial Type Runtime (PTR) that orchestrates polyglot execution. It gives teams a verifiable data backbone without sacrificing developer ergonomics or observability.
Highlights
- 🔐 Hash-verifiable storage: SHA-256 hashing, handle registry with history, immutable audit trail output.
- ♻️ Deterministic execution: PTR mediates 8 polyglot runtimes (Python, JavaScript, Rust, C, WASM, Lean, R, Julia).
- 📊 Enterprise ready: Structured logging, CI/CD pipeline, security auditing, 99%+ automated test coverage.
- 🧠 AI-native extensions: GraphRAG engine, optional LLM runtime, and optimized multimodal vision (
moondream). - 🧰 Developer friendly: Rich Python API, TypeScript SDK, BMAD-driven TDD workflow, numerous examples.
- 📐 Algorithm Benchmarks: Sine comparison (Taylor vs Chebyshev) across Python, C, and Rust.
- ⚡ High Performance: Optimized test suite (~37s) with runtime caching and session-scoped fixtures.
For the long-form narrative and chapter roadmap, see docs/Narrative_Roadmap.md. Architectural philosophy is captured in docs/architecture/Monadic_Duality.md.
Quick Start (Python)
git clone https://github.com/xlp0/MCard_TDD.git
cd MCard_TDD
./activate_venv.sh # installs uv & dependencies
uv run pytest -q -m "not slow" # run the fast Python test suite
uv run python -m mcard.ptr.cli run chapters/chapter_01_arithmetic/addition.yaml
Create and retrieve a card:
from mcard import MCard, default_collection
card = MCard("Hello MCard")
hash_value = default_collection.add(card)
retrieved = default_collection.get(hash_value)
print(retrieved.get_content(as_text=True))
Quick Start (JavaScript / WASM)
See mcard-js/README.md for build, testing, and npm publishing instructions for the TypeScript implementation.
Polyglot Runtime Matrix
| Runtime | Status | Notes |
|---|---|---|
| Python | ✅ | Reference implementation, CLM runner |
| JavaScript | ✅ | Node + browser (WASM) + Full RAG Support |
| Rust | ✅ | High-performance adapter & WASM target |
| C | ✅ | Low-level runtime integration |
| WASM | ✅ | Edge and sandbox execution |
| Lean | ⚙️ | Formal verification pipeline (experimental) |
| R | ✅ | Statistical computing runtime |
| Julia | ✅ | High-performance scientific computing |
Project Structure (abridged)
MCard_TDD/
├── mcard/ # Python package (engines, models, PTR)
├── mcard-js/ # TypeScript implementation & npm package
├── chapters/ # CLM specifications (polyglot demos)
├── docs/ # Architecture, PRD, guides, reports
├── scripts/ # Automation & demo scripts
├── tests/ # >450 automated tests
└── requirements.txt / pyproject.toml
Documentation
- Product requirements: docs/prd.md
- Architecture overview: docs/architecture.md
- Monad–Polynomial philosophy: docs/architecture/Monadic_Duality.md
- Narrative roadmap & chapters: docs/Narrative_Roadmap.md
- Logging system: docs/LOGGING_GUIDE.md
- PTR & CLM reference: docs/CLM_Language_Specification.md, docs/PCard%20Architecture.md
- Reports & execution summaries: docs/reports/
Testing
# Python Suite
uv run pytest -q # Run all tests (~37s)
uv run pytest -q -m "not slow" # Run fast tests only (~34s)
uv run pytest -m "not network" # Skip tests requiring LLM/Ollama
# JavaScript Suite
npm --prefix mcard-js test
Contributing
- Fork the repository and create a feature branch.
- Run the tests (
uv run pytest,npm testinmcard-js). - Submit a pull request describing your change and tests.
We follow the BMAD (Red/Green/Refactor) loop – see BMAD_GUIDE.md.
License
This project is licensed under the MIT License – see LICENSE.
For release notes, check CHANGELOG.md.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mcard-0.1.26.tar.gz.
File metadata
- Download URL: mcard-0.1.26.tar.gz
- Upload date:
- Size: 184.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
34cdfec53b2b4f2adb67ebc6fe4c4147b97294b066c6887a23f77e8b5f4d98a8
|
|
| MD5 |
4d8579b9a52b949102138f5fcf446e5b
|
|
| BLAKE2b-256 |
760dead90c1a75abab90c4e14de71d8200c3afa96c9f03508b3effcfcf40597d
|
File details
Details for the file mcard-0.1.26-py3-none-any.whl.
File metadata
- Download URL: mcard-0.1.26-py3-none-any.whl
- Upload date:
- Size: 227.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bedded3c8294ef216fb38c007ff374eff8f070f3269e5dbac1a0bce844c96499
|
|
| MD5 |
aa3676d4f51c16bfe097e0938ea5ee15
|
|
| BLAKE2b-256 |
77dc12e88d7711d72ac5376825c4878890423b07103fd40397072ad92cb7d560
|