/qfs:qfs-chatworkfrom qfs
Use when a task needs Chatwork through qfs — installing and querying the DECLARED /chatwork driver (rooms, a room's latest messages, a room's unread messages, room file listings, file download, and file upload) written in the query language itself, and posting a message to a room. Covers installing the chatwork.qfs declaration, connecting it to a stored Chatwork API token, reading the latest messages versus the unread-only ones, posting a message via ENCODE form, downloading a file's bytes via the FOLLOW stage, and uploading via ENCODE multipart.
Ships in qfs. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
/chatwork is a declared driver: an integration written in qfs's own query language
(CREATE DRIVER … CREATE VIEW …) rather than compiled Rust. Chatwork is an API-key REST API — the
token rides an x-chatworktoken header — so the whole surface is expressible as declarative config
over the generic /http wire primitive. Installing it is an ordinary preview/commit; connecting it
evaluates it. This is the API-key twin of the shipped /cloudflare declared driver.
Once installed and connected (Setup), your rooms are a path:
/chatwork/rooms
|> select name, type, role
|> order by name
name type role
Deploys group admin
Ops group member
… 6 rows
That read runs live against Chatwork's REST API — the token is resolved from qfs's vault, never typed on the command line, and the declaration is structurally unable to address any host other than Chatwork's (host confinement, enforced at install).
Installing a declared driver is two steps: install the declaration (a local, previewed write to
/sys/drivers — zero network), then connect it to the Chatwork API token you hold.
The shipped chatwork.qfs declares the driver, its row types, and its resources. Preview then commit
each statement (each desugars to one /sys/drivers row). AUTH HEADER names only the header — the
token value never appears in the script:
CREATE DRIVER chatwork
AT 'https://api.chatwork.com/v2'
AUTH HEADER 'x-chatworktoken'
CREATE TYPE chatwork/message (
message_id text PRIMARY KEY,
body text NOT NULL,
send_time timestamp,
update_time timestamp,
account_id text,
account_name text
)
The sender arrives as a nested account object on each message, so the view lifts
account.account_id and account.name into the top-level columns the OF contract names:
CREATE VIEW /chatwork/rooms/{room}/messages OF chatwork/message AS
/http/chatwork/rooms/{room}/messages?force=1
|> DECODE json
|> SELECT message_id, body, send_time, update_time,
account.account_id AS account_id, account.name AS account_name
CREATE VIEW /chatwork/rooms/{room}/messages/unread OF chatwork/message AS
/http/chatwork/rooms/{room}/messages
|> DECODE json
|> SELECT message_id, body, send_time, update_time,
account.account_id AS account_id, account.name AS account_name
CREATE MAP INSERT /chatwork/rooms/{room}/messages AS
INSERT INTO /http/chatwork/rooms/{room}/messages |> ENCODE form VALUES (row)
ENCODE form is load-bearing on that last map. Chatwork's message endpoint — like most plain-REST
APIs of its generation — accepts parameters only as application/x-www-form-urlencoded and answers
a JSON request body with 400. The generic form encoder renders the row struct's scalar fields as
percent-encoded k=v&k=v and sets the content type, so the declaration needs no Chatwork-specific
code.
Store your Chatwork API token in the vault, then bind it to the mount — the declaration stays credential-free; the value lives in the account layer:
qfs account add chatwork work # paste the x-chatworktoken value (stdin, into the vault)
qfs connect /chatwork TO chatwork SECRET 'vault:chatwork/work'
describeStart at the mount root — describe names the children beneath it, so the surface is walkable
without reading the declaration's source:
qfs describe /chatwork
path: /chatwork
archetype: relational (SELECT JOIN INSERT UPDATE UPSERT)
columns: (none declared — this node states no row type; run it to see its columns)
children:
/chatwork/rooms
verbs: (none)
procedures: (none)
aliases: (none)
pushdown: limit
The root bears no rows and answers no verb of its own — verbs: is the authoritative line, and the
parenthesised archetype vocabulary is the shape hint, not a claim about this node.
Walk down one segment at a time. A {param} child is legible as a parameter — substitute a real
value for it:
qfs describe /chatwork/rooms # children: /chatwork/rooms/{room} (room — substitute a value)
qfs describe /chatwork/rooms/123456 # children: …/messages, …/files
At a leaf, describe reports the declared OF columns — the same columns run delivers, so
you can build the next statement straight from them:
qfs describe /chatwork/rooms/123456/messages
path: /chatwork/rooms/123456/messages
archetype: relational (SELECT INSERT)
columns: (declared OF /type/chatwork/message)
| name | type | null
| ------------ | --------- | ----
| message_id | Text | yes
| body | Text | no
| send_time | Timestamp | yes
| update_time | Timestamp | yes
| account_id | Text | yes
| account_name | Text | yes
verbs: SELECT INSERT
pushdown: limit
A node declaring no row type says exactly that instead of reporting a placeholder column — the blob view below is one, and its columns are whatever the wire delivers.
The rows you committed in step 1 are the driver from now on — the shipped chatwork.qfs is
never read again. When a later qfs release corrects the declaration (this one has been corrected
twice), your mount keeps running the text you installed. Ask:
/sys/declarations |> where status == 'stale'
An empty answer means every installed declaration matches the one your binary ships. A chatwork
row means it does not, and its differs column names the CREATE … statements to preview and
commit again. Nothing is upgraded for you: re-installing is your write to make, so a declaration
you customised is never silently overwritten. See the FAQ for the full three-value status.
Address a room by its id (from /chatwork/rooms), newest first, attributed to their senders:
/chatwork/rooms/123456/messages
|> select send_time, account_name, body
|> order by send_time DESC
|> limit 20
That path returns the room's most recent messages every time it is read. It is worth saying why
it needs its own spelling: GET /rooms/{id}/messages defaults to unread messages only, so a view
declared without force=1 returns rows on the first read of a room and nothing on the next one
until someone posts again. The shipped …/messages view passes force=1 — a path names a place,
and reading it twice has to answer the same question.
The unread reading is the API's cheap default call, and it keeps a name of its own:
/chatwork/rooms/123456/messages/unread
|> select body, send_time
This one consumes: Chatwork marks the returned messages read, so the next read of the same room
returns only what arrived in between. Reach for it when you want "what is new since I last looked";
reach for …/messages when you want the room's latest messages.
The room type carries Chatwork's own counters, so "what needs my attention" is one query rather than a scan of every room's name:
/chatwork/rooms
|> where mention_num > 0 or unread_num > 0
|> select name, mention_num, unread_num, last_update_time
|> order by mention_num DESC
mytask_num counts the open tasks in a room that are assigned to you, so "which rooms are waiting
on me" is a where on it — no per-room task fetch:
/chatwork/rooms
|> where mytask_num > 0
|> select name, mytask_num, task_num, last_update_time
|> order by mytask_num DESC
send_time is a column, so an incremental poll is a where on it:
/chatwork/rooms/123456/messages
|> where send_time > 1700000000
|> select send_time, account_name, body
describe reports pushdown: limit for these nodes, and that is the honest answer: Chatwork's
messages endpoint takes no "since" parameter, so the filter runs locally in qfs over the page
the API returns. The query is still the right one to write — it just does not save the round trip.
A Chatwork reply is an ordinary message whose body carries a reply prefix naming the account being replied to and the message being replied to. Both ids are columns, so the prefix composes from a row you already read:
[rp aid=<account_id> to=<room_id>-<message_id>] <your text>
Read the message you are answering, then post the composed body:
/chatwork/rooms/123456/messages
|> where message_id == '1000000000'
|> select CONCAT('[rp aid=', account_id, ' to=123456-', message_id, '] On it') as body
|> insert into /chatwork/rooms/123456/messages
Without account_id this is not expressible — which is why the message type carries the sender.
/chatwork/rooms/123456/files
|> select filename, filesize
|> order by filename
An INSERT appends to the room. Like every write it previews first and sends only on --commit:
insert into /chatwork/rooms/123456/messages values (body) ('Deploy shipped ✅')
The declared map's ENCODE form turns that row into the form body the endpoint requires. What the
encoder does with each field is stated, not implicit: scalar fields (text, int, float, bool,
timestamp) are percent-encoded in declaration order; a NULL field is omitted rather than sent
empty; and a bytes, array, or nested-struct field is refused with a structured error naming the
reason — a form body has no binary or nested encoding, so an upload belongs in ENCODE multipart
(below) instead of being silently flattened onto the wire.
The shipped chatwork.qfs declares a blob view over the two-step download: the metadata GET
returns a temporary download_url on a different host, and the generic FOLLOW stage performs
the second GET off that delivered field — the raw bytes arrive as a one-row content column. The
follow request carries no credential (the URL is self-authorizing), so the token never leaves
Chatwork's API host:
/chatwork/rooms/123456/files/789/blob
The view behind it (already in chatwork.qfs, shown for the shape):
CREATE VIEW /chatwork/rooms/{room}/files/{file}/blob AS
/http/chatwork/rooms/{room}/files/{file}?create_download_url=1
|> DECODE json |> FOLLOW download_url
POST /rooms/{id}/files is multipart/form-data; the declared map's ENCODE multipart produces
it generically — a bytes field becomes the file part (named by the sibling filename text field),
every other scalar field a plain part. Pipe a blob in from any service and shape the row to
file (bytes), filename, and an optional message:
/drive/my/monthly.pdf
|> select content as file, name as filename, 'monthly report' as message
|> insert into /chatwork/rooms/123456/files
The map behind it (already in chatwork.qfs):
CREATE MAP INSERT /chatwork/rooms/{room}/files AS
INSERT INTO /http/chatwork/rooms/{room}/files |> ENCODE multipart VALUES (row)
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub qmu/qfs --plugin qfs14 skills in this plugin
/qfsUse when the user asks to use QFS or its connected services. Discover the live connections and available paths before reading or writing through the qfs CLI; covers pipe-SQL, preview, and commit. For Slack channel discovery and threads, also read qfs-slack./qfs-automationUse when a task needs the qfs SERVER side — scheduled jobs, triggers, HTTP endpoints, and cached views created with CREATE bindings over queries you already write./qfs-cloudflareUse when a task needs Cloudflare through qfs — installing and querying the DECLARED /cloudflare driver (zones, DNS records, account-scoped KV/Queues/D1 listings, plus D1 SQL, KV get/put, queue push and queue pull) written in the query language itself. Covers installing the cloudflare.qfs declaration, connecting it to the stored Cloudflare token, reading, consuming a queue with the read-over-POST pull view, and the declared D1 SQL surface. For Artifacts Git repositories use the compiled /cf driver instead.Other plugins' skills for the same job