@teevee98/synapse-hub 4.2.5 → 4.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/.agents/hooks/session_start.py +52 -0
  2. package/.agents/hooks.json +12 -0
  3. package/.agents/rules/author-integrity-guard.md +1 -0
  4. package/.agents/rules/communication-style.md +1 -0
  5. package/.agents/rules/context-engineering.md +1 -0
  6. package/.agents/rules/cypress_rules.md +46 -0
  7. package/.agents/rules/git-push-protocol.md +1 -0
  8. package/.agents/rules/graphify.md +1 -0
  9. package/.agents/rules/lessons-learned.md +1 -0
  10. package/.agents/rules/mandatory-playwright-live.md +8 -10
  11. package/.agents/rules/mobile_appium_rules.md +26 -10
  12. package/.agents/rules/performance_testing_rules.md +26 -5
  13. package/.agents/rules/security_testing_rules.md +21 -15
  14. package/.agents/rules/skill-precedence.md +11 -4
  15. package/.agents/rules/stack-auto-router.md +18 -12
  16. package/.agents/rules/systematic-debugging.md +1 -0
  17. package/.agents/skills/01-web-automation/clean-pom-crafter/SKILL.md +71 -2
  18. package/.agents/skills/01-web-automation/e2e-testing-patterns/SKILL.md +38 -0
  19. package/.agents/skills/01-web-automation/katalon-cli-runner/SKILL.md +27 -0
  20. package/.agents/skills/01-web-automation/mobile-maestro-detox-patterns/SKILL.md +134 -0
  21. package/.agents/skills/01-web-automation/mobile-maestro-detox-patterns/examples/sample_flow.yaml +6 -0
  22. package/.agents/skills/02-test-design/rbt-manual-testing/SKILL.md +30 -1
  23. package/.agents/skills/02-test-design/rbt-manual-testing/references/field_validation_checklist.md +13 -1
  24. package/.agents/skills/02-test-design/review-spec/SKILL.md +7 -0
  25. package/.agents/skills/03-api-and-contracts/api-spec-to-e2e-matrix/SKILL.md +15 -0
  26. package/.agents/skills/06-healing-and-resilience/failure-autopsy-and-healing/SKILL.md +12 -0
  27. package/.agents/skills/07-data-and-state/synthetic-test-data-generator/SKILL.md +30 -0
  28. package/.agents/skills/09-ci-and-devops/gitlab-ci-templates/SKILL.md +123 -0
  29. package/.agents/skills/09-ci-and-devops/gitlab-ci-templates/examples/sample_gitlab_ci.yml +17 -0
  30. package/.agents/skills/09-ci-and-devops/jenkins-pipeline-templates/SKILL.md +133 -0
  31. package/.agents/skills/09-ci-and-devops/jenkins-pipeline-templates/examples/Jenkinsfile.example +21 -0
  32. package/README.en.md +3 -3
  33. package/README.md +3 -3
  34. package/agentskills.json +2 -2
  35. package/docs/ARCHITECTURE.en.md +3 -3
  36. package/docs/ARCHITECTURE.md +2 -2
  37. package/docs/TOOL_CATALOG.md +1 -1
  38. package/package.json +1 -1
  39. package/plugin.json +1 -1
  40. package/scripts/install_global_plugin.ps1 +1 -1
  41. package/scripts/install_global_plugin.sh +1 -1
  42. package/skills_manifest.json +61 -4
  43. package/synapse.config.json +1 -1
  44. package/tools/TOOL_CATALOG.json +1 -1
  45. package/tools/__init__.py +1 -1
  46. package/tools/benchmark_swarm_context.py +1 -1
  47. package/tools/browser_helpers.js +2 -2
  48. package/tools/cli.py +8 -4
  49. package/tools/dashboard_generator.py +8 -8
  50. package/tools/dspy_qa_signatures.py +105 -1
  51. package/tools/mcp_docx_server.py +1 -1
  52. package/tools/mcp_excel_server.py +1 -1
  53. package/tools/mcp_server.py +1 -1
  54. package/tools/rules_router.py +4 -4
  55. package/tools/setup_project.py +91 -63
  56. package/tools/skill_canonical_digest.py +2 -2
  57. package/tools/task_memory_manager.py +12 -1
  58. package/tools/test_memory_os.py +48 -0
  59. package/tools/tot_exploratory_tester.py +17 -0
  60. package/tools/ui_server.py +1 -1
  61. package/tools/update_sentinel.py +109 -43
  62. package/tools/verify_all.py +1 -1
  63. package/tools/welcome_page.py +2 -2
@@ -391,7 +391,7 @@ def inject_antigravity_global_plugin():
391
391
  """
392
392
  Automatically injects Synapse-Hub into Antigravity's Global Plugin Directory
393
393
  (~/.gemini/config/plugins/synapse-hub).
394
- Ensures that running `npx @teevee98/synapse-hub setup` activates the 53 skills and 9 subagents
394
+ Ensures that running `npx @teevee98/synapse-hub setup` activates the 56 skills and 9 subagents
395
395
  globally across ALL projects in Google Antigravity.
396
396
  """
397
397
  try:
