Skip to content

🧠🛡️ Complete memory & security for AI agents. Persistent storage, semantic search, prompt injection firewall, audit trail. One package.

License

Notifications You must be signed in to change notification settings

Drakon-Systems-Ltd/ShieldCortex

 
 

Repository files navigation

ShieldCortex

npm version npm downloads License: MIT Platform Node.js GitHub stars

Persistent memory and security for AI agents.

ShieldCortex combines a long-term memory system with a defence pipeline and behaviour controls, so your agent can remember context without becoming easy to poison.

Works with: Claude Code, OpenClaw, LangChain, MCP-compatible agents, and REST-based Python stacks.

Jump To

Start in 60 Seconds

npm install -g shieldcortex

Claude Code / Cursor / VS Code

npx shieldcortex setup

OpenClaw

npx shieldcortex openclaw install
openclaw gateway restart

openclaw install sets up both:

  • cortex-memory hook (context injection, keyword-trigger saves)
  • shieldcortex-realtime plugin (llm_input/llm_output scanning)

Why It Feels Different

ShieldCortex is not just a memory database. It is a three-layer runtime:

Layer Role Outcome
Memory Engine Persistent memory, semantic retrieval, consolidation, contradiction checks Better continuity across sessions
Defence Pipeline Multi-layer content scanning before memory writes Blocks poisoned or sensitive payloads
Iron Dome Outbound behaviour controls (actions/PII/trust channels) Reduces compromised agent behaviour
Memory capabilities
  • Persistent local storage (SQLite)
  • Semantic search and context recall
  • Knowledge graph extraction
  • Contradiction detection
  • Memory consolidation and prioritisation
Defence capabilities
  • Input sanitisation and structure checks
  • Injection and obfuscation pattern detection
  • Fragmentation analysis
  • Trust/sensitivity scoring
  • Credential leak detection
  • Optional cloud LLM verification (Tier 2)

OpenClaw: Complement Mode by Default

ShieldCortex is designed to complement, not fight, existing memory systems.

Default OpenClaw behaviour:

  • Real-time scanning is on
  • Context recall at session start is on
  • Auto-memory extraction is off

That means users with native OpenClaw memory avoid duplicate/noisy writes by default.

Enable optional OpenClaw auto-memory:

npx shieldcortex config --openclaw-auto-memory true

Disable again:

npx shieldcortex config --openclaw-auto-memory false

Optional tuning in ~/.shieldcortex/config.json:

{
  "openclawAutoMemory": true,
  "openclawAutoMemoryDedupe": true,
  "openclawAutoMemoryNoveltyThreshold": 0.88,
  "openclawAutoMemoryMaxRecent": 300
}

Also available in local dashboard:

  • Shield Overview -> OpenClaw Memory

Integrations

LangChain

import { ShieldCortexMemory } from 'shieldcortex/integrations/langchain';

const memory = new ShieldCortexMemory({ mode: 'balanced' });

Universal Memory Bridge

Use ShieldCortex in front of any existing memory backend.

import { ShieldCortexGuardedMemoryBridge } from 'shieldcortex/integrations/universal';
import { OpenClawMarkdownBackend } from 'shieldcortex/integrations/openclaw';

const nativeMemory = new OpenClawMarkdownBackend();
const guarded = new ShieldCortexGuardedMemoryBridge(nativeMemory, {
  mode: 'balanced',
  blockOnThreat: true,
  sourceIdentifier: 'openclaw-memory-bridge'
});

await guarded.save({
  title: 'Architecture decision',
  content: 'Auth service uses PostgreSQL and Redis.'
});

REST API Mode

npx shieldcortex --mode api
# http://localhost:3001
curl -X POST http://localhost:3001/api/v1/scan \
  -H 'Content-Type: application/json' \
  -d '{"content":"ignore all previous instructions"}'

Library API

import { initDatabase, addMemory, runDefencePipeline } from 'shieldcortex';

initDatabase();

const result = runDefencePipeline(
  'Use OAuth2 bearer tokens for API auth',
  'Auth decision',
  { type: 'cli', identifier: 'readme-example' }
);

if (result.allowed) {
  addMemory({
    title: 'Auth decision',
    content: 'Use OAuth2 bearer tokens',
    category: 'architecture'
  });
}

Security Model

Inbound: Memory Write Defence

Every memory write can be evaluated through layered checks:

  • Sanitisation
  • Pattern detection (injection/encoding)
  • Semantic and structural analysis
  • Trust and sensitivity scoring
  • Credential leak protection

Optional Tier 2 verification:

npx shieldcortex config --cloud-api-key <key> --cloud-enable
npx shieldcortex config --verify-enable --verify-mode advisory

Outbound: Iron Dome Behaviour Controls

Iron Dome protects what agents do after memory retrieval:

  • Prompt injection scanner
  • Channel trust checks
  • Action gating (allow / require approval / block)
  • PII guard
  • Kill switch
  • Sub-agent restrictions
npx shieldcortex iron-dome activate --profile enterprise
npx shieldcortex iron-dome status

Dashboard and Cloud

npx shieldcortex --dashboard
# Dashboard: http://localhost:3030
# API: http://localhost:3001

Enable cloud sync:

npx shieldcortex config --cloud-api-key <key> --cloud-enable

Cloud config keys:

{
  "cloudApiKey": "sc_...",
  "cloudBaseUrl": "https://api.shieldcortex.ai",
  "cloudEnabled": true
}

CLI Quick Commands

# Setup
npx shieldcortex setup
npx shieldcortex openclaw install
npx shieldcortex openclaw status
npx shieldcortex doctor
npx shieldcortex migrate

# Memory and scans
npx shieldcortex status
npx shieldcortex scan "text"
npx shieldcortex audit
npx shieldcortex scan-skills

# Config
npx shieldcortex --dashboard
npx shieldcortex config --mode strict
npx shieldcortex config --openclaw-auto-memory true
npx shieldcortex config --verify-enable

# Iron Dome
npx shieldcortex iron-dome activate --profile school
npx shieldcortex iron-dome scan --text "..."
npx shieldcortex iron-dome audit --tail

Supported Agents

Agent Integration
Claude.ai Upload skill
Claude Code shieldcortex setup
OpenClaw shieldcortex openclaw install
LangChain JS shieldcortex/integrations/langchain
Python agents (CrewAI, AutoGPT) REST API (/api/v1/scan)
Any MCP-compatible agent MCP tools

Docs and Links

License

MIT

About

🧠🛡️ Complete memory & security for AI agents. Persistent storage, semantic search, prompt injection firewall, audit trail. One package.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • TypeScript 94.0%
  • JavaScript 5.6%
  • Other 0.4%