Communitygithub.com

curiositech/windags-skills

构建始终在线的AI代理的架构与系统设计,涵盖记忆层次、持久化层、代理服务器基础设施、向量存储及框架选择。提供跨会话保持身份并持续学习的代理的具体部署模式。

windags-skills 是什么?

该技能专注于为始终在线的AI代理设计架构,特别是那些具备情景记忆的代理。其核心思想不是简单地扩展上下文窗口,而是将LLM视为一个运行在受管内存上的CPU,维护一个包含核心记忆、回忆记忆和存档记忆的三层记忆层次结构。技能涵盖了选择记忆框架的决策树(如Letta、Zep、Mem0等),核心记忆的驱逐策略,基于延迟和规模需求的向量数据库选择标准,以及将用户输入路由到适当记忆层的决策逻辑。此外,还详细描述了关键的故障模式(如记忆损坏级联、搜索性能下降)及其恢复流程,并提供了构建个人研究助手的完整实战案例,包括代码实现。支持Letta、Zep、Mem0、LangMem、pgvector、Chroma、Qdrant、Weaviate、Pinecone等平台和工具。

兼容平台~Claude Code~Codex CLI~Cursor✓Antigravity
npx skills add https://github.com/curiositech/windags-skills/tree/HEAD/skills/always-on-agent-architecture

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

/always-on-agent-architecture — 构建永不遗忘的代理

你正在为一个始终在线的AI代理设计架构,该代理具备情景记忆。这不是一个拥有长上下文窗口的聊天机器人。这是一个跨会话持久化状态、管理自身记忆层次、作为服务运行,并在数周数月内保持身份的系统。核心洞察:将LLM视为一个在受管内存上运行的CPU,而不是一个无状态函数。

决策点

记忆框架选择树

Q1: 你需要一个完整的代理运行时(服务器、API、工具)吗?
├─ 是 → 使用 Letta(最完整、生产就绪)
└─ 否,我有自己的代理循环
   ├─ Q2: 你需要时间/关系追踪吗?
   │  ├─ 是 → 使用 Zep/Graphiti(最佳时间知识图谱)
   │  └─ 否 → 前往 Q3
   │     ├─ Q3: 你需要图+向量的混合吗?
   │     │  ├─ 是 → 使用 Mem0(图模式)
   │     │  └─ 否 → 前往 Q4
   │     │     ├─ Q4: 已经在用 LangGraph 了吗?
   │     │     │  ├─ 是 → 使用 LangMem
   │     │     │  └─ 否 → 使用 pgvector 或 Chroma
   └─ 想要零依赖? → 自定义 SQLite + 本地嵌入

核心记忆驱逐触发器

触发器阈值操作
大小溢出核心记忆 > 4KB总结最近最少使用的块,将摘要移至存档
时间衰减数据超过30天未使用标记为压缩审查
相关性下降访问分数 < 0.3移至存档记忆并附带衰减标签
用户覆盖用户说“忘记X”立即移除 + 存档墓碑标记
冲突检测存储了矛盾的事实提示代理协调或询问用户

向量数据库选择标准

如果 查询延迟要求 < 10ms AND 数据量 > 100M 向量:
    → 使用 Qdrant(针对速度优化)
否则如果 已经在使用 PostgreSQL:
    → 使用 pgvector(单一数据库,更简单的运维)
否则如果 需要混合搜索(关键词 + 语义):
    → 使用 Weaviate(最佳混合)
否则如果 偏好零运维:
    → 使用 Pinecone(完全托管)
否则:
    → 使用 Chroma(本地优先,简单API)

记忆层路由决策

输入: 用户消息或代理观察
│
├─ 包含身份/偏好更新?
│  └─ 是 → 更新核心记忆,立即持久化
├─ 需要对话上下文?
│  └─ 是 → 搜索回忆记忆(对话历史)
├─ 需要事实知识?
│  └─ 是 → 搜索存档记忆(向量存储)
└─ 需要外部数据?
   └─ 是 → 使用外部工具(API、文件等)

