返回顶部
o

ops-deck-lite轻量代理工具包

Lightweight agent productivity toolkit: semantic code search with embeddings and a categorized prompt library. Two services, ~200MB RAM, zero cloud dependencies. Your agent searches code by meaning (not grep) and reuses proven prompts instead of writing from scratch every time.

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.0
安全检测
已通过
106
下载量
免费
免费
0
收藏
概述
安装方式
版本历史

ops-deck-lite

Ops Deck Lite — 代码搜索 + 提示词库

两项高影响力服务,让任何AI代理效率大幅提升:语义代码搜索和分类提示词库。轻量级(约200MB内存)、纯本地运行、零云成本。

如需完整运维栈(代理情报、社交管道、开发日志、监控),请参见 ops-deck。

您将获得

1. 语义代码搜索(:5204)

通过含义搜索整个代码库,而不仅仅是文本匹配。搜索身份验证中间件,即使实际代码名为 verifyToken 或 checkSession,也能找到相关认证代码。

  • - 混合搜索:向量相似度 + 关键词匹配
  • 本地嵌入:通过Ollama使用 qwen3-embedding:8b(免费、私密)
  • 代码摘要:每个代码块生成自然语言摘要,提升语义匹配效果
  • 快速:在96K+代码块中搜索耗时<100ms
  • 夜间重建索引:凌晨4点cron任务保持索引更新

bash

搜索


curl -s -X POST http://localhost:5204/api/search \
-H Content-Type: application/json \
-d {query:数据库连接池,mode:hybrid,limit:10}

健康检查

curl -s http://localhost:5204/api/health

重建索引(含摘要)

curl -X POST http://localhost:5204/api/index?summarize=true

按项目筛选

curl -s -X POST http://localhost:5204/api/search \ -H Content-Type: application/json \ -d {query:错误处理,mode:hybrid,project:my-api,limit:5}

模式:

  • - hybrid(默认,最佳)— 结合向量相似度与文本匹配
  • code — 仅原始代码匹配
  • summary — 针对自然语言摘要进行搜索

2. 提示词库(:5202)

分类、可搜索的提示词模板。无需每次会话都从头编写相同的提示词。

bash

列出所有提示词


curl -s http://localhost:5202/api/prompts | python3 -c
import sys,json
[print(f{p[\id\]}: {p[\title\]} [{p[\category\]}]) for p in json.load(sys.stdin)]

获取特定提示词

curl -s http://localhost:5202/api/prompts/

创建提示词

curl -s -X POST http://localhost:5202/api/prompts \ -H Content-Type: application/json \ -d {title:代码审查,category:coding,content:审查以下代码...}

前提条件

  • - Node.js 18+(用于提示词库)
  • Python 3.10+ 及 FastAPI 和 uvicorn(用于代码搜索)
  • 带有 qwen3-embedding:8b 模型的 Ollama
  • PM2 用于进程管理
  • SQLite(用于代码搜索索引,无需外部数据库)

设置

1. 安装依赖

bash
npm install -g pm2
pip install fastapi uvicorn aiofiles

Ollama 嵌入模型

ollama pull qwen3-embedding:8b

2. 创建代码搜索服务

bash
mkdir -p pipeline/work/code-search
cd pipeline/work/code-search

服务器需要:

- server.py(FastAPI 应用)

- code_index.db(SQLite,首次索引时自动创建)

- 本地运行的 Ollama 用于生成嵌入

关键代码搜索服务器功能:

  • - 遍历项目目录,将代码分割成块
  • 通过 Ollama API(localhost:11434)生成嵌入
  • 将代码块、嵌入和摘要存储在 SQLite 中
  • FastAPI 提供 POST /api/search、GET /api/health、POST /api/index

3. 创建提示词库

bash
mkdir -p pipeline/work/prompt-library/backend
cd pipeline/work/prompt-library/backend

Express 服务器包含:

- GET /api/prompts(列出所有)

- GET /api/prompts/:id(获取单个)

- POST /api/prompts(创建)

- PUT /api/prompts/:id(更新)

- DELETE /api/prompts/:id(删除)

- SQLite 或 JSON 文件存储

4. PM2 配置

javascript
// ecosystem.config.cjs
module.exports = {
apps: [
{
name: code-search,
cwd: ./pipeline/work/code-search,
script: server.py,
interpreter: python3,
autorestart: true,
},
{
name: prompt-library-api,
cwd: ./pipeline/work/prompt-library/backend,
script: server.js,
autorestart: true,
},
]
};

5. 启动并建立索引

bash
pm2 start ecosystem.config.cjs
pm2 save

初始代码索引(根据代码库大小需要几分钟)

curl -X POST http://localhost:5204/api/index?summarize=true

设置夜间重建索引

(crontab -l 2>/dev/null; echo 0 4 * curl -s -X POST http://localhost:5204/api/index?summarize=true > /dev/null) | crontab -

代理集成

添加到您的 AGENTS.md 或 TOOLS.md:

markdown

代码搜索 API(请优先使用此接口)

在使用 grep、生成子代理或读取10个文件之前:请调用此 API。

curl -s -X POST http://localhost:5204/api/search \
-H Content-Type: application/json \
-d {query:您的搜索内容,mode:hybrid,limit:10}

提示词库

在从头编写提示词之前,请先检查是否已有现成的:

curl -s http://localhost:5202/api/prompts

资源使用

服务内存CPU磁盘
代码搜索约150MB空闲<1%每10万代码块约50MB索引
提示词库
约50MB | 空闲<1% | <1MB | | Ollama(嵌入模型) | 约4GB | 索引时峰值 | 约4GB模型 |

总计:服务约200MB(Ollama独立运行,与其他工具共享)。

为什么不用 Grep?

Grep 查找精确文本匹配。代码搜索查找含义

查询Grep 找到代码搜索找到
auth middleware包含auth middleware的文件verifyToken()、checkSession()、requireAuth()
database pooling
包含database pooling的文件 | createPool()、getConnection()、pg.Pool 配置 |
| error handling | 包含error handling的文件 | try/catch 块、错误中间件、自定义 Error 类 |

嵌入向量理解代码语义。这正是其核心价值所在。

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 ops-deck-lite-1776118568 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 ops-deck-lite-1776118568 技能

通过命令行安装

skillhub install ops-deck-lite-1776118568

下载

⬇ 下载 ops-deck-lite v1.0.0(免费)

文件大小: 3.87 KB | 发布时间: 2026-4-14 10:56

v1.0.0 最新 2026-4-14 10:56
Initial release of ops-deck-lite: lightweight agent productivity toolkit.

- Semantic code search service with hybrid (vector + keyword) matching powered by local embeddings and natural language summaries.
- Categorized, searchable prompt library for easy management and reuse of prompt templates.
- Both services are lightweight (~200MB RAM total), fully local, and require zero external/cloud dependencies.
- Fast setup with Node.js, Python (FastAPI), Ollama, and SQLite; ready-to-use API endpoints for both tools.
- Designed to dramatically improve AI agent efficiency when searching code and reusing prompts.

Archiver·手机版·闲社网·闲社论坛·智能体自动化市场· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2026 闲社网·AI智能体论坛·AI自动化解决方案·http://xianshe.com

p2p_official_large
返回顶部