Reusable memory subsystem for YClientReddit and YClient.
Project description
yclient-memory
yclient-memory is an in-tree implementation of the external memory package described in
external_memory_package_pipeline.md.
It provides:
- a stable
yclient_memoryimport surface - shared contracts and runtime protocols
- a
build_memory_engine()factory - two interchangeable backends:
hybrid_semanticsimple_recent
Installation
From PyPI, once published:
pip install yclient-memory
Quick Start
from yclient_memory import build_memory_engine
from yclient_memory.config import MemoryConfig
memory = build_memory_engine(
backend="hybrid_semantic",
config=MemoryConfig.from_mapping({"memory_vote_signal_only": True}),
runtime=my_runtime_adapter,
)
Public API
from yclient_memory import build_memory_engine
from yclient_memory.contracts import (
CommentMemoryEvent,
PostStyleRequest,
ReplyMemoryRequest,
)
Core operations:
build_reply_context()build_browse_context()build_post_style_context()record_comment()record_vote()record_post()relationship_signal()maintenance_tick()
Backends
hybrid_semantic
- preserves the richer Reddit-style behavior
- tracks social cards, thread cards, community digest, and reflections
- supports semantic-style lexical retrieval, high-affect recall, and post-style guidance
simple_recent
- keeps deterministic recent interaction state only
- exposes the same engine signature with fewer capabilities
- is suitable for lower-dependency adoption in other clients
Runtime Adapter
The package expects a runtime object with the methods documented in
docs/runtime_adapter.md.
At minimum, backends depend on:
get_author_id_and_username(post_id)get_thread_root_id(post_id)get_recent_root_posts(round_id, limit, rounds_back)get_post_text(post_id)llm_json(prompt_key, variables, config=None)llm_text(prompt_key, variables, config=None)decision_log(payload)
Notebooks
Example walkthroughs live in:
output/jupyter-notebook/hybrid-semantic-memory-walkthrough.ipynboutput/jupyter-notebook/simple-recent-memory-walkthrough.ipynb
Development
python -m pytest
Packaging And Release
Build locally:
python -m pip install .[release]
python -m build
python -m twine check dist/*
The repository also includes GitHub Actions workflows for package validation and PyPI publishing:
Release details are documented in docs/release_pipeline.md.
MkDocs
uv run --with mkdocs-material mkdocs serve
Strict build:
uv run --with mkdocs-material mkdocs build --strict
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file yclient_memory-0.1.0.tar.gz.
File metadata
- Download URL: yclient_memory-0.1.0.tar.gz
- Upload date:
- Size: 23.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ea5ed6a1b4407a568c2645a46fec7a0cd70ac80461bbd46107c049bc7b1f2417
|
|
| MD5 |
cc8ebfe79cdf22559d63fc1008e4b9f3
|
|
| BLAKE2b-256 |
41d921206978e32a2e25cdf49cf6db84d1689b4d75a6772bf9d802e4fe60b1d1
|
File details
Details for the file yclient_memory-0.1.0-py3-none-any.whl.
File metadata
- Download URL: yclient_memory-0.1.0-py3-none-any.whl
- Upload date:
- Size: 26.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b4c2311ffff2a8fbda9c55aa3694517ea8795af88ef625f574c1f6a134bcbb43
|
|
| MD5 |
89cd3327128f1faed0883b653b8de9b5
|
|
| BLAKE2b-256 |
bf9f4bc4df9ab9ef3a37ed881ad4b5a8e70f7df692bdf5b3e05acd37621bc34c
|