Version 0.0.2 of Knowledge-and-Memory-Management delivers exactly what experienced developers expect: a clean release with portable path support and streamlined knowledge ingestion. All personal paths have been replaced with the $AGENT_HOME
environment variable, eliminating environment-specific configuration. The focus is on robust knowledge collection from web, video, and articles, paired with a persistent memory layer for retrieval.
Architecture and Portability
The system is divided into two packages: collector
and memory
. Every configurable path now defaults to $AGENT_HOME
. This means no more hardcoded /home/user/data/
or /var/lib/agent/
entries. When AGENT_HOME
is not set, the system falls back to a platform-specific default, but the expectation is that you define it explicitly in containerized or orchestrated deployments. The knowledge entry model is standardized across all sources, containing source_url
, media_type
, raw_content
, summary
, embedding
, and timestamp
.
Knowledge Collection
All collectors adhere to a consistent interface: collect(source: str, **kwargs) -> KnowledgeEntry
. This makes adding new sources straightforward.
Memory Management
Memory is stored in a vector database (FAISS or Chroma) under $AGENT_HOME/memory
. The clean release retroactively updates all previous path references. The Memory
class supports save
, delete
, update
, and search
operations. Search uses cosine similarity on stored embeddings for semantic retrieval. Batching and optional GPU acceleration are configurable for embedding generation.
Code Example
Below is a short, self‑contained example showing how to leverage the portable path for collection and memory storage:
import os
from knowledge_and_memory import Collector, Memory
agent_home = os.getenv("AGENT_HOME", "/opt/agent")
collector = Collector(base_dir=agent_home)
memory = Memory()
web_entry = collector.collect_web("https://example.com/tech-article")
video_entry = collector.collect_video("https://youtube.com/watch?v=abc")
article_entry = collector.collect_article("file:///docs/research.pdf")
memory.save(web_entry)
memory.save(video_entry)
memory.save(article_entry)
results = memory.search("state-of-the-art in NLP", top_k=3)
for r in results:
print(r.summary)
The base_dir
parameter ties everything to $AGENT_HOME
, making deployment portable. The collectors normalize content, so the memory layer receives consistent objects.
Migration and Performance
Existing users must update configuration files to reference $AGENT_HOME
and remove absolute paths. A migration script is included in the release to automate this. Performance-wise, collection pipelines are asynchronous, and memory operations are batched to reduce overhead. The vector database can operate in‑memory for low latency or persist to disk for durability.
v0.0.2 is a practical release for agent developers who need reliable memory without path headaches. Future versions will target additional source types and advanced consolidation strategies, but this clean foundation already delivers on the core promises of knowledge collection and memory management.