desktop-lexiang-sync-clean
Installation
Review the source and dependencies with a prompt. A package is available to download.
Install with an AI assistant
Copy the prompt so your assistant can review the pinned revision and dependencies first.
View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "desktop-lexiang-sync-clean" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-5d00f40b06460c7cee8a8794cfe534da277b8334bb114aa4387d66662360e294. Verify the upstream source and version against https://skillhub.cn/skills/user_de3c14ab/feihang123 before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.
Source and setup
skillhub.cn
Setup guidance pending
See the original source for supported tools, dependencies, and permissions.
Installation test pending
Checks whether WorkBuddy is configured and can access Tencent Cloud Zhi/Ideal MCP services, then compares all readable local documents to accessible ideal documents using metadata, content hashes, and Markdown front-matter/body changes. Use cases include finding ideal documents missing locally, detecting updates in local or ideal documents, reviewing files pending upload or overwrite, and securely synchronizing local files with ideal documents when requested.
Introduction source: third_party · user_de3c14ab · 1.0.1 Reference
SkillPi interpretation
- Tasks
- Check whether WorkBuddy is configured and able to reach the Tencent Yunzhi/Lexiang MCP service, then compare all readable local documents with accessible Lexiang files using metadata, content hashes, and Markdown front-matter/body changes. Use when a user asks to find local documents missing from Lexiang, detect local or Lexiang document updates, review files to upload or overwrite, or safely synchronize local files with Lexiang.
- Testing
- Not tested
Browse files
Frontmatter
name: feihang123
description: Check whether WorkBuddy is configured and able to reach the Tencent Yunzhi/Lexiang MCP service, then compare all readable local documents with accessible Lexiang files using metadata, content hashes, and Markdown front-matter/body changes. Use when a user asks to find local documents missing from Lexiang, detect local or Lexiang document updates, review files to upload or overwrite, or safely synchronize local files with Lexiang.WorkBuddy Lexiang Local Sync
Use this workflow for Tencent Yunzhi/Lexiang only. Treat discovery as read-only. Never upload, overwrite, move, or delete a Lexiang file until the user chooses an action after seeing the candidate list.
Never present a filename-only match as a content similarity score. Never call a personal-space-only scan a complete Lexiang scan.
1. Verify the connection
Always run this step before reading local files, listing Lexiang spaces, generating a table, or replying with any scan result.
Run:
python3 scripts/connection_check.py --probe --json
Continue only when connected: true and the currently exposed Lexiang MCP whoami call succeeds.
If the connector is absent, disabled, disconnected, untrusted, expired, inaccessible, or whoami fails, stop immediately. Return only the following text, with no title, explanation, scan result, or follow-up sentence:
你需要做一步(约 10 秒)
在 WorkBuddy 左侧/连接器面板里:
1. 找到 乐享知识库(lexiang) 连接器;
2. 若显示 disconnected,点击 Trust / 启用(必要时先断开再重连);
3. 完成后回来告诉我“重试”即可。
The local config cannot prove WorkBuddy's live Trust state. Treat a successful config probe plus an in-client whoami as the connection requirement; otherwise use the fixed reply above.
2. Use a metadata-first strategy
Use similarity matching only to create the first local-to-Lexiang mapping. For later runs, use the state file as the source of truth:
- Scan all readable document files under the user's home directory by default, including Desktop, Documents, Downloads, and project folders. Exclude
Library, caches, hidden folders, application bundles, dependency folders, and system paths. Add an explicit--rootfor an external disk or another approved folder. - Compare local
size,mtime_ns, and the stabledevice:inodefile key first. Do not re-read unchanged files. - Recalculate SHA-256 only for files whose metadata changed.
- For
.md, also compare normalized front matter and body hashes. Treat a timestamp-only change as no content update. - Compare each mapped Lexiang entry's
updated_at, version, file ID, size, and optional checksum to detect changes made in Lexiang. - Build and persist one Lexiang tree snapshot per scan at
~/.codex/state/desktop-lexiang-sync/lexiang-tree.json. The snapshot contains the space, root entry, parent entry, full path, entry type,has_children,entry_id,file_id, size, updated time, version, URL, and optional checksum. On later scans, refresh the tree metadata in one traversal and use the previous snapshot to skip unchanged branches where the parent/branch marker is unchanged. - Keep the state at
~/.codex/state/desktop-lexiang-sync/state.json. It stores paths, file keys, hashes, entry IDs, and timestamps only; never store tokens or full document bodies.
This makes routine checks incremental and lets the skill distinguish a local update, a Lexiang-side update, and a two-sided conflict. Do not extract or ask the model to analyze unchanged files.
3. Create the first mapping
Create a local manifest. The script inventories common document types under ~, hashes each file on the first run, and retains a short summary for the review table. The summary is used only in the current comparison result, not as a replacement for the original document.
python3 scripts/desktop_inventory.py \
--root "$HOME" \
--output /tmp/lexiang-local-inventory.json
Use the Lexiang MCP to traverse every user-authorized space and recursively list file entries. Do this as a tree pass, not one search per local file:
- Call
whoami, then obtain each intended space and itsroot_entry_idwithspace_describe_personal_space,space_list_spaces, orspace_describe_spaceas appropriate. - For each root or folder, call
entry_list_childrenwith a sufficiently largelimit; if the response is full, continue withoffsetuntil that parent is exhausted. Record every child in the tree snapshot before descending. - Descend only into entries with
has_children=trueorentry_type=folder. Keep the parent path while traversing, so the resulting manifest already contains the complete Lexiang path and no per-fileentry_list_parentscalls are needed. - Use
entry_describe_entryonly when a child response lacks required metadata. Do not callentry_describe_ai_parse_contentduring tree construction. - Export the flattened file records to
/tmp/lexiang-file-manifest.jsonusing the schema in references/lexiang-manifest.md, and retain the tree snapshot separately. Include pages only when the user explicitly asks to compare pages as well as uploaded files.
Before claiming the scan covers "all Lexiang files", verify that every intended space was traversed. If a tool cannot enumerate a space, report it as excluded rather than silently substituting search results.
Run the matcher only for files that do not yet have a confirmed local file -> Lexiang entry_id link. Treat it as a candidate generator, not the final judge:
- Exact checksum or normalized content match may be marked as verified only when both records have
read_status=readable. - If either side has
read_status=unreadable, show内容不可读取,未进行正文比对plus the storedread_error; never claim the documents are the same or assign a content similarity. - Do not ask AI to calculate or display semantic similarity. Use deterministic checksum/content equality and metadata direction only to narrow candidates.
- Candidate matching never authorizes replacement; upload decisions remain user-controlled.
Run:
python3 scripts/match_manifests.py \
--desktop /tmp/lexiang-local-inventory.json \
--lexiang /tmp/lexiang-file-manifest.json \
--output /tmp/lexiang-update-candidates.json \
--threshold 0.50
The script's deterministic retrieval score is internal only and must not be shown in the HTML report. An identical SHA-256 or identical readable content can establish equality only when both sides are readable; filename/token overlap can only narrow candidates. Never add ai_similarity, confidence, or evidence fields to the report.
3.1 Generate the HTML report first
Always complete the connection check, local inventory, one-pass Lexiang tree traversal, metadata/hash comparison, content comparison, and AI review before generating the report. Then generate one rendered HTML report; do not generate Markdown or Word reports. Use /tmp/lexiang-sync-report.html for a one-off run or a timestamped .html path under $HOME/.codex/state/desktop-lexiang-sync/reports/ for retained reports. Return the HTML file only after verifying it was written.
Keep the report visually compact: use a clear title, short summary block, section headings, horizontal rules, concise cell text, and restrained status labels. Limit AI summaries to one or two concise sentences; do not put full document text or long evidence in cells.
Every document shown in the HTML report must use a real HTML link, not a bare path or literal Markdown syntax:
- Local documents, including Agent-generated documents: in HTML use
<a href="file:///Users/name/Documents/report%20(1).docx">打开文档</a>in a文档链接column, and keep the unencoded full absolute path in a separate文件地址column. Encode spaces, Chinese characters, parentheses,#,%, and other special characters in the target. - Lexiang documents: in HTML use
<a href="https://...">打开乐享文档</a>in a乐享链接column from the manifest's real HTTPSurlfield. Never construct a fake link from an internal ID. - Add a
复制路径button beside every local-file link as a fallback when the browser blocksfile://navigation. - If a real address is unavailable, write
暂无可跳转地址(仅有内部 ID); do not make the filename clickable. - The report itself must be saved and its absolute path returned to the user. Do not claim a report was generated if the file was not written successfully.
Produce one HTML report with a small scan summary and compact tables with sequential numbers. Do not output a long prose list. The HTML must contain real <table>, <thead>, <tbody>, and <a> elements; do not embed Markdown text in a <pre> block.
After AI summaries and recommendations are ready, write /tmp/lexiang-report-data.json with generated_at, scan_scope, local_updates, and unmatched, then always run the deterministic renderer. For every local_updates row, include read_status and read_error. Readable rows must also include lexiang_entry_id, local_read_complete, lexiang_read_complete, ai_review_complete, local_content_chars, and lexiang_content_chars; the renderer rejects a readable row unless all proof fields show a completed two-sided read and AI review. An unreadable row is allowed only as an explicit limitation row with its read error and no AI comparison claim:
python3 scripts/generate_report.py \
--input /tmp/lexiang-report-data.json \
--html /tmp/lexiang-sync-report.html
Do not hand-compose the final report. Before returning it, verify the HTML contains <table and <a and does not contain literal table-source text such as | 序号 | inside a <pre> block. Open the HTML report as the primary visual result.
严格表格格式(强制):两类业务结果必须使用真正的 HTML 表格展示。禁止生成 Markdown/Word 报告;禁止用项目符号、编号段落、长段落或自然语言清单替代两张明细表。两张表必须按顺序出现,并各自使用规定字段;有结果填数据,无结果也必须保留表头并在第一行写 无。表格 2 后允许增加规定的“未上传文档上传建议”短段落,但不得把它做成第三张表。表格一可使用 WorkBuddy 子 agent 提速,表格二不调用子 agent、不读正文、不做 AI 总结。聊天回复只允许给出 HTML 报告链接和一句状态,不得复制表格内容。
-
本地更新了、乐享未更新: show only mapped source files whose local metadata/content or Markdown front matter/body changed after the last confirmed upload while the mapped Lexiang entry did not change. This is the main update table and must include the document's simple overall content summary and what specifically changed:
| 序号 | 文件名 | 文档链接 | 文件地址 | 本地更新时间 | 乐享更新时间 | 本地更新内容 | 文档 AI 总结 | |---|---|---|---|---|---|---|---|---|
This is the only AI analysis table. Scripts may discover and classify candidates, but scripts must never write
本地更新内容or文档 AI 总结. For every readable row, runpython3 scripts/extract_local_document.py <local-path> --output /tmp/local-full.json, call Lexiang MCPentry_describe_ai_parse_contentwith the confirmedentry_id, and read both complete results before asking AI to compare them.本地更新内容must state what was added, changed, or removed in the body; timestamps, file counts, duplicate-copy counts, paths, and filenames are not document changes.文档 AI 总结must summarize the complete current local document, including purpose, scope, and conclusions. Do not infer either field from metadata or inventory excerpts. If a local PDF or Lexiang document cannot be parsed, retain the row with内容不可读取,无法总结and无法进行正文差异比对,已按不可读文件标注, including the parser error; do not emit a fake similarity or 100% match. If both sides changed, keep the conflict classification and do not automatically overwrite. -
本地有、乐享没有: show every source document with no confirmed Lexiang upload relationship and whose closest readable Lexiang candidate is not content-identical. If SHA-256 matches, or both readable excerpts are identical, treat it as already represented and omit it from this table even if no sync link exists. Never use a low filename score alone to hide a file. This section must be a real HTML table, never a prose list, using exactly these decision-oriented columns:
| 序号 | 文件名 | 文档链接 | 文件地址 | 文件类型 | 文件大小 | 最后更新时间 | |---|---|---|---|---|---|
This table must not call AI, read document bodies, calculate similarity, or generate summaries. It must keep its existing columns and behavior unchanged. Use only fast local metadata: filename, real local link, absolute path, extension/type, byte size, and last modified time. Do not dispatch a subagent for this table. The purpose is to let the user quickly decide which files deserve upload review. Keep every qualifying file in this table.
-
所有本机文档统一处理: Agent/WorkBuddy 生成的文档不单独分类、不排除、不降低优先级。它们与其他本机文档使用相同的更新判断,并进入前两张表;
document_class只能作为内部标记,不能改变报告结果。 -
未上传文件的上传建议: keep the second section as the complete file table, then add the prose block
未上传文档上传建议only when an explicitupload_recommendationsarray exists; never generate a recommendation for every unmatched file inside the renderer. First use the filename to select a small set of candidates that appear useful or ambiguous. For each selected candidate, decide whether to runscripts/extract_local_document.py: if it succeeds, consider the filename meaning together with the readable document content; if it is skipped or fails, make a filename-and-file-type judgment and explicitly say that the body was not read. Then write a short, natural recommendation in the model's own words with one clear reason, using建议上传,建议先确认, or暂不建议上传as the decision. Do not turn keyword matches into rigid template sentences, do not claim a business value that the filename or read content does not support, do not summarize every unmatched document, do not calculate similarity, and do not upload or delete automatically. If no filename-selected candidate deserves a recommendation, omit the prose block. -
更新时间接近、内容复核: compare hashes or readable content first. If hashes/content are the same, omit the row only when both sides are readable. If readable content differs and the local timestamp is newer than or equal to the Lexiang timestamp, classify it directly as 本地更新了、乐享未更新, even when timestamps differ by less than one day; the first table AI must read both complete documents and write the update summary. If the Lexiang timestamp is newer and local content did not change, omit it entirely. If both sides changed, show a conflict row with both timestamps. If either side is unreadable, use metadata direction only and visibly write
内容不可读取,未进行正文比对plus the parser error; never turn the filename into a 100% match.
Do not show unchanged files. Every table row must include a filename, address/path, and last-updated date. Ask the user to provide table numbers: 覆盖上传:1,3;仅上传:2,5;先不处理:4. Do not recommend deletion. “覆盖上传” means create/replace the target after verifying the upload; “仅上传” means create a new Lexiang entry and retain the old entry. Do not delete the old entry unless the user separately and explicitly requests deletion.
4. Run incremental monitoring
For repeat checks, create the state directory and preserve both the previous local manifest and the previous Lexiang tree snapshot before writing fresh ones. The inventory script reuses unchanged local metadata, hashes, and text excerpts. The Lexiang tree pass refreshes only branch metadata and returns all entries in one flattened manifest; the update analyzer then reads only changed mapped files and selected upload-recommendation candidates.
mkdir -p "$HOME/.codex/state/desktop-lexiang-sync"
cp "$HOME/.codex/state/desktop-lexiang-sync/local-latest.json" "$HOME/.codex/state/desktop-lexiang-sync/local-previous.json" 2>/dev/null || true
python3 scripts/desktop_inventory.py \
--root "$HOME" \
--prior-inventory "$HOME/.codex/state/desktop-lexiang-sync/local-latest.json" \
--output "$HOME/.codex/state/desktop-lexiang-sync/local-latest.json"
Build a fresh Lexiang tree snapshot and flattened manifest in the same traversal, then run:
python3 scripts/change_monitor.py \
--desktop "$HOME/.codex/state/desktop-lexiang-sync/local-latest.json" \
--lexiang /tmp/lexiang-file-manifest.json \
--state "$HOME/.codex/state/desktop-lexiang-sync/state.json" \
--output /tmp/lexiang-change-reminders.json \
--write-observation
If reminders contain local changes, extract only the current versions of those documents:
python3 scripts/analyze_updates.py \
--current "$HOME/.codex/state/desktop-lexiang-sync/local-latest.json" \
--reminders /tmp/lexiang-change-reminders.json \
--output /tmp/lexiang-update-analysis.json
For each returned update in 表格一, run the AI review in WorkBuddy 子 agent 模式(优先) when that mode is available. The main agent remains the coordinator and final reviewer; it may dispatch one read-only subagent per document pair, or a small bounded batch when the client only supports batched delegation. Do not dispatch more than three document pairs per subagent task. Pass only the local absolute path, confirmed Lexiang entry_id, current version markers, and the output schema. Never pass tokens, connector credentials, unrelated documents, or write authority. This optimization applies only to 表格一; 表格二 stays metadata-only and is generated directly from the manifest.
Each subagent must:
- Run
python3 scripts/extract_local_document.py <local-path> --output /tmp/local-full.jsonand verifyread_complete=true. - Call Lexiang
entry_describe_ai_parse_content(entry_id)and read the complete parsed content in ordered chunks until the end; do not use the inventory excerpt as the final input. - Return strict JSON with
update_summary,ai_summary,local_read_complete,lexiang_read_complete,ai_review_complete,local_content_chars,lexiang_content_chars,lexiang_entry_id, andsummary_source. - Keep
update_summarylimited to body additions, edits, and removals. Keepai_summarylimited to the current local document's purpose, scope, and conclusions. Never calculate or report similarity, and never use timestamps, filenames, paths, or file counts as document changes. - If either side cannot be read, return
read_status=unreadable,read_error, andai_review_complete=false; do not infer a diff and do not write to Lexiang.
The main agent must validate every subagent result: confirm the entry ID, both complete-read flags, positive character counts, and that the summaries contain content evidence rather than metadata. Only validated rows may enter the first HTML table. If WorkBuddy subagents are unavailable, the main agent performs the same protocol serially; the output contract does not change. Do not run this AI step for unmatched files or for 表格二.
The safe speedups are limited to 表格一: dispatch different document pairs concurrently; within each subagent, start the local parser and the Lexiang content retrieval as independent read-only tasks, then join them before comparison; read paginated Lexiang chunks concurrently only when the API provides stable chunk indexes, and reassemble them in index order. Keep the manifest/tree traversal, timestamp classification, table-two rendering, and final validation in the main agent. Never parallelize writes, uploads, replacements, or deletion decisions.
Full-content retrieval is mandatory only for the first table and selected upload-recommendation candidates:
- Lexiang: use the MCP document-content/parsed-content operation only for a confirmed changed entry or a selected upload-recommendation candidate. Retrieve the full body in ordered chunks when pagination is required, and preserve headings, tables, slides, or worksheet boundaries. Never read every Lexiang document body during the tree pass.
- Local: choose the parser by file type and pull the complete body progressively in ordered chunks. Use Office XML for DOCX/PPTX/XLSX, direct text reads for Markdown/TXT/CSV/HTML, PDF text extraction with OCR fallback when needed, and the system text converter for legacy formats. Do not pass only the inventory excerpt to AI.
- Use
scripts/extract_local_document.pyfor the local side. Its JSONcontentis the AI input;desktop_inventory.pyexcerpts are candidate-retrieval data only. - A 1600-character inventory excerpt is for matching only, never for the final summary. Preserve paragraph, heading, slide, page, table, and worksheet boundaries while reading the full local document.
- Mark the read complete only after the end of the local document and the end of the Lexiang parsed content have both been reached. If either side fails, report the limitation instead of inventing a before/after change.
Report only the following actionable reminders:
local_update_pending: a mapped Desktop file changed after its last successful upload.markdown_data_changed: a mapped Markdown file's front matter or body changed.conflict: both sides changed after the last recorded sync.new_unlinkedorunlinked_content_changed: a new or changed local document has no confirmed Lexiang mapping; send it through the first-mapping flow and show it in 乐享未收录.
The generated HTML report must contain these two user-facing table sections in this order: 本地更新了、乐享未更新 and 本地有、乐享没有, followed by the prose block 未上传文档上传建议. It must not contain a section for Lexiang-only updates, Agent-only outputs, or similarity. The two result sections must be HTML tables and use the exact columns specified above. Keep the total local document count in a compact visual dashboard above the sections. Use restrained visual hierarchy: a dark title band, teal local-update status, amber unmatched status, light table headers, fixed key column widths, and automatic wrapping for long paths. If there are no rows, still generate the report, retain all required table headers, and put 无 in the first data row.
For a conflict, never overwrite either side. Present both timestamps and ask which version should become the next upload. For a one-sided local change, remind the user and offer the upload choices below. No reminder may cause an automatic upload. If no local or remote metadata/content changed, reply with a short “未发现更新” and do not generate tables of unchanged files.
5. Ask before any write
After reporting the candidates, ask exactly which operation the user wants:
- Upload and replace: upload each selected Desktop file as the new version, verify it is readable, and retain the original similar file unless the user separately and explicitly requests deletion.
- Upload only: upload each selected Desktop file as a new Lexiang entry and retain all existing Lexiang files.
- Review first: show the candidate list or selected file details; make no changes.
Do not perform a batch replacement merely because a file crossed 50%. If the user picks option 1, require an explicit per-row selection for any ambiguous pair or any score below 90%. Never delete the old entry until the new upload is committed and its entry ID is returned.
For uploads, follow the Lexiang MCP upload sequence: obtain an upload session, PUT the bytes to its pre-signed URL, commit the upload, and verify the created entry. For deletion, use the original Lexiang entry ID shown in the approved review table. After each successful upload, refresh the Lexiang manifest and run:
python3 scripts/register_sync.py \
--state "$HOME/.codex/state/desktop-lexiang-sync/state.json" \
--desktop "$HOME/.codex/state/desktop-lexiang-sync/local-latest.json" \
--lexiang /tmp/lexiang-file-manifest.json \
--local-relative-path "folder/example.md" \
--remote-entry-id "new-lexiang-entry-id"
This records the hash and remote marker as the new baseline. Keep no tokens or full document contents in the state file.
Resources
scripts/connection_check.py: checks WorkBuddy configuration and performs a non-destructive MCPwhoamiprobe.scripts/desktop_inventory.py: inventories all readable local documents, skips non-document/system paths, reuses unchanged metadata, fingerprints Markdown data, and produces review summaries.scripts/match_manifests.py: scores Desktop-to-Lexiang candidate pairs without changing either side.scripts/change_monitor.py: turns local and Lexiang manifest differences into user reminders without changing either side.scripts/analyze_updates.py: analyzes only documents already flagged as changed and prepares update statistics for one AI summary pass.scripts/extract_local_document.py: extracts the complete readable local body for the mandatory first-table AI comparison.scripts/generate_report.py: deterministically renders the final JSON data into a real HTML report with tables, links, and copy-path fallbacks.scripts/register_sync.py: records an approved, successful upload as the next comparison baseline.- references/lexiang-manifest.md: required manifest fields and exhaustive traversal rules.
Current listing version
1.0.1
Safety and assessment details
Quality assessment
Out of 100 · Assessment report from SkillPi LAB.
Highlights
- 解决企业用户本地文档与乐享知识库同步的核心痛点
- 支持增量检测、冲突识别、安全上传等完整闭环
- 适用于高频文档协作场景,实用价值高
Highlights
- 触发场景描述清晰完整(查找缺失、检测更新、安全同步)
- 边界明确,不易误触或漏触
Areas to improve
-
description 重复 Reported severity: Minor
顶层 frontmatter 和 skill_body 内部均包含相同 description 内容
Recommendation: 建议移除 skill_body 内部的重复 description 以保持简洁
Highlights
- Phase 划分清晰,步骤完整,含端到端示例
- frontmatter 完整,文档结构规范
Areas to improve
-
引用文件缺失 Reported severity: Minor
SKILL.md 引用了 references/lexiang-manifest.md 但未在 ZIP 包中提供
Recommendation: 建议补充该引用文件或确认其可通过其他方式获取
Highlights
- 工具链完整,参数正确,异常处理充分
- 不可逆操作有严格用户确认机制,安全可靠
The arithmetic mean of the first four original scores, rounded to a whole number.
Static text checks
100 / 100 · skillpi-20261123-no-r3-v1
No current rules matched the text.
This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.
Permissions and checks before use
Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.
-
Accounts, secrets or authorization
Use a dedicated least-privilege account. Keep secrets out of public content and command logs; verify the receiving service and tenant.
Mentioned in main document · lines 172
Domains or addresses referenced in the document
These addresses may be documentation links or examples, not an approved network allowlist. Verify actual destinations and outgoing data before use.
- ...
Security rating and access scope
safe · Static evidence review; not a runtime safety guarantee.
Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.
User discussion
No verified reviews yet.