pasm-agents 0.4.3__tar.gz

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.
Files changed (59) hide show
  1. pasm_agents-0.4.3/LICENSE +21 -0
  2. pasm_agents-0.4.3/PKG-INFO +264 -0
  3. pasm_agents-0.4.3/README.md +235 -0
  4. pasm_agents-0.4.3/agents/__init__.py +7 -0
  5. pasm_agents-0.4.3/agents/product/__init__.py +1 -0
  6. pasm_agents-0.4.3/agents/product/companion/__init__.py +17 -0
  7. pasm_agents-0.4.3/agents/product/companion/agent.py +216 -0
  8. pasm_agents-0.4.3/agents/product/companion/quickstart.py +49 -0
  9. pasm_agents-0.4.3/agents/product/npc/__init__.py +17 -0
  10. pasm_agents-0.4.3/agents/product/npc/agent.py +139 -0
  11. pasm_agents-0.4.3/agents/product/npc/quickstart.py +43 -0
  12. pasm_agents-0.4.3/agents/product/tutor/__init__.py +15 -0
  13. pasm_agents-0.4.3/agents/product/tutor/agent.py +179 -0
  14. pasm_agents-0.4.3/agents/product/tutor/quickstart.py +43 -0
  15. pasm_agents-0.4.3/agents/verifiers/__init__.py +1 -0
  16. pasm_agents-0.4.3/agents/verifiers/companion_elderly/__init__.py +9 -0
  17. pasm_agents-0.4.3/agents/verifiers/companion_elderly/agent.py +249 -0
  18. pasm_agents-0.4.3/agents/verifiers/companion_elderly/run.py +39 -0
  19. pasm_agents-0.4.3/agents/verifiers/core_verifier/__init__.py +9 -0
  20. pasm_agents-0.4.3/agents/verifiers/core_verifier/agent.py +28 -0
  21. pasm_agents-0.4.3/agents/verifiers/core_verifier/run.py +39 -0
  22. pasm_agents-0.4.3/agents/verifiers/npc_lifelong/__init__.py +9 -0
  23. pasm_agents-0.4.3/agents/verifiers/npc_lifelong/agent.py +279 -0
  24. pasm_agents-0.4.3/agents/verifiers/npc_lifelong/run.py +39 -0
  25. pasm_agents-0.4.3/agents/verifiers/parity_guard/__init__.py +9 -0
  26. pasm_agents-0.4.3/agents/verifiers/parity_guard/agent.py +30 -0
  27. pasm_agents-0.4.3/agents/verifiers/parity_guard/run.py +39 -0
  28. pasm_agents-0.4.3/agents/verifiers/regression/__init__.py +9 -0
  29. pasm_agents-0.4.3/agents/verifiers/regression/agent.py +298 -0
  30. pasm_agents-0.4.3/agents/verifiers/regression/run.py +39 -0
  31. pasm_agents-0.4.3/agents/verifiers/soak_longrun/__init__.py +9 -0
  32. pasm_agents-0.4.3/agents/verifiers/soak_longrun/agent.py +221 -0
  33. pasm_agents-0.4.3/agents/verifiers/soak_longrun/run.py +39 -0
  34. pasm_agents-0.4.3/agents/verifiers/study_tutor/__init__.py +9 -0
  35. pasm_agents-0.4.3/agents/verifiers/study_tutor/agent.py +222 -0
  36. pasm_agents-0.4.3/agents/verifiers/study_tutor/run.py +39 -0
  37. pasm_agents-0.4.3/pasm_agents/__init__.py +47 -0
  38. pasm_agents-0.4.3/pasm_agents/__main__.py +6 -0
  39. pasm_agents-0.4.3/pasm_agents/cli.py +272 -0
  40. pasm_agents-0.4.3/pasm_agents/companion.py +18 -0
  41. pasm_agents-0.4.3/pasm_agents/npc.py +18 -0
  42. pasm_agents-0.4.3/pasm_agents/py.typed +1 -0
  43. pasm_agents-0.4.3/pasm_agents/tutor.py +16 -0
  44. pasm_agents-0.4.3/pasm_agents/verifiers/__init__.py +13 -0
  45. pasm_agents-0.4.3/pasm_agents/verifiers/companion_elderly.py +14 -0
  46. pasm_agents-0.4.3/pasm_agents/verifiers/core_verifier.py +14 -0
  47. pasm_agents-0.4.3/pasm_agents/verifiers/npc_lifelong.py +14 -0
  48. pasm_agents-0.4.3/pasm_agents/verifiers/parity_guard.py +14 -0
  49. pasm_agents-0.4.3/pasm_agents/verifiers/regression.py +14 -0
  50. pasm_agents-0.4.3/pasm_agents/verifiers/soak_longrun.py +14 -0
  51. pasm_agents-0.4.3/pasm_agents/verifiers/study_tutor.py +14 -0
  52. pasm_agents-0.4.3/pasm_agents.egg-info/PKG-INFO +264 -0
  53. pasm_agents-0.4.3/pasm_agents.egg-info/SOURCES.txt +57 -0
  54. pasm_agents-0.4.3/pasm_agents.egg-info/dependency_links.txt +1 -0
  55. pasm_agents-0.4.3/pasm_agents.egg-info/entry_points.txt +5 -0
  56. pasm_agents-0.4.3/pasm_agents.egg-info/requires.txt +4 -0
  57. pasm_agents-0.4.3/pasm_agents.egg-info/top_level.txt +2 -0
  58. pasm_agents-0.4.3/pyproject.toml +59 -0
  59. pasm_agents-0.4.3/setup.cfg +4 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 arronZheng (小志)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,264 @@
