Changesets · Branches · Tags · Compare
| Changeset | 81ce8cce6ac51c4b38dba6a4e5b40a6234bcb33d00aae254065b0207c68809c4 |
|---|---|
| Author | Dallin Romney <dallinromney@gmail.com> · 2025-07-09 17:03 -07:00 |
| Committer | GitHub <noreply@github.com> · 2025-07-09 17:03 -07:00 |
| Parents | 4f8fd8a1afd6, d42d6e45c553 |
6 files changed
added .continue/rules/dev-data-guide.md +200 −0
| @@ -0,0 +1,200 @@ | ||
| 1 | +--- | |
| 2 | +alwaysApply: false | |
| 3 | +--- | |
| 4 | + | |
| 5 | +# Continue Development Data (Dev Data) Guide | |
| 6 | + | |
| 7 | +## Overview | |
| 8 | + | |
| 9 | +Development data (dev data) captures detailed information about how developers interact with LLM-aided development tools. Unlike basic telemetry, dev data includes lots of details into the complete software development workflow, including code context, user interactions, and development patterns. | |
| 10 | + | |
| 11 | +## Core Architecture | |
| 12 | + | |
| 13 | +### Primary Implementation Files | |
| 14 | + | |
| 15 | +- **`/core/data/log.ts`**: Main `DataLogger` class - singleton for event logging and remote transmission | |
| 16 | +- **`/packages/config-yaml/src/schemas/data/`**: Schema definitions for all event types | |
| 17 | + | |
| 18 | +### Storage Locations | |
| 19 | + | |
| 20 | +- **Default storage**: `~/.continue/dev_data/` | |
| 21 | +- **Event files**: `~/.continue/dev_data/{version}/{eventName}.jsonl` | |
| 22 | + | |
| 23 | +## Event Types and Schemas | |
| 24 | + | |
| 25 | +### Core Event Types | |
| 26 | + | |
| 27 | +1. **`tokensGenerated`**: LLM token usage tracking | |
| 28 | +2. **`autocomplete`**: Code completion interactions | |
| 29 | +3. **`chatInteraction`**: Chat-based development assistance | |
| 30 | +4. **`editInteraction`**: Code editing sessions | |
| 31 | +5. **`editOutcome`**: Results of edit operations | |
| 32 | +6. **`nextEditOutcome`**: Next Edit feature outcomes | |
| 33 | +7. **`chatFeedback`**: User feedback on AI responses | |
| 34 | +8. **`toolUsage`**: Tool interaction statistics | |
| 35 | +9. **`quickEdit`**: Quick edit functionality usage | |
| 36 | + | |
| 37 | +### Schema Versioning | |
| 38 | + | |
| 39 | +- **Version 0.1.0**: Initial schema implementation | |
| 40 | +- **Version 0.2.0**: Current schema with expanded fields and metadata | |
| 41 | +- **Schema files**: Located in `/packages/config-yaml/src/schemas/data/` | |
| 42 | + | |
| 43 | +### Base Schema Structure | |
| 44 | + | |
| 45 | +All events inherit from a base schema (`/packages/config-yaml/src/schemas/data/base.ts`): | |
| 46 | + | |
| 47 | +```typescript | |
| 48 | +{ | |
| 49 | + eventName: string, | |
| 50 | + schema: string, | |
| 51 | + timestamp: string, | |
| 52 | + userId: string, | |
| 53 | + userAgent: string, | |
| 54 | + selectedProfileId: string | |
| 55 | +} | |
| 56 | +``` | |
| 57 | + | |
| 58 | +## Key Integration Points | |
| 59 | + | |
| 60 | +### Autocomplete System | |
| 61 | + | |
| 62 | +- **File**: `/core/autocomplete/util/AutocompleteLoggingService.ts` | |
| 63 | +- **Purpose**: Tracks code completion acceptance/rejection, timing, and cache hits | |
| 64 | +- **Integration**: Called from autocomplete engine when completions are shown/accepted | |
| 65 | + | |
| 66 | +### Chat Interface | |
| 67 | + | |
| 68 | +- **Integration**: Chat interactions logged through `DataLogger.logDevData()` | |
| 69 | +- **Data**: Includes prompts, responses, context, and user feedback | |
| 70 | +- **Privacy**: Can be configured to exclude code content | |
| 71 | + | |
| 72 | +### Edit Features | |
| 73 | + | |
| 74 | +- **Files**: `/extensions/vscode/src/extension/EditOutcomeTracker.ts`, `/core/nextEdit/NextEditLoggingService.ts` | |
| 75 | +- **Purpose**: Track edit suggestions, acceptance rates, and outcomes | |
| 76 | +- **Integration**: Embedded in edit workflow to capture user decisions | |
| 77 | + | |
| 78 | +### LLM Token Tracking | |
| 79 | + | |
| 80 | +- **File**: `/core/llm/index.ts` | |
| 81 | +- **Purpose**: Track token usage across all LLM providers | |
| 82 | +- **Storage**: SQLite database for efficient querying and reporting | |
| 83 | + | |
| 84 | +## Configuration and Customization | |
| 85 | + | |
| 86 | +### Configuration Structure | |
| 87 | + | |
| 88 | +Dev data is configured through `data` blocks in your Continue config: | |
| 89 | + | |
| 90 | +```yaml | |
| 91 | +data: | |
| 92 | + - name: "Local Development Data" | |
| 93 | + destination: "file:///Users/developer/.continue/dev_data" | |
| 94 | + schema: "0.2.0" | |
| 95 | + level: "all" | |
| 96 | + events: ["autocomplete", "chatInteraction", "editOutcome"] | |
| 97 | + | |
| 98 | + - name: "Team Analytics" | |
| 99 | + destination: "https://analytics.yourcompany.com/api/events" | |
| 100 | + schema: "0.2.0" | |
| 101 | + level: "noCode" | |
| 102 | + apiKey: "your-api-key-here" | |
| 103 | + events: ["tokensGenerated", "toolUsage"] | |
| 104 | +``` | |
| 105 | + | |
| 106 | +### Configuration Options | |
| 107 | + | |
| 108 | +- **`destination`**: Where to send data (`file://` for local, `http://`/`https://` for remote) | |
| 109 | +- **`schema`**: Schema version to use (`"0.1.0"` or `"0.2.0"`) | |
| 110 | +- **`level`**: Data detail level (`"all"` includes code, `"noCode"` excludes code content) | |
| 111 | +- **`events`**: Array of event types to collect | |
| 112 | +- **`apiKey`**: Authentication for remote endpoints | |
| 113 | + | |
| 114 | +### Privacy Controls | |
| 115 | + | |
| 116 | +- **`"all"` level**: Includes code content (prefixes, suffixes, completions) | |
| 117 | +- **`"noCode"` level**: Excludes code content, only metadata and metrics | |
| 118 | +- **Local-first**: Data is always stored locally, remote transmission is optional | |
| 119 | + | |
| 120 | +## Making Changes to Dev Data | |
| 121 | + | |
| 122 | +### Adding New Event Types | |
| 123 | + | |
| 124 | +1. **Create schema**: Add new event schema in `/packages/config-yaml/src/schemas/data/` | |
| 125 | +2. **Update index**: Add to schema aggregator in `/packages/config-yaml/src/schemas/data/index.ts` | |
| 126 | +3. **Implement logging**: Add logging calls in relevant service files | |
| 127 | +4. **Update version**: Consider schema version bump if breaking changes | |
| 128 | + | |
| 129 | +### Modifying Existing Events | |
| 130 | + | |
| 131 | +1. **Schema changes**: Update schema files in `/packages/config-yaml/src/schemas/data/` | |
| 132 | +2. **Backward compatibility**: Ensure changes don't break existing data consumers | |
| 133 | +3. **Version management**: Increment schema version for breaking changes | |
| 134 | +4. **Test thoroughly**: Validate schema changes with existing data | |
| 135 | + | |
| 136 | +### Adding New Logging Points | |
| 137 | + | |
| 138 | +1. **Import DataLogger**: `import { DataLogger } from "core/data/log"` | |
| 139 | +2. **Log events**: Call `DataLogger.getInstance().logDevData(eventName, data)` | |
| 140 | +3. **Follow patterns**: Use existing logging services as examples | |
| 141 | +4. **Validate data**: Ensure logged data matches schema requirements | |
| 142 | + | |
| 143 | +### Debugging Dev Data Issues | |
| 144 | + | |
| 145 | +1. **Check local storage**: Verify files are being created in `~/.continue/dev_data/` | |
| 146 | +2. **Validate schemas**: Ensure event data matches expected schema format | |
| 147 | +3. **Review configuration**: Check `data` blocks in Continue config | |
| 148 | +4. **Test endpoints**: Verify remote endpoints are reachable and accepting data | |
| 149 | + | |
| 150 | +## Best Practices | |
| 151 | + | |
| 152 | +### When Adding New Events | |
| 153 | + | |
| 154 | +- Follow existing naming conventions for event types | |
| 155 | +- Include sufficient context for analysis without oversharing sensitive data | |
| 156 | +- Consider privacy implications and respect user configuration levels | |
| 157 | +- Add appropriate error handling and logging | |
| 158 | + | |
| 159 | +### When Modifying Schemas | |
| 160 | + | |
| 161 | +- Maintain backward compatibility when possible | |
| 162 | +- Document schema changes thoroughly | |
| 163 | +- Consider impact on existing data consumers | |
| 164 | +- Test with real development data | |
| 165 | + | |
| 166 | +### When Integrating Logging | |
| 167 | + | |
| 168 | +- Use the singleton pattern: `DataLogger.getInstance()` | |
| 169 | +- Log events at appropriate points in user workflow | |
| 170 | +- Respect user privacy settings and configuration | |
| 171 | +- Handle errors gracefully without disrupting user experience | |
| 172 | + | |
| 173 | +## Common Patterns | |
| 174 | + | |
| 175 | +### Service-Based Logging | |
| 176 | + | |
| 177 | +Most dev data logging follows a service pattern: | |
| 178 | + | |
| 179 | +```typescript | |
| 180 | +export class FeatureLoggingService { | |
| 181 | + private dataLogger = DataLogger.getInstance(); | |
| 182 | + | |
| 183 | + logFeatureUsage(data: FeatureUsageData) { | |
| 184 | + this.dataLogger.logDevData("featureUsage", data); | |
| 185 | + } | |
| 186 | +} | |
| 187 | +``` | |
| 188 | + | |
| 189 | +### Event-Driven Logging | |
| 190 | + | |
| 191 | +Events are typically logged at key interaction points: | |
| 192 | + | |
| 193 | +```typescript | |
| 194 | +// When user accepts autocomplete | |
| 195 | +onAutocompleteAccepted(completion: CompletionData) { | |
| 196 | + AutocompleteLoggingService.getInstance().logAutocompleteAccepted(completion); | |
| 197 | +} | |
| 198 | +``` | |
| 199 | + | |
| 200 | +This guide provides the foundation for understanding and working with Continue's dev data system. Always prioritize user privacy and follow established patterns when making changes. |
modified core/llm/rules/getSystemMessageWithRules.ts +4 −0
| @@ -324,6 +324,10 @@ | ||
| 324 | 324 | return applicableRules; |
| 325 | 325 | }; |
| 326 | 326 | |
| 327 | +export function getRuleId(rule: RuleWithSource): string { | |
| 328 | + return rule.slug ?? rule.ruleFile ?? rule.name ?? rule.source; | |
| 329 | +} | |
| 330 | + | |
| 327 | 331 | export const getSystemMessageWithRules = ({ |
| 328 | 332 | baseSystemMessage, |
| 329 | 333 | userMessage, |
modified gui/src/redux/thunks/streamNormalInput.ts +5 −0
| @@ -1,6 +1,7 @@ | ||
| 1 | 1 | import { createAsyncThunk, unwrapResult } from "@reduxjs/toolkit"; |
| 2 | 2 | import { LLMFullCompletionOptions, ModelDescription, Tool } from "core"; |
| 3 | 3 | import { modelSupportsTools } from "core/llm/autodetect"; |
| 4 | +import { getRuleId } from "core/llm/rules/getSystemMessageWithRules"; | |
| 4 | 5 | import { ToCoreProtocol } from "core/protocol"; |
| 5 | 6 | import { BuiltInToolNames } from "core/tools/builtIn"; |
| 6 | 7 | import { selectActiveTools } from "../selectors/selectActiveTools"; |
| @@ -171,6 +172,10 @@ | ||
| 171 | 172 | ...(!!activeTools.length && { |
| 172 | 173 | tools: activeTools.map((tool) => tool.function.name), |
| 173 | 174 | }), |
| 175 | + rules: appliedRules.map((rule) => ({ | |
| 176 | + id: getRuleId(rule), | |
| 177 | + rule: rule.rule, | |
| 178 | + })), | |
| 174 | 179 | }, |
| 175 | 180 | }); |
| 176 | 181 | // else if (state.session.mode === "edit") { |
modified packages/config-yaml/src/schemas/data/chatInteraction/index.ts +8 −0
| @@ -8,4 +8,12 @@ | ||
| 8 | 8 | completion: z.string(), |
| 9 | 9 | sessionId: z.string(), |
| 10 | 10 | tools: z.array(z.string()).optional(), |
| 11 | + rules: z | |
| 12 | + .array( | |
| 13 | + z.object({ | |
| 14 | + id: z.string(), | |
| 15 | + rule: z.string(), | |
| 16 | + }), | |
| 17 | + ) | |
| 18 | + .optional(), | |
| 11 | 19 | }); |
modified packages/config-yaml/src/schemas/data/chatInteraction/v0.2.0.ts +1 −0
| @@ -17,6 +17,7 @@ | ||
| 17 | 17 | modelProvider: true, |
| 18 | 18 | sessionId: true, |
| 19 | 19 | tools: true, |
| 20 | + rules: true, | |
| 20 | 21 | }); |
| 21 | 22 | |
| 22 | 23 | export const chatInteractionEventSchema_0_2_0_noCode = |
modified packages/config-yaml/src/schemas/data/editOutcome/v0.2.0.ts +7 −0
| @@ -15,10 +15,17 @@ | ||
| 15 | 15 | modelTitle: true, |
| 16 | 16 | modelProvider: true, |
| 17 | 17 | accepted: true, |
| 18 | + previousCode: true, | |
| 19 | + newCode: true, | |
| 20 | + previousCodeLines: true, | |
| 21 | + newCodeLines: true, | |
| 22 | + lineChange: true, | |
| 18 | 23 | }); |
| 19 | 24 | |
| 20 | 25 | export const editOutcomeEventSchema_0_2_0_noCode = |
| 21 | 26 | editOutcomeEventSchema_0_2_0.omit({ |
| 22 | 27 | prompt: true, |
| 23 | 28 | completion: true, |
| 29 | + previousCode: true, | |
| 30 | + newCode: true, | |
| 24 | 31 | }); |