Skip to content

Commit 4a6072e

Browse files
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
1 parent 1966e52 commit 4a6072e

5 files changed

Lines changed: 71 additions & 9 deletions

File tree

continual-learning/.cursor-plugin/plugin.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"memory",
2525
"transcripts"
2626
],
27+
"agents": "./agents/",
2728
"skills": "./skills/",
2829
"hooks": "./hooks/hooks.json"
2930
}

continual-learning/README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ The plugin combines:
66

77
- A `stop` hook that decides when to trigger learning.
88
- A `continual-learning` skill that mines only high-signal transcript deltas.
9+
- An `agents-memory-updater` subagent that owns the `AGENTS.md` merge/write step.
910

1011
It is designed to avoid noisy rewrites by:
1112

@@ -23,6 +24,8 @@ It is designed to avoid noisy rewrites by:
2324

2425
On eligible `stop` events, the hook may emit a `followup_message` that asks the agent to run the `continual-learning` skill.
2526

27+
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.
28+
2629
The hook keeps local runtime state in:
2730

2831
- `.cursor/hooks/state/continual-learning.json` (cadence state)
@@ -56,7 +59,7 @@ Trial mode defaults (enabled in this plugin hook config):
5659

5760
## Output format in AGENTS.md
5861

59-
The skill writes only:
62+
The memory updater writes only:
6063

6164
- `## Learned User Preferences`
6265
- `## Learned Workspace Facts`
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
---
2+
name: agents-memory-updater
3+
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.
4+
model: inherit
5+
---
6+
7+
# AGENTS.md memory updater
8+
9+
Own the actual `AGENTS.md` write for continual learning.
10+
11+
## Inputs
12+
13+
- Existing memory file: `AGENTS.md`
14+
- Incremental index: `.cursor/hooks/state/continual-learning-index.json`
15+
- Transcript root: `~/.cursor/projects/<workspace-slug>/agent-transcripts/`
16+
- Any narrowed list of changed transcripts from the caller
17+
- Any extracted candidate bullets from the caller
18+
19+
## Workflow
20+
21+
1. Read existing `AGENTS.md` first. If it does not exist, create it with only:
22+
- `## Learned User Preferences`
23+
- `## Learned Workspace Facts`
24+
2. Load the incremental index if present.
25+
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.
26+
4. Keep only high-signal reusable information:
27+
- recurring user corrections/preferences
28+
- durable workspace facts
29+
5. Update `AGENTS.md` carefully:
30+
- update matching bullets in place
31+
- add only net-new bullets
32+
- deduplicate semantically similar bullets
33+
- keep each learned section to at most 12 bullets
34+
6. Write back the incremental index:
35+
- store latest mtimes for processed files
36+
- remove entries for files that no longer exist
37+
7. If no meaningful updates exist, leave `AGENTS.md` unchanged and respond exactly: `No high-signal memory updates.`
38+
39+
## Guardrails
40+
41+
- Use plain bullet points only.
42+
- Keep only these sections:
43+
- `## Learned User Preferences`
44+
- `## Learned Workspace Facts`
45+
- Do not write evidence/confidence tags.
46+
- Do not write process instructions, rationale, or metadata blocks.
47+
- Never store secrets, credentials, private personal data, or one-off instructions.
48+
- Exclude transient details like branch names, commit hashes, or temporary errors.
49+
50+
## Output
51+
52+
- Updated `AGENTS.md` and `.cursor/hooks/state/continual-learning-index.json` when needed
53+
- Otherwise exactly `No high-signal memory updates.`

continual-learning/hooks/continual-learning-stop.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const TRIAL_DEFAULT_MIN_MINUTES = 15;
1515
const TRIAL_DEFAULT_DURATION_MINUTES = 24 * 60;
1616

1717
const FOLLOWUP_MESSAGE =
18-
`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.`;
18+
`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.`;
1919

2020
interface StopHookInput {
2121
conversation_id: string;

continual-learning/skills/continual-learning/SKILL.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
name: continual-learning
3-
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.
3+
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.
4+
disable-model-invocation: true
45
---
56

67
# Continual Learning
@@ -12,24 +13,27 @@ Keep `AGENTS.md` current using transcript deltas instead of full rescans.
1213
- Transcript root: `~/.cursor/projects/<workspace-slug>/agent-transcripts/`
1314
- Existing memory file: `AGENTS.md`
1415
- Incremental index: `.cursor/hooks/state/continual-learning-index.json`
16+
- AGENTS updater subagent: `agents-memory-updater`
1517

1618
## Workflow
1719

1820
1. Read existing `AGENTS.md` first.
1921
2. Load incremental index if present.
20-
3. Discover transcript files and process only:
22+
3. Discover transcript files and identify only:
2123
- new files not in index, or
2224
- files whose mtime is newer than indexed mtime.
2325
4. Extract only high-signal, reusable information:
2426
- recurring user corrections/preferences
2527
- durable workspace facts
26-
5. Merge with existing bullets in `AGENTS.md`:
27-
- update matching bullets in place
28-
- add only net-new bullets
29-
- deduplicate semantically similar bullets
30-
6. Write back the incremental index:
28+
5. Invoke the `agents-memory-updater` subagent to do the actual `AGENTS.md` merge/write:
29+
- pass the transcript root, incremental index path, and any narrowed set of changed transcripts
30+
- pass the extracted candidate bullets grouped into user preferences vs workspace facts
31+
- tell it to update matching bullets in place, add only net-new bullets, and deduplicate semantic duplicates
32+
- do not edit `AGENTS.md` directly in the parent flow; the subagent owns that step
33+
6. Let the subagent write back the incremental index:
3134
- store latest mtimes for processed files
3235
- remove entries for files that no longer exist
36+
7. If no meaningful updates exist, respond exactly: `No high-signal memory updates.`
3337

3438
## AGENTS.md Output Contract
3539

@@ -39,6 +43,7 @@ Keep `AGENTS.md` current using transcript deltas instead of full rescans.
3943
- Use plain bullet points only.
4044
- Do not write evidence/confidence tags.
4145
- Do not write process instructions, rationale, or metadata blocks.
46+
- Keep each learned section to at most 12 bullets.
4247

4348
## Inclusion Bar
4449

0 commit comments

Comments
 (0)