{"skill":{"slug":"persisent-mind","displayName":"Persistent Mind","summary":"Provides persistent, searchable, context-aware memory storage for AI agents to retain user preferences, corrections, and project context across sessions.","description":"# PersistentMind\n\n**Persistent, searchable, context-aware memory for AI agents. Store what matters. Never lose context again.**\n\nFree and open-source (MIT License) • Zero dependencies • Works locally • No API keys required\n\n---\n\n## Why This Skill?\n\nAI agents forget everything between sessions. Every time you start a new conversation, you repeat the same context: your preferences, your project setup, corrections to previous mistakes, procedures you've documented. This skill solves that permanently.\n\n### Problems it solves:\n- Agents forget user preferences between sessions\n- Same mistakes repeated because corrections aren't persisted\n- Project context has to be re-explained every time\n- No way to build up a team knowledge base over time\n\n---\n\n## Core Concepts\n\n### Memory Types\n\n| Type | Use For | Example |\n|------|---------|---------|\n| `fact` | Factual information | \"Database is PostgreSQL 16\" |\n| `preference` | User preferences | \"User prefers concise responses\" |\n| `procedure` | How-to steps | \"Run migrations with: poetry run alembic upgrade head\" |\n| `correction` | Mistakes + fixes | \"Never use wildcard imports — CI will fail\" |\n| `context` | Background info | \"This is a B2B SaaS product for HR teams\" |\n| `relationship` | How things relate | \"AuthService depends on UserRepository\" |\n| `reminder` | Notes for later | \"Check with team before changing DB schema\" |\n\n### Memory Scopes\n\n| Scope | Persists | Use For |\n|-------|----------|---------|\n| `global` | Always | Cross-project preferences, universal rules |\n| `project` | Within project | Project-specific facts, procedures, corrections |\n| `session` | Current session only | Temporary working notes |\n\n---\n\n## Features\n\n### 1. Store Memories\n\n```python\nfrom persistentmind import PersistentMind, MemoryType, MemoryScope\n\nmm = PersistentMind(project=\"my-app\")\n\n# Critical correction — will always surface first in context\nmm.remember(\n    \"Never use wildcard imports — the linter will fail CI\",\n    memory_type=MemoryType.CORRECTION,\n    scope=MemoryScope.PROJECT,\n    importance=10.0,\n    tags=[\"linting\", \"ci\", \"imports\"]\n)\n\n# Global preference — applies everywhere\nmm.remember(\n    \"User prefers code examples over long explanations\",\n    memory_type=MemoryType.PREFERENCE,\n    scope=MemoryScope.GLOBAL,\n    importance=8.0\n)\n\n# Auto-tags extracted from content automatically if you don't specify\nmm.remember(\n    \"The Stripe API key is in .env as STRIPE_SECRET_KEY\",\n    memory_type=MemoryType.FACT,\n    scope=MemoryScope.PROJECT,\n    importance=9.0\n)\n```\n\n### 2. Search Memories\n\n```python\n# Full-text search with relevance scoring\nresults = mm.recall(\"database migrations\")\nfor r in results:\n    print(f\"[{r.relevance_score:.2f}] [{r.memory.memory_type}] {r.memory.content}\")\n\n# Search with filters\nresults = mm.recall(\"imports\", type_filter=\"correction\", min_importance=7.0)\n\n# Get by type\ncorrections = mm.recall_by_type(MemoryType.CORRECTION)\n\n# Get by tag\ndb_memories = mm.recall_by_tag(\"database\")\n```\n\n### 3. Inject Context Into Prompts\n\n```python\n# Get a formatted context block to prepend to any prompt\ncontext = mm.get_context(project=\"my-app\", max_tokens_estimate=1500)\n\nprompt = f\"\"\"\n{context}\n\n---\n\nUser request: {user_input}\n\"\"\"\n```\n\nOutput:\n```\n# Relevant Memory Context\n\n⚠️ [CORRECTION] Never use wildcard imports — the linter will fail CI\n⚙️ [PREFERENCE] User prefers code examples over long explanations\n📌 [FACT] The Stripe API key is in .env as STRIPE_SECRET_KEY\n📋 [PROCEDURE] Run migrations with: poetry run alembic upgrade head\n```\n\nCorrections always surface first. Importance score determines ranking.\n\n### 4. Memory Management\n\n```python\n# Update an existing memory\nmm.update_memory(memory_id=\"mem_abc123\", importance=9.0, tags=[\"critical\"])\n\n# Archive a memory (soft delete)\nmm.forget(\"mem_abc123\")\n\n# Permanently delete\nmm.forget(\"mem_abc123\", permanent=True)\n\n# Expire automatically after N days\nmm.remember(\"Temp token: abc...\", expires_in_days=7)\n```\n\n### 5. Deduplication\n\n```python\n# Find near-duplicate memories (dry run — just report)\ngroups = mm.consolidate(dry_run=True)\nfor g in groups:\n    print(f\"Found {g['count']} similar memories:\")\n    for m in g['memories']:\n        print(f\"  - {m['content']}\")\n\n# Actually merge them\nmm.consolidate(dry_run=False)\n```\n\n### 6. Team Sharing\n\n```python\n# Export your memory set\nmm.export_memories(\"team_memories.json\")\n\n# Import a colleague's memories\nmm.import_memories(\"team_memories.json\")\n```\n\n### 7. Summary & Stats\n\n```python\nprint(mm.format_summary())\n```\n\n```\n🧠 Total Active Memories: 24  |  Archived: 3\n   Avg Importance: 7.4/10\n\n📊 BY TYPE\n  • correction             4\n  • fact                   8\n  • preference             5\n  • procedure              4\n  • context                3\n```\n\n---\n\n## Importance Scoring Guide\n\n| Score | Use When |\n|-------|----------|\n| 10 | Critical — never violate (e.g. security rules, CI requirements) |\n| 8-9 | Important — strong preference or key fact |\n| 5-7 | Useful but not critical |\n| 1-4 | Nice to know, low priority |\n\n---\n\n## API Reference\n\n### `PersistentMind(storage_path, project, session_id, auto_cleanup_days)`\nInitialize. Data stored in `.persistentmind/` by default.\n\n### `remember(content, memory_type, scope, tags, importance, project, expires_in_days, source)`\nStore a new memory. Returns `Memory` object.\n\n### `recall(query, scope_filter, type_filter, project_filter, limit, min_importance)`\nSearch memories. Returns `List[MemorySearchResult]` sorted by relevance.\n\n### `recall_by_type(memory_type, limit)`\nGet all memories of a specific type, sorted by importance.\n\n### `recall_by_tag(tag, limit)`\nGet all memories with a specific tag.\n\n### `get_context(project, max_tokens_estimate)`\nGet formatted context block for prompt injection. Corrections surfaced first.\n\n### `update_memory(memory_id, content, importance, tags)`\nUpdate an existing memory's fields.\n\n### `forget(memory_id, permanent)`\nArchive (default) or permanently delete a memory.\n\n### `consolidate(dry_run)`\nFind near-duplicate memories. Set `dry_run=False` to merge them.\n\n### `get_stats()`\nReturn memory statistics dictionary.\n\n### `format_summary()`\nHuman-readable memory summary.\n\n### `export_memories(output_file, include_archived)`\nExport to JSON for backup or team sharing.\n\n### `import_memories(input_file, overwrite_duplicates)`\nImport from JSON export file.\n\n---\n\n## Privacy & Security\n\n- ✅ **Zero telemetry** — No data sent anywhere\n- ✅ **Local-only storage** — Everything in `.persistentmind/` on your machine\n- ✅ **No API keys required** — Zero credentials needed\n- ✅ **No authentication** — No accounts or logins\n- ✅ **Full transparency** — MIT licensed, source code included\n\n---\n\n## Changelog\n\n### [1.0.0] - 2026-02-16\n\n- ✨ Initial release — PersistentMind\n- ✨ 7 memory types: fact, preference, procedure, context, correction, relationship, reminder\n- ✨ 3 scopes: global, project, session\n- ✨ Full-text search with relevance scoring, importance boosting, recency decay\n- ✨ Prompt context injection via `get_context()`\n- ✨ Automatic tag extraction from content\n- ✨ Memory consolidation for deduplication\n- ✨ Export/import for team sharing\n- ✨ Auto-expiry and stale session cleanup\n- ✨ Zero dependencies, local-only storage, MIT licensed\n\n---\n\n**Last Updated**: February 16, 2026\n**Current Version**: 1.0.0\n**Status**: Active & Community-Maintained\n\n© 2026 UnisAI Community\n","tags":{"latest":"1.0.0"},"stats":{"comments":0,"downloads":925,"installsAllTime":0,"installsCurrent":0,"stars":1,"versions":1},"createdAt":1771272047875,"updatedAt":1778491560329},"latestVersion":{"version":"1.0.0","createdAt":1771272047875,"changelog":"Initial Commit","license":null},"metadata":null,"owner":{"handle":"vedantsingh60","userId":"s179v2zgm6hpzqc71ntdmqjn9184gcz4","displayName":"vs","image":"https://avatars.githubusercontent.com/u/36488896?v=4"},"moderation":null}