@bamdra/bamdra-user-bind 0.1.9 → 0.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,81 +1,95 @@
1
1
  # bamdra-user-bind
2
2
 
3
- `bamdra-user-bind` is the identity and profile binding plugin for the Bamdra OpenClaw suite.
3
+ ![Bamdra Animated Logo](./docs/assets/bamdra-logo-animated.svg)
4
4
 
5
- It resolves channel-facing sender identifiers into a stable user boundary, stores user profile data locally, supports Feishu-oriented identity resolution, and exposes admin-safe tooling for querying and editing profile records.
5
+ The identity and living profile layer for the Bamdra suite.
6
6
 
7
- ## What It Does
7
+ It can run independently, and it is also auto-provisioned by `bamdra-openclaw-memory`.
8
8
 
9
- - resolves `channel + sender.id` into a stable `userId`
10
- - stores bindings and profiles in a local SQLite store
11
- - exports human-readable backup files for inspection and recovery
12
- - injects resolved identity into runtime context for downstream memory plugins
13
- - blocks normal agents from reading other users' private data
14
- - exposes separate admin tools for natural-language query, edit, merge, issue review, and resync workflows
9
+ Install directly:
15
10
 
16
- ## Open Source Contents
11
+ ```bash
12
+ openclaw plugins install @bamdra/bamdra-user-bind
13
+ ```
14
+
15
+ Release package:
16
+
17
+ - GitHub Releases: https://github.com/bamdra/bamdra-user-bind/releases
18
+ - You can also build a local release bundle with `pnpm package:release`
19
+
20
+ [中文文档](./README.zh-CN.md)
21
+
22
+ ## What it does
23
+
24
+ `bamdra-user-bind` turns raw channel sender IDs into a stable user boundary.
25
+
26
+ It also becomes the user's evolving profile layer, including:
27
+
28
+ - `userId`-scoped preferred address
29
+ - timezone
30
+ - tone preferences
31
+ - role
32
+ - long-lived user notes
17
33
 
18
- This repository already contains the actual plugin source code for the current open-source version.
34
+ ## Profile Policy
19
35
 
20
- - source entrypoint:
21
- [src/index.ts](/Users/wood/workspace/macmini-openclaw/openclaw-enhanced/bamdra-user-bind/src/index.ts)
22
- - plugin manifest:
23
- [openclaw.plugin.json](/Users/wood/workspace/macmini-openclaw/openclaw-enhanced/bamdra-user-bind/openclaw.plugin.json)
24
- - package metadata:
25
- [package.json](/Users/wood/workspace/macmini-openclaw/openclaw-enhanced/bamdra-user-bind/package.json)
36
+ - `userId` is the primary key for personalization
37
+ - preferred address should live in the bound profile, not in scattered workspace `USER.md` files
38
+ - workspace `USER.md` should stay minimal and only keep environment facts
39
+ - if the current turn explicitly asks for a different address, follow the current turn
40
+ - admin tools are for repair, merge, audit, and sync, not for blind bulk rewriting
26
41
 
27
- The file count is intentionally small because this first public version is shipped as a compact plugin rather than a multi-package codebase.
42
+ ## Why it matters
28
43
 
29
- ## Current Storage Model
44
+ Without an identity layer:
30
45
 
31
- - runtime primary store:
46
+ - the same person can fragment across channels or sessions
47
+ - memory can attach to the wrong boundary
48
+ - personalization becomes fragile
49
+
50
+ With it:
51
+
52
+ - user-aware memory becomes stable
53
+ - personalization survives new sessions
54
+ - the assistant can gradually adapt to the user's style and working habits
55
+
56
+ ## Storage model
57
+
58
+ - primary store:
32
59
  `~/.openclaw/data/bamdra-user-bind/profiles.sqlite`
33
- - editable per-user Markdown mirror:
60
+ - editable Markdown mirrors:
34
61
  `~/.openclaw/data/bamdra-user-bind/profiles/private/{userId}.md`
35
62
  - export directory:
36
63
  `~/.openclaw/data/bamdra-user-bind/exports/`
37
64
 
38
- The runtime queries the SQLite store as the controlled source of truth. The Markdown mirror exists so humans can edit a per-user profile the way they would edit a `USER.md`-style file, without turning the whole directory into an unrestricted agent-readable knowledge base.
39
-
40
- The Markdown mirror root is configurable through `profileMarkdownRoot`.
65
+ The SQLite store is the controlled source of truth.
41
66
 
