feat(plugins): share native session handoff and soften memory search

This commit is contained in:
kartik-mem0
2026-09-10 18:20:36 +05:30
parent 02f7a9b2c4
commit 82c32f993e
130 changed files with 16430 additions and 379 deletions
@@ -7,7 +7,12 @@ HOST = Path(__file__).resolve().parents[1]
CORE_ROOT = HOST.parent / "agent-plugin-core"
sys.path.insert(0, str(CORE_ROOT))
from build.build import SHARED_SKILLS, build, render_template # noqa: E402
from build.build import ( # noqa: E402
SHARED_SKILLS,
build,
handoff_instructions,
render_template,
)
def test_native_claude_bundle_preserves_working_contract(tmp_path: Path) -> None:
@@ -26,6 +31,7 @@ def test_native_claude_bundle_preserves_working_contract(tmp_path: Path) -> None
"COMMAND_PREFIX": "mem0",
"HARNESS_ID": "claude-code",
"HARNESS_NAME": "Claude Code",
"HANDOFF_INSTRUCTIONS": handoff_instructions("claude-code", "${CLAUDE_PLUGIN_ROOT}"),
}
for skill in SHARED_SKILLS.glob("*/SKILL.md.tmpl"):
rendered = render_template(skill.read_text(encoding="utf-8"), values)
@@ -2306,8 +2306,8 @@ def test_sidekick_instructions_reject_unrequested_related_changes():
prompt = (PLUGIN_ROOT / "agents" / "sidekick.md").read_text()
normalized = " ".join(prompt.split())
assert "Skill" in prompt.split("---", 2)[1]
assert "ALWAYS call `search_memories` before answering anything" in normalized
assert "Do not rely on the chat window" in normalized
assert "When memories from earlier sessions could help" in normalized
assert "Skip another search when the context already answers it" in normalized
assert "Complete only the work the main agent assigned" in normalized
assert "Do not make related improvements" in normalized
assert "report them separately" in normalized
@@ -2783,7 +2783,7 @@ def test_search_skill_describes_memory_as_optional_starting_knowledge():
def test_control_skills_exposed():
names = sorted(p.name for p in (PLUGIN_ROOT / "skills").iterdir() if p.is_dir())
assert names == ["forget", "pause", "remember", "resume", "search", "status"]
assert names == ["forget", "handoff", "pause", "remember", "resume", "search", "status"]
def test_status_skill_runs_cli_and_surfaces_auth_failures():
@@ -3460,7 +3460,7 @@ def test_automatic_flush_can_be_disabled_for_external_harnesses(isolated_env):
def test_version_is_single_sourced():
manifest = json.loads((PLUGIN_ROOT / ".claude-plugin" / "plugin.json").read_text())
assert manifest["name"] == "mem0"
assert manifest["version"] == memory_core.PLUGIN_VERSION == "0.3.1"
assert manifest["version"] == memory_core.PLUGIN_VERSION == "0.4.0"
root = REPOSITORY_ROOT
for mp in (root / "marketplace.json", root / ".claude-plugin" / "marketplace.json"):
entry = next(p for p in json.loads(mp.read_text())["plugins"] if p["name"] == "mem0")