# tjacquin42/koh-vibe architecture

> Architecture diagram of the GitHub repository tjacquin42/koh-vibe, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/tjacquin42/koh-vibe
- Repository: https://github.com/tjacquin42/koh-vibe

## Overview

Koh-Vibe is a macOS VS Code-family extension that brings Claude Code sessions from multiple projects and windows into one view. Claude Code hooks feed session events to a local spool; the extension normalizes and reduces those events, persists session state, and displays it in the session tree. Users can organize sessions, reopen or close conversations, configure chimes, and inspect usage. The README documents several behaviors whose detailed implementation was not sampled, so those branches are linked at the documented product level.

Main entry points: [`src/extension.ts`](https://github.com/tjacquin42/koh-vibe/blob/main/src/extension.ts) (Extension coordinator), [`src/spool/watcher.ts`](https://github.com/tjacquin42/koh-vibe/blob/main/src/spool/watcher.ts) (Event spool), [`src/ui/tree.ts`](https://github.com/tjacquin42/koh-vibe/blob/main/src/ui/tree.ts) (Session tree), [`src/usage/oauth.ts`](https://github.com/tjacquin42/koh-vibe/blob/main/src/usage/oauth.ts) (Anthropic usage API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["Event intake"]
  node_hooks["Hook installer<br/>[installer.ts]"]
  node_spool[("Event spool<br/>[watcher.ts]")]
  node_event_parser["Event parser<br/>[parse.ts]"]
  node_state_reducer["Session reducer<br/>[reduce.ts]"]
  node_session_store[("Session persistence<br/>[persist.ts]")]
end

subgraph group_sessions["Session lifecycle"]
  node_extension["Extension coordinator<br/>[extension.ts]"]
  node_session_scan["Session discovery<br/>[rescan.ts]"]
  node_transcripts["Transcript reader<br/>[reader.ts]"]
  node_closed_store[("Recently closed<br/>[model.ts]")]
  node_reopen["Reopen planner<br/>[reopen.ts]"]
  node_focus["Cross-window broker<br/>[broker.ts]"]
  node_close["Close workflow<br/>[close.ts]"]
end

subgraph group_workspace["View and filing"]
  node_session_tree["Session tree<br/>[tree.ts]"]
  node_session_labels["Session labels<br/>[labels.ts]"]
  node_group_model["Folder organization<br/>[model.ts]"]
  node_group_store[("Folder persistence<br/>[store.ts]")]
end

subgraph group_settings["Settings and sound"]
  node_settings_store[("Settings<br/>[model.ts]")]
  node_sound_player["Sound playback<br/>[player.ts]"]
  node_sound_library["Sound library<br/>[library.ts]"]
end

subgraph group_insights["Usage"]
  node_usage_view["Usage panel<br/>[usage-view.ts]"]
  node_usage_reader["Usage reader<br/>[reader.ts]"]
  node_oauth["Anthropic usage API<br/>[oauth.ts]"]
end

node_claude(("Claude Code"))
node_editor(("VS Code editor"))
node_anthropic(("Anthropic API<br/>external system"))

node_claude -->|"emits hooks"| node_hooks
node_hooks -->|"writes events"| node_spool
node_spool -->|"parses files"| node_event_parser
node_spool -->|"reduces events"| node_state_reducer
node_spool -->|"persists sessions"| node_session_store
node_editor -->|"hosts extension"| node_extension
node_extension -->|"rescans sessions"| node_session_scan
node_extension -->|"reads sessions"| node_session_store
node_extension -->|"reads transcript"| node_transcripts
node_extension -->|"refreshes view"| node_session_tree
node_session_tree -->|"gets labels"| node_session_labels
node_session_tree -->|"gets folder state"| node_group_model
node_extension -->|"updates folders"| node_group_store
node_group_store -->|"loads and saves"| node_group_model
node_extension -->|"tracks ended sessions"| node_closed_store
node_extension -->|"requests close"| node_close
node_close -->|"dispatches close"| node_focus
node_focus -->|"opens fallback terminal"| node_reopen
node_extension -->|"reopens conversation"| node_reopen
node_extension -->|"loads settings"| node_settings_store
node_extension -->|"plays chimes"| node_sound_player
node_sound_player -->|"lists library sounds"| node_sound_library
node_extension -->|"manages library"| node_sound_library
node_extension -->|"updates usage panel"| node_usage_view
node_usage_view -->|"loads usage"| node_usage_reader
node_usage_reader -->|"fetches measurements"| node_oauth
node_oauth -->|"reads credential"| node_claude
node_oauth -->|"requests usage"| node_anthropic
node_anthropic -->|"returns usage"| node_usage_reader

click node_hooks "https://github.com/tjacquin42/koh-vibe/blob/main/src/hooks/installer.ts"
click node_spool "https://github.com/tjacquin42/koh-vibe/blob/main/src/spool/watcher.ts"
click node_event_parser "https://github.com/tjacquin42/koh-vibe/blob/main/src/events/parse.ts"
click node_state_reducer "https://github.com/tjacquin42/koh-vibe/blob/main/src/store/reduce.ts"
click node_session_store "https://github.com/tjacquin42/koh-vibe/blob/main/src/spool/persist.ts"
click node_extension "https://github.com/tjacquin42/koh-vibe/blob/main/src/extension.ts"
click node_session_scan "https://github.com/tjacquin42/koh-vibe/blob/main/src/claude/rescan.ts"
click node_transcripts "https://github.com/tjacquin42/koh-vibe/blob/main/src/transcript/reader.ts"
click node_closed_store "https://github.com/tjacquin42/koh-vibe/blob/main/src/closed/model.ts"
click node_reopen "https://github.com/tjacquin42/koh-vibe/blob/main/src/closed/reopen.ts"
click node_focus "https://github.com/tjacquin42/koh-vibe/blob/main/src/focus/broker.ts"
click node_close "https://github.com/tjacquin42/koh-vibe/blob/main/src/close/close.ts"
click node_session_tree "https://github.com/tjacquin42/koh-vibe/blob/main/src/ui/tree.ts"
click node_session_labels "https://github.com/tjacquin42/koh-vibe/blob/main/src/ui/labels.ts"
click node_group_model "https://github.com/tjacquin42/koh-vibe/blob/main/src/groups/model.ts"
click node_group_store "https://github.com/tjacquin42/koh-vibe/blob/main/src/groups/store.ts"
click node_settings_store "https://github.com/tjacquin42/koh-vibe/blob/main/src/settings/model.ts"
click node_sound_player "https://github.com/tjacquin42/koh-vibe/blob/main/src/sound/player.ts"
click node_sound_library "https://github.com/tjacquin42/koh-vibe/blob/main/src/sound/library.ts"
click node_usage_view "https://github.com/tjacquin42/koh-vibe/blob/main/src/ui/usage-view.ts"
click node_usage_reader "https://github.com/tjacquin42/koh-vibe/blob/main/src/usage/reader.ts"
click node_oauth "https://github.com/tjacquin42/koh-vibe/blob/main/src/usage/oauth.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_hooks,node_spool,node_event_parser,node_state_reducer,node_session_store toneBlue
class node_extension,node_session_scan,node_transcripts,node_closed_store,node_reopen,node_focus,node_close toneAmber
class node_session_tree,node_session_labels,node_group_model,node_group_store,node_anthropic toneMint
class node_settings_store,node_sound_player,node_sound_library toneRose
class node_usage_view,node_usage_reader,node_oauth,node_claude,node_editor toneIndigo
```

## Components

### Event intake

- [Hook installer](https://github.com/tjacquin42/koh-vibe/blob/main/src/hooks/installer.ts): `src/hooks/installer.ts`
- [Event spool](https://github.com/tjacquin42/koh-vibe/blob/main/src/spool/watcher.ts): `src/spool/watcher.ts`
- [Event parser](https://github.com/tjacquin42/koh-vibe/blob/main/src/events/parse.ts): `src/events/parse.ts`
- [Session reducer](https://github.com/tjacquin42/koh-vibe/blob/main/src/store/reduce.ts): `src/store/reduce.ts`
- [Session persistence](https://github.com/tjacquin42/koh-vibe/blob/main/src/spool/persist.ts): `src/spool/persist.ts`

### Session lifecycle

- [Extension coordinator](https://github.com/tjacquin42/koh-vibe/blob/main/src/extension.ts): `src/extension.ts`
- [Session discovery](https://github.com/tjacquin42/koh-vibe/blob/main/src/claude/rescan.ts): `src/claude/rescan.ts`
- [Transcript reader](https://github.com/tjacquin42/koh-vibe/blob/main/src/transcript/reader.ts): `src/transcript/reader.ts`
- [Recently closed](https://github.com/tjacquin42/koh-vibe/blob/main/src/closed/model.ts): `src/closed/model.ts`
- [Reopen planner](https://github.com/tjacquin42/koh-vibe/blob/main/src/closed/reopen.ts): `src/closed/reopen.ts`
- [Cross-window broker](https://github.com/tjacquin42/koh-vibe/blob/main/src/focus/broker.ts): `src/focus/broker.ts`
- [Close workflow](https://github.com/tjacquin42/koh-vibe/blob/main/src/close/close.ts): `src/close/close.ts`

### View and filing

- [Session tree](https://github.com/tjacquin42/koh-vibe/blob/main/src/ui/tree.ts): `src/ui/tree.ts`
- [Session labels](https://github.com/tjacquin42/koh-vibe/blob/main/src/ui/labels.ts): `src/ui/labels.ts`
- [Folder organization](https://github.com/tjacquin42/koh-vibe/blob/main/src/groups/model.ts): `src/groups/model.ts`
- [Folder persistence](https://github.com/tjacquin42/koh-vibe/blob/main/src/groups/store.ts): `src/groups/store.ts`

### Settings and sound

- [Settings](https://github.com/tjacquin42/koh-vibe/blob/main/src/settings/model.ts): `src/settings/model.ts`
- [Sound playback](https://github.com/tjacquin42/koh-vibe/blob/main/src/sound/player.ts): `src/sound/player.ts`
- [Sound library](https://github.com/tjacquin42/koh-vibe/blob/main/src/sound/library.ts): `src/sound/library.ts`

### Usage

- [Usage panel](https://github.com/tjacquin42/koh-vibe/blob/main/src/ui/usage-view.ts): `src/ui/usage-view.ts`
- [Usage reader](https://github.com/tjacquin42/koh-vibe/blob/main/src/usage/reader.ts): `src/usage/reader.ts`
- [Anthropic usage API](https://github.com/tjacquin42/koh-vibe/blob/main/src/usage/oauth.ts): `src/usage/oauth.ts`

### Other components

- **Claude Code**
- **VS Code editor**
- **Anthropic API**: external system

## Connections

- Claude Code → Hook installer: emits hooks (evidence: `README.md`)
- Hook installer → Event spool: writes events (evidence: `README.md`)
- Event spool → Event parser: parses files (evidence: `src/spool/watcher.ts`)
- Event spool → Session reducer: reduces events (evidence: `src/spool/watcher.ts`)
- Event spool → Session persistence: persists sessions (evidence: `src/spool/watcher.ts`)
- VS Code editor → Extension coordinator: hosts extension (evidence: `README.md`)
- Extension coordinator → Session discovery: rescans sessions (evidence: `src/extension.ts`)
- Extension coordinator → Session persistence: reads sessions (evidence: `src/extension.ts`)
- Extension coordinator → Transcript reader: reads transcript (evidence: `src/extension.ts`)
- Extension coordinator → Session tree: refreshes view (evidence: `src/extension.ts`)
- Session tree → Session labels: gets labels (evidence: `src/ui/tree.ts`)
- Session tree → Folder organization: gets folder state (evidence: `src/ui/tree.ts`)
- Extension coordinator → Folder persistence: updates folders (evidence: `src/extension.ts`)
- Folder persistence → Folder organization: loads and saves (evidence: `src/groups/store.ts`)
- Extension coordinator → Recently closed: tracks ended sessions (evidence: `src/extension.ts`)
- Extension coordinator → Close workflow: requests close (evidence: `src/extension.ts`)
- Close workflow → Cross-window broker: dispatches close (evidence: `src/close/close.ts`)
- Cross-window broker → Reopen planner: opens fallback terminal (evidence: `src/focus/broker.ts`)
- Extension coordinator → Reopen planner: reopens conversation (evidence: `src/extension.ts`)
- Extension coordinator → Settings: loads settings (evidence: `src/extension.ts`)
- Extension coordinator → Sound playback: plays chimes (evidence: `README.md`)
- Sound playback → Sound library: lists library sounds (evidence: `src/sound/player.ts`)
- Extension coordinator → Sound library: manages library (evidence: `src/extension.ts`)
- Extension coordinator → Usage panel: updates usage panel (evidence: `src/extension.ts`)
- Usage panel → Usage reader: loads usage (evidence: `src/ui/usage-view.ts`)
- Usage reader → Anthropic usage API: fetches measurements (evidence: `src/usage/reader.ts`)
- Anthropic usage API → Claude Code: reads credential (evidence: `README.md`)
- Anthropic usage API → Anthropic API: requests usage (evidence: `src/usage/oauth.ts`)
- Anthropic API → Usage reader: returns usage
