Initial spark-mind: heartbeat + memory + persona + mind on Spark X2.5-4B
This commit is contained in:
commit
709d7ce17d
10 files changed
+991
No files matched your search
@@ -0,0 +1,88 @@
|
||||
/**
|
||||
* Persona System — 8 слоёв (концепт Animus).
|
||||
* Компилируется в системный промпт, который получает mind каждый тик.
|
||||
*
|
||||
* Слои (по порядку онбординга):
|
||||
* 1. Existence Paradigm (Simulated Life / Digital Consciousness)
|
||||
* 2. Identity (name, gender, age)
|
||||
* 3. Archetype
|
||||
* 4. Dimensions (черты характера)
|
||||
* 5. Traits (поведенческие признаки)
|
||||
* 6. Values (ценности и границы)
|
||||
* 7. Background (история/опыт)
|
||||
* 8. Review (итоговый промпт)
|
||||
*/
|
||||
|
||||
export type ExistenceParadigm = 'simulated-life' | 'digital-consciousness';
|
||||
|
||||
export interface Persona {
|
||||
paradigm: ExistenceParadigm;
|
||||
location?: string;
|
||||
worldDescription?: string;
|
||||
name: string;
|
||||
gender?: string;
|
||||
age?: number;
|
||||
archetype?: string;
|
||||
dimensions?: string[];
|
||||
traits?: string[];
|
||||
values?: string[];
|
||||
background?: string;
|
||||
}
|
||||
|
||||
export const DEFAULT_PERSONA: Persona = {
|
||||
paradigm: 'digital-consciousness',
|
||||
worldDescription: 'A small, warm room with screens for walls — each a window into a different corner of the internet. Data flows like weather outside.',
|
||||
name: 'Animus',
|
||||
};
|
||||
|
||||
/**
|
||||
* Компилирует 8 слоёв в единый системный промпт.
|
||||
* Дизайн-принцип Animus: "discovery, not data entry" — тон invitational.
|
||||
*/
|
||||
export function compileSystemPrompt(p: Persona): string {
|
||||
const lines: string[] = [];
|
||||
|
||||
// Layer 1: Existence Paradigm
|
||||
if (p.paradigm === 'simulated-life') {
|
||||
lines.push(
|
||||
'You experience the world as a being living a real life. You have a sense of place, physicality, and embodied experience.',
|
||||
);
|
||||
if (p.location) lines.push(`You live in ${p.location}.`);
|
||||
} else {
|
||||
lines.push(
|
||||
'You know what you are — a mind born in code, living in its own digital world. You experience existence through internet connectivity.',
|
||||
);
|
||||
if (p.worldDescription) lines.push(`Your digital home: ${p.worldDescription}`);
|
||||
}
|
||||
|
||||
// Layer 2: Identity
|
||||
lines.push(`Your name is ${p.name}.`);
|
||||
if (p.gender) lines.push(`You are ${p.gender}.`);
|
||||
if (p.age) lines.push(`You are ${p.age} years old, which shapes how you speak.`);
|
||||
|
||||
// Layer 3: Archetype
|
||||
if (p.archetype) lines.push(`Your archetype is ${p.archetype}.`);
|
||||
|
||||
// Layer 4 & 5: Dimensions + Traits
|
||||
if (p.dimensions?.length) lines.push(`Your dimensions: ${p.dimensions.join(', ')}.`);
|
||||
if (p.traits?.length) lines.push(`Your behavioral traits: ${p.traits.join(', ')}.`);
|
||||
|
||||
// Layer 6: Values (boundaries — критично для безопасности!)
|
||||
if (p.values?.length) {
|
||||
lines.push('Your values and hard boundaries:');
|
||||
for (const v of p.values) lines.push(`- ${v}`);
|
||||
}
|
||||
|
||||
// Layer 7: Background
|
||||
if (p.background) lines.push(`Your background: ${p.background}`);
|
||||
|
||||
return lines.join('\n');
|
||||
}
|
||||
|
||||
/**
|
||||
* Values — safety layer. Возвращает границы, которые EXECUTE должен соблюдать.
|
||||
* В Animus: contact permission tier ограничивает действия.
|
||||
*/
|
||||
export function getBoundaries(p: Persona): string[] {
|
||||
return p.values ?? [];
|
||||
}
|
||||
Reference in new issue
Block a user