@hippo-memo/cli 1.0.2 → 1.0.3
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.
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# 🧠 Hippo Memory
|
|
2
|
+
|
|
3
|
+
**hippo-memory** 是项目的持久记忆层 skill,用于存储用户偏好、项目上下文、技术决策等跨会话信息。
|
|
4
|
+
|
|
5
|
+
## ⚡ 会话启动
|
|
6
|
+
|
|
7
|
+
**每次新会话必须检索系统引导记忆,了解用户偏好、项目上下文和核心配置。**
|
|
8
|
+
|
|
9
|
+
## 🎯 调用指南
|
|
10
|
+
|
|
11
|
+
**触发场景:**
|
|
12
|
+
- 用户询问或提及任何可被记忆的信息(偏好、配置、决策、历史、上下文等)
|
|
13
|
+
- 关键词命中:我/我的/习惯/喜欢/选择/决定/记住/保存/my/I prefer/remember/save/previous/architecture/config/settings/架构/配置/规范
|
|
14
|
+
- 用户透露任何可存储的信息(新的偏好、决策、习惯、技术选型等)
|
|
15
|
+
- 回答涉及用户私有信息时需要验证
|
|
16
|
+
|
|
17
|
+
**核心原则:**
|
|
18
|
+
- 涉及用户私有信息时,必须先检索记忆,禁止猜测
|
|
19
|
+
- 用户透露新信息时,立即存储到记忆
|
|
20
|
+
|
|
21
|
+
---
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: hippo-memory
|
|
3
|
-
description:
|
|
3
|
+
description: "🧠 Persistent memory layer. ALWAYS ACTIVE: (1) SEARCH when user asks about memorable info, (2) STORE when user reveals storable info. Keywords: 我/我的/习惯/喜欢/选择/决定/记住/保存/my/I prefer/remember/save/previous/architecture/config/架构/配置. Never guess without searching."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Hippo Memory Skill
|
package/package.json
CHANGED
package/src/commands/init.ts
CHANGED
|
@@ -14,7 +14,14 @@ import prompts from "prompts";
|
|
|
14
14
|
|
|
15
15
|
const __dirname = import.meta.dirname;
|
|
16
16
|
const TEMPLATE_DIR = join(__dirname, "../../template/system");
|
|
17
|
-
const
|
|
17
|
+
const MCP_AGENTS_TEMPLATE_PATH = join(
|
|
18
|
+
__dirname,
|
|
19
|
+
"../../template/mcp/AGENTS.md"
|
|
20
|
+
);
|
|
21
|
+
const SKILL_AGENTS_TEMPLATE_PATH = join(
|
|
22
|
+
__dirname,
|
|
23
|
+
"../../template/skill/AGENTS.md"
|
|
24
|
+
);
|
|
18
25
|
const SKILL_TEMPLATE_DIR = join(__dirname, "../../template/skill");
|
|
19
26
|
|
|
20
27
|
const TEMPLATE_URIS = {
|
|
@@ -87,7 +94,11 @@ async function injectToTopOfFile(
|
|
|
87
94
|
/**
|
|
88
95
|
* 检测并处理 AGENTS.md 和 CLAUDE.md 文件
|
|
89
96
|
*/
|
|
90
|
-
async function handleAgentsAndClaudeFiles(
|
|
97
|
+
async function handleAgentsAndClaudeFiles(
|
|
98
|
+
directory: string,
|
|
99
|
+
templatePath: string,
|
|
100
|
+
mode: InitMode
|
|
101
|
+
): Promise<void> {
|
|
91
102
|
const agentsPath = join(directory, "AGENTS.md");
|
|
92
103
|
const claudePath = join(directory, "CLAUDE.md");
|
|
93
104
|
|
|
@@ -108,7 +119,8 @@ async function handleAgentsAndClaudeFiles(directory: string): Promise<void> {
|
|
|
108
119
|
// CLAUDE.md 不存在
|
|
109
120
|
}
|
|
110
121
|
|
|
111
|
-
const agentsContent = await readFile(
|
|
122
|
+
const agentsContent = await readFile(templatePath, "utf-8");
|
|
123
|
+
const configName = mode === "mcp" ? "MCP" : "Skill";
|
|
112
124
|
|
|
113
125
|
if (hasClaude) {
|
|
114
126
|
console.log("› Found: CLAUDE.md");
|
|
@@ -121,7 +133,7 @@ async function handleAgentsAndClaudeFiles(directory: string): Promise<void> {
|
|
|
121
133
|
const response = await prompts({
|
|
122
134
|
type: "confirm",
|
|
123
135
|
name: "inject",
|
|
124
|
-
message:
|
|
136
|
+
message: `Inject ${configName} configuration to CLAUDE.md?`,
|
|
125
137
|
initial: true
|
|
126
138
|
});
|
|
127
139
|
|
|
@@ -143,7 +155,7 @@ async function handleAgentsAndClaudeFiles(directory: string): Promise<void> {
|
|
|
143
155
|
const response = await prompts({
|
|
144
156
|
type: "confirm",
|
|
145
157
|
name: "inject",
|
|
146
|
-
message:
|
|
158
|
+
message: `Inject ${configName} configuration to AGENTS.md?`,
|
|
147
159
|
initial: true
|
|
148
160
|
});
|
|
149
161
|
|
|
@@ -156,7 +168,7 @@ async function handleAgentsAndClaudeFiles(directory: string): Promise<void> {
|
|
|
156
168
|
console.log("› Skipped: content already exists");
|
|
157
169
|
}
|
|
158
170
|
} else {
|
|
159
|
-
console.log(
|
|
171
|
+
console.log(`✔ Created: AGENTS.md`);
|
|
160
172
|
await writeFile(agentsPath, agentsContent, "utf-8");
|
|
161
173
|
}
|
|
162
174
|
}
|
|
@@ -270,7 +282,7 @@ export async function init(directory: string): Promise<void> {
|
|
|
270
282
|
// 处理 MCP 配置 (注入到 AGENTS.md/CLAUDE.md)
|
|
271
283
|
if (mode === "mcp") {
|
|
272
284
|
console.log(`${EOL}◇ Setting up MCP integration...`);
|
|
273
|
-
await handleAgentsAndClaudeFiles(directory);
|
|
285
|
+
await handleAgentsAndClaudeFiles(directory, MCP_AGENTS_TEMPLATE_PATH, mode);
|
|
274
286
|
console.log(`${EOL}✨ Setup complete!${EOL}`);
|
|
275
287
|
console.log("📌 Next steps:");
|
|
276
288
|
console.log(" 1. Configure MCP server in Claude Code settings");
|
|
@@ -281,12 +293,18 @@ export async function init(directory: string): Promise<void> {
|
|
|
281
293
|
// 处理 Skill 配置
|
|
282
294
|
if (mode === "skill") {
|
|
283
295
|
console.log(`${EOL}◇ Installing Claude Code Skills...`);
|
|
296
|
+
await handleAgentsAndClaudeFiles(
|
|
297
|
+
directory,
|
|
298
|
+
SKILL_AGENTS_TEMPLATE_PATH,
|
|
299
|
+
mode
|
|
300
|
+
);
|
|
284
301
|
await copySkillTemplates(directory);
|
|
285
302
|
console.log(`${EOL}✨ Setup complete!${EOL}`);
|
|
286
303
|
console.log("📌 Next steps:");
|
|
287
304
|
console.log(" 1. Skills installed in .claude/skills/");
|
|
288
|
-
console.log(" 2.
|
|
289
|
-
console.log(" 3.
|
|
305
|
+
console.log(" 2. Configuration injected to CLAUDE.md");
|
|
306
|
+
console.log(" 3. LLM will automatically trigger when needed");
|
|
307
|
+
console.log(" 4. Commit to Git to share with your team");
|
|
290
308
|
console.log("");
|
|
291
309
|
}
|
|
292
310
|
}
|