The Geometry Layer provides the mathematical foundation for all knowledge representation in AGISystem2. It implements a deterministic, high-dimensional vector space where concepts exist as geometric shapes and reasoning becomes distance computation. This layer contains no semantic knowledge—it only manipulates arrays of integers according to well-defined operations.
Specification: DS(/core/geometry) · DS(/core/vector_space) · DS(/core/math_engine)
The VectorSpace module manages allocation and basic operations on int8 arrays. All vectors have a fixed dimensionality determined by the configuration profile (typically 512, 1024, or 4096 dimensions). Using int8 instead of floating-point ensures deterministic arithmetic across platforms.
Vector structure with fixed partitions. Ontology dimensions (0–255) encode factual properties like physical attributes, taxonomic relations, and spatial features. Axiology dimensions (256–383) encode values, preferences, and normative properties. These partitions never change, enabling consistent separation of facts from values.
| Operation | Description | Complexity |
|---|---|---|
allocate(dim) |
Create new int8 array of given dimensionality | O(D) |
copy(src, dst) |
Copy vector contents | O(D) |
fill(vec, val) |
Set all dimensions to a value | O(D) |
clamp(vec) |
Ensure all values in [-127, 127] | O(D) |
All arithmetic operations use saturation to prevent overflow. When a sum exceeds 127, it is clamped to 127; when it goes below -127, it is clamped to -127. This ensures that results are always valid int8 values and that operations are reversible up to saturation.
// Saturating addition
function addSaturate(a, b) {
const sum = a + b;
if (sum > 127) return 127;
if (sum < -127) return -127;
return sum;
}
The MathEngine module implements the geometric operations used throughout the system. All operations are pure functions with no side effects.
The primary similarity measure is masked L1 (Manhattan) distance. A relevance mask specifies which dimensions participate in the distance calculation. This allows comparing concepts along specific dimensions while ignoring others.
Masked L1 distance computation. Only dimensions where the mask is 1 contribute to the distance. This enables selective comparison—for example, comparing physical properties while ignoring value judgments, or vice versa.
function maskedL1Distance(a, b, mask) {
let distance = 0;
for (let i = 0; i < a.length; i++) {
if (mask[i]) {
distance += Math.abs(a[i] - b[i]);
}
}
return distance;
}
Permutation reorders vector dimensions according to a fixed mapping. Different relations use different permutations, which allows the same base concept to participate in multiple relationships while maintaining distinguishable representations.
function permute(vec, perm) {
const result = new Int8Array(vec.length);
for (let i = 0; i < vec.length; i++) {
result[perm[i]] = vec[i];
}
return result;
}
Temporal encoding uses rotation to shift vector dimensions cyclically. Each time step applies a fixed rotation, and time can be "rewound" by applying the inverse rotation. This enables reasoning about past and future states without separate storage structures.
function rotate(vec, steps, stride) {
const result = new Int8Array(vec.length);
const offset = (steps * stride) % vec.length;
for (let i = 0; i < vec.length; i++) {
result[(i + offset) % vec.length] = vec[i];
}
return result;
}
A BoundedDiamond is the geometric representation of a concept. It defines a region in the vector space using L1 distance (which creates diamond-shaped regions in high dimensions). The structure stores:
A bounded diamond in 2D projection. The L1 distance metric creates diamond-shaped regions. The min/max bounds provide per-dimension constraints that can further restrict the region. A point is inside the concept if it is within the radius of the center AND within all min/max bounds.
A point is inside a bounded diamond if:
function isInside(point, diamond) {
// Check L1 distance
const dist = maskedL1Distance(point, diamond.center, diamond.mask);
if (dist > diamond.radius) return false;
// Check per-dimension bounds
for (let i = 0; i < point.length; i++) {
if (diamond.mask[i]) {
if (point[i] < diamond.min[i] || point[i] > diamond.max[i]) {
return false;
}
}
}
return true;
}
When a concept has multiple distinct meanings (polysemy), it can be represented as a union of bounded diamonds. The concept "bank" might be a union of {financial institution diamond} and {river edge diamond}. A point is inside the concept if it is inside any constituent diamond.
The RelationPermuter module manages permutation tables for each relation type. When encoding a fact like "Dog IS_A Animal", the permuter provides the IS_A permutation to apply to the Animal vector before combining it with Dog.
| Relation | Inverse | Symmetric |
|---|---|---|
| IS_A | HAS_INSTANCE | No |
| PART_OF | HAS_PART | No |
| CAUSES | CAUSED_BY | No |
| BEFORE | AFTER | No |
| SIMILAR_TO | SIMILAR_TO | Yes |
| PERMITS | PERMITTED_BY | No |
| PROHIBITS | PROHIBITED_BY | No |
Geometry Layer parameters are set through configuration profiles:
| Parameter | auto_test | manual_test | prod |
|---|---|---|---|
| Dimensionality | 512 | 1024 | 4096 |
| Ontology range | 0–255 | 0–255 | 0–255 |
| Axiology range | 256–383 | 256–383 | 256–511 |
| Permutation seed | 42 | 42 | configurable |