CARGE / Modern Bureaucracy - Decentralized AI-Powered Compliance & Copyright Protection
Transform regulatory processes into executable AI workflows with blockchain proof.
CARGE (Context-Aware Regulatory Governance Engine) is a decentralized platform that transforms bureaucratic processes into executable workflows:
- AI-Powered: Natural language interaction instead of complex forms
- Blockchain Proof: Every step generates cryptographic proof
- GDPR Compliant: Local execution, encrypted storage, user-controlled keys
- Cost Efficient: ~β¬0.05/workflow vs β¬5+ on Ethereum
- EU Compatible: EBSI-ready W3C Verifiable Credentials
β
Copyright Protection (EU EBSI-compatible)
β
RGPD Compliance
β
KYC/AML Workflows
β
Legal Contracts & NDA
β
Supply Chain Certifications
- Node.js 18+
- Claude Desktop (or any MCP-compatible AI client)
- Network connectivity for P2P operations
# Clone the repository
git clone https://github.com/polykrate/human-context-protocol.git
cd human-context-protocol
# Install dependencies
npm install
# Build the project
npm run buildAdd to your MCP configuration file (e.g., ~/.cursor/mcp.json or Claude Desktop config):
{
"mcpServers": {
"human-context-protocol": {
"command": "node",
"args": [
"/path/to/human-context-protocol/build/index.js"
],
"env": {
"SEED": "your twelve word mnemonic seed phrase goes here for deterministic keys",
"NAME": "my-agent",
"HELIA_PORT": "4001",
"SUBSTRATE_WS_URL": "wss://fraa-flashbox-4667-rpc.a.stagenet.tanssi.network",
"SUBSTRATE_RPC_URL": "https://fraa-flashbox-4667-rpc.a.stagenet.tanssi.network",
"MAIEUTIC_DEBUG": "false",
"HELIA_DATA_PATH": "/path/to/data/IPFS/my-agent",
"LEVELDB_DATA_PATH": "/path/to/data/levelDb/my-agent",
"PROOF_PATH": "/path/to/data/proof/my-agent"
}
}
}
}Run multiple agents simultaneously for testing workflows:
{
"mcpServers": {
"human-context-protocol-alice": {
"command": "node",
"args": ["/path/to/human-context-protocol/build/index.js"],
"env": {
"SEED": "earn upset sauce birth indicate spray bring glimpse paper soup release same",
"NAME": "alice",
"HELIA_PORT": "4001",
"SUBSTRATE_WS_URL": "wss://fraa-flashbox-4667-rpc.a.stagenet.tanssi.network",
"SUBSTRATE_RPC_URL": "https://fraa-flashbox-4667-rpc.a.stagenet.tanssi.network",
"HELIA_DATA_PATH": "/home/user/data/IPFS/alice",
"LEVELDB_DATA_PATH": "/home/user/data/levelDb/alice",
"PROOF_PATH": "/home/user/data/proof/alice"
}
},
"human-context-protocol-bob": {
"command": "node",
"args": ["/path/to/human-context-protocol/build/index.js"],
"env": {
"SEED": "purpose shrug zebra girl identify aerobic velvet civil lazy pull steel enter",
"NAME": "bob",
"HELIA_PORT": "4002",
"SUBSTRATE_WS_URL": "wss://fraa-flashbox-4667-rpc.a.stagenet.tanssi.network",
"SUBSTRATE_RPC_URL": "https://fraa-flashbox-4667-rpc.a.stagenet.tanssi.network",
"HELIA_DATA_PATH": "/home/user/data/IPFS/bob",
"LEVELDB_DATA_PATH": "/home/user/data/levelDb/bob",
"PROOF_PATH": "/home/user/data/proof/bob"
}
}
}
}| Variable | Description | Example |
|---|---|---|
SEED |
12-word BIP39 mnemonic for deterministic key generation | "word1 word2 ... word12" |
NAME |
Agent identifier (used for logging and data paths) | "alice" |
HELIA_PORT |
P2P networking port (must be unique per agent) | 4001 |
SUBSTRATE_WS_URL |
WebSocket RPC endpoint for RAG Chain | wss://... |
SUBSTRATE_RPC_URL |
HTTP RPC endpoint for RAG Chain | https://... |
HELIA_DATA_PATH |
IPFS data storage directory | /data/IPFS/alice |
LEVELDB_DATA_PATH |
Local database path | /data/levelDb/alice |
PROOF_PATH |
Directory for cryptographic proofs | /data/proof/alice |
KUDO_GATEWAY_URL |
Kudo IPFS gateway URL for HTTP routing (optional) | http://localhost:5001 |
MAIEUTIC_DEBUG |
Enable debug logging (optional) | "true" or "false" |
Get comprehensive system status including keyring, Helia node, blockchain connection, and stored elicitations.
get_system_info({
includeElicitations: true // optional
})Update or create your PKI profile on the blockchain with exchange keys and peer ID.
update_pki_profile({
newCid: "bafybeigdyrzt5..." // optional: update profile CID
})Retrieve PKI profile information for any address.
get_pki_profile({
address: "5DXBoe8maXbydrgqiKX1PCY9PS19Kfaq59vrroiXp4se7MgU"
})Store content on IPFS and get a CID.
ipfs_depose({
content: "Your content here",
contentType: "text/plain",
encoding: "utf8" // utf8, base64, or hex
})Retrieve content from IPFS using a CID.
ipfs_retrieve({
cid: "bafkreibhyxnitb2dg3dctp7mobotn4igbdqsz4w4g264smvlgia2ytav4m",
outputEncoding: "utf8" // utf8, base64, or hex
})Check if a CID is available and optionally retrieve it.
ipfs_check({
cid: "bafkreib7nu2xbammtvg7wzdkn4fs3tpwibn2szzqjsx3mp63bnqojb3w7m",
attemptRetrieval: true
})Store RAG (Retrieval-Augmented Generation) workflow metadata on blockchain.
store_rag_metadata({
instructionCid: "bafkreiabc...",
resourceCid: "bafkreidef...",
schemaCid: "bafkreighi...",
steps: ["0xhash1", "0xhash2"], // array of step hashes
name: "EU Copyright v3",
description: "EU copyright protection workflow",
tags: ["copyright", "eu", "master"],
ttl: 432000 // optional: time-to-live in blocks
})Retrieve RAG metadata by hash.
get_rag_metadata({
metadataHash: "0x0ec30e885128c18e0e35a403d901ef309f8574c47229d790c748b7cba6d10938"
})Search for RAG workflows using tags (AND logic).
search_rag_by_tags({
tags: ["copyright", "eu", "master"]
})Start a workflow with initial data.
start_workflow({
workflowHash: "0x0ec30e88...",
targetAddress: "5DXBoe8maXbydrgqiKX1PCY9PS19Kfaq59vrroiXp4se7MgU",
delivrable: {
work: {
title: "My Creative Work",
type: "literature",
description: "A poem about blockchain",
creationDate: "2025-10-07",
contentHash: "bafkreihwtfgwhjku627s3ybrf3r4grluxa5nbtxai6kbh2aik7vn4y3zny"
}
}
})Decrypt and view the accumulated data from a workflow step.
decrypt_previous_step({
contentHash: "0xe0c96f06853d17030fe9b01c48a4b389a2a3e64c0d90237dd12a3d76905df974"
})Extract the next step instructions from a workflow.
extract_current_step({
contentHashPreviousStep: "0xe0c96f06853d17030fe9b01c48a4b389a2a3e64c0d90237dd12a3d76905df974"
})Complete a workflow step and move to the next.
complete_step({
targetAddress: "5CLqgPWHnzKw7eF7pL8bV7kuV6FyJ3fFtJyGA7592jrrF1oM",
contentHashPreviousStep: "0x7519e725790fbdec11a7d82a963197e8a4208d22e87d7faa357769502b730459",
delivrable: {
"customer-purchase": {
"customerIdentity": "Wei Chen",
"purchaseLocation": "Emperor's Cellar Shanghai",
"purchaseDate": "2024-08-20",
"bottleNumber": "#347/2500",
"purchasePrice": "Β₯28,800",
"qrCodeScanned": true,
"verificationResult": "All 6 previous steps verified. Complete provenance chain confirmed."
}
}
})Verify a cryptographic proof file against the blockchain.
check_proof({
proofPath: "/home/user/data/proof/brigite/proof_0x7519e725790fbdec11a7d82a963197e8a4208d22e87d7faa357769502b730459.json"
})search_rag_by_tags({
tags: ["copyright", "eu", "master"]
})Result: RAG Hash 0x0ec30e885128c18e0e35a403d901ef309f8574c47229d790c748b7cba6d10938
ipfs_depose({
content: "Your creative work content here...",
contentType: "text/plain",
encoding: "utf8"
})Result: CID bafkreihwtfgwhjku627s3ybrf3r4grluxa5nbtxai6kbh2aik7vn4y3zny
start_workflow({
workflowHash: "0x0ec30e885128c18e0e35a403d901ef309f8574c47229d790c748b7cba6d10938",
targetAddress: "5DXBoe8maXbydrgqiKX1PCY9PS19Kfaq59vrroiXp4se7MgU",
delivrable: {
work: {
title: "Justice Numérique - Poème sur CARGE",
type: "literature",
description: "A poem exploring decentralized justice and blockchain",
creationDate: "2025-10-07",
contentHash: "bafkreihwtfgwhjku627s3ybrf3r4grluxa5nbtxai6kbh2aik7vn4y3zny"
}
}
})Result:
- Crypto trail created on blockchain
- IPFS CID for encrypted data
- Proof file generated:
proof_0xe0c96f06853d17030fe9b01c48a4b389a2a3e64c0d90237dd12a3d76905df974.json
extract_current_step({
contentHashPreviousStep: "0xe0c96f06853d17030fe9b01c48a4b389a2a3e64c0d90237dd12a3d76905df974"
})Result: Instructions for Step 2 (creator identity) + accumulated data from Step 1
complete_step({
targetAddress: "5DXBoe8maXbydrgqiKX1PCY9PS19Kfaq59vrroiXp4se7MgU",
contentHashPreviousStep: "0xe0c96f06853d17030fe9b01c48a4b389a2a3e64c0d90237dd12a3d76905df974",
delivrable: {
creator: {
legalName: "Modern Bureaucracy SAS",
email: "[email protected]",
country: "FR",
walletAddress: "5DXBoe8maXbydrgqiKX1PCY9PS19Kfaq59vrroiXp4se7MgU"
}
}
})Result: Step 2 completed, proof generated
complete_step({
targetAddress: "5DXBoe8maXbydrgqiKX1PCY9PS19Kfaq59vrroiXp4se7MgU",
contentHashPreviousStep: "0xcee46f0d...",
delivrable: {
rights: {
ownershipPercentage: 100,
license: "cc-by-nc",
commercialUse: false,
derivativeWorks: true
}
}
})Result:
- β Workflow completed
- β Final proof with complete copyright data
- β Blockchain verification available
- β EBSI-compatible W3C Verifiable Credential generated
check_proof({
proofPath: "/home/polycrate/projets/data/proof/brigite/proof_0x7519e725790fbdec11a7d82a963197e8a4208d22e87d7faa357769502b730459.json"
})Result: Full crypto trail validation against blockchain
βββββββββββββββββββββββββββββββββββββββββββββββββββ
β MCP Client (Claude, Cursor) β
ββββββββββββββββββββββ¬βββββββββββββββββββββββββββββ
β MCP Protocol
ββββββββββββββββββββββΌβββββββββββββββββββββββββββββ
β Human Context Protocol Server β
β ββββββββββββββββββββββββββββββββββββββββββββ β
β β Keyring (Ed25519 + X25519) β β
β ββββββββββββββββββββββββββββββββββββββββββββ β
β ββββββββββββββββββββββββββββββββββββββββββββ β
β β Helia/IPFS (Content Storage) β β
β ββββββββββββββββββββββββββββββββββββββββββββ β
β ββββββββββββββββββββββββββββββββββββββββββββ β
β β Substrate Client (Blockchain) β β
β ββββββββββββββββββββββββββββββββββββββββββββ β
β ββββββββββββββββββββββββββββββββββββββββββββ β
β β LevelDB (Local Storage) β β
β ββββββββββββββββββββββββββββββββββββββββββββ β
ββββββββββββββββββββββ¬βββββββββββββββββββββββββββββ
β
βββββββββββββββββΌββββββββββββββββ
β β β
ββββββΌββββββ ββββββββΌβββββββ ββββββΌβββββ
β IPFS β β RAG Chain β β Peers β
β Network β β Substrate β β (P2P) β
ββββββββββββ βββββββββββββββ βββββββββββ
- End-to-End Encryption: ChaCha20-Poly1305 with X25519 ECDH
- Perfect Forward Secrecy: Ephemeral keys per workflow step
- Blockchain Coordination: Immutable audit trail
- GDPR Compliance: Local execution, encrypted storage, user owns keys
- No Vendor Lock-in: Open source, self-hosted
npm run build # Compile TypeScript
npm run dev # Watch mode for developmentnpm run test-elicitation # Core elicitation tests
npm run test-elicitation-tool # MCP tool integration testshuman-context-protocol/
βββ src/
β βββ index.ts # Main MCP server entry point
β βββ keyring.ts # Cryptographic key management
β βββ helia-node.ts # IPFS/P2P networking
β βββ substrate.ts # Blockchain client
β βββ storage.ts # LevelDB persistence
β βββ crypto.ts # Encryption utilities
β βββ elicitation.ts # Maieutic elicitation logic
β βββ rag.ts # RAG workflow engine
β βββ proof.ts # Cryptographic proof generation
β βββ tools/ # MCP tool implementations
β βββ workflow.ts
β βββ elicitation.ts
β βββ rag.ts
β βββ ipfs.ts
β βββ pki.ts
β βββ proof.ts
β βββ system.ts
βββ build/ # Compiled JavaScript (auto-generated)
βββ LICENSE # GPL-3.0
βββ package.json
βββ tsconfig.json
βββ README.md
We welcome contributions! This project follows:
- Secure Development: Audited crypto libraries only
- Input Validation: All external data validated
- Error Handling: Comprehensive logging
- Code Quality: TypeScript strict mode
GNU General Public License v3.0
Copyright (C) 2025 Jean FranΓ§ois Meneust - Carge
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
See LICENSE for full details.
Author: Jean FranΓ§ois Meneust
Company: Carge
Email: [email protected]
Website: https://carge.fr
Built with:
- Model Context Protocol (MCP) - Anthropic
- Helia - IPFS implementation
- Substrate/Polkadot - Blockchain framework
- Noble Cryptography - Audited crypto primitives
Inspired by:
- Richard Stallman's Free Software philosophy (GPL-3.0)
- The EBSI initiative for EU digital infrastructure
- Modern Bureaucracy vision: "Code is law, bugs are the common enemy"