Feishu Doc Workflow
Overview
Use the local lark-cli for Feishu/Lark document work. This skill is a document workflow, not just a CLI wrapper: preserve hierarchy, content structure, image dimensions, and post-write verification. Prefer CLI reads and writes over browser automation for Feishu links because this machine already has CLI auth configured.
Quick Start
Use the installed command:
~/.local/bin/lark-cli --help
Read a document or wiki URL:
~/.local/bin/lark-cli docs +fetch \
--api-version v2 \
--doc '<feishu-or-lark-url-or-token>' \
--as user \
--format json
Edit a document:
~/.local/bin/lark-cli docs +update \
--api-version v2 \
--doc '<feishu-or-lark-url-or-token>' \
--as user \
--mode append \
--markdown '@file.md'
Workflow
- Fetch first. Capture the returned
document_id,revision_id, title, and relevant content before writing. - Choose the smallest safe write mode:
appendfor adding new sections.insert_beforeorinsert_afterwith--selection-by-titleor--selection-with-ellipsisfor targeted insertion.replace_rangefor a known span.replace_alloroverwriteonly when the user explicitly wants a full rewrite.- Never use
docs_ai/docs +update --command overwritefor metadata-only edits on an existing page that contains images, grids, tables, whiteboards, formulas, or other rich blocks. Even if the fetched XML keeps<img>tags, Feishu may recreate or reflow the native image blocks and visibly move the user's images. For paper-card metadata changes, use block-level text updates, exact visible-textstr_replace, or ask the user to restore the page version before retrying. - For existing content, prefer modification over rewriting: use Docx block API text updates, exact text replacement, or targeted block insertion/deletion. Do not rebuild an entire card, section, grid, or page just to change wording, metadata, captions, formulas, or other local content.
- Preserve existing images, tables, grids, and rich content unless the user explicitly asks to restructure them.
- Treat the user's current visual arrangement as intentional. If images are in the same row, grid, callout, or adjacent image group, preserve their order, parent block, column/grid ratios, relative widths,
scale,align, captions, and spacing. Do not normalize two side-by-side images to the same width, move them into separate rows, or rebuild their container unless the user explicitly asks for a layout change.
- Treat the user's current visual arrangement as intentional. If images are in the same row, grid, callout, or adjacent image group, preserve their order, parent block, column/grid ratios, relative widths,
- For images, do not create or rewrite them by embedding raw XML
<img>tags in document content. Usedocs +media-insertwith local image files and a text selection so Feishu creates native image blocks that keep the source image aspect ratio. - When any write may touch existing image blocks, fetch with
--detail fullbefore editing and preserve every image's nativewidth,height,scale,src, caption, alignment, parent/container relationship, sibling order, and any grid column-width ratios. Treatwidthandheightas the original-resolution pixel dimensions / aspect-ratio contract, and treatscale/ grid ratios as the user's visible layout contract, not decorative metadata. Never let an image fall back to Feishu's default512 × 512square sizing, and never square-crop, force square dimensions, equalize side-by-side image widths, or reflow a multi-image row unless the user explicitly asks. - If a fetched image block lacks trustworthy
width/height, download the image from its authenticatedhrefor file token, inspect the actual pixel dimensions, and write those dimensions back into the image block before overwriting the page. After writing, fetch again with--detail fulland verify that every touched image'swidth/heightstill matches the preserved or inspected dimensions. - If an accidental XML overwrite has already recreated images as
512 × 512blocks, do not repair by another whole-page overwrite. Use the Docx block API and an older readabledocument_revision_idinstead:- Read old and current blocks from
/open-apis/docx/v1/documents/<docx_token>/blocks?document_revision_id=<rev>. - For each image, download the old image token to a task-local temp directory, upload it to the current image block with
docs +media-upload --parent-type docx_image --parent-node <current_image_block_id>, thenPATCH /blocks/<current_image_block_id>withreplace_image.token, originalwidth,height,scale,alignwhen present, and caption. - For grids, patch the current grid block, not individual grid columns:
update_grid_column_width_ratio: {"width_ratios":[...]}using ratios read from the old grid's child columns. - Verify image count, no unintended
512 × 512images, original width/height/scale/caption, grid ratio parity, and paper-card metadata count. Feishu may normalize missing imagealigntoalign=2; do not chase that field if all visible geometry metadata is restored.
- Read old and current blocks from
- Use
--dry-runbefore risky writes or when the selection may be ambiguous. - Fetch again after writing to verify the update.
- After
docs +update --command overwrite, the doc/Wiki node title may stayUntitledunless you set it. Prefer--new-title 'Page Name'on the same update when the CLI accepts it; otherwise rename via Drive API:
lark-cli api PATCH "/open-apis/drive/v1/files/<docx_token>" \
--as user --params '{"type":"docx"}' \
--data '{"new_title":"Google Dreamer"}'
Use the doc token from docs +fetch or wiki spaces get_node (obj_token). Confirm with wiki spaces get_node --params '{"token":"<wiki_node_token>"}'.
Do not trust --new-title alone after an overwrite. Always fetch the doc and the wiki node after large writes and verify both:
lark-cli docs +fetch --api-version v2 --doc '<docx_token>' --as user --format json
lark-cli wiki spaces get_node --as user --params '{"token":"<wiki_node_token>"}'
If either title is Untitled, immediately run the Drive PATCH above with the obj_token/docx token and verify again. For origin wiki nodes, updating the Drive docx title normally updates the wiki node title as well.
Manually Imported pdf2zh-next Translation
When a translated PDF was manually imported into Feishu, classify the page as a draft conversion and apply the repair gate in paper-deep-dive before calling it a complete deep dive. Rename the page to the verified Chinese paper title, add the required PDF / Project / Code / child-page links, restore heading hierarchy and paragraph breaks, preserve inline and display formulas as native Feishu equations or exact LaTeX, convert figure captions to native image captions, and repair tables against the source PDF/HTML. Derive heading depth at every level from the numeric prefix (N → top level, N.M → subsection, N.M.K → sub-subsection, continuing by component count) rather than imported visual styling. Convert full-width heading punctuation . to ASCII . before parsing, so 4.2.方法 becomes 4.2. 方法. In ordinary structural text, convert / to /, - to -, and citation/list brackets [] to []; protect formulas, code, URLs, paths, and backslash-escaped sequences before cleanup and restore them exactly. Preserve unrelated Chinese punctuation in prose. Use one punctuation convention throughout, defaulting to N. 标题 / N.M. 小标题 unless the source consistently uses N 标题 / N.M 小标题. In the Chinese manuscript, the cited paper title may be translated, but authors, venue, year, pages, identifiers, URLs, and other reference metadata remain in the source language. Re-fetch after editing and verify title, links, hierarchy, formulas, captions, tables, References, and body citation URLs.
Workspace Hygiene
- Do not create Feishu-editing scratch files in the vault root. This includes fetched JSON, intermediate Markdown/XML, link-check scripts, generated paper-card scripts, screenshots, and one-off validation outputs.
- Put all temporary files for a Feishu task under a hidden working directory such as
.tools/tmp/codex/<task-slug>/or the system temp directory, and remove them after the Feishu page has been verified. - For literature or paper-card work, do not keep local copies of source PDFs, arXiv HTML pages, downloaded project pages, extracted PDF text, OCR/MinerU outputs, or temporary figure assets. Prefer reading official HTML/full-paper pages directly. If a PDF/HTML/source asset must be downloaded for extraction or verification, store it only under a task-local temporary directory, use it to write the Feishu content, fetch the Feishu page to verify the durable copy, then delete the downloaded source and extracted intermediates before finishing.
- If an artifact should be kept for audit or reuse, store it under an explicit non-root location such as
.tools/outputs/<task-slug>/and mention it to the user. Do not leave opaque files likesovd_current.md,*_after.json, or ad-hoc Python scripts in the root ofWorldModelVault. - Before finishing a Feishu editing task, check for task-local scratch files and clean them up unless the user asked to keep them.
Paper Card Images
When syncing paper cards to Feishu, use only reliable paper figures as card images:
- Prefer the paper's core method/process figure with matching captions: method, pipeline, framework, system overview, architecture, data flow, benchmark construction, score/loss/computation flow, or other figures that explain how the work operates.
- Do not use a teaser, qualitative showcase, result collage, demo gallery, or visual example grid as the only paper-card image when a core method/process figure exists in the official paper HTML/PDF or project page. A teaser may be kept only as a second supplementary image when it adds distinct context, and its caption must label it as
teaser/结果展示rather than presenting it as the method figure. - When auditing or repairing existing paper cards, if the only image is a teaser/result showcase and a core method/process figure is available, insert or replace with the core figure first. Preserve the teaser only when the card can support a second image without clutter and it adds information the core figure does not.
- If no core method/process figure exists after checking the official paper HTML/PDF/project page, state that explicitly in the caption or note and use the most structurally informative fallback figure; do not silently present a teaser as the method image.
- Reject paper first pages, title pages, abstract pages, arXiv page screenshots, and generic PDF page renders as card images.
- Do not fall back to the largest raster image when no credible figure is found.
- When the user provides a paper figure image or screenshot, especially a manually captured image with the original caption visible, treat the visible caption as source text for the Feishu image caption. Translate the complete original caption into Chinese, preserve the figure number, subfigure labels, symbols, method names, dataset names, and important English technical terms when needed, and write it into the native image caption / description, e.g.
图 2|完整中文图注:.... - Official HTML is also a valid caption source. For arXiv HTML, publisher / conference HTML, and official project pages, search the page's
figure/figcaption, nearby figure labels, image alt text, and visible figure descriptions before using the PDF. Translate the verified original figure caption fully into Chinese for the Feishu native image caption. Do not shorten it to a title such as图|GS-IR overview,图|pipeline,图|teaser, or a self-written summary. Do not use unrelated page prose as a figure caption unless it is clearly tied to that exact figure. - A finished paper-card image caption must be the complete Chinese translation of the source figure caption. It is incomplete if it only contains a figure title, method name, local filename, English overview phrase, or a brief label without the caption content. If Feishu native caption length becomes a real limitation, keep the native caption as
图 N|完整图注见下方and place the full Chinese translated caption in the immediately following paragraph. - Do not invent caption content that is not visible in the provided image or verified from the official paper / project page. If the screenshot has no readable caption and no official caption has been checked, write
图注待补:需要从论文或项目页核验并完整翻译原始 caption。. - Reuse user-captured or previously verified paper-card figures for the same paper before extracting or cropping a new one. Match by stable paper identity such as English title, arXiv ID / DOI, method name, and figure number or caption; do not rely on local filenames alone.
- When the same paper card is used on multiple Feishu pages, preserve the already approved image and Chinese caption unless a page-specific reason requires a different figure. If copying from an existing Feishu card, fetch with full detail when needed and preserve the native image block / caption rather than rebuilding the figure from the paper.
- If a user-provided screenshot should be reused across pages, keep a reusable copy under an explicit non-root library such as
.tools/outputs/paper-card-figures/<paper-id-or-normalized-title>/. These retained user-captured figure assets are not disposable extraction intermediates, but OCR text files, processing outputs, and task-local duplicates must still be deleted after Feishu verification. - For new images inserted with
docs +media-insert, pass--caption '<Chinese caption>'; this writes the native Feishu image caption, not just a normal paragraph. - Insert or preserve paper-card figures using the image's original pixel width and height. If the figure is copied from an existing Feishu page, carry over the full-detail image metadata; if it is inserted from a local/user-provided file, inspect the local file dimensions before upload and verify the resulting Feishu block keeps the same aspect ratio. Do not allow automatic square placeholders such as
512 × 512to become the final card image size. - If an existing paper card has multiple images in one visual row, grid, or adjacent group, preserve that relationship exactly. Do not rebuild the group, equalize image widths, alter grid ratios, or split/merge rows while normalizing text, metadata, captions, or bullet content. A same-row two-image layout is user-authored layout state, not disposable formatting.
- For existing image blocks, prefer an in-place Docx API update instead of re-uploading or reinserting the image: call
PATCH /open-apis/docx/v1/documents/<docx_token>/blocks/batch_updatewithreplace_image.tokenset to the existing imagesrc/ file token andreplace_image.caption.contentset to the Chinese caption. Fetch with--detail fullfirst to get the image block id, token, width, height, scale, and current caption; include the existingscaleinreplace_imageso adding a caption does not resize the image. - Only if the native caption / description API is unavailable or fails, insert a normal Chinese caption paragraph immediately below the image and keep it visually tied to that image; mention this fallback to the user.
- If OCR or visual extraction is used to read a screenshot caption, delete OCR text files, image-processing intermediates, and temporary figure assets after the Feishu write has been fetched back and verified.
- In a Feishu paper card, place the native image block after the metadata paragraph link line (
PDF|Project|Code) andDataset, before the seven fixed bullet slots defined bypaper-card-delivery. Do not leave the image directly under the####title. - If no reliable core method/process figure is available, write
配图待补:需要从论文 HTML/PDF 或项目页补充可信方法流程图;teaser / 结果展示图不能单独作为主图。instead of inserting a questionable image, and treat the card as incomplete rather than a finished formal delivery unless the user explicitly accepts the missing figure. - Do not leave Obsidian migration residue such as
图像: EW_IMG_...png,Image: assets/..., local file names, or local vault paths in the reader-facing Feishu page. After inserting the actual figure as a native Feishu image block, keep only the Chinese figure caption or explanation that helps the reader; remove local filename labels. - Before syncing a paper-card source file, run a text check for
first page,first-page,title page, andpaper page; after syncing, fetch the Feishu page and verify those strings are absent unless they are part of normal prose. - After syncing a paper-card page, fetch it and verify that visible body text contains no
图像:,EW_IMG,assets/,|[Project](...)|[Code](...), with missing items written asw/o. project page,w/o. verified code, etc. Keep the link row near the title / metadata block and avoid separate long URL paragraphs unless the user explicitly asks for a source audit. - Before writing the notes, read/parse the paper and search for current context when needed: arXiv/OpenReview/conference page, project page, GitHub, author page, follow-up papers, critiques, benchmarks, and directly related concurrent work.
- Prefer MinerU for PDF-to-Markdown parsing. On this machine, use
$WORLD_MODEL_VAULT/.tools/mineru-md.shfirst, backed by$WORLD_MODEL_VAULT_MINERU_BIN(mineru 3.3.1verified). Use Docling / Marker / PyMuPDF / pdfplumber only if MinerU fails or there is no PDF. - Treat MinerU output as a conversion draft, not the final authority. For arXiv papers, check the MinerU draft against arXiv HTML whenever available before publishing Feishu pages. Verify section order, paragraph continuity, formulas, figures, captions, tables, appendices, citations, and references. If arXiv HTML is unavailable or incomplete, use official LaTeX source, publisher HTML, or the official PDF as the authority.
- References must be repaired before publishing. Do not leave bibliography entries as fragmented paragraphs or bullets; use a numbered bibliography, keep one reference per numbered item, and preserve body citation markers so the manuscript reads like the original paper.
- Do not upload or store a PDF when a stable arXiv PDF exists, unless the user explicitly requests a PDF copy or the source is unstable/non-arXiv.
- After the Feishu deep dive is done, distilled knowledge may be summarized into Feishu knowledge pages. Only content still judged long-term important after distillation should be added back to Obsidian.
- Verify final Feishu hierarchy: the parent notes page has exactly the intended child pages for
英文原文稿,原文译稿/完整中文稿, and中文精读稿, and the parent page links to them.
Formula / Equation Handling
For paper deep dives and complete manuscript pages, formulas are source-fidelity content, not prose to paraphrase.
- Extract formulas from the official full-paper source before writing. For arXiv papers, prefer arXiv HTML / LaTeX source because it usually preserves MathML, TeX annotations, equation IDs, and numbering; use the PDF or a structured PDF parser only as fallback. Do not reconstruct formulas from collapsed Feishu plain text or OCR text when the official formula source is available.
- Preserve mathematical structure in LaTeX: subscripts, superscripts, hats, dots, norms, fractions, sums, products, matrices, Greek symbols, calligraphic symbols, equation numbers, and variable names. Translate surrounding prose, but do not translate variable identifiers or LaTeX commands.
- Preserve inline formulas as source-fidelity content, not just displayed equations. Inline variables, operators, compact expressions, loss names, author references to equations, and symbolic phrases such as
$S$,$G$,$l(S)$,$\bm{x}^{n}$, or$\mathcal{L}_{\text{RGB}}$must remain inline LaTeX. Do not flatten them into ordinary text, translate them into Chinese words, wrap them in backticks, or rebuild them from Feishu/OCR plain text. - During translation, protect all inline and displayed formulas with non-translatable placeholders, translate only the surrounding prose, then restore the exact TeX from the official source. If using arXiv HTML, prefer each
math.ltx_Math/ MathMLalttextor TeX annotation for inline formula source; verify the restored count and representative samples after translation. - In Markdown sources for Feishu import, use
$...$for inline variables and$$...$$for display equations. Keep display equations on their own lines with blank lines before and after. Do not wrap formulas in backticks or code fences unless explicitly creating a raw-LaTeX fallback section. - In Feishu XML, display equations must be centered by default: wrap standalone equation blocks as
<p align="center"><latex>...</latex></p>. Keep inline formulas inside normal prose paragraphs; do not center inline variables or compact symbolic phrases that are part of a sentence. - In
中文精读稿/ close-reading pages, use inline math$...$for symbols, variables, operators, and compact symbolic expressions such as$S$,$G$,$l(S)$, or$l(S)-l(G)$. Do not use inline code backticks for paper notation. Use plain prose for English technical terms unless they are part of a mathematical expression. - Preserve equation numbering with
\tag{n}inside display math. Do not emulate equation numbers with\qquad(n)or plain text unless the user explicitly requests a fallback after confirming Feishu cannot render\tag. Keep references such as式 (4)aligned with the original paper. - Keep formulas near their original paragraph and section. Do not move all formulas into an appendix unless the source page is only a summary rather than a full manuscript page.
- After writing, fetch the Feishu page and verify formula fidelity. Check both inline and displayed formulas: count
<latex>/$...$blocks when possible, inspect samples across early, middle, appendix, formula-heavy sections, and numbered equations, and confirm formulas did not degrade into ordinary text such asL_render = lambda ||..., lose_/^structure, merge with surrounding prose, or become translated words. - If Feishu Markdown cannot render a formula reliably, use an explicit fallback: keep the exact LaTeX source in a labeled
公式 LaTeX 源paragraph or block and, for important equations, insert a rendered equation image with a Chinese caption. Mark this as a rendering fallback, not as the preferred final form. - Before finishing, report any formulas that remain fallback-only or unverified. Do not claim a deep dive is complete when important equations are visibly flattened, malformed, or missing.
Research Map Trees
When organizing a Feishu survey / research-map page, use a parent-page plus subpage structure by default:
- Use
survey-builderas the canonical source for literature-tree, challenge-insight, mechanism-comparison, and research-entry-point semantics. This Feishu section only controls native mind-map rendering, hierarchy, image/block preservation, and read-back verification; do not weaken or duplicate the survey's mechanism-evidence audit here. - Treat the user's Feishu page
如何构建literature tree(如何进行literature review,构建novelty tree和challenge-insight tree)as the canonical method/example for literature organization and novelty discovery:<FEISHU_OR_LARK_URL>(doc token<DOC_TOKEN>). When building or revising literature trees, novelty trees, challenge-insight trees, or research-map pages, read/reference this page first unless the user gives a more specific template. - Use its novelty taxonomy when organizing papers:
- Type 1 novelty: seminal work for a milestone task.
- Type 2 novelty: seminal work for a novel pipeline or representation.
- Type 3 novelty: seminal work for a novel module.
- Type 4 novelty: module-level improvement to an existing pipeline.
- Build
Literature Treenodes in this order: collect papers in the same direction, identify milestone tasks and their first/seminal papers, group papers by milestone task, identify representative pipelines/representations and their first/seminal papers, subdivide by module-level novelty, then add or revise milestone tasks as field understanding improves. - Build
Challenge-Insight Treenodes from the semantics defined bysurvey-builder: challenge/failure mode, competing explanation, proposed insight/mechanism, representative papers, decisive evidence, unresolved alternative, and remaining gap. Keep only literature-supported depth and do not inflate every branch with empty labels. - The parent page is a concise survey hub. It should contain summary-level content only: research question, scope, key takeaways, recommended route, links to subpages, and a short status / TODO list.
- Create a dedicated subpage for editable survey trees. This page should include the literature tree, challenge-insight tree, and any method / task / benchmark trees needed for navigation.
- Create one dedicated
Paper Cardssubpage for the survey. This page is a browsable collection that contains many paper cards in sequence. Do not create one child page per paper unless the user explicitly asks for per-paper pages. - Create a dedicated subpage for the full survey report. This is usually the long report copied from ChatGPT Deep Research or another long-form source. Preserve it as the source report page, then distill only the summary into the parent page.
- The parent page should link to all three subpages and make their roles obvious:
Tree Maps,Paper Cards, andFull Survey Reportor equivalent Chinese titles. - If the user provides an existing long report page, treat that page as the
Full Survey Reportchild page when possible; do not leave the parent page as an overlong pasted report. - Do not create placeholder survey artifacts. Before writing the parent summary, tree maps, or paper-card page, fetch and read the full survey report, identify the actual task/method/benchmark/research-gap structure, and write content from that understanding.
- The
Paper Cardssubpage must contain real, report-grounded cards for the important papers mentioned in the survey, usually grouped by theme, method family, or reading priority. Avoid待补placeholders except for genuinely missing external links or figures after a best-effort check; in those cases, state what is missing specifically. - Paper-card content and verification are governed by
paper-card-delivery. Thisfeishu-doc-workflowskill must not redefine the paper-card source order, metadata schema, bullet slots, image-selection contract, sorting rules, or validators. - Before creating, normalizing, auditing, or syncing any paper card, read and follow
paper-card-deliverycompletely. In case of conflict,paper-card-deliverywins for content and card structure; this skill only adds Feishu hierarchy, native-image insertion/preservation, and post-write verification requirements. - Use the canonical
paper-card-deliveryformat: exact official English title, compact metadata paragraph, direct PDF link,Dataset:,
…(truncated)