Content Generation Workflow
PREREQUISITE: Read
../anygen-shared/SKILL.mdfor auth, global flags, and security rules.
Rules
Follow these rules exactly.
- Schema: run
anygen schema <resource.method>to check required params and response if needed. - Long-running:
--waitcommands will block, MUST usesessions_spawnto run in the background. - Sending files on Feishu/Lark: Do not use the message tool to send files. It corrupts non-ASCII filenames into
%XXgarbage. Strictly follow the curl process in "Sending files".
Steps
-
Discover operations metadata:
anygen task operationsDo not guess operation types. Always run to get supported operations and their estimated time and thumbnail support. -
Upload reference files (skip if no reference files):
anygen file upload --data '{"file":"./data.csv"}'→ Savefile_tokenfor step 4. Tell user the file was uploaded. -
Gather requirements (skip if requirements are already clear):
anygen task prepare --data '{"operation":"slide","messages":[{"role":"user","content":"Make a Q4 report PPT"}]}'Presentreplyto user, collect their answer, then call again withprepare_session_idand updatedmessages:anygen task prepare --data '{"operation":"slide","prepare_session_id":"<id>","messages":[...previous messages...,{"role":"user","content":"user's answer"}]}'Repeat untilstatus=ready. → When ready, showsuggested_task_params.promptas outline, confirm with user, then use it aspromptin step 4. -
Create task:
anygen task create --data '{"operation":"slide","prompt":"...","file_tokens":["<file_token>"]}'→ Tell user the task is created, sharetask_urland estimated time (from step 1). -
Wait for completion (long-running, must run in background via
sessions_spawn):anygen task get --params '{"task_id":"<id>"}' --wait -
Deliver (after step 5 completes, check the result):
- No files (
output.filesempty): showmessageto user if present. - Has files + has thumbnail (
has_thumbnailfrom step 1):anygen task +download --task-id <id> --thumbnail→ Send thumbnail image withtask_urlas preview. Do not download files yet — wait for user to request download or modifications (→ step 7). - Has files + no thumbnail:
anygen task +download --task-id <id>→ Send files to user (see "Sending files" below).
- No files (
-
Modify (on user request):
anygen task message send --params '{"task_id":"<id>"}' --data '{"content":"..."}'Then wait for result (long-running, must run in background viasessions_spawn):anygen task message list --params '{"task_id":"<id>"}' --wait→ Repeat from step 6 to re-export and deliver. All modifications reuse the same task.
Sending files
When user requests file download, or when delivering files from step 6:
anygen task +download --task-id <id>
To download specific files: anygen task +download --task-id <id> --file report.pptx
Feishu/Lark (message tool corrupts non-ASCII filenames, use curl instead):
- Get credentials: read
app_idandapp_secretfrom the config file (e.g.cat ~/.openclaw/openclaw.json | jq '.channels.feishu'instead ofopenclaw config get). Make sure to use the credentials matching the current account. - Get token:
curl -X POST 'https://open.feishu.cn/open-apis/auth/v3/tenant_access_token/internal' -H 'Content-Type: application/json' -d '{"app_id":"<app_id>","app_secret":"<app_secret>"}' - Upload + Send per file type:
- Images (thumbnail, png, jpg, etc.):
Upload:
curl -X POST 'https://open.feishu.cn/open-apis/im/v1/images' -H 'Authorization: Bearer <tenant_access_token>' -F 'image_type=message' -F 'image=@./preview.png'Send:curl -X POST 'https://open.feishu.cn/open-apis/im/v1/messages?receive_id_type=chat_id' -H 'Authorization: Bearer <tenant_access_token>' -H 'Content-Type: application/json' -d '{"receive_id":"<chat_id>","msg_type":"image","content":"{\"image_key\":\"<image_key>\"}"}' - Documents (pptx/docx/pdf, etc.):
Upload:
curl -X POST 'https://open.feishu.cn/open-apis/im/v1/files' -H 'Authorization: Bearer <tenant_access_token>' -F 'file_type=ppt' -F 'file=@./output.pptx' -F 'file_name=output.pptx'file_typevalues:opus(audio),mp4(video),pdf,doc,xls,ppt,stream(other). Send:curl -X POST 'https://open.feishu.cn/open-apis/im/v1/messages?receive_id_type=chat_id' -H 'Authorization: Bearer <tenant_access_token>' -H 'Content-Type: application/json' -d '{"receive_id":"<chat_id>","msg_type":"file","content":"{\"file_key\":\"<file_key>\"}"}'
- Images (thumbnail, png, jpg, etc.):
Upload:
Other platforms: Send via the platform's message tool.
See Also
anygen-task-download— Download artifacts from a completed task