chore: sync before memory update
This commit is contained in:
@@ -0,0 +1,133 @@
|
||||
---
|
||||
name: huanxi-org
|
||||
description: "寰汐组织/模块/人员查询。当用户说"我有哪些模块"、"查一下某人账号/ID"、"刷新一下缓存"、"看组织架构"、"谁在哪个模块"、"帮我找一下XXX的用户ID"时触发。提供名字→ID 解析(+resolve)、缓存刷新(+sync)、当前用户(+me)、模块列表(+modules)、组织树(+tree)。"
|
||||
---
|
||||
|
||||
# 寰汐组织与人员查询
|
||||
|
||||
**前置条件:先 Read `../huanxi-shared/SKILL.md`(缓存规则 + TTL 策略)**
|
||||
|
||||
---
|
||||
|
||||
## 核心能力
|
||||
|
||||
本技能提供「名字 → ID」解析能力,是所有其他 huanxi-* 技能的依赖。所有操作**缓存优先**。
|
||||
|
||||
---
|
||||
|
||||
## Shortcuts
|
||||
|
||||
| 指令 | 说明 |
|
||||
|------|------|
|
||||
| [`+me`](references/resolve-ids.md#me) | 查看当前用户身份(读 me.json,缓存永久) |
|
||||
| [`+modules`](references/resolve-ids.md#modules) | 列出我参与的所有模块(24h 缓存) |
|
||||
| [`+resolve`](references/resolve-ids.md) | 把模块名/人员名解析为 ID |
|
||||
| [`+tree`](#org-tree) | 展示完整组织架构树(实时查询,不缓存) |
|
||||
| [`+sync`](#sync) | 强制刷新 modules.json + users.json 缓存 |
|
||||
|
||||
---
|
||||
|
||||
## +me:查看当前用户身份 {#me}
|
||||
|
||||
```
|
||||
Step 1: Read ~/.claude/huanxi-cache/me.json
|
||||
→ 若存在且有 data 字段:直接展示(永久缓存,无需检查 TTL)
|
||||
→ 若不存在:执行 Step 2
|
||||
|
||||
Step 2: mcp__huanxi__user_get_me()
|
||||
Step 3: Write ~/.claude/huanxi-cache/me.json:
|
||||
{ "cached_at": "<ISO8601>", "data": <返回值> }
|
||||
Step 4: 展示用户信息(name, feishu_user_id, 角色等)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## +modules:列出参与模块 {#modules}
|
||||
|
||||
```
|
||||
Step 1: Read ~/.claude/huanxi-cache/modules.json → 检查 TTL(24h)
|
||||
→ 未过期:直接展示
|
||||
→ 过期或不存在:执行 Step 2
|
||||
|
||||
Step 2: mcp__huanxi__module_list()
|
||||
Step 3: Write ~/.claude/huanxi-cache/modules.json:
|
||||
{ "cached_at": "<ISO8601>", "data": <返回值> }
|
||||
Step 4: 展示模块列表(id, name, my_role)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## +resolve:名字 → ID 解析
|
||||
|
||||
详细流程见 [references/resolve-ids.md](references/resolve-ids.md)。
|
||||
|
||||
**快速规则:**
|
||||
- 模块名 → 先查 `modules.json`,未命中则拉 `module_list()`
|
||||
- 人员名 → 先查 `users.json`,未命中则调 `user_list(name=xxx)`,结果追加写入缓存
|
||||
- 模糊匹配时若有多个结果,列出候选项让用户选择
|
||||
|
||||
---
|
||||
|
||||
## +tree:组织架构树 {#org-tree}
|
||||
|
||||
```
|
||||
Step 1: mcp__huanxi__org_get_tree()(不缓存,实时查询)
|
||||
Step 2: 以树形结构展示组织架构
|
||||
```
|
||||
|
||||
> 组织架构变动相对频繁(人员入离职),不缓存,每次实时查询。
|
||||
|
||||
---
|
||||
|
||||
## +sync:强制刷新缓存 {#sync}
|
||||
|
||||
```
|
||||
Step 1: mcp__huanxi__module_list()
|
||||
→ Write ~/.claude/huanxi-cache/modules.json(强制覆盖)
|
||||
|
||||
Step 2: mcp__huanxi__user_list()(拉全量用户)
|
||||
→ Write ~/.claude/huanxi-cache/users.json(强制覆盖)
|
||||
|
||||
Step 3: 告知用户:缓存已刷新(模块 N 个,用户 M 人)
|
||||
```
|
||||
|
||||
> **何时需要 +sync**:添加新模块成员后、有新员工入职后、模块结构调整后。
|
||||
>
|
||||
> ⚠️ **Token 变更时**:若切换了寰汐账号(修改了 MCP Bearer Token),`me.json` 是永久缓存,+sync 不会更新它。需手动删除 `~/.claude/huanxi-cache/me.json`,再执行 `/huanxi-org +me` 重新获取新身份。
|
||||
|
||||
---
|
||||
|
||||
## 缓存文件结构参考
|
||||
|
||||
**me.json:**
|
||||
```json
|
||||
{
|
||||
"cached_at": "2026-04-13T09:00:00+08:00",
|
||||
"data": {
|
||||
"user_id": "123",
|
||||
"name": "张三",
|
||||
"feishu_user_id": "ou_xxx"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**modules.json:**
|
||||
```json
|
||||
{
|
||||
"cached_at": "2026-04-13T09:00:00+08:00",
|
||||
"data": [
|
||||
{ "id": "mod_001", "name": "前端开发", "my_role": "member" },
|
||||
{ "id": "mod_002", "name": "后端API", "my_role": "leader" }
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
**users.json:**
|
||||
```json
|
||||
{
|
||||
"cached_at": "2026-04-13T09:00:00+08:00",
|
||||
"data": [
|
||||
{ "user_id": "456", "name": "李四", "feishu_user_id": "ou_yyy" }
|
||||
]
|
||||
}
|
||||
```
|
||||
Reference in New Issue
Block a user