Skip to content

feat: Implement LocalBackend#124

Draft
DaevMithran wants to merge 10 commits intomainfrom
local
Draft

feat: Implement LocalBackend#124
DaevMithran wants to merge 10 commits intomainfrom
local

Conversation

@DaevMithran
Copy link
Copy Markdown
Collaborator

@DaevMithran DaevMithran commented Apr 7, 2026

Summary

  • Add LocalBackend implementing ContextoBackend that runs the full ingestion pipeline locally: extract → summarize (LLM) → embed → cluster (AGNES) → persist
  • Add episode summarizer that calls OpenRouter/OpenAI with the same prompt and parameters as the remote API (gpt-4o-mini, temperature: 0.2, JSON response format)
  • Wire into plugin config via mode: 'local' option: provider and API key are resolved from OpenClaw runtime defaults, no duplicate config needed
  • Storage is pluggable via MindmapStorage interface, defaults to jsonFileStorage('.contexto/mindmap.json')

Motivation

@ekai/contexto only shipped with RemoteBackend, requiring an external API for summarization, ingestion, and search. Users who want to run fully local had no option. The ContextoBackend interface was designed to be pluggable — this PR provides the local implementation.

Usage

{
  "mode": "local"
}

@DaevMithran DaevMithran marked this pull request as draft April 7, 2026 16:35
@DaevMithran DaevMithran marked this pull request as ready for review April 8, 2026 09:40
@DaevMithran DaevMithran force-pushed the local branch 6 times, most recently from d3f7e0d to dd0626a Compare April 8, 2026 13:05
@DaevMithran DaevMithran requested a review from sm86 April 8, 2026 13:28
@sm86
Copy link
Copy Markdown
Contributor

sm86 commented Apr 9, 2026

A few things look worth fixing before merge:

  • In local mode, contexto is only registered after an async API-key lookup finishes. OpenClaw ignores async registration after register() returns, so the context engine may not be available when the slot is resolved.
  • The local summarizer only indexes userMessage and assistantMessages; it drops toolMessages. That means tool-derived facts can become unretrievable, even though the README says episodes include tool output.
  • This PR removes contextEnabled, so existing installs with contextEnabled=false will silently start retrieving/injecting context again after upgrade.

Also worth confirming: release.config.cjs now treats breaking as minor and feat as patch. If that was intentional, fine, but it looks unusual enough to double-check.

@DaevMithran DaevMithran marked this pull request as draft April 9, 2026 09:15
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.

2 participants