libmemory

Construct token-budgeted memory windows from conversation history and tools.

1|1|Updated Aug 7, 2025
One-click install
npx skills add https://github.com/copilot-ld/copilot-ld --skill libmemory
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: libmemory
Source: https://github.com/copilot-ld/copilot-ld/tree/main/packages/libmemory
Command: npx skills add https://github.com/copilot-ld/copilot-ld --skill libmemory

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Memory management for building token-budgeted LLM context windows from conversation history and tools, enabling efficient prompts within strict model limits.

Core Features & Use Cases

  • WindowBuilder constructs context windows that fit within token budgets by combining history and tools.
  • MemoryIndex stores and deduplicates conversation identifiers for fast retrieval and reuse.
  • Token budgeting and overhead calculations ensure reliable prompt construction across multiple models.
  • Integration with Memory and Agent services to streamline end-to-end chat workflows.
  • Use Case: build compact, relevant conversation history for an LLM-driven assistant while respecting model limits.

Quick Start

Create a memory window by supplying the conversation history, available tools, and a token budget, then pass the resulting messages and tools to the LLM.

Frequently Asked Questions about libmemory

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I manage LLM context windows with token budgets for conversation history?

You can manage LLM context windows by using a WindowBuilder to combine conversation history and tools, ensuring the constructed prompt fits within strict model token limits. This approach applies overhead calculations and safe trimming to optimize the final input.

What is the best way to trim conversation history to fit varying model token limits?

Trimming conversation history to fit token limits is best handled by applying a model budget map and overhead calculations for agents and tools. This ensures safe trimming with error handling and integrity checks so the compact history remains relevant.

Does this token budgeting approach work across multiple LLM models and agent configurations?

Yes, token budgeting works across multiple models by using a model budget map to calculate overhead for agents and tools. It constructs reliable prompts by adjusting the memory window to respect the specific constraints of each varying model budget.

How do I build a token-budgeted memory window from conversation history and tools?

To build a token-budgeted memory window, supply your conversation history, available tools, and a token budget to the WindowBuilder. It deduplicates identifiers via a MemoryIndex and outputs optimized messages and tools ready for the LLM.

Why does my LLM prompt fail when adding tools to a long conversation history?

LLM prompts fail when conversation history and tools exceed the strict model token limits. You need token budgeting and overhead calculations to construct a memory window that safely trims history with integrity checks, preventing context overflow.