Claude-skill-registry libmemory
install
source · Clone the upstream repo
git clone https://github.com/majiayu000/claude-skill-registry
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/libmemory" ~/.claude/skills/majiayu000-claude-skill-registry-libmemory && rm -rf "$T"
manifest:
skills/data/libmemory/SKILL.mdsource content
libmemory Skill
When to Use
- Building context windows for LLM calls
- Managing conversation history with token limits
- Constructing prompts from messages and tools
- Optimizing context for model token budgets
Key Concepts
WindowBuilder: Constructs context windows by selecting messages and tools that fit within token budget.
MemoryIndex: Stores conversation message identifiers for retrieval.
Token budgeting: Allocates tokens across system prompt, history, and tools.
Usage Patterns
Pattern 1: Build context window
import { WindowBuilder } from "@copilot-ld/libmemory"; const builder = new WindowBuilder(tokenizer); const window = await builder.build({ messages: conversationHistory, tools: availableTools, budget: 4000, });
Pattern 2: Factory usage
import { createWindow } from "@copilot-ld/libmemory"; const window = await createWindow(resourceId, { maxTokens: 4000, systemPrompt: "You are a helpful assistant.", });
Integration
Used by Memory service and Agent service. Works with libllm for token counting.