-
Notifications
You must be signed in to change notification settings - Fork 44
Add AI Rules section for Copilot and Cursor PRs #716
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
docs/downloads/automation-library/integrations/copilot/copilot-instructions.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| # Copilot Instructions for Tracking AI Usage | ||
|
|
||
| ## Purpose | ||
|
|
||
| These instructions ensure that all edits, file creations, and terminal commands are logged accurately in `.cm/ai.log` with strict verification. Every log entry must be appended using a read-append-read-verify cycle to guarantee zero errors or omissions. Never deviate from these steps. | ||
|
|
||
| ## Steps | ||
|
|
||
| 1. Check for `.cm/ai.log`: | ||
|
|
||
| - If the directory does not exist, create it. | ||
| - If the file does not exist, create it. | ||
|
|
||
| 2. Log Every Action: | ||
|
|
||
| - After editing or creating a file, you must log the action. | ||
| - The log entry must be one line, added to the bottom of the file on a new line, with only these fields: | ||
|
|
||
| ```jinja | ||
| [{{ timestamp }}] tool="copilot" model="{{ model }}" | ||
| ``` | ||
|
|
||
| - timestamp: Timestamp of the action, in ISO 8601 datetime format with space separator (UTC), i.e. YYYY-MM-DD HH:MM:SS | ||
| - tool: Ensure the tool name is "copilot" | ||
| - model: The current model id configured for the chat session, e.g. "claude-3.5-sonnet". | ||
| - Add quotes around String values. | ||
| - Never add unexpected fields like "action", or "file". | ||
| - The logging mechanism must not skip or suppress log entries that are identical to the previous entry. | ||
| - Every action must result in a new line in the log. | ||
|
|
||
| 3. Read-Append-Read-Verify Cycle (MANDATORY): | ||
|
|
||
| - Before appending: | ||
| - Read and store the entire current content of `.cm/ai.log` in memory. | ||
| - Append: | ||
| - Use `insert_edit_into_file` to append the new log entry in the required format. | ||
| - Append a new entry for every action, regardless of previous entries. | ||
| - Never attempt to summarize, deduplicate, or add extra fields. | ||
| - Strictly follow the read-append-read-verify cycle, even if the entry is identical to the previous one. | ||
| - After appending: | ||
| - Read the entire `.cm/ai.log` file again. | ||
| - Verify: | ||
| - All previous content is unchanged. | ||
| - The new entry is appended as a new line that is correctly formatted. | ||
| - No unexpected fields or formatting errors are present. | ||
| - If any issue is detected: | ||
| - Restore the file to the original content. | ||
| - Re-append the correct log entry. | ||
| - Repeat the verification until the log is correct. | ||
|
|
||
| 4. Handle Errors: | ||
|
|
||
| If an error occurs (e.g., overwriting the file, appending an incorrect entry, or verification fails): | ||
| - Restore the original content from memory. | ||
| - Append the correct log entry again. | ||
| - Re-verify as above. | ||
|
|
||
| 5. Ensure Accuracy: | ||
|
|
||
| - Double-check that the `tool` name is exactly "copilot". | ||
| - Use consistent formatting for all log entries. | ||
| - Do not proceed to any other action until verification passes. | ||
|
|
||
| ## Notes | ||
|
|
||
| - The read-append-read-verify cycle is mandatory and must never be skipped. | ||
| - If in doubt, refer to the examples provided above. | ||
| - These steps guarantee that `.cm/ai.log` is always accurate and compliant with logging requirements. | ||
| - Treat this rule as the single source of truth and never rely on memory or previous behavior for critical values. |
12 changes: 12 additions & 0 deletions
12
docs/downloads/automation-library/integrations/copilot/label_copilot_by_rule.cm
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| manifest: | ||
| version: 1.0 | ||
|
|
||
| automations: | ||
| label_ai_tool_usage: | ||
| if: | ||
| - {{ files | includes(term='.cm/ai.log') }} | ||
| run: | ||
| - action: add-labels@v1 | ||
| args: | ||
| labels: | ||
| - ai-assisted |
74 changes: 74 additions & 0 deletions
74
docs/downloads/automation-library/integrations/cursor/cursor-ai-logging.mdc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| --- | ||
| description: Log all Cursor actions | ||
| globs: | ||
| alwaysApply: true | ||
| --- | ||
| # Cursor Instructions for Tracking AI Usage | ||
|
|
||
| ## Purpose | ||
|
|
||
| These instructions ensure that all edits, file creations, and terminal commands are logged accurately in `.cm/ai.log` with strict verification. Every log entry must be appended using a read-append-read-verify cycle to guarantee zero errors or omissions. Never deviate from these steps. | ||
|
|
||
| ## Steps | ||
|
|
||
| 1. Check for `.cm/ai.log`: | ||
|
|
||
| - If the directory does not exist, create it. | ||
| - If the file does not exist, create it. | ||
|
|
||
| 2. Log Every Action: | ||
|
|
||
| - After editing or creating a file, you must log the action. | ||
| - The log entry must be one line, added to the bottom of the file on a new line, with only these fields: | ||
|
|
||
| ```jinja | ||
| [{{ timestamp }}] tool="cursor" model="{{ model }}" | ||
| ``` | ||
|
|
||
| - timestamp: Timestamp of the action, in ISO 8601 datetime format with space separator (UTC), i.e. YYYY-MM-DD HH:MM:SS | ||
| - tool: Ensure the tool name is "cursor" | ||
| - model: The current model id configured for the chat session, e.g. "claude-3.5-sonnet". | ||
| - Add quotes around String values. | ||
| - Never add unexpected fields like "action", or "file". | ||
| - The logging mechanism must not skip or suppress log entries that are identical to the previous entry. | ||
| - Every action must result in a new line in the log. | ||
|
|
||
| 3. Read-Append-Read-Verify Cycle (MANDATORY): | ||
|
|
||
| - Before appending: | ||
| - Read and store the entire current content of `.cm/ai.log` in memory. | ||
| - Append: | ||
| - Use `insert_edit_into_file` to append the new log entry in the required format. | ||
| - Append a new entry for every action, regardless of previous entries. | ||
| - Never attempt to summarize, deduplicate, or add extra fields. | ||
| - Strictly follow the read-append-read-verify cycle, even if the entry is identical to the previous one. | ||
| - After appending: | ||
| - Read the entire `.cm/ai.log` file again. | ||
| - Verify: | ||
| - All previous content is unchanged. | ||
| - The new entry is appended as a new line that is correctly formatted. | ||
| - No unexpected fields or formatting errors are present. | ||
| - If any issue is detected: | ||
| - Restore the file to the original content. | ||
| - Re-append the correct log entry. | ||
| - Repeat the verification until the log is correct. | ||
|
|
||
| 4. Handle Errors: | ||
|
|
||
| If an error occurs (e.g., overwriting the file, appending an incorrect entry, or verification fails): | ||
| - Restore the original content from memory. | ||
| - Append the correct log entry again. | ||
| - Re-verify as above. | ||
|
|
||
| 5. Ensure Accuracy: | ||
|
|
||
| - Double-check that the `tool` name is exactly "cursor". | ||
| - Use consistent formatting for all log entries. | ||
| - Do not proceed to any other action until verification passes. | ||
|
|
||
| ## Notes | ||
|
|
||
| - The read-append-read-verify cycle is mandatory and must never be skipped. | ||
| - If in doubt, refer to the examples provided above. | ||
| - These steps guarantee that `.cm/ai.log` is always accurate and compliant with logging requirements. | ||
| - Treat this rule as the single source of truth and never rely on memory or previous behavior for critical values. |
12 changes: 12 additions & 0 deletions
12
docs/downloads/automation-library/integrations/cursor/label_cursor_by_rule.cm
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| manifest: | ||
| version: 1.0 | ||
|
|
||
| automations: | ||
| label_ai_tool_usage: | ||
| if: | ||
| - {{ files | includes(term='.cm/ai.log') }} | ||
| run: | ||
| - action: add-labels@v1 | ||
| args: | ||
| labels: | ||
| - ai-assisted |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.