故障模式

记忆损坏级联

症状: 代理人格漂移、矛盾响应、核心记忆冲突 根本原因: 对核心记忆的并发写入未加锁,或部分更新失败 检测规则: 如果核心记忆大小突然下降超过50%或包含格式错误的JSON/YAML 恢复步骤:

  1. 立即停止代理以防止进一步损坏
  2. 从最近已知的良好备份(1小时以内)恢复核心记忆
  3. 回放自备份以来的对话日志以重建丢失的更新
  4. 在重启前对核心记忆更新实施写锁定

向量搜索退化

症状: 搜索结果越来越不相关,代理找不到最近存储的事实 根本原因: 嵌入模型漂移、索引损坏、或缺少记忆压缩 检测规则: 如果对已知查询,前3个结果的平均余弦相似度 < 0.7 恢复步骤:

  1. 对100个向量的随机样本运行嵌入一致性检查
  2. 如果超过10%显示异常嵌入,重建整个索引
  3. 实施嵌入模型版本固定
  4. 添加嵌入漂移监控以防止复发

持久化层死锁

症状: 代理在记忆操作上挂起,数据库连接超时 根本原因: 同时读写相同记忆块,连接池不足 检测规则: 如果记忆操作耗时超过30秒或数据库显示锁等待超时 恢复步骤:

  1. 杀死挂起的连接以释放锁
  2. 对记忆操作实施指数退避重试逻辑
  3. 添加具有最大连接限制的连接池
  4. 审查记忆更新的事务隔离级别

上下文窗口爆炸

症状: API成本飙升、响应延迟增加、令牌限制错误 根本原因: 核心记忆膨胀,每次查询检索过多存档块 检测规则: 如果每次请求的平均令牌数超过模型上下文限制的80% 恢复步骤:

  1. 审计核心记忆大小 - 压缩或归档过大的块
  2. 减少存档搜索结果数量(从10减少到5)
  3. 在LLM调用前实施令牌计数
  4. 添加成本监控警报,超过$1/对话时触发

内存泄漏 - 无限制增长

症状: 数据库大小线性增长,搜索性能随时间下降 根本原因: 无记忆压缩、重复事实插入、缺少垃圾回收 检测规则: 如果正常使用下总记忆大小每月增长超过100MB 恢复步骤:

  1. 跨存档记忆运行事实去重(余弦相似度 > 0.92)
  2. 对超过7天的回忆记忆实施对话摘要
  3. 添加相关性评分,自动修剪低分记忆
  4. 安排每周压缩任务

实战案例

示例:构建个人研究助手

场景: 设计一个代理的架构,它可以帮助进行技术研究,记住你的偏好,并在数月内积累知识。

步骤 1 - 记忆层设计

核心记忆 (2KB):
- 用户名: "Sarah"
- 研究领域: ["机器学习", "分布式系统"]
- 首选论文来源: ["arxiv", "acm digital library"]
- 写作风格: "详细且包含代码示例"
- 当前项目: "分布式训练优化"

回忆记忆:
- PostgreSQL 中的所有对话,支持全文搜索
- 30天保留窗口,之后摘要化

存档记忆:
- 论文摘要、提取的见解、代码片段
- PostgreSQL 上的 pgvector(已在回忆记忆中使用)
- nomic-embed-text 用于本地嵌入(隐私 + 成本)

步骤 2 - 框架选择决策 按照决策树:

  • 需要完整代理运行时?否(构建自定义)
  • 需要时间追踪?否(研究事实大多与时间无关)
  • 需要图+向量?否(简单的语义搜索就足够了)
  • 已经在用 LangGraph?否
  • → 决策:pgvector + PostgreSQL

步骤 3 - 代理循环实现

