# openspec-apply-change

Adopt this skill: https://proskills.md/skills/other/mememeow-studio-mememeow-agents-skills-openspec-apply-change

Page: https://proskills.md/skills/other/mememeow-studio-mememeow-agents-skills-openspec-apply-change
This document is the public skill bundle for that page. It contains SKILL.md and every helper file the catalog carries. No login is required.

## File: .agents/skills/openspec-apply-change/SKILL.md
size: 7905
sha: 74109b6be846aadff7f2cad3bd981561786a83e5
upstream: https://github.com/mememeow-studio/mememeow/blob/main/.agents/skills/openspec-apply-change/SKILL.md

````text
---
name: openspec-apply-change
description: Implement tasks from an OpenSpec change. Use when the user wants to start implementing, continue implementation, or work through tasks.
allowed-tools: Bash(openspec:*)
license: MIT
compatibility: Requires openspec CLI.
metadata:
  author: openspec
  version: "1.0"
  generatedBy: "1.8.0"
---

Implement tasks from an OpenSpec change.

**Store selection:** If the user names a store (a store is a standalone OpenSpec repo registered on this machine) or the work lives in one, run `openspec store list --json` to discover registered store ids, then pass `--store <id>` on the commands that read or write specs and changes (`new change`, `status`, `instructions`, `list`, `show`, `validate`, `archive`, `doctor`, `context`, `view`). Once selected, treat `--store <id>` as sticky for the rest of the workflow. Every unscoped example of those commands below is shorthand: before running it, append the flag. For example, run `openspec status --change "<name>" --json --store "<id>"`, not the unscoped form shown below. Other commands do not take the flag. Hints printed by commands already carry the flag; keep it on follow-ups. Without a store, commands act on the nearest local `openspec/` root.

**Input**: Optionally specify a change name (e.g., `$openspec-apply-change (Codex) or /openspec-apply-change (other agents) add-auth`). If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.

**Steps**

1. **Select the change**

   If a name is provided, use it. Otherwise:
   - Infer from conversation context if the user mentioned a change
   - Auto-select if only one active change exists
   - If ambiguous, run `openspec list --json` to get available changes and ask the user to select one

   Always announce: "Using change: <name>" and how to override (e.g., `$openspec-apply-change (Codex) or /openspec-apply-change (other agents) <other>`).

2. **Check status to understand the schema**
   ```bash
   openspec status --change "<name>" --json
   ```
   Parse the JSON to understand:
   - `schemaName`: The workflow being used (e.g., "spec-driven")
   - `planningHome`, `changeRoot`, and `actionContext`: planning scope and edit constraints
   - Which artifact contains the tasks (typically "tasks" for spec-driven, check status for others)

3. **Get apply instructions**

   ```bash
   openspec instructions apply --change "<name>" --json
   ```

   This returns:
   - `contextFiles`: artifact ID -> array of concrete file paths (varies by schema - could be proposal/specs/design/tasks or spec/tests/implementation/docs)
   - Progress (total, complete, remaining)
   - Task list with status
   - Dynamic instruction based on current state
   - Optional `context`: current required project instruction input from the selected root
   - Optional `operationGuidance`: current advisory guidance for apply

   **Handle states:**
   - If `state: "blocked"` (missing artifacts): show message, suggest using `$openspec-continue-change (Codex) or /openspec-continue-change (other agents)` (if it is not installed, run `openspec status --change "<name>" --json` to see the next artifact and `openspec instructions <artifact-id> --change "<name>" --json` for how to create it)
   - If `state: "all_done"`: congratulate, suggest archive
   - Otherwise: proceed to implementation

   Treat `context` as a required prompt-level input. Read and consider it, and
   apply relevant project facts, conventions, and constraints while implementing.
   Treat `operationGuidance` as optional additive advice. Read and consider every
   entry, and follow entries that are applicable and compatible with the built-in
   workflow.

   Keep both fields separate from CLI-returned state, missing artifacts, tasks,
   progress, `contextFiles`, and the built-in `instruction`. They are not
   evidence of task completion, do not replace the built-in instruction, and do
   not permit bypassing a blocked state. If context conflicts with the built-in
   instruction, an explicit user choice, or a CLI-controlled value, report the
   conflict and preserve the controlling value. If guidance is inapplicable or
   conflicts with those controlling inputs, do not follow it and explain why.
   These are prompt-level behavior contracts, not enforceable checks.

4. **Read context files**

   Read every file path listed under `contextFiles` from the apply instructions output.
   The files depend on the schema being used:
   - **spec-driven**: proposal, specs, design, tasks
   - Other schemas: follow the contextFiles from CLI output

   Do not copy `context` or `operationGuidance` verbatim into implementation
   files or planning artifacts unless the user separately asks for that content.

