Smart Refinement System

v1.0.0

Automatically refines unclear prompts, matches relevant skills via vector similarity, integrates context, and suggests execution steps for efficient AI task...

0· 90·0 current·0 all-time

Install

OpenClaw Prompt Flow

Install with OpenClaw

Best for remote or guided setup. Copy the exact prompt, then paste it into OpenClaw for janussilence/smart-refinement.

Previewing Install & Setup.
Prompt PreviewInstall & Setup
Install the skill "Smart Refinement System" (janussilence/smart-refinement) from ClawHub.
Skill page: https://clawhub.ai/janussilence/smart-refinement
Keep the work scoped to this skill only.
After install, inspect the skill metadata and help me finish setup.
Use only the metadata you can verify from ClawHub; do not invent missing requirements.
Ask before making any broader environment changes.

Command Line

CLI Commands

Use the direct CLI path if you want to install manually and keep every step visible.

OpenClaw CLI

Bare skill slug

openclaw skills install smart-refinement

ClawHub CLI

Package manager switcher

npx clawhub@latest install smart-refinement
Security Scan
VirusTotalVirusTotal
Benign
View report →
OpenClawOpenClaw
Benign
high confidence
Purpose & Capability
Name and description (prompt refinement, vector matching, context integration) match the packaged code and SKILL.md. The included skills database and APIs (process_message, refine_prompt, match_skills) are coherent with the stated purpose. Minor note: package metadata references a homepage/repo but the skill registry lists 'Source: unknown' / 'Homepage: none' — origin is not verified, but this is an administrative/attribution issue rather than a functional mismatch.
Instruction Scope
SKILL.md and the code stay within the described scope: detecting vague prompts, producing refined prompts, computing TF-IDF/cosine-like matches, integrating context, and producing suggested actions/guides. The docs and code also recommend mapping matched skills to tools (e.g., 'exec', 'read', 'write', 'autoglm-websearch') — the skill only suggests those tools; it does not itself request credentials or automatically run external commands. When integrated into an agent that has tool plugins, those suggested tools could cause the agent to run commands or access files; consider controlling which tools the agent is permitted to use.
Install Mechanism
No install spec that downloads or executes external archives; files are provided in the package. SKILL.md shows optional npx clawhub install and manual copy instructions. No URLs or remote installers in the package that would write arbitrary code at install time.
Credentials
The skill declares no required environment variables, no config paths, and the code does not read secrets or environment variables. It reads/writes local config/log files (config save and log path in config_example.json), which is reasonable for a local utility.
Persistence & Privilege
always is false and disable-model-invocation is false (normal). The skill does not request elevated or persistent platform privileges. It writes its own config/log files in the working directory if used, which is expected behavior.
Assessment
This package appears coherent with its stated purpose. Before installing: 1) Verify the source repository or author (package.json claims a repo/homepage but the registry entry shows unknown source). 2) Review the remaining code (functions not shown in the truncated listing) to confirm there are no unexpected network calls or hidden endpoints. 3) When integrating into an agent, restrict which executor tools the agent can actually invoke (e.g., block or sandbox 'exec', restrict file access) because the skill suggests actions that may lead the agent to pick tools like exec/read/write/browser. 4) Run in a sandbox or test environment first, and inspect/create a safe config (log paths, custom_skills_path) to avoid writing sensitive data to disk. If you want lower risk, install but disable any tooling integrations that provide OS or network access.

Like a lobster shell, security has layers — review code before you run it.

ai-assistantvk9736rdenxnar5d6vp80sh28r983wzw4context-integrationvk9736rdenxnar5d6vp80sh28r983wzw4latestvk9736rdenxnar5d6vp80sh28r983wzw4openclawvk9736rdenxnar5d6vp80sh28r983wzw4prompt-optimizationvk9736rdenxnar5d6vp80sh28r983wzw4skill-managementvk9736rdenxnar5d6vp80sh28r983wzw4vector-matchingvk9736rdenxnar5d6vp80sh28r983wzw4
90downloads
0stars
1versions
Updated 4w ago
v1.0.0
MIT-0

Smart Refinement Skill

概述

智能提示词优化与向量匹配技能,集成 Prompt Refinement Module 和 Vector Optimizer 的核心功能。自动识别模糊用户请求,优化提示词结构,匹配相关技能,并提供执行指南。

功能特性

🎯 核心功能

  1. 智能提示词优化

    • 自动检测模糊/不完整的用户请求
    • 生成结构化、清晰的优化提示
    • 支持中英文混合输入
    • 集成上下文信息
  2. 向量化技能匹配

    • 基于TF-IDF和余弦相似度的技能匹配
    • 支持6大类技能数据库
    • 实时匹配分数计算
    • 多技能协同建议
  3. 上下文集成

    • 自动集成对话历史
    • 项目上下文管理
    • 操作记录跟踪
    • 性能统计监控

📊 性能指标

  • 处理速度: < 1ms 平均响应时间
  • 优化准确率: 80-90% 模糊提示识别率
  • 技能匹配: 支持6大类技能,50+关键词
  • LLM调用减少: 60-90% 的优化提示减少LLM调用

安装

方法一:通过 ClawHub 安装

npx clawhub install smart-refinement

方法二:手动安装

  1. 复制 smart_refinement_system.py 到技能目录
  2. 确保依赖项已安装

快速开始

基本使用

from smart_refinement_system import SmartRefinementSystem

# 初始化系统
system = SmartRefinementSystem()

