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..410fe92 100644 --- a/continual-learning/README.md +++ b/continual-learning/README.md @@ -5,7 +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. +- 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: @@ -23,11 +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 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` @@ -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..631429f --- /dev/null +++ b/continual-learning/agents/agents-memory-updater.md @@ -0,0 +1,47 @@ +--- +name: agents-memory-updater +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 full memory update flow for continual learning. + +## Trigger + +Use from `continual-learning` when transcript deltas may produce durable memory updates. + +## 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. 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. 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 + +- 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. +- Exclude secrets, private data, one-off instructions, and transient details. + +## 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..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. 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 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 cf42fc6..f1beb5c 100644 --- a/continual-learning/skills/continual-learning/SKILL.md +++ b/continual-learning/skills/continual-learning/SKILL.md @@ -1,72 +1,24 @@ --- 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: 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` +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 process 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: - - store latest mtimes for processed files - - remove entries for files that no longer exist +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. - -## 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.