opencode-fractal-memory 0.2.0

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.
Files changed (127) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +493 -0
  3. package/agent/memory-hints.md +98 -0
  4. package/agent/memory-researcher.md +56 -0
  5. package/commands/memory-auto-test.md +10 -0
  6. package/commands/memory-cache-status.md +13 -0
  7. package/commands/memory-check-context.md +4 -0
  8. package/commands/memory-compress.md +13 -0
  9. package/commands/memory-dashboard.md +23 -0
  10. package/commands/memory-delete.md +24 -0
  11. package/commands/memory-detect-topics.md +28 -0
  12. package/commands/memory-distill.md +35 -0
  13. package/commands/memory-drilldown-query.md +28 -0
  14. package/commands/memory-drilldown.md +11 -0
  15. package/commands/memory-extract-patterns.md +4 -0
  16. package/commands/memory-generate-embeddings.md +26 -0
  17. package/commands/memory-get.md +26 -0
  18. package/commands/memory-help.md +55 -0
  19. package/commands/memory-injection-feedback.md +26 -0
  20. package/commands/memory-injection-stats.md +11 -0
  21. package/commands/memory-list.md +4 -0
  22. package/commands/memory-llm-compress.md +34 -0
  23. package/commands/memory-mcp.md +20 -0
  24. package/commands/memory-prune.md +4 -0
  25. package/commands/memory-rate.md +48 -0
  26. package/commands/memory-reflect.md +37 -0
  27. package/commands/memory-replace.md +26 -0
  28. package/commands/memory-retrieve.md +34 -0
  29. package/commands/memory-search.md +28 -0
  30. package/commands/memory-session-stats.md +4 -0
  31. package/commands/memory-set.md +31 -0
  32. package/commands/memory-stats.md +11 -0
  33. package/commands/memory-summarize.md +29 -0
  34. package/commands/memory-tool-stats.md +4 -0
  35. package/commands/memory-total-tokens.md +10 -0
  36. package/commands/memory-verify.md +4 -0
  37. package/commands/memory-version.md +9 -0
  38. package/dist/cache.js +39 -0
  39. package/dist/config.js +120 -0
  40. package/dist/embeddings.js +125 -0
  41. package/dist/ensure-models.js +70 -0
  42. package/dist/file-summary.js +143 -0
  43. package/dist/frontmatter.js +28 -0
  44. package/dist/hnsw-index.js +138 -0
  45. package/dist/hooks/auto-discover.js +4 -0
  46. package/dist/hooks/auto-distill.js +120 -0
  47. package/dist/hooks/auto-retrieve/content.js +47 -0
  48. package/dist/hooks/auto-retrieve/detection.js +50 -0
  49. package/dist/hooks/auto-retrieve/formatting.js +19 -0
  50. package/dist/hooks/auto-retrieve/index.js +163 -0
  51. package/dist/hooks/auto-retrieve/scoring.js +56 -0
  52. package/dist/hooks/auto-retrieve.js +1 -0
  53. package/dist/hooks/index.js +4 -0
  54. package/dist/hooks/predictive-rating.js +87 -0
  55. package/dist/journal.js +279 -0
  56. package/dist/logging.js +147 -0
  57. package/dist/management/helpers.js +227 -0
  58. package/dist/management/router.js +48 -0
  59. package/dist/management/routes.js +197 -0
  60. package/dist/management-server.js +4 -0
  61. package/dist/management-standalone.js +31 -0
  62. package/dist/mcp/logging.js +57 -0
  63. package/dist/mcp/server.js +251 -0
  64. package/dist/mcp/transform.js +48 -0
  65. package/dist/mcp-server.js +18 -0
  66. package/dist/memory.js +2 -0
  67. package/dist/ollama.js +74 -0
  68. package/dist/plugin/hooks.js +168 -0
  69. package/dist/plugin/index.js +28 -0
  70. package/dist/plugin/init.js +109 -0
  71. package/dist/plugin/state.js +75 -0
  72. package/dist/plugin/tools.js +45 -0
  73. package/dist/plugin.js +2 -0
  74. package/dist/procedural/store.js +1 -0
  75. package/dist/procedural/types.js +1 -0
  76. package/dist/seed-nodes.js +804 -0
  77. package/dist/storage/compress-ops.js +129 -0
  78. package/dist/storage/compression/formatters.js +243 -0
  79. package/dist/storage/compression/index.js +107 -0
  80. package/dist/storage/compression/patterns.js +138 -0
  81. package/dist/storage/expiration.js +66 -0
  82. package/dist/storage/index.js +1 -0
  83. package/dist/storage/injection-events.js +82 -0
  84. package/dist/storage/lifecycle.js +65 -0
  85. package/dist/storage/maintenance.js +60 -0
  86. package/dist/storage/migrations/definitions.js +374 -0
  87. package/dist/storage/migrations/index.js +21 -0
  88. package/dist/storage/navigation.js +98 -0
  89. package/dist/storage/queries/base.js +44 -0
  90. package/dist/storage/queries/links.js +32 -0
  91. package/dist/storage/queries/nodes.js +189 -0
  92. package/dist/storage/queries/search-helpers.js +239 -0
  93. package/dist/storage/scoring.js +36 -0
  94. package/dist/storage/search.js +233 -0
  95. package/dist/storage/session-tracking.js +180 -0
  96. package/dist/storage/sqlite.js +329 -0
  97. package/dist/storage/tool-usage.js +56 -0
  98. package/dist/storage/types.js +1 -0
  99. package/dist/storage/utils.js +94 -0
  100. package/dist/tools/auto-test.js +24 -0
  101. package/dist/tools/cache-status.js +36 -0
  102. package/dist/tools/compress.js +186 -0
  103. package/dist/tools/core.js +307 -0
  104. package/dist/tools/dashboard.js +97 -0
  105. package/dist/tools/help.js +59 -0
  106. package/dist/tools/index.js +12 -0
  107. package/dist/tools/inject.js +91 -0
  108. package/dist/tools/injection-debug.js +48 -0
  109. package/dist/tools/journal.js +105 -0
  110. package/dist/tools/llm-compress.js +41 -0
  111. package/dist/tools/middle-term.js +68 -0
  112. package/dist/tools/playbook.js +64 -0
  113. package/dist/tools/reflect.js +291 -0
  114. package/dist/tools/search.js +188 -0
  115. package/dist/tools/session.js +189 -0
  116. package/dist/tools/shared.js +74 -0
  117. package/dist/tools/skill.js +37 -0
  118. package/dist/tools/stats.js +256 -0
  119. package/dist/tools/version.js +13 -0
  120. package/dist/tools.js +18 -0
  121. package/dist/utils/hybridScore.js +67 -0
  122. package/management/public/app.js +1529 -0
  123. package/management/public/index.html +486 -0
  124. package/management/public/three.min.js +6 -0
  125. package/package.json +65 -0
  126. package/scripts/download-models.ts +16 -0
  127. package/scripts/postinstall.cjs +30 -0
