Author: Satish Gopinathan Web: https://www.eagleeyethinker.com
This project demonstrates five memory types in one agentic HR Policy Assistant.
- Short-Term Memory -> Redis (session)
- Retrieval Memory -> ChromaDB + Ollama embeddings
- Semantic Memory -> NetworkX graph
- Procedural Memory -> LangGraph workflow
- Durable Memory -> JSON audit log
- Python virtual environment with dependencies:
pip install -r requirements.txt
- Ollama running locally with model:
ollama pull llama3
- Redis-compatible server running on
localhost:6379:- Redis or Memurai
choco install memurai-developer -y
Start-Service MemuraiOptional connectivity check:
& "C:\Program Files\Memurai\memurai-cli.exe" pingbrew install redis
brew services start redisOptional connectivity check:
redis-cli pingpython app/main.py- Each prompt you type is appended to a Redis list under session key
default. - The session key TTL is set to 1800 seconds (30 minutes) on each new input.
- Expected behavior:
- Recent user turns are available during the active session.
- If Redis is down, app calls to short-term memory will fail.
Quick check (if using Memurai):
& "C:\Program Files\Memurai\memurai-cli.exe" LRANGE default 0 -1
& "C:\Program Files\Memurai\memurai-cli.exe" TTL default- On startup,
data/policies.txtis loaded and split into chunks. - Chunks are embedded with
llama3embeddings and indexed in ChromaDB. - For each query, top
k=2similar chunks are retrieved and used as LLM context. - Expected behavior:
- Answers should be grounded in policy text when relevant.
- If Ollama is not reachable, app startup/query will fail.
- A small in-memory concept graph is created with fixed relationships:
Employee <-> ManagerManager <-> DirectorPolicy <-> Compliance
- For every query, neighbors of
Policyare fetched. - Expected behavior:
- Semantic relation list currently resolves to
["Compliance"]and is logged.
- Semantic relation list currently resolves to
- The workflow is a single-node LangGraph pipeline:
input->agentnode ->END
- Agent node order:
- Store input in short-term memory
- Retrieve relevant policy chunks
- Read semantic relationships
- Build prompt and call LLM
- Write durable audit record
- Expected behavior:
- Every user prompt consistently follows the same execution path.
- Every turn is appended to
audit_log.json. - Each record contains:
inputretrieval(retrieved chunks)semantic(graph relationships)output(model response)
- Expected behavior:
audit_log.jsongrows over time and preserves past runs for inspection.
HR Policy Assistant