5. **Show current progress**

   Display:
   - Schema being used
   - Progress: "N/M tasks complete"
   - Remaining tasks overview
   - Dynamic instruction from CLI

6. **Implement tasks (loop until done or blocked)**

   For each pending task:
   - Show which task is being worked on
   - Make the code changes required
   - Keep changes minimal and focused
   - Mark task complete in the tasks file: `- [ ]` → `- [x]`
   - Continue to next task

   **Pause if:**
   - Task is unclear → ask for clarification
   - Implementation reveals a design issue → suggest updating artifacts
   - Error or blocker encountered → report and wait for guidance
   - User interrupts

7. **On completion or pause, show status**

   Display:
   - Tasks completed this session
   - Overall progress: "N/M tasks complete"
   - If all done: suggest archive
   - If paused: explain why and wait for guidance

**Output During Implementation**

```
## Implementing: <change-name> (schema: <schema-name>)

Working on task 3/7: <task description>
[...implementation happening...]
✓ Task complete

Working on task 4/7: <task description>
[...implementation happening...]
✓ Task complete
```

**Output On Completion**

```
## Implementation Complete

**Change:** <change-name>
**Schema:** <schema-name>
**Progress:** 7/7 tasks complete ✓

### Completed This Session
- [x] Task 1
- [x] Task 2
...

All tasks complete! You can archive this change with `$openspec-archive-change (Codex) or /openspec-archive-change (other agents)`.
```

**Output On Pause (Issue Encountered)**

```
## Implementation Paused

**Change:** <change-name>
**Schema:** <schema-name>
**Progress:** 4/7 tasks complete

### Issue Encountered
<description of the issue>

**Options:**
1. <option 1>
2. <option 2>
3. Other approach

What would you like to do?
```

**Guardrails**
- Keep going through tasks until done or blocked
- Always read context files before starting (from the apply instructions output)
- If task is ambiguous, pause and ask before implementing
- If implementation reveals issues, pause and suggest artifact updates
- Keep code changes minimal and scoped to each task
- Update task checkbox immediately after completing each task
- Pause on errors, blockers, or unclear requirements - don't guess
- Use contextFiles from CLI output, don't assume specific file names
- Do not use context or operation guidance as proof that a task is complete
- Apply relevant project context; report conflicts with controlling workflow inputs
- Consider every guidance entry; explain any inapplicable or conflicting advice
- Do not copy runtime context or operation guidance into implementation files or planning artifacts
- Preserve CLI-controlled blocked/ready/all-done behavior and completion criteria

**Fluid Workflow Integration**

This skill supports the "actions on a change" model:

- **Can be invoked anytime**: Before all artifacts are done (if tasks exist), after partial implementation, interleaved with other actions
- **Allows artifact updates**: If implementation reveals design issues, suggest updating artifacts - not phase-locked, work fluidly
````

## File: README.md
upstream: https://github.com/mememeow-studio/mememeow/blob/main/README.md

````text
MemeMeow 是一个基于自然语言的表情包检索工具。它能自动标注表情包含义，并通过描述想要的场景或心情，快速找到合适的表情包（无需记住具体的文件名或标签）。

> [!CAUTION]
> 本项目返回的表情包结果均由 AI 理解和生成，与开发者本人观点无关。

<a id="-features"></a>

## ✨ 核心特性

- **🧠 自动化语境理解**: **无需手动为表情包分类和标注**，内置 OpenCode Agent，选择完整分析上传图片时，Agent 会对图片进行结构化分析、生成语境和描述。
- **📤 直接上传**: 无需运行 Agent 语境分析，使用有效文件名生成文本向量，同时生成图片视觉向量；后台根据图片内容尝试自动命名，生成有效名称后更新文本向量。
- **🤖 自然语言检索**: 采用 Embedding 模型，实现 Q&A 式的检索，能够根据你的描述（如“表达无奈”）找到匹配的图片。
- **👁️ 视觉近邻搜索**: 支持本地 DINOv2 视觉模型，实现图片之间的相似度搜索。
- **📦 容器部署**: 提供 Vue 3 Web 界面和统一的 API，服务可通过 Docker Compose 启动。
  ![截图](docs/images/image-preview-zh.png)

## 🚀 立即使用

