diff --git a/.claude/hooks/.diagnostics_state.json b/.claude/hooks/.diagnostics_state.json new file mode 100644 index 00000000..04893a83 --- /dev/null +++ b/.claude/hooks/.diagnostics_state.json @@ -0,0 +1 @@ +{"file": "/home/patrick/Projects/AIPass/src/aipass/seedgo/apps/modules/inbox_audit.py", "errors": [{"line": 86, "message": "E501: Line too long (125 > 120)"}]} \ No newline at end of file diff --git a/src/aipass/memory/apps/handlers/monitor/memory_watcher.py b/src/aipass/memory/apps/handlers/monitor/memory_watcher.py index b84174b5..6427225b 100644 --- a/src/aipass/memory/apps/handlers/monitor/memory_watcher.py +++ b/src/aipass/memory/apps/handlers/monitor/memory_watcher.py @@ -91,10 +91,10 @@ def _get_rollover_threshold(branch_name: str, file_path: Path | None = None) -> data = json.load(f) metadata = data.get("document_metadata", {}) - # v2 files use entry-count limits, not line limits + # v2 files use entry-count limits — return -1 so caller uses detector schema_version = metadata.get("schema_version", "1.0.0") if schema_version.startswith("2"): - return 999999 # Never trigger line-based rollover for v2 + return -1 file_limit = metadata.get("limits", {}).get("max_lines") if file_limit is not None: @@ -204,9 +204,6 @@ def check_and_rollover() -> Dict[str, Any]: lines_synced = 0 for branch_path in branch_paths: branch = Path(branch_path) - # Extract branch name from path (last component, uppercase) - branch_name = branch.name.upper() - # Find memory files in .trinity/ subdirectory trinity_dir = branch / ".trinity" if not trinity_dir.exists(): @@ -215,9 +212,6 @@ def check_and_rollover() -> Dict[str, Any]: for memory_file in trinity_dir.glob(pattern): results["files_checked"] += 1 - # Get threshold per file (file metadata > branch config > default) - threshold = _get_rollover_threshold(branch_name, memory_file) - try: line_count = len(memory_file.read_text(encoding="utf-8").splitlines()) @@ -231,14 +225,16 @@ def check_and_rollover() -> Dict[str, Any]: sync_result = update_line_count(memory_file) if sync_result.get("success"): lines_synced += 1 - # Re-read actual line count after metadata update - line_count = len(memory_file.read_text(encoding="utf-8").splitlines()) except Exception as e: logger.warning(f"[memory_watcher] Non-critical metadata sync failed for {memory_file}: {e}") - if line_count > threshold: + # Use detector for trigger decision (handles both v1 line-based and v2 entry-count) + from aipass.memory.apps.handlers.monitor.detector import _should_rollover + + triggered, _, _, _, _ = _should_rollover(memory_file) + if triggered: results["files_over_limit"].append( - {"file": str(memory_file), "lines": line_count, "threshold": threshold} + {"file": str(memory_file), "lines": line_count, "threshold": 0} ) except Exception as e: logger.warning(f"[memory_watcher] Failed to read memory file {memory_file}: {e}") diff --git a/src/aipass/seedgo/apps/modules/hooks_ext.py b/src/aipass/seedgo/apps/modules/hooks_ext.py index f636a2c8..16837a46 100644 --- a/src/aipass/seedgo/apps/modules/hooks_ext.py +++ b/src/aipass/seedgo/apps/modules/hooks_ext.py @@ -238,6 +238,8 @@ def print_introspection() -> None: def handle_command(command: str, args: list) -> bool: """Not a primary drone module — delegates to hooks.py for routing.""" + if command != "hooks_ext": + return False if not args: print_introspection() return True diff --git a/src/aipass/seedgo/apps/modules/inbox_audit.py b/src/aipass/seedgo/apps/modules/inbox_audit.py index 5bc1626f..b8ebee87 100644 --- a/src/aipass/seedgo/apps/modules/inbox_audit.py +++ b/src/aipass/seedgo/apps/modules/inbox_audit.py @@ -105,16 +105,16 @@ def print_introspection() -> None: def handle_command(command: str, args: List[str]) -> bool: """Handle `audit inbox-ids` — return True only for that exact subcommand.""" + if command == "inbox_audit": + if not args: + print_introspection() + return True + if args[0] in ("--help", "-h", "help"): + print_introspection() + return True if command not in ("audit", "standards_audit"): return False - if not args: - print_introspection() - return True - if args[0] in ("--help", "-h", "help"): - console.print("Usage: drone @seedgo audit inbox-ids") - console.print(" Scans all .ai_mail.local/inbox.json files for non-8-hex message ids.") - return True - if args[0] != "inbox-ids": + if not args or args[0] != "inbox-ids": return False _run_inbox_id_scan() return True diff --git a/src/aipass/spawn/templates/builder/.spawn/.template_registry.json b/src/aipass/spawn/templates/builder/.spawn/.template_registry.json index bc30f0e8..cfc0d8cb 100644 --- a/src/aipass/spawn/templates/builder/.spawn/.template_registry.json +++ b/src/aipass/spawn/templates/builder/.spawn/.template_registry.json @@ -1,7 +1,7 @@ { "metadata": { "version": "1.0.0", - "last_updated": "2026-04-15", + "last_updated": "2026-04-22", "description": "Template file tracking registry for ID-based updates" }, "files": { @@ -137,10 +137,10 @@ "content_hash": "2e4f4a0c1b47", "has_branch_placeholder": false }, - "f022": { - "path": "apps/handlers/__init__.py", - "name": "__init__.py", - "content_hash": "55afc5eddbe0", + "f044": { + "path": "apps/integrations/README.md", + "name": "README.md", + "content_hash": "31c09afe1299", "has_branch_placeholder": false }, "f023": { @@ -149,7 +149,7 @@ "content_hash": "a4cf0a8e3b4f", "has_branch_placeholder": false }, - "f026": { + "f045": { "path": "apps/modules/__init__.py", "name": "__init__.py", "content_hash": "e3b0c44298fc", @@ -161,12 +161,6 @@ "content_hash": "d1e4e2b98c38", "has_branch_placeholder": false }, - "f027": { - "path": "apps/{{BRANCH}}.py", - "name": "{{BRANCH}}.py", - "content_hash": "e3893ff95aa5", - "has_branch_placeholder": true - }, "f028": { "path": "artifacts/README.md", "name": "README.md", @@ -233,12 +227,6 @@ "content_hash": "881f06bb6574", "has_branch_placeholder": false }, - "f039": { - "path": "tests/conftest.py", - "name": "conftest.py", - "content_hash": "5d98b049957b", - "has_branch_placeholder": false - }, "f040": { "path": "tools/README.md", "name": "README.md", @@ -257,13 +245,25 @@ "content_hash": "28e9ae373563", "has_branch_placeholder": false }, - "f044": { - "path": "apps/integrations/README.md", - "name": "README.md", - "content_hash": "31c09afe1299", + "f022": { + "path": "apps/handlers/__init__.py", + "name": "__init__.py", + "content_hash": "dbfc0e044461", "has_branch_placeholder": false }, - "f045": { + "f027": { + "path": "apps/{{BRANCH}}.py", + "name": "{{BRANCH}}.py", + "content_hash": "39db2c4f8160", + "has_branch_placeholder": true + }, + "f039": { + "path": "tests/conftest.py", + "name": "conftest.py", + "content_hash": "97f220799d19", + "has_branch_placeholder": false + }, + "f015": { "path": "apps/plugins/__init__.py", "name": "__init__.py", "content_hash": "e3b0c44298fc", @@ -276,11 +276,6 @@ "name": ".ai_mail.local", "has_branch_placeholder": false }, - "d002": { - "path": ".ai_mail.local/sent", - "name": "sent", - "has_branch_placeholder": false - }, "d003": { "path": ".aipass", "name": ".aipass", @@ -321,6 +316,11 @@ "name": "handlers", "has_branch_placeholder": false }, + "d024": { + "path": "apps/integrations", + "name": "integrations", + "has_branch_placeholder": false + }, "d010": { "path": "apps/modules", "name": "modules", @@ -385,11 +385,6 @@ "path": "{{BRANCH}}_json/custom_config", "name": "custom_config", "has_branch_placeholder": false - }, - "d024": { - "path": "apps/integrations", - "name": "integrations", - "has_branch_placeholder": false } } }