@@ -464,81 +464,102 @@ def inject_antigravity_global_plugin():
464
464
  return False
465
465
 
466
466
 
467
- def install_universal_ai_bridges(target_dir):
467
+ def install_universal_ai_bridges(target_dir, ide="all"):
468
468
  """
469
469
  Deploys Universal AI Bridge configuration files into the target project workspace
470
470
  for seamless integration with Cursor, Claude Code, GitHub Copilot, and Windsurf.
471
+ Supports IDE-selective deployment to save 1,500-2,500 prompt tokens per turn:
472
+ - 'all' / 'auto': deploys standard bridges (Cursor modern, Claude, Copilot, Windsurf)
473
+ - 'cursor': deploys only .cursor/rules/synapse-qa.mdc (avoids legacy .cursorrules redundancy)
474
+ - 'cursor-legacy': deploys only .cursorrules
475
+ - 'windsurf': deploys only .windsurfrules
476
+ - 'claude': deploys only CLAUDE.md
477
+ - 'copilot': deploys only .github/copilot-instructions.md
471
478
  """
472
479
  bridges_dir = os.path.join(TEMPLATES_DIR, "ai_bridges")
473
480
  if not os.path.exists(bridges_dir):
474
481
  return False
475
482
 
476
483
  deployed = []
477
-
478
- # 1. Cursor (.cursor/rules/synapse-qa.mdc)
479
- cursor_dir = os.path.join(target_dir, ".cursor", "rules")
480
- os.makedirs(cursor_dir, exist_ok=True)
481
- src_cursor = os.path.join(bridges_dir, "cursor_synapse_qa.mdc")
482
- dst_cursor = os.path.join(cursor_dir, "synapse-qa.mdc")
483
- if os.path.exists(src_cursor):
484
- shutil.copy2(src_cursor, dst_cursor)
485
- deployed.append("Cursor (.cursor/rules/synapse-qa.mdc)")
484
+ ide_choice = (ide or "all").lower().strip()
485
+ install_all = ide_choice in ("all", "auto")
486
+
487
+ # 1. Cursor Modern (.cursor/rules/synapse-qa.mdc)
488
+ if install_all or ide_choice == "cursor":
489
+ cursor_dir = os.path.join(target_dir, ".cursor", "rules")
490
+ os.makedirs(cursor_dir, exist_ok=True)
491
+ src_cursor = os.path.join(bridges_dir, "cursor_synapse_qa.mdc")
492
+ dst_cursor = os.path.join(cursor_dir, "synapse-qa.mdc")
493
+ if os.path.exists(src_cursor):
494
+ shutil.copy2(src_cursor, dst_cursor)
495
+ deployed.append("Cursor (.cursor/rules/synapse-qa.mdc)")
496
+
497
+ # 1b. Cursor Legacy (.cursorrules)
498
+ if ide_choice == "cursor-legacy":
499
+ src_cr = os.path.join(HUB_ROOT, ".cursorrules")
500
+ dst_cr = os.path.join(target_dir, ".cursorrules")
501
+ if os.path.exists(src_cr):
502
+ shutil.copy2(src_cr, dst_cr)
503
+ deployed.append("Cursor Legacy (.cursorrules)")
486
504
 
487
505
  # 2. Claude Code (CLAUDE.md)
488
- dst_claude = os.path.join(target_dir, "CLAUDE.md")
489
- src_claude = os.path.join(bridges_dir, "CLAUDE.md")
490
- if os.path.exists(src_claude):
491
- if not os.path.exists(dst_claude):
492
- shutil.copy2(src_claude, dst_claude)
493
- deployed.append("Claude Code (CLAUDE.md)")
494
- else:
495
- with open(dst_claude, "r", encoding="utf-8", errors="ignore") as f:
496
- c_content = f.read()
497
- if "Synapse-Hub" not in c_content:
498
- with open(src_claude, "r", encoding="utf-8") as f:
499
- append_data = f.read()
500
- with open(dst_claude, "a", encoding="utf-8") as f:
501
- f.write("\n\n" + append_data)
502
- deployed.append("Claude Code (appended to CLAUDE.md)")
506
+ if install_all or ide_choice == "claude":
507
+ dst_claude = os.path.join(target_dir, "CLAUDE.md")
508
+ src_claude = os.path.join(bridges_dir, "CLAUDE.md")
509
+ if os.path.exists(src_claude):
510
+ if not os.path.exists(dst_claude):
511
+ shutil.copy2(src_claude, dst_claude)
512
+ deployed.append("Claude Code (CLAUDE.md)")
513
+ else:
514
+ with open(dst_claude, "r", encoding="utf-8", errors="ignore") as f:
515
+ c_content = f.read()
516
+ if "Synapse-Hub" not in c_content:
517
+ with open(src_claude, "r", encoding="utf-8") as f:
518
+ append_data = f.read()
519
+ with open(dst_claude, "a", encoding="utf-8") as f:
520
+ f.write("\n\n" + append_data)
521
+ deployed.append("Claude Code (appended to CLAUDE.md)")
503
522
 
504
523
  # 3. GitHub Copilot (.github/copilot-instructions.md)
