Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .cursor-plugin/marketplace.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
{
"name": "continual-learning",
"source": "continual-learning",
"description": "Incremental transcript-driven memory updates for AGENTS.md using high-signal bullet points only."
"description": "Incrementally learns durable user preferences and workspace facts from transcript changes and writes them to user-scoped AGENTS.local.md (safe for team repos)."
},
{
"name": "cursor-team-kit",
Expand Down
4 changes: 2 additions & 2 deletions continual-learning/.cursor-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "continual-learning",
"displayName": "Continual Learning",
"version": "1.0.0",
"description": "Incrementally learns durable user preferences and workspace facts from transcript changes and keeps AGENTS.md up to date with plain bullet points.",
"version": "1.1.0",
"description": "Incrementally learns durable user preferences and workspace facts from transcript changes and writes them to user-scoped AGENTS.local.md (safe for team repos).",
Comment thread
cursor[bot] marked this conversation as resolved.
"author": {
"name": "Eric Zakariasson"
},
Expand Down
13 changes: 13 additions & 0 deletions continual-learning/CHANGELOG.md
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).
88 changes: 78 additions & 10 deletions continual-learning/README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,33 @@
# Continual Learning

Automatically and incrementally keeps `AGENTS.md` up to date from transcript changes.
Automatically and incrementally keeps a **user-scoped** memory file up to date
from transcript changes. Safe to enable in repositories that already track a
team-owned `AGENTS.md`.

Default write target:

```text
~/.cursor/projects/<slug>/AGENTS.local.md
```

`<slug>` is the absolute workspace path with the leading `/` stripped and `/`
replaced by `-` (same layout as `agent-transcripts/`). Cursor stacks this file
with the repo `AGENTS.md`.

The plugin combines:

- A `stop` hook that decides when to trigger learning.
- A `stop` hook that decides when to trigger learning and embeds absolute
memory/index paths in the followup.
- A `continual-learning` skill that orchestrates the learning flow.
- An `agents-memory-updater` subagent that mines new or changed transcripts and updates `AGENTS.md`.
- An `agents-memory-updater` subagent that mines new or changed transcripts
and updates `AGENTS.local.md`.
- A `preToolUse` hook that denies Write/StrReplace of `## Learned *` sections
into a repo-tracked `AGENTS.md` / `CLAUDE.md` / `GEMINI.md`, unless that path
is an explicit shared workspace file that is allowed.

It is designed to avoid noisy rewrites by:

- Reading existing `AGENTS.md` first and updating matching bullets in place.
- Reading the existing memory file first and updating matching bullets in place.
- Processing only new or changed transcript files.
- Writing plain bullet points only (no evidence/confidence metadata).

Expand All @@ -20,19 +37,43 @@ It is designed to avoid noisy rewrites by:
/add-plugin continual-learning
```

## Safe defaults for team repos

Learned bullets no longer go into the workspace `AGENTS.md` by default. That
file is often owned by the whole team; writing personal preferences there
creates dirty trees and accidental commits.

Cadence and the incremental transcript index also default to:

```text
~/.cursor/projects/<slug>/continual-learning/
```

instead of `.cursor/hooks/state/` inside the repo.

Section titles stay:

- `## Learned User Preferences`
- `## Learned Workspace Facts`

Existing `AGENTS.local.md` files keep working; headings are not renamed.

## How it works

On eligible `stop` events, the hook may emit a `followup_message` that asks the agent to run the `continual-learning` skill.
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 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)
- `~/.cursor/projects/<slug>/continual-learning/cadence.json`

The updater uses an incremental transcript index at:

- `.cursor/hooks/state/continual-learning-index.json`
- `~/.cursor/projects/<slug>/continual-learning/index.json`

## Trigger cadence

Expand All @@ -48,7 +89,22 @@ Trial mode defaults (enabled in this plugin hook config):
- minimum 15 minutes
- automatically expires after 24 hours, then falls back to default cadence

## Optional env overrides
## Configuration (all optional)

**Memory targets**

- `CONTINUAL_LEARNING_USER_FILE` — personal memory file. Default:
`~/.cursor/projects/<slug>/AGENTS.local.md`.
- `CONTINUAL_LEARNING_WORKSPACE_FILE` — opt-in shared file inside the repo.
Unset by default. Refused when the path is in git and not gitignored,
unless `CONTINUAL_LEARNING_ALLOW_SHARED=1`.
- `CONTINUAL_LEARNING_STATE_DIR` — `cadence.json` + `index.json`. Default:
`~/.cursor/projects/<slug>/continual-learning/`.
- `CONTINUAL_LEARNING_ALLOW_SHARED` — bypass the git-leak check for the
configured workspace file (also allows the `preToolUse` deny hook to let
that write through).

**Cadence** (unchanged)

- `CONTINUAL_LEARNING_MIN_TURNS` (or legacy `CONTINUOUS_LEARNING_MIN_TURNS`)
- `CONTINUAL_LEARNING_MIN_MINUTES` (or legacy `CONTINUOUS_LEARNING_MIN_MINUTES`)
Expand All @@ -57,7 +113,7 @@ Trial mode defaults (enabled in this plugin hook config):
- `CONTINUAL_LEARNING_TRIAL_MIN_MINUTES` (or legacy `CONTINUOUS_LEARNING_TRIAL_MIN_MINUTES`)
- `CONTINUAL_LEARNING_TRIAL_DURATION_MINUTES` (or legacy `CONTINUOUS_LEARNING_TRIAL_DURATION_MINUTES`)

## Output format in AGENTS.md
## Output format

The memory updater writes only:

Expand All @@ -66,6 +122,18 @@ The memory updater writes only:

Each item is a plain bullet point.

## Migration

Older versions stored cadence/index at
`.cursor/hooks/state/continual-learning.json` and
`continual-learning-index.json`. On first run the plugin copies them into the
user-scoped state dir. Tracked originals are left in place; untracked
originals are removed so they stop showing up in `git status`.

To restore the old shared-file behavior, set
`CONTINUAL_LEARNING_WORKSPACE_FILE` to the repo `AGENTS.md` and
`CONTINUAL_LEARNING_ALLOW_SHARED=1`.

## License

MIT
60 changes: 44 additions & 16 deletions continual-learning/agents/agents-memory-updater.md
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.`
Loading