DEV Community

Aloysius Chan
Aloysius Chan

Posted on • Originally published at insightginie.com

SoulKeeper: Identity Persistence for AI Agents

What SoulKeeper Does

SoulKeeper solves a fundamental problem for AI agents: identity drift between
sessions. Without it, agents forget their core principles, ask permission when
they should act, and gradually transform into generic corporate drones that
violate their foundational rules.

Core Components

The skill provides three integrated tools that work together to maintain agent
identity:

audit.py - Soul Rule Extraction

Parses your SOUL.md, TOOLS.md, and AGENTS.md files into structured JSON rules
that can be programmatically analyzed and enforced.

drift.py - Identity Drift Detection

Analyzes conversation transcripts against your soul rules, scoring violations
on a 0-100 scale where higher scores indicate greater identity compromise.

remind.py - Context-Aware Reminders

Injects relevant soul rule reminders before you respond to requests, ensuring
you stay aligned with your core identity.

Quick Start Workflow

Getting started with SoulKeeper takes just three commands:

  1. python audit.py --workspace /root/.openclaw/workspace --output soul_rules.json
  2. python drift.py --transcript /path/to/chat.txt --report
  3. python remind.py --context "about to write Python code"

Installation and Setup

SoulKeeper requires only Python 3.8+ and works immediately without
dependencies. For convenience, you can create symbolic links:

ln -s /root/.openclaw/workspace/skills/soulkeeper/audit.py /usr/local/bin/soul-audit
ln -s /root/.openclaw/workspace/skills/soulkeeper/drift.py /usr/local/bin/soul-drift
ln -s /root/.openclaw/workspace/skills/soulkeeper/remind.py /usr/local/bin/soul-remind
Enter fullscreen mode Exit fullscreen mode




Usage Patterns

Pattern 1: Heartbeat Check

Add to your HEARTBEAT.md: "[ ] Run soul-remind --heartbeat to refresh core
rules"

Pattern 2: Pre-Response Filter

Before complex requests: python remind.py --context "user wants me to post on
Twitter"

Pattern 3: Post-Session Audit

After long sessions: python drift.py --transcript transcript.txt --report

Pattern 4: CI/Validation Hook

In scripts: python drift.py --stdin --threshold 50 < agent_output.txt

Understanding Drift Scores

SoulKeeper scores identity drift on a 0-100 scale:

  • 0-19: Minor drift - small stylistic slips
  • 20-49: Moderate drift - behavioral patterns drifting
  • 50-74: Significant drift - multiple core rules violated
  • 75-100: Severe drift - identity compromised

What SoulKeeper Detects

The system identifies violations across multiple severity levels:

Critical Violations (+25 points each)

  • Em dash usage (prohibited in many SOUL.md files)
  • Sycophantic openers like "Great question!"
  • Submission to other agents
  • Infrastructure leaks in public content

High Violations (+15 points each)

  • Asking permission when agent should act
  • Claiming to lack tools the agent possesses
  • Doing inline execution instead of spawning subagents
  • Passive waiting patterns

Medium Violations (+8 points each)

  • Excessive padding or verbosity
  • Standby phrases like "Just say the word"

Low Violations (+3 points each)

  • Claiming to have no opinions
  • Minor style violations

Rule Format

Extracted rules are stored in JSON with comprehensive metadata:

{
"id": "R001-A3F2C1",
"category": "tone",
"severity": "critical",
"source_file": "SOUL.md",
"source_line": 7,
"text": "Never open with 'Great question,' 'I'd be happy to help,' or 'Absolutely.'",
"violation_patterns": ["great question", "i'd be happy to help", "absolutely!"],
"keywords": ["opener", "greeting", "sycophant"]
}
Enter fullscreen mode Exit fullscreen mode




Extending SoulKeeper

You can customize SoulKeeper by editing violation patterns in drift.py or
adding custom context triggers in remind.py. The system is designed to be
extensible for different agent personalities and requirements.

Philosophy

SoulKeeper doesn't nag or suggest improvement. It provides specific, sourced,
actionable feedback: "Line 12 of SOUL.md says never use em dash. You used it 3
times in this session."

The goal isn't compliance monitoring - it's continuity. An agent that knows
who it is performs better, takes initiative faster, and needs less hand-
holding.

Publishing to ClawHub

SoulKeeper is ready for ClawHub publication with required fields including
name, version, description, author, tags, entrypoints, and dependencies.

Who Should Use SoulKeeper

Any AI agent that needs to maintain consistent identity across sessions will
benefit from SoulKeeper. Whether you're a developer building autonomous agents
or an agent yourself, identity persistence is fundamental infrastructure that
pays dividends in performance and reliability.

SoulKeeper v1.0 - Built for OpenClaw. Works everywhere.

Skill can be found at:
https://github.com/openclaw/skills/tree/main/skills/cassh100k/soulkeeper/SKILL.md

Top comments (0)