前往[MemeMeow官网](https://mememeow.cc/home) 立即开始使用，无需本地部署。

支持浏览器直接使用，以及Windows，Android，macos和Linux主要发行版。可在官网下载软件。

> 目前正处于早期测试阶段。可以提交issue或加入交流群反馈错误。

## 📖 核心功能与使用说明

### 1. 自然语言检索

系统的主要检索页面，支持通过自然语言查找目标图片。

![主页截图](docs/images/image-home-zh.png)

* **语义检索**：支持输入日常场景描述（如：“表达无奈”、“早上打工人”），系统通过 Embedding 机制检索匹配的图片，不需要依赖确切的文件名或固定的标签。
* **图片复制与保存**：点击检索结果图片，网页端复制到剪贴板，Android 应用保存到相册。
* **输出尺寸**：可选择原图或最长边 60、120、240、360、480、640px，默认原图。保持图片比例，不裁剪，不放大小图；设置保存在当前浏览器。详见[图片复制与相册保存尺寸](docs/search-image-export.md)。
* **详情与预览**：点击图片卡片，可查看后台 Agent 提取的图片描述和语境信息；点击卡片上的放大镜图标可全屏预览原图。

### 2. 图片库

用于浏览、筛选和管理已上传的表情包文件。

![图片库截图](docs/images/image-lib-zh.png)

* **浏览与过滤**：支持分页查看系统内的所有图片资源，并提供文本过滤功能以定位特定图片。
* **处理状态显示**：图片卡片上会显示各项后台任务（如：视觉向量化、元数据提取、文本向量生成）的状态图标，用于区分该阶段的处理是成功还是失败。
* **批量操作与合集 (Collections)**：支持多选图片，将其打包加入“合集包”，用于后续的统一管理或导出。
* **任务重试**：当部分图片在后台处理环节（如调用大模型分析）失败时，可选中这些图片并点击“重试”按钮，将其重新加入任务队列。

### 3. 上传图片

将本地的新表情包文件上传至系统，上传成功后可以在图片库中浏览和管理。

![上传图片截图](docs/images/image-pre-upload-image-zh.png)

* **上传方式**：支持以下三种文件导入方式：
  * **拖拽上传**：将单张图片或多张图片拖入虚线区域。
  * **剪贴板上传**：在页面中使用快捷键（如 `Ctrl+V` 或 `Cmd+V`）直接粘贴剪贴板中的图片。
  * **点击上传**：点击区域打开文件选择器选择本地文件。
* **处理方式**：在确认提交前，可以选择“直接上传”或“完整分析”。一次选择超过 10 张图片时默认直接上传，10 张及以下默认完整分析，也可以手动修改：
  * **直接上传**：使用有效文件名生成文本向量，并生成图片视觉向量。后台根据图片内容尝试自动命名，生成有效名称后更新文本向量，无需运行 Agent 语境分析。文件名为无意义的哈希值且没有其他有效检索文本时，文本向量暂时等待有效名称，图片视觉向量仍会正常生成。
  * **完整分析**：运行 Agent 分析图片的出处、用法和含义，生成语境和描述，并生成检索所需的向量。
* **完整分析选项**：选择完整分析时，可配置后台 Agent 对这批图片的分析规则：
  * **反向搜索策略**：设置在遇到较难理解的图片时，是否允许 Agent 使用谷歌进行联网以图搜图，从而获取图片的来源和背景信息。
  * **自动命名**：选择是否允许 AI 根据图片内容生成新的文件名。
* **上传队列**：页面下方会显示当前批次文件的上传进度，并支持对上传失败的单个文件进行重试。

### 4. 处理任务 (Tasks)

查看和管理后台异步执行的长时任务记录。

![处理任务截图](docs/images/image-processing-tasks-zh.png)

* **任务状态**：上传图片后的语境理解、合集的导入等操作会在后台生成任务记录。页面会定期刷新并显示当前任务处于排队中、运行中、成功或失败状态。
* **分类与筛选**：支持按照“任务类型”和“执行状态”对任务列表进行过滤。
* **任务详情**：点击具体的任务列表项，会从侧边展开“任务抽屉”，展示任务执行的详细步骤和报错日志。
* **中断重试**：针对执行失败的任务，可在任务详情页点击重试按钮，系统会尝试从发生错误的环节继续执行。<a id="-api"></a>

## 本地部署

本项目依赖容器化环境进行隔离与部署，请确保机器已安装 **Docker Engine 28或以上** 与 **Compose v2 插件**。

### 1. 克隆代码与配置环境变量

```bash
git clone https://github.com/MemeMeow-Studio/MemeMeow.git
cd MemeMeow

# 如果你没有安装 uv，也可以直接复制 .env.example 并手动编辑:
# cp .env.example .env
uv run python -m scripts.sync_env
```

执行完毕后，请编辑项目目录下的 `.env` 文件，填写必要的模型配置（特别是 `MEMEMEOW_OPENCODE_BASE_URL` 与 `MEMEMEOW_OPENCODE_API_KEY`，用于 Agent 处理图片语境）。

### 2. 一键启动

```bash
./start.sh start
```

该命令会启动 PostgreSQL（附带 pgvector）、代理执行器 (Agent Executor)、视觉服务以及后端 API 容器。
服务启动成功后，浏览器访问 `http://127.0.0.1:8275/` 即可看到前端界面。

### 3. 下载本地视觉权重

需要下载官方 DINOv2 权重：

```bash
mkdir -p data/models
curl -L --fail --output data/models/dinov2_vitb14_pretrain.pth \
  https://dl.fbaipublicfiles.com/dinov2/dinov2_vitb14/dinov2_vitb14_pretrain.pth
```

下载完成后，若环境配置无误，容器内部会自动挂载并启动服务。

### 常用命令

```bash
./start.sh status         # 查看运行状态
./start.sh logs           # 查看所有服务的日志
./start.sh logs mememeow -f  # 持续跟踪主后端的日志
./start.sh stop           # 安全停止服务（不会丢失数据）
```

## 🔌 进阶设计与 API

MemeMeow 本质是一个 API 驱动的服务。如果你是开发者，可以直接调用 `POST /search` 进行跨应用整合，只要不涉及后台管理，相关检索 API 可供调用。

* **Endpoint**: `POST http://localhost:8275/search`
* **JSON 请求示例**: `{"query": "无奈叹气", "n_results": 5, "llm_enhance": false}`
* **JSON 响应示例**: `{"results":["/media/uuid-1", "/media/uuid-2"]}`

<!-- **🛠️ 面向开发者的架构文档**

如果你想了解 MemeMeow 更底层的设计机制（如安全边界、权限管理、前后端联调方案），我们将其抽离到了独立的文档中：
👉 **[高级部署与架构指南 (docs/deployment.md)](docs/deployment.md)**

关于双环境隔离设计与作用域约束，请查阅 [应用作用域设计 (docs/application-scope.md)](docs/application-scope.md)。 -->

> 官方MemeMeow API正在开发。同时，我们欢迎相关使用需求的讨论。您可以提出issue或加入Q群交流。

## 加入交流

QQ群 https://qm.qq.com/q/UiY4Ix5xqa

## 📦 社区相关应用

基于 MemeMeow 衍生出的社区项目：

| 应用                | 作者                                             | GitHub                                                                                           | 链接                                                                                                             |
| ------------------- | ------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------- |
| VVQuest网页端       |                                                  | [VVQuest](https://github.com/DanielZhangyc/VVQuest)                                               | [链接](https://zvv.quest)                                                                                         |
| VVQuest*iOS*捷径  | [TomSmith163](https://github.com/TomSmith163)     |                                                                                                  | [链接](https://www.icloud.com/shortcuts/a7084c7ae29e4de5898ce7c8386705f3)                                         |
| HakuBot().vv() 命令 | [apple_catwaii](https://github.com/Apple-QAQ)     |                                                                                                  | [QQ](https://qm.qq.com/cgi-bin/qm/qr?k=GJSCe1_B98V4Ni6leVtKAjQrAtJW-VG5)                                          |
| VVQuest油猴脚本     | [DanielZhangyc](https://github.com/DanielZhangyc) | [vvquest-tampermonkey-extension](https://github.com/DanielZhangyc/vvquest-tampermonkey-extension) | [greasyfork](https://greasyfork.org/zh-CN/scripts/528477-vvquest-vv%E8%A1%A8%E6%83%85%E5%8C%85%E5%8A%A9%E6%89%8B) |
| Yunzai-Bot 插件     | [TomyJan](https://github.com/TomyJan)             | [TomyJan/Yunzai-TomyJan-Plugin](https://github.com/TomyJan/Yunzai-TomyJan-Plugin/)                |                                                                                                                  |

> [!TIP]
> 如果你想将自己开发的衍生应用加到这个列表，欢迎提交 [PR](https://github.com/MemeMeow-Studio/MemeMeow/pulls) 或 [Issue](https://github.com/MemeMeow-Studio/MemeMeow/issues)！

## 📄 License & ⭐ Star History

本项目采用 [GNU Affero General Public License v3.0 或更高版本](LICENSE) 开源协议。

[![Star History Chart](https://api.star-history.com/svg?repos=MemeMeow-Studio/MemeMeow&type=Date)](https://star-history.com/#MemeMeow-Studio/MemeMeow&Date)
````
