How saeedezzati/superpower-chatgpt works
Purpose and delivery model
Superpower ChatGPT is a browser extension that augments the ChatGPT website with local chat/prompt management, prompt authoring utilities, UI controls, exports, and community/newsletter features. The extension is defined by manifest.json; its user-facing extension popup is popup.html with popup.css.
Runtime entry points
The background runtime owns extension-level initialization and browser lifecycle work through scripts/background/background.js and scripts/background/initialize.js. On ChatGPT pages, a content-script initialization layer injects and coordinates feature modules at scripts/content/initialize.js, with shared page-level behavior in scripts/content/global.js. Firefox uses a different background declaration, documented in the README, but reuses the initialization script.
Page interception and ChatGPT boundary
The extension operates against ChatGPT’s client UI and network behavior rather than owning a separate application backend. scripts/interceptor/loadScript.js loads scripts/interceptor/interceptor.js, establishing an interception boundary for ChatGPT requests/events. Content modules such as scripts/content/api.js, scripts/content/fetchEventListeners.js, and scripts/content/arkose.js bridge intercepted platform behavior to extension features, including generation controls and moderation/challenge-related handling.
Conversation management pipeline
ChatGPT conversation data is read from the host page/API boundary, copied locally for sync/search/export, and rendered into extension-provided controls. The principal model/view components are scripts/content/conversation.js, scripts/content/conversationList.js, and scripts/content/conversationElement.js. Folder assignment and drag/reorder behavior are layered through scripts/content/folderElement.js, scripts/content/categoryList.js, and scripts/content/sortable.js; destructive and archive-oriented flows include scripts/content/clearConversations.js.
Prompt capture and composition
Prompt authoring is a separate feature cluster centered on local prompt history/library and input-time enhancements: scripts/content/promptHistory.js, scripts/content/promptLibrary.js, and scripts/content/promptChain.js. Input interception and composition features—including autocomplete, template replacement, language/style presets, and custom instructions—are split across scripts/content/quickAccessMenu.js, scripts/content/templateWordsModal.js, and scripts/content/customInstructions.js. This boundary modifies submitted prompts but relies on ChatGPT for model execution.
UI augmentation and response controls
The extension injects UI into ChatGPT navigation, conversation rows, modals, and input/response areas. Key composition points are scripts/content/navbar.js, scripts/content/modal.js, and scripts/content/newChatPage.js. Response lifecycle actions are implemented in scripts/content/continue.js, scripts/content/regenerateResponse.js, and scripts/content/stopGeneratingResponse.js; per-message presentation is handled by scripts/content/rowUser.js and scripts/content/rowAssistant.js.
Persistence, export, and external services
README states conversation and prompt-history copies remain on the user’s computer; auto-sync supports local search and recovery. Export flows are implemented at scripts/content/export.js, backed by bundled serialization/download dependencies such as scripts/thirdParty/jszip.js, scripts/thirdParty/FileSaver.js, and scripts/thirdParty/turndown.js. Community prompt sharing and newsletter functionality imply remote service interaction, while private chats remain outside that server boundary; relevant page modules include scripts/content/pluginStore.js and scripts/content/newsletterList.js.
Dependencies and assets
This is plain browser-extension JavaScript/CSS, with vendored browser-side libraries rather than a visible build system. Rendering/export dependencies include Markdown, syntax highlighting, KaTeX, SSE, and sortable support under scripts/thirdParty/. Shared injected styling is scripts/styles/global.css and scripts/styles/katex.css; notification audio is sounds/beep.mp3.
Main entry points: initialize.js Content initialization · conversation.js Conversation management · interceptor.js ChatGPT interception · manifest.json Extension manifest
Components 20
Extension runtime
- Extension manifest · Defines extension entry points and injection.
manifest.json - Background runtime · Owns browser lifecycle work.
scripts/background/background.js - Background initialization
scripts/background/initialize.js - Extension popup
popup.html
ChatGPT page integration
- Content initialization · Injects and coordinates page features.
scripts/content/initialize.js - Shared page behavior
scripts/content/global.js - Interceptor loader
scripts/interceptor/loadScript.js - ChatGPT interception · Observes ChatGPT requests and events.
scripts/interceptor/interceptor.js
Local features
- Conversation management · Local conversation views, folders, ordering, archive, and clearing.
scripts/content/conversation.js - Conversation list UI
scripts/content/conversationList.js - Folders and sorting · Assigns folders and supports drag/reorder.
scripts/content/folderElement.js - Prompt library and chains · Maintains local prompt history, library, and chains.
scripts/content/promptLibrary.js - Prompt composition · Applies quick access, templates, and custom instructions.
scripts/content/quickAccessMenu.js - Injected UI and response controls · Adds navigation, modal, row, and generation controls.
scripts/content/navbar.js - Local chat and prompt copies · Supports sync, search, recovery, and private data retention.
- Export pipeline · Serializes locally stored chats for download.
scripts/content/export.js - Export dependencies · ZIP, download, and Markdown conversion support.
scripts/thirdParty/jszip.js
External boundaries
- ChatGPT client UI/API · Host owns chat execution and conversation APIs.
- Community and newsletter · Prompt sharing and newsletter features cross the remote-service boundary.
scripts/content/pluginStore.js - Community remote services · Private chats remain outside this boundary.
Connections 22
- Extension manifest → Background runtime: declares
- Extension manifest → Extension popup: declares
- Extension manifest → Content initialization: injects
- Background runtime → Background initialization: initializes
- Content initialization → Shared page behavior: coordinates
- Content initialization → Interceptor loader: loads
- Interceptor loader → ChatGPT interception: injects
- ChatGPT interception → ChatGPT client UI/API: intercepts events and requests
- Content initialization → Conversation management: activates
- Conversation management → Conversation list UI: renders
- Conversation management → Folders and sorting: organizes
- ChatGPT interception → Conversation management: bridges host data
- Conversation management → Local chat and prompt copies: syncs copies
- Content initialization → Prompt library and chains: activates
- Prompt library and chains → Local chat and prompt copies: stores history
- Prompt library and chains → Prompt composition: supplies prompts
- Prompt composition → ChatGPT client UI/API: modifies submitted prompts
- Content initialization → Injected UI and response controls: injects
- Injected UI and response controls → ChatGPT interception: controls generation lifecycle
- Local chat and prompt copies → Export pipeline: provides chats
- Export pipeline → Export dependencies: uses
- Community and newsletter → Community remote services: shares prompts and newsletter data