Store and retrieve memories using the BrAIny REST API. Use this skill to persist facts, notes, and messages about the user or conversation. Automatically stores context when the context window is reaching its limit.
Store and retrieve persistent memories via BrAIny API.
Use the bundled script to interact with the API:
# Store a memory
bun scripts/memory.ts store "User prefers dark mode" --type fact
# Store context summary
bun scripts/memory.ts store "Working on auth refactor..." --type note
# Search memories
bun scripts/memory.ts retrieve "authentication" --limit 5
# Get recent memories
bun scripts/memory.ts retrieve --limit 10
| Variable | Purpose | Default |
|---|---|---|
BRAINY_URL | API base URL | http://localhost:3000 |
BRAINY_USER_ID | User ID for memory scoping | default |
POST /v1/users/{userId}/memories
Content-Type: application/json
{
"content": "string",
"type": "fact" | "note" | "message",
"authorType": "agent" | "user"
}
Memory Types
| Type | Use Case |
|---|---|
fact | Persistent info about user (preferences, background) |
note | Observations, summaries, context |
message | Conversation excerpts worth remembering |
Response
{
"success": true,
"memoryId": "uuid"
}
Duplicates (same user + content) are skipped automatically.
GET /v1/users/{userId}/memories?query={text}&limit={n}
query: semantic search (vector similarity, falls back to keyword)query: returns recent memoriesResponse
{
"success": true,
"memories": [
{
"id": "uuid",
"content": "string",
"type": "fact",
"authorType": "agent",
"createdAt": "2024-01-01T00:00:00Z",
"similarity": 0.85
}
],
"searchMethod": "vector" | "keyword" | "recent"
}
When the context window is reaching its limit, store a comprehensive session summary. This is critical for maintaining continuity.
Create a detailed record containing:
Session Overview
Technical Context
Decisions and Rationale
Current State
Next Steps
Store as a note with authorType agent. Structure the content clearly:
{
"content": "## Session Context\n\n### Task\n[Detailed description of what we're working on]\n\n### Progress\n- Completed: [list with details]\n- In progress: [current work]\n- Pending: [remaining items]\n\n### Technical Details\n- Project: [path and structure]\n- Files modified: [list with purposes]\n- Key patterns: [architectural notes]\n\n### Decisions\n- [Decision]: [Rationale]\n\n### Blockers\n- [Issue]: [Status and findings]\n\n### Next Steps\n1. [Specific action]\n2. [Specific action]",
"type": "note",
"authorType": "agent"
}
Store context preservation when: