Initial spark-mind: heartbeat + memory + persona + mind on Spark X2.5-4B

This commit is contained in:
n1kt4r committed 2026-09-09 22:16:29 +05:00
commit 709d7ce17d
10 files changed
+991

No files matched your search

+37
View File
@@ -0,0 +1,37 @@
/**
* Spark Mind — MVP self-hosted автономного агента.
*
* Концепт позаимствован из Animus (Craigtut): heartbeat, 4 слоя памяти,
* persona в 8 слоёв. Движок — Spark X2.5-4B (локально, self-hosted).
*
* Структура:
* heartbeat.ts — ядро: 5 триггеров тика, состояния Cold/Warm
* memory.ts — 4 слоя памяти (short/working/core self/long-term)
* persona.ts — 8 слоёв → системный промпт
* mind.ts — оркестратор: heartbeat + memory + persona + Spark LLM
*/
import { Heartbeat, DEFAULT_CONFIG } from './src/heartbeat.js';
import { MemorySystem } from './src/memory.js';
import { DEFAULT_PERSONA } from './src/persona.js';
import { Mind, SparkLLMClient } from './src/mind.js';
const HEARTBEAT_MS = 5 * 60 * 1000; // 5 мин — idle-мысли
const heartbeat = new Heartbeat({ intervalMs: HEARTBEAT_MS });
const memory = new MemorySystem(10); // last 10 thoughts
const mind = new Mind(
heartbeat,
memory,
DEFAULT_PERSONA,
new SparkLLMClient('http://localhost:11434'), // Ollama: Spark X2.5-4B
);
// Старт heartbeat
heartbeat.start();
console.log('[spark-mind] started — heartbeat every', HEARTBEAT_MS / 1000, 's');
// Демо: симулируем тик через 10 сек (в прода — реальные триггеры)
setTimeout(() => {
void mind.handleTick({ type: 'interval' });
}, 10_000);