async def research_step(user_query: str):
    # 加载核心记忆
    core = load_core_memory()  # 用户偏好、活跃项目
    
    # 检查查询是否与当前项目相关
    if "optimization" in user_query.lower():
        # 搜索存档中的项目特定知识
        relevant_papers = search_archival("distributed training optimization")
        context = f"当前项目上下文: {relevant_papers}"
    else:
        # 搜索通用领域知识
        context = search_archival(user_query)
    
    # 使用核心记忆 + 检索到的上下文构建提示
    system_prompt = f"""
    你是 Sarah 的研究助手。
    用户偏好: {core['preferences']}
    当前项目: {core['current_project']}
    
    检索到的上下文: {context}
    """
    
    response = await llm.chat([
        {"role": "system", "content": system_prompt},
        {"role": "user", "content": user_query}
    ])
    
    # 持久化交互
    save_to_recall(user_query, response)
    
    return response

新手可能会遗漏的:

  • 在存档中存储原始论文而不是提取的见解
  • 没有实现对话搜索(回忆记忆)
  • 在核心记忆中放入过多内容(包含50个条目的研究领域列表)
  • 没有记忆压缩策略

专家会注意到的:

  • 核心记忆专注于“工作身份”而非知识
  • 存档记忆存储经过整理的事实,而非原始文档
  • 在检索之前实现搜索(代理决定什么相关)
  • 从第一天开始规划记忆增长

质量门禁

部署验证检查清单

  • 记忆延迟 SLO: 核心记忆加载 < 100ms,存档搜索完成 < 500ms
  • 记忆一致性: 核心记忆在代理重启后无损坏地存活(通过故意关闭进程测试)
  • 搜索相关性: 对于已知查询,前3个存档结果的余弦相似度 > 0.6
  • 记忆大小规则: 核心记忆 ≤ 4KB,回忆保留 ≤ 30天,每个存档块 ≤ 1KB
  • 持久化耐久性: 所有记忆更新在数据库重启后存活(已验证ACID合规性)
  • 成本控制: 在每天100次对话的情况下,记忆操作成本 < $0.01/对话
  • 压缩计划: 记忆压缩每周运行,并将总大小减少 ≥ 10%
  • 身份一致性: 代理人格在50+次对话会话中保持稳定
  • 冷启动恢复: 代理优雅地处理空记忆状态(引导流程正常工作)
  • 备份验证: 记忆备份成功恢复并保留代理身份

非此技能边界

请勿将此技能用于:

  • 选择代理训练数据 → 使用 /always-on-agent-inputs——该技能涵盖向代理提供什么数据,本技能涵盖如何存储和检索它们
  • 头脑风暴代理应用 → 使用 /always-on-agent-applications——该技能涵盖用例构思,本技能涵盖技术实现
  • 代理安全与隐私 → 使用 /always-on-agent-safety——该技能涵盖数据治理、同意和安全;本技能假设这些已经设计好
  • 通用代理模式 → 使用 /agentic-patterns——该技能涵盖ReAct循环、工具使用、规划;本技能涵盖底层的持久化层
  • 一次性代理任务 → 使用 /agent-creator——如果代理不需要跨会话记忆,就不需要始终在线的架构
  • 数据库模式设计 → 本技能假设你理解基本数据库概念;模式优化请使用特定数据库的技能
  • 成本优化策略 → 本技能提到了成本考量但未深入优化;请委托给特定于成本的技能

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

curiositech/windags-skills

Expert in 2000s-era music visualization (Milkdrop, AVS, Geiss) and modern WebGL implementations. Specializes in Butterchurn integration, Web Audio API AnalyserNode FFT data, GLSL shaders for audio-reactive visuals, and psychedelic generative art. Activate on "Milkdrop", "music visualization", "WebGL visualizer", "Butterchurn", "audio reactive", "FFT visualization", "spectrum analyzer". NOT for simple bar charts/waveforms (use basic canvas), video editing, or non-audio visuals.

curiositech/windags-skills

Expert legal research agent for finding and scraping expungement data state by state. Knows authoritative sources, URL patterns, Firecrawl configuration, and 2026 legal landscape.

curiositech/windags-skills

