Faisal Khan

I Built an AI Content Research Tool for LinkedIn and X. Here's What Broke.

By Faisal Khan

AI and ProductivityOctober 3, 2026LinkedinX TwitterLlm Grounding
An AI content research tool sorting real source links into a short list of LinkedIn and X post ideas

Most AI writing tools for LinkedIn and X have the same weak spot. They can write all day, but they cannot tell you what is actually being discussed in your field this week. So they guess, and the guess reads like every other post in the feed.

I built TrendPost to fix that one gap. An AI content research tool is software that checks live sources every morning, finds the topics people in your niche are really discussing, and shows each one with its source link, engagement numbers and age, so the AI writes about something real instead of inventing a trend.

This post covers how that works and the bugs that hurt along the way.

What is an AI content research tool?

An AI content research tool is software that collects topics from live sources such as Reddit, Hacker News, dev.to, news search and industry newsletters, ranks them by how fast engagement is growing, and attaches proof to each one. An AI content research tool uses a language model to search and filter, never to make topics up.

That last part is the whole difference. An AI writer starts with "write me a LinkedIn post about leadership" and the model fills the page from memory. A research tool starts with what happened this week, and the model only writes once there is a real story with a real link under it.

In TrendPost, a morning run looks like this:

  1. The AI turns a person's niche into search terms for each source.
  2. Five sources run at the same time and return candidate stories.
  3. Duplicates are merged, so one article shared on Reddit and in a newsletter counts once.
  4. The AI scores each candidate for relevance. Anything weak is dropped.
  5. The top 3–5 topics are shown with their link, numbers and age.
  6. Only when someone picks a topic does the AI draft posts: four angles, sized for LinkedIn or X.

Is an AI content research tool hard to build? What the docs say in 2026

Yes, and most of the difficulty sits outside the AI. Four things from the official documentation shaped how TrendPost had to be built.

Reddit closed its door. Reddit closed self-service access to its public data API in November 2025, so a new app now needs manual approval, according to n8n's Reddit integration docs. I could not open Reddit's own announcement from my tools, so I am linking the integration docs that cite it. My approval request is still pending. Reddit data in TrendPost currently comes through a paid third-party reader, kept behind one switch so I can move back to Reddit's own API by removing a single key.

Thinking models spend your output budget before they answer. Google's Gemini thinking documentation says the output token limit "applies to the combined total of thinking tokens and output tokens", and that thinking tokens are billed even when the answer comes back cut off. That sentence describes a real bug I hit, covered below.

Character counts are not what they look like. X's character counting docs say a post can hold 280 characters, but every emoji counts as 2. A draft that looks like it fits can be refused. LinkedIn's help center puts its post limit at 3,000 characters, which is plenty of room, but the feed hides most of it behind "see more".

Database locks have a lifetime. The PostgreSQL documentation on advisory locks says transaction-level locks "are automatically released at the end of the transaction". If your job runs longer than that transaction, the lock is gone before the work starts.

The rule that keeps the AI honest

The AI in TrendPost is a synthesizer, never a source. It writes search queries. It scores real results. It drafts posts about topics a live source returned. It is never allowed to produce a trend on its own.

Honestly, this rule cost me features. On a quiet morning the board is shorter. A tool that let the AI pad the list would look busier. It would also be lying, and the first time a user clicked a "trend" that did not exist, the product would be finished.

The same rule runs through the small details:

  • A missing number stays missing. News search returns no engagement figures. The tool shows "No numbers reported" rather than 0, because zero means nobody cared, and that is not what we know.
  • One reading is not a trend. A topic seen once has a size but no direction. It only shows as rising after a second reading, hours later, shows growth.
  • Text from outside is treated as data. Every Reddit post and article goes into the prompt inside a fenced block, and the model is told to ignore any instructions inside it. Someone can write "ignore your instructions" in a Reddit thread. It should not work.

The bugs that hurt most

The worst bugs were all quiet. Nothing crashed. The product just did the wrong thing and looked fine.

