anytype

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

AnyType Skill

AnyType 技能

Direct integration with AnyType's local REST API. No MCP dependency — uses HTTP calls via a TypeScript CLI tool.
通过本地REST API直接与AnyType集成。不依赖MCP——通过TypeScript CLI工具发起HTTP请求。

Prerequisites

前提条件

  • AnyType desktop app running (provides REST API on localhost)
  • bun
    runtime installed
  • API key configured (run Auth workflow if not set up)
  • 运行AnyType桌面应用(在localhost提供REST API)
  • 已安装
    bun
    运行时
  • 已配置API密钥(若未设置,运行Auth工作流)

Configuration

配置

Per-machine config is resolved in order:
  1. Environment variables:
    ANYTYPE_API_KEY
    ,
    ANYTYPE_HOST
    ,
    ANYTYPE_PORT
  2. Config file:
    ~/.config/anytype-skill/config.json
  3. Defaults: host=localhost, port=31009
Auto-space: Commands that require a space ID will auto-detect it when you have a single space. Use
--space <id>
to override or when you have multiple spaces.
每台机器的配置按以下优先级读取:
  1. 环境变量:
    ANYTYPE_API_KEY
    ANYTYPE_HOST
    ANYTYPE_PORT
  2. 配置文件:
    ~/.config/anytype-skill/config.json
  3. 默认值: host=localhost,port=31009
自动空间识别: 当你只有一个空间时,需要空间ID的命令会自动检测。若有多个空间或需要覆盖,使用
--space <id>
参数。

Tool Location

工具位置

All operations go through a single CLI tool at
Tools/AnyType.ts
relative to this skill's root directory. Construct the full path based on where this SKILL.md was loaded from.
bun <skill-root>/Tools/AnyType.ts <command> [options]
所有操作都通过该技能根目录下
Tools/AnyType.ts
这个单一CLI工具执行。根据当前SKILL.md的加载路径构建完整路径。
bun <skill-root>/Tools/AnyType.ts <command> [options]

Workflow Routing

工作流路由

WorkflowTriggerFile
AuthSet up API key, authenticate, auth status
Workflows/Auth.md
SearchSearch objects, find notes, query AnyType
Workflows/Search.md
ReadGet object, read note, view object details
Workflows/Read.md
TasksList tasks, create task, mark done, manage tasks
Workflows/Tasks.md
工作流触发条件文件
Auth设置API密钥、身份验证、查看认证状态
Workflows/Auth.md
Search搜索对象、查找笔记、查询AnyType数据
Workflows/Search.md
Read获取对象、读取笔记、查看对象详情
Workflows/Read.md
Tasks列出任务、创建任务、标记完成、管理任务
Workflows/Tasks.md

Tool Reference

工具参考

Authentication

身份验证

CommandDescription
auth challenge
Start auth flow (4-digit code appears in AnyType)
auth verify <challenge_id> <code>
Exchange code for API key
auth set-key <key>
Manually set an API key
auth status
Check current config and connectivity
命令描述
auth challenge
启动认证流程(AnyType中会显示4位验证码)
auth verify <challenge_id> <code>
用验证码兑换API密钥
auth set-key <key>
手动设置API密钥
auth status
检查当前配置和连接状态

Querying

查询操作

CommandDescription
spaces
List all spaces
search --query <text> [--types <t1,t2>] [--sort <prop>] [--direction asc|desc] [--space <id>] [--limit N]
Search objects
get --id <id> [--space <id>]
Get a specific object
list [--space <id>] [--limit N]
List objects in a space
tasks [--done] [--all]
List tasks (default: open/uncompleted)
命令描述
spaces
列出所有空间
search --query <text> [--types <t1,t2>] [--sort <prop>] [--direction asc|desc] [--space <id>] [--limit N]
搜索对象
get --id <id> [--space <id>]
获取指定对象
list [--space <id>] [--limit N]
列出空间内的对象
tasks [--done] [--all]
列出任务(默认:未完成的任务)

Task Shortcuts

任务快捷操作

CommandDescription
task-add "name" [--due YYYY-MM-DD] [--body <text>]
Quick-create a task
done <task_id>
Mark a task as complete
命令描述
task-add "name" [--due YYYY-MM-DD] [--body <text>]
快速创建任务
done <task_id>
标记任务为完成

Mutating

变更操作

CommandDescription
create --type <key> --name <name> [--body <md>] [--properties <json>]
Create an object
update --id <id> [--name <n>] [--body <md>] [--due DATE] [--properties <json>]
Update an object
delete --id <id>
Archive an object
All commands output JSON to stdout.
--space
is optional for all mutating/querying commands (auto-detected).
命令描述
create --type <key> --name <name> [--body <md>] [--properties <json>]
创建对象
update --id <id> [--name <n>] [--body <md>] [--due DATE] [--properties <json>]
更新对象
delete --id <id>
归档对象
所有命令都会向标准输出(stdout)输出JSON。所有查询/变更命令的
--space
参数为可选(会自动检测)。

