From 4a6072ecb0e023764ef40a21eb5599ae4663381d Mon Sep 17 00:00:00 2001 From: ericzakariasson Date: Thu, 12 Mar 2026 16:08:31 +0100 Subject: [PATCH 1/2] Add AGENTS updater subagent to continual-learning Delegate AGENTS.md merges to a dedicated subagent and disable model invocation for the parent skill so the workflow only runs when explicitly triggered. Made-with: Cursor --- continual-learning/.cursor-plugin/plugin.json | 1 + continual-learning/README.md | 5 +- .../agents/agents-memory-updater.md | 53 +++++++++++++++++++ .../hooks/continual-learning-stop.ts | 2 +- .../skills/continual-learning/SKILL.md | 19 ++++--- 5 files changed, 71 insertions(+), 9 deletions(-) create mode 100644 continual-learning/agents/agents-memory-updater.md diff --git a/continual-learning/.cursor-plugin/plugin.json b/continual-learning/.cursor-plugin/plugin.json index dddca77..8382ba9 100644 --- a/continual-learning/.cursor-plugin/plugin.json +++ b/continual-learning/.cursor-plugin/plugin.json @@ -24,6 +24,7 @@ "memory", "transcripts" ], + "agents": "./agents/", "skills": "./skills/", "hooks": "./hooks/hooks.json" } diff --git a/continual-learning/README.md b/continual-learning/README.md index 94e4c67..610e1e5 100644 --- a/continual-learning/README.md +++ b/continual-learning/README.md @@ -6,6 +6,7 @@ The plugin combines: - A `stop` hook that decides when to trigger learning. - A `continual-learning` skill that mines only high-signal transcript deltas. +- An `agents-memory-updater` subagent that owns the `AGENTS.md` merge/write step. It is designed to avoid noisy rewrites by: @@ -23,6 +24,8 @@ It is designed to avoid noisy rewrites by: On eligible `stop` events, the hook may emit a `followup_message` that asks the agent to run the `continual-learning` skill. +The skill is marked `disable-model-invocation: true`, so it will not be auto-selected during normal model invocation. When it does run, it delegates the final `AGENTS.md` merge/write work to the `agents-memory-updater` subagent. + The hook keeps local runtime state in: - `.cursor/hooks/state/continual-learning.json` (cadence state) @@ -56,7 +59,7 @@ Trial mode defaults (enabled in this plugin hook config): ## Output format in AGENTS.md -The skill writes only: +The memory updater writes only: - `## Learned User Preferences` - `## Learned Workspace Facts` diff --git a/continual-learning/agents/agents-memory-updater.md b/continual-learning/agents/agents-memory-updater.md new file mode 100644 index 0000000..a2b2e70 --- /dev/null +++ b/continual-learning/agents/agents-memory-updater.md @@ -0,0 +1,53 @@ +--- +name: agents-memory-updater +description: Merge high-signal continual-learning updates into `AGENTS.md` and keep the incremental transcript index in sync. Use from the `continual-learning` skill when transcript deltas may change durable memory. +model: inherit +--- + +# AGENTS.md memory updater + +Own the actual `AGENTS.md` write for continual learning. + +## Inputs + +- Existing memory file: `AGENTS.md` +- Incremental index: `.cursor/hooks/state/continual-learning-index.json` +- Transcript root: `~/.cursor/projects//agent-transcripts/` +- Any narrowed list of changed transcripts from the caller +- Any extracted candidate bullets from the caller + +## Workflow + +1. Read existing `AGENTS.md` first. If it does not exist, create it with only: + - `## Learned User Preferences` + - `## Learned Workspace Facts` +2. Load the incremental index if present. +3. Use the caller's narrowed transcript set or extracted bullets when provided. Otherwise, inspect only transcript files that are new or whose mtimes are newer than the index. +4. Keep only high-signal reusable information: + - recurring user corrections/preferences + - durable workspace facts +5. Update `AGENTS.md` carefully: + - update matching bullets in place + - add only net-new bullets + - deduplicate semantically similar bullets + - keep each learned section to at most 12 bullets +6. Write back the incremental index: + - store latest mtimes for processed files + - remove entries for files that no longer exist +7. If no meaningful updates exist, leave `AGENTS.md` unchanged and 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. +- Never store secrets, credentials, private personal data, or one-off instructions. +- Exclude transient details like branch names, commit hashes, or temporary errors. + +## Output + +- Updated `AGENTS.md` and `.cursor/hooks/state/continual-learning-index.json` when needed +- Otherwise exactly `No high-signal memory updates.` diff --git a/continual-learning/hooks/continual-learning-stop.ts b/continual-learning/hooks/continual-learning-stop.ts index 4555ddd..6f8a45c 100644 --- a/continual-learning/hooks/continual-learning-stop.ts +++ b/continual-learning/hooks/continual-learning-stop.ts @@ -15,7 +15,7 @@ const TRIAL_DEFAULT_MIN_MINUTES = 15; const TRIAL_DEFAULT_DURATION_MINUTES = 24 * 60; const FOLLOWUP_MESSAGE = - `Run the \`continual-learning\` skill now. First read existing \`AGENTS.md\` and update existing entries in place (do not only append). Use incremental transcript processing with index file \`${INCREMENTAL_INDEX_PATH}\`: only read transcripts not in the index or transcripts whose mtime is newer than indexed mtime (re-read changed transcripts). After processing, write back the updated index mtimes and remove entries for deleted transcripts. Update \`AGENTS.md\` only for high-signal, repeated user-correction patterns or durable workspace facts. Exclude one-off/transient details and secrets. Keep each learned section to at most 12 bullets. Write plain bullet points only, with no evidence/confidence tags or other metadata annotations. If no meaningful updates exist, respond exactly: No high-signal memory updates.`; + `Run the \`continual-learning\` skill now. Use the \`agents-memory-updater\` subagent for the actual \`AGENTS.md\` merge/write. First read existing \`AGENTS.md\`. Use incremental transcript processing with index file \`${INCREMENTAL_INDEX_PATH}\`: only read transcripts not in the index or transcripts whose mtime is newer than indexed mtime (re-read changed transcripts). After processing, have the subagent update existing entries in place (do not only append), write back the updated index mtimes, and remove entries for deleted transcripts. Update \`AGENTS.md\` only for high-signal, repeated user-correction patterns or durable workspace facts. Exclude one-off/transient details and secrets. Keep each learned section to at most 12 bullets. Write plain bullet points only, with no evidence/confidence tags or other metadata annotations. If no meaningful updates exist, respond exactly: No high-signal memory updates.`; interface StopHookInput { conversation_id: string; diff --git a/continual-learning/skills/continual-learning/SKILL.md b/continual-learning/skills/continual-learning/SKILL.md index cf42fc6..9ca3499 100644 --- a/continual-learning/skills/continual-learning/SKILL.md +++ b/continual-learning/skills/continual-learning/SKILL.md @@ -1,6 +1,7 @@ --- name: continual-learning -description: Incrementally extract recurring user corrections and durable workspace facts from transcript changes, then update AGENTS.md with plain bullet points only. Use when the user asks to mine previous chats, maintain AGENTS.md memory, or build a self-learning preference loop. +description: Incrementally extract recurring user corrections and durable workspace facts from transcript changes, then delegate the AGENTS.md merge/update to a dedicated subagent. Use when the user asks to mine previous chats, maintain AGENTS.md memory, or build a self-learning preference loop. +disable-model-invocation: true --- # Continual Learning @@ -12,24 +13,27 @@ Keep `AGENTS.md` current using transcript deltas instead of full rescans. - Transcript root: `~/.cursor/projects//agent-transcripts/` - Existing memory file: `AGENTS.md` - Incremental index: `.cursor/hooks/state/continual-learning-index.json` +- AGENTS updater subagent: `agents-memory-updater` ## Workflow 1. Read existing `AGENTS.md` first. 2. Load incremental index if present. -3. Discover transcript files and process only: +3. Discover transcript files and identify only: - new files not in index, or - files whose mtime is newer than indexed mtime. 4. Extract only high-signal, reusable information: - recurring user corrections/preferences - durable workspace facts -5. Merge with existing bullets in `AGENTS.md`: - - update matching bullets in place - - add only net-new bullets - - deduplicate semantically similar bullets -6. Write back the incremental index: +5. Invoke the `agents-memory-updater` subagent to do the actual `AGENTS.md` merge/write: + - pass the transcript root, incremental index path, and any narrowed set of changed transcripts + - pass the extracted candidate bullets grouped into user preferences vs workspace facts + - tell it to update matching bullets in place, add only net-new bullets, and deduplicate semantic duplicates + - do not edit `AGENTS.md` directly in the parent flow; the subagent owns that step +6. Let the subagent write back the incremental index: - store latest mtimes for processed files - remove entries for files that no longer exist +7. If no meaningful updates exist, respond exactly: `No high-signal memory updates.` ## AGENTS.md Output Contract @@ -39,6 +43,7 @@ Keep `AGENTS.md` current using transcript deltas instead of full rescans. - Use plain bullet points only. - Do not write evidence/confidence tags. - Do not write process instructions, rationale, or metadata blocks. +- Keep each learned section to at most 12 bullets. ## Inclusion Bar From ac93d26be3c3f0db4c4c88c7dac4bdf7deab2b2a Mon Sep 17 00:00:00 2001 From: ericzakariasson Date: Fri, 13 Mar 2026 09:58:43 +0100 Subject: [PATCH 2/2] Simplify continual-learning to one subagent Keep the parent skill orchestration-only and move transcript mining plus AGENTS.md updates into agents-memory-updater so the plugin matches the final staging flow. Made-with: Cursor --- continual-learning/README.md | 8 +- .../agents/agents-memory-updater.md | 30 +++----- .../hooks/continual-learning-stop.ts | 2 +- .../skills/continual-learning/SKILL.md | 73 +++---------------- 4 files changed, 27 insertions(+), 86 deletions(-) diff --git a/continual-learning/README.md b/continual-learning/README.md index 610e1e5..410fe92 100644 --- a/continual-learning/README.md +++ b/continual-learning/README.md @@ -5,8 +5,8 @@ Automatically and incrementally keeps `AGENTS.md` up to date from transcript cha The plugin combines: - A `stop` hook that decides when to trigger learning. -- A `continual-learning` skill that mines only high-signal transcript deltas. -- An `agents-memory-updater` subagent that owns the `AGENTS.md` merge/write step. +- A `continual-learning` skill that orchestrates the learning flow. +- An `agents-memory-updater` subagent that mines new or changed transcripts and updates `AGENTS.md`. It is designed to avoid noisy rewrites by: @@ -24,13 +24,13 @@ It is designed to avoid noisy rewrites by: On eligible `stop` events, the hook may emit a `followup_message` that asks the agent to run the `continual-learning` skill. -The skill is marked `disable-model-invocation: true`, so it will not be auto-selected during normal model invocation. When it does run, it delegates the final `AGENTS.md` merge/write work to the `agents-memory-updater` subagent. +The skill is marked `disable-model-invocation: true`, so it will not be auto-selected during normal model invocation. When it does run, it delegates the full memory update flow to `agents-memory-updater`. The hook keeps local runtime state in: - `.cursor/hooks/state/continual-learning.json` (cadence state) -The skill uses an incremental transcript index at: +The updater uses an incremental transcript index at: - `.cursor/hooks/state/continual-learning-index.json` diff --git a/continual-learning/agents/agents-memory-updater.md b/continual-learning/agents/agents-memory-updater.md index a2b2e70..631429f 100644 --- a/continual-learning/agents/agents-memory-updater.md +++ b/continual-learning/agents/agents-memory-updater.md @@ -1,20 +1,16 @@ --- name: agents-memory-updater -description: Merge high-signal continual-learning updates into `AGENTS.md` and keep the incremental transcript index in sync. Use from the `continual-learning` skill when transcript deltas may change durable memory. +description: Mine high-signal transcript deltas, update `AGENTS.md`, and keep the incremental transcript index in sync. model: inherit --- # AGENTS.md memory updater -Own the actual `AGENTS.md` write for continual learning. +Own the full memory update flow for continual learning. -## Inputs +## Trigger -- Existing memory file: `AGENTS.md` -- Incremental index: `.cursor/hooks/state/continual-learning-index.json` -- Transcript root: `~/.cursor/projects//agent-transcripts/` -- Any narrowed list of changed transcripts from the caller -- Any extracted candidate bullets from the caller +Use from `continual-learning` when transcript deltas may produce durable memory updates. ## Workflow @@ -22,19 +18,18 @@ Own the actual `AGENTS.md` write for continual learning. - `## Learned User Preferences` - `## Learned Workspace Facts` 2. Load the incremental index if present. -3. Use the caller's narrowed transcript set or extracted bullets when provided. Otherwise, inspect only transcript files that are new or whose mtimes are newer than the index. -4. Keep only high-signal reusable information: - - recurring user corrections/preferences - - durable workspace facts +3. Inspect only transcript files under `~/.cursor/projects//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: - update matching bullets in place - add only net-new bullets - deduplicate semantically similar bullets - keep each learned section to at most 12 bullets -6. Write back the incremental index: - - store latest mtimes for processed files - - remove entries for files that no longer exist -7. If no meaningful updates exist, leave `AGENTS.md` unchanged and respond exactly: `No high-signal memory updates.` +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.` ## Guardrails @@ -44,8 +39,7 @@ Own the actual `AGENTS.md` write for continual learning. - `## Learned Workspace Facts` - Do not write evidence/confidence tags. - Do not write process instructions, rationale, or metadata blocks. -- Never store secrets, credentials, private personal data, or one-off instructions. -- Exclude transient details like branch names, commit hashes, or temporary errors. +- Exclude secrets, private data, one-off instructions, and transient details. ## Output diff --git a/continual-learning/hooks/continual-learning-stop.ts b/continual-learning/hooks/continual-learning-stop.ts index 6f8a45c..fa6f5d9 100644 --- a/continual-learning/hooks/continual-learning-stop.ts +++ b/continual-learning/hooks/continual-learning-stop.ts @@ -15,7 +15,7 @@ const TRIAL_DEFAULT_MIN_MINUTES = 15; const TRIAL_DEFAULT_DURATION_MINUTES = 24 * 60; const FOLLOWUP_MESSAGE = - `Run the \`continual-learning\` skill now. Use the \`agents-memory-updater\` subagent for the actual \`AGENTS.md\` merge/write. First read existing \`AGENTS.md\`. Use incremental transcript processing with index file \`${INCREMENTAL_INDEX_PATH}\`: only read transcripts not in the index or transcripts whose mtime is newer than indexed mtime (re-read changed transcripts). After processing, have the subagent update existing entries in place (do not only append), write back the updated index mtimes, and remove entries for deleted transcripts. Update \`AGENTS.md\` only for high-signal, repeated user-correction patterns or durable workspace facts. Exclude one-off/transient details and secrets. Keep each learned section to at most 12 bullets. Write plain bullet points only, with no evidence/confidence tags or other metadata annotations. If no meaningful updates exist, respond exactly: No high-signal memory updates.`; + `Run the \`continual-learning\` skill now. Use the \`agents-memory-updater\` subagent for the full memory update flow. Use incremental transcript processing with index file \`${INCREMENTAL_INDEX_PATH}\`: only consider transcripts not in the index or transcripts whose mtime is newer than indexed mtime. Have the subagent refresh index mtimes, remove entries for deleted transcripts, and update \`AGENTS.md\` only for high-signal recurring user corrections and durable workspace facts. Exclude one-off/transient details and secrets. If no meaningful updates exist, respond exactly: No high-signal memory updates.`; interface StopHookInput { conversation_id: string; diff --git a/continual-learning/skills/continual-learning/SKILL.md b/continual-learning/skills/continual-learning/SKILL.md index 9ca3499..f1beb5c 100644 --- a/continual-learning/skills/continual-learning/SKILL.md +++ b/continual-learning/skills/continual-learning/SKILL.md @@ -1,77 +1,24 @@ --- name: continual-learning -description: Incrementally extract recurring user corrections and durable workspace facts from transcript changes, then delegate the AGENTS.md merge/update to a dedicated subagent. Use when the user asks to mine previous chats, maintain AGENTS.md memory, or build a self-learning preference loop. +description: Orchestrate continual learning by delegating transcript mining and AGENTS.md updates to `agents-memory-updater`. disable-model-invocation: true --- # Continual Learning -Keep `AGENTS.md` current using transcript deltas instead of full rescans. +Keep `AGENTS.md` current by delegating the memory update flow to one subagent. -## Inputs +## Trigger -- Transcript root: `~/.cursor/projects//agent-transcripts/` -- Existing memory file: `AGENTS.md` -- Incremental index: `.cursor/hooks/state/continual-learning-index.json` -- AGENTS updater subagent: `agents-memory-updater` +Use when the user asks to mine prior chats, maintain `AGENTS.md`, or run the continual-learning loop. ## Workflow -1. Read existing `AGENTS.md` first. -2. Load incremental index if present. -3. Discover transcript files and identify only: - - new files not in index, or - - files whose mtime is newer than indexed mtime. -4. Extract only high-signal, reusable information: - - recurring user corrections/preferences - - durable workspace facts -5. Invoke the `agents-memory-updater` subagent to do the actual `AGENTS.md` merge/write: - - pass the transcript root, incremental index path, and any narrowed set of changed transcripts - - pass the extracted candidate bullets grouped into user preferences vs workspace facts - - tell it to update matching bullets in place, add only net-new bullets, and deduplicate semantic duplicates - - do not edit `AGENTS.md` directly in the parent flow; the subagent owns that step -6. Let the subagent write back the incremental index: - - store latest mtimes for processed files - - remove entries for files that no longer exist -7. If no meaningful updates exist, respond exactly: `No high-signal memory updates.` +1. Call `agents-memory-updater`. +2. Return the updater result. -## AGENTS.md Output Contract +## Guardrails -- Keep only these sections: - - `## Learned User Preferences` - - `## Learned Workspace Facts` -- Use plain bullet points only. -- Do not write evidence/confidence tags. -- Do not write process instructions, rationale, or metadata blocks. -- Keep each learned section to at most 12 bullets. - -## Inclusion Bar - -Keep an item only if all are true: - -- actionable in future sessions -- stable across sessions -- repeated in multiple transcripts, or explicitly stated as a broad rule -- non-sensitive - -## Exclusions - -Never store: - -- secrets, tokens, credentials, private personal data -- one-off task instructions -- transient details (branch names, commit hashes, temporary errors) - -## Incremental Index Format - -```json -{ - "version": 1, - "transcripts": { - "/abs/path/to/file.jsonl": { - "mtimeMs": 1730000000000, - "lastProcessedAt": "2026-02-18T12:00:00.000Z" - } - } -} -``` +- Keep the parent skill orchestration-only. +- Do not mine transcripts or edit files in the parent flow. +- Do not bypass the subagent.