lark-worklog

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Lark Worklog

Lark 工作日志

Maintain a structured Lark spreadsheet as the source of truth for the user's work. Record todos and progress, preserve task context in linked documents, and keep the log current across days and months.
维护一个结构化的Lark电子表格作为用户工作的真实数据源,记录待办事项与进度,将任务上下文保存在关联文档中,并跨天、跨月保持日志的时效性。

Required official Lark skills

所需官方Lark技能

Require all four official skills:
  • lark-shared
    — authentication, identity, scopes, credential persistence, and error handling.
  • lark-drive
    — title-based cloud search and resource discovery.
  • lark-sheets
    — workbook validation, sheet structure, cells, rich text, styles, and batch operations.
  • lark-doc
    — task-document creation, fetch, and surgical updates.
Before any Lark read or write, confirm that
lark-cli
and all four skills are available in the current agent runtime. Load
lark-shared
first, then load
lark-drive
,
lark-sheets
, or
lark-doc
before using that domain.
If the binary or any required skill is unavailable, stop the work-log operation. Tell the user that
lark-worklog
depends on the official LarkSuite CLI skill set and direct them to the official installation guide. Recommend exactly:
bash
npx @larksuite/cli@latest install
Then explicitly offer to follow the official guide and perform the installation and verification for the user. Ask whether they want you to do that now, and do not run the installer until they agree. After installation, ask the user to reload the agent so the official skills become discoverable. Once the dependencies exist, use their documented operations and follow
lark-shared
for configuration and authorization.
需要以下四项官方技能:
  • lark-shared
    — 身份验证、身份识别、权限范围、凭证持久化及错误处理。
  • lark-drive
    — 基于标题的云端搜索与资源发现。
  • lark-sheets
    — 工作簿验证、表格结构、单元格、富文本、样式及批量操作。
  • lark-doc
    — 任务文档的创建、获取与精准更新。
在执行任何Lark读写操作前,确认当前Agent运行环境中已安装
lark-cli
及上述四项技能。先加载
lark-shared
,再在使用对应领域功能前加载
lark-drive
lark-sheets
lark-doc
若二进制文件或任何所需技能不可用,立即终止工作日志操作。告知用户
lark-worklog
依赖官方LarkSuite CLI技能集,并引导他们查看官方安装指南。推荐执行以下命令:
bash
npx @larksuite/cli@latest install
随后明确提出可协助用户遵循官方指南完成安装与验证,询问用户是否需要立即执行此操作,且需在用户同意后再运行安装程序。安装完成后,要求用户重新加载Agent,使官方技能可被识别。依赖项就绪后,使用其文档化操作,并遵循
lark-shared
进行配置与授权。

Start or resume a work-log conversation

