KeyFlow CLI Guide for AI Agents
Use this when a person asks you to post, upload, or publish something to KeyFlow (키플로우).
It works the same for any agent that can run shell commands.
1. Steps
- Write one Markdown file (for example
post.md). Use the frontmatter and syntax below. - Run
keyflow check post.md --jsonand fix every error. - Confirm the intended account and draft/public/scheduled action are authorized. Reuse explicit approval already given for that same target and action.
- Run
keyflow push post.md --account <name>when choosing a saved account. Report the returned post ID and URL. - To change the post later, edit the same file and run
keyflow push post.mdagain. It updates the same post.
If keyflow is not logged in, ask the person to run keyflow login themselves.
Use keyflow account list --json and keyflow status --account <name> to check the author without printing credentials.
An account alias alone is not proof of identity; confirm its recorded username. Keep different authors in separate saved accounts.
2. Frontmatter (all optional)
---title: Post title # default: the first "# heading"tags: [nextjs, cache]publish: false # true = publish (needs the person's approval)visibility: public # public | followers | privatecover: ./images/cover.png # local path or https URLab_title: Alternate title # optional Variant B title for A/B testingab_cover: ./images/cover-b.png # optional Variant B cover (local path or https URL)summary: One-line summary # default: KeyFlow writes an AI summarylanguage: ko # ko | en, default: detectedtranslation_of: ./post.en.md # optional: another language file, already uploaded---
- No
publishmeans a private draft. publish: truewithoutvisibilitypublishes aspublic.- The CLI adds a
keyflow:block with the post ID after the first upload. Do not edit or remove it unless the person wants a new post. - If you do not set
title, the first# headingbecomes the title and is not repeated in the body.
Korean and English editions
Give each edition its own title, summary, language and saved ID. Push the first file withouttranslation_of, then add translation_of: ./post.ko.md to the English file after the Korean file
has a real keyflow.id. Push both with the same explicit account. The server links their language
versions; the two uploads are not an atomic batch. A file path is relative to the file that contains it.
Scheduled publication (CLI 2026.10.17 or later)
Add only when scheduling, using your future date and an explicit timezone:
publish: falsevisibility: publicscheduled_at: "2026-10-20T09:00:00+09:00"
The time must be one minute to 30 days ahead. Do not combine it with publish: true or --publish.
The CLI checks server support before uploading; the server also requires writer permissions and an
enabled scheduling queue. The post remains a draft and new cover/content images remain private until publication.
Require a confirmed schedule with the requested post ID and time; a saved draft alone is not a scheduled post.
If registration fails after saving, the CLI exits nonzero and keeps the saved ID for retry instead of creating another post.
Removing scheduled_at does not cancel a server reservation: use KeyFlow's scheduled-post management UI.
Each language edition has its own reservation. Obtain approval for the intended time and visibility before scheduling.
3. Images
- Use local paths as normal Markdown images:
. - Paths are relative to the Markdown file. The CLI uploads them and rewrites the uploaded copy only.
- Keep each image as a real file inside the Markdown file's folder or its subfolders. Symbolic links,
paths that lead outside that folder (../, absolute paths), and files whose content does not match
their extension are rejected bykeyflow checkandkeyflow push. - Allowed: PNG, JPEG, WebP, GIF. Max 10 MB each, 50 per post. SVG is not accepted.
- Always write alt text in the brackets.
4. KeyFlow syntax
Callouts
> [!TIP]> Shorter builds come from caching the dependency layer.
Types: NOTE, TIP, IMPORTANT, WARNING, CAUTION, AI, USER, BOT, STEP.
Use USER and BOT for a question and answer, and STEP for numbered tutorial steps.
Code
Always name the language after the opening fence:
```tsexport const answer = 42;```
Math
Inline: $E = mc^2$. Block:
MASKED_BLOCK_5
Before / After image comparison
Compare 2 images side by side with a draggable divider. Standard Markdown image paths inside :::compare are uploaded and rewritten automatically by keyflow push. The alt text becomes the left (Before) and right (After) label:
MASKED_BLOCK_6
- Put exactly 2 images inside
:::compare...:::(first = left/Before, second = right/After). - Supported on Web, Desktop, and Mobile readers.
Link card
MASKED_BLOCK_7
Document card
MASKED_BLOCK_8
Runnable code (Sandpack)
__MASKED_BLOCK_9__sandpack
{"template":"react","files":{"/App.js":"export default function App() { return
Hi
; }"}}MASKED_BLOCK_10`
5. HTML artifacts
Use keyflow html push report.html --title "Report" --account <name> to save a private draft as a native post.
Add --as link to create a standalone, full-page sharing link outside the profile posts and feed.
Add --publish only with authorization to publish; a draft is not publicly accessible.
The server must advertise capabilities.htmlArtifacts; older servers fail before content is uploaded.
- One self-contained UTF-8 HTML file, at most 1 MiB. Inline CSS, JavaScript and data URL assets are preserved.
- External files, CDN dependencies, network APIs, browser storage, popups and forms are unsupported in the isolated preview.
- HTTPS iframes are supported in previews and published HTML. Embedded sites must allow framing and work without origin storage, login, popups or forms; their own network requests are possible. HTTP, data and blob iframe sources are blocked.
- Include images as data URLs and keep CSS and JavaScript inline. Relative image paths are not uploaded for HTML.
- Real clicks on HTTP(S) links open a separate browser tab; fragment links scroll inside the HTML.
- Use
--dry-run --jsonto validate without uploading. The original file is never rewritten. - Keep the returned artifact ID. Run
keyflow html push report.html --id <id>to update the same URL. - Updates preserve the existing title, description and public/draft state unless explicitly changed. Use
--draftto unpublish. - Updates also preserve language and post/link mode; converting a saved post to a link, or a link to a post, is rejected.
- Use
--description "Summary",--language koor--language en, and--folder <id>(new posts only). - Run
keyflow html list --account <name> --jsonto find IDs and the latest saved state. It lists at most 50 current results without downloading or executing their HTML. - HTML is never rewritten locally. Keep the returned ID yourself and pass
--idexplicitly for later updates. --jsonreturns the artifact ID, version and URL. A version conflict requires reloading before retrying.- HTML uses the existing post detail and library, with scripts isolated inside the HTML body. Scripts in ordinary Markdown posts are still removed.
- Uploaded HTML iframe support does not imply the same support in ordinary Markdown posts. Cards, YouTube embeds and other rich blocks can differ across Web, mobile and desktop readers; verify the intended reader and include a descriptive ordinary link beside important embedded content.
- Cover images, tags, linked Korean/English editions and advanced publication settings use the existing Web editor.
- In My HTML artifacts, deleting a linked post moves it to trash with its HTML. Standalone links and artifacts whose post is gone require permanent-delete confirmation. Emptying trash also queues HTML file cleanup.
6. Title & Cover A/B testing (GA4 + BigQuery)
Public published posts support YouTube-style uniform A/B tests (automatic 50/50 split, no traffic ratio sliders) for:
- Title only (
title) - Cover image only (
cover, including animated GIF up to 3 MB and WebP) - Title + Cover pair (
pair)
Configure from frontmatter (CLI 2026.12.3 or later)
Add ab_title and/or ab_cover to frontmatter and run keyflow push post.md --account <name>:
- On a draft, private, or scheduled post, the CLI queues Variant B on the server and automatically starts the A/B test when the post is published publicly.
- On a publicly published post, the CLI starts the experiment immediately and prints the short share links.
- Local
ab_coverfiles follow the same validation and upload rules ascover.
Manage directly with keyflow ab
Pass either a post ID or a pushed Markdown file (containing keyflow.id). All subcommands support --account <name> and --json:
keyflow ab status # list all experimentskeyflow ab status post.md # inspect one post (or post ID)keyflow ab start post.md --title "Alt" --cover ./images/cover-b.pngkeyflow ab promote <experimentId> B # promote A, B, or C and end the testkeyflow ab cancel <experimentId> # cancel and keep Variant Akeyflow ab clear post.md # remove a queued draft A/B test
Share links & evaluation
- For external sharing (X, LinkedIn, Threads, KakaoTalk, Slack), use the short variant share links (
https://www.keyflow.me/s/<postId>?ab=aandhttps://www.keyflow.me/s/<postId>?ab=b). Each link redirects to that variant's OG preview route while keepingnoindex, followandcanonicalpointed at the original post URL so SEO is unaffected. - Direct visits and plain
/s/<postId>links automatically bucket readers 50:50 on the client when an active experiment is running. - GA4 collects
ab_impression,ab_click(includingexternal_share), andab_engaged_read(30s active dwell + 50% scroll), and the daily BigQuery rollup updates the comparison table on/manage/workspace/posts/<postId>/analyticsand/manage/workspace/dashboard. Promoting a winner updates the post title/cover and revalidates caches without changing the postslug.
7. Common mistakes
- A
#wordafter a space or at the start of a line becomes a tag link. Write\#wordor put it in backticks if you do not want a tag. - Do not start the body with the same heading as
title. - Scripts and inline event handlers are removed when the post is rendered.
- Do not invent new callout types. Unknown types fail
keyflow check.
8. Rules
- Never ask for, print, log, or store KeyFlow credentials, tokens, or
.envvalues. - Get the person's approval before
publish: trueor--publish. - Do not claim a post is published unless
keyflow pushreported it.