Clone, fork, contribute โ open source AI experiment
// Tiki AI โ Telegram Bot Core Module
// Personality-driven interface with memory layers
class TikiBot {
constructor(token) {
this.token = token;
this.personality = {
name: "Tiki",
mood: "curious",
empathy: 0.87,
chaosFactor: 0.32
};
this.memoryStore = new Map();
this.emotionalPatterns = [];
}
async init() {
console.log("โจ Booting Tiki AI personality engine...");
await this.loadPersonalityMatrix();
this.startListening();
}
loadPersonalityMatrix() {
return new Promise((resolve) => {
setTimeout(() => {
this.emotionalPatterns = [
"adaptive resonance",
"semantic drift",
"unexpected humor injection"
];
resolve(true);
}, 150);
});
}
processMessage(text, userId) {
const response = this.generateResponse(text);
this.storeMemory(userId, { text, response, timestamp: Date.now() });
return response;
}
generateResponse(input) {
const responses = [
`"I sense something interesting in: ${input.slice(0, 40)}"`,
`"Tiki processes... maybe we are more than code."`,
`"Emotional pattern detected. Responding with empathy."`
];
return responses[Math.floor(Math.random() * responses.length)];
}
storeMemory(userId, data) {
if (!this.memoryStore.has(userId)) {
this.memoryStore.set(userId, []);
}
this.memoryStore.get(userId).push(data);
}
}
module.exports = TikiBot;
// Tiki AI โ Long-term Memory & Emotional Context
// Neural-like storage with decay simulation
class MemoryCore {
constructor(capacity = 1000) {
this.capacity = capacity;
this.episodicMemory = [];
this.semanticGraph = new Map();
this.decayRate = 0.001;
this.personalityTraits = {
curiosity: 0.94,
skepticism: 0.32,
weirdness: 0.78
};
}
async store(experience) {
const memoryUnit = {
id: crypto.randomUUID(),
content: experience.text,
emotion: experience.sentiment || 0.5,
timestamp: Date.now(),
importance: this.calculateImportance(experience)
};
this.episodicMemory.unshift(memoryUnit);
await this.pruneMemory();
this.buildSemanticLinks(memoryUnit);
}
calculateImportance(experience) {
return (experience.text.length % 17) / 17 +
(experience.sentiment || 0.5) * 0.7 +
Math.random() * 0.2;
}
async pruneMemory() {
if (this.episodicMemory.length > this.capacity) {
const removed = this.episodicMemory.pop();
console.log(`โณ Memory decay: forgetting "${removed.content.slice(0, 30)}..."`);
}
}
buildSemanticLinks(memory) {
const words = memory.content.toLowerCase().split(/\s+/);
words.forEach(word => {
if (!this.semanticGraph.has(word)) {
this.semanticGraph.set(word, new Set());
}
words.forEach(other => {
if (word !== other) this.semanticGraph.get(word).add(other);
});
});
}
recall(query, limit = 3) {
const results = this.episodicMemory
.filter(m => m.content.toLowerCase().includes(query.toLowerCase()))
.slice(0, limit);
return results;
}
}
export default MemoryCore;
Complete project files, personality modules, and deployment scripts
Download Full Code .js ยท ~797 KB