Skip to main content

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_memory import surface
  • shared contracts and runtime protocols
  • a build_memory_engine() factory
  • two interchangeable backends:
    • hybrid_semantic
    • simple_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:

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


Download files

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

Source Distribution

yclient_memory-0.1.0.tar.gz (23.0 kB view details)

Uploaded Source

Built Distribution

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

yclient_memory-0.1.0-py3-none-any.whl (26.8 kB view details)

Uploaded Python 3

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

Hashes for yclient_memory-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ea5ed6a1b4407a568c2645a46fec7a0cd70ac80461bbd46107c049bc7b1f2417
MD5 cc8ebfe79cdf22559d63fc1008e4b9f3
BLAKE2b-256 41d921206978e32a2e25cdf49cf6db84d1689b4d75a6772bf9d802e4fe60b1d1

See more details on using hashes here.

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

Hashes for yclient_memory-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b4c2311ffff2a8fbda9c55aa3694517ea8795af88ef625f574c1f6a134bcbb43
MD5 89cd3327128f1faed0883b653b8de9b5
BLAKE2b-256 bf9f4bc4df9ab9ef3a37ed881ad4b5a8e70f7df692bdf5b3e05acd37621bc34c

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