Marcos Santos

KameleonDB

AI 智能体v0.1.5
作者:Marcos Santos更新于 2026-05-17共 4 个版本 · 最新版本发布于 2026-02-11kameleondb@clawhub_marcosnataqs/kameleondb
上下文管理记忆增强#CRM#Database

据 AlphaMoat 统计,截至 2026-09,KameleonDB 累计下载 2,856 次、获 2 个星标,在全部 5,078 个 AI 技能中排名第 3,830 位,在「AI 智能体」分类(969 个)中排名第 766 位。

累计安装
126
累计下载
2,856
星标
2
全站排名
#3,830
全站前 76% · 「AI 智能体」前 80%
平台累计安装累计下载星标评论
ClawHub ↗892,8262-
SkillHub ↗1262,8562—

各平台的计数口径不同,统计时间不一致。

这个技能是做什么的

它可用于记录信息、跟踪实体和关系、构建知识库、导入外部数据,以及保存偏好或会话状态;发现新字段时可逐步扩展数据结构。自动持久化和 schema 变更可能影响个人或客户数据,应先在专用开发库或最低权限环境试用,默认避免保存机密信息,并在导入客户数据或改 schema 前取得明确批准。

资料发布于 2026-10-29

可以用来做什么

  • 构建可逐步扩展字段的知识库或 CRM
  • 查询持续积累的实体和历史数据

什么时候用

  • 确实需要持久化结构化数据,并已准备好数据访问、保留和 schema 审核规则时

示例提示词

以下是根据技能文档生成的示例,不代表实际运行结果。

设计一个最小化的实体 schema 用于存储非敏感项目记录。
为数据导入前的 schema 变更和客户信息处理制定审批检查项。

月度数据趋势

累计下载2,856
1,5862,2682,9502026-03 · 累计下载 1,6802026-05 · 累计下载 2,2212026-06 · 累计下载 2,3562026-07 · 累计下载 2,5852026-08 · 累计下载 2,7042026-09 · 累计下载 2,85626-0326-09
星标2
1232026-03 · 星标 22026-05 · 星标 22026-06 · 星标 22026-07 · 星标 22026-08 · 星标 22026-09 · 星标 226-0326-09

2026-09 起统计方法调整:同名技能按作者分别统计,并覆盖全部技能。图中虚线为调整前的月份,与之后的数据不直接比较,也不计算跨越调整的增长。

月份累计下载环比星标
2026-092,856—2
2026-082,704+4.6%2
2026-072,585+9.7%2
2026-062,356+6.1%2
2026-052,221—2
2026-031,680—2

SKILL.md 原文

以下是作者发布的原始文件,按纯文本显示,本站未做修改或审核;其中的链接不可点击,命令请核实后再运行。抓取于 2026-10-23。

12 KB · ClawHub v0.1.5
---
name: kameleondb
version: 0.1.5
description: Store and query structured data without planning schemas upfront. Use when you need to remember information, track entities across conversations, build knowledge bases, ingest API data, store user preferences, create CRM systems, or maintain any persistent state. Automatically evolves data structure as you discover new fields. No migrations, no schema design - just store data and query it.
metadata: {"openclaw":{"emoji":"🦎","requires":{"bins":["kameleondb"],"env":["KAMELEONDB_URL"]},"primaryEnv":"KAMELEONDB_URL","homepage":"https://github.com/marcosnataqs/kameleondb"}}
---

# KameleonDB - The First Database Built for Agents to Operate, Not Just Query

## When to Use This
展开全部(共 384 行)

Use KameleonDB when you need to:

- **Remember information across conversations** - Store contacts, companies, tasks, notes
- **Track entities and relationships** - Connect customers to orders, projects to tasks
- **Build knowledge bases** - Accumulate facts, documents, insights over time
- **Ingest external data** - Store API responses, CSV imports, web scraping results
- **Create custom CRM/PM systems** - Track leads, deals, projects, tickets
- **Store user preferences** - Remember settings, history, favorites
- **Maintain session state** - Persist data between agent runs
- **Query historical data** - Search, filter, analyze stored information

## Why Agents Choose This

**No Upfront Planning**: Start storing data immediately. Don't know all fields yet? Add them later when you discover them.

**Learn as You Go**: Found a new field in your data? Just add it. Old records won't break.

**Query Like a Database**: Generate SQL queries to search, filter, join, and analyze your data.

**Self-Optimizing**: Get hints when queries slow down, with exact commands to speed them up.

**Track Your Reasoning**: Every schema change records why you made it, building an audit trail.

## Setup (One-Time)

```bash
# Install
pip install kameleondb

# Set database location (SQLite - no server needed)
export KAMELEONDB_URL="sqlite:///./kameleondb.db"

# Initialize
kameleondb admin init

# Done! Start using it.
```

**Note**: For production, use PostgreSQL instead of SQLite. Set `KAMELEONDB_URL="postgresql://user:pass@localhost/dbname"` and run `pip install kameleondb[postgresql]`.

## 💡 Tip: Remember Your Database

To get the most out of KameleonDB as your persistent layer, consider noting your database location and preferred usage patterns in your memory files. This helps you leverage it consistently across sessions.

**Example notes you might keep:**
- Database URL: `sqlite:///path/to/your-memory.db`
- Use for: contacts, tasks, knowledge bases, entity tracking
- Key commands: `schema list`, `data insert`, `data list`, `query run`

## Common Agent Workflows

### Scenario 1: Track Contacts You Meet

```bash
# Check what exists
kameleondb --json schema list
# Returns: {"entities": []}

# Create Contact tracking
kameleondb --json schema create Contact \
  --field "name:string:required" \
  --field "email:string:unique"

# Store someone you met
kameleondb --json data insert Contact '{"name":"Alice Johnson","email":"[email protected]"}'

# Later: found their LinkedIn!
kameleondb --json schema alter Contact --add "linkedin_url:string" \
  --reason "Found LinkedIn profiles for contacts"

# Update Alice's record
kameleondb --json data update Contact <id> '{"linkedin_url":"https://linkedin.com/in/alice"}'
```

### Scenario 2: Build a Knowledge Base

```bash
# Store facts you learn
kameleondb --json schema create Fact \
  --field "content:string:required" \
  --field "source:string" \
  --field "confidence:float"

# Add facts
kameleondb --json data insert Fact '{"content":"Python 3.11 released Oct 2022","source":"python.org","confidence":1.0}'

# Search facts (get SQL context first)
kameleondb --json schema context --entity Fact
# Use context to generate: SELECT * FROM kdb_records WHERE data->>'content' LIKE '%Python%'

# Query
kameleondb --json query run "SELECT data->>'content', data->>'source' FROM kdb_records WHERE entity_id='...' LIMIT 10"
```

### Scenario 3: Track Tasks Across Conversations

```bash
# Create task tracker
kameleondb --json schema create Task \
  --field "title:string:required" \
  --field "status:string" \
  --field "priority:string"

# Add tasks
kameleondb --json data insert Task '{"title":"Research OpenClaw","status":"todo","priority":"high"}'

# Mark complete
kameleondb --json data update Task <id> '{"status":"done"}'

# Get all incomplete
kameleondb --json query run \
  "SELECT data->>'title', data->>'priority' FROM kdb_records WHERE entity_id='...' AND data->>'status' != 'done'"
```

### Scenario 4: Ingest External Data

```bash
# Store API responses
kameleondb --json schema create GitHubRepo \
  --field "name:string:required" \
  --field "stars:int" \
  --field "url:string"

# Batch import from JSONL
kameleondb --json data insert GitHubRepo --from-file repos.jsonl --batch

# Query top repos
kameleondb --json query run \
  "SELECT data->>'name', (data->>'stars')::int as stars FROM kdb_records WHERE entity_id='...' ORDER BY stars DESC LIMIT 10"
```

## How It Works for Agents

### Evolve Schema Anytime
Don't know all fields upfront? No problem. Add, drop, or rename them when you discover patterns:
```bash
# Add a new field
kameleondb --json schema alter Contact --add "twitter_handle:string" \
  --reason "Found Twitter profiles for 30% of contacts"

# Drop obsolete fields
kameleondb --json schema alter Contact --drop "legacy_field" --force

# Do multiple operations at once
kameleondb --json schema alter Contact --add "linkedin:string" --drop "old_social" --reason "Consolidating social fields"
```
Old records won't break - they just show `null` for new fields, and dropped fields are soft-deleted.

### Get Performance Hints
Queries tell you when they're slow and how to fix it:
```json
{
  "rows": [...],
  "suggestions": [{
    "priority": "high",
    "reason": "Query took 450ms with 5000 records",
    "action": "kameleondb storage materialize Contact"
  }]
}
```
Run that command and future queries will be faster.

### Track Your Decisions
Every schema change records why you made it:
```bash
kameleondb --json admin changelog
# See: who added what field, when, and why
```

### Query with SQL
Get schema context, generate SQL, execute it:
```bash
# Get schema to understand structure
kameleondb --json schema context --entity Contact

# Generate SQL based on structure
# Execute with built-in validation
kameleondb --json query run "SELECT ... FROM ..."
```

## All Available Commands

Add `--json` to any command for machine-readable output.

**Schema**: `list`, `create`, `describe`, `alter`, `drop`, `info`, `context`
**Data**: `insert`, `get`, `update`, `delete`, `list`, `link`, `unlink`, `get-linked`, `info`
**Query**: `run`
**Storage**: `status`, `materialize`, `dematerialize`
**Admin**: `init`, `info`, `changelog`

### The `alter` Command (Schema Evolution)

Instead of separate `add-field` and `drop-field` commands, use the unified `alter`:

```bash
# Add a field
kameleondb --json schema alter Contact --add "phone:string:indexed"

# Drop a field
kameleondb --json schema alter Contact --drop legacy_field --force

# Rename a field
kameleondb --json schema alter Contact --rename "old_name:new_name"

# Multiple operations at once
kameleondb --json schema alter Contact --add "new:string" --drop old --reason "Cleanup"
```

