Skip to content

amolgorithm/kitsune

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

38 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Kitsune Browser

An AI-native, RAM-efficient browser built on Electron + React + TS.
Developed for absolutely no purpose.


Architecture Overview

kitsune/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ main/                        # Electron main process (Node.js)
β”‚   β”‚   β”œβ”€β”€ index.ts                 # App bootstrap, window creation
β”‚   β”‚   β”œβ”€β”€ preload.ts               # Secure contextBridge (IPC surface)
β”‚   β”‚   β”œβ”€β”€ services/
β”‚   β”‚   β”‚   β”œβ”€β”€ TabManager.ts        # BrowserView pool, tab lifecycle
β”‚   β”‚   β”‚   β”œβ”€β”€ HibernationScheduler.ts  # Background RAM manager
β”‚   β”‚   β”‚   β”œβ”€β”€ PrivacyEngine.ts     # Tracker/ad blocking, fingerprint guard
β”‚   β”‚   β”‚   β”œβ”€β”€ AIService.ts         # Anthropic SDK: summaries, chat, clustering
β”‚   β”‚   β”‚   β”œβ”€β”€ WorkspaceManager.ts  # Workspaces + tab groups
β”‚   β”‚   β”‚   β”œβ”€β”€ CleaveManager.ts     # Split-pane layout tree
β”‚   β”‚   β”‚   β”œβ”€β”€ CommandEngine.ts     # Macro/alias/program/scheduled command system
β”‚   β”‚   β”‚   β”œβ”€β”€ CommandExecutorImpl.ts  # All executable command implementations
β”‚   β”‚   β”‚   └── SettingsStore.ts     # electron-store backed persistent settings
β”‚   β”‚   └── ipc/
β”‚   β”‚       β”œβ”€β”€ tabIPC.ts            # Tab lifecycle handlers
β”‚   β”‚       β”œβ”€β”€ aiIPC.ts             # AI feature handlers
β”‚   β”‚       β”œβ”€β”€ privacyIPC.ts        # Privacy report handlers
β”‚   β”‚       β”œβ”€β”€ workspaceIPC.ts      # Workspace + group handlers
β”‚   β”‚       β”œβ”€β”€ cleaveIPC.ts         # Layout handlers
β”‚   β”‚       β”œβ”€β”€ commandIPC.ts        # Command engine handlers
β”‚   β”‚       └── settingsIPC.ts       # Settings read/write handlers
β”‚   β”‚
β”‚   β”œβ”€β”€ renderer/                    # React renderer process
β”‚   β”‚   β”œβ”€β”€ App.tsx                  # Root component, hotkey wiring
β”‚   β”‚   β”œβ”€β”€ main.tsx                 # ReactDOM entry
β”‚   β”‚   β”œβ”€β”€ lib/
β”‚   β”‚   β”‚   └── ipc.ts               # Typed IPC client (window.kitsune)
β”‚   β”‚   β”œβ”€β”€ stores/
β”‚   β”‚   β”‚   └── browserStore.ts      # Zustand store β€” all renderer state
β”‚   β”‚   β”œβ”€β”€ styles/
β”‚   β”‚   β”‚   β”œβ”€β”€ tokens.css           # Design system CSS custom properties
β”‚   β”‚   β”‚   β”œβ”€β”€ global.css           # Resets, animations, utilities
β”‚   β”‚   β”‚   └── lenses.css           # Per-lens CSS overrides
β”‚   β”‚   └── components/
β”‚   β”‚       β”œβ”€β”€ Sidebar/             # Vertical tab list, workspaces, groups
β”‚   β”‚       β”‚   β”œβ”€β”€ Sidebar.tsx
β”‚   β”‚       β”‚   β”œβ”€β”€ TabItem.tsx      # Single tab row with badges, close btn
β”‚   β”‚       β”‚   └── TabGroupHeader.tsx
β”‚   β”‚       β”œβ”€β”€ Navbar/              # URL bar, nav buttons, security badge
β”‚   β”‚       β”‚   └── Navbar.tsx
β”‚   β”‚       β”œβ”€β”€ LensBar/             # Lens profile switcher
β”‚   β”‚       β”‚   └── LensBar.tsx
β”‚   β”‚       β”œβ”€β”€ ContentArea/         # WebView bounds + NewTabPage
β”‚   β”‚       β”‚   β”œβ”€β”€ ContentArea.tsx
β”‚   β”‚       β”‚   └── NewTabPage.tsx
β”‚   β”‚       β”œβ”€β”€ AIPanel/             # AI sidebar: summary/research/notes/tasks/chat
β”‚   β”‚       β”‚   └── AIPanel.tsx
β”‚   β”‚       β”œβ”€β”€ CommandPalette/      # ⌘K fuzzy command & tab search
β”‚   β”‚       β”‚   └── CommandPalette.tsx
β”‚   β”‚       β”œβ”€β”€ CommandREPL/         # ⌘` programmable browser console
β”‚   β”‚       β”‚   └── CommandREPL.tsx
β”‚   β”‚       β”œβ”€β”€ MacroEditor/         # Macro/alias/program/scheduler UI
β”‚   β”‚       β”‚   └── MacroEditor.tsx
β”‚   β”‚       β”œβ”€β”€ Cleave/              # ⌘\ split-pane layout manager
β”‚   β”‚       β”‚   └── CleaveOverlay.tsx
β”‚   β”‚       β”œβ”€β”€ Settings/            # Full settings modal
β”‚   β”‚       β”‚   └── SettingsModal.tsx
β”‚   β”‚       β”œβ”€β”€ StatusBar/           # Memory, tab count, AI, risk
β”‚   β”‚       β”‚   └── StatusBar.tsx
β”‚   β”‚       └── HotkeyBar/           # Always-visible hotkey reference
β”‚   β”‚           └── HotkeyBar.tsx
β”‚   β”‚
β”‚   └── shared/                      # Isomorphic β€” used by both processes
β”‚       β”œβ”€β”€ types.ts                 # All TypeScript types and interfaces
β”‚       β”œβ”€β”€ commandTypes.ts          # Command catalog types
β”‚       └── constants.ts             # App-wide constants
β”‚
β”œβ”€β”€ index.html                       # Vite HTML entry point
β”œβ”€β”€ vite.config.ts                   # Vite + Electron plugin config
β”œβ”€β”€ tsconfig.json
└── package.json

