attune-ai 2.0.0__py3-none-any.whl

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 (457) hide show
  1. attune/__init__.py +358 -0
  2. attune/adaptive/__init__.py +13 -0
  3. attune/adaptive/task_complexity.py +127 -0
  4. attune/agent_monitoring.py +414 -0
  5. attune/cache/__init__.py +117 -0
  6. attune/cache/base.py +166 -0
  7. attune/cache/dependency_manager.py +256 -0
  8. attune/cache/hash_only.py +251 -0
  9. attune/cache/hybrid.py +457 -0
  10. attune/cache/storage.py +285 -0
  11. attune/cache_monitor.py +356 -0
  12. attune/cache_stats.py +298 -0
  13. attune/cli/__init__.py +152 -0
  14. attune/cli/__main__.py +12 -0
  15. attune/cli/commands/__init__.py +1 -0
  16. attune/cli/commands/batch.py +264 -0
  17. attune/cli/commands/cache.py +248 -0
  18. attune/cli/commands/help.py +331 -0
  19. attune/cli/commands/info.py +140 -0
  20. attune/cli/commands/inspect.py +436 -0
  21. attune/cli/commands/inspection.py +57 -0
  22. attune/cli/commands/memory.py +48 -0
  23. attune/cli/commands/metrics.py +92 -0
  24. attune/cli/commands/orchestrate.py +184 -0
  25. attune/cli/commands/patterns.py +207 -0
  26. attune/cli/commands/profiling.py +202 -0
  27. attune/cli/commands/provider.py +98 -0
  28. attune/cli/commands/routing.py +285 -0
  29. attune/cli/commands/setup.py +96 -0
  30. attune/cli/commands/status.py +235 -0
  31. attune/cli/commands/sync.py +166 -0
  32. attune/cli/commands/tier.py +121 -0
  33. attune/cli/commands/utilities.py +114 -0
  34. attune/cli/commands/workflow.py +579 -0
  35. attune/cli/core.py +32 -0
  36. attune/cli/parsers/__init__.py +68 -0
  37. attune/cli/parsers/batch.py +118 -0
  38. attune/cli/parsers/cache.py +65 -0
  39. attune/cli/parsers/help.py +41 -0
  40. attune/cli/parsers/info.py +26 -0
  41. attune/cli/parsers/inspect.py +66 -0
  42. attune/cli/parsers/metrics.py +42 -0
  43. attune/cli/parsers/orchestrate.py +61 -0
  44. attune/cli/parsers/patterns.py +54 -0
  45. attune/cli/parsers/provider.py +40 -0
  46. attune/cli/parsers/routing.py +110 -0
  47. attune/cli/parsers/setup.py +42 -0
  48. attune/cli/parsers/status.py +47 -0
  49. attune/cli/parsers/sync.py +31 -0
  50. attune/cli/parsers/tier.py +33 -0
  51. attune/cli/parsers/workflow.py +77 -0
  52. attune/cli/utils/__init__.py +1 -0
  53. attune/cli/utils/data.py +242 -0
  54. attune/cli/utils/helpers.py +68 -0
  55. attune/cli_legacy.py +3957 -0
  56. attune/cli_minimal.py +1159 -0
  57. attune/cli_router.py +437 -0
  58. attune/cli_unified.py +814 -0
  59. attune/config/__init__.py +66 -0
  60. attune/config/xml_config.py +286 -0
  61. attune/config.py +545 -0
  62. attune/coordination.py +870 -0
  63. attune/core.py +1511 -0
  64. attune/core_modules/__init__.py +15 -0
  65. attune/cost_tracker.py +626 -0
  66. attune/dashboard/__init__.py +41 -0
  67. attune/dashboard/app.py +512 -0
  68. attune/dashboard/simple_server.py +435 -0
  69. attune/dashboard/standalone_server.py +547 -0
  70. attune/discovery.py +306 -0
  71. attune/emergence.py +306 -0
  72. attune/exceptions.py +123 -0
  73. attune/feedback_loops.py +373 -0
  74. attune/hot_reload/README.md +473 -0
  75. attune/hot_reload/__init__.py +62 -0
  76. attune/hot_reload/config.py +83 -0
  77. attune/hot_reload/integration.py +229 -0
  78. attune/hot_reload/reloader.py +298 -0
  79. attune/hot_reload/watcher.py +183 -0
  80. attune/hot_reload/websocket.py +177 -0
  81. attune/levels.py +577 -0
  82. attune/leverage_points.py +441 -0
  83. attune/logging_config.py +261 -0
  84. attune/mcp/__init__.py +10 -0
  85. attune/mcp/server.py +506 -0
  86. attune/memory/__init__.py +237 -0
  87. attune/memory/claude_memory.py +469 -0
  88. attune/memory/config.py +224 -0
  89. attune/memory/control_panel.py +1290 -0
  90. attune/memory/control_panel_support.py +145 -0
  91. attune/memory/cross_session.py +845 -0
  92. attune/memory/edges.py +179 -0
  93. attune/memory/encryption.py +159 -0
  94. attune/memory/file_session.py +770 -0
  95. attune/memory/graph.py +570 -0
  96. attune/memory/long_term.py +913 -0
  97. attune/memory/long_term_types.py +99 -0
  98. attune/memory/mixins/__init__.py +25 -0
  99. attune/memory/mixins/backend_init_mixin.py +249 -0
  100. attune/memory/mixins/capabilities_mixin.py +208 -0
  101. attune/memory/mixins/handoff_mixin.py +208 -0
  102. attune/memory/mixins/lifecycle_mixin.py +49 -0
  103. attune/memory/mixins/long_term_mixin.py +352 -0
  104. attune/memory/mixins/promotion_mixin.py +109 -0
  105. attune/memory/mixins/short_term_mixin.py +182 -0
  106. attune/memory/nodes.py +179 -0
  107. attune/memory/redis_bootstrap.py +540 -0
  108. attune/memory/security/__init__.py +31 -0
  109. attune/memory/security/audit_logger.py +932 -0
  110. attune/memory/security/pii_scrubber.py +640 -0
  111. attune/memory/security/secrets_detector.py +678 -0
  112. attune/memory/short_term.py +2192 -0
  113. attune/memory/simple_storage.py +302 -0
  114. attune/memory/storage/__init__.py +15 -0
  115. attune/memory/storage_backend.py +167 -0
  116. attune/memory/summary_index.py +583 -0
  117. attune/memory/types.py +446 -0
  118. attune/memory/unified.py +182 -0
  119. attune/meta_workflows/__init__.py +74 -0
  120. attune/meta_workflows/agent_creator.py +248 -0
  121. attune/meta_workflows/builtin_templates.py +567 -0
  122. attune/meta_workflows/cli_commands/__init__.py +56 -0
  123. attune/meta_workflows/cli_commands/agent_commands.py +321 -0
  124. attune/meta_workflows/cli_commands/analytics_commands.py +442 -0
  125. attune/meta_workflows/cli_commands/config_commands.py +232 -0
  126. attune/meta_workflows/cli_commands/memory_commands.py +182 -0
  127. attune/meta_workflows/cli_commands/template_commands.py +354 -0
  128. attune/meta_workflows/cli_commands/workflow_commands.py +382 -0
  129. attune/meta_workflows/cli_meta_workflows.py +59 -0
  130. attune/meta_workflows/form_engine.py +292 -0
  131. attune/meta_workflows/intent_detector.py +409 -0
  132. attune/meta_workflows/models.py +569 -0
  133. attune/meta_workflows/pattern_learner.py +738 -0
  134. attune/meta_workflows/plan_generator.py +384 -0
  135. attune/meta_workflows/session_context.py +397 -0
  136. attune/meta_workflows/template_registry.py +229 -0
  137. attune/meta_workflows/workflow.py +984 -0
  138. attune/metrics/__init__.py +12 -0
  139. attune/metrics/collector.py +31 -0
  140. attune/metrics/prompt_metrics.py +194 -0
  141. attune/models/__init__.py +172 -0
  142. attune/models/__main__.py +13 -0
  143. attune/models/adaptive_routing.py +437 -0
  144. attune/models/auth_cli.py +444 -0
  145. attune/models/auth_strategy.py +450 -0
  146. attune/models/cli.py +655 -0
  147. attune/models/empathy_executor.py +354 -0
  148. attune/models/executor.py +257 -0
  149. attune/models/fallback.py +762 -0
  150. attune/models/provider_config.py +282 -0
  151. attune/models/registry.py +472 -0
  152. attune/models/tasks.py +359 -0
  153. attune/models/telemetry/__init__.py +71 -0
  154. attune/models/telemetry/analytics.py +594 -0
  155. attune/models/telemetry/backend.py +196 -0
  156. attune/models/telemetry/data_models.py +431 -0
  157. attune/models/telemetry/storage.py +489 -0
  158. attune/models/token_estimator.py +420 -0
  159. attune/models/validation.py +280 -0
  160. attune/monitoring/__init__.py +52 -0
  161. attune/monitoring/alerts.py +946 -0
  162. attune/monitoring/alerts_cli.py +448 -0
  163. attune/monitoring/multi_backend.py +271 -0
  164. attune/monitoring/otel_backend.py +362 -0
  165. attune/optimization/__init__.py +19 -0
  166. attune/optimization/context_optimizer.py +272 -0
  167. attune/orchestration/__init__.py +67 -0
  168. attune/orchestration/agent_templates.py +707 -0
  169. attune/orchestration/config_store.py +499 -0
  170. attune/orchestration/execution_strategies.py +2111 -0
  171. attune/orchestration/meta_orchestrator.py +1168 -0
  172. attune/orchestration/pattern_learner.py +696 -0
  173. attune/orchestration/real_tools.py +931 -0
  174. attune/pattern_cache.py +187 -0
  175. attune/pattern_library.py +542 -0
  176. attune/patterns/debugging/all_patterns.json +81 -0
  177. attune/patterns/debugging/workflow_20260107_1770825e.json +77 -0
  178. attune/patterns/refactoring_memory.json +89 -0
  179. attune/persistence.py +564 -0
  180. attune/platform_utils.py +265 -0
  181. attune/plugins/__init__.py +28 -0
  182. attune/plugins/base.py +361 -0
  183. attune/plugins/registry.py +268 -0
  184. attune/project_index/__init__.py +32 -0
  185. attune/project_index/cli.py +335 -0
  186. attune/project_index/index.py +667 -0
  187. attune/project_index/models.py +504 -0
  188. attune/project_index/reports.py +474 -0
  189. attune/project_index/scanner.py +777 -0
  190. attune/project_index/scanner_parallel.py +291 -0
  191. attune/prompts/__init__.py +61 -0
  192. attune/prompts/config.py +77 -0
  193. attune/prompts/context.py +177 -0
  194. attune/prompts/parser.py +285 -0
  195. attune/prompts/registry.py +313 -0
  196. attune/prompts/templates.py +208 -0
  197. attune/redis_config.py +302 -0
  198. attune/redis_memory.py +799 -0
  199. attune/resilience/__init__.py +56 -0
  200. attune/resilience/circuit_breaker.py +256 -0
  201. attune/resilience/fallback.py +179 -0
  202. attune/resilience/health.py +300 -0
  203. attune/resilience/retry.py +209 -0
  204. attune/resilience/timeout.py +135 -0
  205. attune/routing/__init__.py +43 -0
  206. attune/routing/chain_executor.py +433 -0
  207. attune/routing/classifier.py +217 -0
  208. attune/routing/smart_router.py +234 -0
  209. attune/routing/workflow_registry.py +343 -0
  210. attune/scaffolding/README.md +589 -0
  211. attune/scaffolding/__init__.py +35 -0
  212. attune/scaffolding/__main__.py +14 -0
  213. attune/scaffolding/cli.py +240 -0
  214. attune/scaffolding/templates/base_wizard.py.jinja2 +121 -0
  215. attune/scaffolding/templates/coach_wizard.py.jinja2 +321 -0
  216. attune/scaffolding/templates/domain_wizard.py.jinja2 +408 -0
  217. attune/scaffolding/templates/linear_flow_wizard.py.jinja2 +203 -0
  218. attune/socratic/__init__.py +256 -0
  219. attune/socratic/ab_testing.py +958 -0
  220. attune/socratic/blueprint.py +533 -0
  221. attune/socratic/cli.py +703 -0
  222. attune/socratic/collaboration.py +1114 -0
  223. attune/socratic/domain_templates.py +924 -0
  224. attune/socratic/embeddings.py +738 -0
  225. attune/socratic/engine.py +794 -0
  226. attune/socratic/explainer.py +682 -0
  227. attune/socratic/feedback.py +772 -0
  228. attune/socratic/forms.py +629 -0
  229. attune/socratic/generator.py +732 -0
  230. attune/socratic/llm_analyzer.py +637 -0
  231. attune/socratic/mcp_server.py +702 -0
  232. attune/socratic/session.py +312 -0
  233. attune/socratic/storage.py +667 -0
  234. attune/socratic/success.py +730 -0
  235. attune/socratic/visual_editor.py +860 -0
  236. attune/socratic/web_ui.py +958 -0
  237. attune/telemetry/__init__.py +39 -0
  238. attune/telemetry/agent_coordination.py +475 -0
  239. attune/telemetry/agent_tracking.py +367 -0
  240. attune/telemetry/approval_gates.py +545 -0
  241. attune/telemetry/cli.py +1231 -0
  242. attune/telemetry/commands/__init__.py +14 -0
  243. attune/telemetry/commands/dashboard_commands.py +696 -0
  244. attune/telemetry/event_streaming.py +409 -0
  245. attune/telemetry/feedback_loop.py +567 -0
  246. attune/telemetry/usage_tracker.py +591 -0
  247. attune/templates.py +754 -0
  248. attune/test_generator/__init__.py +38 -0
  249. attune/test_generator/__main__.py +14 -0
  250. attune/test_generator/cli.py +234 -0
  251. attune/test_generator/generator.py +355 -0
  252. attune/test_generator/risk_analyzer.py +216 -0
  253. attune/test_generator/templates/unit_test.py.jinja2 +272 -0
  254. attune/tier_recommender.py +384 -0
  255. attune/tools.py +183 -0
  256. attune/trust/__init__.py +28 -0
  257. attune/trust/circuit_breaker.py +579 -0
  258. attune/trust_building.py +527 -0
  259. attune/validation/__init__.py +19 -0
  260. attune/validation/xml_validator.py +281 -0
  261. attune/vscode_bridge.py +173 -0
  262. attune/workflow_commands.py +780 -0
  263. attune/workflow_patterns/__init__.py +33 -0
  264. attune/workflow_patterns/behavior.py +249 -0
  265. attune/workflow_patterns/core.py +76 -0
  266. attune/workflow_patterns/output.py +99 -0
  267. attune/workflow_patterns/registry.py +255 -0
  268. attune/workflow_patterns/structural.py +288 -0
  269. attune/workflows/__init__.py +539 -0
  270. attune/workflows/autonomous_test_gen.py +1268 -0
  271. attune/workflows/base.py +2667 -0
  272. attune/workflows/batch_processing.py +342 -0
  273. attune/workflows/bug_predict.py +1084 -0
  274. attune/workflows/builder.py +273 -0
  275. attune/workflows/caching.py +253 -0
  276. attune/workflows/code_review.py +1048 -0
  277. attune/workflows/code_review_adapters.py +312 -0
  278. attune/workflows/code_review_pipeline.py +722 -0
  279. attune/workflows/config.py +645 -0
  280. attune/workflows/dependency_check.py +644 -0
  281. attune/workflows/document_gen/__init__.py +25 -0
  282. attune/workflows/document_gen/config.py +30 -0
  283. attune/workflows/document_gen/report_formatter.py +162 -0
  284. attune/workflows/document_gen/workflow.py +1426 -0
  285. attune/workflows/document_manager.py +216 -0
  286. attune/workflows/document_manager_README.md +134 -0
  287. attune/workflows/documentation_orchestrator.py +1205 -0
  288. attune/workflows/history.py +510 -0
  289. attune/workflows/keyboard_shortcuts/__init__.py +39 -0
  290. attune/workflows/keyboard_shortcuts/generators.py +391 -0
  291. attune/workflows/keyboard_shortcuts/parsers.py +416 -0
  292. attune/workflows/keyboard_shortcuts/prompts.py +295 -0
  293. attune/workflows/keyboard_shortcuts/schema.py +193 -0
  294. attune/workflows/keyboard_shortcuts/workflow.py +509 -0
  295. attune/workflows/llm_base.py +363 -0
  296. attune/workflows/manage_docs.py +87 -0
  297. attune/workflows/manage_docs_README.md +134 -0
  298. attune/workflows/manage_documentation.py +821 -0
  299. attune/workflows/new_sample_workflow1.py +149 -0
  300. attune/workflows/new_sample_workflow1_README.md +150 -0
  301. attune/workflows/orchestrated_health_check.py +849 -0
  302. attune/workflows/orchestrated_release_prep.py +600 -0
  303. attune/workflows/output.py +413 -0
  304. attune/workflows/perf_audit.py +863 -0
  305. attune/workflows/pr_review.py +762 -0
  306. attune/workflows/progress.py +785 -0
  307. attune/workflows/progress_server.py +322 -0
  308. attune/workflows/progressive/README 2.md +454 -0
  309. attune/workflows/progressive/README.md +454 -0
  310. attune/workflows/progressive/__init__.py +82 -0
  311. attune/workflows/progressive/cli.py +219 -0
  312. attune/workflows/progressive/core.py +488 -0
  313. attune/workflows/progressive/orchestrator.py +723 -0
  314. attune/workflows/progressive/reports.py +520 -0
  315. attune/workflows/progressive/telemetry.py +274 -0
  316. attune/workflows/progressive/test_gen.py +495 -0
  317. attune/workflows/progressive/workflow.py +589 -0
  318. attune/workflows/refactor_plan.py +694 -0
  319. attune/workflows/release_prep.py +895 -0
  320. attune/workflows/release_prep_crew.py +969 -0
  321. attune/workflows/research_synthesis.py +404 -0
  322. attune/workflows/routing.py +168 -0
  323. attune/workflows/secure_release.py +593 -0
  324. attune/workflows/security_adapters.py +297 -0
  325. attune/workflows/security_audit.py +1329 -0
  326. attune/workflows/security_audit_phase3.py +355 -0
  327. attune/workflows/seo_optimization.py +633 -0
  328. attune/workflows/step_config.py +234 -0
  329. attune/workflows/telemetry_mixin.py +269 -0
  330. attune/workflows/test5.py +125 -0
  331. attune/workflows/test5_README.md +158 -0
  332. attune/workflows/test_coverage_boost_crew.py +849 -0
  333. attune/workflows/test_gen/__init__.py +52 -0
  334. attune/workflows/test_gen/ast_analyzer.py +249 -0
  335. attune/workflows/test_gen/config.py +88 -0
  336. attune/workflows/test_gen/data_models.py +38 -0
  337. attune/workflows/test_gen/report_formatter.py +289 -0
  338. attune/workflows/test_gen/test_templates.py +381 -0
  339. attune/workflows/test_gen/workflow.py +655 -0
  340. attune/workflows/test_gen.py +54 -0
  341. attune/workflows/test_gen_behavioral.py +477 -0
  342. attune/workflows/test_gen_parallel.py +341 -0
  343. attune/workflows/test_lifecycle.py +526 -0
  344. attune/workflows/test_maintenance.py +627 -0
  345. attune/workflows/test_maintenance_cli.py +590 -0
  346. attune/workflows/test_maintenance_crew.py +840 -0
  347. attune/workflows/test_runner.py +622 -0
  348. attune/workflows/tier_tracking.py +531 -0
  349. attune/workflows/xml_enhanced_crew.py +285 -0
  350. attune_ai-2.0.0.dist-info/METADATA +1026 -0
  351. attune_ai-2.0.0.dist-info/RECORD +457 -0
  352. attune_ai-2.0.0.dist-info/WHEEL +5 -0
  353. attune_ai-2.0.0.dist-info/entry_points.txt +26 -0
  354. attune_ai-2.0.0.dist-info/licenses/LICENSE +201 -0
  355. attune_ai-2.0.0.dist-info/licenses/LICENSE_CHANGE_ANNOUNCEMENT.md +101 -0
  356. attune_ai-2.0.0.dist-info/top_level.txt +5 -0
  357. attune_healthcare/__init__.py +13 -0
  358. attune_healthcare/monitors/__init__.py +9 -0
  359. attune_healthcare/monitors/clinical_protocol_monitor.py +315 -0
  360. attune_healthcare/monitors/monitoring/__init__.py +44 -0
  361. attune_healthcare/monitors/monitoring/protocol_checker.py +300 -0
  362. attune_healthcare/monitors/monitoring/protocol_loader.py +214 -0
  363. attune_healthcare/monitors/monitoring/sensor_parsers.py +306 -0
  364. attune_healthcare/monitors/monitoring/trajectory_analyzer.py +389 -0
  365. attune_llm/README.md +553 -0
  366. attune_llm/__init__.py +28 -0
  367. attune_llm/agent_factory/__init__.py +53 -0
  368. attune_llm/agent_factory/adapters/__init__.py +85 -0
  369. attune_llm/agent_factory/adapters/autogen_adapter.py +312 -0
  370. attune_llm/agent_factory/adapters/crewai_adapter.py +483 -0
  371. attune_llm/agent_factory/adapters/haystack_adapter.py +298 -0
  372. attune_llm/agent_factory/adapters/langchain_adapter.py +362 -0
  373. attune_llm/agent_factory/adapters/langgraph_adapter.py +333 -0
  374. attune_llm/agent_factory/adapters/native.py +228 -0
  375. attune_llm/agent_factory/adapters/wizard_adapter.py +423 -0
  376. attune_llm/agent_factory/base.py +305 -0
  377. attune_llm/agent_factory/crews/__init__.py +67 -0
  378. attune_llm/agent_factory/crews/code_review.py +1113 -0
  379. attune_llm/agent_factory/crews/health_check.py +1262 -0
  380. attune_llm/agent_factory/crews/refactoring.py +1128 -0
  381. attune_llm/agent_factory/crews/security_audit.py +1018 -0
  382. attune_llm/agent_factory/decorators.py +287 -0
  383. attune_llm/agent_factory/factory.py +558 -0
  384. attune_llm/agent_factory/framework.py +193 -0
  385. attune_llm/agent_factory/memory_integration.py +328 -0
  386. attune_llm/agent_factory/resilient.py +320 -0
  387. attune_llm/agents_md/__init__.py +22 -0
  388. attune_llm/agents_md/loader.py +218 -0
  389. attune_llm/agents_md/parser.py +271 -0
  390. attune_llm/agents_md/registry.py +307 -0
  391. attune_llm/claude_memory.py +466 -0
  392. attune_llm/cli/__init__.py +8 -0
  393. attune_llm/cli/sync_claude.py +487 -0
  394. attune_llm/code_health.py +1313 -0
  395. attune_llm/commands/__init__.py +51 -0
  396. attune_llm/commands/context.py +375 -0
  397. attune_llm/commands/loader.py +301 -0
  398. attune_llm/commands/models.py +231 -0
  399. attune_llm/commands/parser.py +371 -0
  400. attune_llm/commands/registry.py +429 -0
  401. attune_llm/config/__init__.py +29 -0
  402. attune_llm/config/unified.py +291 -0
  403. attune_llm/context/__init__.py +22 -0
  404. attune_llm/context/compaction.py +455 -0
  405. attune_llm/context/manager.py +434 -0
  406. attune_llm/contextual_patterns.py +361 -0
  407. attune_llm/core.py +907 -0
  408. attune_llm/git_pattern_extractor.py +435 -0
  409. attune_llm/hooks/__init__.py +24 -0
  410. attune_llm/hooks/config.py +306 -0
  411. attune_llm/hooks/executor.py +289 -0
  412. attune_llm/hooks/registry.py +302 -0
  413. attune_llm/hooks/scripts/__init__.py +39 -0
  414. attune_llm/hooks/scripts/evaluate_session.py +201 -0
  415. attune_llm/hooks/scripts/first_time_init.py +285 -0
  416. attune_llm/hooks/scripts/pre_compact.py +207 -0
  417. attune_llm/hooks/scripts/session_end.py +183 -0
  418. attune_llm/hooks/scripts/session_start.py +163 -0
  419. attune_llm/hooks/scripts/suggest_compact.py +225 -0
  420. attune_llm/learning/__init__.py +30 -0
  421. attune_llm/learning/evaluator.py +438 -0
  422. attune_llm/learning/extractor.py +514 -0
  423. attune_llm/learning/storage.py +560 -0
  424. attune_llm/levels.py +227 -0
  425. attune_llm/pattern_confidence.py +414 -0
  426. attune_llm/pattern_resolver.py +272 -0
  427. attune_llm/pattern_summary.py +350 -0
  428. attune_llm/providers.py +967 -0
  429. attune_llm/routing/__init__.py +32 -0
  430. attune_llm/routing/model_router.py +362 -0
  431. attune_llm/security/IMPLEMENTATION_SUMMARY.md +413 -0
  432. attune_llm/security/PHASE2_COMPLETE.md +384 -0
  433. attune_llm/security/PHASE2_SECRETS_DETECTOR_COMPLETE.md +271 -0
  434. attune_llm/security/QUICK_REFERENCE.md +316 -0
  435. attune_llm/security/README.md +262 -0
  436. attune_llm/security/__init__.py +62 -0
  437. attune_llm/security/audit_logger.py +929 -0
  438. attune_llm/security/audit_logger_example.py +152 -0
  439. attune_llm/security/pii_scrubber.py +640 -0
  440. attune_llm/security/secrets_detector.py +678 -0
  441. attune_llm/security/secrets_detector_example.py +304 -0
  442. attune_llm/security/secure_memdocs.py +1192 -0
  443. attune_llm/security/secure_memdocs_example.py +278 -0
  444. attune_llm/session_status.py +745 -0
  445. attune_llm/state.py +246 -0
  446. attune_llm/utils/__init__.py +5 -0
  447. attune_llm/utils/tokens.py +349 -0
  448. attune_software/SOFTWARE_PLUGIN_README.md +57 -0
  449. attune_software/__init__.py +13 -0
  450. attune_software/cli/__init__.py +120 -0
  451. attune_software/cli/inspect.py +362 -0
  452. attune_software/cli.py +574 -0
  453. attune_software/plugin.py +188 -0
  454. workflow_scaffolding/__init__.py +11 -0
  455. workflow_scaffolding/__main__.py +12 -0
  456. workflow_scaffolding/cli.py +206 -0
  457. workflow_scaffolding/generator.py +265 -0
