Building Briefly AI: A Python CLI That Turns URLs, PDFs, and YouTube Videos into Concise AI Briefs

May 4, 2026
5 min read
By Rahat Kabir

Contents

The problem

I built Briefly AI because I wanted a terminal-first way to turn long articles, PDFs, YouTube videos, and notes into clean text and concise briefs without copy-pasting everything into a chatbot.

In the LLM era, text is the raw material. Before you can think with a model, you need the transcript, the article body, the slide notes — clean, stripped of boilerplate, ready to use. And most of the time you don’t want to read it all. You want the summary, the action items, the decisions, fast.

That’s the loop Briefly is built for: extract clean text, brief it fast, act on it.

The product shape

briefly https://example.com/long-article
briefly paper.pdf --brief-type study
briefly https://youtu.be/abc123 --stream auto
briefly meeting.txt --brief-type action --json

A few things to notice:

  • One positional argument. No subcommand to remember.
  • Five brief types: standard, executive, action, study, decision.
  • Streaming on by default for long content.
  • --json when you want to pipe the output somewhere.
  • A SQLite cache so re-runs are free.

See it in action

Play

The architecture

Two packages in a uv workspace.

Briefly AI architecture: briefly-cli and briefly-core packages, with core never importing cli

One rule: core never imports cli. That dotted arrow is the whole architecture. It means I can later wrap briefly-core in a daemon, an API, or a UI without touching terminal code.

The extraction pipeline

This is where most of the real work lives. A great LLM on bad text gives bad briefs.

Briefly AI extraction pipeline: input resolver routes to Trafilatura, pdfplumber, InnerTube, or Whisper, then through a SQLite cache into the LLM

A few choices worth calling out:

URLs. Trafilatura first. It strips boilerplate better than readability-style libraries on long-form pages.

YouTube. This was the rabbit hole. The official YouTube Data API needs a key, has quotas, and doesn’t reliably return captions. So I hit the Android InnerTube API instead — the same endpoint the YouTube mobile app uses. No key, returns caption tracks directly.

When a video has no captions (which happens a lot), I fall back to yt-dlp for audio and Groq Whisper for transcription. Groq is fast and cheap enough that the fallback path doesn’t feel like a punishment.

PDFs. pdfplumber for both local and remote files. Local PDFs get an mtime-keyed cache entry, so editing the file invalidates the cache automatically.

The LLM layer

I used LiteLLM so the tool isn’t tied to one provider. You pick the model in ~/.briefly/config.json:

briefly config init --model anthropic/claude-sonnet-4-6
# or use an OpenAI GPT model
briefly config init --model openai/gpt-4o-mini

Anthropic, OpenAI, Groq, local Ollama — same command, different model string. Switching providers is a config change, not a code change.

The five brief types aren’t five models. They’re five prompt shapes over the same engine:

  • executive asks for outcomes and decisions.
  • study asks for definitions and structure.
  • action asks for next steps.
  • decision asks for options and tradeoffs.
  • standard is the default narrative summary.

Same input, different lens.

Streaming is auto by default — on for long content, off for short. Fewer surprises.

What I didn’t build

A few things I left out on purpose, and a few I’m saving for later:

  • No PowerPoint, Word, or richer document support yet. Coming soon. The extraction pipeline is built to take new input types without changing the rest of the system.
  • No daemon. A background process for a CLI you run by hand is overhead pretending to be a feature.
  • No agent loop. Briefs are one-shot. Looping would multiply cost without multiplying value.
  • No UI. Once the core is right, a UI is a weekend. For now, the terminal is the UI.

Scope discipline matters more than feature count.

Try it

Recommended for CLI users:

uv tool install briefly-ai
briefly --help

Or with pip:

pip install briefly-ai
briefly config init --model anthropic/claude-sonnet-4-6
briefly https://your-favorite-long-article.com

Three lines, working in under a minute.

There are many more flags, brief types, and config options — see the GitHub README for full details.

Takeaways

  • Extraction quality matters as much as the model. A perfect LLM on garbage text gives garbage briefs.
  • Good AI tools need boring infrastructure. The cache, the config loader, the input resolver — none of it is glamorous, but it’s what makes the tool usable on day 30, not just day 1.
  • Small CLI design decisions compound. briefly <input> instead of briefly brief <input> saves four characters every time. Over hundreds of runs, that’s the difference between a tool you use and a tool you forget.

Next up: PowerPoint and Word support, then a daemon mode that briefs RSS feeds on a schedule, so my morning reading is already digested before I open the terminal.

Code: github.com/Rahat-Kabir/briefly-ai