Tech Stack

Layer Technology Why
Runtime Electron 31 Chromium engine, cross-platform, BrowserView API
UI Framework React 18 + TypeScript Component model, concurrent rendering
Build Vite 5 + vite-plugin-electron Fast HMR, ESM, tree-shaking
State Zustand + Immer Minimal, fast, no boilerplate
AI HackClub AI proxy (OpenAI-compatible) Free, no account, frontier models
Persistence electron-store Typed, schema-validated settings
Styling CSS Modules + custom properties Zero runtime, scoped, themeable

Features Implemented

πŸ—‚ Smart Tab Manager

  • BrowserView pool β€” each tab is a real Chromium BrowserView, not an iframe
  • Hibernation Scheduler β€” background timer checks idle time every 30s; discards webContents to free RAM while preserving tab state
  • Memory pressure mode β€” if total tab memory exceeds threshold, hibernation threshold halves
  • Wake on activate β€” tabs reload transparently when clicked
  • Tab groups β€” color-coded, collapsible; AI-managed groups tagged with ✦
  • Resizable sidebar β€” drag the right edge to resize; snaps to icon-rail mode at minimum width, persisted across sessions

πŸ€– AI Panel (HackClub AI proxy)

  • Page Summarizer β€” auto-triggers on page load; returns key points, stats, and reference links as structured JSON
  • Cross-page Research β€” synthesizes N open tabs into a single cited document
  • Chat β€” full conversation with page context injected; streaming-ready API
  • Task Extractor β€” parses highlighted text into structured to-dos
  • Tab Clusterer β€” asks AI to group all open tabs into labelled categories
  • Pre-load Risk Scorer β€” URL-only heuristic before navigation

⌨️ Command REPL

See the full REPL documentation below.

πŸ›‘ Privacy Engine

  • Request filter β€” session.webRequest.onBeforeRequest intercepts all network requests
  • Domain blocklist β€” seeded with common trackers; designed to fetch EasyList/uBlock at startup
  • AI heuristic patterns β€” regex matching for novel trackers not on any list
  • Fingerprint guard β€” Permissions-Policy headers; canvas/WebGL injection points wired
  • Per-tab block reports β€” track what was blocked per tab for the UI shield badge