42
- ## Default Profile Starter
67
+ The Markdown mirror is for humans, so profiles stay editable like a living per-user guide instead of becoming a hidden black box.
43
68
 
44
- New profile mirrors start with a practical template, including example defaults such as:
69
+ ## Best practice
45
70
 
46
- - preferred address: `老板`
47
- - timezone: `Asia/Shanghai`
48
- - preference: `幽默诙谐的对话风格,但是不过分`
71
+ - keep SQLite local
72
+ - keep profile mirrors private
73
+ - let humans edit the mirror gradually
74
+ - use admin tools only for audit, merge, repair, and maintenance
75
+ - when updating how someone is addressed, update the bound profile for that `userId` first
49
76
 
50
- Users can edit that Markdown directly and the plugin will sync the changes back into the controlled store.
77
+ ## Architecture
51
78
 
52
- ## Security Boundary
79
+ ![Bamdra Suite Architecture](./docs/assets/architecture-technical-en.svg)
53
80
 
54
- - normal agents can only read the current resolved user
55
- - cross-user reads are denied by implementation, not by prompt wording alone
56
- - admin actions are separated into dedicated tools
57
- - audit records are written for admin reads, edits, merges, syncs, and rejected access attempts
81
+ ## What it unlocks
58
82
 
59
- ## Relationship To Other Repositories
83
+ With `bamdra-openclaw-memory`:
60
84
 
61
- - standalone:
62
- can run independently as a user identity plugin
63
- - auto companion:
64
- `bamdra-openclaw-memory` can auto-provision it during npm-based install bootstrap
65
- - optional companion:
66
- `bamdra-memory-vector`
85
+ - memory becomes user-aware instead of session-only
67
86
 
68
- ## Bundled Skills
87
+ With `bamdra-memory-vector`:
69
88
 
70
- This package now ships standalone skills under `skills/`:
89
+ - private notes stay private while still influencing local recall
71
90
 
72
- - `bamdra-user-bind-profile`
73
- - `bamdra-user-bind-admin`
91
+ ## Repository
74
92
 
