memories-sdk
- Repo stars 27
- License Apache-2.0
- Author updated Live
- Author repo memories
- Domain
- Engineering
- Compatible agents
-
- Claude Code
- Cursor
- Cline
- Codex
- Windsurf
- Gemini CLI
- +20
- Trust score
- 94 / 100 · audit passed
- Author / version / license
- @webrenew · Apache-2.0
- Token usage
- Lean
- Setup complexity
- Guided setup
- External API key
- Required · Vendor-specific
- Operating systems
- Unspecified (assume cross-platform)
- Runtime requirements
- No special requirements
- Permissions
-
- Read-only
- Write / modify
- Env read
- Network behavior
- External requests
- Install commands
- 26 variants
Profile is derived at build time from SKILL.md and install vectors. Subject to drift from author intent.
Heads up: 未限定 allowed-tools,默认拥有全部工具权限。
---
name: memories-sdk
description: Build against the memories.sh SDK packages in application code. Use when working with `@memories…
category: engineering
runtime: no special runtime
---
# memories-sdk output preview
## PART A: Task fit
- Use case: Build against the memories.sh SDK packages in application code. Use when working with `@memories.sh/core` or `@memories.sh/ai-sdk`, including: (1) Initializing `MemoriesClient`, (2) Reading, writing, searching, or editing memories from backend code, route handlers, workers, or scripts, (3) Integrating memories with the Vercel AI SDK via `memoriesMiddleware`, `memoriesTools`, `preloadContext`, or `createMemoriesOnFinish`, (4) Choosing and applying `tenantId` / `userId` / `projectId` scoping, (5) Managing SDK skill files or management APIs, or (6) Debugging memories SDK usage in TypeScript or JavaScript applications. Use `memories-cli` for CLI workflows, `memories-mcp` for MCP setup, and `memories-dev` for monorepo internals..
- Inputs: target material, constraints, expected output, and acceptance criteria.
- Evidence boundary: follow “Workflow / Quick Start / @memories.sh/core” and do not present inference as author intent.
## PART B: Execution result
- **01** The card summarizes the use case; runtime output centers on “Build against the memories.sh SDK packages in application code. Use when working with `@memories.sh/core` or `@memories.sh/ai-sdk`, including: (1) Initializing `MemoriesClient`, (2) Reading, writing, searching, or editing memories from backend code, route handlers, workers, or scripts, (3) Integrating memories with the Vercel AI SDK via `memoriesMiddleware`, `memoriesTools`, `preloadContext`, or `createMemoriesOnFinish`, (4) Choosing and applying `tenantId` / `userId` / `projectId` scoping, (5) Managing SDK skill files or management APIs, or (6) Debugging memories SDK usage in TypeScript or JavaScript applications. Use `memories-cli` for CLI workflows, `memories-mcp` for MCP setup, and `memories-dev` for monorepo internals.”.
- **02** When the source has headings, the agent prioritizes “Workflow / Quick Start / @memories.sh/core” so the result follows the author’s structure.
- **03** Typical output includes task judgment, concrete steps, required commands or file edits, validation, and follow-up options.
- **04** Risk context follows the fingerprint: read files, write/modify files, read environment variables; may access external network resources; requires Vendor-specific API keys.
## Running Rules
- read files, write/modify files, read environment variables; may access external network resources; requires Vendor-specific API keys.
- Validate with a small sample before expanding scope.
- Return the result, validation criteria, and next iteration options. The source does not require a stable slash command. After installation, invoke the skill by name and describe the task.
Name target files or source material, expected output, forbidden changes, and whether network or shell access is allowed. Permission fingerprint: read files, write/modify files, read environment variables.
Start with a small task and check whether the result follows “Workflow / Quick Start / @memories.sh/core”. Inspect diffs, logs, previews, or tests before expanding scope.
Confirm the final output includes a concrete result, evidence, and next action. If it stays generic, tighten inputs, boundaries, and acceptance criteria.
---
name: memories-sdk
description: Build against the memories.sh SDK packages in application code. Use when working with `@memories…
category: engineering
source: webrenew/memories
---
# memories-sdk
## When to use
- Build against the memories.sh SDK packages in application code. Use when working with `@memories.sh/core` or `@memorie…
- Use it when the task has clear inputs, repeatable steps, and validation criteria.
## What to provide
- Target material, scope, expected result, and forbidden changes.
- Whether network, commands, file writes, or external services are allowed.
## Execution rules
- Organize steps around “Workflow / Quick Start / @memories.sh/core” and keep inference separate from source facts.
- read files, write/modify files, read environment variables; may access external network resources; requires Vendor-specific API keys.
- Validate with a small sample before expanding the task.
## Output requirements
- Return the deliverable, key evidence, validation method, and next action.
- Mark missing information as unknown; do not invent commands, platforms, or dependencies. The author source anchors workflow facts; repository files anchor sources and commands; Fluxly only adds fit, limitations, and quality judgment.
skill "memories-sdk" {
input -> user goal + target files + boundaries + acceptance criteria
context -> Workflow / Quick Start / @memories.sh/core
rules -> SKILL.md triggers / order / output contract
runtime -> no special runtime | read files, write/modify files, read environment variables | may access external network resources
guardrails -> requires Vendor-specific API keys + small-sample validation + diff/log review
output -> copyable result + checklist + next iteration
} memories-sdk
Use the SDK packages when an application needs memories.sh programmatically. Prefer @memories.sh/core for direct typed API access and @memories.sh/ai-sdk only when the caller already uses the Vercel AI SDK.
Workflow
- Pick the integration surface:
- Use
@memories.sh/corefor backend routes, workers, cron jobs, and non-AI-SDK agents. - Use
@memories.sh/ai-sdkforgenerateText,streamText, middleware, or tool loops built onai. - If the task is about the CLI or MCP configuration, switch to
memories-cliormemories-mcp.
- Use
- Set scope before writing code:
- Keep
MEMORIES_API_KEYserver-side. tenantIdselects the tenant or workspace database.userIdnarrows memory to a user inside that tenant.projectIdnarrows reads and writes to a product area, repo, or feature slice.
- Keep
- Use the narrowest pattern that solves the task:
- Direct CRUD or context lookup:
MemoriesClient - Automatic prompt injection:
memoriesMiddleware - Agent loops with explicit memory tools:
memoriesToolsandmemoriesSystemPrompt - Fetch once and reuse:
preloadContext - Persist after completion:
createMemoriesOnFinish
- Direct CRUD or context lookup:
- Verify the integration:
- Confirm the same scope is used on both reads and writes.
- Catch
MemoriesClientError. - Do not expose the API key to browser-only code.
Quick Start
@memories.sh/core
import { MemoriesClient } from "@memories.sh/core"
const client = new MemoriesClient({
apiKey: process.env.MEMORIES_API_KEY,
tenantId: "acme-prod",
userId: "user_123",
})
const context = await client.context.get({
query: "billing architecture",
projectId: "dashboard",
mode: "all",
strategy: "hybrid",
limit: 8,
})
await client.memories.add({
content: "Enterprise billing uses Stripe invoices.",
type: "fact",
projectId: "dashboard",
tags: ["billing"],
})
@memories.sh/ai-sdk
import { generateText, stepCountIs, wrapLanguageModel } from "ai"
import { openai } from "@ai-sdk/openai"
import {
memoriesMiddleware,
memoriesSystemPrompt,
memoriesTools,
} from "@memories.sh/ai-sdk"
const model = wrapLanguageModel({
model: openai("gpt-4o"),
middleware: memoriesMiddleware({
tenantId: "acme-prod",
userId: "user_123",
projectId: "dashboard",
}),
})
const result = await generateText({
model,
system: memoriesSystemPrompt(),
tools: memoriesTools({
tenantId: "acme-prod",
userId: "user_123",
projectId: "dashboard",
}),
stopWhen: stepCountIs(5),
prompt: "Summarize prior decisions about billing.",
})
console.log(result.text)
Decision Guide
- Need direct typed access from your own backend code: use
MemoriesClient - Need automatic context injection into prompts or messages: use
memoriesMiddleware - Need the model to read or write memory explicitly through tools: use
memoriesTools - Need to manage stored skill files or procedure fragments: use
client.skills.*or the AI SDK skill-file tools - Need tenant, key, or embedding usage administration: use
client.management.* - Need internals of the memories monorepo or server endpoints: use
memories-dev
Reference Files
references/core.md: direct client methods, transport choices, errors, management APIs, and skill-file APIsreferences/ai-sdk.md: middleware, tools, preload, post-finish persistence, and query extraction patternsreferences/scoping.md: tenant/user/project scoping rules, server-side safety, and debugging checklist
Decide Fit First
@memories.sh/coreor `@memories.sh/ai-sd…Design Intent
How To Use It
Boundaries And Review