@@ -0,0 +1,316 @@
1
+ # Audit Logger Quick Reference
2
+
3
+ ## Import
4
+
5
+ ```python
6
+ from attune_llm.security import AuditLogger
7
+ ```
8
+
9
+ ## Initialize
10
+
11
+ ```python
12
+ # Production
13
+ logger = AuditLogger(log_dir="/var/log/empathy")
14
+
15
+ # Development
16
+ logger = AuditLogger(log_dir="./logs", enable_console_logging=True)
17
+ ```
18
+
19
+ ## Log Events
20
+
21
+ ### LLM Request
22
+ ```python
23
+ logger.log_llm_request(
24
+ user_id="user@company.com",
25
+ empathy_level=3,
26
+ provider="anthropic",
27
+ model="claude-sonnet-4",
28
+ memory_sources=["enterprise", "user", "project"],
29
+ pii_count=0,
30
+ secrets_count=0
31
+ )
32
+ ```
33
+
34
+ ### Pattern Storage
35
+ ```python
36
+ logger.log_pattern_store(
37
+ user_id="user@company.com",
38
+ pattern_id="pattern_123",
39
+ pattern_type="architecture",
40
+ classification="INTERNAL", # PUBLIC, INTERNAL, or SENSITIVE
41
+ pii_scrubbed=2,
42
+ retention_days=180
43
+ )
44
+ ```
45
+
46
+ ### Pattern Retrieval
47
+ ```python
48
+ logger.log_pattern_retrieve(
49
+ user_id="user@company.com",
50
+ pattern_id="pattern_123",
51
+ classification="INTERNAL",
52
+ access_granted=True
53
+ )
54
+ ```
55
+
56
+ ### Security Violation
57
+ ```python
58
+ logger.log_security_violation(
59
+ user_id="user@company.com",
60
+ violation_type="secrets_detected",
61
+ severity="HIGH", # LOW, MEDIUM, HIGH, or CRITICAL
62
+ details={"secret_type": "api_key"},
63
+ blocked=True
64
+ )
65
+ ```
66
+
67
+ ## Query Logs
68
+
69
+ ### Basic Queries
70
+ ```python
71
+ # By event type
72
+ events = logger.query(event_type="llm_request")
73
+
74
+ # By user
75
+ events = logger.query(user_id="user@company.com")
76
+
77
+ # By status
78
+ events = logger.query(status="failed")
79
+ ```
80
+
81
+ ### Date Range
82
+ ```python
83
+ from datetime import datetime, timedelta
84
+
85
+ events = logger.query(
86
+ start_date=datetime.utcnow() - timedelta(days=7),
87
+ end_date=datetime.utcnow()
88
+ )
89
+ ```
90
+
91
+ ### Nested Filters
92
+ ```python
93
+ # Patterns with >5 PII items scrubbed
94
+ events = logger.query(
95
+ event_type="store_pattern",
96
+ security__pii_scrubbed__gt=5
97
+ )
98
+
99
+ # Failed requests with secrets
100
+ events = logger.query(
101
+ event_type="llm_request",
102
+ status="failed",
103
+ security__secrets_detected__gt=0
104
+ )
105
+ ```
106
+
107
+ ### Comparison Operators
108
+ - `__gt`: greater than
109
+ - `__gte`: greater than or equal
110
+ - `__lt`: less than
111
+ - `__lte`: less than or equal
112
+ - `__ne`: not equal
113
+
114
+ ## Reports
115
+
116
+ ### Violation Summary
117
+ ```python
118
+ summary = logger.get_violation_summary(user_id="user@company.com")
119
+ print(f"Total: {summary['total_violations']}")
120
+ print(f"By type: {summary['by_type']}")
121
+ print(f"By severity: {summary['by_severity']}")
122
+ ```
123
+
124
+ ### Compliance Report
125
+ ```python
126
+ report = logger.get_compliance_report(
127
+ start_date=datetime.utcnow() - timedelta(days=30)
128
+ )
129
+
130
+ print(f"LLM requests: {report['llm_requests']['total']}")
131
+ print(f"Pattern storage: {report['pattern_storage']['total']}")
132
+ print(f"GDPR compliance: {report['compliance_metrics']['gdpr_compliant_rate']:.2%}")
133
+ print(f"HIPAA compliance: {report['compliance_metrics']['hipaa_compliant_rate']:.2%}")
134
+ ```
135
+
136
+ ## Log Format
137
+
138
+ Each line in `audit.jsonl`:
139
+ ```json
140
+ {
141
+ "event_id": "evt_abc123",
142
+ "timestamp": "2025-11-24T19:03:08.114456Z",
143
+ "version": "1.0",
144
+ "event_type": "llm_request",
145
+ "user_id": "user@company.com",
146
+ "status": "success",
147
+ "llm": { "provider": "anthropic", "model": "claude-sonnet-4", "empathy_level": 3 },
148
+ "security": { "pii_detected": 0, "secrets_detected": 0 },
149
+ "compliance": { "gdpr_compliant": true, "hipaa_compliant": true }
150
+ }
151
+ ```
152
+
153
+ ## Configuration Options
154
+
155
+ ```python
156
+ AuditLogger(
157
+ log_dir="/var/log/empathy", # Log directory
158
+ log_filename="audit.jsonl", # Log file name
159
+ max_file_size_mb=100, # Max file size before rotation
160
+ retention_days=365, # Days to retain logs
161
+ enable_rotation=True, # Enable automatic rotation
162
+ enable_console_logging=False # Also log to console
163
+ )
164
+ ```
165
+
166
+ ## Common Patterns
167
+
168
+ ### Integration with EmpathyLLM
169
+ ```python
170
+ from attune_llm import EmpathyLLM
171
+
172
+ audit_logger = AuditLogger()
173
+ llm = EmpathyLLM(provider="anthropic")
174
+
175
+ async def interact_with_audit(user_id, user_input):
176
+ response = await llm.interact(user_id, user_input, {})
177
+
178
+ audit_logger.log_llm_request(
179
+ user_id=user_id,
180
+ empathy_level=response["empathy_level"],
181
+ provider="anthropic",
182
+ model="claude-sonnet-4",
183
+ memory_sources=["enterprise", "user"],
184
+ pii_count=0,
185
+ secrets_count=0
186
+ )
187
+
188
+ return response
189
+ ```
190
+
191
+ ### Daily Compliance Check
192
+ ```python
193
+ from datetime import datetime, timedelta
194
+
195
+ # Generate yesterday's report
196
+ report = logger.get_compliance_report(
197
+ start_date=datetime.utcnow() - timedelta(days=1)
198
+ )
199
+
200
+ # Alert if compliance drops
201
+ if report['compliance_metrics']['gdpr_compliant_rate'] < 0.95:
202
+ send_alert("GDPR compliance below 95%")
203
+ ```
204
+
205
+ ### Monitor Security Violations
206
+ ```python
207
+ # Check recent violations
208
+ violations = logger.query(
209
+ event_type="security_violation",
210
+ start_date=datetime.utcnow() - timedelta(hours=24)
211
+ )
212
+
213
+ # Alert on critical violations
214
+ for v in violations:
215
+ if v['violation']['severity'] == 'CRITICAL':
216
+ send_alert(f"Critical violation: {v['violation']['type']}")
217
+ ```
218
+
219
+ ## Event Types Reference
220
+
221
+ | Event Type | Purpose | Key Fields |
222
+ |------------|---------|------------|
223
+ | `llm_request` | LLM API calls | provider, model, empathy_level, pii_detected, secrets_detected |
224
+ | `store_pattern` | Pattern storage | pattern_id, classification, pii_scrubbed, encrypted |
225
+ | `retrieve_pattern` | Pattern access | pattern_id, classification, access_granted |
226
+ | `security_violation` | Policy violations | violation_type, severity, blocked |
227
+
228
+ ## Classification Levels
229
+
230
+ | Level | Use Case | Encryption | Retention |
231
+ |-------|----------|------------|-----------|
232
+ | `PUBLIC` | General patterns, shareable | No | 365 days |
233
+ | `INTERNAL` | Company confidential | Optional | 180 days |
234
+ | `SENSITIVE` | HIPAA/PCI-DSS data | Required | 90 days |
235
+
236
+ ## Compliance Mapping
237
+
238
+ | Standard | Requirement | Implementation |
239
+ |----------|-------------|----------------|
240
+ | **SOC2** CC7.2 | System Monitoring | Comprehensive audit logging |
241
+ | **HIPAA** §164.312(b) | Audit Controls | Tamper-evident logs |
242
+ | **GDPR** Art. 30 | Records of Processing | Complete audit trail |
243
+
244
+ ## Troubleshooting
245
+
246
+ ### Logs not being created
247
+ ```python
248
+ # Check directory permissions
249
+ import os
250
+ print(os.access("/var/log/empathy", os.W_OK))
251
+
252
+ # Use fallback directory
253
+ logger = AuditLogger(log_dir="./logs")
254
+ ```
255
+
256
+ ### Query not returning results
257
+ ```python
258
+ # Check log file exists
259
+ print(logger.log_path.exists())
260
+
261
+ # Check query filters
262
+ events = logger.query(limit=10) # Get first 10
263
+ print(f"Total events: {len(events)}")
264
+ ```
265
+
266
+ ### Performance issues
267
+ ```python
268
+ # Use date ranges to limit scan
269
+ events = logger.query(
270
+ start_date=datetime.utcnow() - timedelta(days=1),
271
+ limit=1000
272
+ )
273
+
274
+ # Enable rotation to prevent large files
275
+ logger = AuditLogger(
276
+ max_file_size_mb=50, # Smaller files
277
+ enable_rotation=True
278
+ )
279
+ ```
280
+
281
+ ## Testing
282
+
283
+ ```bash
284
+ # Run tests
285
+ cd attune_llm/security
286
+ python3 -m pytest test_audit_logger.py -v
287
+
288
+ # Run example
289
+ python3 audit_logger_example.py
290
+
291
+ # View logs
292
+ cat logs/audit.jsonl | jq '.'
293
+ ```
294
+
295
+ ## Security Best Practices
296
+
297
+ 1. **Never log actual PII or secrets** - only counts
298
+ 2. **Use restrictive permissions** - 0700 for directory, 0600 for files
299
+ 3. **Enable rotation** - prevent unlimited growth
300
+ 4. **Monitor violations** - alert on CRITICAL severity
301
+ 5. **Regular compliance reports** - daily or weekly
302
+ 6. **Retain logs appropriately** - 365 days for compliance
303
+ 7. **Back up logs** - store in secure, separate location
304
+
305
+ ## Support
306
+
307
+ - **Documentation**: `README.md`
308
+ - **Implementation Summary**: `IMPLEMENTATION_SUMMARY.md`
309
+ - **Architecture**: `../../SECURE_MEMORY_ARCHITECTURE.md`
310
+ - **Tests**: `test_audit_logger.py`
311
+ - **Example**: `audit_logger_example.py`
312
+
313
+ ---
314
+
315
+ **Version**: 1.0.0
316
+ **License**: Fair Source 0.9
@@ -0,0 +1,262 @@
1
+ # Security Module
2
+
3
+ Enterprise-grade security controls for the Empathy Framework, including secrets detection, PII scrubbing, audit logging, and data classification.
4
+
5
+ ## Phase 2: Secrets Detection (v1.8.0-beta) ✅
6
+
7
+ ### Overview
8
+
9
+ The `SecretsDetector` module provides comprehensive detection of hardcoded secrets, credentials, and sensitive data in code and configuration files. It's designed for enterprise privacy integration with:
10
+
11
+ - **20+ built-in patterns** for common secret types
12
+ - **Entropy analysis** for unknown high-entropy strings
13
+ - **Custom pattern support** for organization-specific secrets
14
+ - **Zero secret leakage**: Returns only metadata, never actual secret values
15
+ - **High performance**: Compiled regex patterns with early exit
16
+
17
+ ### Quick Start
18
+
19
+ ```python
20
+ from attune_llm.security import SecretsDetector
21
+
22
+ # Initialize detector
23
+ detector = SecretsDetector()
24
+
25
+ # Scan content for secrets
26
+ code = """
27
+ ANTHROPIC_API_KEY = "sk-ant-api03-abc123..."
28
+ password = "my_secret_pass"
29
+ """
30
+
31
+ detections = detector.detect(code)
32
+
33
+ for detection in detections:
34
+ print(f"Found {detection.secret_type.value} at line {detection.line_number}")
35
+ print(f" Severity: {detection.severity.value}")
36
+ print(f" Context: {detection.context_snippet}")
37
+ ```
38
+
39
+ ### Supported Secret Types
40
+
41
+ #### API Keys
42
+ - Anthropic API keys (`sk-ant-...`)
43
+ - OpenAI API keys (`sk-...`)
44
+ - AWS Access Keys (`AKIA...`)
45
+ - AWS Secret Keys
46
+ - GitHub tokens (`ghp_...`, `gho_...`, etc.)
47
+ - Slack tokens (`xox[abprs]-...`)
48
+ - Stripe keys (`sk_live_...`, `pk_live_...`)
49
+ - Generic API key patterns
50
+
51
+ #### Passwords
52
+ - Password assignments (`password = "..."`)
53
+ - Basic Auth credentials (base64 encoded)
54
+
55
+ #### Private Keys
56
+ - RSA private keys
57
+ - SSH private keys (OpenSSH format)
58
+ - EC (Elliptic Curve) private keys
59
+ - PGP private keys
60
+ - TLS/SSL certificate keys
61
+
62
+ #### Tokens
63
+ - JWT tokens (`eyJ...`)
64
+ - OAuth access tokens
65
+ - Bearer tokens
66
+
67
+ #### Database
68
+ - Database connection URLs (PostgreSQL, MySQL, MongoDB, Redis)
69
+ - Connection strings
70
+
71
+ #### High Entropy Strings
72
+ - Automatically detects random-looking strings (potential secrets)
73
+ - Configurable entropy threshold (default: 4.5)
74
+ - Minimum length requirement (default: 20 characters)
75
+
76
+ ### Advanced Features
77
+
78
+ #### Custom Patterns
79
+
80
+ Add organization-specific secret patterns:
81
+
82
+ ```python
83
+ detector = SecretsDetector()
84
+
85
+ # Add custom pattern
86
+ detector.add_custom_pattern(
87
+ name="acme_api_key",
88
+ pattern=r"acme_[a-zA-Z0-9]{32}",
89
+ severity="high"
90
+ )
91
+
92
+ # Detect with custom pattern
93
+ detections = detector.detect("acme_1234567890abcdefghijklmnopqrst")
94
+ ```
95
+
96
+ #### Entropy Analysis
97
+
98
+ Control high-entropy string detection:
99
+
100
+ ```python
101
+ detector = SecretsDetector(
102
+ enable_entropy_analysis=True,
103
+ entropy_threshold=4.5, # Shannon entropy threshold
104
+ min_entropy_length=20 # Minimum string length
105
+ )
106
+ ```
107
+
108
+ #### Detection Metadata
109
+
110
+ The `SecretDetection` object provides rich metadata without exposing secrets:
111
+
112
+ ```python
113
+ detection = detections[0]
114
+
115
+ print(detection.secret_type) # SecretType.ANTHROPIC_API_KEY
116
+ print(detection.severity) # Severity.HIGH
117
+ print(detection.line_number) # 3
118
+ print(detection.column_start) # 20
119
+ print(detection.column_end) # 95
120
+ print(detection.context_snippet) # "ANTHROPIC_API_KEY = [REDACTED]"
121
+ print(detection.confidence) # 1.0 (for pattern matches)
122
+ print(detection.metadata) # {"custom_pattern": "acme_api_key"}
123
+ ```
124
+
125
+ #### Statistics
126
+
127
+ Get detector configuration and pattern counts:
128
+
129
+ ```python
130
+ stats = detector.get_statistics()
131
+ print(stats)
132
+ # {
133
+ # "builtin_patterns": 20,
134
+ # "custom_patterns": 2,
135
+ # "total_patterns": 22,
136
+ # "entropy_analysis_enabled": True,
137
+ # "entropy_threshold": 4.5,
138
+ # "min_entropy_length": 20
139
+ # }
140
+ ```
141
+
142
+ ### Security Guarantees
143
+
144
+ 1. **No Secret Leakage**: The detector NEVER logs or returns actual secret values
145
+ 2. **Redaction**: Context snippets replace secrets with `[REDACTED]`
146
+ 3. **Metadata Only**: Detection objects contain only type, location, and severity
147
+ 4. **Audit Safe**: All outputs are safe to log without exposing credentials
148
+
149
+ ### Performance
150
+
151
+ - **Compiled Patterns**: All regex patterns are pre-compiled for speed
152
+ - **Early Exit**: Detection stops on first match for each pattern
153
+ - **Large Files**: Tested with 10,000+ line files (completes < 5 seconds)
154
+ - **Efficient Entropy**: Entropy analysis only runs on quoted strings
155
+
156
+ ### Integration Example
157
+
158
+ ```python
159
+ from attune_llm.security import SecretsDetector
160
+
161
+ def scan_file(file_path: str) -> bool:
162
+ """
163
+ Scan a file for secrets.
164
+
165
+ Returns:
166
+ True if no secrets found, False otherwise
167
+ """
168
+ detector = SecretsDetector()
169
+
170
+ with open(file_path, 'r') as f:
171
+ content = f.read()
172
+
173
+ detections = detector.detect(content)
174
+
175
+ if detections:
176
+ print(f"⚠️ Found {len(detections)} secrets in {file_path}")
177
+
178
+ for d in detections:
179
+ print(f" - {d.secret_type.value} (Line {d.line_number})")
180
+ print(f" Severity: {d.severity.value}")
181
+ print(f" Context: {d.context_snippet}")
182
+
183
+ return False
184
+
185
+ print(f"✓ No secrets found in {file_path}")
186
+ return True
187
+ ```
188
+
189
+ ### Testing
190
+
191
+ Comprehensive test suite with 28 tests covering:
192
+ - All secret type detections
193
+ - Custom pattern support
194
+ - Entropy analysis
195
+ - Secret redaction
196
+ - Edge cases and error handling
197
+ - Performance benchmarks
198
+
199
+ Run tests:
200
+ ```bash
201
+ pytest attune_llm/security/test_secrets_detector.py -v
202
+ ```
203
+
204
+ ### Compliance
205
+
206
+ This module supports enterprise compliance requirements:
207
+
208
+ - **OWASP Top 10 A02:2021**: Cryptographic Failures (secret detection)
209
+ - **GDPR Article 32**: Security of processing (protect credentials)
210
+ - **SOC2 CC6.1**: Logical access controls (prevent hardcoded secrets)
211
+ - **HIPAA §164.312(a)(1)**: Access control (credential management)
212
+
213
+ ### Architecture
214
+
215
+ ```
216
+ SecretsDetector
217
+ ├── Built-in Patterns (20+)
218
+ │ ├── API Keys (Anthropic, OpenAI, AWS, GitHub, Slack, Stripe)
219
+ │ ├── Passwords (various assignment patterns)
220
+ │ ├── Private Keys (RSA, SSH, EC, PGP, TLS)
221
+ │ ├── Tokens (JWT, OAuth, Bearer)
222
+ │ └── Database (connection strings, URLs)
223
+ ├── Custom Patterns
224
+ │ └── Organization-specific patterns
225
+ ├── Entropy Analysis
226
+ │ ├── Shannon entropy calculation
227
+ │ ├── Configurable threshold
228
+ │ └── Overlap filtering
229
+ └── Detection Output
230
+ ├── SecretType enum
231
+ ├── Severity enum (CRITICAL, HIGH, MEDIUM, LOW)
232
+ └── SecretDetection dataclass
233
+ ```
234
+
235
+ ### Future Enhancements
236
+
237
+ Planned for Phase 3 (v1.8.0):
238
+ - Integration with CI/CD pipelines (pre-commit hooks)
239
+ - Git history scanning
240
+ - Secret redaction/replacement utilities
241
+ - Real-time monitoring with alerting
242
+ - Integration with secret management systems (HashiCorp Vault, AWS Secrets Manager)
243
+
244
+ ### References
245
+
246
+ - [OWASP Secrets Management](https://owasp.org/www-community/vulnerabilities/Use_of_hard-coded_password)
247
+ - [GitHub Secret Scanning](https://docs.github.com/en/code-security/secret-scanning)
248
+ - [SECURE_MEMORY_ARCHITECTURE.md](../../../SECURE_MEMORY_ARCHITECTURE.md)
249
+ - [Enterprise Security Policy](../../../examples/claude_memory/enterprise-CLAUDE-secure.md)
250
+
251
+ ### Support
252
+
253
+ For questions or issues:
254
+ - File an issue on GitHub
255
+ - Contact the Empathy Framework team
256
+ - See main documentation at `attune_llm/README.md`
257
+
258
+ ---
259
+
260
+ **Author**: Empathy Framework Team
261
+ **Version**: 1.8.0-beta
262
+ **License**: Fair Source 0.9
@@ -0,0 +1,62 @@
1
+ """Security Module for Empathy Framework
2
+
3
+ DEPRECATED: This module re-exports from attune.memory.security
4
+ Use `from attune.memory.security import ...` instead.
5
+
6
+ Provides enterprise-grade security controls including:
7
+ - PII scrubbing (GDPR, HIPAA, SOC2 compliant)
8
+ - Secrets detection (API keys, passwords, private keys)
9
+ - Audit logging (tamper-evident, SOC2/HIPAA compliant)
10
+ - Secure MemDocs integration with encryption
11
+
12
+ Author: Empathy Framework Team
13
+ Version: 2.0.0 (consolidated into attune.memory)
14
+ License: Fair Source 0.9
15
+ """
16
+
17
+ # Re-export from consolidated memory module for backwards compatibility
18
+ from attune.memory.long_term import (
19
+ Classification,
20
+ ClassificationRules,
21
+ EncryptionManager,
22
+ PatternMetadata,
23
+ SecureMemDocsIntegration,
24
+ SecurityError,
25
+ )
26
+ from attune.memory.security import (
27
+ AuditEvent,
28
+ AuditLogger,
29
+ PIIDetection,
30
+ PIIPattern,
31
+ PIIScrubber,
32
+ SecretDetection,
33
+ SecretsDetector,
34
+ SecretType,
35
+ SecurityViolation,
36
+ Severity,
37
+ detect_secrets,
38
+ )
39
+
40
+ __all__ = [
41
+ "AuditEvent",
42
+ # Audit Logging
43
+ "AuditLogger",
44
+ "Classification",
45
+ "ClassificationRules",
46
+ "EncryptionManager",
47
+ "PIIDetection",
48
+ "PIIPattern",
49
+ # PII Scrubbing
50
+ "PIIScrubber",
51
+ "PatternMetadata",
52
+ "SecretDetection",
53
+ "SecretType",
54
+ # Secrets Detection
55
+ "SecretsDetector",
56
+ # Secure MemDocs Integration
57
+ "SecureMemDocsIntegration",
58
+ "SecurityError",
59
+ "SecurityViolation",
60
+ "Severity",
61
+ "detect_secrets",
62
+ ]