Getting Started
Installation
bash
npm install cognitive-engineOr install individual packages:
bash
npm install @cognitive-engine/core @cognitive-engine/perception @cognitive-engine/memoryQuick Example
typescript
import { CognitiveOrchestrator, OpenAiLlmProvider, MemoryStore } from 'cognitive-engine'
const engine = {
llm: new OpenAiLlmProvider({ model: 'gpt-4o-mini' }),
embedding: new OpenAiEmbeddingProvider(),
store: new MemoryStore()
}
const agent = new CognitiveOrchestrator({
engine,
modules: {
perception: true,
episodicMemory: true,
semanticMemory: true,
reasoning: true,
metacognition: true
}
})
const response = await agent.process('Review this code for security issues')What Happens Under the Hood
When you call agent.process(), the cognitive pipeline runs:
- Perception analyzes the input - extracts entities, intent, emotional tone
- Working Memory pulls relevant context from episodic and semantic memory
- Reasoning forms beliefs, generates intentions, picks a strategy
- Metacognition checks if the strategy makes sense, flags contradictions
- Response is generated using the LLM with full cognitive context
Requirements
- Node.js >= 20
- TypeScript >= 5.0 (recommended)
- An LLM provider (OpenAI included, or bring your own)