返回顶部
s

sql-memory

Semantic memory layer for OpenClaw agents. Use when: (1) persisting agent memories with importance scoring, (2) hierarchical memory rollups (daily→weekly→monthly→yearly), (3) queuing tasks for agents, (4) logging activity and audit trails, (5) managing knowledge bases with semantic search. Provides remember/recall/search/queue_task/log_event APIs. Built on sql-connector for reliable parameterized SQL execution.

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 2.1.0
安全检测
已通过
129
下载量
0
收藏
概述
安装方式
版本历史

sql-memory

# SQL Memory Skill > Semantic memory layer for OpenClaw agents ## Overview Provides agent-friendly memory operations: remember, recall, search, forget, plus task queue management, knowledge indexing, activity logging, and hierarchical memory rollups. All operations go through the SQL Connector skill for reliable, parameterized SQL execution. See `scripts/sql_memory.py` for full implementation. ## Dependencies - **sql-connector** — provides the underlying database connection and query execution ## Quick Start ```python from sql_memory import SQLMemory, get_memory mem = get_memory('cloud') # Remember something mem.remember('facts', 'vex_timezone', 'VeX is in EST/EDT timezone', importance=7) # Recall it entry = mem.recall('facts', 'vex_timezone') # Search across all memories results = mem.search_memories('timezone') # Queue a task mem.queue_task('nlp_agent', 'analyze_document', '{"doc": "..."}', priority=3) # Log an event mem.log_event('training_complete', 'nlp_agent', 'Finished training cycle 42') # Store knowledge mem.store_knowledge('stamps', 'inverted_jenny', 'Rare 1918 misprint...', 'catalog') ``` ## Schema All tables live in the `memory` schema (SQL Server database): | Table | Purpose | |-------|---------| | `memory.Memories` | Long-term curated memories with importance scoring | | `memory.TaskQueue` | Task queue for agent work items | | `memory.ActivityLog` | Event/activity logging for audit trail | | `memory.KnowledgeIndex` | Domain-specific knowledge store | | `memory.Sessions` | Session tracking for agents | ## Memory Rollups Hierarchical consolidation keeps memories fresh and relevant: ``` Daily memories → Weekly rollup (Sundays 3AM) Weekly rollups → Monthly rollup (1st of month) Monthly → Quarterly (Jan/Apr/Jul/Oct) Quarterly → Yearly (Jan 1st) ``` Each rollup: 1. Summarizes source entries 2. Creates a consolidated entry with back-references 3. Reduces importance of source entries 4. Tags sources as `rolled_up` ### Importance Scale | Level | Meaning | Example | |-------|---------|---------| | 1-2 | Ephemeral, archive | Old workspace file | | 3-4 | Context, nice-to-know | Debug notes | | 5-6 | Standard operational | Task completion | | 7-8 | Important milestone | Architecture decision | | 9 | Critical | System design choice | | 10 | Permanent | Core identity/values | ## API Reference ### Memory Operations | Method | Description | Example | |--------|-------------|---------| | `remember(cat, key, content, importance, tags)` | Store a memory | `mem.remember('facts', 'name', 'Oblio', 7)` | | `recall(cat, key)` | Retrieve a memory | `mem.recall('facts', 'name')` | | `search_memories(query, limit)` | Semantic search | `mem.search_memories('timezone', limit=5)` | | `forget(cat, key)` | Delete a memory | `mem.forget('facts', 'name')` | ### Task Queue | Method | Description | |--------|-------------| | `queue_task(agent, type, payload, priority)` | Add a task | | `claim_task(id)` | Mark task as processing | | `complete_task(id, result)` | Mark task as completed | | `fail_task(id, error, retries, max)` | Fail with retry logic | ### Activity Logging | Method | Description | |--------|-------------| | `log_event(type, agent, detail, extra)` | Log an activity | | `get_recent_activity(hours, agent)` | Query recent events | ## Configuration Uses the same environment variables as sql-connector: ``` SQL_CLOUD_SERVER=sql5112.site4now.net SQL_CLOUD_DATABASE=db_99ba1f_memory4oblio SQL_CLOUD_USER=... SQL_CLOUD_PASSWORD=... SQL_LOCAL_SERVER=10.0.0.110 SQL_LOCAL_DATABASE=Oblio_Memories SQL_LOCAL_USER=sa SQL_LOCAL_PASSWORD=... ``` ## Architecture ``` ┌──────────────────┐ │ Agents │ ← OblioAgent subclasses ├──────────────────┤ │ SQLMemory │ ← Semantic operations (remember/recall/queue/log) ├──────────────────┤ │ SQLConnector │ ← Generic SQL execution (retry, parameterized, logging) ├──────────────────┤ │ pymssql (TDS) │ ← Native SQL Server driver └──────────────────┘ ``` ## License MIT

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 sql-memory-1776124753 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 sql-memory-1776124753 技能

通过命令行安装

skillhub install sql-memory-1776124753

下载 Zip 包

⬇ 下载 sql-memory v2.1.0

文件大小: 27.49 KB | 发布时间: 2026-4-14 14:14

v2.1.0 最新 2026-4-14 14:14
Housekeeping: removed infrastructure copies and unrelated tests. Branches main+development now in sync. Skill now contains only: sql_memory.py, setup_schema.py, knowledge-base docs.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部