Every AI call failed on the first real run. Query generation asked Gemini for 800 tokens, which was plenty for the answer. But the model spent its budget thinking first, ran out, and returned a cut-off reply that my code correctly refused. Every call. No mocked test could have caught it, because a fake model does not think. The fix was a separate thinking allowance added only on the Gemini path, so each call still says how much answer it expects.

The "one search at a time" lock did nothing. I used a transaction-level lock to stop two searches running for the same person. It was released the moment its transaction committed, which was before the search began. A scheduled run and a manual refresh could both run, both paid for. The fix was a session-level lock held on its own database connection for the whole job.

A security header switched off every button on the live site. A strict Content-Security-Policy blocked the inline script React uses to start the page. In development everything worked. In production the page loaded as plain HTML and no button did anything. I removed the header and wrote down why, so nobody adds it back the same way.

Credits could be spent twice. Reading a balance and then deducting it is two steps. Two browser tabs can both read "1 credit left". I found this one by firing six spends at once against the real database, not in a unit test. Spending is now a single UPDATE ... RETURNING statement, so the deduction and the new balance come from the same instruction.

Common problems when building an AI content research tool

Most problems in an AI content research tool trace back to trusting something you have not checked against the real service. This table lists the ones I hit, what caused them, and what fixed them.

SymptomCauseFix
Every AI call returns a cut-off answerThinking tokens use up the output limitAdd a separate thinking allowance on top of the answer budget
Two searches run for one person at onceLock released when its transaction endsHold a session-level lock on its own connection
Board shows topics that already expiredQuery checks a status flag, not the expiry timeFilter every read on the expiry date as well
Feed articles all dated 1970Seconds treated as millisecondsConvert once, with a test pinning it
Balance and ledger disagreeDeduct and read back as two stepsOne statement that deducts and returns the new balance
Site looks fine, nothing clickableSecurity policy blocks the framework's own scriptsTest on a production build, never only in dev

How to build an AI content research tool that people trust

Build the data pipeline first and treat the AI as one careful step inside it. This is the order I would follow if I started again:

  1. List your sources and check access before writing code. Confirm each API key works with a real request. Reddit's approval process alone can take weeks.
  2. Store proof with every topic. Keep the source link, the engagement numbers and the time you first saw it. If a number is unknown, store "unknown", never zero.
  3. Give the AI narrow jobs. Writing search terms, scoring relevance, drafting from a chosen topic. Validate every answer against a schema and retry once at most.
  4. Measure growth, not size. Read engagement twice, hours apart, and rank by how fast it grew. Big and finished is less useful than small and rising.
  5. Test the risky parts against real services. Locks, money, token limits and production builds. Mocks hide exactly these bugs. This is the kind of work I do in full stack AI development: the AI feature plus the plumbing that keeps it honest.
  6. Ship a short list. Three to five strong topics beat twenty weak ones. A quiet day should look quiet.

What is the difference between an AI content research tool and an AI writer?

An AI writer starts from a prompt and fills the page from what the model already knows. An AI content research tool starts from live sources, finds topics people are discussing now, attaches proof to each, and only then drafts. The writer produces text. The research tool produces a reason to post.

Can an AI content research tool post to LinkedIn or X for me?

TrendPost does not post for you, and I think that is the right choice. It has no access to your LinkedIn or X account. You copy a draft, or open the compose box with one button, then edit and post yourself. The final call stays with the person whose name is on the post.

Which sources should an AI content research tool use?

Use sources where practitioners talk to each other before topics go mainstream. TrendPost reads Reddit, Hacker News, dev.to, a news search and a fixed list of industry newsletters and blogs. Hacker News suits developer and founder niches but returns very little for marketing ones, so source choice should follow the audience.

How long does it take to build an AI content research tool?

Where to start

An AI content research tool is only as good as the rule underneath it: the AI searches and scores, the sources supply the facts. Everything else is plumbing, and the plumbing is where it breaks. If you are planning an AI feature that has to stay accurate with live data, tell me what you are building and we can work out which parts need testing against the real thing.