plugins
plugins copied to clipboard
continual-learning: write to user-scoped memory file by default
Summary
Make the continual-learning plugin safe to enable inside team repositories.
Today the plugin defaults to writing learned bullets into the workspace
AGENTS.md and keeping its cadence + incremental-index state under
.cursor/hooks/state/. On a shared repo both of those paths are owned by
every contributor, so:
- personal preferences end up committed into the team's instructions, and
- the two state JSON files permanently show up in
git statusas untracked noise (or get committed by accident).
This PR moves the defaults to user-scoped locations under
~/.cursor/projects/<workspace-slug>/ — the same directory layout Cursor
already uses for agent-transcripts/ — and keeps any write inside the repo
strictly opt-in.
What changes
- New defaults
- Memory file:
~/.cursor/projects/<slug>/AGENTS.local.md(personal, never committed). Cursor's stackedAGENTS.mdloading picks it up automatically. - State dir:
~/.cursor/projects/<slug>/continual-learning/withcadence.json(hook state) andindex.json(incremental index).
- Memory file:
- Opt-in shared file via
CONTINUAL_LEARNING_WORKSPACE_FILE. If set, the hook runsgit check-ignoreagainst it and refuses to write when the file is inside a git repo and not gitignored. The check can be bypassed withCONTINUAL_LEARNING_ALLOW_SHARED=1. - Explicit section routing
## Learned User Preferences→ user file only.## Learned Workspace Facts→ workspace file when configured and not blocked.## Learned Workspace Facts (local)→ user file fallback heading when no workspace file is configured or the workspace file is blocked.
- Hook embeds resolved paths in
followup_messageso theagents-memory-updatersubagent gets concrete absolute paths and the block reason (if any) instead of having to recompute them. - First-run migration copies any pre-existing
.cursor/hooks/state/continual-learning{,-index}.jsoninto the new user-scoped location, keeps a backup under the user state dir, and removes the originals so they stop appearing ingit status. - New env vars (all optional):
CONTINUAL_LEARNING_USER_FILE,CONTINUAL_LEARNING_WORKSPACE_FILE,CONTINUAL_LEARNING_STATE_DIR,CONTINUAL_LEARNING_ALLOW_SHARED. Existing cadence vars and legacyCONTINUOUS_LEARNING_*aliases are unchanged.
Files
continual-learning/hooks/continual-learning-stop.ts— use resolved targets for state paths; build a structured followup message; migrate legacy state once on startup.continual-learning/hooks/lib/memory-targets.ts(new) — slug computation, env-driven path resolution,git check-ignoresafety check, legacy-state migration. ~180 lines, no new dependencies (node:fs,node:os,node:path,node:child_processonly).continual-learning/agents/agents-memory-updater.md— describe the dual-target write model, the section-routing rules, the safety check, and the local-fallback heading. Prefers the embedded paths from the hook when present.continual-learning/skills/continual-learning/SKILL.md— header wording updated; orchestration unchanged.continual-learning/README.md— new "Safe defaults for team repos" and expanded configuration sections.continual-learning/CHANGELOG.md(new) —Unreleasedentry following the format used by sibling plugins.
Backwards compatibility
- Default memory file path changes from workspace
AGENTS.mdto~/.cursor/projects/<slug>/AGENTS.local.md. Existing users who relied on the old behavior can restore it by settingCONTINUAL_LEARNING_WORKSPACE_FILE=<absolute path to AGENTS.md>andCONTINUAL_LEARNING_ALLOW_SHARED=1. - All existing env vars (
CONTINUAL_LEARNING_MIN_TURNS, trial mode flags, theCONTINUOUS_LEARNING_*legacy aliases) keep their current meaning. - Existing cadence/index files in
.cursor/hooks/state/are migrated automatically on the next hook run.
Test plan
- [x]
node scripts/validate-plugins.mjs— passes (no manifest changes). - [x]
bun build continual-learning/hooks/continual-learning-stop.ts— bundles cleanly. - [x] Cold run (no transcript advance) — hook outputs
{}and does not trigger the followup. - [x] Forced trigger with no workspace file configured — followup message
contains the resolved user file path and routes workspace facts to
the user file under
## Learned Workspace Facts (local). - [x] Forced trigger with
CONTINUAL_LEARNING_WORKSPACE_FILEpointing at a tracked file — followup message marks the workspace target asBLOCKEDwith the git-leak reason and routes workspace facts to the user file under## Learned Workspace Facts (local). - [x] Same scenario with
CONTINUAL_LEARNING_ALLOW_SHARED=1— followup message labels the workspace target asshared, may be committedand allows the write. - [x] First-run migration on a workspace that has the old
.cursor/hooks/state/files — files are moved to the user-scoped location, a backup is left there, and the originals are removed fromgit status.
Made with Cursor