# content-repurposer — content atomization microservice

Content repurposing & atomization microservice: take one long piece (blog post, article, transcript, essay) and reshape it for every channel — a numbered X/Twitter thread, a LinkedIn post, an...


Takes ONE long piece (blog post, article, transcript, essay) and reshapes it for every channel while
respecting each platform's length and format rules. A paid "intelligent microservice": every tool has
a **deterministic sentence/section-reshaping core that runs fully offline**, and the generative tools
**optionally** call an LLM (via `../_shared/llm.js`) to polish, silently falling back to the heuristic.
Every result is tagged `mode: 'heuristic' | 'llm'`.

## Tools

| tool | output |
|---|---|
| `toThread` | Numbered X/Twitter thread, each tweet ≤280 chars, hook first + CTA last. |
| `toLinkedIn` | LinkedIn post: hook line, short paragraphs, → takeaways, CTA, hashtags (≤3000 chars). |
| `toInstagramCaption` | IG caption: hook, short body, CTA, auto hashtag block (≤30, ≤2200 chars). |
| `toNewsletter` | Email: subject, preview text, intro, headed sections, CTA. |
| `toYoutubeDescription` | Hook, summary, timestamped chapter scaffold, link, keyword hashtags. |
| `toTikTokScript` | Short-form script: 3s hook, timed beats + on-screen text, follow CTA. |
| `extractQuotes` | The N most quotable pull-quotes (tweetable-flagged). |
| `keyPoints` | The N distilled key points/takeaways + top keywords. |

All tools require `text`. Optional: `title`, `hashtags`, `cta`, `url`, `handle`, `maxTweets`, `count`.

## Usage

```js
import repurposer from './index.js';

await repurposer.adapters.toThread({ text: longPost, title: 'How we cut churn 40%', maxTweets: 8, cta: 'Follow for more' });
await repurposer.adapters.toInstagramCaption({ text: longPost, hashtags: ['saas', 'growth'] });
repurposer.adapters.keyPoints({ text: longPost, count: 5 });
repurposer.adapters.extractQuotes({ text: longPost, count: 3 });
```

Each call takes ONE args object (maps 1:1 to an HTTP POST body). Missing `text` throws `TypeError`.

## Hybrid intelligence

The extractive engine (sentence ranking by content-word frequency + position) always produces output.
When an LLM is reachable, `toLinkedIn`, `toInstagramCaption`, and `toTikTokScript` polish the result and
keep the heuristic as `fallback`. A down/absent model never throws — the pack works 100% offline.

## DRY boundaries

- **Reshapes** one input across channels. It does **not** generate net-new copy from a product brief
  (that's `copywriter`), audit HTML/meta (`seo`), or build keyword briefs (`seo-brief`).
- General NLP primitives (tokenize/summarize/sentiment) live in `nlp`; this is the platform-formatting layer.
- No cross-pack imports except `../_shared/llm.js`. Pure ESM, Node built-ins only, zero npm deps.


---
Source: shared/engines/adapters/domain/content-repurposer/README.md
Canonical: https://docs.leumas.tech/p/adapters/domain/content-repurposer