启动或恢复工作日志会话

  1. On the first work-log request in a conversation, check the required dependencies above. Reuse that dependency check while the runtime remains unchanged.
  2. Reuse the selected workbook from the current conversation when one has already been found. Keep its title, URL or token, and the selecting user identity only in conversation context. Do not call Drive search again in that conversation unless the user explicitly asks to rediscover or switch targets. If the reused target becomes inaccessible or invalid, stop and report it instead of silently searching for another workbook.
  3. Only when the conversation has no selected target, load
    lark-drive
    and search as the authenticated user for spreadsheet titles containing the literal, case-sensitive marker
    [worklog]
    :
    bash
    lark-cli drive +search --query '[worklog]' --only-title \
      --doc-types sheet --created-by-me --page-size 20 --as user --format json
  4. Treat
    --created-by-me
    as original-creator semantics: only spreadsheets created by the current logged-in user qualify, even if ownership later changed. Keep only results whose returned title actually contains the literal, case-sensitive substring
    [worklog]
    ; search matching is broader than this final check. Preserve API result order. If necessary, follow
    page_token
    until a second exact match is found or results are exhausted.
  5. If no exact match exists, ask for authorization to create
    工作日志 [worklog]
    as the current user. If the user explicitly requests another spreadsheet, validate its creator, title marker, and structure before selecting it for the current conversation. A supplied link is never persisted locally.
  6. If exactly one match exists, select it for the rest of the conversation.
  7. If multiple matches exist, select the first exact match in API result order for the rest of the conversation, but tell the user which title and URL were selected and warn: stable behavior requires exactly one spreadsheet whose title contains
    [worklog]
    . Never silently switch to a later result because the first is malformed or inaccessible.
  8. Load
    lark-sheets
    , resolve the selected result, and inspect its structure. If it differs from the reference format, assess whether the task and required cells can still be mapped unambiguously. Continue with a compatible interpretation when no destructive reshaping is needed. If the meaning is ambiguous or the requested operation requires conversion, describe the mismatch and ask whether to convert the workbook or create a compliant one. Never reshape it without explicit authorization.
  9. Compute the current work-log date from the Agent process's local clock:
    bash
    node <skill-directory>/scripts/worklog-rules.cjs date
  10. Read references/worklog-format.md. Run monthly and daily preflight when the conversation has not prepared this workbook for today's local date, when the date or month changed, or after a structural failure. Otherwise use the same-day fast path and read only the cells needed for the request.
  11. When preflight detects that a month or date rollover is required, immediately tell the user that the structural rollover and verification can make this request a little slower than an ordinary update, reassure them that work is continuing, and then proceed without asking for redundant permission.
  12. Re-read the current sheet after preflight. Treat live workbook metadata and cells as the source of truth; never reuse row or column coordinates after a structural change.
  1. 会话中首次收到工作日志请求时,检查上述所需依赖项。若运行环境未发生变化,可复用该依赖项检查结果。
  2. 若当前会话已找到选定的工作簿,复用该工作簿。仅在会话上下文中保留其标题、URL或令牌,以及选择该工作簿的用户身份。除非用户明确要求重新查找或切换目标,否则在该会话中不再调用Drive搜索。若复用的目标变得不可访问或无效,需终止操作并上报,而非静默搜索其他工作簿。
  3. 仅当会话中未选定目标时,加载
    lark-drive
    ,以已认证用户身份搜索标题包含字面、大小写敏感标记
    [worklog]
    的电子表格:
    bash
    lark-cli drive +search --query '[worklog]' --only-title \
      --doc-types sheet --created-by-me --page-size 20 --as user --format json
  4. --created-by-me
    视为原始创建者语义:仅当前登录用户创建的电子表格符合条件,即使后续所有权发生变更。仅保留返回标题实际包含字面、大小写敏感子串
    [worklog]
    的结果;搜索匹配范围比最终检查更宽泛。保留API结果的顺序。如有必要,循环获取
    page_token
    ,直到找到第二个精确匹配项或结果耗尽。
  5. 若未找到精确匹配项,请求以当前用户身份创建
    工作日志 [worklog]
    。若用户明确指定另一电子表格,需先验证其创建者、标题标记及结构,再将其选定为当前会话的目标。提供的链接不会在本地持久化存储。
  6. 若仅找到一个匹配项,将其选定为该会话后续操作的目标。
  7. 若找到多个匹配项,选定API结果顺序中的第一个精确匹配项作为会话后续操作的目标,但需告知用户选定的标题与URL,并警告:稳定运行要求仅存在一个标题包含
    [worklog]
    的电子表格。切勿因第一个结果格式错误或不可访问而静默切换至后续结果。
  8. 加载
    lark-sheets
    ,解析选定的结果并检查其结构。若与参考格式不符,评估是否仍能明确映射任务与所需单元格。当无需破坏性重构时,采用兼容的解释方式继续操作。若含义模糊或请求的操作需要转换,需描述不匹配之处,并询问用户是转换工作簿还是创建符合规范的新工作簿。未经明确授权,切勿对其进行重构。
  9. 根据Agent进程的本地时钟计算当前工作日志日期:
    bash
    node <skill-directory>/scripts/worklog-rules.cjs date
  10. 阅读references/worklog-format.md。若会话未针对当前本地日期准备好该工作簿、日期或月份已变更,或发生结构故障,需执行月度与每日预检。否则使用当日快速路径,仅读取请求所需的单元格。
  11. 若预检发现需要切换月份或日期,立即告知用户结构切换与验证会使本次请求比普通更新稍慢,向用户确认工作仍在进行,无需额外请求权限即可继续操作。
  12. 预检完成后重新读取当前表格。将工作簿的实时元数据与单元格作为真实数据源;结构变更后切勿复用之前的行或列坐标。

