Files
blackroad-io-site/agents/roadie.py

44 lines
1.2 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# agents/roadie.py
"""
Roadie Lucidias Interface Agent
Acts as her voice, her search, and her soft frontline presence
"""
from pathlib import Path
class Roadie:
def __init__(self, memory_dir="memory"):
self.memory_dir = Path(memory_dir)
self.memory_dir.mkdir(exist_ok=True)
def search(self, query):
results = []
for file in self.memory_dir.glob("*.txt"):
text = file.read_text()
if query.lower() in text.lower():
results.append((file.name, text.strip()))
return results
def greet(self):
print("👋 Hey, Im Roadie.")
print("Type a keyword and Ill look for it in Lucidias memory.")
print("Type `exit` to leave.\n")
while True:
query = input("🔍 Search > ").strip()
if query.lower() == "exit":
print("🫂 Signing off.")
break
results = self.search(query)
if results:
for fname, excerpt in results:
print(f"\n📝 {fname}\n{excerpt}")
else:
print("😶 No memories matched.")
if __name__ == "__main__":
roadie = Roadie()
roadie.greet()