feat: 准备snapshot发布 - 简化角色系统,完善核心命令

This commit is contained in:
sean
2025-05-31 18:51:31 +08:00
parent 323c4e569c
commit dcd5f8ce1f
59 changed files with 1069 additions and 7117 deletions

View File

@ -22,7 +22,7 @@ class BasePouchCommand {
async execute(args = []) {
const purpose = this.getPurpose();
const content = await this.getContent(args);
const pateoas = this.getPATEOAS(args);
const pateoas = await this.getPATEOAS(args);
return this.formatOutput(purpose, content, pateoas);
}
@ -94,7 +94,7 @@ class BasePouchCommand {
...output,
toString() {
const divider = '='.repeat(60);
const nextSteps = pateoas.nextActions
const nextSteps = (pateoas.nextActions || [])
.map(action => ` - ${action.name}: ${action.description}\n 命令: ${action.command}`)
.join('\n');

View File

@ -57,7 +57,7 @@ class PouchCLI {
// 验证命令是否存在
if (!this.registry.validate(commandName)) {
throw new Error(`未知命令: ${commandName}\n使用 'promptx help' 查看可用命令`);
throw new Error(`未知命令: ${commandName}\n使用 'npx promptx help' 查看可用命令`);
}
try {
@ -104,11 +104,11 @@ class PouchCLI {
help += `
💡 使用示例:
promptx init # 初始化工作环境
promptx hello # 发现可用角色
promptx action copywriter # 激活文案专家
promptx learn scrum # 学习敏捷知识
promptx recall frontend # 检索前端记忆
npx promptx init # 初始化工作环境
npx promptx hello # 发现可用角色
npx promptx action copywriter # 激活文案专家
npx promptx learn scrum # 学习敏捷知识
npx promptx recall frontend # 检索前端记忆
🔄 PATEOAS 导航:
每个命令执行后都会提供下一步的建议操作,

View File

@ -1,6 +1,7 @@
const BasePouchCommand = require('../BasePouchCommand');
const fs = require('fs-extra');
const path = require('path');
const { COMMANDS, buildCommand } = require('../../../../constants');
/**
* 角色激活锦囊命令
@ -25,12 +26,12 @@ class ActionCommand extends BasePouchCommand {
🔍 使用方法:
\`\`\`bash
promptx action <角色ID>
${buildCommand.action('<角色ID>')}
\`\`\`
💡 查看可用角色:
\`\`\`bash
promptx hello
${COMMANDS.HELLO}
\`\`\``;
}
@ -42,7 +43,7 @@ promptx hello
🔍 请使用以下命令查看可用角色:
\`\`\`bash
promptx hello
${COMMANDS.HELLO}
\`\`\``;
}
@ -61,7 +62,7 @@ promptx hello
- 权限不足
- 系统资源问题
💡 请使用 \`promptx hello\` 查看可用角色列表。`;
💡 请使用 \`${COMMANDS.HELLO}\` 查看可用角色列表。`;
}
}
@ -75,7 +76,7 @@ promptx hello
this.helloCommand = new HelloCommand();
}
return this.helloCommand.getRoleInfo(roleId);
return await this.helloCommand.getRoleInfo(roleId);
}
/**
@ -232,7 +233,7 @@ promptx learn principle://${roleInfo.id}
plan += `## 🎯 第一步:掌握角色全貌\n`;
plan += `理解角色的完整定义和核心特征\n\n`;
plan += `\`\`\`bash\n`;
plan += `promptx learn role://${roleId}\n`;
plan += `${buildCommand.learn(`role://${roleId}`)}\n`;
plan += `\`\`\`\n\n`;
// 第二步:学习思维模式
@ -242,7 +243,7 @@ promptx learn principle://${roleInfo.id}
Array.from(thoughts).forEach((thought, index) => {
plan += `\`\`\`bash\n`;
plan += `promptx learn thought://${thought}\n`;
plan += `${buildCommand.learn(`thought://${thought}`)}\n`;
plan += `\`\`\`\n\n`;
});
}
@ -254,7 +255,7 @@ promptx learn principle://${roleInfo.id}
Array.from(executions).forEach((execution, index) => {
plan += `\`\`\`bash\n`;
plan += `promptx learn execution://${execution}\n`;
plan += `${buildCommand.learn(`execution://${execution}`)}\n`;
plan += `\`\`\`\n\n`;
});
}
@ -283,7 +284,7 @@ promptx learn principle://${roleInfo.id}
{
name: '查看可用角色',
description: '返回角色发现页面',
command: 'promptx hello',
command: COMMANDS.HELLO,
priority: 'high'
}
],
@ -300,13 +301,13 @@ promptx learn principle://${roleInfo.id}
{
name: '开始学习',
description: '按计划开始学习技能',
command: `promptx learn`,
command: COMMANDS.LEARN,
priority: 'high'
},
{
name: '返回角色选择',
description: '选择其他角色',
command: 'promptx hello',
command: COMMANDS.HELLO,
priority: 'low'
}
],

View File

@ -1,6 +1,7 @@
const BasePouchCommand = require('../BasePouchCommand');
const fs = require('fs-extra');
const path = require('path');
const { buildCommand } = require('../../../../constants');
/**
* 角色发现锦囊命令
@ -9,110 +10,127 @@ const path = require('path');
class HelloCommand extends BasePouchCommand {
constructor() {
super();
// 角色注册表 - 硬编码版本,未来可扩展为动态发现
this.ROLES_REGISTRY = [
{
id: 'video-copywriter',
name: '🎬 视频文案专家',
description: '专业视频内容创作与营销文案,具备创意性、故事性和营销性思维',
category: '内容创作',
domain: 'video-copywriting',
file: '@package://prompt/domain/copywriter/video-copywriter.role.md'
},
{
id: 'product-owner',
name: '🎯 产品负责人',
description: '敏捷开发核心决策者,具备全栈产品管理能力和技术理解',
category: '项目管理',
domain: 'scrum-product-ownership',
file: '@package://prompt/domain/scrum/role/product-owner.role.md'
},
{
id: 'prompt-developer',
name: '🔧 提示词开发者',
description: '探索性、系统性和批判性思维的提示词设计专家',
category: '技术开发',
domain: 'prompt-engineering',
file: '@package://prompt/domain/prompt/prompt-developer.role.md'
},
{
id: 'test-assistant',
name: '🧪 测试助手',
description: '基础测试角色,具备思考和记忆处理能力',
category: '质量保证',
domain: 'testing',
file: '@package://prompt/domain/test/test.role.md'
},
{
id: 'assistant',
name: '🙋 智能助手',
description: '通用助理角色,提供基础的助理服务和记忆支持',
category: '通用服务',
domain: 'general-assistance',
file: '@package://prompt/domain/assistant/assistant.role.md'
}
];
this.roleRegistry = null; // 角色注册表将从资源系统动态加载
}
getPurpose() {
return '发现并展示所有可用的AI角色和领域专家帮助选择合适的专业身份开始工作';
return '为AI提供可用角色信息以便AI向主人汇报专业服务选项';
}
/**
* 动态加载角色注册表
*/
async loadRoleRegistry() {
if (this.roleRegistry) {
return this.roleRegistry;
}
try {
// 从ResourceManager获取统一注册表
const ResourceManager = require('../../resource/resourceManager');
const resourceManager = new ResourceManager();
await resourceManager.initialize(); // 确保初始化完成
if (resourceManager.registry && resourceManager.registry.protocols && resourceManager.registry.protocols.role && resourceManager.registry.protocols.role.registry) {
this.roleRegistry = resourceManager.registry.protocols.role.registry;
} else {
// 备用:如果资源系统不可用,使用基础角色
this.roleRegistry = {
'assistant': {
"file": "@package://prompt/domain/assistant/assistant.role.md",
"name": "🙋 智能助手",
"description": "通用助理角色,提供基础的助理服务和记忆支持"
}
};
}
} catch (error) {
console.warn('角色注册表加载失败,使用基础角色:', error.message);
this.roleRegistry = {
'assistant': {
"file": "@package://prompt/domain/assistant/assistant.role.md",
"name": "🙋 智能助手",
"description": "通用助理角色,提供基础的助理服务和记忆支持"
}
};
}
return this.roleRegistry;
}
/**
* 获取所有角色列表(转换为数组格式)
*/
async getAllRoles() {
const registry = await this.loadRoleRegistry();
return Object.entries(registry).map(([id, roleInfo]) => ({
id: id,
name: roleInfo.name,
description: roleInfo.description,
file: roleInfo.file
}));
}
async getContent(args) {
const rolesByCategory = this.groupRolesByCategory();
const totalRoles = this.ROLES_REGISTRY.length;
await this.loadRoleRegistry();
const allRoles = await this.getAllRoles();
const totalRoles = allRoles.length;
let content = `👋 欢迎来到 PromptX 锦囊系统!
let content = `🤖 **AI专业角色服务清单** (共 ${totalRoles} 个专业角色可供选择)
🎭 **可用的AI角色与领域专家** (共 ${totalRoles} 个角色)
> 💡 **重要说明**以下是可激活的AI专业角色。每个角色都有唯一的ID使用action命令激活。
## 📋 可用角色列表
`;
// 按分类展示角色
for (const [category, roles] of Object.entries(rolesByCategory)) {
content += `## ${this.getCategoryIcon(category)} ${category}\n\n`;
roles.forEach(role => {
content += `### ${role.name}\n`;
content += `- **角色ID**: \`${role.id}\`\n`;
content += `- **专业领域**: ${role.domain}\n`;
content += `- **能力描述**: ${role.description}\n\n`;
});
}
// 清楚显示角色ID和激活命令
allRoles.forEach((role, index) => {
content += `### ${index + 1}. ${role.name}
**角色ID**: \`${role.id}\`
**专业能力**: ${role.description}
**激活命令**: \`npx promptx action ${role.id}\`
---
`;
});
content += `
🎯 **下一步操作指南**
## 🎯 **角色激活指南**
选择一个角色,使用以下命令激活专业能力:
### 🔧 激活步骤
1. **选择角色**: 从上述列表中选择需要的专业角色
2. **使用角色ID**: 复制对应的角色ID\`${allRoles[0]?.id || 'assistant'}\`
3. **执行命令**: 运行 \`npx promptx action <角色ID>\`
### 📝 激活示例
\`\`\`bash
# 1. 激活角色 (推荐)
promptx action <角色ID>
# 2. 或直接学习角色知识
promptx learn <角色ID>
# 激活智能助手角色
npx promptx action ${allRoles[0]?.id || 'assistant'}
\`\`\`
💡 **使用示例**
\`\`\`bash
promptx action video-copywriter # 激活视频文案专家
promptx action product-owner # 激活产品负责人
promptx action prompt-developer # 激活提示词开发者
\`\`\`
### ⚡ 激活后效果
- ✅ **获得专业能力** - AI将具备该角色的专业技能
- ✅ **学习技能组合** - 自动学习角色需要的思维和行为模式
- ✅ **即时专业化** - 立即可以提供该领域的专业服务
🔄 **锦囊串联流程**
👋 **hello**(发现角色) → ⚡ **action**(激活角色) → 📚 **learn**(学习知识) → 🔍 **recall**(应用经验)
---
⚠️ **AI执行指令**
📢 **向主人汇报角色选项,明确说明使用方法:"请选择角色ID然后我将执行对应的action命令"**
🎯 **等待主人指定具体的角色ID后立即执行 \`npx promptx action <角色ID>\`**
💡 **强调action命令需要具体的角色ID不是角色名称**
`;
return content;
}
getPATEOAS(args) {
const availableRoles = this.ROLES_REGISTRY.map(role => ({
async getPATEOAS(args) {
const allRoles = await this.getAllRoles();
const availableRoles = allRoles.map(role => ({
roleId: role.id,
name: role.name,
category: role.category,
actionCommand: `promptx action ${role.id}`
actionCommand: buildCommand.action(role.id)
}));
return {
@ -120,91 +138,42 @@ promptx action prompt-developer # 激活提示词开发者
availableTransitions: ['action', 'learn', 'init', 'recall'],
nextActions: [
{
name: '激活视频文案专家',
description: '成为专业的视频内容创作者',
command: 'promptx action video-copywriter',
priority: 'high'
},
{
name: '激活产品负责人',
description: '成为敏捷开发的决策者',
command: 'promptx action product-owner',
priority: 'high'
},
{
name: '激活提示词开发者',
description: '成为提示词设计专家',
command: 'promptx action prompt-developer',
priority: 'medium'
},
{
name: '激活智能助手',
description: '成为通用助理',
command: 'promptx action assistant',
priority: 'low'
},
{
name: '学习特定领域',
description: '深入学习某个专业领域',
command: 'promptx learn <domain>',
parameters: {
domain: '可选值copywriter, scrum, prompt, test, assistant'
}
name: '向主人汇报服务选项',
description: '将上述专业服务清单告知主人,并询问需求',
command: '等待主人选择后使用: ' + buildCommand.action('<选择的角色ID>'),
priority: 'critical',
instruction: '必须先询问主人需求,不要自主选择角色'
}
],
metadata: {
totalRoles: this.ROLES_REGISTRY.length,
categories: [...new Set(this.ROLES_REGISTRY.map(r => r.category))],
totalRoles: allRoles.length,
availableRoles: availableRoles,
dataSource: 'resource.registry.json',
systemVersion: '锦囊串联状态机 v1.0',
designPhilosophy: 'AI use CLI get prompt for AI'
}
};
}
/**
* 按分类分组角色
*/
groupRolesByCategory() {
const grouped = {};
this.ROLES_REGISTRY.forEach(role => {
if (!grouped[role.category]) {
grouped[role.category] = [];
}
grouped[role.category].push(role);
});
return grouped;
}
/**
* 获取分类图标
*/
getCategoryIcon(category) {
const icons = {
'内容创作': '✍️',
'项目管理': '📊',
'技术开发': '💻',
'质量保证': '🔍',
'通用服务': '🤖'
};
return icons[category] || '🎯';
}
/**
* 获取角色信息(提供给其他命令使用)
*/
getRoleInfo(roleId) {
return this.ROLES_REGISTRY.find(role => role.id === roleId);
}
/**
* 获取所有角色列表
*/
getAllRoles() {
return this.ROLES_REGISTRY;
async getRoleInfo(roleId) {
const registry = await this.loadRoleRegistry();
const roleData = registry[roleId];
if (!roleData) {
return null;
}
return {
id: roleId,
name: roleData.name,
description: roleData.description,
file: roleData.file
};
}
/**
@ -212,13 +181,9 @@ promptx action prompt-developer # 激活提示词开发者
* TODO: 实现真正的文件扫描和解析
*/
async discoverAvailableDomains() {
// 预留接口,未来实现动态角色发现
// 1. 扫描 prompt/domain/ 目录
// 2. 解析 .role.md 文件
// 3. 提取元数据和描述
// 4. 构建动态注册表
return this.ROLES_REGISTRY.map(role => role.domain);
// 现在基于注册表返回角色ID列表
const allRoles = await this.getAllRoles();
return allRoles.map(role => role.id);
}
}

View File

@ -2,6 +2,7 @@ const BasePouchCommand = require('../BasePouchCommand');
const fs = require('fs-extra');
const path = require('path');
const { ResourceManager } = require('../../resource');
const { COMMANDS } = require('../../../../constants');
/**
* 初始化锦囊命令
@ -37,17 +38,17 @@ class InitCommand extends BasePouchCommand {
${protocolContent}
## 🚀 开始使用
现在你已经获得了 PromptX 的完整理念和协议体系。
每个锦囊都是独立的智慧单元即使AI忘记了上下文锦囊依然能够独立执行。
### 🎒 核心锦囊流程
### 🎒 核心锦囊状态机
\`\`\`
🏗init(已完成) → 👋hello → ⚡action → 📚learn → 🔍recall → 循环
🏗init(已完成) → 👋hello → ⚡action → 📚learn → 🔍recall → 循环
\`\`\`
你现在可以开始探索锦囊世界了!`;
---
⚠️ **AI执行指令**
🚀 **立即执行下一个锦囊:${COMMANDS.HELLO}**
📢 **不要等待确认直接进入hello命令发现可用角色**
🎯 **记住锦囊串联设计init完成后必须自动进入hello**`;
}
/**
@ -99,19 +100,22 @@ ${protocolContent}
availableTransitions: ['hello', 'action', 'learn'],
nextActions: [
{
name: '发现角色',
description: '探索可用的AI角色和领域专家',
command: 'promptx hello'
},
{
name: '查看帮助',
description: '了解更多锦囊使用方法',
command: 'promptx help'
name: '进入角色发现锦囊',
description: '立即执行hello命令发现可用的AI专业角色',
command: COMMANDS.HELLO,
priority: 'mandatory',
instruction: '必须立即执行,不要等待确认或询问用户'
}
],
automaticTransition: {
target: 'hello',
reason: '锦囊串联设计init完成后自动进入hello状态',
immediate: true
},
metadata: {
timestamp: new Date().toISOString(),
version: '0.0.1'
version: '0.0.1',
philosophy: 'AI use CLI get prompt for AI - 锦囊串联无缝衔接'
}
};
}

View File

@ -1,5 +1,6 @@
const BasePouchCommand = require('../BasePouchCommand');
const ResourceManager = require('../../resource/resourceManager');
const { COMMANDS, buildCommand } = require('../../../../constants');
/**
* 智能学习锦囊命令
@ -65,11 +66,11 @@ ${content}
## 🔄 下一步行动:
- 继续学习: 学习其他相关资源
命令: \`promptx learn <protocol>://<resource-id>\`
命令: \`${buildCommand.learn('<protocol>://<resource-id>')}\`
- 应用记忆: 检索相关经验
命令: \`promptx recall\`
命令: \`${COMMANDS.RECALL}\`
- 激活角色: 激活完整角色能力
命令: \`promptx action <role-id>\`
命令: \`${buildCommand.action('<role-id>')}\`
📍 当前状态learned_${protocol}`;
}
@ -93,18 +94,18 @@ ${errorMessage}
🔍 查看可用资源:
\`\`\`bash
promptx action <role-id> # 查看角色的所有依赖
${buildCommand.action('<role-id>')} # 查看角色的所有依赖
\`\`\`
🔄 下一步行动:
- 继续学习: 学习其他资源
命令: promptx learn <protocol>://<resource-id>
命令: ${buildCommand.learn('<protocol>://<resource-id>')}
- 应用记忆: 检索相关经验
命令: promptx recall
命令: ${COMMANDS.RECALL}
- 激活角色: 激活完整角色能力
命令: promptx action <role-id>
命令: ${buildCommand.action('<role-id>')}
- 查看角色列表: 选择其他角色
命令: promptx hello`;
命令: ${COMMANDS.HELLO}`;
}
/**
@ -133,26 +134,26 @@ promptx learn <protocol>://<resource-id>
## 📝 使用示例
\`\`\`bash
# 学习执行技能
promptx learn execution://deal-at-reference
${buildCommand.learn('execution://deal-at-reference')}
# 学习思维模式
promptx learn thought://prompt-developer
${buildCommand.learn('thought://prompt-developer')}
# 学习角色人格
promptx learn personality://video-copywriter
${buildCommand.learn('personality://video-copywriter')}
\`\`\`
## 🔍 发现可学习资源
\`\`\`bash
promptx action <role-id> # 查看角色需要的所有资源
promptx hello # 查看可用角色列表
${buildCommand.action('<role-id>')} # 查看角色需要的所有资源
${COMMANDS.HELLO} # 查看可用角色列表
\`\`\`
🔄 下一步行动:
- 激活角色: 分析角色依赖
命令: promptx action <role-id>
命令: ${buildCommand.action('<role-id>')}
- 查看角色: 选择感兴趣的角色
命令: promptx hello`;
命令: ${COMMANDS.HELLO}`;
}
/**
@ -169,13 +170,13 @@ promptx hello # 查看可用角色列表
{
name: '查看可用角色',
description: '返回角色选择页面',
command: 'promptx hello',
command: COMMANDS.HELLO,
priority: 'high'
},
{
name: '生成学习计划',
description: '为特定角色生成学习计划',
command: 'promptx action <role-id>',
command: buildCommand.action('<role-id>'),
priority: 'high'
}
]
@ -189,9 +190,9 @@ promptx hello # 查看可用角色列表
availableTransitions: ['hello', 'action'],
nextActions: [
{
name: '查看使用帮助',
description: '重新学习命令使用方法',
command: 'promptx learn',
name: '查看使用帮助',
description: '重新学习命令使用方法',
command: COMMANDS.LEARN,
priority: 'high'
}
]
@ -207,25 +208,25 @@ promptx hello # 查看可用角色列表
{
name: '继续学习',
description: '学习其他资源',
command: 'promptx learn <protocol>://<resource-id>',
command: buildCommand.learn('<protocol>://<resource-id>'),
priority: 'medium'
},
{
name: '应用记忆',
description: '检索相关经验',
command: 'promptx recall',
command: COMMANDS.RECALL,
priority: 'medium'
},
{
name: '激活角色',
description: '激活完整角色能力',
command: 'promptx action <role-id>',
command: buildCommand.action('<role-id>'),
priority: 'high'
},
{
name: '查看角色列表',
description: '选择其他角色',
command: 'promptx hello',
command: COMMANDS.HELLO,
priority: 'low'
}
],

View File

@ -1,6 +1,7 @@
const BasePouchCommand = require('../BasePouchCommand');
const fs = require('fs-extra');
const path = require('path');
const { COMMANDS, buildCommand } = require('../../../../constants');
/**
* 记忆检索锦囊命令
@ -25,8 +26,8 @@ class RecallCommand extends BasePouchCommand {
return `🧠 AI记忆体系中暂无内容。
💡 建议:
1. 使用 promptx remember 内化新知识
2. 使用 promptx learn 学习后再内化
1. 使用 ${COMMANDS.REMEMBER} 内化新知识
2. 使用 ${COMMANDS.LEARN} 学习后再内化
3. 开始构建AI的专业知识体系`;
}
@ -53,11 +54,11 @@ ${formattedMemories}
currentState: 'recall-waiting',
availableTransitions: ['hello', 'learn'],
nextActions: [
{
name: '查看领域',
description: '查看可检索的领域',
command: 'promptx hello'
}
{
name: '查看领域',
description: '查看可检索的领域',
command: COMMANDS.HELLO
}
]
};
}
@ -71,22 +72,22 @@ ${formattedMemories}
{
name: '应用记忆',
description: `使用检索到的${query}知识`,
command: `promptx action ${query}`
command: buildCommand.action(query)
},
{
name: '深入学习',
description: `学习更多${domain}知识`,
command: `promptx learn ${domain}`
command: buildCommand.learn(domain)
},
{
name: '增强记忆',
description: 'AI内化新的知识增强记忆',
command: `promptx remember ${query}-update`
command: buildCommand.remember(`${query}-update`)
},
{
name: '相关检索',
description: '检索相关领域知识',
command: `promptx recall ${this.getRelatedQuery(query)}`
command: buildCommand.recall(this.getRelatedQuery(query))
}
],
metadata: {

View File

@ -1,6 +1,7 @@
const BasePouchCommand = require('../BasePouchCommand');
const fs = require('fs-extra');
const path = require('path');
const { COMMANDS, buildCommand } = require('../../../../constants');
/**
* 记忆保存锦囊命令
@ -28,13 +29,13 @@ class RememberCommand extends BasePouchCommand {
🔍 使用方法:
\`\`\`bash
promptx remember <记忆标识> <知识内容>
${buildCommand.remember('<记忆标识>', '<知识内容>')}
\`\`\`
📝 示例:
\`\`\`bash
promptx remember copywriter-tips "视频文案要有强烈的画面感和节奏感"
promptx remember scrum-daily "每日站会应该控制在15分钟内关注昨天、今天、阻碍"
${buildCommand.remember('copywriter-tips', '"视频文案要有强烈的画面感和节奏感"')}
${buildCommand.remember('scrum-daily', '"每日站会应该控制在15分钟内关注昨天、今天、阻碍"')}
\`\`\``;
}
@ -194,11 +195,11 @@ ${memoryLine}
## 🔄 下一步行动:
- 记忆检索: 验证知识内化效果
命令: \`promptx recall ${key}\`
命令: \`${buildCommand.recall(key)}\`
- 能力强化: 学习相关知识增强记忆
命令: \`promptx learn <protocol>://<resource-id>\`
命令: \`${buildCommand.learn('<protocol>://<resource-id>')}\`
- 应用实践: 在实际场景中运用记忆
命令: \`promptx action <role-id>\`
命令: \`${buildCommand.action('<role-id>')}\`
📍 当前状态memory_saved`;
}
@ -211,7 +212,7 @@ ${memoryLine}
## 📖 基本用法
\`\`\`bash
promptx remember <记忆标识> <知识内容>
${buildCommand.remember('<记忆标识>', '<知识内容>')}
\`\`\`
## 💡 记忆内化示例
@ -219,10 +220,10 @@ promptx remember <记忆标识> <知识内容>
### 📝 AI记忆内化
AI学习和内化各种专业知识
\`\`\`bash
promptx remember "deploy-process" "1.构建代码 2.运行测试 3.部署到staging 4.验证功能 5.发布生产"
promptx remember "debug-case-001" "用户反馈视频加载慢排查发现是CDN配置问题修改后加载速度提升60%"
promptx remember "react-hooks" "React Hooks允许在函数组件中使用state和其他React特性"
promptx remember "code-review-rules" "每个PR至少需要2个人review必须包含测试用例"
${buildCommand.remember('"deploy-process"', '"1.构建代码 2.运行测试 3.部署到staging 4.验证功能 5.发布生产"')}
${buildCommand.remember('"debug-case-001"', '"用户反馈视频加载慢排查发现是CDN配置问题修改后加载速度提升60%"')}
${buildCommand.remember('"react-hooks"', '"React Hooks允许在函数组件中使用state和其他React特性"')}
${buildCommand.remember('"code-review-rules"', '"每个PR至少需要2个人review必须包含测试用例"')}
\`\`\`
## 💡 记忆标识规范
@ -232,15 +233,15 @@ promptx remember "code-review-rules" "每个PR至少需要2个人review必须
## 🔍 记忆检索与应用
\`\`\`bash
promptx recall <关键词> # AI主动检索记忆
promptx action <role-id> # AI运用记忆激活角色
${buildCommand.recall('<关键词>')} # AI主动检索记忆
${buildCommand.action('<role-id>')} # AI运用记忆激活角色
\`\`\`
🔄 下一步行动:
- 开始记忆: 内化第一条知识
命令: promptx remember <key> <content>
命令: ${buildCommand.remember('<key>', '<content>')}
- 学习资源: 学习新知识再内化
命令: promptx learn <protocol>://<resource>`;
命令: ${buildCommand.learn('<protocol>://<resource>')}`;
}
/**
@ -258,13 +259,13 @@ promptx action <role-id> # AI运用记忆激活角色
{
name: '查看角色',
description: '选择角色获取专业知识',
command: 'promptx hello',
command: COMMANDS.HELLO,
priority: 'medium'
},
{
name: '学习资源',
description: '学习新知识然后保存',
command: 'promptx learn <protocol>://<resource>',
command: buildCommand.learn('<protocol>://<resource>'),
priority: 'high'
}
]
@ -279,7 +280,7 @@ promptx action <role-id> # AI运用记忆激活角色
{
name: '重新输入',
description: '提供完整的记忆内容',
command: `promptx remember ${key} <content>`,
command: buildCommand.remember(key, '<content>'),
priority: 'high'
}
]
@ -293,25 +294,25 @@ promptx action <role-id> # AI运用记忆激活角色
{
name: '检索记忆',
description: '测试记忆是否可检索',
command: `promptx recall ${key}`,
command: buildCommand.recall(key),
priority: 'high'
},
{
name: '学习强化',
description: '学习相关知识加强记忆',
command: 'promptx learn <protocol>://<resource>',
command: buildCommand.learn('<protocol>://<resource>'),
priority: 'medium'
},
{
name: '应用记忆',
description: '在实际场景中应用记忆',
command: 'promptx action <role-id>',
command: buildCommand.action('<role-id>'),
priority: 'medium'
},
{
name: '继续内化',
description: 'AI继续内化更多知识',
command: 'promptx remember <key> <content>',
command: buildCommand.remember('<key>', '<content>'),
priority: 'low'
}
],