IDE Integrations
Idiomark provides integrations with popular AI-powered IDEs to help you generate code that matches your unique developer style. Using IdiomarkD (Idiomark for Developers) profiles, you can customize AI coding assistants to follow your conventions, preferences, and patterns.
Overview
IdiomarkD profiles capture your behavioral coding patterns:
| Dimension | What It Captures | Impact on AI |
|---|---|---|
| Cognitive Style | Problem-solving approach, learning style | How AI explains solutions |
| Code Structure | Function length, complexity tolerance, organization | Code structure suggestions |
| Naming Conventions | Variable, type, constant naming | Variable names in suggestions |
| Error Handling | Fail-fast vs graceful, logging level | Error patterns in code |
| Testing | Coverage threshold, mock strategy | Test generation style |
| Code Review | Focus areas, nitpicks | Review comments style |
IdiomarkD (Idiomark for Developers) is an extension of the Idiomark protocol specifically designed for developer behavioral profiles. It uses profile_type: "developer" to distinguish from general personality profiles. See IdiomarkD Documentation for more details.
Choose Your IDE
- GitHub Copilot
- Cursor AI
GitHub Copilot Integration
The @idiomark/copilot-integration package provides integration with GitHub Copilot in VS Code.
Installation
# From the monorepo
cd packages/copilot-integration
npm install
npm run build
Configuration
1. Create a IdiomarkD Profile
First, create your developer profile using the Idiomark CLI:
# Analyze your codebase to generate a IdiomarkD profile
npx @idiomark/core analyze-code ./src --format=idiomarkd > my-developer-profile.idiomarkd.json
2. Set Up Environment
# Set the profile path
export IdiomarkD_PROFILE=/path/to/your/profile.idiomarkd.json
3. VS Code Settings
Add to your .vscode/settings.json:
{
"github.copilot.inlineSuggest.count": 5,
"github.copilot.enable": {
"*": true
}
}
Programmatic Usage
import { createCopilotIntegration, COPILOT_LIMITATIONS } from '@idiomark/copilot-integration'
// Initialize integration
const integration = createCopilotIntegration({
profilePath: '/path/to/profile.idiomarkd.json',
debug: true
})
const result = await integration.init()
if (!result.success) {
console.error('Failed to initialize:', result.error)
}
// Get the active profile
const profile = integration.getActiveProfile()
console.log('Profile loaded:', profile?.metadata?.identity?.name)
// Check limitations
console.log('Known limitations:', COPILOT_LIMITATIONS)
Profile Structure for Copilot
{
"idiomark": "1.1.0",
"profile_type": "developer",
"metadata": {
"identity": {
"name": "Developer Name"
}
},
"behavioral": {
"cognitive_style": {
"problem_solving": "iterative_refinement",
"learning_style": "experimental",
"documentation_preference": "code_first_comments_selective"
},
"code_structure": {
"functional_preference": 0.7,
"max_function_length": 25,
"complexity_tolerance": "moderate",
"file_organization": "co-located"
},
"naming": {
"philosophy": "descriptive_over_brief",
"conventions": {
"variables": "camelCase",
"types": "PascalCase",
"constants": "UPPER_SNAKE"
}
},
"error_handling": {
"philosophy": "graceful_degradation",
"fail_fast": false,
"error_context": "on_error_only",
"logging_level": "warn"
},
"testing": {
"temperament": "pragmatic_not_zealot",
"coverage_threshold": 0.7,
"test_external_dependencies": true,
"mock_strategy": "external_only"
}
}
}
Limitations
GitHub Copilot's public API has significant limitations for custom integrations:
- No System Prompts: Copilot Chat API does not support custom system prompts
- Configuration Only: Can only inject via VS Code workspace configuration
- No Runtime Context: Cannot modify Copilot context after initialization
- Token Limit: Profile injection uses suggestion tokens
Workarounds
Since Copilot's API is limited, use these alternative approaches:
Configuration Comments
Add special comments to your code for Copilot to recognize:
// @idiomarkd-config
// Developer: Senior Full Stack Developer
// Problem Solving: iterative_refinement
// Learning: experimental
// Functional: 0.7
// Naming: camelCase
Custom Snippets
Generate VS Code snippets matching your style:
// .vscode/snippets.code-snippets
{
"Error Handler": {
"prefix": "eh",
"body": [
"try {",
" $1",
"} catch (error) {",
" console.warn('[${2:module}]', error)",
" $3",
"}"
],
"description": "Error handler with graceful degradation"
}
}
Cursor AI Integration
The @idiomark/cursor-integration package provides integration with Cursor AI editor.
Installation
# From the monorepo
cd packages/cursor-integration
npm install
npm run build
Configuration
1. Create a IdiomarkD Profile
# Analyze your codebase to generate a IdiomarkD profile
npx @idiomark/core analyze-code ./src --format=idiomarkd > my-developer-profile.idiomarkd.json
2. Set Environment Variable
# Set the profile path
export IdiomarkD_PROFILE=/path/to/your/profile.idiomarkd.json
# Launch Cursor
cursor .
Programmatic Usage
import {
initCursorIntegration,
createCursorIntegration
} from '@idiomark/cursor-integration'
// Initialize with environment-based profile
const result = await initCursorIntegration()
if (result.success) {
console.log('IdiomarkD loaded successfully')
// Get the integration instance
const integration = createCursorIntegration()
// Get active profile
const profile = integration.getActiveProfile()
console.log('Profile loaded:', profile?.metadata?.identity?.name)
// Generate prompt injection for Cursor
const prompt = integration.getPromptInjection()
console.log('Prompt injection:', prompt)
}
Prompt Injection Format
The integration generates a system prompt that includes:
## Developer Profile
**Name:** Senior Full Stack Developer
**Version:** 1.1.0
## Behavioral Preferences
### Cognitive Style
- **Problem Solving:** iterative_refinement
- **Learning Style:** experimental
- **Documentation:** code_first_comments_selective
### Code Structure
- **Functional Preference:** 0.7
- **Max Function Length:** 25
- **Complexity:** moderate
- **Organization:** co-located
### Naming Conventions
- **Philosophy:** descriptive_over_brief
- **Variables:** camelCase
- **Types:** PascalCase
- **Constants:** UPPER_SNAKE
### Error Handling
- **Philosophy:** graceful_degradation
- **Fail Fast:** No
- **Error Context:** on_error_only
- **Logging:** warn
### Testing
- **Temperament:** pragmatic_not_zealot
- **Coverage Target:** 0.7
- **Test External:** Yes
- **Mock Strategy:** external_only
With AI Personality Layer
Optionally add an AI personality layer for more control:
{
"idiomark": "1.1.0",
"profile_type": "developer",
"behavioral": { ... },
"ai_personality": {
"voice": {
"tone": {
"primary": "professional_friendly",
"certainty": 0.8
},
"formality": "semi_formal",
"humor": "subtle"
},
"code_generation": {
"prefer_patterns_over_raw_code": true,
"include_explanations": "on_request",
"comment_style": "minimal_but_meaningful"
},
"interaction": {
"question_response_style": "direct_with_context",
"error_communication": "suggestive_not_prescriptive",
"suggestion_openness": "offers_alternatives"
}
}
}
Cursor Rules File
Create a .cursorrules file in your project root that references your profile:
# IdiomarkD Integration
This project uses Idiomark for Developers for code generation consistency.
## Developer Profile
- **Problem Solving**: Iterative refinement - prefer incremental improvements
- **Code Structure**: Functional preference (0.7), max 25 lines per function
- **Naming**: Descriptive over brief, camelCase variables, PascalCase types
- **Error Handling**: Graceful degradation, warn-level logging
- **Testing**: Pragmatic (70% coverage), mock external dependencies only
## Code Review Focus Areas
- Architecture and maintainability
- Error handling patterns
- Asynchronous code patterns
General Integration Patterns
Profile Loading Pattern
Both integrations follow a similar pattern for loading profiles:
interface IntegrationOptions {
/** Path to IdiomarkD profile file */
profilePath?: string
/** Enable debug logging */
debug?: boolean
}
interface IntegrationResult {
success: boolean
profile?: DevBehavior
error?: string
}
Environment Detection
Both integrations detect their respective environments:
// Copilot environment detection
const isCopilot = typeof window !== 'undefined' && (
'vscode' in (window as any).constructor.name ||
'github.github' in (window as any).document.URL
)
// Cursor environment detection
const isCursor = !!process.env.CURSOR_VERSION ||
(typeof window !== 'undefined' &&
'cursor' in (window as any).navigator.userAgent.toLowerCase())
Profile Validation
All profiles are validated before use:
// Required fields for IdiomarkD profiles
const requiredFields = {
idiomark: 'string', // Version string
profile_type: 'developer', // Must be "developer"
behavioral: {
cognitive_style: 'object',
code_structure: 'object',
naming: 'object',
error_handling: 'object',
testing: 'object'
}
}
Creating a IdiomarkD Profile
From Existing Code
# Analyze your local codebase
npx @idiomark/core analyze-code ./src --format=idiomarkd > profile.idiomarkd.json
# Analyze specific files
npx @idiomark/core analyze-code ./src/components/*.tsx --format=idiomarkd
# Analyze with sample size limit
npx @idiomark/core analyze-code ./src --samples=50 --format=idiomarkd
Manual Creation
Create a profile manually based on your preferences:
const profile = {
idiomark: "1.1.0",
profile_type: "developer",
metadata: {
identity: {
name: "Your Name"
}
},
behavioral: {
cognitive_style: {
problem_solving: "iterative_refinement", // or: decomposition, pattern_matching
learning_style: "experimental", // or: documentation_first, tutorial_based
documentation_preference: "code_first_comments_selective" // or: comments_first, minimal
},
code_structure: {
functional_preference: 0.7, // 0-1 scale
max_function_length: 25,
complexity_tolerance: "moderate", // low, moderate, high
file_organization: "co-located" // or: feature_based, layer_based
},
naming: {
philosophy: "descriptive_over_brief", // or: concise_practical
conventions: {
variables: "camelCase",
types: "PascalCase",
constants: "UPPER_SNAKE",
files: "kebab-case"
}
},
error_handling: {
philosophy: "graceful_degradation", // or: fail_fast, defensive
fail_fast: false,
error_context: "on_error_only", // or: always_include_trace
logging_level: "warn" // debug, info, warn, error
},
testing: {
temperament: "pragmatic_not_zealot", // or: tdd_advocate, coverage_maximalist
coverage_threshold: 0.7,
test_external_dependencies: true,
mock_strategy: "external_only" // or: none, all, mixed
}
}
}
Troubleshooting
Common Issues
- Copilot
- Cursor
"Copilot environment not detected"
Ensure you're running within VS Code with the Copilot extension installed and enabled.
Solution:
# Verify VS Code is running
code --version
# Check Copilot extension is installed
code --list-extensions | grep copilot
"Failed to load profile"
The profile file may be invalid or missing required fields.
Solution:
# Validate the profile
idiomark validate profile.idiomarkd.json --strict
# Check file exists
ls -la $IdiomarkD_PROFILE
"No runtime context modification"
This is a known limitation of Copilot's API.
Solution: Use configuration comments or custom snippets as workarounds.
"Not running in Cursor environment"
Ensure Cursor is properly installed and you're launching from Cursor.
Solution:
# Verify Cursor is installed
which cursor
# Launch from Cursor
cursor /path/to/project
"Profile not loading from environment"
The environment variable may not be set.
Solution:
# Verify environment variable
echo $IdiomarkD_PROFILE
# Set it correctly
export IdiomarkD_PROFILE=/absolute/path/to/profile.idiomarkd.json
"Prompt injection not working"
Check that the integration is properly initialized.
Solution:
const integration = createCursorIntegration({
profilePath: '/absolute/path/to/profile.idiomarkd.json',
debug: true
})
const result = await integration.init()
console.log('Init result:', result)
Debug Mode
Enable debug mode for verbose logging:
const integration = createIntegration({
profilePath: '/path/to/profile.idiomarkd.json',
debug: true // Enable debug logging
})
Profile Validation Errors
| Error | Cause | Solution |
|---|---|---|
Invalid IdiomarkD file: must have profile_type "developer" | Wrong profile type | Add "profile_type": "developer" |
Invalid IdiomarkD file: missing behavioral layer | Missing required field | Add behavioral object |
Failed to load profile: ENOENT | File not found | Check file path |
Failed to load profile: Unexpected token | Invalid JSON | Validate JSON syntax |
API Reference
Copilot Integration
import {
createCopilotIntegration,
COPILOT_LIMITATIONS,
COPILOT_WORKAROUNDS
} from '@idiomark/copilot-integration'
// Types
interface CopilotIntegrationOptions {
profilePath?: string
debug?: boolean
}
interface CopilotIntegrationResult {
success: boolean
profile?: DevBehavior
method: 'config' | 'comment' | 'environment'
error?: string
}
// Methods
const integration = createCopilotIntegration(options)
await integration.init()
integration.getActiveProfile()
integration.isActive()
integration.dispose()
Cursor Integration
import {
createCursorIntegration,
initCursorIntegration
} from '@idiomark/cursor-integration'
// Types
interface CursorIntegrationOptions {
profilePath?: string
debug?: boolean
maxTokens?: number
}
interface CursorIntegrationResult {
success: boolean
profile?: DevBehavior
promptInjection?: string
error?: string
}
// Methods
const integration = createCursorIntegration(options)
await integration.init()
integration.getActiveProfile()
integration.getPromptInjection()
integration.isActive()
integration.dispose()
// Helper function
const result = await initCursorIntegration()
See Also
- IdiomarkD Documentation - Full Idiomark for Developers reference
- SDK Guide - Programmatic Idiomark usage
- CLI Reference - Command-line tools
- Format Specification - Idiomark file format details
- Browser Extension - ChatGPT and Claude integration