* refactor(memory): rename package second-brain to memory * refactor(memory): use OpenAI env naming and fix trailing slash * feat(memory): add chunking with env-configurable size and overlap * feat(memory): dedup search results by source in top-K * test(memory): add chunking, batching, dedup, live tests * docs(memory): update README and project map after rename * docs(handoff): add handoff and ADR-032 for memory refactor * docs(handoff): set PR number * fix(ci): reduce index.py complexity to rank A --------- Co-authored-by: opencode-agent <agent@opencode.local>
34 lines
965 B
Python
34 lines
965 B
Python
import argparse
|
|
|
|
from src.memory.index import run_index
|
|
from src.memory.search import run_search
|
|
|
|
|
|
def main(argv: list[str] | None = None) -> None:
|
|
parser = argparse.ArgumentParser(prog="memory")
|
|
sub = parser.add_subparsers(dest="command", required=True)
|
|
|
|
search_p = sub.add_parser("search")
|
|
search_p.add_argument("query")
|
|
search_p.add_argument("-i", "--index-dir", required=True)
|
|
search_p.add_argument("-k", type=int, default=15)
|
|
search_p.add_argument("--json", action="store_true")
|
|
|
|
index_p = sub.add_parser("index")
|
|
index_p.add_argument("memory_dir")
|
|
index_p.add_argument("-o", "--output", required=True)
|
|
|
|
sub.add_parser("download")
|
|
|
|
args = parser.parse_args(argv)
|
|
|
|
if args.command == "search":
|
|
run_search(args)
|
|
elif args.command == "index":
|
|
run_index(args)
|
|
elif args.command == "download":
|
|
print("Gemini API: model download not needed")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|