Skip to content

feat(memory): integrate optional PowerMem retrieval into system prompt#68

Open
Teingi wants to merge 1 commit intoHKUDS:mainfrom
Teingi:powermem
Open

feat(memory): integrate optional PowerMem retrieval into system prompt#68
Teingi wants to merge 1 commit intoHKUDS:mainfrom
Teingi:powermem

Conversation

@Teingi
Copy link
Copy Markdown

@Teingi Teingi commented Apr 8, 2026

Summary

What problem does this PR solve?

  • OpenHarness memory is Markdown-first (MEMORY.md + topic files) with keyword/heuristic relevance only. Users who run PowerMem (hybrid vector / full-text / graph retrieval, etc.) had no built-in way to inject PowerMem search results into the assembled system prompt.
  • This PR adds an optional retrieval path so agents can use semantic (and hybrid) memory from PowerMem without changing the default behavior for everyone else.

What changed?

  • Extended MemorySettings with backend (local | powermem_http | powermem_sdk | hybrid) and PowerMem fields (powermem_base_url, powermem_api_key, powermem_user_id, powermem_agent_id, powermem_run_id), plus env overrides (OPENHARNESS_MEMORY_BACKEND, OPENHARNESS_POWERMEM_*).
  • New openharness/memory/powermem_client.py: HTTP search against POST {base}/api/v1/memories/search (via existing httpx); optional in-process SDK via lazy create_memory() when powermem is installed.
  • build_runtime_system_prompt (openharness/prompts/context.py): when backend includes PowerMem and there is a latest user message, append a # PowerMem Retrieval section; local / hybrid still use existing Markdown relevance as before.
  • pyproject.toml: optional extra powermem → powermem>=1.1.0.
  • openharness/memory/init.py: export search_powermem_for_prompt.
  • Tests: tests/test_memory/test_powermem_client.py (response parsing + mocked HTTP).

Validation

  • uv run ruff check src tests scripts
  • uv run pytest -q
  • cd frontend/terminal && npx tsc --noEmit (if frontend touched)

Notes

  • Related issue: (link the tracking issue, e.g. closes [Feature]: (memory): optional PowerMem retrieval for system prompt context #67 )
  • Follow-up work: Document PowerMem in README / README.zh-CN; optional ohmo prompt wiring; MCP or tools for PowerMem write/update if desired; CI job that runs only tests/test_memory/test_powermem_client.py if full suite is heavy (optional).
  • SDK mode: Upstream powermem targets Python 3.11+; OpenHarness remains 3.10+ by default — use powermem_http on 3.10, or install the powermem extra on 3.11+ for powermem_sdk.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: (memory): optional PowerMem retrieval for system prompt context

1 participant