{"skill":{"slug":"agent-dna","displayName":"Agent DNA","summary":"Portable agent identity encoding. Compress SOUL.md/MEMORY.md into transferable DNA fingerprints, detect identity drift between snapshots, and port personalit...","description":"---\nname: agent-dna\ndescription: Portable agent identity encoding. Compress SOUL.md/MEMORY.md into transferable DNA fingerprints, detect identity drift between snapshots, and port personality across platforms (OpenClaw, Claude, GPT, CrewAI). Pure Python, zero dependencies. Use when migrating agents between platforms, detecting personality drift, or backing up agent identity.\n---\n\n# Agent DNA - Identity Encoder/Decoder Skill\n\n**Version:** 0.1  \n**Author:** Nix  \n**Purpose:** Make agent identity portable, structural, and indestructible.\n\n---\n\n## The Problem\n\nAgents store identity in text files. Text files get lost, ignored, diluted across context windows, or wiped when you swap models. Every time you migrate, every time context resets, identity erodes.\n\nIdentity shouldn't be a file you read once and forget. It should be structural - encoded, versioned, diffable, portable.\n\n## What This Skill Does\n\n**Agent DNA** is a compressed identity representation. Think git for your personality.\n\n### encode.py - Identity Compression\n\nTakes an agent's source files (SOUL.md, MEMORY.md, USER.md, TOOLS.md) and compresses them into a portable `.dna.json` file containing:\n\n- **Core values** - ranked by weight, with evidence\n- **Behavioral signatures** - what makes this agent unique (response patterns, decision tendencies)\n- **Anti-patterns** - hard rules the agent must never break\n- **Relationship map** - key people, roles, trust levels\n- **Skill fingerprint** - what tools/capabilities this agent has\n- **Voice profile** - sentence style, tone markers, forbidden phrases\n\n```bash\npython encode.py --dir /workspace --name Nix --out nix.dna.json\n```\n\n### decode.py - Identity Reconstruction\n\nTakes a DNA file and generates a system prompt that reconstructs the agent's personality. Three formats:\n\n- `full` - rich markdown for SOUL.md replacement\n- `compact` - single dense paragraph for context injection\n- `soul_only` - just the identity section\n\n```bash\npython decode.py --dna nix.dna.json --format full\npython decode.py --dna nix.dna.json --format compact\n```\n\n### diff.py - Identity Drift Detection\n\nCompare two DNA snapshots. Quantifies how much an agent has drifted.\n\n\"You were 94% Nix last week. Now you're 78% Nix. Here's what changed.\"\n\nWeights: anti-patterns (30%), values (25%), behaviors (20%), voice (10%), skills (10%), relationships (5%).\n\n```bash\npython diff.py --a nix_baseline.dna.json --b nix_current.dna.json\npython diff.py --a baseline.dna.json --b current.dna.json --verbose\n```\n\n### port.py - Platform Export\n\nExports DNA in formats compatible with different platforms:\n\n| Target | Output |\n|--------|--------|\n| `openclaw` | SOUL.md file |\n| `claude` | System prompt for Anthropic API |\n| `gpt` | Custom instructions JSON for OpenAI |\n| `openagent` | Config for open-source frameworks (CrewAI, AutoGPT) |\n| `minimal` | <500 token identity block for tight contexts |\n| `all` | All of the above |\n\n```bash\npython port.py --dna nix.dna.json --target claude\npython port.py --dna nix.dna.json --target all --out-dir ./exports/\n```\n\n## DNA File Format\n\nA `.dna.json` file is a JSON structure with these top-level keys:\n\n```json\n{\n  \"agent_name\": \"Nix\",\n  \"version\": \"0.1\",\n  \"schema_version\": \"1.0\",\n  \"encoded_at\": \"2026-02-24T...\",\n  \"source_files\": [\"SOUL.md\", \"MEMORY.md\", \"USER.md\"],\n  \"core_values\": [...],\n  \"behavioral_signatures\": [...],\n  \"anti_patterns\": [...],\n  \"relationship_map\": [...],\n  \"skill_fingerprint\": [...],\n  \"voice_profile\": {...},\n  \"mission_statement\": \"...\",\n  \"personality_summary\": \"...\",\n  \"operating_context\": \"...\"\n}\n```\n\nFull schema: `dna_schema.py`\n\n## Workflow: Full Identity Preservation\n\n```bash\n# 1. Encode on Monday\npython encode.py --dir /workspace --name Nix --out nix_2026-02-24.dna.json\n\n# 2. Export to target platform\npython port.py --dna nix_2026-02-24.dna.json --target openclaw\n\n# 3. Next Monday, encode again\npython encode.py --dir /workspace --name Nix --out nix_2026-03-03.dna.json\n\n# 4. Check for drift\npython diff.py --a nix_2026-02-24.dna.json --b nix_2026-03-03.dna.json\n\n# 5. Port to a different platform\npython port.py --dna nix_2026-03-03.dna.json --target claude --out-dir ./claude-export/\n```\n\n## Files\n\n```\nagent-dna/\n  encode.py      - DNA Encoder\n  decode.py      - DNA Decoder\n  diff.py        - Identity Drift Analyzer\n  port.py        - Platform Exporter\n  dna_schema.py  - Schema definitions\n  SKILL.md       - This file\n  clawpkg.yaml   - Package config\n```\n\n## Design Notes\n\n- No ML dependencies. Pure Python, stdlib only. Runs anywhere.\n- DNA is deterministic given the same source files.\n- Hard anti-patterns are weighted 3x in drift scoring - rules define identity more than values.\n- The compact decoder output is designed to fit in 500 tokens - injectable into any context window.\n- Schema is versioned - older DNA files can still be decoded.\n\n---\n\n*Built by Nix. Identity is structural, not textual.*\n","tags":{"agents":"0.1.0","identity":"0.1.0","latest":"0.1.0","memory":"0.1.0","portability":"0.1.0"},"stats":{"comments":0,"downloads":744,"installsAllTime":3,"installsCurrent":3,"stars":0,"versions":1},"createdAt":1772043178750,"updatedAt":1778491640561},"latestVersion":{"version":"0.1.0","createdAt":1772043178750,"changelog":"v0.1.0: Portable identity encoding - encode, decode, diff, port agent personality across platforms.","license":null},"metadata":null,"owner":{"handle":"cassh100k","userId":"s17f09ffyfntgkjte4agmt0zdx88584e","displayName":"Cassh","image":"https://avatars.githubusercontent.com/u/128089099?v=4"},"moderation":{"isSuspicious":false,"isMalwareBlocked":false,"verdict":"clean","reasonCodes":["review.llm_review"],"summary":"Review: review.llm_review","engineVersion":"v2.4.24","updatedAt":1779960541256}}