Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# CLAUDE.md — GroupThink

LLM-powered tab grouping Chrome extension. Groups browser tabs by topic and intent using Claude, displayed in a zoomable d3 treemap.
LLM-powered tab grouping Chrome extension. Groups browser tabs by topic and intent using Claude or local models via Ollama, displayed in a zoomable d3 treemap.

## Commands

Expand Down Expand Up @@ -40,7 +40,7 @@ src/
SpecificitySlider.tsx 1–10 granularity control
TabCard.tsx, TabGroup.tsx, GroupGrid.tsx Legacy grid components (unused by treemap)
lib/
ai.ts Anthropic SDK wrapper — groupTabs, sweepUncategorized, refineGrouping
ai.ts LLM client layer (Anthropic + Ollama) — groupTabs, sweepUncategorized, refineGrouping
prompts.ts System prompt + per-call prompt builders
grouping.ts flattenForSpecificity, shouldRePrompt, moveTab, mergeStepResults, mergeSmallGroups
treemap-layout.ts d3-hierarchy layout engine — computeUnifiedLayout
Expand All @@ -58,7 +58,7 @@ src/

## Key invariants

- `ai.ts` (Anthropic SDK) is **only imported in `src/background/index.ts`** — never in app/components
- `ai.ts` (LLM client layer) is **only imported in `src/background/index.ts`** — never in app/components
- App communicates with background via `chrome.runtime.sendMessage`
- Cache-first loading: app shows cached grouping instantly on mount; regrouping only fires on explicit user action (Refresh, slider, chat)
- No silent refresh mid-navigation — avoids swapping groups while user is focused inside one
Expand All @@ -71,15 +71,17 @@ src/
```json
{
"ANTHROPIC_API_KEY": "sk-ant-...",
"ANTHROPIC_MODEL": "claude-sonnet-4-20250514"
"ANTHROPIC_MODEL": "claude-sonnet-4-20250514",
"OLLAMA_BASE_URL": "http://localhost:11434",
"OLLAMA_MODEL": "llama3"
}
```

`scripts/inject-env.js` reads this at build time and writes `src/lib/env.ts`. The background service worker auto-configures on install.

## Things NOT to do

- Do not import AI SDK or `ai.ts` outside of `src/background/`
- Do not import LLM client (`ai.ts`) outside of `src/background/`
- Do not fire silent grouping refresh from the cache-hit path
- Do not create domain-based tab groups (no "YouTube", "GitHub" groups) — always topic-based
- Do not skip tab ID deduplication when building layout segments
Expand Down