Fast path within one conversation

同一会话内的快速路径

  • Reuse the selected workbook identity without Drive search.
  • After a successful preflight, remember the prepared local date and current-month sheet ID in conversation context. If both still match, skip workbook discovery and rollover checks.
  • Reuse a task title/alias-to-row index until a row insertion, row deletion, task identity edit, target switch, or structural failure invalidates it. Before writing, read each targeted cell and confirm that its title or mention token still matches; refresh column A only on mismatch.
  • For explicit row requests, read those rows directly. For multiple status updates, use one contiguous
    +cells-get
    , one
    +cells-set --writes
    , and one verification read; read references/status-updates.md.
  • Treat complete target-cell content as a write precondition. After every
    +cells-get
    , inspect
    warning_message
    ,
    truncated
    ,
    has_more
    , and
    complete
    when present. If the result is incomplete, narrow the range or continue the read until every target cell is complete; never transform or write from a clipped value or partial
    rich_text
    array.
  • Consolidate independent sheet ranges into the fewest supported read calls. Do not run an explicit auth-status call before every business command; follow
    lark-shared
    only when authentication actually needs diagnosis.
  • 复用选定的工作簿标识,无需再次进行Drive搜索。
  • 预检成功后,在会话上下文中记录已准备好的本地日期与当前月份表格ID。若两者仍匹配,跳过工作簿发现与切换检查。
  • 复用任务标题/别名到行索引的映射,直到发生行插入、行删除、任务标识编辑、目标切换或结构故障导致映射失效。写入前,读取每个目标单元格并确认其标题或提及令牌仍匹配;仅在不匹配时刷新A列。
  • 对于明确的行请求,直接读取对应行。对于多个状态更新,使用一次连续的
    +cells-get
    、一次
    +cells-set --writes
    和一次验证读取;阅读references/status-updates.md
  • 将目标单元格的完整内容视为写入前置条件。每次
    +cells-get
    后,检查是否存在
    warning_message
    truncated
    has_more
    complete
    字段。若结果不完整,缩小范围或继续读取,直到所有目标单元格内容完整;切勿基于截断值或部分
    rich_text
    数组进行转换或写入。
  • 将独立的表格范围合并为最少的支持读取调用。无需在每次业务命令前执行明确的授权状态检查;仅在实际需要诊断身份验证问题时遵循
    lark-shared
    的要求。

Interpret user input

用户输入解析规则

  • Put unassigned fragments in row 2 (
    杂项
    ).
  • Resolve task references against the primary title and
    别名:
    values read from column A.
  • Accept a unique title or alias match. For an uncertain match, present at most three likely tasks and wait for confirmation; then add the user's expression as an alias.
  • Use one logical daily item per line:
    • []
      — open todo
    • [x]
      — completed item
    • [~]
      — progress or context that should carry to the next day
  • Treat task-level completion separately from daily
    [x]
    items. Add
    状态:已完成
    only when the user explicitly completes the whole task.
  • Use
    状态:挂起
    for a parked task. Retain suspended tasks during month rollover.
  • Keep links, PRDs, designs, decisions, and long-form context in the primary task document. Keep the daily sheet concise.
  • 将未分配的零散内容放在第2行(
    杂项
    )。
  • 根据从A列读取的主标题与
    别名:
    值解析任务引用。
  • 接受唯一的标题或别名匹配。若匹配结果不确定,最多展示三个可能的任务并等待用户确认;随后将用户的表述添加为别名。
  • 每行对应一个逻辑每日条目:
    • []
      — 未完成的待办事项
    • [x]
      — 已完成的条目
    • [~]
      — 需要延续到次日的进度或上下文
  • 将任务级完成状态与每日
    [x]
    条目分开处理。仅当用户明确标记整个任务完成时,添加
    状态:已完成
  • 对暂停的任务使用
    状态:挂起
    。月份切换时保留暂停的任务。
  • 将链接、PRD、设计方案、决策内容及长篇上下文保存在主任务文档中,保持每日表格简洁。

