Privacy-first, local-first AI with tripartite consensus and usage metering
usemeter is the usage metering, billing, and cost-tracking engine for the SuperInstance AI ecosystem. It provides high-performance event ingestion (10,000+ events/sec), flexible pricing models, budget alerting, and multi-backend storage. Designed as a standalone crate within the broader SuperInstance workspace, usemeter tracks API calls, token consumption, compute time, and bandwidthβtranslating raw usage into actionable billing data with millisecond query response times.
The parent workspace also hosts the full tripartite consensus AI system (Pathos, Logos, Ethos), the privox privacy proxy, knowledge-vault RAG engine, and cloud tunnel infrastructure.
SuperInstance AI is a revolutionary agentic AI system that prioritizes your privacy through local processing while enabling intelligent cloud escalation when needed. Unlike traditional AI chatbots, SuperInstance uses a tripartite consensus system where three specialized AI agentsβPathos, Logos, and Ethosβmust agree before responding.
Three specialized agents collaborate on every query:
- Pathos (Intent): "What does the user actually want?"
- Logos (Logic): "How do we accomplish this?"
- Ethos (Truth): "Is this safe, accurate, and feasible?"
No response is emitted until all three agents agree.
- π All sensitive data is tokenized before cloud processing
- π Local-first by defaultβyour data stays on your machine
- π 18 built-in redaction patterns (emails, API keys, credentials, etc.)
- π‘οΈ Local token vaultβmappings never leave your device
- π Automatic re-inflationβresponses restored locally
- β‘ Automatic hardware detection (CPU, GPU, RAM, disk)
- π― Intelligent model selection based on available resources
- π Local knowledge vault with RAG capabilities
- πΎ Works completely offline after initial setup
- π Optional cloud escalation for complex tasks (Phase 2)
- Rust 1.75+ (install via rustup)
- C compiler and OpenSSL headers
- 8GB RAM minimum (16GB recommended)
# Clone the repository
git clone https://github.com/SuperInstance/Tripartite1.git
cd Tripartite1
# Build release binary
cargo build --release
# Initialize the system
./target/release/synesis init
# Run your first query
./target/release/synesis ask "What is the capital of France?"Output:
π€ Pathos (Intent): User wants factual information about French geography
π§ Logos (Logic): Retrieving knowledge about capital cities...
β
Ethos (Truth): Verifying factual accuracy...
β
Consensus reached (0.95 confidence)
The capital of France is Paris.
---
Agents: 3/3 agreed | Confidence: 95% | Time: 2.3s
synesis ask "Explain how vector databases work"# Add your documents
synesis knowledge add ~/Documents/my-project/
# Query your codebase
synesis ask "How does the authentication system work?"# Adjust consensus threshold
synesis config set consensus.threshold 0.90
# Change model
synesis config set agents.pathos.model phi-3-minisynesis status
# Output:
# βββββββββββββββ¬βββββββββββββββββββ
# β Component β Status β
# βββββββββββββββΌβββββββββββββββββββ€
# β CPU β 16 cores @ 3.5GHzβ
# β GPU β NVIDIA RTX 4090 β
# β RAM β 32 GB β
# β Model β phi-3-mini β
# βββββββββββββββ΄βββββββββββββββββββUser Query
β
βΌ
βββββββββββββββββββββββββββββββββββββ
β Privacy Proxy β β Redact sensitive data
βββββββββββββββ¬ββββββββββββββββββββββ
β
βββββββββββββββΌββββββββββββββββββββββ
β Tripartite Council β
β ββββββββββ ββββββββββ βββββββββββ
β β Pathos β β Logos β β Ethos ββ β Three agents
β βββββ¬βββββ βββββ¬βββββ βββββ¬ββββββ
β βββββββββββββΌββββββββββββββββ
β β β
β ββββββββββΌβββββββββ β
β β Consensus Engine β β β Weighted voting
β ββββββββββ¬βββββββββ β
βββββββββββββββββββββΌββββββββββββββββ
β
βββββββββββ΄ββββββββββ
βΌ βΌ
Local Models Cloud Escalation
(phi-3, llama) (Claude, GPT-4)
β β
ββββββΌβββββ βββββββΌββββββ
βKnowledgeβ β QUIC β
β Vault β β Tunnel β
βββββββββββ βββββββββββββ
Learn More: ARCHITECTURE.md | Developer Guide
- Multi-agent deliberation: Each agent brings unique perspective
- Weighted voting: Not all agents equal (Ethos has veto power)
- Revision rounds: Agents negotiate if initial consensus is low
- Transparent: See how each agent contributed
- 18 redaction patterns: Emails, API keys, phone numbers, SSNs, etc.
- Token vault: Local SQLite database, never transmitted
- Re-inflation: Only happens locally on your device
- mTLS: All cloud communication uses mutual TLS (Phase 2)
- SQLite-VSS: Fast vector search on local documents
- Automatic chunking: Multiple strategies (paragraph, sentence, fixed)
- Semantic search: Find relevant information in your codebase
- Source citation: Responses include where information came from
- Parallel execution: Agents run concurrently (25-33% latency reduction)
- Hardware acceleration: GPU support (NVIDIA, AMD, Apple Silicon)
- Model caching: First query slower, subsequent queries fast
- Resource efficient: Works on 8GB RAM (16GB recommended)
- Getting Started Tutorial - Installation and first query
- Your First Query - Understanding the tripartite system
- Knowledge Vault Guide - Using RAG with your documents
- Privacy Basics - How privacy features work
- FAQ - Frequently asked questions
- Glossary - Terminology and concepts
- Developer Guide - Contribution and development workflow
- Architecture Deep Dive - System design and internals
- API Documentation - Rust API reference
- Examples - Runnable code examples
- Testing Guide - How to write tests
- Phase 1: Local Kernel β Complete
- Phase 2: Cloud Mesh π In Progress (33%)
- Phase 3: Marketplace - Planned
- Phase 4: Utility - Planned
# Query the AI
synesis ask "Your question here"
# Knowledge management
synesis knowledge add <path> # Add documents
synesis knowledge search "query" # Search vault
synesis knowledge stats # View statistics
# Configuration
synesis config list # List all settings
synesis config get <key> # Get setting
synesis config set <key> <value> # Change setting
# System information
synesis status # View system status
synesis metrics show # View performance metrics
# Model management
synesis model list # List available models
synesis model download <model> # Download a model
synesis model info <model> # Model details- Code understanding: "How does the authentication flow work?"
- Bug investigation: "Why is this function returning an error?"
- Code review: "What are the potential issues with this code?"
- Documentation: "Generate docs for this API endpoint"
- Literature review: "Summarize recent papers on vector databases"
- Concept explanation: "Explain Rust ownership with examples"
- Technical writing: "Write a technical description of this system"
- Content generation: "Write blog post about async Rust"
- Editing: "Improve clarity and flow of this paragraph"
- Ideation: "Brainstorm features for a mobile app"
- Learning: "Teach me about machine learning"
- Analysis: "Compare and contrast these two approaches"
- Decision making: "What are the trade-offs between SQL and NoSQL?"
- 8 GB RAM
- 10 GB disk space
- x86_64 or ARM64 CPU
- 16 GB RAM
- 4 GB VRAM (NVIDIA GPU)
- 25 GB disk space
- Ubuntu 22.04+ / macOS 12+ / Windows 10+
- 32 GB RAM
- 8 GB VRAM (NVIDIA RTX 3060+)
- NVMe storage
- Dedicated GPU (NVIDIA, AMD, or Apple Silicon)
- Version: v0.2.0
- Phase: Phase 1 (Local Kernel) β Complete | Phase 2 (Cloud Mesh) π 33% Complete
- Tests: 250+ passing (100%)
- Code Quality: Zero warnings (all library crates)
- Documentation: Comprehensive (70+ markdown files)
- β Tripartite council with three agents
- β Consensus engine with multi-round negotiation
- β Privacy proxy with 18 redaction patterns
- β Knowledge vault with RAG and semantic search
- β Hardware detection and model management
- β CLI with all commands
- β Comprehensive testing (250+ tests)
- β Zero compiler warnings
- π QUIC tunnel with mTLS (Sessions 2.1-2.2 complete)
- π Device telemetry and heartbeat (Session 2.3 complete)
- π Cloud escalation client (Session 2.4 in progress)
- β³ Billing integration (Session 2.6)
- β³ Cloudflare Workers deployment (Session 2.7)
We welcome contributions! SuperInstance is a community-driven project.
- π Improve documentation
- π§ͺ Add tests
- π Fix bugs
- β¨ Add features
See: CONTRIBUTING.md | Developer Guide
- Read Developer Guide
- Set up development environment
- Pick an issue or create one
- Fork and create a branch
- Make your changes
- Add tests and documentation
- Submit a pull request
| Metric | Local (CPU) | Local (GPU) | Cloud |
|---|---|---|---|
| First query | 5-8s | 3-5s | 2-3s |
| Subsequent | 2-3s | 1-2s | 1-2s |
| Memory usage | 4-8 GB | 6-12 GB | N/A |
| Privacy | 100% | 100% | Tokenized |
Benchmarks on: Intel i7-12700K, 32GB RAM, NVIDIA RTX 4090
- Tripartite consensus system
- Privacy proxy with redaction
- Knowledge vault with RAG
- Hardware detection
- CLI interface
- QUIC tunnel with mTLS
- Cloud escalation (Claude, GPT-4)
- Billing and metering
- LoRA hot-swap
- Collaborator system
- LoRA training
- Knowledge marketplace
- Model sharing
- Monetization
- SDKs (Python, JavaScript)
- Desktop application
- Mobile SDK
- Distributed mode
See: PROJECT_ROADMAP.md for details
SuperInstance is designed with privacy as a core principle:
- β Local processing by default: Your data never leaves your device
- β Tokenization before cloud: Sensitive info replaced with UUIDs
- β Local token vault: Mappings stored locally (SQLite)
- β mTLS encryption: All cloud communication encrypted (Phase 2)
- β Open source: Fully auditable codebase
Built-in patterns for:
- Email addresses
- API keys (GitHub, AWS, OpenAI, etc.)
- Phone numbers
- Social Security Numbers
- Credit card numbers
- Passwords
- IP addresses
- And 10 more...
# Run all tests
cargo test --workspace
# Run specific crate tests
cargo test -p synesis-core
cargo test -p synesis-knowledge
cargo test -p synesis-privacy
# Run with output
cargo test --workspace -- --nocapture
# Test coverage
cargo test --workspace --all-featuresTest Results: 250+ tests passing (100%)
Licensed under either of:
- MIT License (LICENSE-MIT)
- Apache License, Version 2.0 (LICENSE-APACHE)
at your option.
Built with amazing open-source projects:
- llama.cpp - Local LLM inference
- SQLite + SQLite-VSS - Vector database
- Tokio - Async runtime
- Quinn - QUIC implementation
- Cloudflare Workers - Edge compute (Phase 2)
- Documentation - Start here
- FAQ - Common questions
- Troubleshooting - Solve problems
- GitHub Issues - Report bugs
- GitHub Discussions - Ask questions
- GitHub: SuperInstance/Tripartite1
- Star β us if you find SuperInstance useful!
- Watch π to track progress
- Fork π΄ to contribute
SuperInstance AI - Your AI, your way, your privacy.
Version: 0.2.0 | Status: Production-Ready (Phase 1) | Tests: 250+ Passing β
Last Updated: 2026-01-07
Application / API Layer
β
βΌ
ββββββββββββββββββββ
β Event Ingestion β β Meter::record(event)
β (async, 10K+/s) β
ββββββββββ¬ββββββββββ
β
ββββββββββΌββββββββββ
β Aggregation β β hourly / daily / monthly windows
β Engine β β sum, avg, max, min, p99, count
ββββββββββ¬ββββββββββ
β
βββββββ΄βββββββ
βΌ βΌ
ββββββββ ββββββββββββ
β Queryβ β Billing β β PricingRule, PricingTier
β Layerβ β Engine β β Invoice generation
ββββ¬ββββ ββββββ¬ββββββ
β β
ββββΌβββββββββββββΌβββ
β Storage Backends β
β SQLite β File β
β (JSONL) β
βββββββββββββββββββββ
β
ββββββββββΌββββββββββ
β Reporting & β
β Alerting β β CSV/JSON reports, budget alerts
β Layer β
βββββββββββββββββββββ
βββββββββββββββ βββββββββββββββββ ββββββββββββββββββ
β privox ββββββΆβ synesis-core ββββββΆβ usemeter β
β (redaction)β β (tripartite β β (metering & β
β β β consensus) β β billing) β
βββββββββββββββ βββββββββ¬ββββββββ ββββββββββ¬ββββββββ
β β
βββββββββΌββββββββ βββββββββΌββββββββ
β knowledge- β β synesis- β
β vault-rs β β cloud β
β (RAG/VSS) β β (QUIC/bill) β
βββββββββββββββββ βββββββββββββββββ
# Add to Cargo.toml
[dependencies]
usemeter = { version = "0.1", features = ["sqlite", "csv-reports"] }use usemeter::{Meter, Event, StorageBackend};
use usemeter::storage::SqliteBackend;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let storage = SqliteBackend::new_in_memory()?;
let meter = Meter::new(storage);
meter.initialize().await?;
let event = Event::builder()
.event_type("api_call")
.user_id("user-123")
.metric("tokens", 1000)
.build()?;
meter.record(event).await?;
Ok(())
}- Event Tracking β High-volume async ingestion with flexible metric schemas
- Time Windows β Hourly, daily, monthly automatic bucketing
- Aggregation β Sum, average, max, min, count, percentile functions
- Billing Engine β Linear and tiered pricing with invoice generation
- Storage Backends β SQLite (embedded), JSONL file, extensible trait
- Report Generation β CSV and JSON export formats
- Alerting β Budget threshold monitoring and anomaly detection
- Zero-copy Metrics β Efficient in-memory aggregation with <10MB footprint
| Component | Integration Method | Purpose |
|---|---|---|
privox |
Feature flag with_privox |
Redact PII before metering |
synesis-core |
Event adapter | Track agent consensus events |
synesis-cloud |
Billing bridge | Cloud escalation cost tracking |
knowledge-vault-rs |
Query audit | RAG query billing |
tripartite-rs |
Consensus callback | Per-agent latency metering |
