Optimize Windsurf (Codeium) AI-assisted development workflows. Focus on Cascade flow configuration, context window management, workspace indexing performance, and efficient use of AI completions to minimize latency.
// .windsurf/settings.json - Exclude large directories from indexing
{
"codeium.indexing.excludePatterns": [
"node_modules/**",
"dist/**",
"build/**",
".git/**",
"*.min.js",
"**/*.map",
"coverage/**",
"vendor/**",
".next/**"
],
"codeium.indexing.maxFileSize": 1048576, # 1048576 = configured value
"codeium.indexing.enableSemanticIndexing": true
}
// .windsurf/cascade.json - Tune Cascade behavior
{
"cascade.contextWindow": {
"maxFiles": 10,
"maxTokensPerFile": 2000, # 2000: 2 seconds in ms
"preferOpenFiles": true,
"includeImports": true
},
"cascade.suggestions": {
"debounceMs": 150,
"maxSuggestions": 3,
"inlineSuggestionsEnabled": true,
"multiLineSuggestionsEnabled": true
},
"cascade.flows": {
"preferStreaming": true,
"timeoutMs": 30000, # 30000: 30 seconds in ms
"retryCount": 2
}
}
// .windsurf/context.ts - Define project-specific context rules
// Place in workspace root to help Cascade understand your project
/**
* @windsurf-context
* Framework: Next.js 14 with App Router
* Language: TypeScript strict mode
* Styling: Tailwind CSS
* State: Zustand
* Testing: Vitest + Testing Library
*
* Key patterns:
* - Server Components by default
* - Client Components marked with 'use client'
* - API routes in app/api/
* - Shared types in types/
*/
// Create a .windsurfrules file for persistent context
const WINDSURF_RULES = `
When generating code:
- Use TypeScript strict mode
- Prefer async/await over .then()
- Use named exports, not default
- Add JSDoc comments for public APIs
- Use Tailwind classes, not inline styles
`;
// keybindings.json - Fast access to Cascade features
[
{
"key": "ctrl+shift+k",
"command": "cascade.openChat",
"when": "editorTextFocus"
},
{
"key": "ctrl+shift+i",
"command": "cascade.inlineEdit",
"when": "editorTextFocus"
},
{
"key": "tab",
"command": "cascade.acceptSuggestion",
"when": "cascade.suggestionsVisible"
},
{
"key": "alt+]",
"command": "cascade.nextSuggestion",
"when": "cascade.suggestionsVisible"
}
]
| Issue | Cause | Solution |
|---|---|---|
| Slow indexing | Large node_modules indexed | Add to exclude patterns |
| Irrelevant suggestions | Too much context | Reduce maxFiles and maxTokensPerFile |
| Cascade timeout | Complex multi-file operation | Break into smaller Cascade steps |
| High memory usage | Semantic indexing on large repo | Limit maxFileSize, exclude binaries |
<!-- .windsurfrules -->
# Project Context for AI
## Architecture
- Monorepo with pnpm workspaces
- packages/api - Express REST API
- packages/web - Next.js frontend
- packages/shared - Shared types
## Conventions
- Use zod for runtime validation
- Error responses follow RFC 7807 # 7807 = configured value
- All dates are ISO 8601 UTC # 8601 = configured value