ReasoningBank is a Go module for storing, retrieving, and evolving reasoning patterns for LLM agents.
ReasoningBank acts as a memory layer for agents. It stores structured “patterns” (rules, templates, guardrails), retrieves them by semantic intent and filters, ranks them by quality signals, and updates them based on feedback.
- Store patterns with metadata (domain, type, keywords, tags).
- Retrieve the most relevant patterns for a query (vector + keyword).
- Rank using confidence, success rate, recency, and diversity.
- Learn from feedback to improve future ranking.
Client
| /v1/patterns, /v1/retrieve, /v1/feedback
v
API (HTTP/gRPC/MCP)
| store / retrieve / feedback
v
Retriever + Ranker ---> Learning (confidence updates)
|
v
Qdrant (vectors + payloads)
- Storage: Qdrant for vector + payload storage.
- Retriever: hybrid search with filters and ranking.
- Learning: metric updates from outcomes.
- Transport: HTTP, gRPC, MCP.
- Observability: Prometheus metrics.
- Policy/Compliance: reusable block/allow rules and filters.
- Observability: common metric queries and alert patterns.
- Analytics: reusable ClickHouse query templates.
- Agent memory: capture expert solutions for reuse across tasks.
Pattern fields you will use most:
title,description,domain,pattern_typekeywords,tagsmetrics(confidence, success_count, failure_count, last_used_at, usage_count)
- Create a pattern:
curl -sS -X POST localhost:8080/v1/patterns \
-H 'Content-Type: application/json' \
-d '{
"title": "SUB_PROTOCOL for blocking calls",
"description": "Use SUB_PROTOCOL to block voice calls",
"domain": "policy",
"pattern_type": "positive",
"keywords": ["calls", "block"],
"tags": ["policy_create", "calls"]
}'- Retrieve patterns:
curl -sS -X POST localhost:8080/v1/retrieve \
-H 'Content-Type: application/json' \
-d '{
"query": "how to block calls",
"options": { "top_k": 5, "domain": "policy", "include_negative": true }
}'- Send feedback:
curl -sS -X POST localhost:8080/v1/feedback \
-H 'Content-Type: application/json' \
-d '{ "pattern_id": "pat-001", "outcome": "success" }'docker compose up -d --buildcurl -sS localhost:8080/healthz
POST /v1/patternscreate a patternGET /v1/patternslist patternsGET /v1/patterns/{id}fetch by idPOST /v1/retrieveretrieve top‑k patternsPOST /v1/feedbackrecord outcome for a patternGET /healthzhealth checkGET /metricsPrometheus metrics
Docker Compose uses env-driven port mappings. Override in .env:
RB_API_PORT(default8080)RB_GRPC_PORT(default50051)RB_METRICS_PORT(default9090)RB_QDRANT_PORT(default6333)
When running in Docker, use RB_STORAGE_QDRANT_URL=http://qdrant:6333 (the container network hostname).
Run the MCP server (stdio transport):
go run ./cmd/mcp./scripts/reset_qdrant.shSet RB_LLM_OPENAI_API_KEY and embedding keys in .env or a local override like .env.local before running LLM-backed features.