Memory query
Skill Makiato1999/agentic-travel/.claude/skills/memory-query
An LLM-powered multi-agent business travel planning system that integrates RAG knowledge retrieval, user preference memory, real-time information querying, and itinerary generation.
npx -y skills add Makiato1999/agentic-travel --skill memory-queryAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Use this skill when the user asks about their own history, past trips, or saved preferences. Triggers when user asks "我去过哪些地方", "我上次去北京是什么时候", "我之前说过什么偏好", "我的旅行记录". This skill uses MemoryQueryAgent and requires a MemoryManager (user_id, session_id) to access long-term memory.
SKILL.md
3.1 KB, 780 tokens by cl100k_base, as published. Nobody here has run it
Memory Query (记忆查询)
基于用户长期记忆回答「我去过哪」「上次什么时候」「我的偏好」等问题,使用 MemoryQueryAgent。需传入 MemoryManager 以访问 data/memory/{user_id}.json 中的行程、偏好与聊天摘要。
When to Use
- 用户问自己的历史行程、偏好、或过往对话内容时
Agent
- MemoryQueryAgent (
agents/memory_query_agent.py) - 入参:model、memory_manager(必选,否则无记忆可查)
- 异步:
reply()为async,需await
依赖
- MemoryManager:
context.memory_manager.MemoryManager(user_id, session_id, storage_path, llm_model) - 长期记忆存储:
data/memory/{user_id}.json
初始化与调用
import asyncio
import json
from agentscope.message import Msg
from agentscope.model import OpenAIChatModel
from config_agentscope import init_agentscope
from config import LLM_CONFIG
from context.memory_manager import MemoryManager
from agents.memory_query_agent import MemoryQueryAgent
async def memory_query(user_query: str, user_id: str = "default_user", session_id: str = "default"):
init_agentscope()
model = OpenAIChatModel(
model_name=LLM_CONFIG["model_name"],
api_key=LLM_CONFIG["api_key"],
client_kwargs={"base_url": LLM_CONFIG["base_url"], "timeout": 60},
temperature=LLM_CONFIG.get("temperature", 0.7),
max_tokens=LLM_CONFIG.get("max_tokens", 2000),
)
memory_manager = MemoryManager(user_id=user_id, session_id=session_id, llm_model=model)
agent = MemoryQueryAgent(
name="MemoryQueryAgent",
model=model,
memory_manager=memory_manager,
)
# Agent 期望 content 为 JSON:{"context": {"rewritten_query": "用户问题"}}
user_msg = Msg(
name="user",
content=json.dumps({"context": {"rewritten_query": user_query}}),
role="user",
)
result = await agent.reply(user_msg)
return json.loads(result.content) if isinstance(result.content, str) else result.content
# 使用
data = asyncio.run(memory_query("我去过哪些地方?"))
# data: {"status": "success", "query": "...", "answer": "...", "memory_sources": {"trip_count", "has_preferences", ...}}
返回格式
status:"success"或"error"query: 用户问题answer: 基于记忆的自然语言回答memory_sources: 如trip_count,has_preferences,has_chat_summary
回答指南
【回答要求】
- 直接基于上述记忆信息回答问题
- 如果记忆中没有相关信息,诚实说明"记录中没有相关信息"
- 回答要自然、准确、有条理
- 如果有多条记录,可以按时间顺序或分类列举
- 不要编造不存在的信息
请直接回答用户的问题。
Gives 0 of the 12 instructions most memory context skills give in 780 tokens
Counted across 674 of the 847 authors here whose files we hold, read 2026-08-06
- inform the user when setup is completein 21 of 674, across 6 files
- confirm the draft with the user before writingin 21 of 674, across 6 files
- update the agent skills block in place if it existsin 21 of 674, across 6 files
- present findings to the userin 20 of 674, across 5 files
- write the three docs files from seed templatesin 20 of 674, across 5 files
- ask the user about each decision one at a timein 19 of 674, across 4 files
- edit CLAUDE.md if it existsin 18 of 674, across 3 files
- explore current repo statein 18 of 674, across 3 files
- do not overwrite user edits to surrounding sectionsin 18 of 674, across 3 files
- back up the original file before overwritingin 16 of 674, across 8 files
- keep the memory index under 200 linesin 15 of 674
- Provide actionable steps and verificationin 13 of 674, across 2 files
Said here and by no other author read
- answer the question directly based on retrieved memory
- state honestly if no relevant memory information exists
- answer naturally, accurately, and coherently
- list multiple records chronologically or by category
- answer the user's question directly
Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once. Length counted with cl100k_base; the agent that loads this file may tokenize it differently.