AGISystem2 is a Hyperdimensional Reasoning Engine for neuro-symbolic AI. It represents concepts, facts, relations and rules as high-dimensional vectors and executes reasoning through a formally defined DSL with full explainability.

Key Features

Core Concepts

Hypervectors High-dimensional binary vectors (default 32,768 bits) representing concepts in geometric space. Operations: bind (XOR), bundle (majority), similarity (Hamming).
DSL Syntax Statements have form @dest operator arg1 arg2 ... or operator arg1 arg2 for anonymous facts.
HDC Strategies Pluggable implementations: dense-binary (default), with support for future strategies like sparse polynomial. Set via SYS2_HDC_STRATEGY env var.
Sessions Runtime contexts that load theories, accumulate facts in KB, and execute queries/proofs.
Theories Reusable .sys2 files with facts and rules. Core theories define taxonomy, logic, and modal operators.

HDC Strategy Architecture

┌─────────────────────────────────────────────────────────┐
│  Layer 4: Application (DSL, Session API)                │
│  ─────────────────────────────────────────────────────  │
│  Layer 3: Reasoning (Query, Prove, Rules)               │
│  ─────────────────────────────────────────────────────  │
│  Layer 2: HDC Operations Interface (bind, bundle, sim)  │  ← CONTRACT
│  ═══════════════════════════════════════════════════════│
│  Layer 1: HDC Implementation Strategy                   │  ← SWAPPABLE
│           ├── dense-binary (Uint32Array, XOR, majority) │
│           └── [future: sparse-polynomial, bigint, etc.] │
└─────────────────────────────────────────────────────────┘

Documentation Sections

Architecture

System layers: HDC core, runtime (Session, Executor), reasoning (Query, Prove), parser, and output generation.

Foundational Theory

Hyperdimensional computing principles: vector space algebra, bind/bundle operations, similarity metrics.

DSL Syntax

Language reference: statements, operators, macros, theories, and Core theory definitions.

APIs

Session API: learn(), query(), prove(), generateText(), elaborate(). HDC Facade: bind(), bundle(), similarity().

Specifications

Design specs (DS01-DS17), evaluation suites, and test coverage matrix.

Guides

Conceptual guides: geometric reasoning, theory layering, HDC strategies, LLM integration.

Quick Start

import { Session } from './src/runtime/session.mjs';

// Create session (loads Core theories automatically)
const session = new Session({ geometry: 32768 });

// Learn facts
session.learn(`
  isA Dog Animal
  isA Rex Dog
`);

// Query
const result = session.query('@q isA Rex ?what');
console.log(result.bindings.get('what').answer); // "Dog"

// Prove with transitive reasoning
const proof = session.prove('@goal isA Rex Animal');
console.log(proof.valid);  // true
console.log(proof.method); // "transitive_chain"

// Generate natural language
const text = session.generateText('isA', ['Rex', 'Animal']);
console.log(text); // "Rex is an animal."

DSL Syntax Quick Reference

FormIn ScopeIn KBUse Case
operator arg1 arg2 No Yes Simple facts (anonymous, auto-persisted)
@var operator arg1 arg2 Yes No Temporary variable (for references)
@var:name operator arg1 arg2 Yes Yes Named persistent fact

Building Complex Rules

Note: Parenthesized compound expressions are NOT supported. Complex rules are built by defining parts as separate statements, then referencing them:

# WRONG (not supported):
# @rule Implies (And $cond1 $cond2) $conclusion

# CORRECT:
@cond1 hasState Door Open
@cond2 isA Door Entrance
@combined And $cond1 $cond2
@conclusion canEnter Person Door
@rule Implies $combined $conclusion

Environment Variables

SYS2_HDC_STRATEGY HDC implementation to use. Default: dense-binary
SYS2_GEOMETRY Default vector geometry. Default: 32768 (must be divisible by 32)
SYS2_DEBUG Enable debug logging. Set to true for verbose output.

Benchmarking HDC Strategies

import { benchmarkStrategy, printBenchmark } from './src/hdc/facade.mjs';

const results = benchmarkStrategy('dense-binary', 8192, { iterations: 1000 });
printBenchmark(results);

// Output:
// === HDC Strategy Benchmark ===
// Strategy: dense-binary
// Geometry: 8192
// Operations:
// ────────────────────────────────────────
// bind           0.002 ms    650K ops/sec
// similarity     0.004 ms    250K ops/sec
// bundle         0.195 ms      5K ops/sec
// ────────────────────────────────────────

Specification Documents