Skip to main content

Token-efficient controllable memory gate for AI coding agents.

Project description

RecallGate 0 API calls MIT Tests

RecallGate

Give every AI agent only the memory it needs — and nothing else.

RecallGate is a token-efficient, controllable memory gate for AI coding agents.

It helps Claude Code, Codex CLI, Cursor, Gemini CLI, Copilot-style agents, and multi-agent coding workflows stop wasting context on irrelevant history.

Without RecallGate:  1,240 tokens → $0.02 per ask → model reads everything
With RecallGate:        95 tokens → $0.001 per ask → model reads only what matters
                                                                  ▲ 92.3% cheaper

Zero dependencies. Zero API calls. Offline. One .recallgate folder.


Install

pip install recallgate
# or from source
git clone https://github.com/lamguo/recallgate.git
cd recallgate && pip install -e .

Quick start — 10 seconds to value

# 1. Init a workspace in your project
cd my-project && recall-gate init

# 2. Add project rules (they stay in Git-friendly .md files)
recall-gate add "Keep zero core dependencies." --role coder --priority high
recall-gate add "Tests use temp fixtures, not example files." --role tester
recall-gate add "README must match CLI behavior exactly." --role writer

# 3. Generate a 100-token brief for your coding agent
recall-gate brief "fix CI pipeline test failure" --role tester --budget 100

Paste the output into your AI agent. That's it.


Why you'll use this

"My AI keeps forgetting the project rules"

recall-gate correct "model keeps suggesting requests library — we use stdlib only"

Outputs a <100-token correction brief. Paste it into any AI agent. Problem solved.

"I'm burning tokens on irrelevant context"

recall-gate estimate --task "fix tests" --role tester --json

Returns structured data: {"full_active_memory_tokens": 1240, "injected_brief_tokens": 95, "estimated_saving_percent": 92.3}. Know your savings before you inject.

"Coder, tester, and writer agents need different context"

recall-gate brief "fix deployment" --role coder     # sees deployment rules
recall-gate brief "update docs"   --role writer     # sees README guidelines
recall-gate brief "review PR"     --role reviewer    # sees audit checklist

Each agent role sees only its relevant memories. Shared rules go to --role all.

"I have 50 memories and don't know what's stale"

recall-gate review --apply          # auto-archive low-value memories
recall-gate list --sort use_count   # see what's never been used
recall-gate search "fixtures"       # find without opening index.json

Features

What Why it matters
🎯 Role-filtered briefs Coder gets coding rules, writer gets docs rules, tester gets test rules
✂️ Token budget control Set default_budget = 100 in config — briefs are hard-capped
🔄 Memory lifecycle activearchivetrashdelete. Nothing lost by accident
🔧 Edit in place recall-gate edit mem_0001 --priority critical — no delete+re-create
🔍 Full-text search Searches content, short text, keywords, scope, type, priority
📦 JSON output --json on every command — pipe into scripts, editors, MCP
📂 Git-friendly storage Each memory is a .md file with YAML frontmatter. Diff, commit, review
🌐 CJK support Chinese memory gets readable slugs and meaningful keywords
🧼 Auto-review recall-gate review --apply archives unused memories automatically

Memory lifecycle

active   → readable by default
archive  → hidden but recoverable
trash    → blocked from agents, still recoverable
deleted  → permanently removed from index and disk

Role-based routing

Every memory targets one or more roles. --role all means everyone sees it.

recall-gate brief "fix tests"    --role tester     # only tester memories
recall-gate brief "update README" --role writer    # only writer memories
recall-gate brief "review"       --role reviewer   # only reviewer memories

The goal: Shared outline, private depth.


Command reference

recall-gate
  init                           Create workspace
  add <content>                  Add a memory
  edit/update <id>               Edit memory fields
  info <id>                      Full memory details
  list [--sort] [--reverse]      List memories
  search <query>                 Full-text search
  brief <task>                   Token-efficient memory brief
  correct <issue>                Correction brief (model forgets)
  estimate                       Token cost estimate
  review [--apply]               Suggest/apply cleanup
  archive / trash / restore      Lifecycle commands
  promote <id>                   Move conversation to project
  delete <id> --yes              Permanent removal

Global flags:
  --json      Machine-readable output on all commands
  --root      Target a specific workspace (for automation)

About injection

brief prints plain text by design in v0.1.0. You copy the output into Claude Code, Codex CLI, Cursor, Gemini CLI, Copilot Chat, or any other coding agent.

Automatic injection is intentionally not included in the first version because the core tool should stay local, predictable, and provider-agnostic. Future integrations can add MCP, editor plugins, or agent hooks on top of the same brief engine.


Design philosophy

Default model calls:       0
Default API keys:          0
Default runtime deps:      0
Default storage:           local Markdown + JSON
Default tokenizer:         built-in estimator
Default test discovery:    python -m unittest discover

RecallGate is built to be cheap, local, and predictable. No vector database. No LLM calls. No network. No vendor lock-in. You commit your .recallgate folder to Git, and every teammate gets the same memory.

What RecallGate is

  • A local memory gate
  • A memory firewall
  • A token-saving brief generator
  • A role-based memory router
  • A stale model memory correction layer

What RecallGate is not

  • Not a hosted memory service
  • Not a vector database
  • Not a full AI agent framework
  • Not a replacement for Claude Code, Codex, Cursor, or Copilot
  • Not a tool that blindly remembers everything

Status

v0.1.0 — alpha MVP with 31 unit tests, 0 dependencies, and 17 CLI commands.

Coming next: MCP server, editor plugins, auto-conflict detection, and optional AI compression.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

recallgate-0.1.0.tar.gz (24.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

recallgate-0.1.0-py3-none-any.whl (18.4 kB view details)

Uploaded Python 3

File details

Details for the file recallgate-0.1.0.tar.gz.

File metadata

  • Download URL: recallgate-0.1.0.tar.gz
  • Upload date:
  • Size: 24.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for recallgate-0.1.0.tar.gz
Algorithm Hash digest
SHA256 58af6bafa82f1f0aedba0da135168f3bf24281cda81f83743b54aed0f840ff39
MD5 7cc5b3bc2b54bb3c2a854a24eeb2dc1b
BLAKE2b-256 136c24058301615ca9f1168669cedaa192b188909333743d891931af1dad493e

See more details on using hashes here.

File details

Details for the file recallgate-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: recallgate-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 18.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for recallgate-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0d46931f0e025f8947ae8d071b9100d3ae939546c476ed9fa85b3f990c063ccb
MD5 25c938e678b675c31a21f0f0d00ce05c
BLAKE2b-256 4be2cb6b0da88c5946c8c08596312fe6e6071de6a213874b32b88f25d2843de4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page