RuleStack

Configs

Stacks

Compare

Diff

RuleStack

Configs

Stacks

Compare

Diff

Read API

RuleStack

Configs

Stacks

Compare

Diff

Read API

Diff/thangaram611-second-brain-windsurfrules ↔ thangaram611-second-brain-apps-ui-agents

Comparison

A · Windsurf rules · thangaram611/second-brainB · AGENTS.md · thangaram611/second-brain
What each file covers, counted
DimensionSharedOnly in AOnly in BOverlap
Sections01350%
Commands000—
Section tags26220%

What each file covers

Sections

0 shared · 13 only in A · 5 only in B
  • − Second Brain — Windsurf Rules
  • − Project Overview
  • − Tech Stack
  • − Monorepo
  • − Commands
  • − Coding Rules
  • − Always
  • − Never
  • − Backend Patterns
  • − Frontend Patterns
  • − Testing
  • − Data Model
  • − Documentation
  • + apps/ui — Agent Instructions
  • + Entry Point
  • + Key Directories
  • + State management
  • + Conventions

Commands

neither file has any

Section tags

2 shared · 6 only in A · 2 only in B
  • − setup
  • − test
  • − architecture
  • − types
  • − do-not
  • − docs
  • + ui
  • + agent-behaviour
  •   code-style
  •   monorepo

Line diff

+31 added−89 removed14 unchanged13.6% identical
thangaram611/second-brain · .windsurfrules
@@ −1 @@
1# Second Brain — Windsurf Rules
2 
3## Project Overview
4 
5Developer knowledge graph — pnpm monorepo with Turborepo. Node.js 22+, TypeScript 5.8+ strict mode, ESM only.
6 
7For full architecture: see docs/architecture.md
8For agent instructions: see AGENTS.md
9 
10## Tech Stack
11 
12- Runtime: Node.js 22+, ESM only ("type": "module")
13- Language: TypeScript 5.8+ strict mode
14- Database: SQLite (better-sqlite3) + Drizzle ORM, WAL mode
15- Search: FTS5 (BM25) + sqlite-vec (cosine KNN), Reciprocal Rank Fusion
16- Validation: Zod v4
17- Testing: Vitest, in-memory SQLite
18- Build: tsdown (ESM), tsc (type-check)
19- Frontend: React 19, Zustand, Cytoscape.js, Tailwind CSS, Radix UI
20- Sync: Yjs CRDTs via Hocuspocus relay
21- IDs: ULIDs (ulidx). Never UUID
22- Timestamps: ISO 8601 strings. Never unix timestamps
23 
24## Monorepo
25 
26packages/types — Shared TypeScript types
27packages/core — Knowledge graph engine (Brain class in src/brain.ts)
28packages/collectors — Data collectors + streaming providers
29packages/ingestion — LLM extraction + embedding pipeline
30packages/sync — Yjs CRDT sync bridge
31packages/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)
36 
37## Commands
38 
39pnpm install, pnpm build, pnpm test, pnpm check-types, pnpm dev
 
 
40 
41## Coding Rules
 