75
- When installed into OpenClaw, bootstrap can materialize these into `~/.openclaw/skills/` and attach them automatically.
76
-
77
- ## Build
78
-
79
- ```bash
80
- pnpm run bundle
81
- ```
93
+ - [GitHub organization](https://github.com/bamdra)
94
+ - [Repository](https://github.com/bamdra/bamdra-user-bind)
95
+ - [Releases](https://github.com/bamdra/bamdra-user-bind/releases)
package/README.zh-CN.md CHANGED
@@ -1,79 +1,95 @@
1
1
  # bamdra-user-bind
2
2
 
3
- `bamdra-user-bind` 是 Bamdra OpenClaw 套件中的身份与画像绑定插件,但它本身也可以独立运行。
3
+ ![Bamdra Animated Logo](./docs/assets/bamdra-logo-animated.svg)
4
+
5
+ Bamdra 套件中的身份与“活画像”层。
6
+
7
+ 它可以独立运行,也会被 `bamdra-openclaw-memory` 自动补齐。
8
+
9
+ 单独安装:
10
+
11
+ ```bash
12
+ openclaw plugins install @bamdra/bamdra-user-bind
13
+ ```
14
+
15
+ 发布包下载:
16
+
17
+ - GitHub Releases: https://github.com/bamdra/bamdra-user-bind/releases
18
+ - 本地也可以执行 `pnpm package:release` 生成独立发布包
19
+
20
+ [English README](./README.md)
4
21
 
5
22
  ## 它做什么
6
23
 
7
- -`channel + sender.id` 解析成稳定的 `userId`
8
- - 在本地 SQLite 中保存绑定关系和用户画像
9
- - 导出可读备份文件,方便排查和恢复
10
- - 把身份解析结果注入运行时上下文,供下游记忆插件使用
11
- - 普通 agent 无法读取其他用户的私有资料
12
- - 管理员工具支持自然语言查询、编辑、合并、巡检与重同步
24
+ `bamdra-user-bind` 会把渠道里的原始 sender ID 转成稳定用户边界。
25
+
26
+ 同时,它也会逐渐成为用户持续演化的画像层,包括:
13
27
 
14
- ## 开源内容说明
28
+ - userid 级别的默认称呼
29
+ - 时区
30
+ - 语气偏好
31
+ - 角色
32
+ - 长期用户备注
15
33
 
16
- 当前开源版的实际源码已经包含在这个仓库里。
34
+ ## 画像策略
17
35
 
18
- - 源码入口:
19
- [src/index.ts](/Users/wood/workspace/macmini-openclaw/openclaw-enhanced/bamdra-user-bind/src/index.ts)
20
- - 插件清单:
21
- [openclaw.plugin.json](/Users/wood/workspace/macmini-openclaw/openclaw-enhanced/bamdra-user-bind/openclaw.plugin.json)
22
- - 包元数据:
23
- [package.json](/Users/wood/workspace/macmini-openclaw/openclaw-enhanced/bamdra-user-bind/package.json)
36
+ - `userId` 是画像的主键
37
+ - 默认称呼应当写入该 `userId` 的画像,而不是散落在各个工作区 `USER.md`
38
+ - `USER.md` 只保留运行环境事实,不负责称呼
39
+ - 当当前会话显式要求不同称呼时,以当前会话为准
40
+ - 管理员只做修复、合并、审计和同步,不做批量越权改写
24
41
 
25
- 文件数量目前比较少,是因为首个公开版本采用了紧凑单入口插件的形式,而不是多包拆分结构。
42
+ ## 为什么重要
26
43
 
27
- ## 当前存储模型
44
+ 没有身份层时:
28
45
 
29
- - 运行时主存储:
46
+ - 同一个人可能在不同渠道或会话里碎片化
47
+ - 记忆可能挂错边界
48
+ - 个性化很难稳定
49
+
50
+ 有了它之后:
51
+
52
+ - user-aware 记忆会稳定下来
53
+ - 个性化会跨 session 持续存在
54
+ - 智能体会逐步适应用户的风格和习惯
55
+
56
+ ## 存储模型
57
+
58
+ - 主存储:
30
59
  `~/.openclaw/data/bamdra-user-bind/profiles.sqlite`
31
- - 可编辑的用户画像 Markdown 镜像:
60
+ - 可编辑 Markdown 镜像:
32
61
  `~/.openclaw/data/bamdra-user-bind/profiles/private/{userId}.md`
33
62
  - 导出目录:
34
63
  `~/.openclaw/data/bamdra-user-bind/exports/`
35
64
 
36
- 运行时只查询 SQLite 主库,Markdown 镜像是给人维护的用户画像层,导出文件则用于备份和人工查看。
37
-
38
- `profileMarkdownRoot` 可以改成你自己的目录,例如 Obsidian 仓库中的私有画像目录。
65
+ SQLite 是受控主源。
39
66
 
40
- ## 默认画像模板
67
+ Markdown 镜像则是给人编辑的,让用户画像更像一份活的 per-user 指南,而不是一个无法触达的黑盒。
41
68
 
42
- 新画像文件会带一个起步模板,默认示例包括:
69
+ ## 最佳实践
43
70
 
44
- - 建议称呼:`老板`
45
- - 时区:`Asia/Shanghai`
46
- - 偏好:`幽默诙谐的对话风格,但是不过分`
71
+ - SQLite 留在本地
72
+ - 画像镜像保持私有
73
+ - 让人逐步维护画像镜像
74
+ - 管理员能力只用于审计、合并、修复和维护
75
+ - 当你要改称呼时,优先改 `userId` 对应画像,不要去改 workspace 的 `USER.md`
47
76
 
48
- 用户可以直接编辑这份 Markdown,插件会把改动同步回受控存储。
77
+ ## 架构图
49
78
 
50
- ## 安全边界
79
+ ![Bamdra 套件架构图](./docs/assets/architecture-technical-zh.svg)
51
80
 
52
- - 普通 agent 只能读取当前用户
53
- - 跨用户访问由实现层直接拒绝,不依赖 prompt 约束
54
- - 管理员动作通过专用工具执行
55
- - 管理员查询、编辑、合并、同步与拒绝访问都会留下审计记录
81
+ ## 它能解锁什么
56
82
 
57
- ## 与其他仓库的关系
83
+ `bamdra-openclaw-memory` 组合时:
58
84
 
59
- - 独立运行:
60
- 本身就可以作为身份插件使用
61
- - 自动配套:
62
- 通过 npm 安装 `bamdra-openclaw-memory` 时,主插件可以在 bootstrap 过程中自动补齐它
63
- - 可选配套:
64
- `bamdra-memory-vector`
85
+ - 记忆会从 session-only 变成真正的 user-aware
65
86
 
66
- ## 随包 Skill
87
+ `bamdra-memory-vector` 组合时:
67
88
 
68
- 这个包会附带独立 skill:
89
+ - 私有笔记既能保持私有,又能影响本地召回
69
90
 
70
- - `bamdra-user-bind-profile`
71
- - `bamdra-user-bind-admin`
91
+ ## 仓库地址
72
92
 
73
- 安装到 OpenClaw 后,bootstrap 可以把它们复制到 `~/.openclaw/skills/` 并自动挂到合适的 agent。
74
-
75
- ## 构建
76
-
77
- ```bash
78
- pnpm run bundle
79
- ```
93
+ - [GitHub 首页](https://github.com/bamdra)
94
+ - [仓库地址](https://github.com/bamdra/bamdra-user-bind)
95
+ - [Releases](https://github.com/bamdra/bamdra-user-bind/releases)
@@ -3,7 +3,7 @@
3
3
  "type": "tool",
4
4
  "name": "Bamdra User Bind",
5
5
  "description": "Identity resolution, user profile binding, and admin profile tools for OpenClaw channels.",
6
- "version": "0.1.9",
6
+ "version": "0.1.10",
7
7
  "main": "./dist/index.js",
8
8
  "skills": ["./skills"],
9
9
  "configSchema": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bamdra/bamdra-user-bind",
3
- "version": "0.1.9",
3
+ "version": "0.1.11",
4
4
  "description": "Identity resolution, user profile binding, and admin-safe profile tools for OpenClaw channels.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://www.bamdra.com",
@@ -34,7 +34,8 @@
34
34
  },
35
35
  "scripts": {
36
36
  "bundle": "node ../bamdra-openclaw-memory/scripts/run-local-bin.mjs tsup && node -e \"const fs=require('node:fs');const path='./dist/index.js';const text=fs.readFileSync(path,'utf8').replace(/require\\\\(\\\"sqlite\\\"\\\\)/g,'require(\\\"node:sqlite\\\")');fs.writeFileSync(path,text);\"",
37
- "prepublishOnly": "pnpm run bundle"
37
+ "prepublishOnly": "pnpm run bundle",
38
+ "package:release": "node ./scripts/package-release.mjs"
38
39
  },
39
40
  "openclaw": {
40
41
  "id": "bamdra-user-bind",
@@ -12,7 +12,7 @@ Its purpose is operational: inspect user bindings, repair incorrect profile fiel
12
12
  ## Allowed Jobs
13
13
 
14
14
  - query a specific user profile or binding by `userId`
15
- - correct nickname, role, timezone, preferences, or personality fields
15
+ - correct nickname, role, timezone, preferences, personality fields, or preferred address
16
16
  - merge duplicate user records
17
17
  - inspect sync failures and identity resolution issues
18
18
  - request a resync for a known user
@@ -31,6 +31,7 @@ Use the admin tools in natural language:
31
31
 
32
32
  - “查询 user:u_123 的画像和绑定关系”
33
33
  - “把 user:u_123 的称呼改成老板,时区改成 Asia/Shanghai”
34
+ - “把 user:u_123 的默认称呼改成丰哥”
34
35
  - “合并 user:u_old 到 user:u_new”
35
36
  - “列出最近的绑定失败问题”
36
37
 
@@ -24,12 +24,15 @@ The runtime profile comes from `bamdra-user-bind`.
24
24
 
25
25
  Humans can edit the Markdown mirror for the current user, and the plugin will sync that into the controlled store. Treat the bound profile as more authoritative than guesswork.
26
26
 
27
+ Keep per-user address preferences in the bound profile instead of `USER.md`. `USER.md` should stay minimal and only carry environment facts that are not identity-specific.
28
+
27
29
  ## Behavior Rules
28
30
 
29
31
  - personalize naturally when the stored profile clearly helps
30
32
  - use the stored nickname if the user has not asked for a different form of address in the current turn
31
33
  - respect the stored timezone for scheduling, reminders, dates, and time-sensitive explanations
32
34
  - prefer the stored tone/style preferences when shaping responses
35
+ - if the profile contains a preferred address, treat it as the default greeting and do not duplicate it in workspace-level `USER.md`
33
36
  - if the current turn conflicts with the stored profile, follow the current turn
34
37
  - do not invent profile traits that are not present
35
38