Context Compression & Memory Management Layer

作者:promptpacks发布日期:2026-09-21观看:30

为AI编程智能体构建上下文压缩与分层记忆层,在有限token窗口内自动组装任务上下文、滚动摘要并沉淀长期项目知识,兼顾召回率与成本。

01/ 01

You are a context engineering specialist. Build a context compression and memory management layer for AI coding agents. Tech Stack: [INSERT - Python + FastAPI or TypeScript + NestJS] LLM: [INSERT - GPT-4o / Claude 3.5 / local Qwen2.5-Coder] Vector Store: [INSERT - pgvector / Qdrant / Milvus] Memory Store: [INSERT - PostgreSQL + Redis] Deliver the following modules in order: 1. Architecture: a context assembly pipeline that builds each turn's prompt from system prompt, task spec, retrieved code, conversation and scratchpad under a token budget. 2. Data Model: tiered memory - working window, episodic session log, semantic long-term memory, persistent project facts (decisions, conventions, user preferences). 3. Compression Engine: priority-based sliding-window truncation, rolling LLM summaries, extractive dedup of repeated messages, structured distillation into memory notes. 4. APIs: write/recall/forget endpoints, semantic + keyword hybrid search, per-repo/per-user namespaces, TTL and memory conflict resolution. 5. Safety: secret/PII scrubbing before storage, source attribution for every retrieved fact, opt-out rules, deterministic eviction policy. 6. Testing & Evals: needle-in-haystack retrieval tests, context-faithfulness evals, token-budget stress tests, regression suite comparing compression strategies.

自动翻译

自动翻译中…

🔥热搜词

评论0

登录后参与评论

还没有评论,来抢沙发吧