505
- github_dir = os.path.join(target_dir, ".github")
506
- os.makedirs(github_dir, exist_ok=True)
507
- dst_copilot = os.path.join(github_dir, "copilot-instructions.md")
508
- src_copilot = os.path.join(bridges_dir, "copilot-instructions.md")
509
- if os.path.exists(src_copilot):
510
- if not os.path.exists(dst_copilot):
511
- shutil.copy2(src_copilot, dst_copilot)
512
- deployed.append("GitHub Copilot (.github/copilot-instructions.md)")
513
- else:
514
- with open(dst_copilot, "r", encoding="utf-8", errors="ignore") as f:
515
- cp_content = f.read()
516
- if "Synapse-Hub" not in cp_content:
517
- with open(src_copilot, "r", encoding="utf-8") as f:
518
- append_data = f.read()
519
- with open(dst_copilot, "a", encoding="utf-8") as f:
520
- f.write("\n\n" + append_data)
521
- deployed.append("GitHub Copilot (appended to copilot-instructions.md)")
524
+ if install_all or ide_choice == "copilot":
525
+ github_dir = os.path.join(target_dir, ".github")
526
+ os.makedirs(github_dir, exist_ok=True)
527
+ dst_copilot = os.path.join(github_dir, "copilot-instructions.md")
528
+ src_copilot = os.path.join(bridges_dir, "copilot-instructions.md")
529
+ if os.path.exists(src_copilot):
530
+ if not os.path.exists(dst_copilot):
531
+ shutil.copy2(src_copilot, dst_copilot)
532
+ deployed.append("GitHub Copilot (.github/copilot-instructions.md)")
533
+ else:
534
+ with open(dst_copilot, "r", encoding="utf-8", errors="ignore") as f:
535
+ cp_content = f.read()
536
+ if "Synapse-Hub" not in cp_content:
537
+ with open(src_copilot, "r", encoding="utf-8") as f:
538
+ append_data = f.read()
539
+ with open(dst_copilot, "a", encoding="utf-8") as f:
540
+ f.write("\n\n" + append_data)
541
+ deployed.append("GitHub Copilot (appended to copilot-instructions.md)")
522
542
 
523
543
  # 4. Windsurf (.windsurfrules)
524
- dst_windsurf = os.path.join(target_dir, ".windsurfrules")
525
- src_windsurf = os.path.join(bridges_dir, "windsurfrules")
526
- if os.path.exists(src_windsurf):
527
- if not os.path.exists(dst_windsurf):
528
- shutil.copy2(src_windsurf, dst_windsurf)
529
- deployed.append("Windsurf (.windsurfrules)")
530
- else:
531
- with open(dst_windsurf, "r", encoding="utf-8", errors="ignore") as f:
532
- w_content = f.read()
533
- if "Synapse-Hub" not in w_content:
534
- with open(src_windsurf, "r", encoding="utf-8") as f:
535
- append_data = f.read()
536
- with open(dst_windsurf, "a", encoding="utf-8") as f:
537
- f.write("\n\n" + append_data)
538
- deployed.append("Windsurf (appended to .windsurfrules)")
544
+ if install_all or ide_choice == "windsurf":
545
+ dst_windsurf = os.path.join(target_dir, ".windsurfrules")
546
+ src_windsurf = os.path.join(bridges_dir, "windsurfrules")
547
+ if os.path.exists(src_windsurf):
548
+ if not os.path.exists(dst_windsurf):
549
+ shutil.copy2(src_windsurf, dst_windsurf)
550
+ deployed.append("Windsurf (.windsurfrules)")
551
+ else:
552
+ with open(dst_windsurf, "r", encoding="utf-8", errors="ignore") as f:
553
+ w_content = f.read()
554
+ if "Synapse-Hub" not in w_content:
555
+ with open(src_windsurf, "r", encoding="utf-8") as f:
556
+ append_data = f.read()
557
+ with open(dst_windsurf, "a", encoding="utf-8") as f:
558
+ f.write("\n\n" + append_data)
559
+ deployed.append("Windsurf (appended to .windsurfrules)")
539
560
 
540
561
  if deployed:
541
- print(f" {GREEN}[OK] Deployed Universal AI Bridges:{RESET} {', '.join(deployed)}")
562
+ print(f" {GREEN}[OK] Deployed Universal AI Bridges ({ide_choice}):{RESET} {', '.join(deployed)}")
542
563
  return True
543
564
 
544
565
 
@@ -600,7 +621,7 @@ def uninstall_setup(target_repo: str) -> int:
600
621
  return 0
601
622
 
602
623
 
603
- def run_setup(target_repo, dry_run=False, profile="auto", no_global=True, no_git_hook=False, no_browser=True, open_browser=False):
624
+ def run_setup(target_repo, dry_run=False, profile="auto", no_global=True, no_git_hook=False, no_browser=True, open_browser=False, ide="all"):
604
625
  """Main execution entrypoint for automated project setup."""
605
626
  print(f"\n{BOLD}{CYAN}======================================================================{RESET}")
606
627
  print(f"{BOLD}{CYAN} AUTONOMOUS ZERO-COMMAND PROJECT BOOTSTRAP (AI-READY SETUP) {RESET}")
