Skip to main content

A library to help facilitate memory recall

Project description

psg_recall

Usage

Installation

Install latest from the GitHub repository:

$ pip install git+https://github.com/problemsolversguild/psg_recall.git

or from pypi

$ pip install psg_recall

Documentation

Documentation can be found hosted on this GitHub repository’s pages. Additionally you can find package manager specific guidelines on pypi.

How to use

psg_recall provides persistent memory storage at three levels:

  • Global - Memories shared across all projects (stored in ~/.solveit_memory/)
  • Project - Memories for the current project directory (stored in .memory/)
  • File - Memories tied to a specific file (stored in .memory/{filename}_memory.txt)
from psg_recall.storage import remember, recall, recall_all, recall_history, forget

Storing memories

Use remember() to store a key-value pair. By default it stores at the project level:

# Store a project-level memory
remember("user_name", "Alice")
'Remembered (project): user_name'
# Store a global memory (available across all projects)
remember("api_preference", "openai", level="global")
'Remembered (global): api_preference'
# Store a file-specific memory (context specifies the filename)
remember("last_edit", "fixed bug on line 42", level="file", context="main.py")
'Remembered (file): last_edit'

Recalling memories

Use recall() to retrieve memories from a specific level. Returns None if the key doesn’t exist:

# Recall a specific key from project level
recall(key="user_name")
'Alice'
# Recall all project-level memories
recall()
'user_name: Alice\n'
# Recall from global level
recall(level="global")
'api_preference: openai\n'

Recalling from all levels

Use recall_all() to get memories from global, project, and file levels combined:

# Get all memories across all levels
print(recall_all(context="main.py"))  # include file context to also get file-level memories
=== GLOBAL ===
api_preference: openai

=== PROJECT ===
user_name: Alice

=== FILE ===
last_edit: fixed bug on line 42

Forgetting memories

Use forget() to remove a key from memory. This also records the removal in history:

# Forget a project-level memory
forget("user_name")
'Forgot (project): user_name'

Viewing history

Use recall_history() to see past changes to memories, including timestamps and whether values were remembered or forgotten:

# View all history for project level
print(recall_history())
2026-01-05 04:33:41 | remember | user_name | Alice
2026-01-05 04:33:41 | forget | user_name | Alice
2026-01-05 04:33:57 | remember | user_name | Alice
2026-01-05 04:33:57 | forget | user_name | Alice
# View history for a specific key
print(recall_history(key="user_name"))
2026-01-05 04:33:41 | remember | user_name | Alice
2026-01-05 04:33:41 | forget | user_name | Alice
2026-01-05 04:33:57 | remember | user_name | Alice
2026-01-05 04:33:57 | forget | user_name | Alice

Export

from nbdev import nbdev_export
from nbdev.quarto import nbdev_docs

nbdev_export()
nbdev_docs()

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

psg_recall-0.0.2.tar.gz (14.4 kB view details)

Uploaded Source

Built Distribution

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

psg_recall-0.0.2-py3-none-any.whl (12.7 kB view details)

Uploaded Python 3

File details

Details for the file psg_recall-0.0.2.tar.gz.

File metadata

  • Download URL: psg_recall-0.0.2.tar.gz
  • Upload date:
  • Size: 14.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for psg_recall-0.0.2.tar.gz
Algorithm Hash digest
SHA256 d73dc4b47476d17c93ba00ba518eb961926e6e9de363c33164f61829949e3c4a
MD5 e3425e479d417fa38cb34ecc6445ed15
BLAKE2b-256 c8f055c2e305415ac27c938ae2204a19f2ad529f40fee9206e3fd29bdafd99ec

See more details on using hashes here.

File details

Details for the file psg_recall-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: psg_recall-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 12.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for psg_recall-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 823ee1c2ba23461fcc2843fd3d0dd1040e796c808c7106203f21061f9e3593a5
MD5 3802de3c21f5922324dbbbda45b77288
BLAKE2b-256 62b3808a89a3dc2ac529bfac7fdcce8c15ecf3784e6c64c3a48bac9c7bd67879

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