Skip to main content

Memory API

The Memory API manages your AI Knowledge Base — persistent memories that help the AI personalize PRD generation across conversations. Memories are scoped per user and include preferences, decisions, project context, and feedback. See the Knowledge Base user guide for how memories work in the product.

List Memories

GET /api/memory
Retrieve your stored memories, sorted by importance and recent usage. Query parameters:
ParameterTypeDefaultDescription
limitinteger20Max memories to return
categorystringFilter by category: technical, business, process, style, team
typestringFilter by type: preference, decision, project_context, feedback
activebooleantrueSet to false to include soft-deleted memories
curl https://app.thig.ai/api/memory?limit=10&category=style \
  -H "Authorization: Bearer YOUR_API_KEY"
Response:
{
  "memories": [
    {
      "id": "uuid",
      "userId": "user_123",
      "memoryType": "preference",
      "category": "style",
      "content": "User prefers detailed user stories with acceptance criteria in Given/When/Then format",
      "summary": "Prefers Given/When/Then acceptance criteria",
      "importance": 8,
      "isActive": true,
      "sourceProjectId": "proj_456",
      "lastUsedAt": "2026-03-05T14:30:00Z",
      "createdAt": "2026-02-15T10:00:00Z"
    }
  ]
}

Create Memory

POST /api/memory
Manually add a memory to your Knowledge Base. Body:
FieldTypeRequiredDescription
memoryTypestringYespreference, decision, project_context, or feedback
categorystringYestechnical, business, process, style, or team
contentstringYesThe memory content (clear, actionable statement)
summarystringNoBrief 1-line summary
sourceProjectIdstringNoProject this memory originated from
sourceConversationobject[]NoConversation messages for context
importanceintegerNo1–10 (10 = most important for future context)
curl -X POST https://app.thig.ai/api/memory \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "memoryType": "preference",
    "category": "style",
    "content": "Always include acceptance criteria in Given/When/Then format",
    "summary": "Given/When/Then acceptance criteria",
    "importance": 8
  }'
Response:
{
  "memory": {
    "id": "uuid",
    "userId": "user_123",
    "memoryType": "preference",
    "category": "style",
    "content": "Always include acceptance criteria in Given/When/Then format",
    "summary": "Given/When/Then acceptance criteria",
    "importance": 8,
    "isActive": true,
    "createdAt": "2026-03-06T12:00:00Z"
  }
}

Delete Memory

DELETE /api/memory?id=MEMORY_ID
Soft-deletes a memory (sets isActive to false). The memory can still be retrieved by passing active=false to the list endpoint. Query parameters:
ParameterTypeRequiredDescription
idstringYesMemory ID to delete
curl -X DELETE "https://app.thig.ai/api/memory?id=MEMORY_ID" \
  -H "Authorization: Bearer YOUR_API_KEY"
Response:
{
  "success": true
}

Extract Memories from Conversation

POST /api/memory/extract
Uses AI to analyze a conversation and automatically extract reusable memories — preferences, decisions, context, and feedback. Extracted memories are saved to your Knowledge Base. Body:
FieldTypeRequiredDescription
conversationobject[]YesArray of message objects (max 50 messages, max 10,000 chars each)
conversation[].rolestringYesuser or assistant
conversation[].contentstringYesMessage content
projectIdstringNoProject the conversation belongs to
curl -X POST https://app.thig.ai/api/memory/extract \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "conversation": [
      {"role": "user", "content": "I prefer user stories with Given/When/Then acceptance criteria"},
      {"role": "assistant", "content": "Noted! I will use Given/When/Then format for all acceptance criteria going forward."},
      {"role": "user", "content": "Also, our tech stack is React + Node.js + PostgreSQL"}
    ],
    "projectId": "proj_123"
  }'
Response:
{
  "extracted": 2,
  "saved": 2,
  "memories": [
    {
      "id": "uuid",
      "memoryType": "preference",
      "category": "style",
      "content": "User prefers Given/When/Then format for acceptance criteria",
      "summary": "Given/When/Then acceptance criteria",
      "importance": 8
    },
    {
      "id": "uuid",
      "memoryType": "project_context",
      "category": "technical",
      "content": "Tech stack: React, Node.js, PostgreSQL",
      "summary": "React + Node.js + PostgreSQL stack",
      "importance": 7
    }
  ]
}
Memory extraction uses your configured AI provider (respecting BYOK settings). The AI only extracts genuinely useful, reusable information — it skips trivial or project-specific details that won’t apply to future projects.

Memory Types

TypeDescription
preferenceUser preferences about PRD style, detail level, terminology
decisionKey decisions made about requirements or architecture
project_contextCompany, team, or technical stack information
feedbackFeedback about generated content that indicates future preferences

Categories

CategoryDescription
technicalTechnical architecture, stack, infrastructure
businessBusiness goals, KPIs, stakeholder preferences
processDevelopment methodology, workflow preferences
styleWriting style, format, detail level preferences
teamTeam structure, roles, communication patterns