feat(memory): add jcode-mempalace-adapter type-conversion layer (#355)#364
Merged
Conversation
Creates a new crate with bidirectional conversions between jcode's MemoryEntry and mempalace's Drawer types. Key design decision: the crate has ZERO dependency on mempalace-core to avoid the libsqlite3-sys version conflict (mempalace uses rusqlite 0.32, jcode uses 0.33 via casr). Instead it defines local mirror types (Drawer, DrawerKind, DrawerId, MemoryScope) that match mempalace's public surface exactly. Conversions provided: - MemoryCategory ↔ DrawerKind (1:1 including Entity, Correction, Custom) - MemoryEntry ↔ Drawer (all fields, including #25 timestamps, #26 confidence/strength, tags, trust, reinforcements, embedding) - MemoryScope ↔ MemoryScope (Project→Local, Global→Global, All→All) - TrustLevel ↔ String 6 unit tests cover: round-trip content, category mapping, kind mapping, scope mapping, drawer defaults, half-life parity. Issues covered: - #355: Type-conversion layer complete - #359: Unit tests + README (part 1) - #356-#358 deferred (need Palace runtime = rusqlite alignment)
…ntegration Issue #356: Data migration tool - New crates/jcode-mempalace-adapter/src/migrate.rs - Reads jcode MemoryGraph JSON files (global + per-project) - Converts MemoryEntry → mempalace Drawer via mirror_drawer_to_real() - Creates HasTag edges via MemoryProvider::tag() - Creates RelatesTo/Supersedes edges via link()/supersede() - Handles legacy MemoryStore (v1 flat Vec) format - Backup (.bak) files before changes - Dry-run mode reports counts without writing - MigrationReport struct with counts + errors + duration Issue #357: MemoryTool config-gated dispatch - Added MemoryBackend enum to jcode-config-types (native|mempalace) - Added memory_backend field to AgentsConfig - Added 'mempalace-backend' feature to jcode-app-core - MemoryTool dispatches to MempalaceAdapter when backend=mempalace - Same 8 actions (remember/recall/search/list/forget/tag/link/related) - MempalaceAdapter wraps Palace with typed action methods Issue #358: Mempalace prompt injection pipeline - In prompting.rs: checks JCODE_MEMORY_BACKEND env var - When mempalace, spawns mempalace_per_turn_pipeline() per turn - Pipeline: embed context → search Palace → surface into PENDING_MEMORY - Writes to same PENDING_MEMORY static so take_pending_memory() unchanged - Falls back to native MemoryAgent when not configured - format_context_for_relevance made pub for cross-crate access Infrastructure: - mempalace-core added as optional dep to adapter (default-features=false) - 'backend' feature in adapter gates Palace runtime + migrate + adapter - mirror_drawer_to_real() converts mirror Drawer → real mempalace Drawer - Re-exports key mempalace-core types from adapter crate - rusqlite 0.33 aligned between mempalace and jcode (no conflict) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
cargo fix --lib auto-removed 3 unused imports flagged by CI: - memory.rs: unused import - memory.rs: unused and imports - mod.rs: unused import
- jcode-base/live_tests.rs: collapse nested if (collapsible_if) - jcode-app-core/tool/mod.rs: restore Mutex import (cargo fix was too aggressive) - jcode-app-core/tool/memory.rs: remove unused imports - jcode-tui/helpers.rs, inline_interactive.rs: remove needless borrows on provider_slug - src/cli/tui_launch.rs: remove needless borrows on provider_slug All pre-existing clippy errors fixed. CI should now pass.
The Mutex import was only needed when feature 'dcp' is enabled (the DcpPlugin field is cfg-gated). Make the import conditional to eliminate the unused-import warning in default builds.
The path dep '../../../mempalace_rust/crates/core' doesn't exist on CI runners. Switch to git dep pointing at the feat/mp-issues-25-35 branch. This fixes the 'cargo metadata --all-features' failure that broke all CI jobs. Also update README to reflect the resolved rusqlite alignment.
# Conflicts: # Cargo.toml # crates/jcode-app-core/src/tool/mod.rs
This was referenced Jun 5, 2026
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Creates a new crate
jcode-mempalace-adapterwith bidirectional conversions between jcode'sMemoryEntryand mempalace'sDrawertypes.Design
Zero dependency on mempalace-core — avoids the
libsqlite3-sysversion conflict (mempalace uses rusqlite 0.32, jcode uses 0.33 via casr). Instead defines local mirror types (Drawer,DrawerKind,DrawerId,MemoryScope) that match mempalace's public surface exactly.Conversions
MemoryCategoryDrawerKind(1:1 including Entity, Correction, Custom)MemoryEntryDrawer(all fields: timestamps, confidence, trust, tags, embeddings, reinforcements)MemoryScopeMemoryScope(Project→Local, Global→Global, All→All)TrustLevelTests
6 unit tests pass: round-trip content, category↔kind mapping, kind→category mapping, scope round-trip, drawer defaults, half-life parity with jcode.
Issues covered
Next steps
backendfeature to pull inmempalace-core, exposeMempalaceAdapterruntime structmemory_backendconfig~/.jcode/memory/*.jsonSee README for full details.