# Agent Work Registry

Registers agent outputs, removes duplicates and builds the cards that show them.

- Repository: https://github.com/lobehub/lobehub (83676 stars)
- Category: AI and agents
- License: see repository
- Last updated: 2026-11-01
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add lobehub/lobehub --skill agent-work -g -a claude-code -y`
Codex: `npx skills add lobehub/lobehub --skill agent-work -g -a codex -y`
Cursor: `npx skills add lobehub/lobehub --skill agent-work -g -a cursor -y`
Gemini CLI: `npx skills add lobehub/lobehub --skill agent-work -g -a gemini-cli -y`

## Description

Use for the Agent Work output registry: registration, deduplication, cards, skill providers, CLI scanners and Work types.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# Agent Works

A **Work** is a durable record of something an agent produced or touched, a GitHub PR/issue, a Linear issue, an entity file (pptx/xlsx/docx/pdf), a document, a task. Works render as cards under the assistant message that produced them and accumulate **versions** across operations, so the same PR edited twice shows one card with history.

Two tables (`packages/database/src/schemas/work.ts`):

- `works`, one row per resource. Identity/dedup key: `(resourceType, resourceId)` within the user/workspace scope and the share scope (see below). `currentVersionId` soft-references the latest version.
- `work_versions`, one row per registration event. Dedup: unique `(workId, toolCallId)`, so a retried registration with the same real tool call id is a no-op. Versions carry provenance (source message, producing tool) and operation-level `cumulativeCost` / `cumulativeUsage`.

## Type registry

`packages/database/src/models/work/registry.ts` is the single registry of Work types (`document` / `external` / `file` / `task`): `WORK_TYPE_ADAPTERS` is `satisfies Record<WorkType, WorkTypeAdapter>`, so a type added to `@lobechat/types` without an adapter is a compile error.

**Read-path compatibility gate**: `OPT_IN_WORK_TYPES` (currently `{'file'}`) hides newer types from clients that did not opt in (`includeFileWorks`). Released Electron clients lag by weeks and crash on unknown type descriptors (`descriptor.getIcon` on `undefined`), so a request without the opt-in receives exactly the pre-`file` set. Any NEW Work type must ship behind the same kind of opt-in.

The gate has two kinds of emission points, and both must honor the client's declaration:

The rest: https://github.com/lobehub/lobehub/blob/HEAD/.agents/skills/agent-work/SKILL.md
