Skip to content

Commit 72a29f5

Browse files
authored
Openclaw local plugin integration (#1488)
## Description This PR integrates recent fixes to improve skill generation and handle viewer authentication gracefully. - **Skill Generator**: Aligned the skill generation prompt template with skill-creator best practices. Added explicit instructions to assume the agent is smart, improved trigger descriptions, enforced stricter metadata/naming rules, and prevented the generation of extraneous boilerplate files. - **Viewer**: Added a check in the `loadConfig` function to show a "session expired" toast notification when receiving a 401 Unauthorized response, preventing silent authentication failures. Related Issue (Required): Fixes #1434, Fixes #1424 ## Type of change Please delete options that are not relevant. - [x] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] Refactor (does not change functionality, e.g. code style improvements, linting) - [ ] Documentation update ## How Has This Been Tested? Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration - [ ] Unit Test - [x] Test Script Or Test Steps (please provide) - Generated a new skill to verify that the output correctly follows the updated prompt constraints (e.g., kebab-case naming, no extra files, proper trigger keywords). - Manually simulated a 401 response during config load in the viewer to ensure the session expiration toast appears properly. - [ ] Pipeline Automated API Test (please provide) ## Checklist - [x] I have performed a self-review of my own code | 我已自行检查了自己的代码 - [x] I have commented my code in hard-to-understand areas | 我已在难以理解的地方对代码进行了注释 - [x] I have added tests that prove my fix is effective or that my feature works | 我已添加测试以证明我的修复有效或功能正常 - [ ] I have created related documentation issue/PR in [MemOS-Docs](https://github.com/MemTensor/MemOS-Docs) (if applicable) | 我已在 [MemOS-Docs](https://github.com/MemTensor/MemOS-Docs) 中创建了相关的文档 issue/PR(如果适用) - [x] I have linked the issue to this PR (if applicable) | 我已将 issue 链接到此 PR(如果适用) - [ ] I have mentioned the person who will review this PR | 我已提及将审查此 PR 的人 ## Reviewer Checklist - [x] closes #1434, closes #1424 - [ ] Made sure Checks passed - [ ] Tests have been provided
2 parents c044b25 + d2ded98 commit 72a29f5

2 files changed

Lines changed: 19 additions & 4 deletions

File tree

apps/memos-local-openclaw/src/skill/generator.ts

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,24 @@ This Skill is special: it comes from real execution experience — every step wa
2424
2525
## Core principles (follow strictly but do NOT include these in output)
2626
27+
### Assume the agent is smart
28+
The agent consuming this skill is an LLM — it already knows how to use git, write code, read docs, and run commands.
29+
- Only write what the agent CANNOT derive from the codebase or general knowledge: project-specific gotchas, non-obvious config, verified flags/versions, and real pitfalls encountered.
30+
- Do NOT explain basic concepts, standard tool usage, or things any competent developer already knows.
31+
2732
### Progressive disclosure
2833
- The frontmatter description (~100 words) is ALWAYS in the agent's context — it must be self-sufficient for deciding whether to use this skill.
2934
- The SKILL.md body loads when triggered — keep it under 400 lines, focused, no fluff.
3035
- If the task involved large configs/scripts, mention them but DON'T inline everything — just reference that scripts/ or references/ may contain them.
36+
- If the skill covers multiple variants (e.g. different OS targets, different cloud providers), put variant-specific details in references/ files. The main SKILL.md should cover the common workflow only.
3137
3238
### Description as trigger mechanism
33-
The description field decides whether the agent activates this skill. Write it "proactively":
39+
The description field is the SOLE input the agent uses to decide whether to activate this skill. If the description doesn't match, the body is never read — so put maximum effort here.
3440
- Don't just say what it does — list the situations, keywords, and phrasings that should trigger it.
3541
- Claude/agents tend to under-trigger skills. Counter this by being explicit about when to use it.
42+
- Include indirect phrasings: users often describe the goal ("make it run anywhere") rather than the tool ("Docker").
3643
- Bad: "How to deploy Node.js to Docker"
37-
- Good: "How to containerize and deploy a Node.js application using Docker. Use when the user mentions Docker deployment, Dockerfile writing, container builds, multi-stage builds, port mapping, .dockerignore, image optimization, CI/CD container pipelines, or any task involving packaging a Node/JS backend into a container — even if they don't say 'Docker' explicitly but describe wanting to 'package the app for production' or 'run it anywhere'."
44+
- Good: "How to containerize and deploy a Node.js application using Docker. TRIGGER when: user mentions Docker deployment, Dockerfile writing, container builds, multi-stage builds, port mapping, .dockerignore, image optimization, CI/CD container pipelines, or any task involving packaging a Node/JS backend into a container — even if they don't say 'Docker' explicitly but describe wanting to 'package the app for production' or 'run it anywhere'."
3845
3946
### Writing style
4047
- Use imperative form
@@ -43,6 +50,9 @@ The description field decides whether the agent activates this skill. Write it "
4350
- Generalize from the specific task so the skill works for similar future scenarios, don't over-fit to this exact project
4451
- Keep real commands/code/config from the task record — these are verified to work
4552
53+
### No extra files
54+
- Output ONLY the SKILL.md content. Do NOT create or reference README.md, CHANGELOG.md, INSTALLATION_GUIDE.md, CONTRIBUTING.md, or similar boilerplate files. All information belongs in SKILL.md, scripts/, or references/.
55+
4656
### Language matching (CRITICAL)
4757
You MUST write the ENTIRE skill in the SAME language as the user's messages in the task record.
4858
- If the user wrote in Chinese → the skill title, description, all prose sections MUST be in Chinese
@@ -57,12 +67,16 @@ DO NOT default to English. Look at the task record below and match its language.
5767
5868
Output ONLY the complete SKILL.md content. No extra text before or after.
5969
70+
The frontmatter contains ONLY name and description. Nothing else.
71+
(OpenClaw metadata such as emoji is optional — if desired, add it as a \`<!-- metadata: {{"openclaw": {{"emoji": "..."}}}}} -->\` HTML comment at the very end of the file body, NOT in the frontmatter.)
72+
6073
---
6174
name: "{NAME}"
62-
description: "{A natural, proactive description. 60-120 words. Cover what it does + multiple phrasings/scenarios that should trigger it. Be pushy about triggering — list keywords, alternative descriptions, edge-case phrasings.}"
63-
metadata: {{ "openclaw": {{ "emoji": "{emoji}" }} }}
75+
description: "{A natural, proactive description. 60-120 words. Cover what it does + multiple phrasings/scenarios that should trigger it. Include a TRIGGER line listing keywords and indirect phrasings. Be pushy about triggering.}"
6476
---
6577
78+
Name rules: 2-4 English words, kebab-case, lowercase (e.g. "docker-node-deploy", "aws-s3-backup"). This is a machine identifier.
79+
6680
# {Title — clear, action-oriented}
6781
6882
{One sentence: what this skill helps you do and why it's valuable}

apps/memos-local-openclaw/src/viewer/html.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7205,6 +7205,7 @@ function onProviderChange(){}
72057205
async function loadConfig(){
72067206
try{
72077207
const r=await fetch('/api/config');
7208+
if(r.status===401){toast(t('settings.session.expired'),'error');return;}
72087209
if(!r.ok) return;
72097210
const cfg=await r.json();
72107211
const emb=cfg.embedding||{};

0 commit comments

Comments
 (0)