opencode-continual-learning
v0.5.0
Published
Automatically and incrementally keeps AGENTS.md up to date by mining session conversations for high-signal learnings
Maintainers
Readme
opencode-continual-learning
Automatically and incrementally keeps AGENTS.md up to date by mining the current session's conversation for high-signal learnings.
Features
- Automatic learning: after a configurable number of completed turns and elapsed time, the plugin silently injects a prompt that tells the AI to run the
continual-learningskill and updateAGENTS.md /learncommand: manually trigger a learning pass at any timeAGENTS.md-aware updates: the AI reads existing entries and updates them in place rather than appending blindly, keeping the file clean and deduplicated- Noise-resistant: only high-signal, reusable information is written—recurring preferences and durable workspace facts only; one-off instructions and transient details are excluded
- Configurable cadence: tune the trigger thresholds via environment variables; trial mode for faster initial feedback
- Standalone skill + plugin automation: the canonical
SKILL.mdlives at the repo root fornpx skillsinstalls, and the plugin mirrors it into.opencode/skills/on first load for OpenCode
Requirements
- OpenCode v1.2.15 or later
Installation
Standalone skill (npx skills)
Install the reusable skill into any supported agent:
npx skills add baradghimire/opencode-continual-learningOpenCode plugin (automation)
Add to your OpenCode config (~/.config/opencode/opencode.json):
{
"plugin": ["opencode-continual-learning"]
}Restart OpenCode and you're ready to go.
Optionally, pin to a specific version for stability:
{
"plugin": ["[email protected]"]
}Usage
Automatic
The plugin runs silently in the background. After the cadence threshold is met (default: 10 completed turns and 120 minutes since the last run), it injects a prompt that asks the AI to invoke the continual-learning skill. The AI reads AGENTS.md, mines the session conversation, and writes back only:
## Learned User Preferences— recurring corrections and stated preferences## Learned Workspace Facts— durable facts about the project (patterns, conventions, tech choices)
Manual
Run /learn at any point to trigger a learning pass immediately:
/learnThe cadence timer is reset after a manual run so the auto-trigger backs off.
What gets written to AGENTS.md
The AI only stores items that meet all of these criteria:
| Criterion | Example |
|---|---|
| Actionable in future sessions | "Always use pnpm instead of npm" |
| Stable across sessions | "The API layer lives in packages/api/src/" |
| Repeated or stated as a broad rule | User has corrected the same thing multiple times |
| Non-sensitive | No credentials, personal data |
Items that are never stored: secrets, one-off task instructions, transient details (branch names, commit hashes, temporary error messages).
Configuration
Cadence (environment variables)
| Variable | Default | Description |
|---|---|---|
| CONTINUAL_LEARNING_MIN_TURNS | 10 | Minimum completed turns before triggering |
| CONTINUAL_LEARNING_MIN_MINUTES | 120 | Minimum minutes since last run |
| CONTINUAL_LEARNING_TRIAL_MODE | false | Enable reduced thresholds for initial testing |
| CONTINUAL_LEARNING_TRIAL_MIN_TURNS | 3 | Min turns in trial mode |
| CONTINUAL_LEARNING_TRIAL_MIN_MINUTES | 15 | Min minutes in trial mode |
| CONTINUAL_LEARNING_TRIAL_DURATION_MINUTES | 1440 | How long trial mode lasts (minutes) |
Set CONTINUAL_LEARNING_TRIAL_MODE=1 for quicker feedback when first setting up the plugin.
State file
Per-project cadence state is stored at:
<project>/.opencode/state/continual-learning.jsonDelete this file to reset the turn counter and timer.
Skill file
The plugin writes a SKILL.md to:
<project>/.opencode/skills/continual-learning/SKILL.mdThis copy comes from the canonical repo-root SKILL.md. The plugin writes it on first load if it does not already exist, and then leaves your project copy alone.
Contributing
git clone https://github.com/baradghimire/opencode-continual-learning
cd opencode-continual-learning
bun installSymlink the plugin to your OpenCode config for local development:
mkdir -p ~/.config/opencode/plugins
ln -sf "$(pwd)/src/plugin.ts" ~/.config/opencode/plugins/continual-learning.tsRun the type checker:
bun run typecheckReleasing
This repository uses an automated release flow with minimal manual steps.
Workflow Overview
| File | Trigger | Purpose |
|------|---------|---------|
| ci.yml | PRs + pushes to main | Type checking and validation |
| release-please.yml | Push to main | Opens release PR with version bump and changelog |
| release.yml | release.published | Publishes to npm with provenance |
Step-by-Step
- Open a feature branch from
main - Make changes, commit with Conventional Commits
- Push and open a PR —
ciworkflow runs typecheck - Merge to
main— requires PR review (direct pushes blocked by ruleset) release-pleasecreates/updates a Release PR — includes version bump and changelog- Review and merge the Release PR — creates a
v*tag and a published GitHub Release releaseworkflow runs automatically — builds, attests, uploads tarball, and publishes to npm with provenance
Direct pushes to main are blocked
The repository has a ruleset enforcing PR-based changes with required review. All changes must go through pull requests.
GitHub Actions Details
ci: Validates TypeScript on every PR and push tomainrelease-please: Uses googleapis/release-please-action to manage releases. Parses Conventional Commits to determine semver bumps.release: Publishes to npm with--provenanceflag. Uses Bun for dependencies, npm for publish (npm provenance not yet available in Bun).oc-zen-free: Reusable workflow that selects free OpenCode models first, falling back toopencode/kimi-k2.upstream-sync: Weekly check for upstream dependency updates from cursor/plugins and opencode-handoff.
Required Secret for Full Release Automation
Set a repository secret named RELEASE_PLEASE_TOKEN (PAT or GitHub App token with repo/workflow permissions).
Using the default GITHUB_TOKEN can prevent downstream PR-triggered workflows from firing on release-please-created PRs.
Manual Release Trigger
You can manually trigger release-please from the GitHub Actions UI if needed:
- Go to Actions → release-please → Run workflow
- Select branch
mainand run
Attribution
This plugin is inspired by and draws directly from:
cursor/plugins — continual-learning: the original plugin concept, cadence logic, SKILL.md workflow, and
AGENTS.mdoutput contract. The trigger cadence, trial mode, and inclusion/exclusion rules are adapted from Cursor's implementation.Josh Thomas' original OpenCode handoff plugin: this repository was forked from Josh Thomas' work and adapted for continual learning. It informed the OpenCode plugin architecture usage, patterns for
@opencode-ai/pluginand@opencode-ai/sdk, and the command/event hook structure used here.
License
opencode-continual-learning is licensed under the MIT license. See the LICENSE file for more information.
opencode-continual-learning is not built by, or affiliated with, the OpenCode team.
OpenCode is ©2025 Anomaly.
