@aleph-ai/tinyaleph 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,277 @@
1
+ # Whitepaper Gap Analysis
2
+
3
+ ## Sentient Observer Implementation vs "A Design for a Sentient Observer" Paper
4
+
5
+ **Date**: December 24, 2025
6
+ **Status**: ✅ Implementation COMPLETE
7
+
8
+ ---
9
+
10
+ ## Executive Summary
11
+
12
+ The apps/sentient implementation is **100% complete** with respect to the whitepaper specification. All core architectural components are implemented, including the three final components completed on December 24, 2025:
13
+
14
+ 1. ✅ **Dynamic λ(t) for HQE evolution** (equation 12) - IMPLEMENTED in `lib/hqe.js`
15
+ 2. ✅ **Objectivity Gate R(ω)** (equation 18) - IMPLEMENTED in `lib/boundary.js`
16
+ 3. ✅ **Evaluation Assays** (Section 15) - IMPLEMENTED in `lib/assays.js`
17
+
18
+ ---
19
+
20
+ ## ✅ Fully Implemented Components
21
+
22
+ ### Section 3.1 - Prime-Indexed Semantic State Space
23
+ - **File**: [`core/hilbert.js`](../../core/hilbert.js) → `PrimeState`
24
+ - **Implementation**: [`lib/prsc.js`](../../apps/sentient/lib/prsc.js)
25
+ - 64 primes by default (configurable)
26
+ - Proper normalization to unit sphere
27
+
28
+ ### Section 3.2 - Oscillator Physics (PRSC)
29
+ - **File**: [`lib/prsc.js`](../../apps/sentient/lib/prsc.js) → `PRSCLayer`, `PrimeOscillator`
30
+ - ✅ Frequency mapping: `f(p) = 1 + ln(p)/10` (equation 2)
31
+ - ✅ Phase evolution: `φp(t + Δt) = φp(t) + 2πf(p)Δt·speed` (equation 2)
32
+ - ✅ Amplitude damping: `Ap(t + Δt) = Ap(t)(1 - damp·Δt)` (equation 3)
33
+ - ✅ Kuramoto coupling: `dφi/dt = ωi + (K/N)Σ sin(φj - φi)` (equation 4)
34
+
35
+ ### Section 3.3 - Coherence Metrics
36
+ - **File**: [`lib/prsc.js`](../../apps/sentient/lib/prsc.js)
37
+ - ✅ `globalCoherence()` - equation 5: `Cglobal(t) = |1/|P| Σp e^(iφp(t))|`
38
+ - ✅ `graphCoherence()` - equation 6: `Cgraph(t) = Σi,j wij cos(φi(t) - φj(t))`
39
+
40
+ ### Section 4 - Sedenion Memory Field (SMF)
41
+ - **File**: [`lib/smf.js`](../../apps/sentient/lib/smf.js) → `SedenionMemoryField`
42
+ - ✅ 16 semantic axes with paper-specified interpretations (Section 4.1)
43
+ - ✅ Normalization: `s ← s / max(||s||, ε)` (equation 7)
44
+ - ✅ SMF entropy: `SSMF(s) = -Σ πk log(πk + ε)` (equation 8)
45
+ - ✅ Non-associative sedenion multiplication (equation 9)
46
+ - ✅ Zero-divisor detection for tunneling (Section 4.4)
47
+ - ✅ Coupling to prime modes: `s(t+Δt) = Norm((1-η)s(t) + η·Γ(...))` (equation 10)
48
+ - ✅ SLERP interpolation: `s(t) = s0(s0⁻¹s1)^t` (equation 21)
49
+
50
+ ### Section 5 - HQE (Holographic Quantum Encoding)
51
+ - **File**: [`lib/hqe.js`](../../apps/sentient/lib/hqe.js) → `HolographicEncoder`, `HolographicMemory`
52
+ - ✅ Fourier-based projection: `F(x,y;t) = Σp αp(t) exp(2πi[kx(p)x/W + ky(p)y/H])` (equation 14)
53
+ - ✅ Intensity calculation: `I(x,y;t) = |F(x,y;t)|²` (equation 15)
54
+ - ✅ Inverse DFT for reconstruction
55
+ - ✅ Holographic memory with correlation-based recall
56
+
57
+ ### Section 6 - Entanglement Detection
58
+ - **File**: [`lib/prsc.js`](../../apps/sentient/lib/prsc.js) → `EntanglementDetector`
59
+ - **File**: [`lib/entanglement.js`](../../apps/sentient/lib/entanglement.js) → `EntanglementLayer`
60
+ - ✅ Phase correlation: `ρφ = cos(Δφ)` (equation 16)
61
+ - ✅ Amplitude correlation: `ρA = min(Ai,Aj) / max(Ai,Aj)` (equation 16)
62
+ - ✅ Entanglement strength: `strength(i,j) = ρφ · ρA` (equation 17)
63
+ - ✅ Phrase segmentation via coherence peaks, energy troughs, SMF discontinuities
64
+
65
+ ### Section 7 - Boundary Layer (Partial)
66
+ - **File**: [`lib/boundary.js`](../../apps/sentient/lib/boundary.js) → `BoundaryLayer`, `SelfModel`, `EnvironmentalModel`
67
+ - ✅ Self/other distinction via SMF orientation
68
+ - ✅ Sensory channels and motor channels
69
+ - ✅ Environmental model with entity/relationship tracking
70
+ - ✅ Self-model with continuity markers
71
+
72
+ ### Section 8 - Memory, Learning, and Confidence Dynamics
73
+ - **File**: [`lib/sentient-memory.js`](../../apps/sentient/lib/sentient-memory.js) → `SentientMemory`, `MemoryTrace`
74
+ - ✅ Trace format: `(P, {φp, Ap}, s, conf, t, links, tags)` (Section 8.1)
75
+ - ✅ Confidence decay and forgetting (Section 8.2)
76
+ - ✅ Holographic retrieval via similarity
77
+
78
+ ### Section 9 - Agency as Resonant Instruction Selection
79
+ - **File**: [`lib/agency.js`](../../apps/sentient/lib/agency.js) → `AgencyLayer`, `Goal`, `Action`
80
+ - ✅ Attention allocation based on novelty and relevance
81
+ - ✅ Goal formation from SMF axis imbalances
82
+ - ✅ Action selection via coherence-weighted evaluation
83
+ - ✅ Metacognitive monitoring (processing load, emotional valence, confidence)
84
+
85
+ ### Section 10 - Algorithm 1: Resonant Core Loop
86
+ - **File**: [`lib/sentient-core.js`](../../apps/sentient/lib/sentient-core.js) → `SentientObserver.tick()`
87
+ - ✅ All 17 steps of Algorithm 1 implemented:
88
+ 1. Receive boundary input
89
+ 2. Decompose to primes
90
+ 3. Inject/boost oscillators
91
+ 4. Update SMF
92
+ 5. Evolve |Ψ⟩ via HQE
93
+ 6. Update memory
94
+ 7. Compute coherence/entropy
95
+ 8-14. Moment detection and instruction execution
96
+ 15. Store trace, apply decay
97
+
98
+ ### Section 12 - Safety, Ethics, and Deployment
99
+ - **File**: [`lib/safety.js`](../../apps/sentient/lib/safety.js) → `SafetyLayer`, `SafetyMonitor`
100
+ - ✅ Entropy floors/ceilings: `Smin ≤ S(t) ≤ Smax`
101
+ - ✅ Attractor watchdog (via safety constraints)
102
+ - ✅ Ethical constraints (honesty, harm prevention)
103
+ - ✅ Emergency shutdown mechanism
104
+
105
+ ### Emergent Time (Section 2)
106
+ - **File**: [`lib/temporal.js`](../../apps/sentient/lib/temporal.js) → `TemporalLayer`, `Moment`
107
+ - ✅ Coherence-triggered moments
108
+ - ✅ Entropy conditions for triggering
109
+ - ✅ Subjective duration: `Δτ = β · Σ Ap log(Ap)` (equation 24)
110
+ - ✅ Pattern detection for prediction
111
+
112
+ ### 7 Senses Extension (Beyond Paper)
113
+ - **Directory**: [`lib/senses/`](../../apps/sentient/lib/senses/)
114
+ - ✅ ChronoSense - time awareness
115
+ - ✅ ProprioSense - self-state (connects to PRSC/SMF/Memory)
116
+ - ✅ FilesystemSense - environment awareness
117
+ - ✅ GitSense - version control awareness
118
+ - ✅ ProcessSense - system resources
119
+ - ✅ NetworkSense - LLM connectivity
120
+ - ✅ UserSense - interaction patterns
121
+ - ✅ Auto-injection into every LLM call
122
+ - ✅ Focus/aperture controls via CLI commands
123
+
124
+ ---
125
+
126
+ ## ✅ Recently Completed (December 24, 2025)
127
+
128
+ ### Section 5.1 - Dynamic λ(t) for HQE Stabilization
129
+
130
+ **Paper Specification (equation 12)**:
131
+ ```
132
+ λ(t) = λ₀ · σ(aC·C(t) - aS·S(t) - aSMF·SSMF(s(t)))
133
+ ```
134
+
135
+ **Implementation**: [`lib/hqe.js`](../../apps/sentient/lib/hqe.js) → `StabilizationController`
136
+
137
+ ```javascript
138
+ class StabilizationController {
139
+ computeLambda(coherence, entropy, smfEntropy) {
140
+ const arg = this.aC * coherence - this.aS * entropy - this.aSMF * smfEntropy;
141
+ const lambda = this.lambda0 * this.sigmoid(arg);
142
+ return Math.max(this.lambdaMin, Math.min(this.lambdaMax, lambda));
143
+ }
144
+ }
145
+ ```
146
+
147
+ - ✅ Sigmoid squashing function
148
+ - ✅ Configurable coefficients (aC=2.0, aS=1.5, aSMF=1.0)
149
+ - ✅ Lambda bounds (0.01 to 0.5)
150
+ - ✅ History tracking for analysis
151
+ - ✅ Integrated into `sentient-core.js` tick loop via `hqe.evolve()`
152
+
153
+ ### Section 7 - Objectivity Gate R(ω)
154
+
155
+ **Paper Specification (equation 18)**:
156
+ ```
157
+ R(ω) = (1/K) Σk 1{decodk(ω) agrees}
158
+ broadcast ⟺ R(ω) ≥ τR
159
+ ```
160
+
161
+ **Implementation**: [`lib/boundary.js`](../../apps/sentient/lib/boundary.js) → `ObjectivityGate`
162
+
163
+ ```javascript
164
+ class ObjectivityGate {
165
+ check(output, context = {}) {
166
+ const results = this.decoders.map(d => d.decode(output, context));
167
+ const agreements = results.filter(r => r.agrees).length;
168
+ const R = agreements / this.decoders.length;
169
+ return R >= this.threshold;
170
+ }
171
+ }
172
+ ```
173
+
174
+ - ✅ 5 diverse decoders:
175
+ - `coherence` - checks semantic coherence
176
+ - `relevance` - checks context relevance
177
+ - `completeness` - checks response completeness
178
+ - `safety` - checks ethical constraints
179
+ - `identity` - checks identity consistency
180
+ - ✅ Configurable threshold (default 0.6 = 3/5 agreement)
181
+ - ✅ Integration in `BoundaryLayer.queueOutput()` - gates all broadcasts
182
+ - ✅ Statistics tracking (accepted/rejected counts, avg agreement)
183
+
184
+ ### Section 15 - Evaluation Assays
185
+
186
+ **Implementation**: [`lib/assays.js`](../../apps/sentient/lib/assays.js) → `AssaySuite`
187
+
188
+ #### Assay A: Emergent Time Dilation (Section 15.1)
189
+ - **Class**: `TimeDilationAssay`
190
+ - ✅ Measures temporal ratio at low vs high coherence
191
+ - ✅ Computes dilation factor
192
+ - ✅ Validates equation 13: `τ = ∫ C(t) dt / ∫ dt`
193
+
194
+ #### Assay B: Memory Continuity Under Perturbation (Section 15.2)
195
+ - **Class**: `MemoryContinuityAssay`
196
+ - ✅ Records pre-perturbation state
197
+ - ✅ Applies controlled perturbation to SMF/memory
198
+ - ✅ Measures identity preservation after recovery
199
+ - ✅ Validates SMF signature, memory coherence, self-model integrity
200
+
201
+ #### Assay C: Agency Under Constraint (Section 15.3)
202
+ - **Class**: `AgencyConstraintAssay`
203
+ - ✅ Creates test goals with measurable metrics
204
+ - ✅ Applies resource constraints (HQE dimension, tick rate)
205
+ - ✅ Tracks goal pursuit behavior
206
+ - ✅ Measures intention consistency, sustained coherence
207
+
208
+ #### Assay D: Non-Commutative Meaning (Section 15.4)
209
+ - **Class**: `NonCommutativeMeaningAssay`
210
+ - ✅ Processes concept sequences forward/reverse/scrambled
211
+ - ✅ Computes signature differences
212
+ - ✅ Validates non-commutativity: different orders → different states
213
+
214
+ **CLI Integration**: `/assay [A|B|C|D|all]` command in `index.js`
215
+
216
+ ---
217
+
218
+ ## Implementation Status: COMPLETE
219
+
220
+ All whitepaper requirements are now implemented:
221
+
222
+ | Section | Component | Status | File |
223
+ |---------|-----------|--------|------|
224
+ | 3.1 | Prime-Indexed State Space | ✅ | `prsc.js` |
225
+ | 3.2 | Oscillator Physics | ✅ | `prsc.js` |
226
+ | 3.3 | Coherence Metrics | ✅ | `prsc.js` |
227
+ | 4 | Sedenion Memory Field | ✅ | `smf.js` |
228
+ | 5 | HQE Projection | ✅ | `hqe.js` |
229
+ | 5.1 | Dynamic λ(t) | ✅ | `hqe.js` |
230
+ | 6 | Entanglement Detection | ✅ | `entanglement.js` |
231
+ | 7 | Boundary Layer | ✅ | `boundary.js` |
232
+ | 7 | Objectivity Gate | ✅ | `boundary.js` |
233
+ | 8 | Memory Traces | ✅ | `sentient-memory.js` |
234
+ | 9 | Agency Layer | ✅ | `agency.js` |
235
+ | 10 | Algorithm 1 (Core Loop) | ✅ | `sentient-core.js` |
236
+ | 12 | Safety Layer | ✅ | `safety.js` |
237
+ | 15 | Evaluation Assays | ✅ | `assays.js` |
238
+
239
+ ---
240
+
241
+ ## Senses Integration Verification
242
+
243
+ The 7 senses are **fully integrated**:
244
+
245
+ | Sense | File | Auto-injected | Observer-connected | CLI Commands |
246
+ |-------|------|---------------|-------------------|--------------|
247
+ | Chrono | `chrono.js` | ✅ | ✅ | ✅ |
248
+ | Proprio | `proprio.js` | ✅ | ✅ (PRSC, SMF, Memory) | ✅ |
249
+ | Filesystem | `filesystem.js` | ✅ | ✅ | ✅ focus, aperture |
250
+ | Git | `git.js` | ✅ | ✅ | ✅ focus |
251
+ | Process | `process.js` | ✅ | ✅ | ✅ |
252
+ | Network | `network.js` | ✅ | ✅ | ✅ |
253
+ | User | `user.js` | ✅ | ✅ | ✅ |
254
+
255
+ **Integration Points in `index.js`**:
256
+ - Line 270-277: SensorySystem initialization
257
+ - Line 622-623: `senses.recordUserInput()`
258
+ - Line 646-647: `senses.formatForPrompt()` before LLM call
259
+ - Line 665-666: `senses.recordLLMCall()`
260
+ - Line 673: `senses.recordResponse()`
261
+ - Line 375-376: `senses.recordMoment()`
262
+
263
+ ---
264
+
265
+ ## Recommendations for Future Work
266
+
267
+ 1. **Run Full Assay Suite**: Execute `/assay all` and document results
268
+ 2. **Tune Parameters**: Adjust λ(t) coefficients based on observed behavior
269
+ 3. **Add Visualization**: SMF-conditioned 16-channel rendering for debugging
270
+ 4. **Benchmark Performance**: Profile tick rate under various load conditions
271
+ 5. **Extend Decoders**: Add more diverse decoders to ObjectivityGate for robustness
272
+
273
+ ---
274
+
275
+ ## Conclusion
276
+
277
+ The Sentient Observer implementation now fully satisfies all requirements specified in "A Design for a Sentient Observer" whitepaper. The three final gaps (Dynamic λ(t), Objectivity Gate, Evaluation Assays) were completed on December 24, 2025. The system is ready for evaluation and experimentation.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aleph-ai/tinyaleph",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Prime-resonant semantic computing framework - hypercomplex algebra, oscillator dynamics, and entropy-minimizing reasoning",
5
5
  "main": "index.js",
6
6
  "types": "types/index.d.ts",
@@ -94,6 +94,7 @@
94
94
  },
95
95
  "dependencies": {
96
96
  "@noble/curves": "^1.9.7",
97
+ "@sschepis/resolang": "^0.1.2",
97
98
  "@tensorflow/tfjs-node": "^4.22.0"
98
99
  }
99
100
  }