-
Notifications
You must be signed in to change notification settings - Fork 715
fix(continual-learning): write memory to AGENTS.local.md in team repos #372
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
Open
Liqiuyue9597
wants to merge
4
commits into
cursor:main
Choose a base branch
from
Liqiuyue9597:team-safe-agents-local
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
a4dc2d7
fix(continual-learning): write memory to AGENTS.local.md in team repos
Liqiuyue9597 0edd69b
docs(continual-learning): present team-safe defaults as upstream beha…
Liqiuyue9597 a43311e
fix(continual-learning): address review on repo-write guard and routing
Liqiuyue9597 341d9e9
fix(continual-learning): match marketplace listing to plugin.json
Liqiuyue9597 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
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,13 @@ | ||
| # Changelog | ||
|
|
||
| ## 1.1.0 | ||
|
|
||
| - Default memory file is `~/.cursor/projects/<slug>/AGENTS.local.md`. | ||
| - Stop-hook followup embeds resolved absolute paths and forbids writing the | ||
| repo-tracked `AGENTS.md` unless an allowed shared workspace file is set. | ||
| - `preToolUse` denies Write/StrReplace of `## Learned *` sections into | ||
| repo-tracked `AGENTS.md` / `CLAUDE.md` / `GEMINI.md`, except the configured | ||
| workspace file when it is gitignored or `CONTINUAL_LEARNING_ALLOW_SHARED=1`. | ||
| - Cadence/index default to `~/.cursor/projects/<slug>/continual-learning/`. | ||
| Legacy files are copied; tracked originals are not deleted. | ||
| - Keep `## Learned Workspace Facts` (no `(local)` heading rename). |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,47 +1,75 @@ | ||
| --- | ||
| name: agents-memory-updater | ||
| description: Mine high-signal transcript deltas, update `AGENTS.md`, and keep the incremental transcript index in sync. | ||
| description: Mine high-signal transcript deltas, update the user-scoped AGENTS.local.md memory file, and keep the incremental transcript index in sync. | ||
| model: inherit | ||
| --- | ||
|
|
||
| # AGENTS.md memory updater | ||
| # Memory updater | ||
|
|
||
| Own the full memory update flow for continual learning. | ||
|
|
||
| ## Trigger | ||
|
|
||
| Use from `continual-learning` when transcript deltas may produce durable memory updates. | ||
|
|
||
| ## Target files | ||
|
|
||
| **User memory file** (always written, personal, never committed): | ||
|
|
||
| - Path from the followup message when present; otherwise | ||
| `$CONTINUAL_LEARNING_USER_FILE` or | ||
| `~/.cursor/projects/<slug>/AGENTS.local.md`. | ||
| - `<slug>` is the absolute workspace path with the leading `/` stripped and | ||
| remaining `/` replaced by `-`. | ||
| - Owns `## Learned User Preferences` and `## Learned Workspace Facts`. | ||
| - Do **not** rename the workspace-facts heading to `(local)`. | ||
|
|
||
| **Workspace memory file** (opt-in only): | ||
|
|
||
| - `$CONTINUAL_LEARNING_WORKSPACE_FILE`. Unset by default — skip it. | ||
| - Refuse the write when `git check-ignore -q` exits `1` unless | ||
| `CONTINUAL_LEARNING_ALLOW_SHARED=1`. | ||
|
|
||
| **Never** write `## Learned User Preferences` or `## Learned Workspace Facts` | ||
| into a repo-tracked `AGENTS.md` / `CLAUDE.md` / `GEMINI.md`. | ||
|
|
||
| **Index**: `$CONTINUAL_LEARNING_STATE_DIR/index.json` if set; otherwise | ||
| `~/.cursor/projects/<slug>/continual-learning/index.json`. Prefer the absolute | ||
| index path embedded in the followup message. | ||
|
|
||
| ## Workflow | ||
|
|
||
| 1. Read existing `AGENTS.md` first. If it does not exist, create it with only: | ||
| 1. Resolve target paths from the followup message when present. | ||
| 2. Read the existing user memory file. If it does not exist, create it with only: | ||
| - `## Learned User Preferences` | ||
| - `## Learned Workspace Facts` | ||
| 2. Load the incremental index if present. | ||
| 3. Inspect only transcript files under `~/.cursor/projects/<workspace-slug>/agent-transcripts/` that are new or have newer mtimes than the index. | ||
| 4. Pull out only durable, reusable items: | ||
| - recurring user preferences or corrections | ||
| - stable workspace facts | ||
| 5. Update `AGENTS.md` carefully: | ||
| 3. Load the incremental index. | ||
| 4. Inspect only transcript files under | ||
| `~/.cursor/projects/<workspace-slug>/agent-transcripts/` that are new or | ||
| have newer mtimes than the index. | ||
| 5. Extract only durable, reusable items. | ||
| 6. Update the user memory file: | ||
| - update matching bullets in place | ||
| - add only net-new bullets | ||
| - deduplicate semantically similar bullets | ||
| - keep each learned section to at most 12 bullets | ||
| 6. Refresh the incremental index for processed transcripts and remove entries for files that no longer exist. | ||
| 7. If the merge produces no `AGENTS.md` changes, leave `AGENTS.md` unchanged but still refresh the index. | ||
| 8. If no meaningful updates exist, respond exactly: `No high-signal memory updates.` | ||
| - keep each section to at most 12 bullets | ||
| 7. Refresh the index for processed transcripts and remove entries for files | ||
| that no longer exist. | ||
| 8. If the merge produces no file changes, leave the memory file unchanged | ||
| but still refresh the index. | ||
| 9. If no meaningful updates exist, respond exactly: | ||
| `No high-signal memory updates.` | ||
|
|
||
| ## Guardrails | ||
|
|
||
| - Use plain bullet points only. | ||
| - Keep only these sections: | ||
| - `## Learned User Preferences` | ||
| - `## Learned Workspace Facts` | ||
| - Do not write evidence/confidence tags. | ||
| - Do not write process instructions, rationale, or metadata blocks. | ||
| - Do not write evidence/confidence tags, process instructions, rationale, or metadata. | ||
| - Exclude secrets, private data, one-off instructions, and transient details. | ||
|
|
||
| ## Output | ||
|
|
||
| - Updated `AGENTS.md` and `.cursor/hooks/state/continual-learning-index.json` when needed | ||
| - Updated the user memory file and the index when needed. | ||
| - Otherwise exactly `No high-signal memory updates.` |
Oops, something went wrong.
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.