feat(memory): FPLAN-0276 — unify memory limits into config single-source + cleanup

- memory.config.json is the single source of truth: char caps (entry_limits, global) + rollover counts (per_branch, materialized from registry); .trinity files stripped to a one-line _usage header
- changed_entries gate now matches by content identity, not array position — prepending a new entry never re-flags unchanged legacy entries (old=old, new=new; no trimming required on a cap change)
- rollover push command + top-level 'drone @memory push' alias; corrected config _note + --help (rollover push surfaced, labeled destructive system-wide reset)
- removed 3 dead functions: seed_per_branch, its orphaned write_config, add_learning + its tests
- spawn birthright/builder + LOCAL/OBSERVATIONS templates aligned to the stripped shape
- 966 tests, seedgo 100%

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
AIOSAI
2026-06-14 20:54:34 -07:00
co-authored by Claude Opus 4.8
parent 6c675e9b78
commit 72659eccbd
21 changed files with 743 additions and 408 deletions
+36 -1
View File
@@ -52,6 +52,7 @@ _SUBCOMMANDS = {
"status": "Show rollover statistics for all branches",
"check": "Check which files need rollover (dry run)",
"sync-lines": "Update line count metadata for all branches",
"push": "Overwrite all per_branch limits to defaults (system-wide reset)",
}
@@ -112,6 +113,10 @@ def handle_command(command: str, args: List[str]) -> bool:
sync_line_counts()
return True
if sub == "push":
push_defaults()
return True
# Unknown subcommand
error(
f"Unknown subcommand: '{sub}'",
@@ -158,6 +163,7 @@ def print_help() -> None:
console.print(" [cyan]status[/cyan] Show rollover statistics for all branches")
console.print(" [cyan]check[/cyan] Check which files need rollover (dry run)")
console.print(" [cyan]sync-lines[/cyan] Update line count metadata for all branches")
console.print(" [cyan]push[/cyan] ⚠ Reset ALL per_branch limits to defaults (system-wide)")
console.print(" [cyan]help[/cyan] Show this help message")
console.print()
console.print("[bold]LIMITS:[/bold]")
@@ -213,7 +219,8 @@ def run_rollover() -> bool:
local_status = "> local" if item.get("local_stored") else "x local"
console.print(
f" [green]>[/green] Rolled over {item['memories_count']} items -> {item['global_collection']} "
f"({item['old_lines']} -> {item['new_lines']} lines, global: {item['global_total']} vectors, {local_status})"
f"({item['old_lines']} -> {item['new_lines']} lines, "
f"global: {item['global_total']} vectors, {local_status})"
)
# Report results
@@ -322,6 +329,34 @@ def sync_line_counts() -> None:
console.print()
# =============================================================================
# PUSH DEFAULTS
# =============================================================================
def push_defaults() -> None:
"""Overwrite every per_branch entry in memory.config.json with defaults."""
from ..handlers.json import config_loader
console.print()
console.print(Panel.fit("[bold cyan]Memory - Push Defaults[/bold cyan]", border_style="cyan", box=box.ROUNDED))
console.print()
console.print("[cyan]Overwriting all per_branch limits with defaults...[/cyan]")
console.print()
result = config_loader.push_defaults_to_per_branch()
if not result.get("success"):
error(result.get("error", "Unknown error"))
return
count = result.get("branches", 0)
console.print(f"[green]>[/green] Pushed defaults to {count} branches")
console.print()
json_handler.log_operation("push_defaults", {"branches": count})
# =============================================================================
# STATUS & CHECKING
# =============================================================================