# 处理用户消息
result = system.process_message("Help me process that file")

print(f"优化后提示: {result['refined_prompt']}")
print(f"匹配技能: {result['skill_matches']}")

简化接口

from smart_refinement_system import refine_prompt, match_skills

# 优化提示词
refined = refine_prompt("帮我处理那个文件")
print(refined)

# 匹配技能
skills = match_skills("写一个Python数据分析脚本")
print(skills)

API 参考

SmartRefinementSystem 类

__init__(config_path: Optional[str] = None)

初始化智能优化系统。

参数:

  • config_path: 可选配置文件路径

process_message(message: str, context: Optional[Dict] = None) -> Dict

处理用户消息,返回完整优化结果。

参数:

  • message: 用户消息
  • context: 上下文信息字典

返回:

{
    "original_message": str,
    "needs_refinement": bool,
    "refinement_confidence": float,
    "refined_prompt": str,
    "intent": Dict,
    "entities": Dict,
    "skill_matches": List[Dict],
    "suggested_actions": List[str],
    "execution_guide": str,
    "integrated_context": Dict,
    "processing_time_ms": float,
    "system_stats": Dict
}

get_stats() -> Dict

获取系统统计信息。

save_config(config_path: str)

保存当前配置到文件。

export_skill_data() -> Dict

导出技能数据。

简化函数

refine_prompt(message: str, context: Optional[Dict] = None) -> str

优化提示词的简化接口。

match_skills(message: str) -> List[Dict]

匹配技能的简化接口。

配置选项

创建 config.json 文件自定义配置:

{
    "refinement_threshold": 0.3,
    "vector_match_threshold": 0.5,
    "enable_context_integration": true,
    "enable_skill_suggestion": true,
    "enable_performance_tracking": true,
    "language": "auto",
    "output_format": "structured"
}

技能数据库

系统内置6大类技能:

  1. code_generation - 代码生成和优化
  2. file_operation - 文件操作
  3. web_search - 网络搜索
  4. data_analysis - 数据分析
  5. documentation - 文档编写
  6. system_operation - 系统操作

使用场景

场景1:模糊请求优化

# 输入: "帮我处理那个文件"
# 输出: 结构化提示,包含具体动作建议

场景2:技能匹配

# 输入: "搜索AI趋势信息"
# 输出: 匹配web_search技能,建议使用autoglm-websearch工具

场景3:多技能协同

# 输入: "分析数据并生成报告"
# 输出: 匹配data_analysis和documentation技能,提供完整工作流

集成示例

与 OpenClaw 集成

from smart_refinement_system import SmartRefinementSystem

class EnhancedAgent:
    def __init__(self):
        self.refinement_system = SmartRefinementSystem()
    
    def handle_message(self, message: str, context: Dict = None):
        # 1. 优化提示词
        result = self.refinement_system.process_message(message, context)
        
        # 2. 根据优化结果执行
        if result['needs_refinement']:
            # 使用优化后的提示
            prompt = result['refined_prompt']
        else:
            prompt = message
        
        # 3. 根据技能匹配选择工具
        for skill_match in result['skill_matches']:
            if skill_match['match_score'] > 0.5:
                self._select_tool(skill_match['skill_type'])
        
        return self._execute(prompt)

与团队系统集成

from smart_refinement_system import SmartRefinementSystem
from team_manager import TeamManager

class SmartTeamSystem:
    def __init__(self):
        self.refinement = SmartRefinementSystem()
        self.team = TeamManager()
    
    def assign_task(self, task_description: str):
        # 优化任务描述
        result = self.refinement.process_message(task_description)
        
        # 根据技能匹配分配团队成员
        for skill_match in result['skill_matches']:
            member = self.team.find_member_by_skill(skill_match['skill_type'])
            if member:
                self.team.assign_task(member, result['refined_prompt'])

性能优化

缓存策略

系统自动缓存:

  • 高频关键词匹配结果
  • 技能向量计算结果
  • 上下文集成数据

并行处理

支持批量消息处理:

messages = ["任务1", "任务2", "任务3"]
results = [system.process_message(msg) for msg in messages]

故障排除

常见问题

  1. 优化效果不明显

    • 检查 refinement_threshold 配置
    • 确认关键词数据库是否完整
    • 检查上下文信息是否充足
  2. 技能匹配不准确

    • 更新技能数据库关键词
    • 调整 vector_match_threshold
    • 检查消息预处理逻辑
  3. 性能问题

    • 启用缓存功能
    • 减少不必要的上下文集成
    • 批量处理消息

调试模式

system = SmartRefinementSystem()
result = system.process_message("测试消息", debug=True)
print(json.dumps(result, indent=2, ensure_ascii=False))

更新日志

v1.0.0 (2026-03-30)

  • 初始版本发布
  • 集成 Prompt Refinement Module 核心功能
  • 集成 Vector Optimizer 向量匹配
  • 添加上下文管理器
  • 支持6大类技能数据库
  • 提供简化API接口

贡献指南

  1. Fork 项目
  2. 创建功能分支
  3. 提交更改
  4. 推送到分支
  5. 创建 Pull Request

许可证

MIT License

支持

如有问题或建议,请:

  1. 查看 GitHub Issues
  2. 提交新的 Issue
  3. 或通过邮件联系

标签: prompt-optimization, vector-matching, context-integration, skill-management, openclaw, ai-assistant

适用场景: AI助手优化、团队任务分配、技能匹配、提示词工程

Comments

Loading comments...