Skip to content

sivaji1012/Primus

Repository files navigation

PRIMUS — Julia-Native AGI Substrate

PRIMUS is a high-performance AGI (Artificial General Intelligence) substrate built on Julia, implementing the MeTTa language and OpenCog Hyperon cognitive architecture.

Features

  • Full MeTTa evaluator — S-expression language with pattern matching, non-deterministic evaluation, and type checking
  • Cognitive algorithms — PLN, MOSES, ECAN, MetaMo, WILLIAM, TransWeave
  • Julia-native tensor operationst-add, t-matmul, t-reshape, metta-grad!
  • CLP(FD) constraints#+, #-, #*, #<, #>, #=
  • ECAN attentiondecimate-importance!, get-neighbors
  • EGraph equality saturationsaturate!, theory-size
  • HPC federationbroadcast!, hpc-map, federate!
  • Automatic differentiation — via Enzyme/Zygote

Quick Start

PRIMUS is a monorepo of 9 Julia packages under packages/. The bootstrap script handles the clean-clone workflow in one command.

# Clone
git clone https://github.com/Shivaji1012/PRIMUS.git
cd PRIMUS

# Bootstrap — idempotent, safe to re-run after `git pull`
./scripts/bootstrap.sh

Bootstrap walks all 9 packages, runs Pkg.develop + Pkg.instantiate + Pkg.precompile, seeds data/primus_state/, and verifies the substrate health gate (5/5). A re-run on a working install is a ~1-minute no-op (Julia cold-start overhead plus cache checks). First-time bootstrap is slower (~10-30 min) because deps compile from scratch.

Flags: --skip-health (CI bring-up), --quiet (terse), --force (re-instantiate even if Manifest is current), -h (help).

Post-install introspection

./bin/primus doctor            # human-readable repo status
./bin/primus doctor --json     # structured output for diff-over-time tooling
./bin/primus doctor --health   # also run the 5/5 health gate (slow)

Doctor reports julia version, PRIMUS version, git HEAD, per-package Project.toml + precompile cache status, data/primus_state/ presence, and server state. Read-only.

Update workflow

git pull
./scripts/bootstrap.sh         # re-runs against new Manifest if deps changed

No separate install.sh / uninstall.sh / update commands — the repo itself is the install (git clone = install, rm -rf PRIMUS/ = uninstall), and git pull && bootstrap is the update.

Hello MeTTa

; Define a function
(: factorial (-> Number Number))
(= (factorial 0) 1)
(= (factorial $n) (* $n (factorial (- $n 1))))

; Evaluate
!(factorial 5)  ; -> [120]

; Pattern matching
(parent Alice Bob)
(parent Bob Charlie)
!(match &self (parent Alice $child) $child)  ; -> [Bob]

; Tensor operations (PRIMUS-native)
!(t-matmul (tensor ((1 2) (3 4))) (tensor ((5 6) (7 8))))

Architecture

MeTTa Programs (.metta)
    |
PRIMUS_Core Evaluator
  MorkAdapter -> LogicBridge -> MM2Engine -> AxiomCompiler
    |
+---------+---------+-----------+
|  ECAN   |   PLN   |   MOSES   |
| Attn.   | Infer.  |  Evolve   |
+---------+---------+-----------+
    |
PRIMUS_Metagraph (MORK Storage)
  PathTrie - SplitStore - UnifiedSpace
    |
Julia Runtime (JIT + Enzyme)

Algorithm Maturity (92.5% overall)

Algorithm Maturity Status
Logic Core 95% Production Hardened
MOSES 95% Production Hardened
ECAN 95% Importance Stabilized
PLN 92% Canonical Logic Fuel
TransWeave 90% Production Ready

Evaluation Server

# Start the server (port 7701)
julia --project=. tools/metta_server.jl

# Evaluate via curl
curl -X POST http://localhost:7701/eval \
  -H "Content-Type: application/json" \
  -d '{"expr": "!(+ 1 2)"}'

VS Code Extension

Full MeTTa language support with Tree-sitter parsing, 241-builtin hover docs, and server-backed completions: vscode-metta

Documentation

Build the documentation site:

julia --project=docs docs/make.jl
# Open docs/build/index.html

Or browse the source docs in docs/src/.

Project Structure

PRIMUS/
  packages/           # Julia packages
    PRIMUS_Core/      # Main substrate (evaluator, runtime, cognitive engines)
    PRIMUS_Metagraph/ # MORK storage layer
    PRIMUS_Interfaces/# Shared interfaces
    PRIMUS_Neural/    # Neural-symbolic bridge
    PRIMUS_HPC/       # Distributed computing
    ...
  tests/              # Test suites
    integration/      # Health gate (5/5 required)
  docs/               # Documenter.jl site (47 pages)
  tools/              # Eval server, REPL, CLI
  examples/           # MeTTa example programs
  bin/                # PRIMUS CLI

Links

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages