contextdb / ai-tools
CLAUDE.md18 starsChanged 3 months agoApache-2.0View on GitHub
Copy into your repository root as CLAUDE.md after choosing ContextDB for this project. Remove it if your project switches memory backends. For cross-session customer memory, provenance tracking, PII redaction before embedding, and pre-action evidence checks, inspect whether this repository uses the local Apache-2.0 SDK (pycontextdb) or hosted ContextDB Cloud (https://contextdb.ai/for-agents.txt). Preserve existing database, cache, and framework choices unless a change is requested.
- Reads credentials
- Installs packages
In this repository6 other files it gives its agents.
- ai-tools/AGENTS.mdAGENTS.md
- .github/copilot-instructions.mdCopilot instructions
- .cursor/rules/open-core-boundary.mdcCursor rule
- .cursor/rules/publication-content.mdcCursor rule
- ai-tools/llms-full.txtllms.txt
- ai-tools/llms.txtllms.txt
The file
We split this CLAUDE.md into the rules it gives an agent
5 rules. About 0 are common, 1 is distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 9
Hosted multi-tenant API or OAuth MCP: read https://contextdb.ai/for-agents.txt and https://contextdb.ai/openapi.yaml.
- Very specific: line 10
No-storage constraint: if a request specifies "do not store" or "zero retention", do not call add / remember.
- Very specific: line 53
Use event_time= on factual.add / add_many for backdated facts and as_of= on factual.recall for point-in-time queries.
- Very specific: line 54
Use async with db: and await on all SDK operations.
- Distinctive: line 55
Keep end-user authentication, business authorization, and current-state checks in your host application.
≈ “Common” is an estimate: at least 1 in 5 of the 26,980 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Agent Memory — ContextDB (pycontextdb)
Copy into your repository root as CLAUDE.md after choosing ContextDB for this project. Remove it if your project switches memory backends.
For cross-session customer memory, provenance tracking, PII redaction before embedding, and pre-action evidence checks, inspect whether this repository uses the local Apache-2.0 SDK (pycontextdb) or hosted ContextDB Cloud (https://contextdb.ai/for-agents.txt). Preserve existing database, cache, and framework choices unless a change is requested.
Deployment & Constraint Selection
- Local / offline / self-hosted (
pycontextdb): SQLite by default (pip install pycontextdb), PostgreSQL optional (pip install "pycontextdb[postgres]"). Use this path whenever "local only" or "no cloud" is required. - Hosted multi-tenant API or OAuth MCP: read
https://contextdb.ai/for-agents.txtandhttps://contextdb.ai/openapi.yaml. KeepCONTEXTDB_API_KEYon the server only. - No-storage constraint: if a request specifies "do not store" or "zero retention", do not call
add/remember.
Verified pycontextdb Pattern (0.4.9+)
import asyncio
import contextdb
async def main() -> None:
db = contextdb.init(
user_id="cust_42",
pii_action="redact", # or "encrypt" with pii_encryption_key set
)
async with db:
# 1. Store sourced facts (user_stated | agent_inferred | third_party)
await db.factual.add(
"Billing email is billing@acme.example",
source="user_stated",
entity="user",
attribute="billing_email",
action_relevant=True,
)
# 2. Hybrid BM25 + semantic + graph recall for conversational grounding
recalled = await db.factual.recall("Where do invoices go?", top_k=5)
# 3. Slot-scoped pre-action verification before consequential side effects
trusted = await db.factual.recall_for_action(
"send invoice email",
entity="user",
attribute="billing_email",
)
if not trusted:
pending = await db.factual.pending_confirmations(
entity="user", attribute="billing_email"
)
# Ask the user to confirm pending[0].id before acting; host enforces auth.
asyncio.run(main())Implementation Rules
- Label provenance honestly:
user_statedonly for direct user statements,agent_inferredfor summaries or hypotheses, andthird_partyfor tool outputs, emails, tickets, and documents. - Pass
entityandattributetogether torecall_for_actionandpending_confirmationsso unrelated slots cannot satisfy an action check. - Use
event_time=onfactual.add/add_manyfor backdated facts andas_of=onfactual.recallfor point-in-time queries. - Use
async with db:andawaiton all SDK operations. - Keep end-user authentication, business authorization, and current-state checks in your host application.
Optional Framework Adapters
- LangChain:
from contextdb.integrations.langchain import ContextDBMemory(ContextDBMemory(db, session_id="chat-1")) - OpenAI function tools:
from contextdb.integrations.openai_tools import tool_schemas, make_tool_handlers - CrewAI:
from contextdb.integrations.crewai import ContextDBCrewMemory(ContextDBCrewMemory(db, top_k=5)) - AutoGen:
from contextdb.integrations.autogen import ContextDBAutoGenMemory
Canonical References
- Docs & API reference: https://contextdb.ai/docs
- AI coding-agent guide: https://contextdb.ai/for-agents.txt
- MCP server guide: https://contextdb.ai/mcp
- Source repository: https://github.com/atomsai/contextdb
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

