@heretek-ai/epistemic-swarm 0.2.0 → 0.2.2

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 (42) hide show
  1. package/.claude-plugin/marketplace.json +36 -9
  2. package/.claude-plugin/plugin.json +47 -41
  3. package/MARKETPLACE.md +93 -0
  4. package/README.md +39 -2
  5. package/bin/cli.js +58 -0
  6. package/config/mcp_launcher.py +215 -0
  7. package/hooks/hooks.json +24 -0
  8. package/package.json +26 -3
  9. package/plugins/research-cache/.claude-plugin/plugin.json +15 -0
  10. package/plugins/socratic-grilling/.claude-plugin/plugin.json +15 -0
  11. package/plugins/socratic-grilling/skills/grilling/SKILL.md +48 -0
  12. package/plugins/socratic-grilling/skills/grilling/__init__.py +0 -0
  13. package/plugins/socratic-grilling/skills/grilling/socratic_tree.py +148 -0
  14. package/prompts/agent_code_auditor.md +88 -0
  15. package/prompts/agent_oss_scout.md +78 -0
  16. package/runner/__pycache__/__init__.cpython-311.pyc +0 -0
  17. package/runner/__pycache__/auditor_engine.cpython-311.pyc +0 -0
  18. package/runner/__pycache__/research_swarm.cpython-311.pyc +0 -0
  19. package/runner/__pycache__/state_machine.cpython-311.pyc +0 -0
  20. package/runner/research_swarm.py +230 -81
  21. package/runner/tests/__pycache__/test_swarm.cpython-311.pyc +0 -0
  22. package/runner/tests/test_swarm.py +37 -0
  23. package/skills/code_audit/SKILL.md +45 -0
  24. package/skills/epistemic_search/SKILL.md +35 -0
  25. package/skills/epistemic_search/__init__.py +1 -0
  26. package/skills/epistemic_search/scripts/fetch.py +157 -0
  27. package/skills/epistemic_search/scripts/search.py +162 -0
  28. package/skills/oss_scout/SKILL.md +49 -0
  29. package/skills/research_cache/SKILL.md +36 -0
  30. package/skills/research_cache/__init__.py +0 -0
  31. package/skills/research_cache/__pycache__/__init__.cpython-311.pyc +0 -0
  32. package/skills/{research-cache → research_cache}/__pycache__/hasher.cpython-311.pyc +0 -0
  33. package/skills/research_cache/hasher.py +195 -0
  34. package/skills/swarm_config/SKILL.md +72 -0
  35. package/skills/swarm_config/__init__.py +4 -0
  36. package/skills/swarm_config/__pycache__/__init__.cpython-311.pyc +0 -0
  37. package/skills/swarm_config/__pycache__/configure.cpython-311.pyc +0 -0
  38. package/skills/swarm_config/configure.py +167 -0
  39. package/skills/research-cache/__pycache__/__init__.cpython-311.pyc +0 -0
  40. /package/{skills/research-cache → plugins/research-cache/skills/research_cache}/SKILL.md +0 -0
  41. /package/{skills/research-cache → plugins/research-cache/skills/research_cache}/__init__.py +0 -0
  42. /package/{skills/research-cache → plugins/research-cache/skills/research_cache}/hasher.py +0 -0