42 
43### Always
44- ESM only. Named exports. Re-export from index.ts
45- Use workspace imports: @second-brain/core, @second-brain/types
46- Zod schemas for all external input validation
47- ULIDs for IDs (via ulidx)
48- ISO 8601 for timestamps
49- Namespace field on all entities/relations
50- In-memory SQLite for tests
51- Try-catch with descriptive errors
52- batchUpsert for bulk operations
53 
54### Never
55- Use `any` type
56- Use path aliases
57- Use UUIDs
58- Use unix timestamps or Date objects in storage
59- Write to entities_fts directly (auto-maintained via triggers)
60- Mutate stored confidence (decay is read-side only)
61- Sync 'personal' namespace
62- Import from package internals (use public API)
63 
64## Backend Patterns
65 
66- 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 relations
70- WebSocket broadcast after mutations
71- MCP tools: packages/mcp-server/src/tools/
72 
73## Frontend Patterns
74 
75- React 19 functional components
76- Zustand stores (one per feature in apps/ui/src/store/)
77- Cytoscape.js with diff-based rendering
78- Tailwind dark theme (zinc-950 bg)
79- REST client: apps/ui/src/lib/api.ts
80- WebSocket: apps/ui/src/lib/ws.ts (auto-reconnect)
81- HashRouter (React Router 7)
82 
83## Testing
84 
85- Vitest with globals (no imports for describe/it/expect)
86- In-memory SQLite for all DB tests
87- Co-located: __tests__/*.test.ts
88- Use Brain class directly (not HTTP)
89- Test happy path + error cases
90 
91## Data Model
92 
93Entity types (15): concept, decision, pattern, person, file, symbol, event, tool, fact, conversation, reference, implementation, pull_request, merge_request, branch
94 
95Relation 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_with
96 
97## Documentation
98 
99- docs/architecture.md — Full technical architecture
100- docs/getting-started.md — Usage guide
101- docs/api-reference.md — REST API + MCP + CLI reference
102- AGENTS.md — Detailed agent instructions
103 
thangaram611/second-brain · apps/ui/AGENTS.md
@@ +1 @@
1# apps/ui — Agent Instructions
2 
3React 19 web app for visualizing and interacting with the knowledge graph.
4 
5## Entry Point
6 
7`src/main.tsx` → React root. Port **5173** (Vite dev server).
 
8 
9## Key Directories
10 
11| Directory | Purpose |
12|-----------|---------|
13| `src/components/` | React components |
14| `src/store/` | Zustand stores — client-only state (see below) |
15| `src/hooks/` | Custom React hooks (`use-graph.ts`, `use-websocket.ts`, `use-debounce.ts`) |
16| `src/lib/` | Utilities — `api.ts` (REST client), `ws.ts` (WebSocket), `query-client.ts` / `query-keys.ts` (TanStack Query), `ws-cache.ts` (live-update cache reducers) |
 
 
 
 
 
17 
18## State management
19 
20Server state lives in **TanStack Query** (`@tanstack/react-query`). Each page
21calls `useQuery` / `useMutation` keyed via the `src/lib/query-keys.ts` factory;
22the `queryClient` singleton in `src/lib/query-client.ts` lets non-component code
23(WebSocket handlers) patch caches with `setQueryData`. The accumulated graph
24cache + entity mutations are wrapped in `src/hooks/use-graph.ts`.
 
 
 
 
 
25 
26Zustand is used **only for true client state**:
27 
28| Store | Purpose |
29|-------|---------|
30| `auth-store.ts` | Session: csrfToken / user / mode / relayUrl |
31 
32UI-local state (search query, timeline/ownership filters, graph selection) is
33plain component `useState`.
34 
35## Conventions
 
 
 
 
 
 
 
 
 
36 
37- React 19 functional components only
38- Server state via TanStack Query (never hand-rolled caches or Zustand for server data)
39- WebSocket live updates patch query caches via pure reducers in `lib/ws-cache.ts`
40- Cytoscape.js with diff-based rendering (not full re-render)
41- Tailwind CSS dark theme (`zinc-950` background)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42- HashRouter (React Router 7)
43- REST client in `src/lib/api.ts` — all API calls go through this
44- WebSocket in `src/lib/ws.ts` — auto-reconnect, Zod-validated event union
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45 
@@ −1 +1 @@
1−# Second Brain — Windsurf Rules
1+# apps/ui — Agent Instructions
22  
3−## Project Overview
3+React 19 web app for visualizing and interacting with the knowledge graph.
44  
5−Developer knowledge graph — pnpm monorepo with Turborepo. Node.js 22+, TypeScript 5.8+ strict mode, ESM only.
5+## Entry Point
66  
7−For full architecture: see docs/architecture.md
8−For agent instructions: see AGENTS.md
7+`src/main.tsx` → React root. Port **5173** (Vite dev server).
98  
10−## Tech Stack
9+## Key Directories
1110  
12−- Runtime: Node.js 22+, ESM only ("type": "module")
13−- Language: TypeScript 5.8+ strict mode
14−- Database: SQLite (better-sqlite3) + Drizzle ORM, WAL mode
15−- Search: FTS5 (BM25) + sqlite-vec (cosine KNN), Reciprocal Rank Fusion
16−- Validation: Zod v4
17−- Testing: Vitest, in-memory SQLite
18−- Build: tsdown (ESM), tsc (type-check)
19−- Frontend: React 19, Zustand, Cytoscape.js, Tailwind CSS, Radix UI
20−- Sync: Yjs CRDTs via Hocuspocus relay
21−- IDs: ULIDs (ulidx). Never UUID
22−- Timestamps: ISO 8601 strings. Never unix timestamps
11+| Directory | Purpose |
12+|-----------|---------|
13+| `src/components/` | React components |
14+| `src/store/` | Zustand stores — client-only state (see below) |
15+| `src/hooks/` | Custom React hooks (`use-graph.ts`, `use-websocket.ts`, `use-debounce.ts`) |
16+| `src/lib/` | Utilities — `api.ts` (REST client), `ws.ts` (WebSocket), `query-client.ts` / `query-keys.ts` (TanStack Query), `ws-cache.ts` (live-update cache reducers) |
2317  
24−## Monorepo
18+## State management
2519  
26−packages/types — Shared TypeScript types
27−packages/core — Knowledge graph engine (Brain class in src/brain.ts)
28−packages/collectors — Data collectors + streaming providers
29−packages/ingestion — LLM extraction + embedding pipeline
30−packages/sync — Yjs CRDT sync bridge
31−packages/mcp-server — MCP tools (32 tools, stdio + HTTP)
32−apps/server — Express 5 REST API + WebSocket (port 7430)
33−apps/ui — React 19 + Cytoscape.js (port 5173)
34−apps/relay — Hocuspocus CRDT relay (port 7421)
35−tools/cli — brain CLI (Commander.js)
20+Server state lives in **TanStack Query** (`@tanstack/react-query`). Each page
21+calls `useQuery` / `useMutation` keyed via the `src/lib/query-keys.ts` factory;
22+the `queryClient` singleton in `src/lib/query-client.ts` lets non-component code
23+(WebSocket handlers) patch caches with `setQueryData`. The accumulated graph
24+cache + entity mutations are wrapped in `src/hooks/use-graph.ts`.
3625  
37−## Commands
26+Zustand is used **only for true client state**:
3827  
39−pnpm install, pnpm build, pnpm test, pnpm check-types, pnpm dev
28+| Store | Purpose |
29+|-------|---------|
30+| `auth-store.ts` | Session: csrfToken / user / mode / relayUrl |
4031  
41−## Coding Rules
32+UI-local state (search query, timeline/ownership filters, graph selection) is
33+plain component `useState`.
4234  
43−### Always
44−- ESM only. Named exports. Re-export from index.ts
45−- Use workspace imports: @second-brain/core, @second-brain/types
46−- Zod schemas for all external input validation
47−- ULIDs for IDs (via ulidx)
48−- ISO 8601 for timestamps
49−- Namespace field on all entities/relations
50−- In-memory SQLite for tests
51−- Try-catch with descriptive errors
52−- batchUpsert for bulk operations
35+## Conventions
5336  
54−### Never
55−- Use `any` type
56−- Use path aliases
57−- Use UUIDs
58−- Use unix timestamps or Date objects in storage
59−- Write to entities_fts directly (auto-maintained via triggers)
60−- Mutate stored confidence (decay is read-side only)
61−- Sync 'personal' namespace
62−- Import from package internals (use public API)
63− 
64−## Backend Patterns
65− 
66−- 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 relations
70−- WebSocket broadcast after mutations
71−- MCP tools: packages/mcp-server/src/tools/
72− 
73−## Frontend Patterns
74− 
75−- React 19 functional components
76−- Zustand stores (one per feature in apps/ui/src/store/)
77−- Cytoscape.js with diff-based rendering
78−- Tailwind dark theme (zinc-950 bg)
79−- REST client: apps/ui/src/lib/api.ts
80−- WebSocket: apps/ui/src/lib/ws.ts (auto-reconnect)
37+- React 19 functional components only
38+- Server state via TanStack Query (never hand-rolled caches or Zustand for server data)
39+- WebSocket live updates patch query caches via pure reducers in `lib/ws-cache.ts`
40+- Cytoscape.js with diff-based rendering (not full re-render)
41+- Tailwind CSS dark theme (`zinc-950` background)
8142 - HashRouter (React Router 7)
82− 
83−## Testing
84− 
85−- Vitest with globals (no imports for describe/it/expect)
86−- In-memory SQLite for all DB tests
87−- Co-located: __tests__/*.test.ts
88−- Use Brain class directly (not HTTP)
89−- Test happy path + error cases
90− 
91−## Data Model
92− 
93−Entity types (15): concept, decision, pattern, person, file, symbol, event, tool, fact, conversation, reference, implementation, pull_request, merge_request, branch
94− 
95−Relation 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_with
96− 
97−## Documentation
98− 
99−- docs/architecture.md — Full technical architecture
100−- docs/getting-started.md — Usage guide
101−- docs/api-reference.md — REST API + MCP + CLI reference
102−- AGENTS.md — Detailed agent instructions
43+- REST client in `src/lib/api.ts` — all API calls go through this
44+- WebSocket in `src/lib/ws.ts` — auto-reconnect, Zod-validated event union
10345  
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