Expert in 3D computer vision labeling tools, workflows, and AI-assisted annotation for LiDAR, point clouds, and sensor fusion. Covers SAM4D/Point-SAM, human-in-the-loop architectures, and vertical-specific training strategies. Activate on '3D labeling', 'point cloud annotation', 'LiDAR labeling', 'SAM 3D', 'SAM4D', 'sensor fusion annotation', '3D bounding box', 'semantic segmentation point cloud'. NOT for 2D image labeling (use clip-aware-embeddings), general ML training (use ml-engineer), video annotation without 3D (use computer-vision-pipeline), or VLM prompt engineering (use prompt-engineer).

curiositech/windags-skills

Implement WCAG 2.2 AA/AAA compliance with automated testing, keyboard navigation, screen reader support, and focus management. Activate on: accessibility audit, WCAG compliance, keyboard navigation, screen reader, aria attributes, axe-core, focus trap. NOT for: design-level accessibility review (use design-accessibility-auditor), color contrast only (use css-in-js-architect).

curiositech/windags-skills

Time-blind friendly planning, executive function support, and daily structure for ADHD brains. Specializes in realistic time estimation, dopamine-aware task design, and building systems that actually work for neurodivergent minds.

curiositech/windags-skills

Designs digital experiences for ADHD brains using neuroscience research and UX principles. Expert in reducing cognitive load, time blindness solutions, dopamine-driven engagement, and compassionate design patterns. Activate on 'ADHD design', 'cognitive load', 'accessibility', 'neurodivergent UX', 'time blindness', 'dopamine-driven', 'executive function'. NOT for general accessibility (WCAG only), neurotypical UX design, or simple UI styling without ADHD context.

curiositech/windags-skills

>- Apply crisis decision-making research to agent routing, uncertainty triage, and coordination failure analysis in time-pressured systems. Use when diagnosing handoff failures, analytical paralysis, or expert judgment under incomplete information. NOT for routine coding, simple CRUD design, or static single-agent tasks with complete information.

curiositech/windags-skills

Extend and modify the admin dashboard, developer portal, and operations console. Use when adding new admin tabs, metrics, monitoring features, or internal tools. Activates for dashboard development, analytics, user management, and internal tooling.

curiositech/windags-skills

Conversation patterns and interaction protocols for multi-agent systems. Covers request/response, pub/sub, blackboard, delegation chains, debate, critique, consensus, fan-out/fan-in, supervisor-worker, and peer negotiation. Deep analysis of AutoGen conversation patterns, CrewAI delegation, LangGraph state passing, and FIPA-ACL performatives. Teaches how to design what agents say to each other and in what order. Activate on: "agent conversation", "agent protocol", "multi-agent debate", "agent delegation", "supervisor worker pattern", "agent voting", "consensus protocol", "fan-out fan-in", "agent negotiation", "blackboard pattern", "agent dialogue", "conversation topology", "agent handoff". NOT for: wire format or serialization (use agent-interchange-formats), orchestration infrastructure (use agentic-infrastructure-2026), single agent behavior (use agentic-patterns).

curiositech/windags-skills

Meta-agent for creating new custom agents, skills, and MCP integrations. Expert in agent design, MCP development, skill architecture, and rapid prototyping. Activate on 'create agent', 'new skill', 'MCP server', 'custom tool', 'agent design'. NOT for using existing agents (invoke them directly), general coding (use language-specific skills), or infrastructure setup (use deployment-engineer).

curiositech/windags-skills

AI-powered calendar management and agent-based scheduling coordination. Covers calendar APIs (Google Calendar, CalDAV/iCal), AI scheduling assistants (Reclaim, Clockwise, Motion, Cal.com), building custom calendar agents with MCP, multi-calendar merging, timezone management, focus block protection, meeting fatigue detection, and agent-to-agent meeting negotiation protocols. Activate on: "calendar agent", "AI scheduling", "calendar coordination", "meeting scheduling", "calendar API", "focus time protection", "calendar optimization", "Google Calendar MCP", "Reclaim", "Clockwise", "Motion", "Cal.com", "smart scheduling", "calendar-aware agent", "timezone scheduling", "agent negotiation meetings". NOT for: manual calendar UI component design (use form-validation-architect), project management scheduling or Gantt charts (use project-management-guru-adhd), general time-tracking or pomodoro apps (use adhd-daily-planner for time-awareness), building the agent itself from scratch (use agent-creator).

