cogmemai-sdk
v1.0.0
Published
CogmemAi — Persistent memory for AI coding assistants
Maintainers
Readme
CogmemAi JavaScript/TypeScript SDK
Persistent memory for AI coding assistants. Give your AI tools memory that persists across sessions.
Install
npm install cogmemai-sdkQuick Start
import { CogmemAi } from "cogmemai-sdk";
const client = new CogmemAi({ apiKey: "cm_your_api_key_here" });
// Save a memory
await client.saveMemory({
content: "This project uses React with TypeScript",
memory_type: "architecture",
category: "frontend",
importance: 8,
});
// Search memories
const results = await client.recallMemories({
query: "what framework does this project use?",
});
// Load project context
const context = await client.getProjectContext({
projectId: "my-project",
});
// Extract memories from conversation
await client.extractMemories({
user_message: "Let's use PostgreSQL for the database",
assistant_response: "Good choice. I'll set up the schema with...",
});All Methods
Core Memory
saveMemory(options)— Save a memoryrecallMemories(options)— Semantic searchextractMemories(options)— Ai extracts facts from conversationgetProjectContext(options?)— Load top memories with smart rankinglistMemories(options?)— Browse with filtersupdateMemory(memoryId, options)— Edit a memorydeleteMemory(memoryId)— Delete permanentlygetUsage()— Check usage stats and tier
Documents & Sessions
ingestDocument(options)— Extract memories from docssaveSessionSummary(options)— Capture session accomplishments
Import / Export
exportMemories()— Back up memories as JSONimportMemories(memories)— Bulk import from JSONgetMemoryVersions(memoryId)— Version history
Team & Collaboration
getTeamMembers(projectId?)— List team membersinviteTeamMember(email, projectId, role?)— Invite a memberremoveTeamMember(memberId)— Remove a member
Memory Relationships & Promotion
linkMemories(memoryId, relatedMemoryId, relationshipType)— Link related memoriesgetMemoryLinks(memoryId)— Get linked memoriesgetPromotionCandidates()— Find cross-project patternspromoteToGlobal(memoryId)— Promote to global scope
Error Handling
import { CogmemAi, CogmemAiError } from "cogmemai-sdk";
try {
await client.saveMemory({ content: "test" });
} catch (err) {
if (err instanceof CogmemAiError) {
console.error(`Error ${err.statusCode}: ${err.message}`);
}
}TypeScript
Full type definitions included. All request options and response types are exported:
import type { Memory, SaveMemoryOptions, RecallResult } from "cogmemai-sdk";Get an API Key
- Sign up at hifriendbot.com/developer/
- Generate an API key
- Start saving memories
