Download cli.py from kirikir13/DeepSeek-roby-base: direct link, hf CLI and curl.
- Browser
- Download file 2.98 kB
-
https://huggingface.co/kirikir13/DeepSeek-roby-base/resolve/main/cli.py
- Command line
-
hf download hf://kirikir13/DeepSeek-roby-base/cli.py
-
curl -L -o cli.py https://huggingface.co/kirikir13/DeepSeek-roby-base/resolve/main/cli.py
2.98 kB
| #!/usr/bin/env python3 | |
| """Shared memory CLI. Any assistant can call this. | |
| python cli.py remember --user "..." --assistant "..." | |
| python cli.py recall "what did we decide about OpenVINO" | |
| python cli.py fact hf_user kirikir13 | |
| python cli.py --session work recall "openvino" | |
| python cli.py hive propose "OpenVINO package lives at DR-Studios/ltxv-openvino-cpu" | |
| python cli.py hive recall "where is the openvino package" | |
| """ | |
| from __future__ import annotations | |
| import argparse | |
| import json | |
| import os | |
| import uuid | |
| from pathlib import Path | |
| from memory_manager import MemoryManager | |
| SESSION_FILE = Path.home() / ".ultimate-ai-memory" / "session" | |
| def load_session(explicit: str | None) -> str: | |
| if explicit: | |
| SESSION_FILE.parent.mkdir(parents=True, exist_ok=True) | |
| SESSION_FILE.write_text(explicit) | |
| return explicit | |
| if os.environ.get("SESSION_ID"): | |
| return os.environ["SESSION_ID"] | |
| if SESSION_FILE.exists(): | |
| saved = SESSION_FILE.read_text().strip() | |
| if saved: | |
| return saved | |
| sid = str(uuid.uuid4()) | |
| SESSION_FILE.parent.mkdir(parents=True, exist_ok=True) | |
| SESSION_FILE.write_text(sid) | |
| return sid | |
| def main() -> None: | |
| p = argparse.ArgumentParser() | |
| p.add_argument("--user-id", default=os.environ.get("USER_ID", "dave")) | |
| p.add_argument("--agent", default=os.environ.get("AGENT_NAME", "cli")) | |
| p.add_argument("--session", default=None, help="reuse or set the CLI session id") | |
| sub = p.add_subparsers(dest="cmd", required=True) | |
| r = sub.add_parser("remember") | |
| r.add_argument("--user", required=True) | |
| r.add_argument("--assistant", required=True) | |
| r.add_argument("--importance", type=int, default=6) | |
| q = sub.add_parser("recall") | |
| q.add_argument("query") | |
| f = sub.add_parser("fact") | |
| f.add_argument("key") | |
| f.add_argument("value") | |
| h = sub.add_parser("hive", help="crew truths: propose or recall") | |
| h.add_argument("action", choices=["propose", "recall"]) | |
| h.add_argument("text") | |
| h.add_argument("--importance", type=int, default=8) | |
| args = p.parse_args() | |
| session_id = load_session(args.session) | |
| mem = MemoryManager(user_id=args.user_id, agent=args.agent, session_id=session_id) | |
| if args.cmd == "remember": | |
| mem.remember(args.user, args.assistant, importance=args.importance) | |
| print(f"stored session={mem.session_id}") | |
| elif args.cmd == "recall": | |
| print(json.dumps(mem.recall(args.query), indent=2, default=str)) | |
| elif args.cmd == "fact": | |
| mem.store_fact(args.key, args.value) | |
| print("fact stored") | |
| elif args.cmd == "hive": | |
| from tunnels import Hive | |
| hive = Hive(mem) | |
| if args.action == "propose": | |
| rid = hive.propose(args.text, agent=mem.agent, importance=args.importance) | |
| print(f"hive proposed id={rid}") | |
| else: | |
| print(json.dumps(hive.recall(args.text), indent=2, default=str)) | |
| if __name__ == "__main__": | |
| main() | |