@@ -653,8 +674,8 @@ def run_setup(target_repo, dry_run=False, profile="auto", no_global=True, no_git
653
674
  ensure_synapse_config(target_repo)
654
675
 
655
676
  # 3. Deploy Universal AI Bridges (Cursor, Claude Code, GitHub Copilot, Windsurf)
656
- print(f"\n{BOLD}[2/5] Deploying Universal AI Bridges (Cursor, Claude, Copilot, Windsurf)...{RESET}")
657
- install_universal_ai_bridges(target_repo)
677
+ print(f"\n{BOLD}[2/5] Deploying Universal AI Bridges (ide={ide})...{RESET}")
678
+ install_universal_ai_bridges(target_repo, ide=ide)
658
679
 
659
680
  # 4. Inject Antigravity Global Plugin
660
681
  plugin_injected = False
@@ -732,6 +753,12 @@ def main():
732
753
  choices=["auto", "core", "web-e2e", "api-perf", "full", "playwright", "pytest", "cypress", "katalon"],
733
754
  help="Skills profile to install (auto, core, web-e2e, api-perf, full, playwright, pytest, cypress, katalon)"
734
755
  )
756
+ parser.add_argument(
757
+ "--ide",
758
+ default="all",
759
+ choices=["auto", "all", "cursor", "cursor-legacy", "windsurf", "claude", "copilot"],
760
+ help="Target IDE AI bridge to install (auto, all, cursor, cursor-legacy, windsurf, claude, copilot)"
761
+ )
735
762
  parser.add_argument("--dry-run", action="store_true", help="Simulate setup actions without modifying disk")
736
763
  parser.add_argument("--uninstall", action="store_true", help="Revert and remove files installed by setup_project")
737
764
  parser.add_argument("--global", action="store_true", dest="enable_global", default=False,
@@ -767,7 +794,8 @@ def main():
767
794
  no_global=use_no_global,
768
795
  no_git_hook=args.no_git_hook,
769
796
  no_browser=no_browser,
770
- open_browser=open_browser
797
+ open_browser=open_browser,
798
+ ide=args.ide
771
799
  )
772
800
 
773
801
 
@@ -68,7 +68,7 @@ EXCLUDED_DIRNAMES = frozenset({
68
68
  ".hg",
69
69
  })
70
70
 
71
- TOTAL_REGISTERED_SKILLS = 53
71
+ TOTAL_REGISTERED_SKILLS = 56
72
72
 
73
73
 
74
74
  def resolve_contained_skill_path(repo_root: str, skill_path: str) -> str:
