replace state.json cache with bincode state.bin
Faster serialization/deserialization, smaller on disk (4.2MB vs 5.9MB). Automatic migration from state.json on first load — reads the JSON, writes state.bin, deletes the old file. Added list-keys, list-edges, dump-json commands so Python scripts no longer need to parse the cache directly. Updated bulk-categorize.py and consolidation-loop.py to use the new CLI commands.
This commit is contained in:
parent
c4d1675128
commit
4b0bba7c56
6 changed files with 88 additions and 24 deletions
|
|
@ -50,13 +50,12 @@ def call_sonnet(prompt: str, timeout: int = 300) -> str:
|
|||
|
||||
|
||||
def get_all_keys() -> list[str]:
|
||||
"""Get all node keys from state.json."""
|
||||
state_path = MEMORY_DIR / "state.json"
|
||||
if not state_path.exists():
|
||||
"""Get all node keys via poc-memory list-keys."""
|
||||
r = subprocess.run(["poc-memory", "list-keys"],
|
||||
capture_output=True, text=True, timeout=30)
|
||||
if r.returncode != 0:
|
||||
return []
|
||||
content = state_path.read_text()
|
||||
keys = re.findall(r'"key":\s*"([^"]*)"', content)
|
||||
return sorted(set(keys))
|
||||
return [k for k in r.stdout.strip().split('\n') if k]
|
||||
|
||||
|
||||
def get_unique_files(keys: list[str]) -> list[str]:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue