본문으로 건너뛰기
cccskills
무료GitHub에 공개

scepticagent-architecture

ScepticAgent internal architecture reference. Use whenever the user asks how the extension works, wants to add a new AI provider, add a new highlight category, debug communication between components, understand the agent loop or streaming, or work with provider routing and the Gemini CORS proxy.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

연동 도구OpenAIGemini
설치 방법 보기

포함된 파일(1)

  • SKILL.md4.4 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

Communication flow

Side Panel (app.js)
  │  chrome.runtime.connect("agent") — one port per request
  ▼
Service Worker (background.js)
  │  fetch() to provider API
  ▼
AI Provider (Anthropic / OpenAI / Gemini)

Two parallel port connections fire on page open via Promise.all:

  1. streamViaPort("analyze") — full analysis with agent loop
  2. quickHighlightPage() — fast highlight scan

Port message types

MessageMeaning
{ type: "status", message }Progress label shown in UI
{ type: "tool_call", name, label }Tool being invoked
{ type: "text_delta", text }Streamed text chunk
{ type: "highlight_item", highlight, index }One highlight, emitted in real-time
{ type: "highlights_result", summary, categorySummaries }Final highlights metadata
{ type: "done" }Stream complete
{ type: "error", message }Error — stops streaming

Agent loop (Claude only)

runAgentLoop / runHighlightsAgentLoop — up to 12 iterations (4 for highlights). Stop reasons:

  • end_turn → break
  • pause_turn → continue (server-side web_search still running)
  • tool_use → run fetch_url, re-submit with results

Tools: web_search_20250305 (server-side, Anthropic-hosted), fetch_url (client-side, fetchUrl() in background.js).

Streaming parser

parseAgentStream(response, port, onTextDelta?) reads the Anthropic SSE stream. Optional onTextDelta callback intercepts text chunks — used by highlights to extract JSON objects in real-time via extractCompleteHighlights().

Real-time highlight extraction

extractCompleteHighlights(buffer, fromPos) — brace-depth character scanner that finds complete {"phrase":...} JSON objects in a mid-stream buffer without waiting for the full response. Returns { highlights, nextPos }.

Provider routing

getProviderConfig() reads provider, ${p}Key, ${p}Model from chrome.storage.local.

  • "anthropic" → full agent loop with tools
  • "openai" → runOpenAIStream — SSE streaming, no tools
  • "gemini" → runGeminiStream + geminiProxyFetch — non-streaming, proxied through content script

Gemini CORS proxy

Service workers send Origin: chrome-extension://[id] which Google's API rejects. Fix: geminiProxyFetch() sends the request to the content script via chrome.tabs.sendMessage. The content script fetches from the page's http/https origin, which Google accepts. Use Content-Type: text/plain + key as URL query param to avoid CORS preflight (simple request).

Settings storage keys

KeyDescription
provider"anthropic" / "openai" / "gemini"
anthropicKey / openaiKey / geminiKeyAPI keys
anthropicModel / openaiModel / geminiModelSelected model
apiKeyLegacy Anthropic key (still read for backwards compat)

Adding a new provider — checklist

  • Add const XXX_API_BASE constant in background.js
  • Add to getProviderConfig() key/model maps
  • Implement runXxxStream(port, apiKey, model, systemText, messages, signal)
  • Branch in handleAnalyze, handleChat, handleHighlights
  • Add provider tab to options/index.html and logic to options/app.js
  • Add API domain to host_permissions in manifest.json
  • Update CLAUDE.md and README.md

Adding a new highlight category — checklist

  • Add to LABELS object and add .ra-hl-{category} CSS rule in content.js
  • Add to CAT_META in sidepanel/app.js
  • Add .scan-pill.{cat}, .hl-dot.{cat}, .hl-item-dot.{cat}, .summary-bullet-{cat} in sidepanel/style.css
  • Add scan pill and legend entry in sidepanel/index.html
  • Add category description in buildHighlightsPrompt() in background.js
  • Update CLAUDE.md and README.md

Known limitations

  • Gemini: no streaming (generateContent only), no tool use, no real URLs in source_url
  • OpenAI: no tool use, single-turn only
  • Highlights agent loop: Claude only — non-Claude providers use handleHighlightsSimple
  • Page content: truncated to 8000–10000 chars before sending to AI

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Expert guidelines for Chrome extension development with Manifest V3, covering security, performance, and best practices

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

Maros112358/scepticagent22026년 3월 22일 업데이트

Use this skill when building applications with Gemini models, Gemini API, working with multimodal content (text, images, audio, video), implementing function calling, using structured outputs, or needing current model specifications. Covers SDK usage (google-genai for Python, @google/genai for JavaScript/TypeScript, com.google.genai:google-genai for Java, google.golang.org/genai for Go), model selection, and API capabilities.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

Maros112358/scepticagent22026년 3월 22일 업데이트

ScepticAgent AI prompt reference. Use whenever the user asks about the prompts, wants to change analysis behaviour, modify what the AI looks for, adjust highlight categories or scoring, understand what instructions are sent to the AI, or tune the output format of analysis or highlights.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

Maros112358/scepticagent22026년 3월 22일 업데이트

ScepticAgent packaging and Chrome Web Store publishing workflow. Use whenever the user wants to build the zip, package the extension, publish or submit to the Chrome Web Store, update the store listing, or deal with manifest/icon/permission requirements for publishing.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

Maros112358/scepticagent22026년 3월 22일 업데이트

ScepticAgent UI and styles reference. Use whenever the user wants to change the side panel UI, modify highlight colours, update the markdown renderer, work with CSS architecture, add or change category colours, or understand how the sidepanel renders analysis output.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

Maros112358/scepticagent22026년 3월 22일 업데이트

Searches multiple web sources, synthesizes findings, and produces cited research reports using delegated subagents. Use when the user asks to research a topic online, search the web, look something up, find current information, compare options, or produce a research report.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

Maros112358/scepticagent22026년 3월 22일 업데이트

Maros112358의 스킬 모두 보기

이 스킬의 문제 신고