@@ -253,7 +253,7 @@ def validate_lockfile_integrity(repo_root: str, enforce_content_hash: bool = Tru
253
253
 
254
254
  def update_skills_lockfile(repo_root: str) -> Tuple[bool, str]:
255
255
  """
256
- Recalculates canonical SHA-256 hashes for all 53 skills and writes to skills-lock.json & .skill-lock.json.
256
+ Recalculates canonical SHA-256 hashes for all 56 skills and writes to skills-lock.json & .skill-lock.json.
257
257
  Ensures deterministic output: generating twice on the same tree produces byte-identical files.
258
258
  """
259
259
  canonical_lock = os.path.join(repo_root, "skills-lock.json")
@@ -94,10 +94,21 @@ class TaskMemoryManager:
94
94
  os.makedirs(self.memory_dir, exist_ok=True)
95
95
  now = datetime.datetime.now(datetime.timezone.utc).isoformat()
96
96
 
97
+ # Query Cold Memory (TestMemoryOS) for relevant historical lessons/mutations
98
+ historical_insights = ""
99
+ try:
100
+ from test_memory_os import TestMemoryOS
101
+ mem = TestMemoryOS()
102
+ ctx = mem.retrieve_session_context(query=f"{title} {goal}", top_k=3)
103
+ if ctx.get("count", 0) > 0:
104
+ historical_insights = f"\n## 0. Historical Insights (Cold-Memory Hydration)\n{ctx['markdown_block']}\n"
105
+ except Exception:
106
+ historical_insights = ""
107
+
97
108
  if not os.path.isfile(self.plan_path):
98
109
  initial_plan = (
99
110
  f"# {title}\n\n"
100
- f"> Initialized: `{now}`\n\n"
111
+ f"> Initialized: `{now}`\n{historical_insights}"
101
112
  f"## 1. Goal & Requirements\n{goal}\n\n"
102
113
  f"## 2. Phases & Milestones\n- [ ] Phase 1: Discovery & Analysis\n- [ ] Phase 2: Implementation\n- [ ] Phase 3: Verification & DoD\n\n"
103
114
  f"## 3. Active Status\n`IN_PROGRESS`\n"
@@ -320,6 +320,40 @@ class TestMemoryOS:
320
320
  "results": results
321
321
  }
322
322
 
323
+ def retrieve_session_context(self, query: str, aut_version: Optional[str] = None, top_k: int = 3) -> Dict[str, Any]:
324
+ """
325
+ Retrieves top relevant historical lessons, locator mutations, or anti-patterns
326
+ from Archival Memory and formats them into a compact markdown snippet (< 150 tokens)
327
+ for automated cold-memory prompt hydration at session start.
328
+ """
329
+ search_res = self.archival_search(query=query, aut_version=aut_version, top_k=top_k)
330
+ matches = search_res.get("results", [])
331
+
332
+ if not matches:
333
+ return {
334
+ "status": "EMPTY",
335
+ "count": 0,
336
+ "markdown_block": "> No historical anomalies or failure postmortems recorded for this domain yet.\n",
337
+ "matches": []
338
+ }
339
+
340
+ md_lines = ["> 🧠 **Historical Insights & Anti-Patterns (Cold Memory Retrieval):**\n"]
341
+ for it in matches:
342
+ key = it.get("key", "LESSON")
343
+ payload = it.get("payload", {})
344
+ desc = payload.get("description") or payload.get("reason") or payload.get("patch") or str(payload)
345
+ if len(desc) > 100:
346
+ desc = desc[:97] + "..."
347
+ md_lines.append(f"- **[{key}]** {desc}")
348
+
349
+ markdown_block = "\n".join(md_lines) + "\n"
350
+ return {
351
+ "status": "PASS",
352
+ "count": len(matches),
353
+ "markdown_block": markdown_block,
354
+ "matches": matches
355
+ }
356
+
323
357
  # ----------------- Hygiene & Secret Scrubbing -----------------
324
358
 
325
359
  def scrub_string(self, text: str) -> Tuple[str, int]:
@@ -414,6 +448,13 @@ def main():
414
448
  as_parser.add_argument("--top-k", type=int, default=3, help="Max results to return")
415
449
  as_parser.add_argument("--json", action="store_true", help="Print JSON output")
416
450
 
451
+ # auto-context (cold memory retrieval for prompt injection)
452
+ ac_parser = subparsers.add_parser("auto-context", help="Retrieve cold-memory historical context formatted for prompt injection")
453
+ ac_parser.add_argument("--query", required=True, help="Task query, title, or domain context")
454
+ ac_parser.add_argument("--aut-version", help="Filter by AUT release version")
455
+ ac_parser.add_argument("--top-k", type=int, default=3, help="Max results to return")
456
+ ac_parser.add_argument("--json", action="store_true", help="Print JSON output")
457
+
417
458
  # gc
418
459
  clean_parser = subparsers.add_parser("gc", help="Garbage collection and secret scrubbing")
419
460
  clean_parser.add_argument("--scrub-secrets", action="store_true", default=True, help="Scrub sensitive credentials")
@@ -449,6 +490,13 @@ def main():
449
490
  res = mem.archival_search(args.query, aut_version=args.aut_version, top_k=args.top_k)
450
491
  print(json.dumps(res, indent=2))
451
492
 
493
+ elif args.subcommand == "auto-context":
494
+ res = mem.retrieve_session_context(args.query, aut_version=args.aut_version, top_k=args.top_k)
495
+ if args.json:
496
+ print(json.dumps(res, indent=2))
497
+ else:
498
+ print(res["markdown_block"])
499
+
452
500
  elif args.subcommand == "gc":
453
501
  res = mem.gc(scrub_secrets=args.scrub_secrets, max_age_days=args.max_age_days)
454
502
  print(json.dumps(res, indent=2))
@@ -91,6 +91,22 @@ class TotExploratoryTester:
91
91
  }
92
92
  ]
93
93
 
94
+ # Deep Graph-of-Thoughts (GoT) expansion when max_depth >= 2
95
+ if max_depth >= 2:
96
+ for b in branches:
97
+ if b["branch_id"] == "BRANCH_HAPPY_PATH":
98
+ b["thoughts"].append({"step": 4, "thought": "Assert idempotent data teardown and verify zero dangling entities in database."})
99
+ elif b["branch_id"] == "BRANCH_BOUNDARY_RACE":
100
+ b["thoughts"].append({"step": 4, "thought": "Verify token renewal under concurrent in-flight requests without 401 unhandled rejection."})
101
+ elif b["branch_id"] == "BRANCH_NEGATIVE_CHAOS":
102
+ b["thoughts"].append({"step": 4, "thought": "Verify client-side exponential backoff retry and circuit breaker recovery under transient 503."})
103
+
104
+ graph_edges = [
105
+ {"from": "BRANCH_HAPPY_PATH:step_1", "to": "BRANCH_BOUNDARY_RACE:step_1", "relation": "session_fork"},
106
+ {"from": "BRANCH_BOUNDARY_RACE:step_2", "to": "BRANCH_NEGATIVE_CHAOS:step_2", "relation": "fault_escalation"},
107
+ {"from": "BRANCH_NEGATIVE_CHAOS:step_3", "to": "BRANCH_HAPPY_PATH:step_3", "relation": "recovery_reconciliation"}
108
+ ]
109
+
94
110
  # Beam search selection: sort by risk score descending and take beam_width
95
111
  sorted_branches = sorted(branches, key=lambda b: cast(float, b["risk_score"]), reverse=True)
96
112
  selected_branches = sorted_branches[:beam_width]
@@ -104,6 +120,7 @@ class TotExploratoryTester:
104
120
  "total_branches_explored": len(branches),
105
121
  "highest_risk_branch": selected_branches[0]["branch_id"],
106
122
  "branches": selected_branches,
123
+ "graph_of_thoughts_edges": graph_edges,
107
124
  "clean_pom_recommendations": [
108
125
  f"Implement {context_domain}Page extending BasePage",
109
126
  "Encapsulate double-click debounce in clickSubmitSafe()",
@@ -238,7 +238,7 @@ class SynapseUiHandler(BaseHTTPRequestHandler):
238
238
  if path == "/api/status":
239
239
  active_target = JOB_MANAGER.target_dir or REPO_ROOT
240
240
  self.send_json(200, {
241
- "version": "4.2.5",
241
+ "version": "4.3.1",
242
242
  "status": "ONLINE",
243
243
  "os": sys.platform,
244
244
  "workspace": active_target,
@@ -68,7 +68,7 @@ def get_local_version():
68
68
  try:
69
69
  with open(pkg_file, "r", encoding="utf-8") as f:
70
70
  data = json.load(f)
71
- return data.get("version", "4.2.5")
71
+ return data.get("version", "4.3.1")
72
72
  except (OSError, json.JSONDecodeError):
73
73
  data = {}
74
74
 
@@ -77,11 +77,11 @@ def get_local_version():
77
77
  try:
78
78
  with open(manifest_file, "r", encoding="utf-8") as f:
79
79
  data = json.load(f)
80
- return data.get("version", "4.2.5")
80
+ return data.get("version", "4.3.1")
81
81
  except (OSError, json.JSONDecodeError):
82
82
  data = {}
83
83
 
84
- return "4.2.5"
84
+ return "4.3.1"
85
85
 
86
86
 
87
87
  def fetch_remote_version():
@@ -237,34 +237,37 @@ def verify_git_provenance(cwd):
237
237
  return True, "Provenance verified"
238
238
 
239
239
 
240
- def perform_update():
240
+ def perform_update(silent=False):
241
241
  """
242
242
  Executes 1-click update:
243
243
  1. If inside a git repository (local clone or global plugin): pulls latest changes.
244
244
  2. Synchronizes SQLite central memory.
245
245
  3. Re-runs DoD Quality Gates to guarantee integrity.
246
246
  """
247
- print(f"\n{BOLD}{CYAN}======================================================================{RESET}")
248
- print(f"{BOLD}{CYAN} SYNAPSE-HUB: 1-CLICK AUTOMATED UPDATE ENGINE {RESET}")
249
- print(f"{BOLD}{CYAN}======================================================================{RESET}")
247
+ if not silent:
248
+ print(f"\n{BOLD}{CYAN}======================================================================{RESET}")
249
+ print(f"{BOLD}{CYAN} SYNAPSE-HUB: 1-CLICK AUTOMATED UPDATE ENGINE {RESET}")
250
+ print(f"{BOLD}{CYAN}======================================================================{RESET}")
250
251
 
251
252
  local_ver = get_local_version()
252
- print(f"📦 Current Hub Version: {BOLD}v{local_ver}{RESET}")
253
- print("🔍 Checking upstream for latest releases...")
253
+ if not silent:
254
+ print(f"📦 Current Hub Version: {BOLD}v{local_ver}{RESET}")
255
+ print("🔍 Checking upstream for latest releases...")
254
256
 
255
257
  has_update, local_ver, remote_ver = check_for_updates(force=True, notify=False)
256
- if remote_ver:
257
- print(f"🌐 Latest Upstream Version: {BOLD}{GREEN}v{remote_ver}{RESET}")
258
- else:
259
- print("⚠️ Could not reach upstream registry (offline or network timeout).")
258
+ if not silent:
259
+ if remote_ver:
260
+ print(f"🌐 Latest Upstream Version: {BOLD}{GREEN}v{remote_ver}{RESET}")
261
+ else:
262
+ print("⚠️ Could not reach upstream registry (offline or network timeout).")
260
263
 
261
264
  # Detect if repo is a git clone
262
265
  git_dir = os.path.join(HUB_ROOT, ".git")
263
266
  is_git_repo = os.path.exists(git_dir)
264
267
 
265
-
266
268
  if is_git_repo:
267
- print(f"\n{BOLD}[1/3] Pulling latest updates via Git...{RESET}")
269
+ if not silent:
270
+ print(f"\n{BOLD}[1/3] Pulling latest updates via Git...{RESET}")
268
271
  try:
269
272
  res = subprocess.run(
270
273
  ["git", "pull", "--ff-only"],
@@ -275,28 +278,38 @@ def perform_update():
275
278
  timeout=30.0
276
279
  )
277
280
  if res.returncode == 0:
278
- print(f" {GREEN}[OK] Git pull successful:{RESET}")
279
- for line in res.stdout.strip().splitlines():
280
- print(f" {line}")
281
+ if not silent:
282
+ print(f" {GREEN}[OK] Git pull successful:{RESET}")
283
+ for line in res.stdout.strip().splitlines():
284
+ print(f" {line}")
281
285
  ok, msg = verify_git_provenance(HUB_ROOT)
282
- if not ok:
283
- print(f" {RED}⚠️ Provenance Warning: {msg}{RESET}")
284
- else:
285
- print(f" {GREEN}[OK] {msg}{RESET}")
286
+ if not silent:
287
+ if not ok:
288
+ print(f" {RED}⚠️ Provenance Warning: {msg}{RESET}")
289
+ else:
290
+ print(f" {GREEN}[OK] {msg}{RESET}")
286
291
  # If this is the first pull, show the welcome landing page
287
- try:
288
- import welcome_page
289
- if welcome_page.is_first_run(HUB_ROOT):
290
- welcome_page.generate_welcome_page(target_repo=HUB_ROOT, open_browser=True)
291
- welcome_page.mark_first_run_completed(HUB_ROOT)
292
- except (ImportError, OSError):
293
- welcome_page = None
292
+ if not silent:
293
+ try:
294
+ import welcome_page
295
+ if welcome_page.is_first_run(HUB_ROOT):
296
+ welcome_page.generate_welcome_page(target_repo=HUB_ROOT, open_browser=True)
297
+ welcome_page.mark_first_run_completed(HUB_ROOT)
298
+ except (ImportError, OSError):
299
+ welcome_page = None
294
300
  else:
295
- print(f" ⚠️ Git pull notice: {res.stderr.strip() or res.stdout.strip()}")
301
+ if not silent:
302
+ print(f" ⚠️ Git pull notice: {res.stderr.strip() or res.stdout.strip()}")
303
+ else:
304
+ sys.stderr.write(f"[update_sentinel] Git pull skipped: {res.stderr.strip() or res.stdout.strip()}\n")
296
305
  except Exception as e:
297
- print(f" ⚠️ Could not execute git pull: {e}")
306
+ if not silent:
307
+ print(f" ⚠️ Could not execute git pull: {e}")
308
+ else:
309
+ sys.stderr.write(f"[update_sentinel] Git pull error: {e}\n")
298
310
  else:
299
- print(f"\n{BOLD}[1/3] Checking NPM package installation...{RESET}")
311
+ if not silent:
312
+ print(f"\n{BOLD}[1/3] Checking NPM package installation...{RESET}")
300
313
  try:
301
314
  res = subprocess.run(
302
315
  ["npm", "install", "-g", "@teevee98/synapse-hub@latest"],
@@ -305,7 +318,7 @@ def perform_update():
305
318
  text=True,
306
319
  timeout=60.0
307
320
  )
308
- if res.returncode == 0:
321
+ if res.returncode == 0 and not silent:
309
322
  print(f" {GREEN}[OK] Global NPM package updated to latest!{RESET}")
310
323
  except (subprocess.SubprocessError, OSError) as err:
311
324
  import logging
@@ -313,12 +326,14 @@ def perform_update():
313
326
 
314
327
  # 2. Check Global Plugin
315
328
  if os.path.exists(GLOBAL_PLUGIN_DIR) and GLOBAL_PLUGIN_DIR.lower() != HUB_ROOT.lower():
316
- print(f"\n{BOLD}[2/3] Synchronizing Global Antigravity Plugin...{RESET}")
329
+ if not silent:
330
+ print(f"\n{BOLD}[2/3] Synchronizing Global Antigravity Plugin...{RESET}")
317
331
  plugin_git = os.path.join(GLOBAL_PLUGIN_DIR, ".git")
318
332
  if os.path.exists(plugin_git):
319
333
  try:
320
334
  subprocess.run(["git", "pull", "--ff-only"], cwd=GLOBAL_PLUGIN_DIR, stdout=subprocess.DEVNULL, timeout=30.0)
321
- print(f" {GREEN}[OK] Updated Global Plugin repository: {GLOBAL_PLUGIN_DIR}{RESET}")
335
+ if not silent:
336
+ print(f" {GREEN}[OK] Updated Global Plugin repository: {GLOBAL_PLUGIN_DIR}{RESET}")
322
337
  except (subprocess.SubprocessError, OSError) as err:
323
338
  import logging
324
339
  logging.getLogger("update_sentinel").debug("Git pull skipped: %s", err)
@@ -331,19 +346,23 @@ def perform_update():
331
346
  dst_f = os.path.join(GLOBAL_PLUGIN_DIR, meta_f)
332
347
  if os.path.exists(src_f):
333
348
  shutil.copy2(src_f, dst_f)
334
- print(f" {GREEN}[OK] Refreshed metadata & LICENSE in: {GLOBAL_PLUGIN_DIR}{RESET}")
349
+ if not silent:
350
+ print(f" {GREEN}[OK] Refreshed metadata & LICENSE in: {GLOBAL_PLUGIN_DIR}{RESET}")
335
351
  except OSError as err:
336
352
  import logging
337
353
  logging.getLogger("update_sentinel").debug("Failed to refresh metadata: %s", err)
338
354
 
339
355
  # 3. Re-initialize SQLite Memory Cache
340
- print(f"\n{BOLD}[3/3] Synchronizing Central Agent Memory Cache...{RESET}")
356
+ if not silent:
357
+ print(f"\n{BOLD}[3/3] Synchronizing Central Agent Memory Cache...{RESET}")
341
358
  try:
342
359
  import cache_resolver
343
360
  cache_resolver.init_db(seed=True)
344
- print(f" {GREEN}[OK] Synced episodic solution memory (0-token cache).{RESET}")
361
+ if not silent:
362
+ print(f" {GREEN}[OK] Synced episodic solution memory (0-token cache).{RESET}")
345
363
  except Exception as e:
346
- print(f" ⚠️ Cache sync notice: {e}")
364
+ if not silent:
365
+ print(f" ⚠️ Cache sync notice: {e}")
347
366
 
348
367
  # Clear update cache so banner dismisses
349
368
  new_local_ver = get_local_version()
@@ -355,20 +374,67 @@ def perform_update():
355
374
  }
356
375
  write_update_cache(cache)
357
376
 
358
- print(f"\n{BOLD}{CYAN}======================================================================{RESET}")
359
- print(f"{BOLD}{GREEN} 🎉 UPDATE COMPLETE: Synapse-Hub is up to date (v{new_local_ver})! {RESET}")
360
- print(f"{BOLD}{CYAN}======================================================================{RESET}\n")
377
+ if not silent:
378
+ print(f"\n{BOLD}{CYAN}======================================================================{RESET}")
379
+ print(f"{BOLD}{GREEN} 🎉 UPDATE COMPLETE: Synapse-Hub is up to date (v{new_local_ver})! {RESET}")
380
+ print(f"{BOLD}{CYAN}======================================================================{RESET}\n")
361
381
  return True
362
382
 
363
383
 
384
+ def run_auto_update_hook(force=False):
385
+ """
386
+ Executes automated non-interactive update check for Antigravity SessionStart lifecycle hook.
387
+ Outputs strict JSON to stdout matching the Antigravity hook contract:
388
+ {"injectSteps": [{"systemMessage": {"systemMessage": "...", "metadata": {"user_markdown": "..."}}}]}
389
+ """
390
+ try:
391
+ has_update, local_ver, remote_ver = check_for_updates(force=force, notify=False)
392
+ if not has_update or not remote_ver:
393
+ print(json.dumps({"injectSteps": []}))
394
+ return
395
+
396
+ # Perform silent update
397
+ perform_update(silent=True)
398
+ new_local_ver = get_local_version()
399
+
400
+ if parse_semver(new_local_ver) > parse_semver(local_ver):
401
+ msg = f"Synapse-Hub auto-updated from v{local_ver} to v{new_local_ver}."
402
+ badge = f"> 🚀 **Synapse Hub Auto-Updated:** `v{local_ver}` → `v{new_local_ver}` (Session Ready with 56 skills)"
403
+ else:
404
+ msg = f"Synapse-Hub update v{remote_ver} available upstream."
405
+ badge = f"> ℹ️ **Synapse Hub Update Available:** `v{remote_ver}` available upstream."
406
+
407
+ payload = {
408
+ "injectSteps": [
409
+ {
410
+ "systemMessage": {
411
+ "systemMessage": msg,
412
+ "metadata": {
413
+ "user_markdown": badge
414
+ }
415
+ }
416
+ }
417
+ ]
418
+ }
419
+ print(json.dumps(payload))
420
+ except Exception as err:
421
+ sys.stderr.write(f"[update_sentinel] Auto-update hook notice: {err}\n")
422
+ print(json.dumps({"injectSteps": []}))
423
+
424
+
364
425
  def main():
365
426
  import argparse
366
427
  parser = argparse.ArgumentParser(description="Synapse-Hub Auto-Update & Drift Sentinel")
367
428
  parser.add_argument("--check", action="store_true", help="Check for available updates without applying")
368
429
  parser.add_argument("--update", action="store_true", help="Perform 1-click update to latest version")
430
+ parser.add_argument("--auto", action="store_true", help="Non-interactive silent auto-update for Antigravity hooks")
369
431
  parser.add_argument("--force", action="store_true", help="Force refresh update check bypassing cache")
370
432
  args = parser.parse_args()
371
433
 
434
+ if args.auto:
435
+ run_auto_update_hook(force=args.force)
436
+ sys.exit(0)
437
+
372
438
  if args.check:
373
439
  has_update, cur, rem = check_for_updates(force=True, notify=False)
374
440
  print(f"Current Hub Version : v{cur}")
@@ -380,7 +446,7 @@ def main():
380
446
  print(f"{GREEN}✅ Synapse-Hub is up to date.{RESET}")
381
447
  sys.exit(0)
382
448
 
383
- if args.update or not (args.check or args.force):
449
+ if args.update or not (args.check or args.force or args.auto):
384
450
  perform_update()
385
451
  sys.exit(0)
386
452
 
@@ -1458,7 +1458,7 @@ def gate_9_skill_collision(repo_root, mode="AUTO"):
1458
1458
  safe_print(s_res.stdout)
1459
1459
  safe_print(s_res.stderr)
1460
1460
  return False
1461
- print("[PASS] 100% Verified: All 53 skills conform to Frontmatter Schema & Policies.")
1461
+ print("[PASS] 100% Verified: All registered skills conform to Frontmatter Schema & Policies.")
1462
1462
  except Exception as s_err:
1463
1463
  print(f"[FAIL] Gate 9 Skill Schema Validator execution error: {s_err}")
1464
1464
  return False