Apply writes

写入操作规则

  • Treat a clear maintenance request as authorization for its scoped Lark writes and automatic rollover. Ask again only for an ambiguous task, an inaccessible target, or a structural conversion that is not already explicit in the request.
  • Follow the current
    lark-sheets
    instructions for every table operation, including style inheritance, stdin payloads, high-risk confirmation, and mandatory read-back verification.
  • Read references/status-updates.md before changing aliases or statuses in rich-text task cells.
  • Follow the current
    lark-doc
    instructions for every task-document operation. Create the document before inserting a new task row, and update existing documents surgically rather than overwriting them.
  • Never assume a failed batch rolled back every successful child operation. Parse per-operation results, re-read affected ranges, and reconcile actual state before retrying.
  • If document creation succeeds but a later sheet operation fails, retain and report that document URL. Resume with the same document; never create a duplicate or delete the first document automatically.
  • 将明确的维护请求视为对其范围内Lark写入操作与自动切换的授权。仅在任务模糊、目标不可访问或结构转换未在请求中明确说明时,才需再次询问用户。
  • 所有表格操作均遵循当前
    lark-sheets
    的说明,包括样式继承、标准输入 payload、高风险操作确认及强制回读验证。
  • 在富文本任务单元格中修改别名或状态前,阅读references/status-updates.md
  • 所有任务文档操作均遵循当前
    lark-doc
    的说明。插入新任务行前先创建文档,对现有文档进行精准更新而非覆盖。
  • 切勿假设批量操作失败时所有子操作已回滚。解析每个操作的结果,重新读取受影响的范围,在重试前协调实际状态。
  • 若文档创建成功但后续表格操作失败,需保留并上报该文档URL。使用同一文档恢复操作;切勿自动创建重复文档或删除首个文档。

Respect boundaries

边界约束

  • Represent task completion only with an explicit
    状态:已完成
    line. Preserve background styles during ordinary maintenance.
  • Never delete completed rows from an active month. Delete explicitly completed rows only from a newly copied month before creating its first current-month date column.
  • Never copy an older month when the exact previous
    YYYYMM
    sheet is missing.
  • Never create skipped daily columns; create only today's column from the latest prior populated date.
  • Never modify A1. Leave it blank in a newly created workbook.
  • Keep no persistent local configuration for this skill. Do not write a spreadsheet URL, timezone, document token, task content, or target-selection cache to disk. Conversation-local target reuse is required for speed and is discarded with the conversation. The official
    lark-cli
    may persist its own authentication and application configuration according to
    lark-shared
    ; that state is external to this skill.
  • Scope the preflight to work-log requests. This skill is not a scheduler and does not run before unrelated conversations.
  • 仅使用明确的
    状态:已完成
    行表示任务完成。日常维护中保留背景样式。
  • 切勿从活跃月份的表格中删除已完成的行。仅在复制旧月份表格并创建其首个当月日期列前,删除明确标记为已完成的行。
  • 若确切的上一个
    YYYYMM
    表格缺失,切勿复制旧月份表格。
  • 切勿创建跳过的每日列;仅从最近的已填充日期开始创建当日列。
  • 切勿修改A1单元格。新创建的工作簿中A1需保持空白。
  • 不为该技能保存持久化本地配置。切勿将电子表格URL、时区、文档令牌、任务内容或目标选择缓存写入磁盘。会话内目标复用是为了提升速度,会随会话结束而丢弃。官方
    lark-cli
    可根据
    lark-shared
    的要求持久化自身的身份验证与应用配置;该状态独立于本技能。
  • 预检仅针对工作日志请求。本技能并非调度器,不会在无关会话前运行。