Skip to main content

Quick Start

Get up and running with Trinity in 5 minutes.

Prerequisites

  • Zig 0.15.xDownload
  • Git — Version control

Installation

# Clone the repository
git clone https://github.com/gHashTag/trinity.git
cd trinity

# Verify Zig version
zig version # Should show 0.15.x

# Build
zig build

Run Your First Example

# Run VSA example
zig run examples/memory.zig

Basic VSA Operations

const vsa = @import("vsa.zig");

// Create random vectors
var a = vsa.HybridBigInt.random(1000);
var b = vsa.HybridBigInt.random(1000);

// Bind vectors (create association)
var bound = vsa.bind(&a, &b);

// Check similarity
const similarity = vsa.cosineSimilarity(&a, &bound);

Run Tests

# All tests
zig build test

# Specific module
zig test src/vsa.zig

TRI CLI

The unified command-line interface for the entire Trinity ecosystem. See the full TRI CLI Reference for 190+ commands.

# Build and run TRI CLI (interactive REPL)
zig build tri

# Generate code from specification
zig build tri -- gen specs/tri/module.vibee

# Chat with AI
zig build tri -- chat "Explain ternary computing"

# System health check
zig build tri -- doctor

# Sacred math verification (38 checks)
zig build tri -- math-verify

# Full autonomous health report
zig build tri -- full-autonomous

Try It Now

No installation needed — experiment with ternary vectors in your browser:

Live Editor
function TernaryDemo() {
  const [dim, setDim] = React.useState(8);

  // Generate random ternary vector {-1, 0, +1}
  const randomTernary = (n) =>
    Array.from({length: n}, () => Math.floor(Math.random() * 3) - 1);

  const [vecA, setVecA] = React.useState(randomTernary(8));
  const [vecB, setVecB] = React.useState(randomTernary(8));

  const regenerate = () => {
    setVecA(randomTernary(dim));
    setVecB(randomTernary(dim));
  };

  // VSA operations
  const bind = (a, b) => a.map((v, i) => v * b[i]);
  const similarity = (a, b) => {
    const dot = a.reduce((s, v, i) => s + v * b[i], 0);
    return dot / Math.sqrt(a.length);
  };

  const bound = bind(vecA, vecB);
  const sim = similarity(vecA, vecB).toFixed(3);

  return (
    <div style={{fontFamily: 'monospace'}}>
      <button onClick={regenerate}>Generate New Vectors</button>
      <div style={{marginTop: '1rem'}}>
        <div><b>A:</b> [{vecA.join(', ')}]</div>
        <div><b>B:</b> [{vecB.join(', ')}]</div>
        <div><b>bind(A,B):</b> [{bound.join(', ')}]</div>
        <div><b>similarity:</b> {sim}</div>
      </div>
    </div>
  );
}
Result
Loading...

Next Steps