Skip to content

Commit 9c39b57

Browse files
Merge pull request #36 from cursor/continual-learning-agents-updater
Add AGENTS updater subagent to continual-learning
2 parents e2a9918 + ac93d26 commit 9c39b57

File tree

5 files changed

+66
-63
lines changed

5 files changed

+66
-63
lines changed

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: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ Automatically and incrementally keeps `AGENTS.md` up to date from transcript cha
55
The plugin combines:
66

77
- A `stop` hook that decides when to trigger learning.
8-
- A `continual-learning` skill that mines only high-signal transcript deltas.
8+
- A `continual-learning` skill that orchestrates the learning flow.
9+
- An `agents-memory-updater` subagent that mines new or changed transcripts and updates `AGENTS.md`.
910

1011
It is designed to avoid noisy rewrites by:
1112

@@ -23,11 +24,13 @@ 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 full memory update flow to `agents-memory-updater`.
28+
2629
The hook keeps local runtime state in:
2730

2831
- `.cursor/hooks/state/continual-learning.json` (cadence state)
2932

30-
The skill uses an incremental transcript index at:
33+
The updater uses an incremental transcript index at:
3134

3235
- `.cursor/hooks/state/continual-learning-index.json`
3336

@@ -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: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
name: agents-memory-updater
3+
description: Mine high-signal transcript deltas, update `AGENTS.md`, and keep the incremental transcript index in sync.
4+
model: inherit
5+
---
6+
7+
# AGENTS.md memory updater
8+
9+
Own the full memory update flow for continual learning.
10+
11+
## Trigger
12+
13+
Use from `continual-learning` when transcript deltas may produce durable memory updates.
14+
15+
## Workflow
16+
17+
1. Read existing `AGENTS.md` first. If it does not exist, create it with only:
18+
- `## Learned User Preferences`
19+
- `## Learned Workspace Facts`
20+
2. Load the incremental index if present.
21+
3. Inspect only transcript files under `~/.cursor/projects/<workspace-slug>/agent-transcripts/` that are new or have newer mtimes than the index.
22+
4. Pull out only durable, reusable items:
23+
- recurring user preferences or corrections
24+
- stable workspace facts
25+
5. Update `AGENTS.md` carefully:
26+
- update matching bullets in place
27+
- add only net-new bullets
28+
- deduplicate semantically similar bullets
29+
- keep each learned section to at most 12 bullets
30+
6. Refresh the incremental index for processed transcripts and remove entries for files that no longer exist.
31+
7. If the merge produces no `AGENTS.md` changes, leave `AGENTS.md` unchanged but still refresh the index.
32+
8. If no meaningful updates exist, respond exactly: `No high-signal memory updates.`
33+
34+
## Guardrails
35+
36+
- Use plain bullet points only.
37+
- Keep only these sections:
38+
- `## Learned User Preferences`
39+
- `## Learned Workspace Facts`
40+
- Do not write evidence/confidence tags.
41+
- Do not write process instructions, rationale, or metadata blocks.
42+
- Exclude secrets, private data, one-off instructions, and transient details.
43+
44+
## Output
45+
46+
- Updated `AGENTS.md` and `.cursor/hooks/state/continual-learning-index.json` when needed
47+
- 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 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.`;
1919

2020
interface StopHookInput {
2121
conversation_id: string;
Lines changed: 11 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,72 +1,24 @@
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: Orchestrate continual learning by delegating transcript mining and AGENTS.md updates to `agents-memory-updater`.
4+
disable-model-invocation: true
45
---
56

67
# Continual Learning
78

8-
Keep `AGENTS.md` current using transcript deltas instead of full rescans.
9+
Keep `AGENTS.md` current by delegating the memory update flow to one subagent.
910

10-
## Inputs
11+
## Trigger
1112

12-
- Transcript root: `~/.cursor/projects/<workspace-slug>/agent-transcripts/`
13-
- Existing memory file: `AGENTS.md`
14-
- Incremental index: `.cursor/hooks/state/continual-learning-index.json`
13+
Use when the user asks to mine prior chats, maintain `AGENTS.md`, or run the continual-learning loop.
1514

1615
## Workflow
1716

18-
1. Read existing `AGENTS.md` first.
19-
2. Load incremental index if present.
20-
3. Discover transcript files and process only:
21-
- new files not in index, or
22-
- files whose mtime is newer than indexed mtime.
23-
4. Extract only high-signal, reusable information:
24-
- recurring user corrections/preferences
25-
- 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:
31-
- store latest mtimes for processed files
32-
- remove entries for files that no longer exist
17+
1. Call `agents-memory-updater`.
18+
2. Return the updater result.
3319

34-
## AGENTS.md Output Contract
20+
## Guardrails
3521

36-
- Keep only these sections:
37-
- `## Learned User Preferences`
38-
- `## Learned Workspace Facts`
39-
- Use plain bullet points only.
40-
- Do not write evidence/confidence tags.
41-
- Do not write process instructions, rationale, or metadata blocks.
42-
43-
## Inclusion Bar
44-
45-
Keep an item only if all are true:
46-
47-
- actionable in future sessions
48-
- stable across sessions
49-
- repeated in multiple transcripts, or explicitly stated as a broad rule
50-
- non-sensitive
51-
52-
## Exclusions
53-
54-
Never store:
55-
56-
- secrets, tokens, credentials, private personal data
57-
- one-off task instructions
58-
- transient details (branch names, commit hashes, temporary errors)
59-
60-
## Incremental Index Format
61-
62-
```json
63-
{
64-
"version": 1,
65-
"transcripts": {
66-
"/abs/path/to/file.jsonl": {
67-
"mtimeMs": 1730000000000,
68-
"lastProcessedAt": "2026-02-18T12:00:00.000Z"
69-
}
70-
}
71-
}
72-
```
22+
- Keep the parent skill orchestration-only.
23+
- Do not mine transcripts or edit files in the parent flow.
24+
- Do not bypass the subagent.

0 commit comments

Comments
 (0)