RuleStack

Configs

Stacks

Compare

Diff

RuleStack

Configs

Stacks

Compare

Diff

Read API

RuleStack

Configs

Stacks

Compare

Diff

Read API

Configs/Cline rules/cline/cline

Cline rules

.clinerules/storage.md
Cline rules

Quality

65/100

Scores the file, not the repository.

Length

316 words

9 headings · 2 code blocks

Repository

66k

— · pushed 0 days ago

Last changed

3 days ago

First indexed 3 days ago.
cline/cline/.clinerules/storage.mdRawGitHub
1# Storage Architecture
2 
3Global settings, secrets and workspace state are stored in **file-backed JSON stores** under `~/.cline/data/`. This is the shared storage layer used by VSCode, CLI, and JetBrains.
4 
5## Key Abstractions
6 
7### `StorageContext` (src/shared/storage/storage-context.ts)
8The entry point. Created via `createStorageContext()` and passed to `StateManager.initialize()`. Contains three `ClineFileStorage` instances:
9- `globalState` → `~/.cline/data/globalState.json`
10- `secrets` → `~/.cline/data/secrets.json` (mode 0o600)
11- `workspaceState` → `~/.cline/data/workspaces/<hash>/workspaceState.json`
12 
13### `ClineFileStorage` (src/shared/storage/ClineFileStorage.ts)
14Synchronous JSON key-value store backed by a single file. Supports `get()`, `set()`, `setBatch()`, `delete()`. Writes are atomic (write-then-rename).
15 
16### `StateManager` (src/core/storage/StateManager.ts)
17In-memory cache on top of `StorageContext`. All runtime reads hit the cache; writes update cache immediately and debounce-flush to disk.
18 
19## ⚠️ Do NOT Use VSCode's ExtensionContext for Storage
20 
21**Do not** read from or write to `context.globalState`, `context.workspaceState`, or `context.secrets` for persistent data. These are VSCode-specific and not available on CLI or JetBrains.
22 
23Instead, use:
24```typescript
25// Reading state
26StateManager.get().getGlobalStateKey("myKey")
27StateManager.get().getSecretKey("mySecretKey")
28StateManager.get().getWorkspaceStateKey("myWsKey")
29 
30// Writing state
31StateManager.get().setGlobalState("myKey", value)
32StateManager.get().setSecret("mySecretKey", value)
33StateManager.get().setWorkspaceState("myWsKey", value)
34```
35 
36Remember that your data may be read by a different client than the one that wrote it. For example, a value written by Cline in JetBrains may be read by Cline CLI.
37 
38## VSCode Migration (src/hosts/vscode/vscode-to-file-migration.ts)
39 
40On VSCode startup, a migration copies data from VSCode's `ExtensionContext` storage into the file-backed stores. This runs in `src/common.ts` before `StateManager.initialize()`.
41 
42- **Sentinel**: `__vscodeMigrationVersion` key in global state and workspace state — prevents re-migration.
43- **Merge strategy**: File store wins. Existing values are never overwritten.
44- **Safe downgrade**: VSCode storage is NOT cleared, so older extension versions still work.
45 
46## Adding New Storage Keys
47 
481. Add to `src/shared/storage/state-keys.ts` (see existing patterns)
492. Read/write via `StateManager` (NOT via `context.globalState`)
503. If adding a secret, add to `SecretKeys` array in `state-keys.ts`
51 
52## File Layout
53 
54```
55~/.cline/
56 data/
57 globalState.json # Global settings & state
58 secrets.json # API keys (mode 0o600)
59 tasks/
60 taskHistory.json # Task history (separate file)
61 workspaces/
62 <hash>/
63 workspaceState.json # Per-workspace toggles
64```
65 

Sections

  • Storage Architecture
  • Key Abstractions
  • `StorageContext` (src/shared/storage/storage-context.ts)
  • `ClineFileStorage` (src/shared/storage/ClineFileStorage.ts)
  • `StateManager` (src/core/storage/StateManager.ts)
  • ⚠️ Do NOT Use VSCode's ExtensionContext for Storage
  • VSCode Migration (src/hosts/vscode/vscode-to-file-migration.ts)
  • Adding New Storage Keys
  • File Layout

What it covers

code-stylearchitecturedatabasedo-not

