- This is an OpenCode plugin, not the MemPalace app itself. The shipped runtime is
src/index.tsplus helpers insrc/config.ts,src/mempalace.ts,src/mining.ts, andsrc/session.ts;skills/mempalace/SKILL.mdis bundled data. src/index.tsis the runtime entrypoint exported by the package. It logs MemPalace availability diagnostics, installs config, exposes themempalace_mine_sessiontool, wires automatic session mining hooks, and injectsmempalace wake-upoutput into prompt/compaction hooks.src/config.tsinjects themempalaceMCP server, slash commands, and the bundled skill path into OpenCode config.src/mempalace.tsis the MemPalace CLI integration layer: command discovery, startup diagnostics, project readiness checks, andwake-upexecution.src/mining.tsandsrc/session.tsimplement transcript export andmempalace mine ... --mode convosintegration using the OpenCode client API instead of SQLite.
- Install deps with
bun install. - Typecheck with
bun run typecheck. - Run tests with
bun test. - CI and release workflows run
bun install --frozen-lockfile, thenbun run typecheck, thenbun test. Keep that order when doing full verification.
- OpenCode loads this plugin directly from TypeScript via Bun. There is no build step and no compiled output to update.
- This repo no longer auto-installs MemPalace. If the
mempalaceCLI or Python module is missing, startup logs warn clearly but the plugin stays loaded. - The injected MCP server is currently hardcoded to
python3 -m mempalace.mcp_server. Do not document or rely on a Python fallback unless the code adds it back. applyMemPalaceConfigmust not overwrite an existingmcp.mempalaceentry.- The skill injection expects a directory path in
cfg.skills.paths, not a direct path toSKILL.md. - Runtime options now include
threshold,autoMine,injectWakeUp,injectOnCompaction,maxWakeUpChars,flushOnIdle, andflushOnExit. - Automatic conversation mining uses project readiness checks via
mempalace status; when the project is not initialized, the plugin warns once and skips auto-mining and wake-up injection until/mempalace-initis run. flushOnExitcurrently only installs graceful signal handlers. It is not a true synchronous crash-safe flush yet.
tests/config.test.tscovers config-injection invariants;tests/plugin.test.tscovers runtime option logging and wake-up injection toggles. Update the appropriate file when changing config or runtime hook behavior.- If you change plugin bootstrap logic in
src/index.ts, at least runbun run typecheckandbun test.
- For end-to-end manual testing, point
~/.config/opencode/opencode.jsonat/path/to/opencode-mempalace/src/index.ts. - Useful checks: plugin loads cleanly, existing
mempalaceMCP config is preserved, themempalaceskill appears,/mempalace-*commands are present,mempalace wake-upcontent appears in prompts when enabled, and themempalace_mine_sessiontool can manually mine the current session.
- This package uses Release Please (
release-please.ymlplusrelease-please-config.jsonand.release-please-manifest.json). Prefer Conventional Commits because releases are derived from commit history. - Publishing to npm is handled by GitHub Actions after Release Please creates a release, and the publish job reruns typecheck and tests first.