Metadata-Version: 2.4
Name: psg_recall
Version: 0.0.2
Summary: A library to help facilitate memory recall
Home-page: https://github.com/problemsolversguild/psg_recall
Author: Kevin Bird
Author-email: kevin@problemsolversguild.com
License: Apache Software License 2.0
Keywords: nbdev jupyter notebook python
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Natural Language :: English
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: License :: OSI Approved :: Apache Software License
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: dev
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: keywords
Dynamic: license
Dynamic: license-file
Dynamic: provides-extra
Dynamic: requires-python
Dynamic: summary

# psg_recall


<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->

## Usage

### Installation

Install latest from the GitHub
[repository](https://github.com/problemsolversguild/psg_recall):

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

or from [pypi](https://pypi.org/project/psg_recall/)

``` sh
$ pip install psg_recall
```

### Documentation

Documentation can be found hosted on this GitHub
[repository](https://github.com/problemsolversguild/psg_recall)’s
[pages](https://problemsolversguild.github.io/psg_recall/). Additionally
you can find package manager specific guidelines on
[pypi](https://pypi.org/project/psg_recall/).

## 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`)

``` python
from psg_recall.storage import remember, recall, recall_all, recall_history, forget
```

### Storing memories

Use
[`remember()`](https://problemsolversguild.github.io/psg_recall/storage.html#remember)
to store a key-value pair. By default it stores at the project level:

``` python
# Store a project-level memory
remember("user_name", "Alice")
```

    'Remembered (project): user_name'

``` python
# Store a global memory (available across all projects)
remember("api_preference", "openai", level="global")
```

    'Remembered (global): api_preference'

``` python
# 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()`](https://problemsolversguild.github.io/psg_recall/retrieval.html#recall)
to retrieve memories from a specific level. Returns `None` if the key
doesn’t exist:

``` python
# Recall a specific key from project level
recall(key="user_name")
```

    'Alice'

``` python
# Recall all project-level memories
recall()
```

    'user_name: Alice\n'

``` python
# Recall from global level
recall(level="global")
```

    'api_preference: openai\n'

### Recalling from all levels

Use
[`recall_all()`](https://problemsolversguild.github.io/psg_recall/storage.html#recall_all)
to get memories from global, project, and file levels combined:

``` python
# 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:

``` python
# 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:

``` python
# 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

``` python
# 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

``` python
from nbdev import nbdev_export
from nbdev.quarto import nbdev_docs

nbdev_export()
nbdev_docs()
```