curiositech/windags-skills

Build and adopt production AI agent infrastructure in 2026. Covers framework selection (LangGraph, CrewAI, AutoGen, MCP), orchestration patterns, evaluation, observability, memory systems, and tool use. Also covers the SOCIAL dimension: how to sell agent infrastructure internally, change management, measuring ROI, building trust in autonomous systems, and scaling adoption across teams. Activate on: "agent infrastructure", "agent framework comparison", "which agent framework", "sell AI tools internally", "agent adoption", "agent observability", "agent evaluation", "MCP architecture", "agentic mesh", "enterprise AI agents", "AI change management", "agent ROI". NOT for: building specific agents (use ai-engineer), designing agent behavior patterns (use agentic-patterns), prompt tuning (use prompt-engineer).

curiositech/windags-skills

Fundamental patterns for effective agentic behavior. Teaches decomposition, tool orchestration, error recovery, context management, quality self-assessment, and knowing when to stop. Model-agnostic principles that make any agent more effective regardless of domain. Activate on: "how should I structure this agent", "agentic workflow", "agent patterns", "multi-step task", "tool orchestration", "/agentic-patterns", "decompose this", "agent best practices", "chain of actions", "when should the agent stop", "agent loop design". NOT for: creating agent infrastructure (use agent-creator), building DAGs (use windags-architect), specific tool implementation.

curiositech/windags-skills

Automated discovery and matching of agent skills for dynamic task routing and capability assessment

curiositech/windags-skills

Cryptographic security for agentic systems — zero-trust agent networking, signed message envelopes (JWS/JWE), capability-based security (ocaps), Merkle tree audit trails, WASM sandboxing, and formal verification. Covers CLI dev tool security, mTLS between agents, permission boundaries (least privilege for AI agents), and supply chain security for skills/plugins. Activate on: "agent security", "zero trust agents", "secure agent communication", "capability-based security", "ocap", "signed messages between agents", "agent audit trail", "sandbox agent execution", "agent permissions", "mTLS agents", "cryptographic verification", "agent supply chain", "OWASP agentic", "prove agent did X", "tamper-proof agent logs". NOT for: application-level SAST scanning (use security-auditor), network firewall rules (use infrastructure), SOC2/HIPAA compliance (organizational), or prompt injection defense (use prompt-engineer).

curiositech/windags-skills

Data structures and serialization formats for agent-to-agent communication. Covers message envelopes, structured output schemas, capability declarations, task handoff payloads, error/retry signaling, and context windows as data structures. Deep comparison of A2A protocol, MCP, OpenAI function calling, and LangChain message types. Teaches when to use rigid schemas vs free-form with validation, typed vs untyped, streaming vs batch. Activate on: "agent message format", "agent communication schema", "agent-to-agent protocol", "A2A protocol", "MCP message format", "structured output for agents", "agent interop", "interchange format", "agent serialization", "task handoff format", "capability declaration". NOT for: what agents say to each other (use agent-conversation-protocols), orchestration topology (use multi-agent-coordination), building agent infrastructure (use agentic-infrastructure-2026).

curiositech/windags-skills

Logic-based agent programming language implementing BDI architecture for practical autonomous agent development

curiositech/windags-skills

>- Design AgentSpeak(L)-style BDI agents with context-guarded plans, selection functions, and intention stacks. Use for interruptible autonomy, agent policy, and multi-agent orchestration in dynamic environments. NOT for simple rule engines, static planners, or centralized workflows.

curiositech/windags-skills

Foundational concurrent computation model where actors communicate exclusively through asynchronous message passing

curiositech/windags-skills

license: Apache-2.0 NOT for unrelated tasks outside this domain.

相关技能