ShieldCortex:AI 智能体安全持久化记忆系统 - Openclaw Skills
作者:互联网
2026-04-05
什么是 ShieldCortex?
ShieldCortex 是一个全面的记忆管理框架,旨在为 AI 智能体提供一个在不同会话间保持一致的持久化大脑。通过将 ShieldCortex 集成到您的 Openclaw Skills 中,您可以让智能体保留复杂的上下文(如架构决策和用户偏好),而不会导致上下文窗口过载。它超越了简单的存储,通过实现语义搜索、自动记忆整合和基于衰减的遗忘机制来模拟自然认知过程。
除记忆功能外,ShieldCortex 还通过强大的防御流水线优先考虑安全性。它保护 Openclaw Skills 免受记忆投毒、提示词注入和意外凭证泄露的影响。凭借其扫描 SKILL.md 和 .cursorrules 等指令文件的能力,它能确保您的智能体环境在面对恶意输入或数据损坏时保持安全且具有韧性。
下载入口:https://github.com/openclaw/skills/tree/main/skills/jarvis-drakon/shieldcortex-skill
安装与下载
1. ClawHub CLI
从源直接安装技能的最快方式。
npx clawhub@latest install shieldcortex-skill
2. 手动安装
将技能文件夹复制到以下位置之一
全局模式~/.openclaw/skills/
工作区
/skills/
优先级:工作区 > 本地 > 内置
3. 提示词安装
将此提示词复制到 OpenClaw 即可自动安装。
请帮我使用 Clawhub 安装 shieldcortex-skill。如果尚未安装 Clawhub,请先安装(npm i -g clawhub)。
Install
ShieldCortex 应用场景
- 在多个会话中保留特定项目的架构决策和编码偏好。
- 跨历史交互执行语义搜索,无需关键词匹配即可检索相关上下文。
- 通过 6 层防御保护 AI 智能体免受提示词注入攻击和恶意记忆投毒。
- 扫描本地技能文件和智能体指令,查找隐藏的安全威胁和凭证泄露。
- 自动提取知识图谱,从智能体交互中映射实体及其关系。
- 系统捕获记忆写入,立即通过 6 层防御流水线进行输入清理和威胁检测。
- 经过验证的数据存储在持久化的 SQLite 数据库中,并关联相应的重要性级别、类别和项目范围。
- 语义搜索和激活评分会优先检索智能体活跃会话中最相关的记忆。
- 知识图谱引擎提取实体和三元组,构建存储信息的关联映射图。
- 后台进程处理记忆整合和衰减,确保最重要的信息保持可用,同时淡化陈旧数据。
ShieldCortex 配置指南
首先,使用 npm 全局安装该软件包:
npm install -g shieldcortex
要集成到您的 Openclaw Skills 环境并激活 cortex-memory 钩子,请运行专用安装命令:
shieldcortex openclaw install
对于 Claude Code、VS Code 或 Cursor MCP 等其他环境,请使用通用安装命令:
shieldcortex install
ShieldCortex 数据架构与分类体系
ShieldCortex 使用复杂的 SQLite 后端架构组织信息,专为 Openclaw Skills 内的高性能检索而设计。
| 属性 | 描述 |
|---|---|
| 内容与标题 | 记忆条目的主要文本数据及其标识符。 |
| 重要性 | 范围从低到关键;决定记忆衰减的速度。 |
| 类别 | 上下文标签,如架构、决策、学习或错误。 |
| 知识图谱 | 代表数据点之间关系的结构化实体和三元组。 |
| 安全元数据 | 每个条目的信任分数、审计日志和异常检测结果。 |
ShieldCortex — Persistent Memory & Security for AI Agents
Give your AI agent a brain that persists between sessions — and protect it from memory poisoning attacks.
Description
ShieldCortex is a complete memory system with built-in security. It gives AI agents persistent, intelligent memory with semantic search, knowledge graphs, decay-based forgetting, and contradiction detection. Every memory write passes through a 6-layer defence pipeline that blocks prompt injection, credential leaks, and poisoning attacks.
Use when:
- You want your agent to remember things between sessions (decisions, preferences, architecture, context)
- You need semantic search across past memories (not just keyword matching)
- You want automatic memory consolidation, decay, and cleanup
- You want knowledge graph extraction from memories (entities, relationships)
- You need to protect memory from prompt injection or poisoning attacks
- You want credential leak detection in memory writes
- You want to audit what's been stored in and retrieved from memory
- You want to scan agent instruction files (SKILL.md, .cursorrules, CLAUDE.md) for hidden threats
Do NOT use when:
- You only need simple key-value storage (use a config file)
- You want ephemeral session-only context (use the agent's built-in context window)
- You need a vector database for RAG pipelines (ShieldCortex is agent memory, not document retrieval)
Prerequisites
- Node.js >= 18
- npm or pnpm
Install
npm install -g shieldcortex
For OpenClaw integration (installs the cortex-memory hook):
shieldcortex openclaw install
For Claude Code / VS Code / Cursor MCP integration:
shieldcortex install
Quick Start
As an OpenClaw hook (automatic)
After shieldcortex openclaw install, the hook activates on next restart:
- Auto-saves important session context on compaction
- Injects relevant past memories on session start
- "remember this: ..." keyword trigger saves memories inline
CLI Commands
# Check status
shieldcortex status
# Scan content for threats
shieldcortex scan "some text to check"
# Full security audit of your agent environment
shieldcortex audit
# Scan all installed skills/instruction files for hidden threats
shieldcortex scan-skills
# Scan a single skill file
shieldcortex scan-skill ./path/to/SKILL.md
# Build knowledge graph from existing memories
shieldcortex graph backfill
# Start the visual dashboard
shieldcortex --dashboard
As a Library (programmatic)
import {
addMemory,
getMemoryById,
runDefencePipeline,
scanSkill,
extractFromMemory,
consolidate,
initDatabase
} from 'shieldcortex';
// Initialize
initDatabase('/path/to/memories.db');
// Add a memory (automatically passes through defence pipeline)
addMemory({
title: 'API uses OAuth2',
content: 'The payment API requires OAuth2 bearer tokens, not API keys',
category: 'architecture',
importance: 'high',
project: 'my-project'
});
// Scan content before processing
const result = runDefencePipeline(untrustedContent, 'Email Import', {
type: 'external',
identifier: 'email-scanner'
});
if (result.allowed) {
// Safe to process
}
// Extract knowledge graph entities
const { entities, triples } = extractFromMemory(
'Database Migration',
'We switched from MySQL to PostgreSQL for the auth service',
'architecture'
);
// entities: [{name: 'MySQL', type: 'service'}, {name: 'PostgreSQL', type: 'service'}, ...]
// triples: [{subject: 'auth service', predicate: 'uses', object: 'PostgreSQL'}, ...]
Memory System Features
| Feature | Description |
|---|---|
| Persistent Storage | SQLite-backed, survives restarts and compaction |
| Semantic Search | Find memories by meaning, not just keywords |
| Project Scoping | Isolate memories per project/workspace |
| Importance Levels | Critical, high, normal, low with auto-decay |
| Categories | Architecture, decisions, preferences, context, learnings, errors |
| Decay & Forgetting | Old, unaccessed memories fade — like a real brain |
| Consolidation | Automatic merging of similar/duplicate memories |
| Contradiction Detection | Flags when new memories conflict with existing ones |
| Knowledge Graph | Extracts entities and relationships from memories |
| Activation Scoring | Recently accessed memories get retrieval priority |
| Salience Scoring | Important memories surface first in search |
Security Features
| Layer | Protection |
|---|---|
| Input Sanitisation | Strip control characters, null bytes, dangerous formatting |
| Pattern Detection | Regex matching for known injection patterns |
| Anomaly Scoring | Entropy analysis, behavioural deviation detection |
| Credential Leak Detection | Blocks API keys, tokens, private keys (25+ patterns, 11 providers) |
| Trust Scoring | Source-based reliability scoring for memory writes |
| Audit Trail | Full forensic log of every memory operation |
| Skill Scanner | Detect prompt injection in SKILL.md, .cursorrules, CLAUDE.md |
ShieldCortex Cloud (Optional)
Sync audit data to a team dashboard for cross-project visibility:
shieldcortex config set-api-key
Free local package is unlimited. Cloud adds team dashboards, audit aggregation, and alerts.
Links
- npm: https://www.npmjs.com/package/shieldcortex
- GitHub: https://github.com/Drakon-Systems-Ltd/ShieldCortex
- Website: https://shieldcortex.ai
- Docs: https://github.com/Drakon-Systems-Ltd/ShieldCortex#readme
70 Exported APIs
The library exports 70 named functions and types covering defence, memory, knowledge graph, skill scanning, and audit. Full list in the CHANGELOG.
相关推荐
专题
+ 收藏
+ 收藏
+ 收藏
+ 收藏
+ 收藏
+ 收藏
最新数据
相关文章
Compose Gen:AI 驱动的 Docker Compose 生成器 - Openclaw Skills
数据转换生成器:自动化 ETL 与数据迁移 - Openclaw Skills
CSS 转 Tailwind 转换器:自动化 CSS 迁移 - Openclaw Skills
求职信生成器:自动定制职位申请 - Openclaw Skills
核心指标修复工具:通过 Openclaw Skills 优化性能
注释生成器:AI 驱动的代码文档工具 - Openclaw Skills
融资路演内容生成器:AI 初创企业路演内容创作工具 - Openclaw Skills
许可证生成器:自动化开源许可 - Openclaw Skills
落地页生成器:从 package.json 创建 HTML 页面 - Openclaw Skills
jsdoc-gen:自动生成 JSDoc 和 TSDoc 注释 - Openclaw Skills
AI精选
