Summarize

repository·main·Indexed 27 days ago

https://github.com/steipete/summarize

A tool for generating fast summaries from URLs, files, and media including YouTube and podcasts. It provides a CLI, a browser extension for Chrome and Firefox, and an optional daemon for advanced media processing, native OCR, and enhanced AI capabilities. Supports multiple providers including OpenAI, Anthropic, Gemini, and local Ollama models. Includes @steipete/summarize-core for content extraction and prompt building.

Tokens
38.5K
Snippets
88
Records
266
Agent score
92%

What's inside @steipete/summarize

  1. Use @steipete/summarize-core for content extraction and prompt building

    main
    @steipete/summarize-core is the core library providing content extraction capabilities and prompt builders. For library usage, it is recommended to import specifically from the sub-modules to access the required functionality.
  2. Understand the Summarize Execution Engine architecture

    main

    The execution engine (src/engine) is a headless core responsible for summary policy and execution. It is designed to be transport-agnostic and does not depend on terminal (TTY), daemon, or HTTP layers.

    Key Responsibilities of the Engine:

    • Prompt policy
    • Model attempts and provider overrides
    • Summary cache keys and normalization
    • Stream normalization
    • Timestamp validation
    • Retry and fallback outcomes

    Adapter Responsibilities (CLI, Daemon, Browser): Adapters are responsible for the UI and transport layers, including stdout/stderr, terminal rendering, progress lifecycles, and SSE/HTTP serialization.

  3. Access Summarize documentation

    main

    The project documentation is organized into several specialized guides covering different aspects of the Summarize tool. You can find specific information in the following files:

    • Chrome Extension: docs/chrome-extension.md (Side panel extension and daemon setup/troubleshooting)
    • Cache: docs/cache.md (SQLite cache design and configuration)
    • CLI Models: docs/cli.md (Claude, Codex, Gemini, Agent, OpenClaw, OpenCode, Copilot, Antigravity, pi)
    • Configuration: docs/config.md (File location, precedence, and schema)
    • Extract Mode: docs/extract-only.md (Running without LLM summarization)
    • Engine Architecture: docs/engine.md (Headless execution engine)
    • Firecrawl: docs/firecrawl.md (Firecrawl mode and API key usage)
    • Language Settings: docs/language.md (Setting output language via --language or config)
    • LLM Configuration: docs/llm.md (Summarization via Gateway or OpenAI)
    • Manual Testing: docs/manual-tests.md (End-to-end test checklist)
    • Automatic Model Selection: docs/model-auto.md (Using --model auto)
    • Local Ollama: docs/ollama.md (Using local Ollama models via OpenAI-compatible endpoints)
    • OpenAI Usage: docs/openai.md (OpenAI model usage and flags)
    • Releasing: docs/releasing.md (Release checklist and Homebrew verification)
    • Smoke Testing: docs/smoketest.md (20-case smoke test plan)
    • Website Extraction: docs/website.md (HTML extraction and Firecrawl fallback)
    • YouTube Extraction: docs/youtube.md (Transcript extraction via youtubei, captionTracks, or Apify)
  4. Use the CLI to summarize websites, YouTube, and files

    main
    The summarize CLI supports multiple input types including URLs, YouTube videos, and local files. Use the --model flag to specify the LLM and the --length flag to control summary verbosity. For YouTube videos, use the --youtube auto flag to enable automatic caption/transcript handling.
  5. Authenticate with an Auth-fronted Ollama

    main
    If your Ollama instance is behind an authentication proxy, set the OPENAI_API_KEY environment variable. summarize will forward this value as an Authorization: Bearer … header. For bare Ollama instances, any value for this variable is acceptable.
  6. Release @steipete/summarize via the release script

    main

    The recommended way to release the project is using the scripts/release.sh helper script. This script manages the complex workflow of publishing to npm, building artifacts, and preparing GitHub releases.

    Release Phases:

    • gates: Runs pre-flight checks (pnpm install, check, build).
    • build: Builds various artifacts (Bun, Chrome, Firefox).
    • publish: Publishes core and CLI to npm using the next tag, performs a smoke test, and then promotes to latest.
    • tag: Creates an annotated git tag.
    • github: Verifies the GitHub Release and assets.
    • homebrew: Verifies the Homebrew installation.
    • deprecate: Used to deprecate a broken version.
    • all: Runs the full release pipeline.
  7. Generate a basic summary

    main

    Run summarize followed by a URL to generate a streaming Markdown summary in your terminal. The default summary length is long (~4k chars). You can adjust the length using the --length flag with predefined values like short or specific character counts.

    summarize "https://en.wikipedia.org/wiki/Llama"
    
    # Custom lengths
    summarize "https://example.com/long-article" --length short
    summarize "https://example.com/long-article" --length 3k
    summarize "https://example.com/long-article" --length 30000
  8. Summarize web pages, YouTube videos, and local files via CLI

    main

    The summarize CLI can be used to extract and summarize various content types. It uses Readability for articles, markitdown for files, and various transcript fetchers for media.

    Common usage patterns include:

    • Web pages: Summarize a URL using the default model.
    • YouTube: Summarize a video (prefers captions, falls back to yt-dlp + Whisper).
    • Local files: Summarize PDFs, images, audio, or video files.
    • Pipes: Use --extract to skip the LLM and output only the cleaned content, which is ideal for piping to other tools.
    • Stdin: Pipe content from the clipboard or standard input into summarize using -.
    # Web page
    summarize "https://example.com/article"
    
    # YouTube
    summarize "https://youtu.be/I845O57ZSy4"
    
    # Local file with specific model
    summarize ./report.pdf --model openai/gpt-5-mini
    
    # Extract content only (no LLM) for pipes
    summarize "https://example.com" --extract --format md | wc -w
    
    # From clipboard/stdin
    pbpaste | summarize -
  9. Configure LLM models and API keys via environment variables

    main

    To use specific LLM providers with summarize, you must set the corresponding API key in your environment or a .env file in the current working directory. Some providers also allow overriding the base URL for OpenAI-compatible endpoints.

    Required Environment Variables

    • xAI: XAI_API_KEY (Optional: XAI_BASE_URL)
    • OpenAI: OPENAI_API_KEY (Optional: OPENAI_BASE_URL, OPENAI_USE_CHAT_COMPLETIONS)
    • NVIDIA: NVIDIA_API_KEY or NGC_API_KEY (Optional: NVIDIA_BASE_URL)
    • MiniMax: MINIMAX_API_KEY (Optional: MINIMAX_BASE_URL)
    • OpenRouter: OPENROUTER_API_KEY (Used if OPENAI_BASE_URL points to OpenRouter)
    • GitHub Models: GITHUB_TOKEN or GH_TOKEN (for github-copilot/... models)
    • Z.AI: Z_AI_API_KEY or XAI_API_KEY (Optional: Z_AI_BASE_URL)
    • Ollama: OLLAMA_BASE_URL (Default: http://localhost:11434/v1)
    • Google: GEMINI_API_KEY or GOOGLE_API_KEY or GOOGLE_GENERATIVE_AI_API_KEY (Optional: GOOGLE_BASE_URL or GEMINI_BASE_URL)
    • Anthropic: ANTHROPIC_API_KEY (Optional: ANTHROPIC_BASE_URL)

    Configuration Fallback

    If process environment variables are missing, summarize reads fallback defaults from ~/.summarize/config.json under the env key.

  10. Use the Summarize CLI for websites and podcasts

    main

    The CLI can summarize websites, handle podcast URLs, and use specific transcription providers.

    • Website summary: Provide a URL. Use --max-output-tokens to limit output.
    • No-model-needed shortcut: Providing a very high --max-output-tokens value (e.g., 99999) will print the extracted text without invoking an AI model.
    • Podcast/Audio: When using a podcast URL, the tool will download and transcribe the audio. If ASSEMBLYAI_API_KEY is set, it will use assemblyai as the transcriptionProvider.
    • Detailed metrics: Use --metrics detailed to see more information during processing.
  11. Install and pair the Summarize Daemon

    main

    The daemon allows the Chrome extension to access native tools (like yt-dlp, ffmpeg, and tesseract OCR), shared caches, and CLI model fallbacks. To pair the extension with the CLI, you must install the daemon using a token copied from the extension's Side Panel.

    If you use a non-default port, you must specify it during installation and then update the extension settings in Options → Runtime → Daemon → Port.

  12. Add a new Transcript Provider

    main

    When extending the project with a new transcript provider, follow these implementation rules to maintain architectural consistency:

    1. Register cloud metadata: Define the provider's characteristics.
    2. Add a remote attempt handler: Implement how the provider handles byte/file attempts.
    3. Widen shared capability helpers: Update transcription-capability.ts to include the new provider's capabilities (e.g., canTranscribe).
    4. Write focused provider tests: Implement unit tests for the provider logic before integrating into live orchestration tests.
    5. Keep entrypoints thin: Avoid putting orchestration logic directly in the entrypoint; use pure parser helpers where possible.