Metacognition (how to think) + Persistent Memory (what to remember)
Quick Start Β· Why AgentMind Β· Architecture Β· Examples Β· Contributing
Every AI agent has two fatal flaws:
-
It doesn't think about HOW it thinks. It jumps to answers, fabricates data, forgets the original goal mid-task, and repeats the same failing approach.
-
It forgets EVERYTHING when the conversation ends. New chat = total stranger. Your preferences, your projects, yesterday's progress β all gone.
AgentMind fixes both.
| Without AgentMind | With AgentMind | |
|---|---|---|
| New conversation | "What project? What language? Where is it?" | Reads your context from memory files, starts working immediately |
| Known pitfall | Wastes 10 minutes rediscovering the same fix | Checks procedural memory, avoids it in 2 seconds |
| Research task | Generates plausible-sounding fabricated statistics | Searches the web first, cites real sources |
| Complex task | Forgets the goal halfway through | Re-checks original intent after every major step |
| Same error 3x | Tries the same approach a 4th time | Hard rule: switches to a completely different method |
No database. No API keys. No vendor lock-in. Just Markdown files on your machine.
# Clone the repo
git clone https://github.com/q7766206/AgentMind.git
# For Claude Code
cp -r AgentMind/metacognition ~/.claude/skills/agentmind-metacognition
cp -r AgentMind/memory ~/.claude/skills/agentmind-memory
# Create your memory workspace
mkdir -p ~/agentmind/memory
cp AgentMind/memory/templates/* ~/agentmind/Just want better thinking without persistent memory?
cp -r AgentMind/metacognition ~/.claude/skills/agentmind-metacognitionJust want persistent memory without the thinking protocol?
cp -r AgentMind/memory ~/.claude/skills/agentmind-memory
mkdir -p ~/agentmind/memory
cp AgentMind/memory/templates/* ~/agentmind/Include the content of metacognition/SKILL.md and/or memory/SKILL.md in your system prompt or instruction file.
Claude Code
# Copy skill files to Claude's skill directory
cp -r AgentMind/metacognition ~/.claude/skills/agentmind-metacognition
cp -r AgentMind/memory ~/.claude/skills/agentmind-memory
# Create memory workspace
mkdir -p ~/agentmind/memory
cp AgentMind/memory/templates/* ~/agentmind/Claude Code will auto-detect skills in ~/.claude/skills/.
Cursor
# Copy to Cursor's rules directory
mkdir -p .cursor/rules
cp AgentMind/metacognition/SKILL.md .cursor/rules/agentmind-metacognition.md
cp AgentMind/memory/SKILL.md .cursor/rules/agentmind-memory.md
# Create memory workspace in your project root
mkdir -p .agentmind/memory
cp AgentMind/memory/templates/* .agentmind/Then in Cursor Settings β Rules, the files will be auto-loaded as project rules.
Windsurf
# Copy to Windsurf's rules directory
mkdir -p .windsurf/rules
cp AgentMind/metacognition/SKILL.md .windsurf/rules/agentmind-metacognition.md
cp AgentMind/memory/SKILL.md .windsurf/rules/agentmind-memory.md
# Create memory workspace
mkdir -p .agentmind/memory
cp AgentMind/memory/templates/* .agentmind/Cline (VS Code)
# Copy to Cline's custom instructions directory
mkdir -p .cline/rules
cp AgentMind/metacognition/SKILL.md .cline/rules/agentmind-metacognition.md
cp AgentMind/memory/SKILL.md .cline/rules/agentmind-memory.md
# Create memory workspace
mkdir -p .agentmind/memory
cp AgentMind/memory/templates/* .agentmind/Or paste the SKILL.md content into Cline's "Custom Instructions" field in settings.
ChatGPT / GPT-4 (Custom Instructions)
- Open ChatGPT β Settings β Personalization β Custom Instructions
- Paste the content of
metacognition/SKILL.mdinto "How would you like ChatGPT to respond?" - For memory: ChatGPT has built-in memory, but you can paste
memory/SKILL.mdto enhance its memory protocol
Note: ChatGPT's custom instructions have a character limit (~1500 chars). Use the condensed version from examples/chatgpt-condensed.md (coming soon).
Any LLM via System Prompt
For any LLM API (OpenAI, Anthropic, Google, local models):
# Python example
with open("AgentMind/metacognition/SKILL.md") as f:
metacognition = f.read()
with open("AgentMind/memory/SKILL.md") as f:
memory = f.read()
system_prompt = f"""
{metacognition}
---
{memory}
"""
# Use as system message in your API call
response = client.chat.completions.create(
model="your-model",
messages=[
{"role": "system", "content": system_prompt},
{"role": "user", "content": user_message}
]
)AgentMind
βββ metacognition/ # HOW your agent thinks
β βββ SKILL.md # The thinking protocol
β
βββ memory/ # WHAT your agent remembers
β βββ SKILL.md # The memory protocol
β βββ templates/ # Starter templates
β βββ MEMORY.md # Semantic memory (facts & preferences)
β βββ PROCEDURES.md # Procedural memory (lessons learned)
β βββ WORKING.md # Working memory (current task)
β
βββ examples/ # Real-world usage examples
βββ usage-examples.md
The thinking OS. It makes your agent:
- Decode intent β understand what the user really wants (not just what they said)
- Think in 3 layers β surface problem β real need β next problem
- Validate in reverse β actively try to disprove its own conclusions
- Monitor itself β catch fake completion, vague filler, mid-task amnesia
- Fail-3-Switch β same method fails 3 times? Mandatory method change
- Search offensively β web search is a primary weapon, not a last resort
Four layers of persistent memory, inspired by cognitive science:
| Layer | File | Purpose | Lifespan |
|---|---|---|---|
| Working | WORKING.md |
Current task state & progress | Session (cleared after task) |
| Episodic | memory/YYYY-MM-DD.md |
Daily event logs | 30 days |
| Semantic | MEMORY.md |
Long-term facts & user preferences | Permanent |
| Procedural | PROCEDURES.md |
How-to knowledge & lessons learned | Permanent |
All stored as plain Markdown. Open them in any text editor. Edit them. Delete what you don't want remembered. You're in full control.
- Memory Compression β Monthly protocol to distill episodic logs into semantic facts, deduplicate, and keep files lean
- Confidence Markers β Tag memories as
verify,uncertain, orstaleso the agent knows what to re-check - Conflict Resolution β Decision tree for handling contradictory information (preference changes, source disagreements, temporal updates)
- Multi-Profile Support β
profiles/directory structure for multiple agents or projects with shared knowledge base
Day 1: "My project is at ~/projects/myapp, using Python 3.11 with FastAPI."
β Agent writes to MEMORY.md
Day 2: "Add a new endpoint."
β Agent reads MEMORY.md, knows the project, framework, and location
β Starts working immediately. No questions asked.
Session 1: Agent tries `pip install` on system Python. Fails (no pip).
Discovers workaround: use venv pip.
β Writes to PROCEDURES.md
Session 2: Same situation arises.
β Agent reads PROCEDURES.md, uses venv pip directly.
β Zero time wasted.
User: "Write a market analysis report."
Without metacognition:
β Agent generates 2000 words of plausible but fabricated statistics
With metacognition:
β Agent assesses: "Information completeness: 30%. I need real data."
β Searches the web, finds actual statistics
β Writes report with cited sources
See more in examples/usage-examples.md.
| Feature | AgentMind | Mem0 | MemOS | OpenClaw Memory |
|---|---|---|---|---|
| Storage | Local Markdown | Vector DB + Graph DB | Vector DB + API | Local Markdown |
| Dependencies | None | Python SDK + API key | Python SDK + API key | Part of larger framework |
| Human-readable | β Plain text | β Embeddings | β Embeddings | β Plain text |
| Human-editable | β Any text editor | β API only | β API only | β Any text editor |
| Metacognition | β Built-in | β | β | β |
| Memory compression | β Monthly protocol | β Auto | β Auto | β |
| Confidence markers | β verify/uncertain/stale | β | β | β |
| Multi-profile | β profiles/ directory | β User-scoped | β User-scoped | β |
| Conflict resolution | β Decision tree | β Last-write-wins | β | β |
| Zero-code setup | β Copy files | β Requires coding | β Requires coding | β Requires setup |
| Cross-agent | β Claude/Cursor/Windsurf/GPT/any LLM | β SDK only | β SDK only | β OpenClaw only |
| Cost | Free | Free tier + paid | Free tier + paid | Free |
| Works offline | β | β | β | β |
AgentMind's niche: Zero-dependency, human-readable, works-offline memory + thinking protocol. Not competing with Mem0/MemOS on vector search β competing on simplicity and transparency.
π§ Email: 769811481@qq.com β Questions, collaborations, feedback welcome.
Contributions welcome! Here's how:
- Fork the repo
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- π Translations β translate SKILL.md files to other languages (Chinese, Japanese, Korean, Spanish...)
- π§ͺ More examples β real-world usage scenarios
- π Integrations β adapters for other AI platforms (Cursor, Windsurf, Cline...)
- π Memory analytics β scripts to visualize memory growth over time
- π Sync β optional cloud sync for multi-device setups
MIT License. See LICENSE for details.
Use it, modify it, share it. Attribution appreciated but not required.
Built with β€οΈ for the AI agent community
If AgentMind helps you, consider giving it a β on GitHub!
π§ 769811481@qq.com