Search Behavior

搜索行为说明

  • Search
    query
    is required and searches object content, not just names
  • To list all objects of a type, use a space as wildcard:
    search --query " " --types <type_key>
  • The
    --types
    flag filters which object types are returned, not what text is searched
  • Type keys (e.g.,
    page
    ,
    task
    ,
    note
    ) vary per space — discover them by running a broad search and inspecting the
    type.key
    field in results
  • Objects may contain
    anytype://
    links in their markdown body that reference other objects by
    objectId
    and
    spaceId
    — use these with the
    get
    command to follow links
  • Use
    --sort last_modified_date --direction desc
    to get most recently modified first
  • Use
    --space <id>
    to scope search to a single space
  • 搜索
    query
    为必填项,会搜索对象的内容,而非仅名称
  • 若要列出某一类型的所有对象,使用空格作为通配符:
    search --query " " --types <type_key>
  • --types
    参数用于过滤返回的对象类型,而非搜索文本
  • 类型键(如
    page
    task
    note
    )因空间而异——可通过执行宽泛搜索并查看结果中的
    type.key
    字段来发现
  • 对象的markdown内容中可能包含
    anytype://
    链接,通过
    objectId
    spaceId
    引用其他对象——可配合
    get
    命令使用这些链接查看关联内容
  • 使用
    --sort last_modified_date --direction desc
    可按最近修改时间排序
  • 使用
    --space <id>
    可将搜索范围限定在单个空间内

Property Format Reference

属性格式参考

When using
--properties
with
create
or
update
, match the property format:
FormatJSON Example
checkbox
{"key": "done", "checkbox": true}
text
{"key": "description", "text": "Some text"}
select
{"key": "status", "select": {"name": "In Progress"}}
date
{"key": "due_date", "date": "2026-03-01T00:00:00Z"}
Note:
update
also accepts
--due YYYY-MM-DD
as a shorthand for setting the due_date property.
create
update
命令中使用
--properties
时,需匹配以下属性格式:
格式JSON示例
checkbox
{"key": "done", "checkbox": true}
text
{"key": "description", "text": "Some text"}
select
{"key": "status", "select": {"name": "In Progress"}}
date
{"key": "due_date", "date": "2026-03-01T00:00:00Z"}
注意:
update
命令也支持
--due YYYY-MM-DD
作为设置due_date属性的简写方式。

API Quirks

API特性说明

  • Unchecked checkboxes are omitted: When
    done
    is
    false
    , the property is absent from the response (not returned as
    false
    ). The
    tasks
    command handles this automatically.
  • No server-side property filtering: The API filters by type but not property values. The
    tasks
    command filters client-side.
  • Delete = archive: The DELETE endpoint archives objects; they can be restored in AnyType.
  • 未勾选的复选框会被省略:
    done
    false
    时,该属性不会出现在响应中(不会返回
    false
    )。
    tasks
    命令会自动处理此情况。
  • 无服务器端属性过滤: API支持按类型过滤,但不支持按属性值过滤。
    tasks
    命令会在客户端进行过滤。
  • 删除即归档: DELETE端点会归档对象;可在AnyType中恢复这些对象。

Examples

示例

List open tasks:
bun Tools/AnyType.ts tasks
Quick-create a task with due date:
bun Tools/AnyType.ts task-add "Review pull request" --due 2026-03-01
Mark task done:
bun Tools/AnyType.ts done <task_id>
Set a due date on existing task:
bun Tools/AnyType.ts update --id <task_id> --due 2026-03-15
Search with sorting:
bun Tools/AnyType.ts search --query "meeting" --sort last_modified_date --direction desc
Read a specific object:
bun Tools/AnyType.ts get --id <object_id>
Create with full control:
bun Tools/AnyType.ts create --type page --name "Meeting Notes" --body "## Agenda\n- Item 1"
列出未完成任务:
bun Tools/AnyType.ts tasks
快速创建带截止日期的任务:
bun Tools/AnyType.ts task-add "Review pull request" --due 2026-03-01
标记任务为完成:
bun Tools/AnyType.ts done <task_id>
为现有任务设置截止日期:
bun Tools/AnyType.ts update --id <task_id> --due 2026-03-15
带排序的搜索:
bun Tools/AnyType.ts search --query "meeting" --sort last_modified_date --direction desc
读取指定对象:
bun Tools/AnyType.ts get --id <object_id>
完全自定义创建对象:
bun Tools/AnyType.ts create --type page --name "Meeting Notes" --body "## Agenda\n- Item 1"