0g.hk
0g.hk is a temporary public note and short-link service. Keep this skill as routing and safety guidance; do not mirror the full API here. This package is publicly installable, so do not assume a local checkout path.
Truth sources:
- Live agent manual:
https://0g.hk/llms.txt - Source repository:
https://github.com/catoncat/0g-hk - When working inside the source checkout, prefer the repo's
docs/API.md
Companion tool:
- Use
scripts/0ghk-history.mjswhen the user wants to browse, search, edit, open, copy, or renew locally saved publication history. It reads${XDG_DATA_HOME:-$HOME/.local/share}/0g-hk/links.jsonland never prints edit tokens.
Rules:
- Create in JSON/form mode, share
shortUrl, and userawUrlfor agents or scripts. - Save
editTokenimmediately when the user may edit or renew later. - If local edit history is needed, store it outside the installed skill package, for example
${XDG_DATA_HOME:-$HOME/.local/share}/0g-hk/links.jsonl. Keep mode600. - Treat
editToken,editPath, andeditUrlas secrets. Do not expose them publicly unless the user explicitly wants an editable entry. - Prefer JSON body edits/renewals with
{ "token": "..." }; query?edit=is compatibility only. - If curl gets a Cloudflare challenge, use the browser UI and verify the resulting public URL.
- Do not commit
links.jsonl, copied tokens, or generated local history.
Lost edit token / web-created notes:
- First search the local ledger with
scripts/0ghk-history.mjs --list --search <name>; web-created notes often have no local ledger entry. - For live 0g.hk production, verify the Worker/KV truth from the source checkout before touching data:
wrangler.tomlgives the Worker account andNOTESnamespace, and current code stores note bodies atn:<name>plus metadata atm:<name>. - The original edit token cannot be recovered from KV. Metadata stores only a hash (
m:<name>.h), TTL key (t), and created/renewed timestamp (ct). - If the user owns the deployment and explicitly asks to recover access, use the Cloudflare ops lane (
cf-ops/wrangler) to read onlym:<name>andn:<name>, confirm the note exists, then reset access by writing a fresh token hash intom:<name>while preservingt,ct, and the remaining KV expiration. Do not dump unrelated KV keys. - Return only the new
https://<name>.0g.hk/edit#t=<token>link to the authorized user. Do not log the token into tracked files, memory, or public docs.
Local ledger:
- Append-only JSONL.
- On create, record
event,name,short_url,raw_url,edit_token,edit_url,ttl,expires_at,title,source, andrecorded_at. - On edit or renew, append a new event instead of overwriting prior rows.