@lacspace/hookwriter
v1.1.0
Published
Deterministic platform copy from facts — hooks, titles, captions, CTAs and descriptions in many styles (question, number-led, what-it-means, contrast, breaking, how-to, quote…), English and Nepali, trimmed to each platform's character limit (YouTube/IG/Ti
Downloads
489
Maintainers
Readme
@lacspace/hookwriter
Platform-ready copy from facts — hooks, titles, captions, CTAs and descriptions, in many styles, English and Nepali. Deterministic: it fills templates with only the facts you pass (never invents a claim), trims to each platform's character limit, and drops sensational phrasing. AI is optional — only to fill slots.
npm i @lacspace/hookwriterimport { generate, compose } from "@lacspace/hookwriter";
const facts = {
topic: "the rate cut",
headline: "Nepal Rastra Bank cuts the policy rate",
place: "Nepal", number: "4.5%",
hashtags: ["NRB", "economy", "Nepal"],
};
generate(facts, { type: "hook", platform: "instagram", lang: "both" });
// → [{ style:"plain", lang:"ne", text:"…" }, { style:"number", lang:"en", text:"4.5% …" }, …] (no BREAKING unless urgency:"breaking")
compose(facts, { platform: "instagram", lang: "en" }).text;
// → hook + caption + CTA + #NRB #economy #Nepal, fitted to 2200 charsWhy
A newsroom needs a caption/title for every post on every platform — doing that with an LLM each time is slow, costly, and risks drift or hype. hookwriter stamps out on-brand, factual copy deterministically, and leaves the LLM only the occasional slot to fill.
API
generate(facts, { type, platform, lang?, styles?, max? })→Variant[]— many variants of one copytype(hook|title|caption|cta|description), each{ style, lang, text, length }. A template whose slots aren't all present infactsis skipped — nothing is fabricated — and anything sensational is dropped. Output is trimmed to the platform's limit.compose(facts, { platform, lang?, style?, urgency?, cta?, maxHashtags? })→{ hook, caption, hashtags, text }— a full post assembled from the parts, hashtags capped per platform (30 on Instagram), fitted to the caption limit.slotTemplates(type, lang)→ the raw templates with their{slots}, so an LLM can fill the slots itself (the only place AI is needed).describe()→ machine-readable capabilities + JSON-Schema commands + the lists oftypes,stylesandplatforms, so an AI "conductor" drives it by choosing options.PLATFORMS/limitFor/fitText— the platform limits and the word-boundary trimmer, exported.
Urgency (1.1.0): "BREAKING:" / "Just in" / "ताजा खबर:" copy appears only with urgency: "breaking" (or styles: ["breaking"]); routine stories (the default) never get it, in generate or compose.
Styles: plain, question, number, whatItMeans, contrast, curiosity, breaking, howto, quote, list. Platforms: YouTube, Instagram, TikTok, Facebook, X, Threads, LinkedIn, Telegram. Pair it with @lacspace/extractive (facts/headlines) upstream.
Licence
Lacspace Free Licence v1.0 — free for personal and commercial use.