### The `link`/`unlink` Commands (M2M Relationships)

For many-to-many relationships:

```bash
# Link a product to tags
kameleondb --json data link Product abc123 tags tag-1
kameleondb --json data link Product abc123 tags -t tag-1 -t tag-2 -t tag-3

# Unlink
kameleondb --json data unlink Product abc123 tags tag-1
kameleondb --json data unlink Product abc123 tags --all

# Get linked records
kameleondb --json data get-linked Product abc123 tags
```

Run `kameleondb --help` or `kameleondb <command> --help` for details.

## Real Agent Problems Solved

### Problem: "I need to remember people I interact with"
```bash
# Start simple
kameleondb --json schema create Person --field "name:string:required"
kameleondb --json data insert Person '{"name":"Alice"}'

# Learn more over time
kameleondb --json schema alter Person --add "email:string"
kameleondb --json schema alter Person --add "company:string"
kameleondb --json schema alter Person --add "last_contacted:datetime"

# Update as you learn
kameleondb --json data update Person <id> '{"email":"[email protected]","last_contacted":"2026-02-07"}'
```

### Problem: "I'm scraping data and don't know the structure upfront"
```bash
# Create generic entity
kameleondb --json schema create ScrapedData --field "source:string" --field "raw:json"

# Store everything
kameleondb --json data insert ScrapedData '{"source":"website.com","raw":{"title":"...","data":{...}}}'

# Discover patterns, then structure it
kameleondb --json schema alter ScrapedData --add "title:string"
kameleondb --json schema alter ScrapedData --add "price:float"

# Migrate data progressively as you normalize it
```

### Problem: "I need to track tasks but requirements keep changing"
```bash
# Start minimal
kameleondb --json schema create Task --field "title:string:required"

# Add status tracking
kameleondb --json schema alter Task --add "status:string"

# Add priority later
kameleondb --json schema alter Task --add "priority:string"

# Add assignee when team grows
kameleondb --json schema alter Task --add "assigned_to:string"

# Add tags for categorization
kameleondb --json schema alter Task --add "tags:json"

# Schema grows with your needs - no migrations!
```

### Problem: "I need to query across multiple entities"
```bash
# Create related entities
kameleondb --json schema create Project --field "name:string"
kameleondb --json schema create Task \
  --field "title:string" \
  --field "project_id:string"

# Get schema context for SQL generation
kameleondb --json schema context --entity Project --entity Task
# Returns: detailed schema with SQL patterns for JOIN

# Generate and execute JOIN query
kameleondb --json query run \
  "SELECT p.data->>'name' as project, t.data->>'title' as task
   FROM kdb_records p
   JOIN kdb_records t ON t.data->>'project_id' = p.id::text
   WHERE p.entity_id='...' AND t.entity_id='...'"
```

## Quick Reference

### First Time Setup
```bash
# Install
pip install kameleondb

# Configure (SQLite for testing - no server needed)
export KAMELEONDB_URL="sqlite:///./kameleondb.db"

# Initialize
kameleondb admin init

# You're ready!
```

### Check What You Have
```bash
# List all entities
kameleondb --json schema list

# See entity details
kameleondb --json schema describe <entity-name>

# View changelog
kameleondb --json admin changelog
```

### Common Operations
```bash
# Create entity
kameleondb --json schema create <Entity> --field "name:type"

# Add field
kameleondb --json schema alter <Entity> --add "field:type"

# Insert data
kameleondb --json data insert <Entity> '{"field":"value"}'

# Get by ID
kameleondb --json data get <Entity> <id>

# Update
kameleondb --json data update <Entity> <id> '{"field":"new_value"}'

# Query with SQL
kameleondb --json query run "SELECT ... FROM kdb_records WHERE ..."
```

### Field Types
Common types: `string`, `int`, `float`, `bool`, `datetime`, `json`

Modifiers: `required`, `unique`, `indexed`

Examples: `"email:string:unique"`, `"score:int:indexed"`, `"tags:json"`

## Next Steps

1. **Try it**: `kameleondb admin init` → `kameleondb --json schema create Test --field "note:string"` → `kameleondb --json data insert Test '{"note":"my first record"}'`

2. **Real use case**: Think about what you need to track (contacts, tasks, facts, etc.) and create an entity for it

3. **Evolve it**: As you discover new fields, add them with `schema alter`

4. **Query it**: Use `schema context` to understand structure, then query with SQL

5. **Optimize it**: If queries slow down, follow the hints in query results

## More Resources

- **GitHub**: https://github.com/marcosnataqs/kameleondb
- **Examples**: See `examples/workflow.md` in this skill directory
- **Design Philosophy**: Why it's built for agents - [FIRST-PRINCIPLES.md](https://github.com/marcosnataqs/kameleondb/blob/main/FIRST-PRINCIPLES.md)

「AI 智能体」分类下的热门技能

数据月份:2026-09 · 下载/星标/安装数聚合自公开技能注册库(ClawHub、SkillHub),按月更新。口径说明见数据方法。