⧉ Cleave

  • Split modes: horizontal, vertical, AI-beside, triple, by-workspace, by-group
  • PaneNode tree β€” recursive layout structure; serialize/deserialize for persistence
  • Preview SVGs β€” every mode has a visual diagram before you apply it
  • Hotkey-driven β€” full keyboard support, single key per split mode

🎨 Lens Profiles

  • 5 built-in lenses: Default, Research, Coding, Reading, Creative
  • Each lens sets: accent color, default AI tab, reader mode, font override
  • CSS-based overrides β€” zero JS overhead at runtime
  • Custom lens creation scaffolded (UI in Settings, creation flow TBD)

⌨ Command Palette (⌘K)

  • Fuzzy search across: commands, open tabs, lens profiles, AI actions
  • Keyboard navigation: ↑↓ to move, ↡ to execute, esc to dismiss
  • Grouped by category with hotkey hints

πŸ–₯ Command REPL

Open with **⌘** (or Ctrl+Shift+;`). Kitsune ships a full programmable console β€” think Neovim's command mode but for your browser. Every browser action is a typed command you can invoke, automate, and chain.

Opening the REPL

Method Shortcut
Keyboard ⌘\`` / Ctrl+``
Keyboard (alt) βŒ˜β‡§; / Ctrl+Shift+;
Settings β†’ Macros Click "open REPL" link

Command Syntax

Commands follow a simple command.subcommand key=value format:

tab.create url=https://github.com
tab.openMany urls=https://a.com,https://b.com delay=300
ai.chat message="Summarize this page"
lens.set research
memory.hibernate.threshold minutes=5
system.volume.set 50
js.eval code="document.title"

Positional arguments also work for simple commands:

workspace.switch research
tab.closeMatching pattern=stackoverflow

Built-in Aliases

Aliases expand short strings into full commands before execution. Several are seeded by default:

Alias Expands to
:nt tab.create url=kitsune://newtab
:ct tab.close
:hi tab.hibernateAll
:ai ai.panel.toggle
:rw workspace.program research-workspace
:fs ui.fileSearch
:cp ui.commandPalette

Create your own:

alias :gh tab.create url=https://github.com
alias :morning macro run morning-session

Command Categories

Tabs β€” tab.create, tab.close, tab.restore, tab.navigate, tab.activate, tab.hibernate, tab.hibernateAll, tab.wake, tab.wakeAll, tab.list, tab.reload, tab.reloadAll, tab.pin, tab.unpin, tab.duplicate, tab.openMany, tab.closeMatching, tab.focusMatching, tab.memory, tab.goBack, tab.goForward

Workspaces β€” workspace.create, workspace.switch, workspace.list, workspace.program, workspace.closeAll, group.create, group.delete, group.aiCluster

AI β€” ai.summarize, ai.chat, ai.cluster, ai.riskScore, ai.extractTasks, ai.panel.toggle, ai.panel.open, ai.panel.close, ai.panel.tab

Lenses β€” lens.set, lens.restore, lens.list

Privacy β€” privacy.report, privacy.blocklist, privacy.enable, privacy.disable

Memory β€” memory.report, memory.save, memory.threshold.set, memory.hibernate.threshold

System (OS-level) β€” system.volume.set, system.volume.mute, system.volume.unmute, system.notify, system.app.focus, system.screenshot, system.exec, system.idle

UI β€” ui.commandPalette, ui.settings, ui.fileSearch, ui.cleave, ui.focusUrlBar, ui.zoom.in, ui.zoom.out, ui.zoom.reset, ui.fullscreen, ui.sidebar.toggle, ui.readingMode

Page / JS β€” js.eval, js.inject, page.scroll, page.scrollTop, page.scrollBottom, page.getText, page.getTitle, page.getUrl, page.click, page.find

Settings β€” settings.set, settings.get, settings.reset, settings.theme, settings.ai.toggle

Chain Mode

Chain multiple commands together into a single execution:

chain
  tab.create url=https://google.com
  tab.create url=https://github.com
  ai.panel.open
  lens.set research
:run

Type :cancel to abort a chain in progress.

You can also run chains directly from the IPC layer:

CommandIPC.runChain([
  'tab.create url=https://news.ycombinator.com',
  'ai.summarize',
])

Macros

Macros are named sequences of commands that can be saved, edited, and run by name or alias. They support per-step delays, conditions, and error handling.

Running a macro:

macro run morning-session
:morning          ← via alias

Built-in macros:

Name Alias What it does
morning-session :morning Opens email, calendar, HN, AI panel
hibernate-and-save :save Hibernates background tabs, shows memory report
ai-research-mode :research Switches to Research lens, opens AI panel on Research tab

Creating a macro β€” open Settings β†’ Macros & Automation, click "+ New Macro", and write steps one per line in command syntax. Or use the REPL sidebar's Macros tab to run, edit, and delete them.

Workspace Programs

Programs open a curated set of tabs in a new or existing workspace, optionally with pre-defined groups and AI clustering after load.

workspace.program research-workspace
workspace.program dev-workspace

Built-in programs:

research-workspace β€” creates a "Research" workspace with Scholar, Semantic Scholar, arXiv, Connected Papers, and a scratch tab. AI-clusters after load.

dev-workspace β€” creates a "Dev" workspace with GitHub, MDN, Stack Overflow, and a scratch tab.

Scheduled Commands

Commands can run automatically on a timer. Create them in Settings β†’ Macros & Automation β†’ Scheduled, or via the IPC:

CommandIPC.createScheduled({
  name: 'hourly-hibernation',
  command: 'tab.hibernateAll',
  schedule: { type: 'interval', intervalMs: 3600000 },
  enabled: true,
})

History and Undo

The REPL keeps a rolling history of the last 500 commands. Navigate with ↑/↓ in the input. The Undo system (cmd:undo) reverses the last undoable action by mapping commands to their anti-commands (e.g. tab.create β†’ tab.close, lens.set β†’ lens.restore).

Autocomplete

Press Tab to cycle through suggestions. The autocomplete engine searches across all registered commands, user-defined aliases, and saved macros simultaneously, ranked by prefix match. Suggestions display category, argument signature, and description in a compact overlay above the input.

REPL Sidebar

The left panel has four tabs:

  • Commands β€” filterable, categorized list of every available command; click to insert into the input
  • Macros β€” all saved macros with run/edit actions
  • Aliases β€” all current aliases; click to insert the short form
  • History β€” input history in reverse chronological order; click to re-run

Getting Started

Prerequisites

  • Node.js β‰₯ 20
  • npm β‰₯ 10

Install

cd kitsune
npm install

Development

npm run dev

This starts Vite dev server + Electron simultaneously with hot reload.

Build

npm run electron:build

Produces a native installer in release/.

Configure AI

Open Settings (⌘,) β†’ AI & Intelligence β†’ paste a HackClub API key from ai.hackclub.com.

Or set it via environment variable before launching:

ANTHROPIC_API_KEY=sk-hc-v1-... npm run dev

Hotkeys

Hotkey Action
⌘K Command palette
`⌘`` Command REPL
⌘T New tab
⌘W Close active tab
⌘\ Cleave (split layout)
βŒ˜β‡§A Toggle AI panel
βŒ˜β‡§F File search
βŒ˜β‡§R Reading mode
⌘, Settings
βŒƒ1 Default lens
βŒƒ2 Research lens
βŒƒ3 Coding lens
βŒƒ4 Reading lens

Roadmap / TODO

  • kitsune://newtab internal page renderer (protocol handler)
  • Horizontal tab bar mode (toggle in settings)
  • ResizablePanels integration for live Cleave layouts
  • Universal File Search (PDF/DOCX/email indexing with local embeddings)
  • AI Humanizer extension (human-like typing automation)
  • Meeting Prep: email + calendar + tab synthesis
  • Developer Lens: integrated DevTools panel, console in sidebar
  • AI Workflow Chains: multi-step automation with visible "trail"
  • Sync (encrypted) across devices
  • Extension support (Manifest V3 compatible)
  • LibreWolf-equivalent: integrate uBlock Origin engine natively
  • REPL hotkey remapping
  • Macro import/export (JSON)

Security Model

  • Context isolation: renderer has zero Node.js access; all syscalls go through contextBridge
  • Sandboxed webContents: every tab runs in a sandboxed BrowserView
  • Private tabs: ephemeral partition sessions, never touch disk
  • No remote content in chrome UI: the browser shell itself loads only local assets
  • Tracker blocking at network layer: session.webRequest blocks before TCP connects
  • CSP on chrome window: strict Content-Security-Policy header on the renderer HTML

License

MIT β€” build on it, ship it, make it yours.

About

browser.

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors