agentleFS
AtmoskunAtmoskun/claude-skills/skills/chatgpt/SKILL.md

chatgpt

Skill0 starsChanged 9 months agoMITView on GitHub

ChatGPT browser automation - ask questions, select models, multi-turn conversations

4 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

4 rules. 0 are common, 1 is distinctive, and 3 are very specific to this project.

  • 0

    Common

    Most of the 3 edited versions we read keep these.

  • 1

    Distinctive

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    If standard models timeout, check that the stop button selector still works

    line 133
  2. Very specific:

    Run debug_selectors.py to verify STOP_BUTTON_SELECTORS

    line 134
  3. Very specific:

    Browser mode: Always visible (headless=False) — ChatGPT actively blocks headless

    line 172
  4. Very specific:

    Config centralization: All selectors in config.py — single file to update on UI changes

    line 177

“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

ℹ️ 备用工具 — 日常多AI协同请用 /write --team(socratic-writer)。本工具仅在需要特定 GPT 模型(如 o3)或上传文件到 ChatGPT 网页版时使用。

ChatGPT Browser Automation Skill

Reusable ChatGPT automation via Patchright (Playwright fork). Opens a visible Chrome browser, types questions, detects responses using dual stop-button + text-stability polling, and persists Q&A to JSON + Obsidian.

When to Use

  • Other skills need ChatGPT as a reasoning backend (e.g., socratic-writer)
  • You need to query ChatGPT with model selection (o3, gpt-4o, etc.)
  • You want Q&A history searchable in Obsidian

When NOT to Use

  • Claude can answer the question directly — no need for ChatGPT
  • The task requires the ChatGPT API (use the OpenAI SDK instead)
  • Headless automation — ChatGPT blocks headless browsers

Quick Start

# First time: setup venv + install deps
python scripts/run.py setup_environment

# Authenticate (opens browser for manual login)
python scripts/run.py auth_manager setup

# Ask a question
python scripts/run.py ask_question --question "What is 2+2?"

# Ask with model selection
python scripts/run.py ask_question --question "Explain quantum entanglement" --model o3

# Multi-turn interactive session
python scripts/run.py conversation interactive --model gpt-4o

Core Workflow

One-Shot Q&A (ask_question.py)

The primary entry point. Each call opens a fresh browser session:

  1. Auth check → launch persistent Chrome context (visible)
  2. Navigate to chatgpt.com → wait for page load
  3. Dismiss popups → select model (if specified)
  4. Click-focus input → page.keyboard.type() (ProseMirror compatible)
  5. Click send button (or fallback Enter)
  6. Dual response detection:
    • Layer 1: Stop button visible → still generating (progress every 15s)
    • Layer 2: Text stability — 3 identical reads at 1.5s intervals
  7. Save cookies → persist to history → return text
# Programmatic usage from other skills
from ask_question import ask_chatgpt

answer = ask_chatgpt("What is 2+2?", model="o3")

Multi-Turn Conversation (conversation.py)

Keeps browser open across questions:

# Interactive REPL
python scripts/run.py conversation interactive --model o3
# Type questions, get answers, empty line to end

Script Reference

ScriptPurposeCLI
ask_question.pyOne-shot Q&A--question "..." [--model o3] [--no-history]
conversation.pyMulti-turn sessionsinteractive [--model o3]
auth_manager.pyLogin managementsetup|status|validate|clear|reauth
history_manager.pyQ&A historysearch --query "..."|list|stats
debug_selectors.pySelector diagnostics(no args — opens browser, reports)
config.pyAll selectors + config(imported, not run directly)
browser_utils.pyBrowserFactory + stealth(imported, not run directly)
run.pyVenv wrapper<script_name> [args]
setup_environment.pyFirst-time setup[--check]

Model Selection

Available models (update MODEL_MAPPINGS in config.py when ChatGPT changes):

NameKeyTimeout
o3o3300s (thinking)
GPT-4ogpt-4o120s
GPT-4gpt-4120s
GPT-4.5gpt-4.5120s
o4-minio4-mini120s
o4-mini-higho4-mini-high300s (thinking)
Deep Researchdeep-research300s (thinking)

Data & Persistence

DataLocation
Browser statedata/browser_state/state.json
Chrome profiledata/browser_state/browser_profile/
Auth metadatadata/auth_info.json
Q&A historydata/history.json
Obsidian logs~/Documents/Obsidian Vault/ChatGPT/ChatGPT_YYYY-MM-DD.md

Troubleshooting

"Not authenticated"

python scripts/run.py auth_manager setup

Selectors broken (UI changed)

python scripts/run.py debug_selectors

This shows which selectors match and which are broken. Update config.py accordingly.

Model not found in menu

The model picker UI changes frequently. Run debug_selectors.py to see current button labels, then update MODEL_MAPPINGS in config.py.

Response timeout

  • Thinking models (o3, deep-research) have 300s timeout — this is normal
  • If standard models timeout, check that the stop button selector still works
  • Run debug_selectors.py to verify STOP_BUTTON_SELECTORS

ProseMirror typing issues

The skill uses page.keyboard.type() instead of element.fill() because ChatGPT's contenteditable div (ProseMirror) only processes real keyboard events. If typing fails, the input selector may have changed — check INPUT_SELECTORS in config.

Integration with Other Skills

Other skills can import ask_chatgpt directly:

import sys
sys.path.insert(0, str(Path.home() / ".claude/skills/chatgpt/scripts"))
from ask_question import ask_chatgpt

# Simple query
answer = ask_chatgpt("Analyze this argument: ...")

# With model selection
answer = ask_chatgpt("Deep analysis needed", model="o3")

# Skip history (for internal queries)
answer = ask_chatgpt("Quick check", no_history=True)

For multi-turn from code:

from conversation import ChatGPTSession

session = ChatGPTSession()
session.start(model="gpt-4o")
answer1 = session.ask("First question")
answer2 = session.ask("Follow-up based on your answer")
session.end()  # Saves all Q&A to history

Architecture Notes

  • Browser mode: Always visible (headless=False) — ChatGPT actively blocks headless
  • Browser pattern: launch_persistent_context — better fingerprint persistence than new_context
  • Input method: page.keyboard.type() — ProseMirror rejects fill() on contenteditable
  • Response detection: Dual algorithm (stop-button + text stability polling)
  • Auth expiry: 3 days (ChatGPT sessions expire faster than Google)
  • Config centralization: All selectors in config.py — single file to update on UI changes

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.