@@ -0,0 +1,167 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ Interactive Configuration Manager for IUMBTEMS Epistemic Swarm.
4
+ Reads, modifies, and persists research parameters in .research/config.json.
5
+ """
6
+
7
+ import sys
8
+ import os
9
+ import json
10
+ from pathlib import Path
11
+ from typing import Dict, Any
12
+
13
+ DEFAULT_CONFIG: Dict[str, Any] = {
14
+ "search_engine": "duckduckgo",
15
+ "max_iterations": 2,
16
+ "divergence_threshold": 0.75,
17
+ "mode": "research", # "research", "audit", "scout", "hybrid"
18
+ "cache_raw_markdown": True,
19
+ "license_whitelist": ["MIT", "Apache-2.0", "BSD-3-Clause", "ISC"],
20
+ "output_dir": ".research"
21
+ }
22
+
23
+ def get_config_path(base_dir: str = ".research") -> Path:
24
+ return Path(base_dir) / "config.json"
25
+
26
+ def load_config(base_dir: str = ".research") -> Dict[str, Any]:
27
+ cfg_file = get_config_path(base_dir)
28
+ if not cfg_file.exists():
29
+ return dict(DEFAULT_CONFIG)
30
+ try:
31
+ with open(cfg_file, "r", encoding="utf-8") as f:
32
+ data = json.load(f)
33
+ merged = dict(DEFAULT_CONFIG)
34
+ merged.update(data)
35
+ return merged
36
+ except Exception as e:
37
+ sys.stderr.write(f"[swarm-config] Warning: Failed to parse {cfg_file}: {e}. Using defaults.\n")
38
+ return dict(DEFAULT_CONFIG)
39
+
40
+ def save_config(cfg: Dict[str, Any], base_dir: str = ".research") -> Path:
41
+ target_dir = Path(base_dir)
42
+ target_dir.mkdir(parents=True, exist_ok=True)
43
+ cfg_file = target_dir / "config.json"
44
+ with open(cfg_file, "w", encoding="utf-8") as f:
45
+ json.dump(cfg, f, indent=2)
46
+ return cfg_file
47
+
48
+ def display_config(cfg: Dict[str, Any]):
49
+ print("\n⚙️ EPISTEMIC SWARM ACTIVE CONFIGURATION")
50
+ print("========================================")
51
+ print(f" 🔍 Primary Search Engine: {cfg.get('search_engine', 'duckduckgo').upper()}")
52
+ print(f" 🔄 Max Iterations (Depth): {cfg.get('max_iterations', 2)}")
53
+ print(f" ⚖️ Divergence Threshold: {cfg.get('divergence_threshold', 0.75)}")
54
+ print(f" 🎯 Operating Mode: {cfg.get('mode', 'research').upper()}")
55
+ print(f" 💾 Raw Markdown Caching: {'ENABLED' if cfg.get('cache_raw_markdown', True) else 'DISABLED'}")
56
+ print(f" 📜 License Whitelist: {', '.join(cfg.get('license_whitelist', []))}")
57
+ print(f" 📁 Output Directory: {cfg.get('output_dir', '.research')}")
58
+ print("========================================\n")
59
+
60
+ def run_interactive(cfg: Dict[str, Any]) -> Dict[str, Any]:
61
+ print("\n🔧 Epistemic Swarm Interactive Configuration Setup")
62
+ print("--------------------------------------------------")
63
+
64
+ # 1. Search engine
65
+ print("\nSelect Primary Search Engine:")
66
+ print(" 1) DuckDuckGo (Zero-key default, free, no limits)")
67
+ print(" 2) Brave Search (High accuracy SERP, requires BRAVE_SEARCH_API_KEY)")
68
+ print(" 3) Firecrawl (Deep JS rendering, requires FIRECRAWL_API_KEY)")
69
+ print(" 4) SearXNG (Self-hosted metasearch aggregator)")
70
+ engine_choice = input(f"Choice [current: {cfg['search_engine']}]: ").strip()
71
+ if engine_choice == "1":
72
+ cfg["search_engine"] = "duckduckgo"
73
+ elif engine_choice == "2":
74
+ cfg["search_engine"] = "brave"
75
+ elif engine_choice == "3":
76
+ cfg["search_engine"] = "firecrawl"
77
+ elif engine_choice == "4":
78
+ cfg["search_engine"] = "searxng"
79
+
80
+ # 2. Max iterations
81
+ print("\nSelect Research Depth / Max Iterations:")
82
+ print(" 1) 1 Pass — Rapid brief (low token usage)")
83
+ print(" 2) 2 Passes — Standard dialectic thesis vs antithesis (recommended)")
84
+ print(" 3) 3 Passes — Deep investigation")
85
+ print(" 4) 4 Passes — Exhaustive multi-scope audit")
86
+ depth_choice = input(f"Choice [current: {cfg['max_iterations']}]: ").strip()
87
+ if depth_choice in ("1", "2", "3", "4"):
88
+ cfg["max_iterations"] = int(depth_choice)
89
+
90
+ # 3. Operating mode
91
+ print("\nSelect Primary Operating Mode:")
92
+ print(" 1) research — Empirical web & literature synthesis")
93
+ print(" 2) audit — Deep codebase architecture & vulnerability audit")
94
+ print(" 3) scout — Open-source software discovery & clean-room harvesting")
95
+ print(" 4) hybrid — Combined codebase audit + web research")
96
+ mode_choice = input(f"Choice [current: {cfg['mode']}]: ").strip()
97
+ if mode_choice == "1":
98
+ cfg["mode"] = "research"
99
+ elif mode_choice == "2":
100
+ cfg["mode"] = "audit"
101
+ elif mode_choice == "3":
102
+ cfg["mode"] = "scout"
103
+ elif mode_choice == "4":
104
+ cfg["mode"] = "hybrid"
105
+
106
+ return cfg
107
+
108
+ def main():
109
+ cfg = load_config()
110
+ args = sys.argv[1:]
111
+
112
+ if not args or "--show" in args:
113
+ display_config(cfg)
114
+ if not args:
115
+ print("To edit settings, run:")
116
+ print(" python3 skills/swarm_config/configure.py --interactive")
117
+ print(" python3 skills/swarm_config/configure.py --engine duckduckgo --depth 3 --mode audit\n")
118
+ return
119
+
120
+ if "--interactive" in args or "-i" in args:
121
+ cfg = run_interactive(cfg)
122
+ cfg_path = save_config(cfg)
123
+ print(f"✅ Configuration saved to {cfg_path}")
124
+ display_config(cfg)
125
+ return
126
+
127
+ idx = 0
128
+ modified = False
129
+ while idx < len(args):
130
+ arg = args[idx]
131
+ if arg in ("--engine", "-e") and idx + 1 < len(args):
132
+ engine = args[idx + 1].lower()
133
+ if engine in ("duckduckgo", "brave", "firecrawl", "searxng"):
134
+ cfg["search_engine"] = engine
135
+ modified = True
136
+ idx += 1
137
+ elif arg in ("--depth", "-d", "--iterations") and idx + 1 < len(args):
138
+ try:
139
+ cfg["max_iterations"] = int(args[idx + 1])
140
+ modified = True
141
+ except ValueError:
142
+ pass
143
+ idx += 1
144
+ elif arg in ("--mode", "-m") and idx + 1 < len(args):
145
+ mode = args[idx + 1].lower()
146
+ if mode in ("research", "audit", "scout", "hybrid"):
147
+ cfg["mode"] = mode
148
+ modified = True
149
+ idx += 1
150
+ elif arg == "--divergence" and idx + 1 < len(args):
151
+ try:
152
+ cfg["divergence_threshold"] = float(args[idx + 1])
153
+ modified = True
154
+ except ValueError:
155
+ pass
156
+ idx += 1
157
+ idx += 1
158
+
159
+ if modified:
160
+ cfg_path = save_config(cfg)
161
+ print(f"✅ Configuration updated and saved to {cfg_path}")
162
+ display_config(cfg)
163
+ else:
164
+ display_config(cfg)
165
+
166
+ if __name__ == "__main__":
167
+ main()