Windsurf rules
.windsurfrulesWindsurf rulesroot
Quality
75/100
Scores the file, not the repository.Length
502 words
13 headings · 0 code blocksRepository
0
— · pushed 31 days agoLast changed
3 days ago
First indexed 3 days ago.1# Second Brain — Windsurf Rules23## Project Overview45Developer knowledge graph — pnpm monorepo with Turborepo. Node.js 22+, TypeScript 5.8+ strict mode, ESM only.67For full architecture: see docs/architecture.md8For agent instructions: see AGENTS.md910## Tech Stack1112- Runtime: Node.js 22+, ESM only ("type": "module")13- Language: TypeScript 5.8+ strict mode14- Database: SQLite (better-sqlite3) + Drizzle ORM, WAL mode15- Search: FTS5 (BM25) + sqlite-vec (cosine KNN), Reciprocal Rank Fusion16- Validation: Zod v417- Testing: Vitest, in-memory SQLite18- Build: tsdown (ESM), tsc (type-check)19- Frontend: React 19, Zustand, Cytoscape.js, Tailwind CSS, Radix UI20- Sync: Yjs CRDTs via Hocuspocus relay21- IDs: ULIDs (ulidx). Never UUID22- Timestamps: ISO 8601 strings. Never unix timestamps2324## Monorepo2526packages/types — Shared TypeScript types27packages/core — Knowledge graph engine (Brain class in src/brain.ts)28packages/collectors — Data collectors + streaming providers29packages/ingestion — LLM extraction + embedding pipeline30packages/sync — Yjs CRDT sync bridge31packages/mcp-server — MCP tools (32 tools, stdio + HTTP)32apps/server — Express 5 REST API + WebSocket (port 7430)33apps/ui — React 19 + Cytoscape.js (port 5173)34apps/relay — Hocuspocus CRDT relay (port 7421)35tools/cli — brain CLI (Commander.js)3637## Commands3839pnpm install, pnpm build, pnpm test, pnpm check-types, pnpm dev4041## Coding Rules4243### Always44- ESM only. Named exports. Re-export from index.ts45- Use workspace imports: @second-brain/core, @second-brain/types46- Zod schemas for all external input validation47- ULIDs for IDs (via ulidx)48- ISO 8601 for timestamps49- Namespace field on all entities/relations50- In-memory SQLite for tests51- Try-catch with descriptive errors52- batchUpsert for bulk operations5354### Never55- Use `any` type56- Use path aliases57- Use UUIDs58- Use unix timestamps or Date objects in storage59- Write to entities_fts directly (auto-maintained via triggers)60- Mutate stored confidence (decay is read-side only)61- Sync 'personal' namespace62- Import from package internals (use public API)6364## Backend Patterns6566- Drizzle ORM for queries (schema in packages/core/src/schema/)67- Brain class is main facade (packages/core/src/brain.ts)68- Relations: unique constraint on (sourceId, targetId, type)69- Use createOrGet for idempotent relations70- WebSocket broadcast after mutations71- MCP tools: packages/mcp-server/src/tools/7273## Frontend Patterns7475- React 19 functional components76- Zustand stores (one per feature in apps/ui/src/store/)77- Cytoscape.js with diff-based rendering78- Tailwind dark theme (zinc-950 bg)79- REST client: apps/ui/src/lib/api.ts80- WebSocket: apps/ui/src/lib/ws.ts (auto-reconnect)81- HashRouter (React Router 7)8283## Testing8485- Vitest with globals (no imports for describe/it/expect)86- In-memory SQLite for all DB tests87- Co-located: __tests__/*.test.ts88- Use Brain class directly (not HTTP)89- Test happy path + error cases9091## Data Model9293Entity types (15): concept, decision, pattern, person, file, symbol, event, tool, fact, conversation, reference, implementation, pull_request, merge_request, branch9495Relation types (20): relates_to, depends_on, implements, supersedes, contradicts, derived_from, authored_by, decided_in, uses, tests, contains, co_changes_with, preceded_by, blocks, reviewed_by, merged_in_mr, merged_in_pr, touches_file, owns, parallel_with9697## Documentation9899- docs/architecture.md — Full technical architecture100- docs/getting-started.md — Usage guide101- docs/api-reference.md — REST API + MCP + CLI reference102- AGENTS.md — Detailed agent instructions103
Also in thangaram611/second-brain
Diff this repo’s formatsOne 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?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| thangaram611/second-brain.clinerules/01-project.md · 0 | Cline rules | setuptestmonorepodo-not | 65/100 | 3 days ago | |
| thangaram611/second-brain.clinerules/02-conventions.md · 0 | Cline rules | teststyledo-not | 40/100 | 3 days ago | |
| thangaram611/second-brain.clinerules/03-backend.md · 0 | Cline rules | styledatabase | 37/100 | 3 days ago | |
| thangaram611/second-brain.clinerules/04-frontend.md · 0 | Cline rules | style | 28/100 | 3 days ago | |
| thangaram611/second-brain.clinerules/05-testing.md · 0 | Cline rules | testdo-not | 35/100 | 3 days ago | |
| thangaram611/second-brain.clinerules/06-data-model.md · 0 | Cline rules | types | 25/100 | 3 days ago | |
| thangaram611/second-brain.cursor/rules/backend.mdc · 0 | Cursor rules | do-not | 31/100 | 3 days ago | |
| thangaram611/second-brain.cursor/rules/data-model.mdc · 0 | Cursor rules | types | 30/100 | 3 days ago | |
| thangaram611/second-brain.cursor/rules/frontend.mdc · 0 | Cursor rules | do-not | 31/100 | 3 days ago | |
| thangaram611/second-brain.cursor/rules/project.mdc · 0 | Cursor rules | testdo-notagent-behaviour | 50/100 | 3 days ago | |
| thangaram611/second-brain.cursor/rules/testing.mdc · 0 | Cursor rules | testdo-not | 27/100 | 3 days ago | |
| thangaram611/second-brain.github/copilot-instructions.md · 0 | Copilot instructions | setupteststylearch+4 | 96/100 | 3 days ago | |
| thangaram611/second-brainAGENTS.md · 0 | AGENTS.md | setupteststyletypes+3 | 74/100 | 3 days ago | |
| thangaram611/second-brainCLAUDE.md · 0 | CLAUDE.md | agent-behaviour | 16/100 | 3 days ago | |
| thangaram611/second-brainapps/relay/AGENTS.md · 0 | AGENTS.md | monorepoagent-behaviour | 33/100 | 3 days ago | |
| thangaram611/second-brainapps/server/AGENTS.md · 0 | AGENTS.md | styleapimonorepoagent-behaviour | 56/100 | 3 days ago | |
| thangaram611/second-brainapps/ui/AGENTS.md · 0 | AGENTS.md | styleuimonorepoagent-behaviour | 56/100 | 3 days ago | |
| thangaram611/second-brainpackages/collectors/AGENTS.md · 0 | AGENTS.md | agent-behaviour | 52/100 | 3 days ago | |
| thangaram611/second-brainpackages/core/AGENTS.md · 0 | AGENTS.md | testtypesdatabaseagent-behaviour | 62/100 | 3 days ago | |
| thangaram611/second-brainpackages/ingestion/AGENTS.md · 0 | AGENTS.md | styleagent-behaviour | 48/100 | 3 days ago |
Diff against .clinerules/01-project.md Diff against .clinerules/02-conventions.md Diff against .clinerules/03-backend.md Diff against .clinerules/04-frontend.md Diff against .clinerules/05-testing.md Diff against .clinerules/06-data-model.md Diff against .cursor/rules/backend.mdc Diff against .cursor/rules/data-model.mdc Diff against .cursor/rules/frontend.mdc Diff against .cursor/rules/project.mdc Diff against .cursor/rules/testing.mdc Diff against .github/copilot-instructions.md Diff against AGENTS.md Diff against CLAUDE.md Diff against apps/relay/AGENTS.md Diff against apps/server/AGENTS.md Diff against apps/ui/AGENTS.md Diff against packages/collectors/AGENTS.md Diff against packages/core/AGENTS.md Diff against packages/ingestion/AGENTS.md
Similar configs
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| danielvm-git/bigpowers.windsurf/rules/organize-workspace.md · 114 | Windsurf rules | buildstylegitdeployment+2 | 89/100 | 3 days ago | |
| danielvm-git/bigpowers.windsurf/rules/guard-git.md · 114 | Windsurf rules | stylearchgitsecurity+2 | 89/100 | 3 days ago | |
| danielvm-git/bigpowers.windsurf/rules/quick-fix.md · 114 | Windsurf rules | teststylegitdeployment+1 | 85/100 | 3 days ago | |
| danielvm-git/bigpowers.windsurf/rules/develop-tdd.md · 114 | Windsurf rules | teststylearchtesting-strategy+5 | 85/100 | 3 days ago | |
| danielvm-git/bigpowers.windsurf/rules/session-state.md · 114 | Windsurf rules | lint-formatstyleagent-behaviour | 82/100 | 3 days ago | |
| danielvm-git/bigpowers.windsurf/rules/commit-message.md · 114 | Windsurf rules | lint-formatstyletypesgit+3 | 82/100 | 3 days ago | |
| danielvm-git/bigpowers.windsurf/rules/extract-design.md · 114 | Windsurf rules | lint-formatstyledependenciesui | 82/100 | 3 days ago | |
| danielvm-git/bigpowers.windsurf/rules/setup-environment.md · 114 | Windsurf rules | setupstylesecuritydo-not+1 | 81/100 | 3 days ago |
