| |
| 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() |
|
|