Stack — with the evidence

typescript

(1.00)

node

(1.00)

vitest

(1.00)

react

(0.70)

nextjs

(0.70)

tailwind

(0.70)

vite

(0.70)

eslint

(0.70)

vercel

(0.70)

desktop-app

(0.70)

javascript

(0.60)

bun

(0.60)

biome

(0.60)

github-actions

(0.60)

Format

Cline rules

A single file or a folder of files, all always-on. The folder form is the simplest way any format here lets you split rules into topics without also learning an activation model.

What the corpus says about it

Repository

Owner
cline
Language
—
License
—
Archived
no

All configs in this repo

Also in cline/cline

Diff this repo’s formats

One repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?

The other instruction files in this repository
RepositoryFormatStackCoversScoreChanged
cline/cline.clinerules/bun-and-node.md · 66kCline rulestypescriptnode+12setuptestmonorepodo-not74/1003 days ago
cline/cline.clinerules/cline-overview.md · 66kCline rulestypescriptnode+12archtypesapi54/1003 days ago
cline/cline.clinerules/debug-harness.md · 66kCline rulestypescriptnode+12buildtesttesting-strategysecurity+185/1003 days ago
cline/cline.clinerules/general.md · 66kCline rulestypescriptnode+12setupbuildstylearch+286/1003 days ago
cline/cline.clinerules/network.md · 66kCline rulestypescriptnode+12styletesting-strategydependencies54/1003 days ago
cline/cline.clinerules/protobuf-development.md · 66kCline rulestypescriptnode+12buildstylearchapi+174/1003 days ago
cline/cline.clinerules/sdk-migration.md · 66kCline rulestypescriptnode+12style59/1003 days ago
cline/cline.github/copilot-instructions.md · 66kCopilot instructionstypescriptnode+12buildteststyleapi+175/1003 days ago
cline/clineAGENTS.md · 66kAGENTS.mdtypescriptnode+13buildtestlint-formatstyle+283/1003 days ago
cline/clinesdk/AGENTS.md · 66kAGENTS.mdtypescriptnode+12setupbuildteststyle+589/1003 days ago
cline/clinesdk/packages/llms/AGENTS.md · 66kAGENTS.mdtypescriptnode+12no sections45/1003 days ago
Diff against .clinerules/bun-and-node.md Diff against .clinerules/cline-overview.md Diff against .clinerules/debug-harness.md Diff against .clinerules/general.md Diff against .clinerules/network.md Diff against .clinerules/protobuf-development.md Diff against .clinerules/sdk-migration.md Diff against .github/copilot-instructions.md Diff against AGENTS.md Diff against sdk/AGENTS.md Diff against sdk/packages/llms/AGENTS.md

Similar configs

Same format, overlapping stack, ranked by quality.

Same format, overlapping stack, ranked by quality
RepositoryFormatStackCoversScoreChanged
bashdeban/fastmind.clinerules/.project-consistency-keeper2.md · 5Cline rulestypescriptnode+8setupbuildtestlint-format+11100/1003 days ago
JCodesMore/ai-website-cloner-template.clinerules · 31kCline rulestypescriptnode+7buildlint-formatstylearch+397/1002 days ago
BryaanF/LiantPortfolio.clinerules/project-guidelines.md · 0Cline rulesjavascripttailwind+5buildstylearchgit+296/1003 days ago
u9401066/zotero-keeper.clinerules/50-pubmed-project.md · 6Cline rulespytestruff+6testlint-formatstylearch+194/1003 days ago
u9401066/zotero-keepervscode-extension/resources/repo-assets/pubmed-search-mcp/.clinerules/50-pubmed-project.md · 6Cline rulespytestruff+6testlint-formatstylearch+194/1003 days ago
VaillerTeeter/HoshimiNest.clinerules/project-identity.md · 1Cline rulestypescriptvite+4setuparchtypesdo-not93/100yesterday
HerringtonDarkholme/megarepo.clinerules/02-development.md · 17Cline rulesnodejavascriptsetupbuildteststyle+392/1003 days ago
blendsdk/codeops-mcp.clinerules/project.md · 0Cline rulestypescriptvitest+3buildteststylearch+791/1003 days ago
RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack

RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack

RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack