|
| 1 | +# Development |
| 2 | + |
| 3 | +## Local Setup |
| 4 | + |
| 5 | +Clone and link locally for plugin development: |
| 6 | + |
| 7 | +```bash |
| 8 | +git clone https://github.com/basicmachines-co/openclaw-basic-memory.git |
| 9 | +cd openclaw-basic-memory |
| 10 | +bun install |
| 11 | +openclaw plugins install -l "$PWD" |
| 12 | +openclaw plugins enable openclaw-basic-memory --slot memory |
| 13 | +openclaw gateway restart |
| 14 | +``` |
| 15 | + |
| 16 | +Or load directly from a path in your OpenClaw config: |
| 17 | + |
| 18 | +```json5 |
| 19 | +{ |
| 20 | + plugins: { |
| 21 | + load: { |
| 22 | + paths: ["~/dev/openclaw-basic-memory"] |
| 23 | + }, |
| 24 | + entries: { |
| 25 | + "openclaw-basic-memory": { |
| 26 | + enabled: true |
| 27 | + } |
| 28 | + }, |
| 29 | + slots: { |
| 30 | + memory: "openclaw-basic-memory" |
| 31 | + } |
| 32 | + } |
| 33 | +} |
| 34 | +``` |
| 35 | + |
| 36 | +## Commands |
| 37 | + |
| 38 | +```bash |
| 39 | +bun run check-types # Type checking |
| 40 | +bun run lint # Linting |
| 41 | +bun test # Run tests (156 tests) |
| 42 | +bun run test:int # Real BM MCP integration tests |
| 43 | +``` |
| 44 | + |
| 45 | +## Integration Tests |
| 46 | + |
| 47 | +Real end-to-end tests for `BmClient` in `integration/bm-client.integration.test.ts`. These launch a real `bm mcp --transport stdio` process and assert actual filesystem/index results. |
| 48 | + |
| 49 | +```bash |
| 50 | +bun run test:int |
| 51 | +``` |
| 52 | + |
| 53 | +By default this uses `./scripts/bm-local.sh`, which runs BM from a sibling `../basic-memory` checkout via `uv run --project ...` when present, and falls back to `bm` on `PATH` otherwise. |
| 54 | + |
| 55 | +Optional overrides: |
| 56 | + |
| 57 | +```bash |
| 58 | +BM_BIN=/absolute/path/to/bm bun run test:int |
| 59 | +BASIC_MEMORY_REPO=/absolute/path/to/basic-memory bun run test:int |
| 60 | +``` |
| 61 | + |
| 62 | +## Publishing to npm |
| 63 | + |
| 64 | +This package is published as `@basicmemory/openclaw-basic-memory`. |
| 65 | + |
| 66 | +```bash |
| 67 | +# Verify release readiness (types + tests + npm pack dry run) |
| 68 | +just release-check |
| 69 | + |
| 70 | +# Inspect publish payload |
| 71 | +just release-pack |
| 72 | + |
| 73 | +# Authenticate once (if needed) |
| 74 | +npm login |
| 75 | + |
| 76 | +# Publish current version from package.json |
| 77 | +just release-publish |
| 78 | +``` |
| 79 | + |
| 80 | +For a full release (version bump + publish + push tag): |
| 81 | + |
| 82 | +```bash |
| 83 | +just release patch # or: minor, major, 0.2.0, etc. |
| 84 | +``` |
| 85 | + |
| 86 | +### GitHub Actions CI/CD |
| 87 | + |
| 88 | +- CI workflow: `.github/workflows/ci.yml` runs on PRs and `main` pushes |
| 89 | +- Release workflow: `.github/workflows/release.yml` runs manually (`workflow_dispatch`) |
| 90 | + 1. Runs release checks |
| 91 | + 2. Bumps version and creates a git tag |
| 92 | + 3. Pushes commit + tag |
| 93 | + 4. Publishes to npm |
| 94 | + 5. Creates a GitHub release |
| 95 | + |
| 96 | +Publishing uses npm OIDC trusted publishing — no secrets required. |
| 97 | + |
| 98 | +## Project Structure |
| 99 | + |
| 100 | +``` |
| 101 | +openclaw-basic-memory/ |
| 102 | +├── index.ts # Plugin entry — manages MCP lifecycle, registers tools |
| 103 | +├── config.ts # Configuration parsing |
| 104 | +├── bm-client.ts # Persistent Basic Memory MCP stdio client |
| 105 | +├── tools/ # Agent tools |
| 106 | +│ ├── search-notes.ts # search_notes |
| 107 | +│ ├── read-note.ts # read_note |
| 108 | +│ ├── write-note.ts # write_note |
| 109 | +│ ├── edit-note.ts # edit_note |
| 110 | +│ ├── delete-note.ts # delete_note |
| 111 | +│ ├── move-note.ts # move_note |
| 112 | +│ ├── build-context.ts # build_context |
| 113 | +│ ├── list-memory-projects.ts # list_memory_projects |
| 114 | +│ ├── list-workspaces.ts # list_workspaces |
| 115 | +│ ├── schema-validate.ts # schema_validate |
| 116 | +│ ├── schema-infer.ts # schema_infer |
| 117 | +│ ├── schema-diff.ts # schema_diff |
| 118 | +│ └── memory-provider.ts # Composited memory_search + memory_get |
| 119 | +├── commands/ |
| 120 | +│ ├── slash.ts # /remember, /recall |
| 121 | +│ ├── skills.ts # /tasks, /reflect, /defrag, /schema |
| 122 | +│ └── cli.ts # openclaw basic-memory CLI |
| 123 | +└── hooks/ |
| 124 | + ├── capture.ts # Auto-capture conversations |
| 125 | + └── recall.ts # Auto-recall (active tasks + recent activity) |
| 126 | +``` |
0 commit comments