diff --git a/.claude/settings.json b/.claude/settings.json new file mode 100644 index 0000000..7bf866c --- /dev/null +++ b/.claude/settings.json @@ -0,0 +1,48 @@ +{ + "enabledPlugins": { + "superpowers@claude-plugins-official": true + }, + "enableAllProjectMcpServers": true, + "permissions": { + "allow": [ + "Bash(python *)", + "Bash(python3 *)", + "Bash(uv *)", + "Bash(pip *)", + "Bash(pytest *)", + "Bash(ruff *)", + "Bash(black *)", + "Bash(git status *)", + "Bash(git add *)", + "Bash(git diff *)", + "Bash(git log *)", + "Bash(git commit *)", + "Bash(git push:*)", + "Bash(git pull *)", + "Bash(git fetch *)", + "Bash(git checkout *)", + "Bash(git branch *)", + "Bash(ls *)", + "Bash(mkdir *)", + "Bash(cp *)", + "Bash(mv *)", + "Bash(rm *)", + "Bash(find *)", + "Bash(grep *)", + "Bash(make *)", + "Bash(npx *)", + "Bash(node *)", + "Bash(npm *)", + "Bash(echo *)", + "Bash(gh *)", + "Bash(env)", + "WebSearch", + "Read(workspace/**/*)", + "Write(workspace/**/*)", + "Edit(workspace/**/*)", + "Read(.claude/**/*)", + "Write(.claude/**/*)", + "Edit(.claude/**/*)" + ] + } +} diff --git a/.gitignore b/.gitignore index 7eeb637..2226c44 100644 --- a/.gitignore +++ b/.gitignore @@ -20,8 +20,10 @@ build/ .vscode/ .idea/ -# Project runtime -.claude/ +# Project runtime — commit base settings.json, ignore local overrides and runtime state +.claude/settings.local.json +.claude/scheduled_tasks.json +.claude/keybindings.json .obsidian/ # MCP configs and temp artifacts diff --git a/bin/commands/init.py b/bin/commands/init.py index 67ceda3..e271b6f 100644 --- a/bin/commands/init.py +++ b/bin/commands/init.py @@ -12,6 +12,10 @@ console = Console() stderr_console = Console(stderr=True) # Link name -> list of environment variable names to try, in order. +# +# Customize this dict for your own projects. Each entry creates a symlink +# from workspace/ to the target path resolved from one of the env vars. +# Users define the corresponding env vars in their shell config (e.g. ~/.zshrc). _LINK_MAP: dict[str, list[str]] = { "myacademia": ["path_myacademia"], "myslides": ["path_myslides", "MYSLIDES_ROOT"], diff --git a/templates/workspace/CLAUDE.md b/templates/workspace/CLAUDE.md index 2d50ce4..6217a09 100644 --- a/templates/workspace/CLAUDE.md +++ b/templates/workspace/CLAUDE.md @@ -16,6 +16,7 @@ - **风格**: 简洁直接,不说废话 - **解释**: 关键部分详细,熟悉内容简洁 - **代码**: PEP8 + Black,需要类型注解 +- **测试**: 高度重视 --- @@ -32,11 +33,6 @@ ### 知识检索 -使用 `metamemory` skill 或 `mm` CLI: -- `mm search ` - 搜索已有记忆 -- `mm list` - 列出所有文档 -- `mm folders` - 浏览文件夹结构 - 查询资料时直接用 `Grep`/`Read` 工具。 --- @@ -45,91 +41,26 @@ ``` workspace/ -├── .obsidian/ # Obsidian 配置 -├── myacademia -> ... # → Obsidian/iCloud 知识库 (符号链接) -├── myagent -> ... # → myagent 项目 (符号链接) -├── mydesktop -> ... # → Obsidian/iCloud 过程/共享文件 (符号链接) -├── myslides -> ... # → Slidev 幻灯片 (符号链接) -├── mytoolkit -> ... # → 个人 CLI 工具集 (符号链接) -├── mywebpage -> ... # → Docusaurus 网站 (符号链接) -├── scripts/ # 实用脚本 -└── tmp/ # 临时文件 +├── .claude/ # Claude Code 配置 +├── .obsidian/ # Obsidian 配置(可选) +├── .git/ # git 仓库 +├── CLAUDE.md # 本文件(个人助理配置) +├── tmp/ # 临时文件 +└── ... # 按需添加项目目录或符号链接 ``` -**符号链接配置**: -根据实际环境创建符号链接,目标路径因人而异。例如: -- `myacademia` → Obsidian/iCloud 知识库路径 -- `mydesktop` → Obsidian/iCloud 过程文件路径 -- `myagent` → myagent 项目路径 -- `myslides` → Slidev 幻灯片路径 -- `mytoolkit` → 个人 CLI 工具集路径 -- `mywebpage` → Docusaurus 网站路径 - -**重要路径**: -- `myacademia/` - Obsidian 知识库 -- `mydesktop/` - Obsidian/iCloud 过程/共享文件 -- `myagent/` - myagent 项目目录 -- `myslides/` - Slidev 幻灯片项目 -- `mytoolkit/` - 个人 CLI 工具集(PDF、图片、LaTeX 等) -- `mywebpage/` - Docusaurus 网站项目 +可按需创建符号链接指向常用目录(如文献库、项目目录等),方便 Claude 快速访问。 --- ## 4. 临时文件管理 -- **截图/下载** 默认写入 `tmp/`,避免污染项目根目录 -- Playwright MCP 截图时务必指定 `filename="tmp/xxx.png"`(cwd 为 workspace/) +- **截图/下载** 默认写入 `tmp/`,避免污染根目录 - 定期清理 `tmp/` 中过期的临时文件 --- -## 5. 文件系统管辖与主动搜索 - -### 管辖原则 -**全文件系统可管理**。具体目录结构以 `metamemory` 中的"文件系统知识库"文档为准,CLAUDE.md 不硬编码路径。 - -### 主动搜索协议 -当用户提及文件、合同、报告等时: -1. **优先查知识库**:先用 `mm search` 查 metamemory 中已记录的目录结构,定位可能位置 -2. **动态搜索**:在知识库提示的范围内用 `Glob`/`Grep` 按名称、日期、内容关键词搜索 -3. **模糊匹配**:支持关键词部分匹配(如"成都理工" → `*成都*`, `*理工*`) -4. **结果汇报**:列出候选文件路径、修改时间,供用户确认 -5. **兜底**:确实找不到时,询问是否需要创建或从其他来源获取 - -### 知识库同步 -每次 `file-manager` 整理后,读取操作日志并同步更新 `metamemory` 中的"文件系统知识库"文档,确保 wiki 与物理文件系统一致。禁止在 CLAUDE.md 中硬编码具体路径。 - ---- - -## 6. 记忆机制 - -使用 `metamemory`(`mm` CLI)跨会话持久化信息: - -### 写入 -```bash -# 创建文档(推荐用 stdin) -echo '# 内容' | mm create "标题" --tags "user,feedback" --by "myclaude" - -# 创建文件夹 -mm mkdir "myclaude" -``` - -### 读取 -```bash -mm search # 搜索 -mm list # 列出文档 -mm get # 按 ID 获取 -mm path # 按路径获取 -``` - -### 触发条件 -- 用户说"记住"/"记下来"/"以后默认..." -- 用户纠正行为或偏好 -- 发现重要的项目事实/约定 - ---- - -## 7. 沟通风格 +## 5. 沟通风格 - **简洁**: 不说废话 - **透明**: 复杂任务同步进度 @@ -142,7 +73,7 @@ mm path # 按路径获取 --- -## 8. 指令优先级 +## 6. 指令优先级 1. **明确指令** > 默认规则 2. **当前对话上下文** > 历史记忆