微信扫码
添加专属顾问
我要投稿
Claude Code 解决了本地数据管理的核心痛点,让RAG和agent开发更安全高效。 核心内容: 1. 本地数据管理的五大常见问题与解决方案 2. Claude Code存储架构的四大设计原则 3. 多级配置体系与灵活扩展机制
{"projects": {"/Users/xxx/my-project": {"MCPServers": {"jarvis-tasks": {"type": "stdio","command": "python","args": ["/path/to/run_mcp.py"]}}}},"recentPrompts": ["Fix the bug in auth module","Add unit tests"]}
~/.claude/├── settings.json # 全局设置(权限、插件、清理周期)├── settings.local.json # 本地设置(机器特定,不提交Git)├── history.jsonl # 命令历史记录│├── projects/ # 📁 Session 数据(按项目组织,核心目录)│ └── -Users-xxx-project/ # 路径编码后的项目目录│ ├── {session-id}.jsonl # 主会话数据(JSONL格式)│ └── agent-{agentId}.jsonl # 子代理会话数据│├── session-env/ # Session 环境变量│ └── {session-id}/ # 按Session ID隔离│├── skills/ # 📁 用户级 Skills(全局可用)│ └── mac-mail/│ └── SKILL.md│├── plugins/ # 📁 插件管理│ ├── config.json # 插件全局配置│ ├── installed_plugins.json # 已安装插件列表│ ├── known_marketplaces.json # 市场源配置│ ├── cache/ # 插件缓存│ └── marketplaces/│ └── anthropic-agent-skills/│ ├── .claude-plugin/│ │ └── marketplace.json│ └── skills/│ ├── pdf/│ ├── docx/│ └── frontend-design/│├── todos/ # 任务列表存储│ └── {session-id}-*.json # 关联Session的任务文件│├── file-history/ # 文件编辑历史(按内容hash存储)│ └── {content-hash}/ # 哈希命名的文件备份目录│├── shell-snapshots/ # Shell 状态快照├── plans/ # Plan Mode 计划存储├── local/ # 本地工具/node_modules│ └── claude # Claude CLI 可执行文件│ └── node_modules/ # 本地依赖│├── statsig/ # 特性开关缓存├── telemetry/ # 遥测数据└── debug/ # 调试日志
┌─────────────────────────────────────────┐│ 项目级配置 │ 优先级最高│ 项目/.claude/settings.json │ 项目专属,覆盖其他配置├─────────────────────────────────────────┤│ 本地配置 │ 机器特定,不提交版本控制│ ~/.claude/settings.local.json │ 覆盖全局配置├─────────────────────────────────────────┤│ 全局配置 │ 优先级最低│ ~/.claude/settings.json │ 基础默认配置└─────────────────────────────────────────┘
{ "$schema": "https://json.schemastore.org/claude-code-settings.json", "permissions": { "allow": ["Read(**)", "Bash(npm:*)"], "deny": ["Bash(rm -rf:*)"], "ask": ["Edit", "Write"] }, "enabledPlugins": { "document-skills@anthropic-agent-skills": true }, "cleanupPeriodDays": 30}{ "permissions": { "allow": ["Bash(git:*)", "Bash(docker:*)"] }, "env": { "ANTHROPIC_API_KEY": "sk-ant-xxx" }}{ "permissions": { "allow": ["Bash(pytest:*)"] }}/Users/bill/My Project → -Users-bill-My-Project
{"type":"user","message":{"role":"user","content":"Hello"},"timestamp":"2026-01-05T10:00:00Z"}{"type":"assistant","message":{"role":"assistant","content":[{"type":"text","text":"Hi!"}]}}{"type":"user","message":{"role":"user","content":"Help me fix this bug"}}{"type": "user","uuid": "7d90e1c9-e727-4291-8eb9-0e7b844c4348","parentUuid": null,"sessionId": "e5d52290-e2c1-41d6-8e97-371401502fdf","timestamp": "2026-01-05T10:00:00.000Z","message": {"role": "user","content": "分析一下这个项目的架构"},"cwd": "/Users/xxx/project","gitBranch": "main","version": "2.0.76"}{"type": "assistant","uuid": "e684816e-f476-424d-92e3-1fe404f13212","parentUuid": "7d90e1c9-e727-4291-8eb9-0e7b844c4348","message": {"role": "assistant","model": "claude-opus-4-5-20251101","content": [{"type": "thinking","thinking": "用户想了解项目架构,我需要先查看目录结构..."},{"type": "text","text": "让我先看一下项目结构。"},{"type": "tool_use","id": "toolu_01ABC","name": "Bash","input": {"command": "ls -la"}}],"usage": {"input_tokens": 1500,"output_tokens": 200,"cache_read_input_tokens": 50000}}}file-history-snapshot (messageId: A)↓user (uuid: A, parentUuid: null) ← 用户提问(链路起点)↓assistant (uuid: B, parentUuid: A) ← AI思考 + 文本回复↓assistant (uuid: C, parentUuid: B) ← AI工具调用(如Bash命令)↓user (uuid: D, parentUuid: C) ← 工具执行结果(如Bash输出)↓assistant (uuid: E, parentUuid: D) ← AI基于工具结果继续回复↓summary (leafUuid: E) ← 会话摘要(关联链路终点)
用户提问 → 创建snapshot(备份原始内容) → Claude修改文件 → 用户不满意 → Esc+Esc撤销↑ ↓存储原始内容 ←─────────────────────────────── 从snapshot恢复原始内容
{"type": "file-history-snapshot","messageId": "7d90e1c9-e727-4291-8eb9-0e7b844c4348","snapshot": {"messageId": "7d90e1c9-e727-4291-8eb9-0e7b844c4348","trackedFileBackups": {"/path/to/file1.py": "原始文件内容\ndef hello():\n print('old')","/path/to/file2.js": "// 原始内容..."},"timestamp": "2026-01-05T10:00:00.000Z"},"isSnapshotUpdate": false}┌──────────────────┐│ 修改前 app.py ││ print("old") │───────→ 备份到 snapshot 的 trackedFileBackups└──────────────────┘↓┌──────────────────┐│ Claude 修改后 ││ print("new") │───────→ 写入磁盘(覆盖原文件)└──────────────────┘↓┌──────────────────┐│ 用户执行撤销 ││ 按下 Esc + Esc │───────→ 从 snapshot 恢复 "old" 内容到磁盘└──────────────────┘~/.claude/plugins/├── config.json插件全局配置(如启用/禁用规则)├── installed_plugins.json已安装插件列表(含版本、状态)├── known_marketplaces.json插件市场源配置(如Anthropic官方市场)├── cache/插件下载缓存(避免重复下载)└── marketplaces/市场源存储目录└── anthropic-agent-skills/官方插件市场├── .claude-plugin/│ └── marketplace.json市场元信息└── skills/市场提供的Skills├── pdf/PDF处理相关Skill├── docx/Word文档处理相关Skill└── frontend-design/前端设计相关Skill
53AI,企业落地大模型首选服务商
产品:场景落地咨询+大模型应用平台+行业解决方案
承诺:免费POC验证,效果达标后再合作。零风险落地应用大模型,已交付160+中大型企业
2026-02-04
Claude Cowork 真能替换 RAG ?
2026-02-03
使用 Agent Skills 做知识库检索,能比传统 RAG 效果更好吗?
2026-02-03
告别向量数据库!PageIndex:让AI像人类专家一样阅读长文档
2026-02-02
OpenViking:面向 Agent 的上下文数据库
2026-02-02
别再迷信向量数据库了,RAG 的“大力出奇迹”该结束了
2026-01-29
告别黑盒开发!清华系团队开源 UltraRAG:用“搭积木”的方式构建复杂 RAG 流程
2026-01-28
RAG优化不抓瞎!Milvus检索可视化,帮你快速定位嵌入、切块、索引哪有问题
2026-01-28
今天,分享Clawdbot记忆系统最佳工程实践
2025-12-04
2025-12-03
2025-11-13
2025-12-02
2025-11-13
2026-01-15
2025-12-07
2026-01-02
2025-12-23
2025-12-18
2026-02-04
2026-02-03
2026-01-19
2026-01-12
2026-01-08
2026-01-02
2025-12-23
2025-12-21