Files
Project-Thoth/codex/chatgpt-capture-mvp/implementation/0002-active-tab-capture.md
T

50 lines
2.2 KiB
Markdown

Implement Task 2 — Active Tab Capture Flow for the Project Thoth ChatGPT Capture Connector MVP.
Context:
- This is a Manifest V3 Chrome/Edge extension.
- Capture Connectors must only capture source material; they must not reason, call LLMs, generate metadata, or interact with the Project Thoth application yet.
- The MVP action is a browser toolbar button labeled “Save to Project Thoth.”
- The extension should use minimal permissions: activeTab, scripting, and downloads as needed later.
- This task focuses only on toolbar click → active tab lookup → script injection → service worker/content script message passing.
Architecture requirements:
1. Use the Manifest V3 service worker as the orchestration point.
2. On toolbar button click, get the currently active tab.
3. Verify the current tab URL is ChatGPT:
- https://chatgpt.com/*
- https://chat.openai.com/*
4. Inject or execute a content script using chrome.scripting.
5. The content script should send a message back to the service worker with a placeholder capture payload.
6. The service worker should receive and log the payload.
7. Do not implement the real ChatGPT DOM extractor yet.
8. Do not implement Markdown normalization yet.
9. Do not implement downloads yet except leaving clear TODO boundaries.
10. Keep ChatGPT-specific extraction isolated for the next task.
Expected placeholder payload:
{
sourcePlatform: "ChatGPT",
title: document.title || "ChatGPT Conversation",
url: window.location.href,
capturedAt: new Date().toISOString(),
messages: []
}
Files to update or create:
- manifest.json
- src/background.js
- src/chatgptExtractor.js if needed as a placeholder injected module
- README.md if local testing instructions need updating
Acceptance criteria:
- Extension loads locally in Chrome/Edge.
- Toolbar button click triggers the service worker.
- On a ChatGPT tab, the content script executes successfully.
- A placeholder capture payload is returned to the service worker.
- On a non-ChatGPT tab, the extension does not inject and logs or displays a simple error.
- No LLM calls.
- No Project Thoth application dependency.
- No vault writes.
Keep the implementation simple, readable, and modular so Task 3 can replace the placeholder with the real ChatGPT DOM extractor.