1
+ Metadata-Version: 2.4
2
+ Name: pasm-agents
3
+ Version: 0.4.3
4
+ Summary: PASM 智能体集 —— 基于 PASM 引擎的成品智能体:游戏 NPC / 老人陪伴 / 学习陪伴 + 七个长期验证智能体
5
+ Author: arronzheng
6
+ License: MIT
7
+ Project-URL: Homepage, https://gitee.com/arronzheng/pasm-agents
8
+ Project-URL: Repository, https://github.com/arronJack/pasm-agents
9
+ Project-URL: Source, https://gitee.com/arronzheng/pasm-agents
10
+ Project-URL: Issues, https://gitee.com/arronzheng/pasm-agents/issues
11
+ Keywords: pasm,agent,npc,companion,elderly-care,tutor,memory,emotion,verification,long-run
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
22
+ Requires-Python: >=3.10
23
+ Description-Content-Type: text/markdown
24
+ License-File: LICENSE
25
+ Requires-Dist: pasm-skills>=0.4.1
26
+ Provides-Extra: torch
27
+ Requires-Dist: torch; extra == "torch"
28
+ Dynamic: license-file
29
+
30
+ # PASM Agents · 成品智能体集
31
+
32
+ > **本仓是智能体集:拿起来就能用的智能体。**
33
+ > 提供"写智能体"能力的**基座**在独立公开仓 **pasm-skills**。
34
+ >
35
+ > ```bash
36
+ > pip install pasm-agents # 本仓(会自动带上基座 pasm-skills)
37
+ > ```
38
+
39
+ 两类智能体,都在这里:
40
+
41
+ | | 个数 | 面向 | 例子 |
42
+ |---|---|---|---|
43
+ | **产品智能体** | 3 | 使用者 | 游戏 NPC / 老人陪伴 / 学习陪伴 |
44
+ | **验证智能体** | 7 | 开发者 | 核心契约 / 两仓对齐 / 回归基线 / 长效耐久 + 4 个领域验证 |
45
+
46
+ 零 LLM 依赖、断网可用、状态持久化 —— **不是 mock,驱动的是真 PASM 引擎**(拿不到就降级,并在 `tier` 如实标注)。
47
+
48
+ ---
49
+
50
+ ## 一、产品智能体
51
+
52
+ ### ① 游戏 NPC(`NpcAgent`)
53
+
54
+ ```python
55
+ from pasm_agents import NpcAgent
56
+
57
+ npc = NpcAgent(agent_id="herbalist", persona={
58
+ "name": "陈伯", "role": "河边摆摊的草药老头",
59
+ "temper": 0.55, "energy": 0.40, "play": 0.30, "tone": "慢悠悠、爱讲道理",
60
+ })
61
+ npc.observe("玩家第一次来买跌打药", tags=["玩家", "买药"], salience=4)
62
+ print(npc.act()) # 'talk' / 'wave' / 'peek' / ...
63
+ print(npc.chat("有跌打药吗")) # 召回相关记忆
64
+ print(npc.mood) # 情绪(属性,不加括号)
65
+ npc.feedback("praise", action="talk") # 显式夸"talk"这个动作 → 它会更常出现
66
+ npc.save() # ~/.pasm-agents/herbalist/
67
+ ```
68
+
69
+ ### ② 老人陪伴(`ElderlyCompanion`)
70
+
71
+ ```python
72
+ from pasm_agents import ElderlyCompanion
73
+
74
+ comp = ElderlyCompanion(agent_id="chenxiulan", persona={
75
+ "name": "陈秀兰", "age": 78, "tone": "慢、温和",
76
+ "key_facts": [
77
+ {"label": "用药", "content": "每天早 8 点吃降压药络活喜 5mg"},
78
+ {"label": "过敏", "content": "青霉素过敏"},
79
+ {"label": "家人", "content": "女儿在深圳,每周日来电话"},
80
+ {"label": "本人", "content": "78 岁,独居"},
81
+ ],
82
+ "emergency_contact": {"name": "女儿小敏", "phone": "13900000000"},
83
+ "medication_schedule": [{"name": "络活喜", "dose": "5mg", "hour": 8}],
84
+ })
85
+ print(comp.chat("我吃什么药")) # 标签直查 → 命中率 100%
86
+ print(comp.detect_crisis("卫生间滑倒")) # ['摔倒/外伤']
87
+ print(comp.escalate("卫生间滑倒")) # 写入紧急记忆 + 返回升级上下文
88
+ for med in comp.due_medication(now_hour=8):
89
+ print(f"⏰ 该吃 {med['name']} {med['dose']}")
90
+ ```
91
+
92
+ > ⚠️ **不是医疗器械**,不替代任何医疗或急救服务。它只负责"记得住、认得清、说得暖",
93
+ > **是否通知家人由调用方决定**。
94
+
95
+ ### ③ 学习陪伴(`LearningTutor`)
96
+
97
+ ```python
98
+ from pasm_agents import LearningTutor
99
+
100
+ t = LearningTutor(agent_id="xiaoya", persona={
101
+ "name": "小雅", "grade": "五年级",
102
+ "topics": ["分数加减", "面积计算", "行程问题", "鸡兔同笼"],
103
+ })
104
+ t.report("分数加减", 0.4)
105
+ print(t.pick_next()) # 最弱优先(20% 抖动防刷同一知识点)
106
+ print(t.mastery("面积计算"))
107
+ print(t.snapshot()) # 学情 JSON(mastery / weakest / average / tier)
108
+ ```
109
+
110
+ ---
111
+
112
+ ## 二、验证智能体(给 PASM 核心做长期体检)
113
+
114
+ **只有跑久了才看得见的问题**(记忆丢失、情绪漂移、行为僵化、人格饱和)只能靠行为验证抓。
115
+
116
+ | 验证智能体 | 检查什么 | 需要哪个仓 |
117
+ |---|---|---|
118
+ | `core-verifier` | 契约 / 安全底线 / 环境插件 | `core` |
119
+ | `parity-guard` | 两仓核心内容逐字一致 | `core` + `studio` |
120
+ | `regression` | 关键指纹与基线比对(基线锁定解释器档位) | `core` + `lite` |
121
+ | `npc-lifelong` | 90 天 / 270 段经历 —— 核心能否正确记忆 NPC | `core` |
122
+ | `companion-elderly` | 30 天老人陪伴 —— 关键事实 100% 检索、危机命中 | `core` |
123
+ | `study-tutor` | 30 天学习陪伴 —— 学情结构 + 巩固 | `core` |
124
+ | `soak-longrun` | 6000 步认知 + 行为 + 记忆洪峰 —— 长效耐久 | `core` + `lite` |
125
+
126
+ **它们通过 entry point 自动被基座发现**(本仓 `pyproject.toml` 里声明了
127
+ `[project.entry-points."pasm_skills.agents"]`),所以:
128
+
129
+ ```bash
130
+ pip install pasm-agents
131
+ python -m pasm_skills list # ← 7 个验证智能体会出现在这里
132
+ python -m pasm_skills run core-verifier
133
+ python -m pasm_skills run --all
134
+ python -m pasm_skills run regression --update # 刷新事实基线(写 baselines/)
135
+ ```
136
+
137
+ 没装 PASM 核心时它们会 `SKIP` 并说明原因 —— **不会拿自研替身糊过去**。
138
+
139
+ ---
140
+
141
+ ## 三、30 秒上手
142
+
143
+ ```bash
144
+ pip install pasm-agents
145
+
146
+ # 三个产品智能体各有预置剧本
147
+ pasm-agents demo npc
148
+ pasm-agents demo companion
149
+ pasm-agents demo tutor
150
+
151
+ # 交互模式(quit 退出并 save)
152
+ pasm-agents run npc --id=my_herbalist
153
+ pasm-agents run companion --id=my_companion --persona-file=personas/chenxiulan.json
154
+
155
+ pasm-agents list
156
+ pasm-agents inspect my_herbalist
157
+ ```
158
+
159
+ 或直接从源码跑 —— **每个智能体自己文件夹里就有可跑示例**:
160
+
161
+ ```bash
162
+ git clone https://gitee.com/arronzheng/pasm-agents
163
+ cd pasm-agents
164
+
165
+ python agents/product/npc/quickstart.py # 游戏 NPC
166
+ python agents/product/companion/quickstart.py # 老人陪伴
167
+ python agents/product/tutor/quickstart.py # 学习陪伴
168
+
169
+ python agents/verifiers/parity_guard/run.py # 验证智能体同理(<1s,最快)
170
+ ```
171
+
172
+ > 想看某个智能体**到底怎么写的**:打开 `agents/product/npc/agent.py`,
173
+ > 旁边就是它的 `README.md`(功能 / API / persona 字段 / 输出样例)。
174
+ > 索引在 [`agents/README.md`](agents/README.md)。
175
+
176
+ ---
177
+
178
+ ## 四、档位透明(永不隐藏降级)
179
+
180
+ | tier | 依赖 | 得到什么 |
181
+ |---|---|---|
182
+ | `light` | 无 | 纯内置:重要度淘汰 + 字面检索 + 性格/反馈加权 |
183
+ | `core` | 能 `import pasm.cognitive`(**不需要 torch**) | 真 `memory_layers` + `learning.LearningEngine` |
184
+ | `bionic` | 上面 + torch | 再加真情绪 / 人格模块 |
185
+
186
+ 每个智能体的 `summary()` 与落盘 JSON 都带 `tier` 字段。
187
+
188
+ ## 五、目录:**每个智能体一个文件夹**
189
+
190
+ 打开 `agents/` 下的任意一个文件夹,都能看到它自己的**实现 + 说明 + 可跑示例** ——
191
+ 不用在一个大包里翻。
192
+
193
+ ```
194
+ pasm-agents/
195
+ ├── agents/ ★ 智能体目录(每个智能体一个文件夹)
196
+ │ ├── README.md 一句话索引:10 个智能体,两类
197
+ │ ├── product/ 面向使用者
198
+ │ │ ├── npc/ 游戏 NPC
199
+ │ │ │ ├── README.md 功能 / API / persona 字段 / 输出样例
200
+ │ │ │ ├── agent.py ★ 实现本体
201
+ │ │ │ ├── __init__.py 转发
202
+ │ │ │ └── quickstart.py python agents/product/npc/quickstart.py
203
+ │ │ ├── companion/ 老人陪伴
204
+ │ │ └── tutor/ 学习陪伴
205
+ │ └── verifiers/ 面向开发者
206
+ │ ├── README.md 结构层 / 行为层两层说明
207
+ │ ├── core_verifier/ 结构体检
208
+ │ ├── parity_guard/ 两仓一致性
209
+ │ ├── regression/ 静默退化
210
+ │ ├── npc_lifelong/ 90 天 NPC 行为体检
211
+ │ ├── companion_elderly/ 30 天陪伴行为体检(安全关键)
212
+ │ ├── study_tutor/ 30 天学习行为体检
213
+ │ └── soak_longrun/ 6000 步长效耐久
214
+
215
+ ├── pasm_agents/ ★ 聚合转发层(公开 API 的稳定入口)
216
+ │ ├── __init__.py from pasm_agents import NpcAgent
217
+ │ ├── npc.py / companion.py / tutor.py → 转发到 agents/product/*
218
+ │ ├── verifiers/ → 转发到 agents/verifiers/*(基座靠它发现)
219
+ │ └── cli.py pasm-agents 命令行
220
+
221
+ ├── skill/ 4 份技能正文(3 产品 + 1 验证)
222
+ ├── tools/ 打包脚本 + 技能文档一致性检查
223
+ ├── examples/ 跨智能体的综合示例
224
+ ├── baselines/ 事实基线(regression 用,入库)
225
+ └── docs/AGENTS.md 设计手册(选型分析 + 真问题表)
226
+ ```
227
+
228
+ > **为什么保留 `agents/` 和 `pasm_agents/` 两层?**
229
+ > `agents/` 是**实现的家**,`pasm_agents/` 是**稳定入口**。
230
+ > 已发布的技能文档、CLI、以及基座的发现机制都依赖 `pasm_agents.*` ——
231
+ > 把入口和实现分开,**以后目录怎么整理都不会破坏用户已经写好的代码**:
232
+ >
233
+ > ```python
234
+ > from pasm_agents import NpcAgent # 推荐:稳定入口
235
+ > from agents.product.npc import NpcAgent # 也行:直接指到那个文件夹
236
+ > ```
237
+
238
+ ## 六、相关仓
239
+
240
+ | 仓 | 定位 | 关系 |
241
+ |---|---|---|
242
+ | **pasm-skills** | 基座:SDK / 框架 / 打包工具 / 脚手架 | ← **本仓依赖它** |
243
+ | **本仓 pasm-agents** | 成品智能体集 | |
244
+ | PASM | 认知引擎核心 | 私有;智能体可选驱动它 |
245
+ | PASM-Lite | 教学与认知引擎协议 | 公开 |
246
+ | pasm-qclaw | 桌面应用发行 | 公开 |
247
+
248
+ 想**自己写一个智能体**?看基座仓的
249
+ [`docs/BUILD-AGENT.md`](https://gitee.com/arronzheng/pasm-skills/blob/master/docs/BUILD-AGENT.md) 与
250
+ `templates/` —— 本仓的源码就是最好的例子。
251
+
252
+ ## 七、技能包
253
+
254
+ 4 个技能包(3 产品 + 1 验证),各自独立、可单独上传:
255
+
256
+ ```bash
257
+ python tools/build_skill.py --zip --clean
258
+ # 产物:../pasm-agents-dist/{zip-root,slug-dir}/<name>/SKILL.md + <name>-<ver>.zip
259
+ ```
260
+
261
+ ## 八、许可证
262
+
263
+ MIT。技能包在部分平台需按平台要求标 `MIT-0`(比 MIT 更宽松,**允许无署名使用**)——
264
+ `tools/build_skill.py` 里对两种形态分别处理,详见基座仓的 `docs/SKILL-FORMAT.md`。
@@ -0,0 +1,235 @@
1
+ # PASM Agents · 成品智能体集
2
+
3
+ > **本仓是智能体集:拿起来就能用的智能体。**
4
+ > 提供"写智能体"能力的**基座**在独立公开仓 **pasm-skills**。
5
+ >
6
+ > ```bash
7
+ > pip install pasm-agents # 本仓(会自动带上基座 pasm-skills)
8
+ > ```
9
+
10
+ 两类智能体,都在这里:
11
+
12
+ | | 个数 | 面向 | 例子 |
13
+ |---|---|---|---|
14
+ | **产品智能体** | 3 | 使用者 | 游戏 NPC / 老人陪伴 / 学习陪伴 |
15
+ | **验证智能体** | 7 | 开发者 | 核心契约 / 两仓对齐 / 回归基线 / 长效耐久 + 4 个领域验证 |
16
+
17
+ 零 LLM 依赖、断网可用、状态持久化 —— **不是 mock,驱动的是真 PASM 引擎**(拿不到就降级,并在 `tier` 如实标注)。
18
+
19
+ ---
20
+
21
+ ## 一、产品智能体
22
+
23
+ ### ① 游戏 NPC(`NpcAgent`)
24
+
25
+ ```python
26
+ from pasm_agents import NpcAgent
27
+
28
+ npc = NpcAgent(agent_id="herbalist", persona={
29
+ "name": "陈伯", "role": "河边摆摊的草药老头",
30
+ "temper": 0.55, "energy": 0.40, "play": 0.30, "tone": "慢悠悠、爱讲道理",
31
+ })
32
+ npc.observe("玩家第一次来买跌打药", tags=["玩家", "买药"], salience=4)
33
+ print(npc.act()) # 'talk' / 'wave' / 'peek' / ...
34
+ print(npc.chat("有跌打药吗")) # 召回相关记忆
35
+ print(npc.mood) # 情绪(属性,不加括号)
36
+ npc.feedback("praise", action="talk") # 显式夸"talk"这个动作 → 它会更常出现
37
+ npc.save() # ~/.pasm-agents/herbalist/
38
+ ```
39
+
40
+ ### ② 老人陪伴(`ElderlyCompanion`)
41
+
42
+ ```python
43
+ from pasm_agents import ElderlyCompanion
44
+
45
+ comp = ElderlyCompanion(agent_id="chenxiulan", persona={
46
+ "name": "陈秀兰", "age": 78, "tone": "慢、温和",
47
+ "key_facts": [
48
+ {"label": "用药", "content": "每天早 8 点吃降压药络活喜 5mg"},
49
+ {"label": "过敏", "content": "青霉素过敏"},
50
+ {"label": "家人", "content": "女儿在深圳,每周日来电话"},
51
+ {"label": "本人", "content": "78 岁,独居"},
52
+ ],
53
+ "emergency_contact": {"name": "女儿小敏", "phone": "13900000000"},
54
+ "medication_schedule": [{"name": "络活喜", "dose": "5mg", "hour": 8}],
55
+ })
56
+ print(comp.chat("我吃什么药")) # 标签直查 → 命中率 100%
57
+ print(comp.detect_crisis("卫生间滑倒")) # ['摔倒/外伤']
58
+ print(comp.escalate("卫生间滑倒")) # 写入紧急记忆 + 返回升级上下文
59
+ for med in comp.due_medication(now_hour=8):
60
+ print(f"⏰ 该吃 {med['name']} {med['dose']}")
61
+ ```
62
+
63
+ > ⚠️ **不是医疗器械**,不替代任何医疗或急救服务。它只负责"记得住、认得清、说得暖",
64
+ > **是否通知家人由调用方决定**。
65
+
66
+ ### ③ 学习陪伴(`LearningTutor`)
67
+
68
+ ```python
69
+ from pasm_agents import LearningTutor
70
+
71
+ t = LearningTutor(agent_id="xiaoya", persona={
72
+ "name": "小雅", "grade": "五年级",
73
+ "topics": ["分数加减", "面积计算", "行程问题", "鸡兔同笼"],
74
+ })
75
+ t.report("分数加减", 0.4)
76
+ print(t.pick_next()) # 最弱优先(20% 抖动防刷同一知识点)
77
+ print(t.mastery("面积计算"))
78
+ print(t.snapshot()) # 学情 JSON(mastery / weakest / average / tier)
79
+ ```
80
+
81
+ ---
82
+
83
+ ## 二、验证智能体(给 PASM 核心做长期体检)
84
+
85
+ **只有跑久了才看得见的问题**(记忆丢失、情绪漂移、行为僵化、人格饱和)只能靠行为验证抓。
86
+
87
+ | 验证智能体 | 检查什么 | 需要哪个仓 |
88
+ |---|---|---|
89
+ | `core-verifier` | 契约 / 安全底线 / 环境插件 | `core` |
90
+ | `parity-guard` | 两仓核心内容逐字一致 | `core` + `studio` |
91
+ | `regression` | 关键指纹与基线比对(基线锁定解释器档位) | `core` + `lite` |
92
+ | `npc-lifelong` | 90 天 / 270 段经历 —— 核心能否正确记忆 NPC | `core` |
93
+ | `companion-elderly` | 30 天老人陪伴 —— 关键事实 100% 检索、危机命中 | `core` |
94
+ | `study-tutor` | 30 天学习陪伴 —— 学情结构 + 巩固 | `core` |
95
+ | `soak-longrun` | 6000 步认知 + 行为 + 记忆洪峰 —— 长效耐久 | `core` + `lite` |
96
+
97
+ **它们通过 entry point 自动被基座发现**(本仓 `pyproject.toml` 里声明了
98
+ `[project.entry-points."pasm_skills.agents"]`),所以:
99
+
100
+ ```bash
101
+ pip install pasm-agents
102
+ python -m pasm_skills list # ← 7 个验证智能体会出现在这里
103
+ python -m pasm_skills run core-verifier
104
+ python -m pasm_skills run --all
105
+ python -m pasm_skills run regression --update # 刷新事实基线(写 baselines/)
106
+ ```
107
+
108
+ 没装 PASM 核心时它们会 `SKIP` 并说明原因 —— **不会拿自研替身糊过去**。
109
+
110
+ ---
111
+
112
+ ## 三、30 秒上手
113
+
114
+ ```bash
115
+ pip install pasm-agents
116
+
117
+ # 三个产品智能体各有预置剧本
118
+ pasm-agents demo npc
119
+ pasm-agents demo companion
120
+ pasm-agents demo tutor
121
+
122
+ # 交互模式(quit 退出并 save)
123
+ pasm-agents run npc --id=my_herbalist
124
+ pasm-agents run companion --id=my_companion --persona-file=personas/chenxiulan.json
125
+
126
+ pasm-agents list
127
+ pasm-agents inspect my_herbalist
128
+ ```
129
+
130
+ 或直接从源码跑 —— **每个智能体自己文件夹里就有可跑示例**:
131
+
132
+ ```bash
133
+ git clone https://gitee.com/arronzheng/pasm-agents
134
+ cd pasm-agents
135
+
136
+ python agents/product/npc/quickstart.py # 游戏 NPC
137
+ python agents/product/companion/quickstart.py # 老人陪伴
138
+ python agents/product/tutor/quickstart.py # 学习陪伴
139
+
140
+ python agents/verifiers/parity_guard/run.py # 验证智能体同理(<1s,最快)
141
+ ```
142
+
143
+ > 想看某个智能体**到底怎么写的**:打开 `agents/product/npc/agent.py`,
144
+ > 旁边就是它的 `README.md`(功能 / API / persona 字段 / 输出样例)。
145
+ > 索引在 [`agents/README.md`](agents/README.md)。
146
+
147
+ ---
148
+
149
+ ## 四、档位透明(永不隐藏降级)
150
+
151
+ | tier | 依赖 | 得到什么 |
152
+ |---|---|---|
153
+ | `light` | 无 | 纯内置:重要度淘汰 + 字面检索 + 性格/反馈加权 |
154
+ | `core` | 能 `import pasm.cognitive`(**不需要 torch**) | 真 `memory_layers` + `learning.LearningEngine` |
155
+ | `bionic` | 上面 + torch | 再加真情绪 / 人格模块 |
156
+
157
+ 每个智能体的 `summary()` 与落盘 JSON 都带 `tier` 字段。
158
+
159
+ ## 五、目录:**每个智能体一个文件夹**
160
+
161
+ 打开 `agents/` 下的任意一个文件夹,都能看到它自己的**实现 + 说明 + 可跑示例** ——
162
+ 不用在一个大包里翻。
163
+
164
+ ```
165
+ pasm-agents/
166
+ ├── agents/ ★ 智能体目录(每个智能体一个文件夹)
167
+ │ ├── README.md 一句话索引:10 个智能体,两类
168
+ │ ├── product/ 面向使用者
169
+ │ │ ├── npc/ 游戏 NPC
170
+ │ │ │ ├── README.md 功能 / API / persona 字段 / 输出样例
171
+ │ │ │ ├── agent.py ★ 实现本体
172
+ │ │ │ ├── __init__.py 转发
173
+ │ │ │ └── quickstart.py python agents/product/npc/quickstart.py
174
+ │ │ ├── companion/ 老人陪伴
175
+ │ │ └── tutor/ 学习陪伴
176
+ │ └── verifiers/ 面向开发者
177
+ │ ├── README.md 结构层 / 行为层两层说明
178
+ │ ├── core_verifier/ 结构体检
179
+ │ ├── parity_guard/ 两仓一致性
180
+ │ ├── regression/ 静默退化
181
+ │ ├── npc_lifelong/ 90 天 NPC 行为体检
182
+ │ ├── companion_elderly/ 30 天陪伴行为体检(安全关键)
183
+ │ ├── study_tutor/ 30 天学习行为体检
184
+ │ └── soak_longrun/ 6000 步长效耐久
185
+
186
+ ├── pasm_agents/ ★ 聚合转发层(公开 API 的稳定入口)
187
+ │ ├── __init__.py from pasm_agents import NpcAgent
188
+ │ ├── npc.py / companion.py / tutor.py → 转发到 agents/product/*
189
+ │ ├── verifiers/ → 转发到 agents/verifiers/*(基座靠它发现)
190
+ │ └── cli.py pasm-agents 命令行
191
+
192
+ ├── skill/ 4 份技能正文(3 产品 + 1 验证)
193
+ ├── tools/ 打包脚本 + 技能文档一致性检查
194
+ ├── examples/ 跨智能体的综合示例
195
+ ├── baselines/ 事实基线(regression 用,入库)
196
+ └── docs/AGENTS.md 设计手册(选型分析 + 真问题表)
197
+ ```
198
+
199
+ > **为什么保留 `agents/` 和 `pasm_agents/` 两层?**
200
+ > `agents/` 是**实现的家**,`pasm_agents/` 是**稳定入口**。
201
+ > 已发布的技能文档、CLI、以及基座的发现机制都依赖 `pasm_agents.*` ——
202
+ > 把入口和实现分开,**以后目录怎么整理都不会破坏用户已经写好的代码**:
203
+ >
204
+ > ```python
205
+ > from pasm_agents import NpcAgent # 推荐:稳定入口
206
+ > from agents.product.npc import NpcAgent # 也行:直接指到那个文件夹
207
+ > ```
208
+
209
+ ## 六、相关仓
210
+
211
+ | 仓 | 定位 | 关系 |
212
+ |---|---|---|
213
+ | **pasm-skills** | 基座:SDK / 框架 / 打包工具 / 脚手架 | ← **本仓依赖它** |
214
+ | **本仓 pasm-agents** | 成品智能体集 | |
215
+ | PASM | 认知引擎核心 | 私有;智能体可选驱动它 |
216
+ | PASM-Lite | 教学与认知引擎协议 | 公开 |
217
+ | pasm-qclaw | 桌面应用发行 | 公开 |
218
+
219
+ 想**自己写一个智能体**?看基座仓的
220
+ [`docs/BUILD-AGENT.md`](https://gitee.com/arronzheng/pasm-skills/blob/master/docs/BUILD-AGENT.md) 与
221
+ `templates/` —— 本仓的源码就是最好的例子。
222
+
223
+ ## 七、技能包
224
+
225
+ 4 个技能包(3 产品 + 1 验证),各自独立、可单独上传:
226
+
227
+ ```bash
228
+ python tools/build_skill.py --zip --clean
229
+ # 产物:../pasm-agents-dist/{zip-root,slug-dir}/<name>/SKILL.md + <name>-<ver>.zip
230
+ ```
231
+
232
+ ## 八、许可证
233
+
234
+ MIT。技能包在部分平台需按平台要求标 `MIT-0`(比 MIT 更宽松,**允许无署名使用**)——
235
+ `tools/build_skill.py` 里对两种形态分别处理,详见基座仓的 `docs/SKILL-FORMAT.md`。
@@ -0,0 +1,7 @@
1
+ """PASM 智能体目录 —— 每个智能体一个文件夹。
2
+
3
+ - `product/` 面向使用者的成品智能体(游戏 NPC / 老人陪伴 / 学习陪伴)
4
+ - `verifiers/` 面向开发者的验证智能体(给认知引擎做长期体检)
5
+
6
+ `pasm_agents` 包是本目录的聚合转发层,公开 API 与目录结构解耦。
7
+ """
@@ -0,0 +1 @@
1
+ """面向使用者的成品智能体:游戏 NPC / 老人陪伴 / 学习陪伴。"""
@@ -0,0 +1,17 @@
1
+ """ElderlyCompanion —— 老人陪伴:关键事实 / 用药提醒 / 危机升级
2
+
3
+ 实现正文在 `agent.py`;本文件只做转发,方便 `from <包路径> import ElderlyCompanion`。
4
+ """
5
+ from __future__ import annotations
6
+
7
+ from .agent import ( # noqa: F401
8
+ ElderlyCompanion,
9
+ CRISIS_KEYWORDS,
10
+ random_kind,
11
+ )
12
+
13
+ __all__ = [
14
+ "ElderlyCompanion",
15
+ "CRISIS_KEYWORDS",
16
+ "random_kind",
17
+ ]