SHOREKEEPER / scripts /07_run_shorekeeper.py
geoore's picture
Restructure to src/ layout with attention, per-layer MoE, and working chat
73400c8
#!/usr/bin/env python3
import sys
import readline
from pathlib import Path
sys.path.insert(0, str(Path(__file__).parent.parent))
from src.shorekeeper import SHOREKEEPER
def print_banner():
print("""
╔══════════════════════════════════════════════════════════╗
β•‘ β•‘
β•‘ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•— β–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•— β–ˆβ–ˆβ•— β•‘
β•‘ β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•”β• β•‘
β•‘ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β• β•‘
β•‘ β•šβ•β•β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β• β–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•— β•‘
β•‘ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•— β•‘
β•‘ β•šβ•β•β•β•β•β•β•β•šβ•β• β•šβ•β• β•šβ•β•β•β•β•β• β•šβ•β• β•šβ•β•β•šβ•β•β•β•β•β•β•β•šβ•β• β•šβ•β• β•‘
β•‘ β•‘
β•‘ SHOREKEEPER-4B β•‘
β•‘ The AI with 12 Specialized Experts β•‘
β•‘ β•‘
β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•
Commands:
/remember <fact> - Store in memory
/recall <query> - Search memory
/run <command> - Execute in sandbox
/project <name> - Create project on 3TB drive
/exit - Goodbye
""")
def main():
print_banner()
print("Loading SHOREKEEPER-4B...")
model = SHOREKEEPER()
print("SHOREKEEPER is ready. Type /help for commands.\n")
while True:
try:
user_input = input("\nYou: ").strip()
if not user_input:
continue
if user_input == "/exit":
print("\nSHOREKEEPER: Until we meet again. The council will remember.")
break
elif user_input == "/help":
print("""
Commands:
/remember <fact> - Store something in memory
/recall <query> - Search memory
/run <command> - Run terminal command in sandbox
/project <name> - Create new project on 3TB drive
/exit - Quit
""")
elif user_input.startswith("/remember "):
fact = user_input[10:]
mem_id = model.remember(fact)
print(f"SHOREKEEPER: I will remember that. (ID: {mem_id})")
elif user_input.startswith("/recall "):
query = user_input[8:]
memories = model.recall(query)
if memories:
print("\nSHOREKEEPER: I found these memories:")
for mem in memories[:5]:
content = mem.get("content", {})
if isinstance(content, dict):
for k, v in content.items():
print(f" * {k}: {v}")
else:
print(f" * {content}")
else:
print("SHOREKEEPER: I don't remember anything matching that.")
elif user_input.startswith("/run "):
command = user_input[5:]
print(f"\nExecuting: {command}\n")
output = model.run_command(command)
print(output)
elif user_input.startswith("/project "):
name = user_input[9:]
project_path = model.create_project(name)
print(f"SHOREKEEPER: Created project {name} at {project_path}")
else:
response = model.chat(user_input)
print(f"\nSHOREKEEPER: {response}")
except KeyboardInterrupt:
print("\n\nSHOREKEEPER: Interrupted. Goodbye.")
break
except Exception as e:
print(f"\nError: {e}")
if __name__ == "__main__":
main()