thoughtmcp
Version:
AI that thinks more like humans do - MCP server with human-like cognitive architecture for enhanced reasoning, memory, and self-monitoring
82 lines • 2.56 kB
TypeScript
/**
* Semantic Memory System
*
* Implements embedding-based similarity search for semantic memories.
* Handles storage, retrieval, and relationship management of concepts.
*/
import { ComponentStatus, ISemanticMemory } from "../interfaces/cognitive.js";
import { Concept, Relation } from "../types/core.js";
export interface SemanticMemoryConfig {
capacity: number;
embedding_dim: number;
similarity_threshold: number;
activation_decay: number;
relation_strength_threshold: number;
max_relations_per_concept: number;
}
export declare class SemanticMemory implements ISemanticMemory {
private concepts;
private relations;
private embeddingIndex;
private activationIndex;
private config;
private initialized;
private lastActivity;
constructor(config?: Partial<SemanticMemoryConfig>);
initialize(config?: Partial<SemanticMemoryConfig>): Promise<void>;
process(input: unknown): Promise<unknown>;
reset(): void;
getStatus(): ComponentStatus;
/**
* Store a concept in semantic memory
*/
store(concept: Concept): string;
/**
* Retrieve concepts based on similarity to cue
*/
retrieve(cue: string, threshold?: number): Concept[];
/**
* Add a relation between two concepts
*/
addRelation(from: string, to: string, type: string, strength: number): void;
/**
* Get concepts related to a given concept
*/
getRelated(conceptId: string): Concept[];
/**
* Update activation level of a concept
*/
updateActivation(conceptId: string, delta: number): void;
/**
* Apply activation decay to all concepts
*/
applyDecay(): void;
/**
* Find concepts by content similarity
*/
findSimilarConcepts(conceptId: string, maxResults?: number): Concept[];
/**
* Get concept by ID
*/
getConcept(conceptId: string): Concept | undefined;
/**
* Get all concepts with activation above threshold
*/
getActiveConcepts(threshold?: number): Concept[];
/**
* Get relations of a specific type
*/
getRelationsByType(type: string): Relation[];
private generateConceptId;
private generateEmbedding;
private computeCosineSimilarity;
private addRelationToConcept;
private removeWeakestRelation;
private pruneLeastActiveConcepts;
private removeConcept;
/**
* Simulate memory decay for testing purposes
*/
simulateDecay(milliseconds: number): Promise<void>;
}
//# sourceMappingURL=SemanticMemory.d.ts.map