package/package.json ADDED
@@ -0,0 +1,65 @@
1
+ {
2
+ "name": "opencode-fractal-memory",
3
+ "version": "0.2.0",
4
+ "description": "Fractal memory system for OpenCode with semantic search and automatic compression.",
5
+ "main": "dist/plugin.js",
6
+ "type": "module",
7
+ "files": [
8
+ "dist",
9
+ "agent",
10
+ "commands",
11
+ "management",
12
+ "scripts"
13
+ ],
14
+ "keywords": [
15
+ "opencode",
16
+ "opencode-plugin",
17
+ "memory",
18
+ "embeddings",
19
+ "semantic-search",
20
+ "hnsw",
21
+ "vector-search",
22
+ "bm25",
23
+ "agent-memory"
24
+ ],
25
+ "license": "MIT",
26
+ "repository": {
27
+ "type": "git",
28
+ "url": "git+https://github.com/holgerreppert/opencode-fractal-memory.git"
29
+ },
30
+ "trustedDependencies": [],
31
+ "scripts": {
32
+ "build": "tsc",
33
+ "prepublishOnly": "npm run build && npm run typecheck",
34
+ "postinstall": "node scripts/postinstall.cjs",
35
+ "test": "bun test",
36
+ "typecheck": "tsc --noEmit",
37
+ "view": "bun run dist/management-standalone.js",
38
+ "mcp": "bun run dist/mcp-server.js"
39
+ },
40
+ "dependencies": {
41
+ "@huggingface/tokenizers": "^0.1.3",
42
+ "@modelcontextprotocol/sdk": "^1.29.0",
43
+ "hnsw": "^1.1.1",
44
+ "js-yaml": "^4.2.0",
45
+ "onnxruntime-web": "^1.26.0",
46
+ "zod": "^4.4.3"
47
+ },
48
+ "peerDependencies": {
49
+ "@opencode-ai/plugin": "^1.15.13"
50
+ },
51
+ "devDependencies": {
52
+ "@opencode-ai/plugin": "^1.15.13",
53
+ "@tsconfig/bun": "^1.0.10",
54
+ "@types/bun": "^1.3.14",
55
+ "@types/js-yaml": "^4.0.9",
56
+ "@types/node": "^25.9.1",
57
+ "esbuild": "^0.28.0",
58
+ "typescript": "^6.0.3"
59
+ },
60
+ "engines": {
61
+ "node": ">=18.0.0",
62
+ "bun": ">=1.0.0"
63
+ },
64
+ "overrides": {}
65
+ }
@@ -0,0 +1,16 @@
1
+ import { ensureModels, ensureAgentFiles, ensureCommandFiles } from "../src/ensure-models";
2
+
3
+ async function main() {
4
+ console.log("Checking embedding model files...");
5
+ await ensureModels();
6
+ console.log("Copying agent files...");
7
+ await ensureAgentFiles();
8
+ console.log("Copying command files...");
9
+ await ensureCommandFiles();
10
+ console.log("Done.");
11
+ }
12
+
13
+ main().catch((err) => {
14
+ console.error("Failed to download models:", err);
15
+ process.exit(1);
16
+ });
@@ -0,0 +1,30 @@
1
+ const fs = require("fs");
2
+ const path = require("path");
3
+ const { execSync } = require("child_process");
4
+
5
+ const home = process.env.HOME || process.env.USERPROFILE;
6
+ const configDir = path.join(home, ".config", "opencode");
7
+
8
+ function copyFiles(srcDir, destDir) {
9
+ const destPath = path.join(configDir, destDir);
10
+ fs.mkdirSync(destPath, { recursive: true });
11
+ try {
12
+ const files = fs.readdirSync(srcDir);
13
+ for (const f of files) {
14
+ try {
15
+ fs.copyFileSync(path.join(srcDir, f), path.join(destPath, f));
16
+ } catch {}
17
+ }
18
+ } catch {}
19
+ }
20
+
21
+ copyFiles("agent", "agent");
22
+ copyFiles("commands", "commands");
23
+
24
+ try {
25
+ execSync("bun run scripts/download-models.ts", { stdio: "inherit" });
26
+ } catch {
27
+ console.log(
28
+ "bun not available — models will download automatically on first plugin load",
29
+ );
30
+ }