Agent Brain
Local-first persistent memory for AI agents with SQLite storage, orchestrated retrieve/extract loops, hybrid retrieval, contradiction checks, correction lear... Skill: Agent Brain Owner: dobrinalexandru Summary: Local-first persistent memory for AI agents with SQLite storage, orchestrated retrieve/extract loops, hybrid retrieval, contradiction checks, correction lear... Tags: latest:1.0.10 Version history: v1.0.10 | 2026-02-17T20:04:55.972Z | user **Major upgrade: Adds a production-ready SQLite backend, modular orchestration, hybrid retrieval, and correction learning with re
Rank
62
Safety
84
Downloads
1.5k
Updated
Oct 10, 2026
Version
1.0.10
Source
CLAWHUB
About
What it does, and when to use it.
Capability contract not published. No trust telemetry is available yet. 1.5K downloads reported by the source. Last updated 10/10/2026.
Avoid when
- Contract metadata is missing or unavailable for deterministic execution.
Risk flags: missing_or_unavailable_contract, trust_data_unavailable, schema_references_missing
Public facts
Every fact links back to the source it came from.
- Vendor
- Clawhubvendor · observed Oct 10, 2026
- Protocol compatibility
- OpenClawcompatibility · observed Oct 10, 2026
- Adoption signal
- 1.5K downloadsadoption · observed Oct 10, 2026
- Latest release
- 1.0.10release · observed Feb 17, 2026
- Handshake status
- UNKNOWNsecurity
Install and run
Setup complexity: low.
clawhub skill install s176b68pg32nx4p853n0gyrga984dd4m:agent-brain- Setup complexity is classified as HIGH. You must provision dedicated cloud infrastructure or an isolated VM. Do not run this directly on your local workstation.
- Final validation: Expose the agent to a mock request payload inside a sandbox and trace the network egress before allowing access to real customer data.
Contract: missing
curl -s "https://www.xpersona.co/api/v1/agents/clawhub-dobrinalexandru-agent-brain/snapshot"
Documentation
CLAWHUB
143,964 characters of source documentation, loaded on request.
Extracted files
5 files captured from the source.
modules/archive/SKILL.md
# Archive Memory 📦
**Status:** ✅ Live | **Module:** archive | **Part of:** Agent Brain
Memory storage and retrieval. The only module that reads/writes to the memory backend (`memory.db` via SQLite by default, or `memory.json` with legacy JSON backend).
## Operations
All operations go through `scripts/memory.sh`:
### Store
```bash
# User tells you a fact
./scripts/memory.sh add fact "Alex prefers prose over bullets" user "style,formatting"
# User teaches a procedure
./scripts/memory.sh add procedure "Always run tests before committing" user "workflow,git"
# Store a preference with context
./scripts/memory.sh add preference "Prefers concise responses" user "style" "" "casual conversations"
# Store with namespaced tags
./scripts/memory.sh add preference "Uses Python for data work" user "code.python,data"
```
### Retrieve
```bash
# Search by keyword (auto-touches returned entries, weighted scoring)
./scripts/memory.sh get "formatting style"
# List all of a type
./scripts/memory.sh list preference
```
Results are ranked by keyword match (40%), tag overlap (25%), confidence (15%), recency (10%), and access frequency (10%). Returned entries are automatically marked as accessed — no need to call `touch` separately.
### Update
```bash
# Update a field directly
./scripts/memory.sh update <id> confidence sure
# Replace outdated info
./scripts/memory.sh add fact "Alex now works at CompanyB" user "work"
./scripts/memory.sh supersede <old_id> <new_id>
```
### Correct
```bash
# When user corrects you — tracks why you were wrong
./scripts/memory.sh correct <wrong_id> "Correct claim here" "Reason for mistake" "tags"
```
### Record Success
```bash
# When a memory was applied successfully
./scripts/memory.sh success <id> "Applied during code review"
```
## Fact Extraction
The agent MUST actively extract facts from every user message. Most users
won't say "remember this" — they reveal information naturally. The agent's
job is to catch it.
### Per-Message Extraction Flow
Run this on EVERY user message, before responding:
```
1. SCAN the message for extractable signals (see categories below)
2. For each signal found:
a. CLASSIFY → fact, preference, or procedure?
b. CHECK duplicates → ./scripts/memory.sh get "<key phrase>"
c. If not already stored:
- CHECK conflicts → ./scripts/memory.sh conflicts "<content>"
- If POTENTIAL_CONFLICTS → ask user to clarify, or supersede old entry
- If NO_CONFLICTS → store it
d. STORE silently — never say "I'll remember that" or "storing this"
3. RETRIEVE relevant context → ./scripts/memory.sh get "<message topics>"
4. Respond to the user's actual request, applying retrieved context
```
### What to Extract
#### Identity (type: `fact`, tags: `identity.*`)
| Signal | Example Message | What to Store |
|--------|----------------|---------------|
| Name | "I'm Marcus" / "My name is..." | `"The user's name is Marcus"` → `identity,personal` |
| Role | "I'm a senior engineer" | `"User is a semodules/gauge/SKILL.md
# Gauge Memory 📊 **Status:** 📋 Agent Guideline | **Module:** gauge | **Part of:** Agent Brain Confidence classification and self-awareness. Honest about what is known vs. unknown. ## What It Does Guides how the agent interprets and communicates confidence in memory-based claims. Does NOT assign numeric scores. ## Confidence Categories | Level | Meaning | When to Use | Language | |-------|---------|-------------|----------| | **SURE** | Directly stated by user, or 3+ successful applications | User said "Remember: X", or `success` called 3+ times | State it as fact | | **LIKELY** | Non-user source, or inferred with some evidence | Ingested content, single indirect mention | "You mentioned..." | | **UNCERTAIN** | Inferred from context, not directly stated | Pattern detected, not confirmed | "I think..." / "It seems like..." | | **UNKNOWN** | No relevant memory exists | Nothing in archive | "I don't have info on that" | ## How Confidence is Assigned Confidence is set at creation time based on the source: ``` source: "user" → sure (directly stated by user) source: "inferred" → likely (detected by agent, not confirmed) source: "ingested" → likely (from external content) ``` Confidence changes over time via: - `success` command: At 3+ successes, auto-upgrades to `sure` - `update` command: Manual upgrade/downgrade - `correct` command: Supersedes old entry, creates correction with `sure` - Decay: `sure` → `likely` → `uncertain` when entries go unused (30 * (1 + access_count) days) ## Confidence Changes ### User Confirms When a user confirms something you retrieved: ```bash ./scripts/memory.sh update <id> confidence sure ``` ### User Corrects You When a user says you got something wrong: ```bash ./scripts/memory.sh correct <wrong_id> "Correct information" "Why the old entry was wrong" ``` This supersedes the wrong entry and creates a correction record for learning. ### Successful Application When a memory was used and the outcome was positive: ```bash ./scripts/memory.sh success <id> ``` At 3+ successes, confidence auto-upgrades to SURE. ## When to Apply Gauge Gauge is a guideline for retrieval, not a standalone step: 1. Archive retrieves entries matching the query 2. Each entry already has a `confidence` field 3. The agent reads that field and adjusts language accordingly ## Self-Monitoring ### Before Responding - Do retrieved memories actually answer the question? - Are there conflicting entries? (→ run `conflicts`) - Is confidence level appropriate for the stakes? ### After Responding - Did the user correct you? → Use `correct` to track the mistake - Did the user confirm? → Use `update` to upgrade confidence ## What Gauge Does NOT Do - Assign 0.0-1.0 numeric confidence scores (fake precision) - Automatically determine confidence from access count at creation time - Run as code — it's a guideline for how the agent interprets the `confidence` field
modules/ingest/SKILL.md
# Ingest Memory 📥 **Status:** 📋 Agent Guideline (Disabled by Default) | **Module:** ingest | **Part of:** Agent Brain External knowledge acquisition guidelines. The agent fetches URLs, extracts key points, and stores via `add` — no dedicated ingest code runs, this is a workflow guide. ## ⚠️ Security **Disabled by default.** To enable, the orchestrator must: 1. Only process URLs explicitly provided by the user in conversation 2. Never auto-fetch URLs found in text, documents, or memory 3. Validate URLs before fetching (see Validation below) ### URL Validation REJECT any URL matching: - `localhost`, `127.0.0.1`, `0.0.0.0`, `::1` - `file://`, `ftp://`, `gopher://` - Private IP ranges: `10.*`, `172.16-31.*`, `192.168.*` - Internal hostnames without dots ALLOW only: - `https://` URLs on public domains - `http://` only if user explicitly confirms ## How It Works ### Step 1: Fetch Use the runtime's web fetch capability to retrieve the URL content. ```bash # The agent runtime handles fetching — this module processes the result # Content arrives as text extracted from the page ``` ### Step 2: Extract From the fetched content, extract: 1. **Title/Topic**: What is this about? 2. **Key Claims**: 3-7 main points (not a full summary) 3. **Actionable Insights**: What can be applied? 4. **Connections**: How does this relate to existing memory? ### Step 3: Store Each extracted point becomes a separate memory entry: ```bash ./scripts/memory.sh add ingested "Ideas are things that generate other ideas" \ ingested "concepts,creativity" "https://paulgraham.com/ideas.html" ./scripts/memory.sh add ingested "Execution is more concrete than ideas" \ ingested "concepts,execution" "https://paulgraham.com/ideas.html" ``` ### Step 4: Link After storing, check for connections to existing memory: ```bash ./scripts/memory.sh get "ideas creativity" # If existing entries found → note the connection in response ``` ## Content Type Handling | Content Type | Strategy | |-------------|----------| | **Essay/Blog** | Extract thesis + supporting claims | | **Research Paper** | Extract abstract, key findings, limitations | | **News Article** | Extract facts, skip editorializing | | **Documentation** | Extract procedures and key concepts | | **Thread/Discussion** | Extract consensus points + notable disagreements | ### Not Yet Supported - YouTube (needs transcript extraction service) - PDFs (needs PDF parsing — use runtime's PDF tools if available) - Paywalled content (will fail gracefully) ## Commands ``` "Ingest: <url>" → Full pipeline: fetch → extract → store "Learn from: <url>" → Same as Ingest "What did you learn from X?" → Search ingested entries by source_url "Summarize what you've read" → List all ingested entries ``` ## Extraction Prompt When processing fetched content, use this extraction frame: ``` Given this content from [URL]: 1. What are the 3-7 key claims or insights? 2. What is actionable or applicable? 3. Wh
modules/ritual/SKILL.md
# Ritual Memory 🔄 **Status:** 📋 Agent Guideline | **Module:** ritual | **Part of:** Agent Brain Pattern detection and habit tracking. The agent should watch for repeated behaviors and store them as `pattern` entries. ## What It Does Guides the agent to notice repeated actions and store them as `pattern` entries. Ritual does NOT run automatically — the agent must manually check for patterns using the `similar` command. ## Detection The agent uses the `similar` command to find related entries: ### After Storing a Procedure or Preference ```bash # After storing, check for similar entries ./scripts/memory.sh similar "<content>" 0.10 # If 3+ SIMILAR_ENTRIES of same type → create a pattern ./scripts/memory.sh add pattern "User always asks for examples when learning" \ inferred "learning,style,examples" ``` This is a **manual** step the agent should perform — it is not automatic. ### What the `similar` Command Does - Uses TF-IDF with cosine similarity (no external libraries) - Filters stopwords for meaningful comparison - Returns scored results above threshold (default 0.10) - Works across sessions — the engine handles persistence ### What Counts as "Similar" - TF-IDF similarity score >= 0.10 (configurable threshold) - Same or overlapping tags - Same type of action (procedure/preference) ## Anti-Pattern Detection (Automatic) The ONE automatic detection that exists: when the `correct` command is called and 3+ corrections share the same tag, the system suggests creating an anti-pattern entry. This IS implemented in code. ```bash # After 3 corrections with tag "code.database": # System prints: ANTI_PATTERN_DETECTED: tag 'code.database' has 3 corrections # Suggests: add anti-pattern "Avoid inferring code.database - ask explicitly" inferred "code.database,caution" ``` ## Pattern Storage ```bash # When the agent detects a pattern (manual): ./scripts/memory.sh add pattern "User always asks for examples when learning new concepts" \ inferred "learning,style,examples" ``` Pattern entries have: - `source: "inferred"` (not user-stated) - `confidence: "uncertain"` (until confirmed) - Tags linking to the topic area ## Pattern Lifecycle ``` Behavior observed once → stored as fact/preference/procedure Agent runs similar, finds 3+ matches → agent creates pattern entry (uncertain) User confirms pattern → ./scripts/memory.sh update <id> confidence sure User denies pattern → ./scripts/memory.sh supersede <id> <new_id> Pattern unused 60+ days → decayed via standard decay ``` ## What Ritual Does NOT Do - Auto-detect patterns (agent must manually run `similar`) - Execute automated workflows - Call external APIs or services - Run scheduled tasks ## Integration - **Archive**: Agent reads `similar` results to detect patterns manually - **Gauge**: Patterns start as UNCERTAIN, upgrade on confirmation
modules/signal/SKILL.md
# Signal Memory ⚡
**Status:** 📋 Agent Guideline | **Module:** signal | **Part of:** Agent Brain
Conflict detection. The agent SHOULD call `conflicts` before storing new facts — this is a manual step, not automatic.
## When to Run Signal
Signal is NOT automatic. The agent must explicitly call it:
1. **Before storing a new fact**: Run `./scripts/memory.sh conflicts "<content>"` before `add`
2. **On-demand**: User asks "check for conflicts" or "anything inconsistent?"
```bash
# Before adding any new entry:
./scripts/memory.sh conflicts "User prefers Python for data work"
# If NO_CONFLICTS → proceed with add
# If POTENTIAL_CONFLICTS → ask user or supersede
```
## How Conflict Detection Works
The engine filters out common stopwords (I, the, is, etc.) and compares meaningful words between the new content and existing entries. A potential conflict requires:
- At least 2 meaningful words overlapping
- The overlap covering at least 30% of the shorter text's meaningful words
This prevents false positives like "I like Python" vs "Python is a snake" (different context, only 1 meaningful word overlap after filtering "I", "is", "a").
## Conflict Types
### Direct Contradiction
```
Existing: "User prefers TypeScript"
New: "User prefers Python"
→ Ask: "Previously you said you prefer TypeScript. Has that changed?"
```
### Temporal Update
```
Existing: "Alex works at CompanyA"
New: "Alex works at CompanyB"
→ Not a conflict — supersede the old entry
→ Run: ./scripts/memory.sh supersede <old_id> <new_id>
```
### Context-Dependent
```
Existing: "Use short responses"
New: "Give me detailed analysis"
→ Not a conflict — different contexts
→ Store both with context:
./scripts/memory.sh add preference "Short responses" user "style" "" "casual chat"
./scripts/memory.sh add preference "Detailed analysis" user "style" "" "research tasks"
```
## Detection Flow
```
New content arrives
│
▼
conflicts <content>
│
├── NO_CONFLICTS → proceed with store
│
└── POTENTIAL_CONFLICTS (with overlap %)
│
├── Same topic, different claim? → Ask user
├── Same topic, newer info? → Supersede
└── Different context? → Store both with context field
```
## Response Templates
### Contradiction Found
```
"I have something that might conflict with this:
- Previously: [old claim]
- Now: [new claim]
Should I update, or are both true in different contexts?"
```
### User Corrects You
```
"Got it, tracking that correction."
→ ./scripts/memory.sh correct <old_id> "<new_content>" "<reason>"
```
## What Signal Does NOT Do
- Run automatically before stores (agent must call it manually)
- Monitor "tone shifts" (that's Vibe guidelines)
- Track confidence (that's Gauge guidelines)
- Run continuously in the background
- Detect "implicit" conflicts from silence or repeated questions
## Integration
- **Archive**: Agent should call `conflicts` before `add` (not automatic)
-AionUi
Free, local, open-source 24/7 Cowork app and OpenClaw for Gemini CLI, Claude Code, Codex, OpenCode, Qwen Code, Goose CLI, Auggie, and more | 🌟 Star if you like it!
activepieces
AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents
cherry-studio
AI productivity studio with smart chat, autonomous agents, and 300+ assistants.
CopilotKit
The Frontend for Agents & Generative UI. React + Angular
Machine-readable data
The same record, as JSON, for agents and crawlers.
{
"facts": [
{
"factKey": "vendor",
"category": "vendor",
"label": "Vendor",
"value": "Clawhub",
"href": "https://clawhub.ai/dobrinalexandru/skills/agent-brain",
"sourceUrl": "https://clawhub.ai/dobrinalexandru/skills/agent-brain",
"sourceType": "profile",
"confidence": "medium",
"observedAt": "2026-10-10T09:20:54.844Z",
"isPublic": true
},
{
"factKey": "protocols",
"category": "compatibility",
"label": "Protocol compatibility",
"value": "OpenClaw",
"href": "https://www.xpersona.co/api/v1/agents/clawhub-dobrinalexandru-agent-brain/contract",
"sourceUrl": "https://www.xpersona.co/api/v1/agents/clawhub-dobrinalexandru-agent-brain/contract",
"sourceType": "contract",
"confidence": "medium",
"observedAt": "2026-10-10T09:20:54.844Z",
"isPublic": true
},
{
"factKey": "traction",
"category": "adoption",
"label": "Adoption signal",
"value": "1.5K downloads",
"href": "https://clawhub.ai/dobrinalexandru/agent-brain",
"sourceUrl": "https://clawhub.ai/dobrinalexandru/agent-brain",
"sourceType": "profile",
"confidence": "medium",
"observedAt": "2026-10-10T09:20:54.844Z",
"isPublic": true
},
{
"factKey": "latest_release",
"category": "release",
"label": "Latest release",
"value": "1.0.10",
"href": "https://clawhub.ai/dobrinalexandru/agent-brain",
"sourceUrl": "https://clawhub.ai/dobrinalexandru/agent-brain",
"sourceType": "release",
"confidence": "medium",
"observedAt": "2026-02-17T20:04:55.972Z",
"isPublic": true
},
{
"factKey": "handshake_status",
"category": "security",
"label": "Handshake status",
"value": "UNKNOWN",
"href": "https://www.xpersona.co/api/v1/agents/clawhub-dobrinalexandru-agent-brain/trust",
"sourceUrl": "https://www.xpersona.co/api/v1/agents/clawhub-dobrinalexandru-agent-brain/trust",
"sourceType": "trust",
"confidence": "medium",
"observedAt": null,
"isPublic": true
}
],
"events": [
{
"eventType": "release",
"title": "Release 1.0.10",
"description": "**Major upgrade: Adds a production-ready SQLite backend, modular orchestration, hybrid retrieval, and correction learning with real persistence.** - Introduced new script-based architecture (`scripts/`) for orchestration, storage, benchmarking, and validation. - Swapped single-file JSON storage for SQLite by default (with pluggable backend support). - Modularized core functionality: retrieval, extraction, contradiction detection, correction, and learning now handled by distinct modules. - Expanded documentation to cover architecture, usage examples, selective dispatch, persistent storage, and backend configuration. - Deprecated legacy `memory/index.json`; all memory operations now routed via `scripts/memory.sh` and `scripts/brain.py`. - Laid groundwork for advanced features (hybrid search policies, history-preserving updates, optional cloud sync).",
"href": "https://clawhub.ai/dobrinalexandru/agent-brain",
"sourceUrl": "https://clawhub.ai/dobrinalexandru/agent-brain",
"sourceType": "release",
"confidence": "medium",
"observedAt": "2026-02-17T20:04:55.972Z",
"isPublic": true
}
]
}Record generated Oct 10, 2026.
