# antibot4navalny/metabot architecture

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

- Interactive diagram: https://gitdiagram.com/antibot4navalny/metabot
- Repository: https://github.com/antibot4navalny/metabot

## Overview

Metabot is a browser extension that highlights suspected bot accounts in Twitter posts. The principal workflow is: the extension refreshes legacy and manual account labels from GitHub, stores them locally, and the page script combines those labels with bundled labels to annotate matching tweets. Storage access is shared through a small helper. The README establishes the user-facing capability; the sampled source shows the refresh, storage, and page-marking behavior. Other declared files are unused or development-only and are omitted.

Main entry points: [`sources/metabot.js`](https://github.com/antibot4navalny/metabot/blob/master/sources/metabot.js) (Tweet annotator), [`sources/background.js`](https://github.com/antibot4navalny/metabot/blob/master/sources/background.js) (Label refresh), [`sources/common_impex.js`](https://github.com/antibot4navalny/metabot/blob/master/sources/common_impex.js) (Storage helper), [`assets/labels.json`](https://github.com/antibot4navalny/metabot/blob/master/assets/labels.json) (Bundled labels)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_label_updates["Label updates"]
  node_background["Label refresh<br/>[background.js]"]
end

subgraph group_extension_runtime["Extension runtime"]
  node_storage_helper["Storage helper<br/>[common_impex.js]"]
  node_local_storage[("Browser local storage")]
end

subgraph group_tweet_highlighting["Tweet highlighting"]
  node_page_script["Tweet annotator<br/>[metabot.js]"]
  node_bundled_labels["Bundled labels<br/>[labels.json]"]
end

node_user(("Twitter user"))
node_twitter_page["Twitter page"]
node_github_labels["GitHub label files"]

node_user -->|"views tweets"| node_twitter_page
node_twitter_page -->|"enables highlighting"| node_page_script
node_background -->|"fetches labels"| node_github_labels
node_background -->|"reads dates"| node_storage_helper
node_background -->|"writes labels"| node_local_storage
node_storage_helper -->|"reads values"| node_local_storage
node_page_script -->|"loads cached labels"| node_storage_helper
node_page_script -->|"loads labels"| node_bundled_labels
node_page_script -->|"marks matching tweets"| node_twitter_page

click node_background "https://github.com/antibot4navalny/metabot/blob/master/sources/background.js"
click node_storage_helper "https://github.com/antibot4navalny/metabot/blob/master/sources/common_impex.js"
click node_page_script "https://github.com/antibot4navalny/metabot/blob/master/sources/metabot.js"
click node_bundled_labels "https://github.com/antibot4navalny/metabot/blob/master/assets/labels.json"

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_background,node_user toneBlue
class node_storage_helper,node_local_storage toneAmber
class node_page_script,node_bundled_labels toneMint
class node_twitter_page,node_github_labels toneIndigo
```

## Components

### Label updates

- [Label refresh](https://github.com/antibot4navalny/metabot/blob/master/sources/background.js): `sources/background.js`

### Extension runtime

- [Storage helper](https://github.com/antibot4navalny/metabot/blob/master/sources/common_impex.js): `sources/common_impex.js`
- **Browser local storage**

### Tweet highlighting

- [Tweet annotator](https://github.com/antibot4navalny/metabot/blob/master/sources/metabot.js): `sources/metabot.js`
- [Bundled labels](https://github.com/antibot4navalny/metabot/blob/master/assets/labels.json): `assets/labels.json`

### Other components

- **Twitter user**
- **Twitter page**
- **GitHub label files**

## Connections

- Twitter user → Twitter page: views tweets (evidence: `README.md`)
- Twitter page → Tweet annotator: enables highlighting (evidence: `README.md`)
- Label refresh → GitHub label files: fetches labels (evidence: `sources/background.js`)
- Label refresh → Storage helper: reads dates (evidence: `sources/background.js`)
- Label refresh → Browser local storage: writes labels (evidence: `sources/background.js`)
- Storage helper → Browser local storage: reads values (evidence: `sources/common_impex.js`)
- Tweet annotator → Storage helper: loads cached labels (evidence: `sources/metabot.js`)
- Tweet annotator → Bundled labels: loads labels (evidence: `sources/metabot.js`)
- Tweet annotator → Twitter page: marks matching tweets (evidence: `sources/metabot.js`)
