Skip to content

OnlyTerp/memory-bridge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Memory Bridge

Dependency-free Node.js bridge for OpenClaw semantic memory. It provides:

  • memory-query.js for on-demand memory search from any coding agent
  • preflight-context.js for pulling relevant memory into a CONTEXT.md file before agent startup

Requirements

  • Node.js 24+
  • openclaw available in PATH
  • Windows environment supported by the OpenClaw CLI

Files

  • memory-query.js
  • preflight-context.js
  • test.js

Usage

Query memory directly

node memory-query.js "how does the auth module work"
node memory-query.js "past decisions about database schema" --max-results 10
node memory-query.js "error handling patterns" --agent ops --json

Default behavior:

  • agent: ops
  • max results: 5
  • output: human-readable summary with path, score, and snippet

Preflight context generation

node preflight-context.js --task "Build a REST API for user management" --workdir C:\path\to\project

Optional flags:

node preflight-context.js --task "Refactor auth middleware" --workdir C:\repo --agent ops --max-results 8 --context-limit 18

Behavior:

  1. Builds 3-5 search angles from the task.
  2. Queries memory for each angle.
  3. Deduplicates and ranks results.
  4. Writes CONTEXT.md in the target workdir.

CONTEXT.md is structured for LLM consumption and includes:

  • source file path
  • line range
  • relevance score
  • matched query angles
  • raw text snippet

Error handling

The scripts fail clearly when:

  • openclaw is not installed or not in PATH
  • the memory search command returns non-zero
  • JSON returned by the CLI is invalid
  • the target workdir does not exist

Tests

Run smoke tests:

node test.js

The tests validate CLI formatting, JSON passthrough, query generation, deduplication, and markdown output by stubbing the openclaw binary.

About

CLI bridge into OpenClaw semantic memory for coding agents. Gives Codex/Claude Code access to 24,700+ chunks of institutional knowledge via Qwen3-VL-Embedding-8B (4096-dim) on RTX 5090.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors