MCPcopy Create free account
hub / github.com/VectifyAI/OpenKB / list_iterations

Function list_iterations

openkb/skill/workspace.py:46–63  ·  view source on GitHub ↗

List existing iteration directories for a skill, sorted by N ascending. Returns an empty list if the workspace doesn't exist.

(kb_dir: Path, skill_name: str)

Source from the content-addressed store, hash-verified

44
45
46def list_iterations(kb_dir: Path, skill_name: str) -> list[Path]:
47 """List existing iteration directories for a skill, sorted by N ascending.
48
49 Returns an empty list if the workspace doesn't exist.
50 """
51 ws = _workspace_dir(kb_dir, skill_name)
52 if not ws.is_dir():
53 return []
54 iters: list[tuple[int, Path]] = []
55 for child in ws.iterdir():
56 if not child.is_dir():
57 continue
58 n = _iter_number(child)
59 if n is None:
60 continue
61 iters.append((n, child))
62 iters.sort(key=lambda t: t[0])
63 return [p for _, p in iters]
64
65
66def save_iteration(kb_dir: Path, skill_name: str) -> Path | None:

Calls 1

_iter_numberFunction · 0.85