@mastra/opencode 0.0.0-key-fix-20260227010020 → 0.0.0-knowledge-org-scope-20260902233451

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE.md CHANGED
@@ -1,3 +1,20 @@
1
+ Portions of this software are licensed as follows:
2
+
3
+ - All content that resides under any directory named `ee/` within this
4
+ repository, including but not limited to:
5
+ - `@mastra/core/auth/ee`
6
+ - `@mastra/core/agent-builder/ee`
7
+ - `@mastra/editor/ee`
8
+
9
+ is licensed under the license defined in [`ee/LICENSE`](https://github.com/mastra-ai/mastra/blob/main/ee/LICENSE).
10
+
11
+ - All third-party components incorporated into the Mastra Software are
12
+ licensed under the original license provided by the owner of the
13
+ applicable component.
14
+
15
+ - Content outside of the above-mentioned directories or restrictions is
16
+ available under the "Apache License 2.0" as defined below.
17
+
1
18
  # Apache License 2.0
2
19
 
3
20
  Copyright (c) 2025 Kepler Software, Inc.
package/README.md ADDED
@@ -0,0 +1,48 @@
1
+ # @mastra/opencode
2
+
3
+ `@mastra/opencode` brings Mastra Observational Memory to OpenCode sessions. It condenses long conversation histories into structured observations so coding sessions retain important context without repeatedly sending the entire transcript to the model.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @mastra/opencode
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ Re-export the plugin from an OpenCode plugin file:
14
+
15
+ ```typescript title=".opencode/plugins/mastra.ts"
16
+ import { MastraPlugin } from '@mastra/opencode';
17
+
18
+ export default MastraPlugin;
19
+ ```
20
+
21
+ Optionally add project-level configuration:
22
+
23
+ ```json title=".opencode/mastra.json"
24
+ {
25
+ "model": "google/gemini-2.5-flash",
26
+ "observation": { "messageTokens": 20000 },
27
+ "reflection": { "observationTokens": 90000 },
28
+ "storagePath": ".opencode/memory/observations.db"
29
+ }
30
+ ```
31
+
32
+ ## Documentation
33
+
34
+ The plugin converts OpenCode user and assistant messages, including text, tool calls, files, images, and reasoning, into Mastra's message format. Before each model request it observes new messages when the configured token threshold is reached, removes history already represented by observations, and injects the optimized observation context into the system prompt.
35
+
36
+ Configuration is read from `.opencode/mastra.json`. It accepts Mastra `ObservationalMemoryOptions` such as the observer model, observation and reflection thresholds, scope, and shared token budget. `storagePath` controls the local SQLite database and defaults to `.opencode/memory/observations.db`.
37
+
38
+ The plugin resolves model credentials lazily from OpenCode's provider store. Existing environment variables take precedence, so OpenCode credentials only fill missing provider keys. Observation data is stored with `LibSQLStore` inside the project and remains available when the OpenCode session is resumed.
39
+
40
+ OpenCode toast notifications report observation and reflection progress. The plugin also registers diagnostic tools for inspecting memory status and stored observations, which helps explain when the next compaction cycle will run and what context has already been retained.
41
+
42
+ ## Changelog
43
+
44
+ See the [package changelog](https://github.com/mastra-ai/mastra/blob/main/integrations/opencode/CHANGELOG.md) for version history and release notes.
45
+
46
+ ## Support
47
+
48
+ We have an [open community Discord](https://discord.gg/mastra-ai). Come and say hello and let us know if you have any questions or need any help getting things running.