productivity
Readwise Lua API for KosmoKrator Agents
Agent-facing Lua documentation and function reference for the Readwise KosmoKrator integration.Lua Namespace
Agents call this integration through app.integrations.readwise.*.
Use lua_read_doc("integrations.readwise") inside KosmoKrator to discover the same reference at runtime.
Call Lua from the Headless CLI
Use kosmo integrations:lua when a shell script, CI job, cron job, or another coding CLI should run a deterministic
Readwise workflow without starting an interactive agent session.
kosmo integrations:lua --eval 'dump(app.integrations.readwise.check_auth({}))' --json kosmo integrations:lua --eval 'print(docs.read("readwise"))' --json
kosmo integrations:lua --eval 'print(docs.read("readwise.check_auth"))' --json Workflow file
Put repeatable logic in a Lua file, then execute it with JSON output for the calling process.
local readwise = app.integrations.readwise
local result = readwise.check_auth({})
dump(result) kosmo integrations:lua workflow.lua --json
kosmo integrations:lua workflow.lua --force --json integrations:lua exposes app.integrations.readwise, app.mcp.*, docs.*, json.*, and regex.*. Use app.integrations.readwise.default.* or app.integrations.readwise.work.* when you configured named credential accounts.
MCP-only Lua
If the script only needs configured MCP servers and does not need Readwise, use the narrower mcp:lua command.
# Use mcp:lua for MCP-only scripts; use integrations:lua for this integration namespace.
kosmo mcp:lua --eval 'dump(mcp.servers())' --json Agent-Facing Lua Docs
This is the rendered version of the full Lua documentation exposed to agents when they inspect the integration namespace.
Readwise
Use the readwise namespace to work with both Readwise highlights/books and Reader documents.
Authentication uses a Readwise access token in the Authorization: Token ... header. Agents should not pass the token manually.
Readwise v2
readwise_list_booksandreadwise_get_bookread source books/articles.readwise_list_highlights,readwise_get_highlight,readwise_create_highlights,readwise_update_highlight, andreadwise_delete_highlightmanage highlights.readwise_export_highlightsis the preferred sync endpoint. UseupdatedAfterandpageCursorfor incremental exports.readwise_get_review_queueretrieves review queue items.- Book and highlight tag tools use
book_id,highlight_id, andtag_idpath fields.
Reader v3
readwise_save_documentsaves a URL or HTML document to Reader.readwise_list_documentsaccepts filters such asupdatedAfter,location,category,tag,limit, andpageCursor.readwise_update_documentupdates metadata, tags, notes, location, category, and seen state for one document.readwise_bulk_update_documentsaccepts anupdatesarray.readwise_delete_documentdeletes a Reader document.readwise_list_reader_tagslists Reader tags for filtering.
Examples
readwise_save_document({
url = "https://example.test/article",
payload = {
tags = {"research", "later"},
saved_using = "agent"
}
})
readwise_list_documents({
payload = {
location = "archive",
updatedAfter = "2026-05-01T00:00:00Z",
limit = 100
}
})
readwise_export_highlights({
payload = {
updatedAfter = "2026-05-01T00:00:00Z",
pageCursor = "cursor-from-previous-response"
}
})
The raw readwise_api_get, readwise_api_post, readwise_api_patch, and readwise_api_delete tools only accept relative paths such as /api/v3/list/; full URLs are rejected.
Raw agent markdown
# Readwise
Use the `readwise` namespace to work with both Readwise highlights/books and Reader documents.
Authentication uses a Readwise access token in the `Authorization: Token ...` header. Agents should not pass the token manually.
## Readwise v2
- `readwise_list_books` and `readwise_get_book` read source books/articles.
- `readwise_list_highlights`, `readwise_get_highlight`, `readwise_create_highlights`, `readwise_update_highlight`, and `readwise_delete_highlight` manage highlights.
- `readwise_export_highlights` is the preferred sync endpoint. Use `updatedAfter` and `pageCursor` for incremental exports.
- `readwise_get_review_queue` retrieves review queue items.
- Book and highlight tag tools use `book_id`, `highlight_id`, and `tag_id` path fields.
## Reader v3
- `readwise_save_document` saves a URL or HTML document to Reader.
- `readwise_list_documents` accepts filters such as `updatedAfter`, `location`, `category`, `tag`, `limit`, and `pageCursor`.
- `readwise_update_document` updates metadata, tags, notes, location, category, and seen state for one document.
- `readwise_bulk_update_documents` accepts an `updates` array.
- `readwise_delete_document` deletes a Reader document.
- `readwise_list_reader_tags` lists Reader tags for filtering.
## Examples
```lua
readwise_save_document({
url = "https://example.test/article",
payload = {
tags = {"research", "later"},
saved_using = "agent"
}
})
```
```lua
readwise_list_documents({
payload = {
location = "archive",
updatedAfter = "2026-05-01T00:00:00Z",
limit = 100
}
})
```
```lua
readwise_export_highlights({
payload = {
updatedAfter = "2026-05-01T00:00:00Z",
pageCursor = "cursor-from-previous-response"
}
})
```
The raw `readwise_api_get`, `readwise_api_post`, `readwise_api_patch`, and `readwise_api_delete` tools only accept relative paths such as `/api/v3/list/`; full URLs are rejected. local result = app.integrations.readwise.check_auth({})
print(result) Functions
check_auth Read
Validate the Readwise access token.
- Lua path
app.integrations.readwise.check_auth- Full name
readwise.readwise_check_auth
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
list_books Read
List Readwise books.
- Lua path
app.integrations.readwise.list_books- Full name
readwise.readwise_list_books
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
get_book Read
Get one Readwise book.
- Lua path
app.integrations.readwise.get_book- Full name
readwise.readwise_get_book
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
list_book_tags Read
List tags for a Readwise book.
- Lua path
app.integrations.readwise.list_book_tags- Full name
readwise.readwise_list_book_tags
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
create_book_tag Write
Create a tag on a Readwise book.
- Lua path
app.integrations.readwise.create_book_tag- Full name
readwise.readwise_create_book_tag
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
delete_book_tag Write
Delete a tag from a Readwise book.
- Lua path
app.integrations.readwise.delete_book_tag- Full name
readwise.readwise_delete_book_tag
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
list_highlights Read
List Readwise highlights.
- Lua path
app.integrations.readwise.list_highlights- Full name
readwise.readwise_list_highlights
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
create_highlights Write
Create one or more Readwise highlights.
- Lua path
app.integrations.readwise.create_highlights- Full name
readwise.readwise_create_highlights
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
get_highlight Read
Get one Readwise highlight.
- Lua path
app.integrations.readwise.get_highlight- Full name
readwise.readwise_get_highlight
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
update_highlight Write
Update a Readwise highlight.
- Lua path
app.integrations.readwise.update_highlight- Full name
readwise.readwise_update_highlight
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
delete_highlight Write
Delete a Readwise highlight.
- Lua path
app.integrations.readwise.delete_highlight- Full name
readwise.readwise_delete_highlight
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
list_highlight_tags Read
List tags for a highlight.
- Lua path
app.integrations.readwise.list_highlight_tags- Full name
readwise.readwise_list_highlight_tags
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
create_highlight_tag Write
Create a tag on a highlight.
- Lua path
app.integrations.readwise.create_highlight_tag- Full name
readwise.readwise_create_highlight_tag
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
delete_highlight_tag Write
Delete a tag from a highlight.
- Lua path
app.integrations.readwise.delete_highlight_tag- Full name
readwise.readwise_delete_highlight_tag
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
export_highlights Read
Sync Readwise export data.
- Lua path
app.integrations.readwise.export_highlights- Full name
readwise.readwise_export_highlights
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
get_review_queue Read
Get daily review queue items.
- Lua path
app.integrations.readwise.get_review_queue- Full name
readwise.readwise_get_review_queue
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
list_reader_documents Read
List Reader documents.
- Lua path
app.integrations.readwise.list_reader_documents- Full name
readwise.readwise_list_documents
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
save_reader_document Write
Save a document to Reader.
- Lua path
app.integrations.readwise.save_reader_document- Full name
readwise.readwise_save_document
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
update_reader_document Write
Update a Reader document.
- Lua path
app.integrations.readwise.update_reader_document- Full name
readwise.readwise_update_document
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
bulk_update_documents Write
Bulk update Reader documents.
- Lua path
app.integrations.readwise.bulk_update_documents- Full name
readwise.readwise_bulk_update_documents
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
delete_reader_document Write
Delete a Reader document.
- Lua path
app.integrations.readwise.delete_reader_document- Full name
readwise.readwise_delete_document
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
list_reader_tags Read
List Reader tags.
- Lua path
app.integrations.readwise.list_reader_tags- Full name
readwise.readwise_list_reader_tags
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
api_get Read
Call a safe relative Readwise GET path.
- Lua path
app.integrations.readwise.api_get- Full name
readwise.readwise_api_get
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
api_post Write
Call a safe relative Readwise POST path.
- Lua path
app.integrations.readwise.api_post- Full name
readwise.readwise_api_post
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
api_patch Write
Call a safe relative Readwise PATCH path.
- Lua path
app.integrations.readwise.api_patch- Full name
readwise.readwise_api_patch
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
api_delete Write
Call a safe relative Readwise DELETE path.
- Lua path
app.integrations.readwise.api_delete- Full name
readwise.readwise_api_delete
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||