MCPcopy Create free account
hub / github.com/T0UGH/codex-self-evolution-plugin / _handle_recall

Function _handle_recall

src/codex_self_evolution/csep.py:55–85  ·  view source on GitHub ↗
(args: argparse.Namespace)

Source from the content-addressed store, hash-verified

53
54
55def _handle_recall(args: argparse.Namespace) -> int:
56 started = time.monotonic()
57 configure_logging()
58 query = " ".join(args.query).strip()
59 cwd = str(Path(args.cwd or os.getcwd()).expanduser().resolve())
60 try:
61 result = build_focused_recall(
62 query=query,
63 cwd=cwd,
64 state_dir=args.state_dir,
65 top_k=max(1, args.top_k),
66 )
67 result.update({"triggered": True, "reasons": ["self_invoked"], "status": "matched" if result["count"] else "no_match"})
68 except Exception as exc: # noqa: BLE001 - recall is a soft dependency for the model.
69 result = {
70 "query": query,
71 "count": 0,
72 "results": [],
73 "focused_recall": "",
74 "triggered": True,
75 "reasons": ["self_invoked"],
76 "status": "error",
77 "error": f"{type(exc).__name__}: {exc}",
78 }
79
80 if args.format == "json":
81 print(json.dumps(result, indent=2, sort_keys=True))
82 else:
83 print(render_focused_recall_markdown(result), end="")
84 _log_recall(started, cwd=cwd, query=query, result=result, output_format=args.format, exit_code=0)
85 return 0
86
87
88def main(argv: list[str] | None = None) -> int:

Callers 1

mainFunction · 0.85

Calls 3

build_focused_recallFunction · 0.85
_log_recallFunction · 0.85

Tested by

no test coverage detected