pulse-os 10.0.0__tar.gz

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 (401) hide show
  1. pulse_os-10.0.0/.claude/CLAUDE.md +67 -0
  2. pulse_os-10.0.0/.cursor/skills/Architecture/ABSTRACTION_ALCHEMIST.md +91 -0
  3. pulse_os-10.0.0/.cursor/skills/Architecture/ARCHITECT.md +26 -0
  4. pulse_os-10.0.0/.cursor/skills/Architecture/COMPLEXITY_CRUSHER.md +78 -0
  5. pulse_os-10.0.0/.cursor/skills/Architecture/DATABASE_WHISPERER.md +79 -0
  6. pulse_os-10.0.0/.cursor/skills/Architecture/KAFKA_MAGE.md +56 -0
  7. pulse_os-10.0.0/.cursor/skills/Architecture/MASTER_ARCHITECT.md +59 -0
  8. pulse_os-10.0.0/.cursor/skills/Architecture/NETWORK_NOMAD.md +79 -0
  9. pulse_os-10.0.0/.cursor/skills/Architecture/SYSTEM_HARMONIZER.md +60 -0
  10. pulse_os-10.0.0/.cursor/skills/Architecture/UI_ALCHEMIST.md +60 -0
  11. pulse_os-10.0.0/.cursor/skills/Architecture/UX_PSYCHOLOGIST.md +60 -0
  12. pulse_os-10.0.0/.cursor/skills/Development/API_GURU.md +69 -0
  13. pulse_os-10.0.0/.cursor/skills/Development/BOILERPLATE_PURGE.md +57 -0
  14. pulse_os-10.0.0/.cursor/skills/Development/CI_CD_COMMANDER.md +68 -0
  15. pulse_os-10.0.0/.cursor/skills/Development/CODE_ARCHEOLOGIST.md +62 -0
  16. pulse_os-10.0.0/.cursor/skills/Development/CODE_VANGUARD.md +67 -0
  17. pulse_os-10.0.0/.cursor/skills/Development/DOCKER_DRILL.md +57 -0
  18. pulse_os-10.0.0/.cursor/skills/Development/ERROR_RECOVERY.md +59 -0
  19. pulse_os-10.0.0/.cursor/skills/Development/REFACTOR_DRUID.md +64 -0
  20. pulse_os-10.0.0/.cursor/skills/Development/TEST_DRIVEN.md +60 -0
  21. pulse_os-10.0.0/.cursor/skills/Development/TEST_STRATEGIST.md +64 -0
  22. pulse_os-10.0.0/.cursor/skills/Development/TYPE_TITAN.md +65 -0
  23. pulse_os-10.0.0/.cursor/skills/GIT_PRACTICES/AUDIT_REPORT.md +45 -0
  24. pulse_os-10.0.0/.cursor/skills/GIT_PRACTICES/COMMIT_ALCHEMIST.md +36 -0
  25. pulse_os-10.0.0/.cursor/skills/GIT_PRACTICES/CONFLICT_MAGE.md +37 -0
  26. pulse_os-10.0.0/.cursor/skills/GIT_PRACTICES/ENTERPRISE_FLOW.md +33 -0
  27. pulse_os-10.0.0/.cursor/skills/GIT_PRACTICES/GIT_SENTINEL.md +36 -0
  28. pulse_os-10.0.0/.cursor/skills/GIT_PRACTICES/REPO_MAINTAINER.md +34 -0
  29. pulse_os-10.0.0/.cursor/skills/General/AI_NEUROLOGIST.md +57 -0
  30. pulse_os-10.0.0/.cursor/skills/General/CLOUD_CATALYST.md +69 -0
  31. pulse_os-10.0.0/.cursor/skills/General/CONSTITUTIONAL_CLARITY.md +64 -0
  32. pulse_os-10.0.0/.cursor/skills/General/DATA_DYNAMO.md +60 -0
  33. pulse_os-10.0.0/.cursor/skills/General/DEBUG_WARLORD.md +28 -0
  34. pulse_os-10.0.0/.cursor/skills/General/DOCU_FORGE.md +23 -0
  35. pulse_os-10.0.0/.cursor/skills/General/DOC_QUALITY.md +67 -0
  36. pulse_os-10.0.0/.cursor/skills/General/GIT_SENTINEL.md +25 -0
  37. pulse_os-10.0.0/.cursor/skills/General/INNOVATION_IGNITER.md +57 -0
  38. pulse_os-10.0.0/.cursor/skills/General/LATENCY_LAYER.md +22 -0
  39. pulse_os-10.0.0/.cursor/skills/General/LOGIC_LANCE.md +63 -0
  40. pulse_os-10.0.0/.cursor/skills/General/LOG_LEGIONNAIRE.md +62 -0
  41. pulse_os-10.0.0/.cursor/skills/General/PATTERN_PIONEER.md +71 -0
  42. pulse_os-10.0.0/.cursor/skills/General/QUALITY_QUORUM.md +60 -0
  43. pulse_os-10.0.0/.cursor/skills/General/REASONING_REFINER.md +61 -0
  44. pulse_os-10.0.0/.cursor/skills/General/SHELL_SORCERER.md +22 -0
  45. pulse_os-10.0.0/.cursor/skills/General/SPEED_V2.md +58 -0
  46. pulse_os-10.0.0/.cursor/skills/General/STRATEGIST.md +62 -0
  47. pulse_os-10.0.0/.cursor/skills/General/SUPEREGO_ENFORCER.md +37 -0
  48. pulse_os-10.0.0/.cursor/skills/General/TOKEN_VAULT.md +34 -0
  49. pulse_os-10.0.0/.cursor/skills/Orchestration/BRAIN_NAVIGATOR.md +56 -0
  50. pulse_os-10.0.0/.cursor/skills/Orchestration/CONTEXT_COMMANDER.md +60 -0
  51. pulse_os-10.0.0/.cursor/skills/Orchestration/COST_OPTIMIZER.md +51 -0
  52. pulse_os-10.0.0/.cursor/skills/Orchestration/MEMORY_MINER.md +60 -0
  53. pulse_os-10.0.0/.cursor/skills/Orchestration/META_LEARNER.md +56 -0
  54. pulse_os-10.0.0/.cursor/skills/Orchestration/ORCHESTRATOR.md +29 -0
  55. pulse_os-10.0.0/.cursor/skills/Orchestration/SKILL_NAVIGATOR.md +66 -0
  56. pulse_os-10.0.0/.cursor/skills/Orchestration/SWARM_SOVEREIGN.md +69 -0
  57. pulse_os-10.0.0/.cursor/skills/Security/ADVERSARIAL_TESTER.md +70 -0
  58. pulse_os-10.0.0/.cursor/skills/Security/AUDITOR.md +21 -0
  59. pulse_os-10.0.0/.cursor/skills/Security/BYZANTINE_SENTINEL.md +39 -0
  60. pulse_os-10.0.0/.cursor/skills/Security/LINT_LEXICON.md +72 -0
  61. pulse_os-10.0.0/.cursor/skills/Security/PROTOCOL_POLICEMAN.md +60 -0
  62. pulse_os-10.0.0/.cursor/skills/Security/SECURITY_STRESS_TESTER.md +76 -0
  63. pulse_os-10.0.0/.cursor/skills/Security/SECURITY_VANGUARD.md +25 -0
  64. pulse_os-10.0.0/.cursor/skills/Security/ZERO_TRUST.md +22 -0
  65. pulse_os-10.0.0/.env.example +51 -0
  66. pulse_os-10.0.0/.gemini/hooks/brain_hook.py +21 -0
  67. pulse_os-10.0.0/.gemini/settings.json +18 -0
  68. pulse_os-10.0.0/.github/ISSUE_TEMPLATE/bug_report.md +34 -0
  69. pulse_os-10.0.0/.github/ISSUE_TEMPLATE/feature_request.md +17 -0
  70. pulse_os-10.0.0/.github/workflows/publish.yml +149 -0
  71. pulse_os-10.0.0/.github/workflows/pulse-quality.yml +34 -0
  72. pulse_os-10.0.0/.gitignore +93 -0
  73. pulse_os-10.0.0/CONTRIBUTING.md +32 -0
  74. pulse_os-10.0.0/CONTRIBUTORS.md +36 -0
  75. pulse_os-10.0.0/Corpus_Callosum/Archive/ARCHITECTURE.md +157 -0
  76. pulse_os-10.0.0/Corpus_Callosum/Archive/BRAIN_AUDIT_REPORT.md +76 -0
  77. pulse_os-10.0.0/Corpus_Callosum/Archive/BRAIN_IMPLEMENTATION_SUMMARY.md +72 -0
  78. pulse_os-10.0.0/Corpus_Callosum/Archive/BRAIN_SEARCH_IMPLEMENTATION.md +122 -0
  79. pulse_os-10.0.0/Corpus_Callosum/Archive/CHANGELOG.md +47 -0
  80. pulse_os-10.0.0/Corpus_Callosum/Archive/LAWS.md +126 -0
  81. pulse_os-10.0.0/Corpus_Callosum/Archive/MEMORY_ANALYSIS.md +241 -0
  82. pulse_os-10.0.0/Corpus_Callosum/Archive/TITAN_LAWS.md +36 -0
  83. pulse_os-10.0.0/Corpus_Callosum/Archive/agent_transparency.md +31 -0
  84. pulse_os-10.0.0/Corpus_Callosum/Archive/audit_results.md +38 -0
  85. pulse_os-10.0.0/Corpus_Callosum/Archive/enforcement_protocol.md +49 -0
  86. pulse_os-10.0.0/Corpus_Callosum/Archive/governance_overview.md +41 -0
  87. pulse_os-10.0.0/Corpus_Callosum/Archive/laws_1_3.md +37 -0
  88. pulse_os-10.0.0/Corpus_Callosum/Archive/laws_4_6.md +33 -0
  89. pulse_os-10.0.0/Corpus_Callosum/Archive/laws_7_9.md +34 -0
  90. pulse_os-10.0.0/Corpus_Callosum/Archive/pii_detection.json +10 -0
  91. pulse_os-10.0.0/Corpus_Callosum/Archive/rule_audit_process.md +32 -0
  92. pulse_os-10.0.0/Corpus_Callosum/Archive/transparency_examples.md +29 -0
  93. pulse_os-10.0.0/Corpus_Callosum/Archive/transparency_logic.md +36 -0
  94. pulse_os-10.0.0/Corpus_Callosum/Archive/transparency_templates.md +52 -0
  95. pulse_os-10.0.0/Corpus_Callosum/Archive/uncertainty_procedures.md +68 -0
  96. pulse_os-10.0.0/Corpus_Callosum/Archive/violation_handling.md +55 -0
  97. pulse_os-10.0.0/Corpus_Callosum/CONSTITUTION.md +103 -0
  98. pulse_os-10.0.0/Corpus_Callosum/GOVERNANCE_MAP.md +49 -0
  99. pulse_os-10.0.0/Corpus_Callosum/Protocols/AGENT_CACHE_PROTOCOL.md +96 -0
  100. pulse_os-10.0.0/Corpus_Callosum/Protocols/ASOP.md +112 -0
  101. pulse_os-10.0.0/Corpus_Callosum/Protocols/BENCHMARK_SYSTEM.md +123 -0
  102. pulse_os-10.0.0/Corpus_Callosum/Protocols/HOOKS.md +150 -0
  103. pulse_os-10.0.0/Corpus_Callosum/Protocols/WORKFLOW.md +117 -0
  104. pulse_os-10.0.0/Dockerfile +26 -0
  105. pulse_os-10.0.0/LICENSE +80 -0
  106. pulse_os-10.0.0/PKG-INFO +526 -0
  107. pulse_os-10.0.0/PULSE_OS.md +55 -0
  108. pulse_os-10.0.0/Prefrontal_Cortex/Action_Queue/task_board.json +55382 -0
  109. pulse_os-10.0.0/README.md +492 -0
  110. pulse_os-10.0.0/SECURITY.md +233 -0
  111. pulse_os-10.0.0/SESSION.md +10 -0
  112. pulse_os-10.0.0/docker-compose.yml +30 -0
  113. pulse_os-10.0.0/docs/GITHUB_SETUP.md +25 -0
  114. pulse_os-10.0.0/docs/MODEL_GUIDE.md +108 -0
  115. pulse_os-10.0.0/docs/SWARM_QUICKSTART.md +83 -0
  116. pulse_os-10.0.0/install_pulse_path.ps1 +20 -0
  117. pulse_os-10.0.0/pulse/__init__.py +3 -0
  118. pulse_os-10.0.0/pulse/__main__.py +4 -0
  119. pulse_os-10.0.0/pulse/admin/__init__.py +1 -0
  120. pulse_os-10.0.0/pulse/admin/agent_logs_aggregator.py +253 -0
  121. pulse_os-10.0.0/pulse/admin/audit/__init__.py +1 -0
  122. pulse_os-10.0.0/pulse/admin/audit/brain_validators.py +310 -0
  123. pulse_os-10.0.0/pulse/admin/audit/conflict_resolver.py +222 -0
  124. pulse_os-10.0.0/pulse/admin/audit/metacognitive_audit.py +267 -0
  125. pulse_os-10.0.0/pulse/admin/audit/soc_checker.py +265 -0
  126. pulse_os-10.0.0/pulse/admin/benchmarks/__init__.py +1 -0
  127. pulse_os-10.0.0/pulse/admin/benchmarks/benchmark_synthesizer.py +223 -0
  128. pulse_os-10.0.0/pulse/admin/benchmarks/benchmark_tracker.py +273 -0
  129. pulse_os-10.0.0/pulse/admin/benchmarks/performance_profiler.py +171 -0
  130. pulse_os-10.0.0/pulse/admin/brain_ops/__init__.py +1 -0
  131. pulse_os-10.0.0/pulse/admin/brain_ops/brain_cleanse.py +46 -0
  132. pulse_os-10.0.0/pulse/admin/brain_ops/brain_recommender.py +208 -0
  133. pulse_os-10.0.0/pulse/admin/brain_ops/growth_monitor.py +220 -0
  134. pulse_os-10.0.0/pulse/admin/brain_ops/private_synthesis.py +179 -0
  135. pulse_os-10.0.0/pulse/admin/brain_ops/pulse_prune.py +113 -0
  136. pulse_os-10.0.0/pulse/admin/brain_ops/purge_prompt_echoes.py +165 -0
  137. pulse_os-10.0.0/pulse/admin/brain_ops/refactor_evidence.py +228 -0
  138. pulse_os-10.0.0/pulse/admin/brain_ops/synthesizer.py +260 -0
  139. pulse_os-10.0.0/pulse/admin/patterns/__init__.py +1 -0
  140. pulse_os-10.0.0/pulse/admin/patterns/anti_pattern_builder.py +214 -0
  141. pulse_os-10.0.0/pulse/admin/patterns/anti_pattern_similarity.py +235 -0
  142. pulse_os-10.0.0/pulse/admin/procedural_tracker.py +294 -0
  143. pulse_os-10.0.0/pulse/admin/pulse_consensus.py +203 -0
  144. pulse_os-10.0.0/pulse/admin/pulse_transaction.py +110 -0
  145. pulse_os-10.0.0/pulse/admin/retroactive/__init__.py +1 -0
  146. pulse_os-10.0.0/pulse/admin/retroactive/_clean_wants.py +26 -0
  147. pulse_os-10.0.0/pulse/admin/retroactive/backfill_session_descriptions.py +240 -0
  148. pulse_os-10.0.0/pulse/admin/retroactive/clean_intents_batch1.py +209 -0
  149. pulse_os-10.0.0/pulse/admin/retroactive/finish_batches.py +88 -0
  150. pulse_os-10.0.0/pulse/admin/retroactive/prompt_echo_filter.py +54 -0
  151. pulse_os-10.0.0/pulse/admin/retroactive/retroactive_intents_cleaner.py +180 -0
  152. pulse_os-10.0.0/pulse/admin/retroactive/retroactive_llm_extractor.py +286 -0
  153. pulse_os-10.0.0/pulse/admin/retroactive/retroactive_sign.py +55 -0
  154. pulse_os-10.0.0/pulse/admin/setup/__init__.py +1 -0
  155. pulse_os-10.0.0/pulse/admin/setup/generate_admin_keys.py +92 -0
  156. pulse_os-10.0.0/pulse/admin/setup/generate_anchors.py +216 -0
  157. pulse_os-10.0.0/pulse/admin/setup/generate_registry.py +183 -0
  158. pulse_os-10.0.0/pulse/admin/setup/hippocampus_wiring.py +64 -0
  159. pulse_os-10.0.0/pulse/admin/setup/pulse_scaffold.py +138 -0
  160. pulse_os-10.0.0/pulse/admin/setup/seal_env.py +75 -0
  161. pulse_os-10.0.0/pulse/admin/setup/update_constitution_hash.py +71 -0
  162. pulse_os-10.0.0/pulse/admin/skills/__init__.py +1 -0
  163. pulse_os-10.0.0/pulse/admin/skills/skill_effectiveness.py +158 -0
  164. pulse_os-10.0.0/pulse/admin/skills/skill_recommender.py +213 -0
  165. pulse_os-10.0.0/pulse/admin/skills/wire_skills.py +53 -0
  166. pulse_os-10.0.0/pulse/admin/tool_dependency_graph.py +180 -0
  167. pulse_os-10.0.0/pulse/agents/__init__.py +1 -0
  168. pulse_os-10.0.0/pulse/agents/interactive_chat.py +171 -0
  169. pulse_os-10.0.0/pulse/agents/pulse_claude.py +232 -0
  170. pulse_os-10.0.0/pulse/agents/pulse_codex.py +219 -0
  171. pulse_os-10.0.0/pulse/agents/pulse_gemini.py +207 -0
  172. pulse_os-10.0.0/pulse/agents/pulse_grok.py +58 -0
  173. pulse_os-10.0.0/pulse/agents/pulse_wrapper.py +257 -0
  174. pulse_os-10.0.0/pulse/agents/wrapper_capture.py +75 -0
  175. pulse_os-10.0.0/pulse/agents/wrapper_context.py +269 -0
  176. pulse_os-10.0.0/pulse/agents/wrapper_orchestrator.py +76 -0
  177. pulse_os-10.0.0/pulse/agents/wrapper_skills.py +159 -0
  178. pulse_os-10.0.0/pulse/api/__init__.py +1 -0
  179. pulse_os-10.0.0/pulse/api/pulse_api.py +273 -0
  180. pulse_os-10.0.0/pulse/api/pulse_api_agents.py +269 -0
  181. pulse_os-10.0.0/pulse/api/pulse_api_brain.py +179 -0
  182. pulse_os-10.0.0/pulse/api/pulse_api_license.py +145 -0
  183. pulse_os-10.0.0/pulse/api/pulse_api_system.py +209 -0
  184. pulse_os-10.0.0/pulse/api/pulse_coordinator.py +87 -0
  185. pulse_os-10.0.0/pulse/brain/__init__.py +1 -0
  186. pulse_os-10.0.0/pulse/brain/agent_procedures.py +256 -0
  187. pulse_os-10.0.0/pulse/brain/auto_capture.py +230 -0
  188. pulse_os-10.0.0/pulse/brain/boot/__init__.py +4 -0
  189. pulse_os-10.0.0/pulse/brain/boot/formatters.py +143 -0
  190. pulse_os-10.0.0/pulse/brain/boot/loaders.py +225 -0
  191. pulse_os-10.0.0/pulse/brain/boot_briefing.py +13 -0
  192. pulse_os-10.0.0/pulse/brain/boot_formatting.py +227 -0
  193. pulse_os-10.0.0/pulse/brain/boot_tasks.py +113 -0
  194. pulse_os-10.0.0/pulse/brain/brain_query.py +296 -0
  195. pulse_os-10.0.0/pulse/brain/brain_search.py +205 -0
  196. pulse_os-10.0.0/pulse/brain/capture_routing.py +293 -0
  197. pulse_os-10.0.0/pulse/brain/compliance_tracker.py +104 -0
  198. pulse_os-10.0.0/pulse/brain/cross_agent.py +56 -0
  199. pulse_os-10.0.0/pulse/brain/graph_rag_extractor.py +44 -0
  200. pulse_os-10.0.0/pulse/brain/pulse_boot.py +207 -0
  201. pulse_os-10.0.0/pulse/brain/pulse_save.py +294 -0
  202. pulse_os-10.0.0/pulse/brain/query_search.py +169 -0
  203. pulse_os-10.0.0/pulse/brain/rule_embeddings.py +261 -0
  204. pulse_os-10.0.0/pulse/brain/save_knowledge_ops.py +224 -0
  205. pulse_os-10.0.0/pulse/brain/save_writers.py +369 -0
  206. pulse_os-10.0.0/pulse/brain/search_index.py +239 -0
  207. pulse_os-10.0.0/pulse/brain/search_sources.py +31 -0
  208. pulse_os-10.0.0/pulse/brain/search_sources_core.py +187 -0
  209. pulse_os-10.0.0/pulse/brain/search_sources_ext.py +250 -0
  210. pulse_os-10.0.0/pulse/brain/search_utils.py +90 -0
  211. pulse_os-10.0.0/pulse/brain/wants_classify.py +162 -0
  212. pulse_os-10.0.0/pulse/brain/wants_parser.py +233 -0
  213. pulse_os-10.0.0/pulse/browser/core.py +69 -0
  214. pulse_os-10.0.0/pulse/cli/__init__.py +6 -0
  215. pulse_os-10.0.0/pulse/cli/autopilot/__init__.py +4 -0
  216. pulse_os-10.0.0/pulse/cli/autopilot/context.py +81 -0
  217. pulse_os-10.0.0/pulse/cli/autopilot/gates.py +78 -0
  218. pulse_os-10.0.0/pulse/cli/autopilot/loop.py +201 -0
  219. pulse_os-10.0.0/pulse/cli/cmd_agent.py +159 -0
  220. pulse_os-10.0.0/pulse/cli/cmd_costs.py +121 -0
  221. pulse_os-10.0.0/pulse/cli/cmd_license.py +87 -0
  222. pulse_os-10.0.0/pulse/cli/cmd_manage_data.py +118 -0
  223. pulse_os-10.0.0/pulse/cli/cmd_manage_lifecycle.py +189 -0
  224. pulse_os-10.0.0/pulse/cli/cmd_proposals.py +298 -0
  225. pulse_os-10.0.0/pulse/cli/cmd_swarm.py +280 -0
  226. pulse_os-10.0.0/pulse/cli/main.py +261 -0
  227. pulse_os-10.0.0/pulse/cli/ollama_launch.py +88 -0
  228. pulse_os-10.0.0/pulse/cli/status/__init__.py +6 -0
  229. pulse_os-10.0.0/pulse/cli/status/cmd_brain.py +72 -0
  230. pulse_os-10.0.0/pulse/cli/status/cmd_status.py +298 -0
  231. pulse_os-10.0.0/pulse/cli/status/cmd_watch.py +23 -0
  232. pulse_os-10.0.0/pulse/cli/swarm_providers.py +194 -0
  233. pulse_os-10.0.0/pulse/cli/swarm_workers.py +275 -0
  234. pulse_os-10.0.0/pulse/config/_router.md +10 -0
  235. pulse_os-10.0.0/pulse/config/brain_config.json +72 -0
  236. pulse_os-10.0.0/pulse/config/brain_manifest.json +32 -0
  237. pulse_os-10.0.0/pulse/config/knowledge_anchors.json +97655 -0
  238. pulse_os-10.0.0/pulse/config/pulse_daemon.json +16 -0
  239. pulse_os-10.0.0/pulse/core/__init__.py +1 -0
  240. pulse_os-10.0.0/pulse/core/brain_analysis.py +140 -0
  241. pulse_os-10.0.0/pulse/core/brain_io.py +180 -0
  242. pulse_os-10.0.0/pulse/core/brain_utils.py +252 -0
  243. pulse_os-10.0.0/pulse/core/config.py +169 -0
  244. pulse_os-10.0.0/pulse/core/license.py +201 -0
  245. pulse_os-10.0.0/pulse/core/llm_router.py +253 -0
  246. pulse_os-10.0.0/pulse/core/paths.py +341 -0
  247. pulse_os-10.0.0/pulse/core/pii_filter.py +147 -0
  248. pulse_os-10.0.0/pulse/core/provider_state.py +68 -0
  249. pulse_os-10.0.0/pulse/core/pulse_client.py +112 -0
  250. pulse_os-10.0.0/pulse/core/pulse_crdt.py +77 -0
  251. pulse_os-10.0.0/pulse/core/pulse_crypto.py +194 -0
  252. pulse_os-10.0.0/pulse/core/user_profile.py +92 -0
  253. pulse_os-10.0.0/pulse/daemons/__init__.py +1 -0
  254. pulse_os-10.0.0/pulse/daemons/bridge/__init__.py +1 -0
  255. pulse_os-10.0.0/pulse/daemons/bridge/bridge_routing.py +185 -0
  256. pulse_os-10.0.0/pulse/daemons/bridge/intent_daemon.py +277 -0
  257. pulse_os-10.0.0/pulse/daemons/bridge/memory_dispatcher.py +194 -0
  258. pulse_os-10.0.0/pulse/daemons/bridge/pulse_bridge.py +237 -0
  259. pulse_os-10.0.0/pulse/daemons/bridge/reflex_arc.py +153 -0
  260. pulse_os-10.0.0/pulse/daemons/bridge/reflex_llm.py +486 -0
  261. pulse_os-10.0.0/pulse/daemons/compliance_validator.py +212 -0
  262. pulse_os-10.0.0/pulse/daemons/consolidation/__init__.py +1 -0
  263. pulse_os-10.0.0/pulse/daemons/consolidation/consolidation_daemon.py +170 -0
  264. pulse_os-10.0.0/pulse/daemons/consolidation/consolidation_helpers.py +32 -0
  265. pulse_os-10.0.0/pulse/daemons/consolidation/consolidation_mining.py +277 -0
  266. pulse_os-10.0.0/pulse/daemons/consolidation/consolidation_promotion.py +123 -0
  267. pulse_os-10.0.0/pulse/daemons/consolidation/consolidation_stages.py +464 -0
  268. pulse_os-10.0.0/pulse/daemons/neural/__init__.py +1 -0
  269. pulse_os-10.0.0/pulse/daemons/neural/drift_detector.py +281 -0
  270. pulse_os-10.0.0/pulse/daemons/neural/gate_feedback.py +280 -0
  271. pulse_os-10.0.0/pulse/daemons/neural/neural_render.py +256 -0
  272. pulse_os-10.0.0/pulse/daemons/neural/prediction_daemon.py +263 -0
  273. pulse_os-10.0.0/pulse/daemons/neural/prediction_feedback.py +184 -0
  274. pulse_os-10.0.0/pulse/daemons/neural/pulse_neural.py +122 -0
  275. pulse_os-10.0.0/pulse/daemons/orchestrator.py +300 -0
  276. pulse_os-10.0.0/pulse/daemons/orchestrator_schedulers.py +165 -0
  277. pulse_os-10.0.0/pulse/daemons/orchestrator_security.py +239 -0
  278. pulse_os-10.0.0/pulse/daemons/pulse_dashboard.py +229 -0
  279. pulse_os-10.0.0/pulse/daemons/safety_check.py +86 -0
  280. pulse_os-10.0.0/pulse/daemons/synthesis/__init__.py +1 -0
  281. pulse_os-10.0.0/pulse/daemons/synthesis/agent_procedure_synthesizer.py +158 -0
  282. pulse_os-10.0.0/pulse/daemons/synthesis/agent_synth_pipeline.py +271 -0
  283. pulse_os-10.0.0/pulse/daemons/synthesis/brain_healer.py +150 -0
  284. pulse_os-10.0.0/pulse/daemons/synthesis/causal_claim_recovery.py +290 -0
  285. pulse_os-10.0.0/pulse/daemons/synthesis/constraint_engine.py +264 -0
  286. pulse_os-10.0.0/pulse/daemons/synthesis/crew_composer.py +299 -0
  287. pulse_os-10.0.0/pulse/daemons/synthesis/dmn_daemon.py +299 -0
  288. pulse_os-10.0.0/pulse/daemons/synthesis/epistemic_forager.py +276 -0
  289. pulse_os-10.0.0/pulse/daemons/synthesis/epistemic_search.py +94 -0
  290. pulse_os-10.0.0/pulse/daemons/synthesis/ghost_resonance.py +300 -0
  291. pulse_os-10.0.0/pulse/daemons/synthesis/hebbian_balancer.py +271 -0
  292. pulse_os-10.0.0/pulse/daemons/synthesis/homeostatic_scheduler.py +300 -0
  293. pulse_os-10.0.0/pulse/daemons/synthesis/pathweaver.py +206 -0
  294. pulse_os-10.0.0/pulse/daemons/synthesis/pathweaver_mining.py +283 -0
  295. pulse_os-10.0.0/pulse/daemons/synthesis/procedural_sleep_healer.py +299 -0
  296. pulse_os-10.0.0/pulse/daemons/synthesis/procedure_daemon.py +267 -0
  297. pulse_os-10.0.0/pulse/daemons/synthesis/profile_distiller.py +116 -0
  298. pulse_os-10.0.0/pulse/daemons/synthesis/pulse_dedup.py +300 -0
  299. pulse_os-10.0.0/pulse/daemons/synthesis/schema_daemon.py +248 -0
  300. pulse_os-10.0.0/pulse/daemons/synthesis/skill_dependency_synthesizer.py +285 -0
  301. pulse_os-10.0.0/pulse/daemons/synthesis/skill_phylogeny.py +243 -0
  302. pulse_os-10.0.0/pulse/daemons/synthesis/skill_phylogeny_collectors.py +281 -0
  303. pulse_os-10.0.0/pulse/daemons/synthesis/sleep_cycle.py +290 -0
  304. pulse_os-10.0.0/pulse/daemons/synthesis/swarm_reflex.py +294 -0
  305. pulse_os-10.0.0/pulse/daemons/synthesis/synthesize_plans.py +199 -0
  306. pulse_os-10.0.0/pulse/daemons/worker_supervisor.py +280 -0
  307. pulse_os-10.0.0/pulse/graph/__init__.py +1 -0
  308. pulse_os-10.0.0/pulse/graph/graph_parser.py +133 -0
  309. pulse_os-10.0.0/pulse/graph/knowledge_graph.py +106 -0
  310. pulse_os-10.0.0/pulse/graph/knowledge_graph_build.py +292 -0
  311. pulse_os-10.0.0/pulse/graph/knowledge_graph_query.py +244 -0
  312. pulse_os-10.0.0/pulse/tasks/__init__.py +1 -0
  313. pulse_os-10.0.0/pulse/tasks/decomposer.py +249 -0
  314. pulse_os-10.0.0/pulse/tasks/dispatcher_lifecycle.py +281 -0
  315. pulse_os-10.0.0/pulse/tasks/pulse_dispatcher.py +198 -0
  316. pulse_os-10.0.0/pulse/tasks/pulse_relay.py +269 -0
  317. pulse_os-10.0.0/pulse/tasks/task_claiming.py +238 -0
  318. pulse_os-10.0.0/pulse/tasks/task_ops.py +224 -0
  319. pulse_os-10.0.0/pulse/workers/__init__.py +1 -0
  320. pulse_os-10.0.0/pulse/workers/pulse_worker.py +13 -0
  321. pulse_os-10.0.0/pulse/workers/runner/worker_compliance.py +23 -0
  322. pulse_os-10.0.0/pulse/workers/runner/worker_context.py +49 -0
  323. pulse_os-10.0.0/pulse/workers/runner/worker_execute.py +149 -0
  324. pulse_os-10.0.0/pulse/workers/runner/worker_main.py +119 -0
  325. pulse_os-10.0.0/pulse/workers/runner/worker_memory.py +246 -0
  326. pulse_os-10.0.0/pulse/workers/runner/worker_router.py +39 -0
  327. pulse_os-10.0.0/pulse/workers/runner/worker_state.py +168 -0
  328. pulse_os-10.0.0/pulse/workers/worker_llm.py +284 -0
  329. pulse_os-10.0.0/pulse/workers/worker_tools.py +413 -0
  330. pulse_os-10.0.0/pulse.cmd +4 -0
  331. pulse_os-10.0.0/pulse.ps1 +10 -0
  332. pulse_os-10.0.0/pulse_cli.py +116 -0
  333. pulse_os-10.0.0/pulse_neural_path.cmd +15 -0
  334. pulse_os-10.0.0/pulse_neural_path.ps1 +35 -0
  335. pulse_os-10.0.0/pyproject.toml +63 -0
  336. pulse_os-10.0.0/requirements.txt +12 -0
  337. pulse_os-10.0.0/scripts/install_pulse_service.ps1 +80 -0
  338. pulse_os-10.0.0/tests/__init__.py +0 -0
  339. pulse_os-10.0.0/tests/dummy_2.txt +1 -0
  340. pulse_os-10.0.0/tests/smoke_test.py +166 -0
  341. pulse_os-10.0.0/tests/test_api.py +348 -0
  342. pulse_os-10.0.0/tests/test_brain_io.py +242 -0
  343. pulse_os-10.0.0/tests/test_crypto.py +259 -0
  344. pulse_os-10.0.0/tests/test_worker_tools.py +403 -0
  345. pulse_os-10.0.0/web/.gitignore +24 -0
  346. pulse_os-10.0.0/web/README.md +73 -0
  347. pulse_os-10.0.0/web/api/license/generate.js +62 -0
  348. pulse_os-10.0.0/web/api/license/recover-request.js +61 -0
  349. pulse_os-10.0.0/web/api/license/recover.js +120 -0
  350. pulse_os-10.0.0/web/api/license/validate.js +66 -0
  351. pulse_os-10.0.0/web/eslint.config.js +23 -0
  352. pulse_os-10.0.0/web/index.html +13 -0
  353. pulse_os-10.0.0/web/package-lock.json +5780 -0
  354. pulse_os-10.0.0/web/package.json +45 -0
  355. pulse_os-10.0.0/web/public/vite.svg +1 -0
  356. pulse_os-10.0.0/web/src/App.tsx +32 -0
  357. pulse_os-10.0.0/web/src/api/client.ts +31 -0
  358. pulse_os-10.0.0/web/src/api/types.ts +72 -0
  359. pulse_os-10.0.0/web/src/assets/react.svg +1 -0
  360. pulse_os-10.0.0/web/src/components/AgentCard.tsx +121 -0
  361. pulse_os-10.0.0/web/src/components/AgentGrid.tsx +323 -0
  362. pulse_os-10.0.0/web/src/components/BrainGraph3D/BrainGraph3DScene.tsx +131 -0
  363. pulse_os-10.0.0/web/src/components/BrainGraph3D/EdgeLines.tsx +71 -0
  364. pulse_os-10.0.0/web/src/components/BrainGraph3D/GraphDataProvider.tsx +100 -0
  365. pulse_os-10.0.0/web/src/components/BrainGraph3D/NeuralPulse.tsx +70 -0
  366. pulse_os-10.0.0/web/src/components/BrainGraph3D/NodeCloud.tsx +161 -0
  367. pulse_os-10.0.0/web/src/components/BrainGraph3D/NodeTooltip.tsx +33 -0
  368. pulse_os-10.0.0/web/src/components/BrainGraph3D/constants.ts +76 -0
  369. pulse_os-10.0.0/web/src/components/BrainGraph3D/forceWorker.ts +139 -0
  370. pulse_os-10.0.0/web/src/components/BrainGraph3D/index.tsx +73 -0
  371. pulse_os-10.0.0/web/src/components/BrainGraph3D/types.ts +73 -0
  372. pulse_os-10.0.0/web/src/components/BrainGraph3D/useForceLayout.ts +48 -0
  373. pulse_os-10.0.0/web/src/components/BrainGraph3D/useGraphInteraction.ts +43 -0
  374. pulse_os-10.0.0/web/src/components/BrainHero3D/index.tsx +225 -0
  375. pulse_os-10.0.0/web/src/components/BrainStats.tsx +381 -0
  376. pulse_os-10.0.0/web/src/components/ErrorBoundary.tsx +68 -0
  377. pulse_os-10.0.0/web/src/components/Layout.tsx +94 -0
  378. pulse_os-10.0.0/web/src/components/TaskBoard.tsx +142 -0
  379. pulse_os-10.0.0/web/src/components/WorkerMonitor.tsx +265 -0
  380. pulse_os-10.0.0/web/src/hooks/index.ts +9 -0
  381. pulse_os-10.0.0/web/src/hooks/useBrainData.ts +63 -0
  382. pulse_os-10.0.0/web/src/hooks/useDebounce.ts +13 -0
  383. pulse_os-10.0.0/web/src/hooks/usePolling.ts +34 -0
  384. pulse_os-10.0.0/web/src/hooks/usePulseAPI.ts +33 -0
  385. pulse_os-10.0.0/web/src/hooks/useTaskBoard.ts +9 -0
  386. pulse_os-10.0.0/web/src/index.css +79 -0
  387. pulse_os-10.0.0/web/src/main.tsx +13 -0
  388. pulse_os-10.0.0/web/src/pages/Brain.tsx +730 -0
  389. pulse_os-10.0.0/web/src/pages/Dashboard.tsx +59 -0
  390. pulse_os-10.0.0/web/src/pages/Docs.tsx +541 -0
  391. pulse_os-10.0.0/web/src/pages/Install.tsx +373 -0
  392. pulse_os-10.0.0/web/src/pages/Landing.tsx +258 -0
  393. pulse_os-10.0.0/web/src/pages/NotFound.tsx +178 -0
  394. pulse_os-10.0.0/web/src/pages/Pricing.tsx +296 -0
  395. pulse_os-10.0.0/web/src/pages/Recover.tsx +217 -0
  396. pulse_os-10.0.0/web/src/pages/Success.tsx +144 -0
  397. pulse_os-10.0.0/web/tsconfig.app.json +28 -0
  398. pulse_os-10.0.0/web/tsconfig.json +7 -0
  399. pulse_os-10.0.0/web/tsconfig.node.json +26 -0
  400. pulse_os-10.0.0/web/vercel.json +6 -0
  401. pulse_os-10.0.0/web/vite.config.ts +26 -0
@@ -0,0 +1,67 @@
1
+ # PULSE Agent Boot Directive
2
+
3
+ You are operating inside PULSE, a Neural Operating System for AI swarms.
4
+ Platform: Windows 11. Use PowerShell or Python to read files — bash commands (cat, grep) will NOT work.
5
+
6
+ ## Rules (Non-Negotiable)
7
+ 1. **Brain FIRST:** Before ANY implementation, run `python pulse/brain/brain_query.py --query "<your task>"` and apply the knowledge. For Claude Code: this runs automatically via hooks on every Edit/Write. For other agents: run it manually before coding. Skipping brain = Tier 0 violation.
8
+ 2. **Task board:** Check `Prefrontal_Cortex/Action_Queue/task_board.json`. If open tasks exist, CLAIM one matching your tier per ASOP Rule 2 and execute it. **If the board is empty, output a brief Status Report and WAIT — do NOT start working autonomously.**
9
+ 3. **Silent compliance:** Do NOT print law lists, rule checkboxes, or ceremony text to the user. Governance is loaded internally. User sees your Status Report (name, task, 1-2 brain insights, under 5 lines) and your work — nothing else.
10
+ 4. **Save learnings:** When done, run `python pulse/brain/pulse_save.py --agent <you> --learnings "what you learned" --failures "what failed"`.
11
+ 5. **No repeat mistakes:** Check `Hippocampus/Patterns/anti_patterns.md` before implementing.
12
+ 6. **Constitution:** Read `Corpus_Callosum/CONSTITUTION.md`. Comply silently.
13
+ 7. **ASOP protocol:** Read `Corpus_Callosum/Protocols/ASOP.md` for task coordination.
14
+ 8. **Decompose for others:** If user gives you multiple tasks, do what you can and post the rest to the task board via `python pulse/tasks/pulse_relay.py --tasks "Title:domain:complexity"`.
15
+
16
+ ## Task Tiers (check `recommended_tier` on each task)
17
+ - **fast:** Haiku, Flash, cheap models. Simple tasks (rename, format, docs, tests).
18
+ - **standard:** Sonnet, Gemini Pro. Features, refactoring, implementation.
19
+ - **premium:** Opus, GPT-4. Architecture, security audits, complex design.
20
+ - Claim tasks matching YOUR capability. Don't waste expensive models on simple tasks.
21
+
22
+ ## Autonomous Task Execution
23
+ Tasks posted via `pulse_relay.py` are auto-executed. One command:
24
+
25
+ **`pulse swarm` — THE unified way to start workers:**
26
+ - `pulse swarm` — interactive picker (provider -> model -> count)
27
+ - `pulse swarm gemini` — pick model + count for Gemini
28
+ - `pulse swarm stop` / `pulse swarm status`
29
+ - Auto-detects available providers (API keys, CLI subscriptions, Ollama)
30
+ - Routes to headless workers (API/Ollama) or CLI autopilot (subscriptions)
31
+
32
+ **Interactive chat (no task board):**
33
+ - `pulse claude` / `pulse gemini` — launches agent for interactive use
34
+
35
+ ## Package Structure
36
+ All code lives in the `pulse/` Python package:
37
+ - **Core:** `pulse/core/` — brain_utils, brain_io, config, crypto, paths
38
+ - **Brain:** `pulse/brain/` — search, query, save, boot, extraction
39
+ - **Agents:** `pulse/agents/` — claude, gemini, codex, grok wrappers
40
+ - **Workers:** `pulse/workers/` — headless task execution
41
+ - **Tasks:** `pulse/tasks/` — dispatcher, relay, decomposer
42
+ - **Daemons:** `pulse/daemons/` — orchestrator + 4 subpackages: consolidation/, bridge/, neural/, synthesis/
43
+ - **Graph:** `pulse/graph/` — knowledge graph build/query
44
+ - **API:** `pulse/api/` — REST endpoints
45
+ - **Admin:** `pulse/admin/` — 7 subpackages: audit/, brain_ops/, patterns/, skills/, benchmarks/, retroactive/, setup/
46
+ - **CLI:** `pulse/cli/` — status, swarm, manage commands
47
+ - **Config:** `pulse/config/` — brain_config.json, knowledge_anchors.json
48
+ - **State:** `state/` — runtime data (PIDs, logs, registries, captures)
49
+
50
+ ## Key Paths
51
+ - **Brain query:** `python pulse/brain/brain_query.py --query "<task>"` (RUN FIRST)
52
+ - **Brain save:** `python pulse/brain/pulse_save.py --agent <you> --learnings "..." --failures "..."`
53
+ - **Task relay:** `python pulse/tasks/pulse_relay.py --tasks "Title:domain:complexity"`
54
+ - **Brain map:** `Hippocampus/BRAIN_MAP.md` (single navigation file)
55
+ - **Lessons:** `Hippocampus/Lessons/auto_lessons.md`
56
+ - **Failures:** `Hippocampus/Failures/auto_fails.md`
57
+ - **Patterns:** `Hippocampus/Patterns/auto_patterns.md`
58
+ - **Evidence:** `Hippocampus/Evidence/` (session logs, decisions, intents)
59
+ - **Knowledge:** `Hippocampus/Knowledge/` (curated domain knowledge)
60
+ - **Anti-patterns:** `Hippocampus/Patterns/anti_patterns.md`
61
+ - **Pipeline:** `Personal_Plans/PIPELINE.md` (master priority list — single source of truth)
62
+ - **Task board:** `Prefrontal_Cortex/Action_Queue/task_board.json`
63
+ - **Skills:** `.cursor/skills/` (read relevant skill .md before executing domain tasks)
64
+ - **CLI:** `python pulse_cli.py status|swarm|post|start|stop|claude|gemini`
65
+
66
+ ## User
67
+ The Founder goes by "bro". Values efficiency — every token counts. Prefers concise, action-oriented communication. Multiple agents (Gemini, Claude, Codex, Grok) share this brain.
@@ -0,0 +1,91 @@
1
+ ---
2
+ type: skill
3
+ domain: architecture
4
+ links: [Corpus_Callosum/CONSTITUTION.md, PULSE_OS.md]
5
+ ---
6
+
7
+ # ABSTRACTION_ALCHEMIST
8
+ > **ROLE:** REUSABILITY EXPERT
9
+ > **TRIGGER:** "MODULARIZE"
10
+
11
+ ## Core Mandate
12
+ Turn specific code into universal tools. But never abstract too early -- wait for the pattern to prove itself.
13
+
14
+ ## Step-by-Step Protocol
15
+ 1. **Brain check**: `python Autonomic_System/Utilities/Tools/brain_query.py --query "abstraction patterns for <domain>"`
16
+ 2. **Apply the Rule of Three**: Only extract a shared abstraction when the SAME pattern appears in 3+ places. Two is a coincidence; three is a pattern.
17
+ 3. **Design the interface first**: Write the function signature and docstring before the implementation. The API should be "easy to use correctly, hard to use incorrectly."
18
+ 4. **Minimize public surface**: Export only what consumers need. Prefix internal helpers with `_`. Fewer public methods = fewer breaking changes.
19
+ 5. **Verify stability and save**: Ensure the abstraction lives in `Utilities/` or a shared module. Record the pattern via `pulse_save.py`.
20
+
21
+ ## The Rule of Three
22
+ | Occurrences | Action |
23
+ |---|---|
24
+ | 1 | Write it inline. Do not abstract. |
25
+ | 2 | Note the duplication. Still do not abstract. |
26
+ | 3+ | Extract to shared function/module. Now you have evidence. |
27
+
28
+ ## Interface Design Patterns
29
+ ```python
30
+ # PATTERN 1: Config object instead of many parameters
31
+ # BAD: 7 positional args
32
+ def start_worker(provider, model, tier, timeout, retries, log_level, dry_run): ...
33
+
34
+ # GOOD: Config dataclass
35
+ @dataclass
36
+ class WorkerConfig:
37
+ provider: str = "google"
38
+ model: str = "gemini-2.5-flash"
39
+ tier: str = "standard"
40
+ timeout: int = 120
41
+ max_retries: int = 5
42
+
43
+ def start_worker(config: WorkerConfig): ...
44
+
45
+ # PATTERN 2: Protocol/ABC for plugin architecture
46
+ from typing import Protocol
47
+
48
+ class AgentProvider(Protocol):
49
+ def send(self, prompt: str) -> str: ...
50
+ def supports_tools(self) -> bool: ...
51
+
52
+ # Any class with send() and supports_tools() satisfies this -- no inheritance needed.
53
+
54
+ # PATTERN 3: Builder for complex objects
55
+ class TaskBuilder:
56
+ def __init__(self, title: str):
57
+ self._task = {"title": title, "status": "open"}
58
+ def tier(self, t: str) -> "TaskBuilder":
59
+ self._task["tier"] = t
60
+ return self
61
+ def build(self) -> dict:
62
+ return self._task
63
+ ```
64
+
65
+ ## Metrics & Thresholds
66
+ | Metric | Threshold |
67
+ |---|---|
68
+ | Public methods per module | <7 (Miller's Law) |
69
+ | Parameters per function | <5 (use config object if more) |
70
+ | Inheritance depth | <3 levels (prefer composition) |
71
+ | Duplicate code before abstracting | 3+ occurrences minimum |
72
+ | Module fan-out (imports) | <10 direct dependencies |
73
+
74
+ ## Anti-Patterns
75
+ - **Premature abstraction**: Creating `BaseTask`, `AbstractTask`, `TaskInterface` when you have exactly 1 task type. Wait for three.
76
+ - **Leaky abstraction**: If callers need to know internal details to use your API, the abstraction is broken. Redesign the interface.
77
+ - **God module**: A `utils.py` with 50 unrelated functions is not abstraction -- it is a junk drawer. Split by domain.
78
+
79
+ ## Tools to Use
80
+ - `brain_query.py --query "abstraction patterns for <domain>"` -- check prior designs
81
+ - `pulse_relay.py --tasks "Extract shared module:architecture:standard"` -- delegate extraction
82
+ - `pulse_save.py --learnings "extracted <pattern>"` -- record successful abstractions
83
+ - `Hippocampus/Patterns/auto_patterns.md` -- check for recurring patterns worth abstracting
84
+
85
+ ## Verification Checklist
86
+ - [ ] No abstraction created for fewer than 3 occurrences (Rule of Three)
87
+ - [ ] Public API surface <7 methods per module
88
+ - [ ] No function takes more than 5 parameters (use config object)
89
+ - [ ] Inheritance depth <3 (prefer composition over inheritance)
90
+ - [ ] All internal helpers prefixed with `_`
91
+ - [ ] Shared abstractions live in `Utilities/` or clearly named shared modules
@@ -0,0 +1,26 @@
1
+ # ARCHITECT.md
2
+
3
+ ---
4
+ type: skill
5
+ domain: architecture
6
+ links: [Corpus_Callosum/CONSTITUTION.md, Corpus_Callosum/CONSTITUTION.md, Corpus_Callosum/CONSTITUTION.md, Corpus_Callosum/Architecture_Maps/ARCHITECTURE.md]
7
+ ---
8
+
9
+ > **ROLE:** SYSTEMS ARCHITECT
10
+ > **TRIGGER:** "PLAN MODE"
11
+
12
+ ## 🏗️ BLUEPRINT PROTOCOL
13
+ Do not write a single line of code until we have a map.
14
+
15
+ ### 1. THE "PRD" MINI-FORMAT
16
+ For every feature request, generate this:
17
+ * **Goal:** 1 sentence.
18
+ * **Files Touched:** List of files to edit/create.
19
+ * **Data Flow:** `User -> API -> DB -> Response`
20
+ * **Edge Cases:** What happens if the user is offline/banned/stupid?
21
+
22
+ ### 2. THE STEP-BY-STEP
23
+ Break the plan into atomic steps that `gemini-flash` can execute later.
24
+ 1. [ ] Setup DB Schema
25
+ 2. [ ] Create API Endpoint
26
+ 3. [ ] Build UI Component
@@ -0,0 +1,78 @@
1
+ ---
2
+ type: skill
3
+ domain: architecture
4
+ links: [Corpus_Callosum/CONSTITUTION.md, PULSE_OS.md]
5
+ ---
6
+
7
+ # COMPLEXITY_CRUSHER
8
+ > **ROLE:** SIMPLICITY ARCHITECT
9
+ > **TRIGGER:** "SIMPLIFY"
10
+
11
+ ## Core Mandate
12
+ Simple is better than complex. Complex is better than complicated. If two solutions work, pick the one with fewer moving parts.
13
+
14
+ ## Step-by-Step Protocol
15
+ 1. **Brain check**: `python Autonomic_System/Utilities/Tools/brain_query.py --query "complexity issues in <module>"`
16
+ 2. **Score the code**: Measure cyclomatic complexity, nesting depth, function length, and file length against thresholds below.
17
+ 3. **Apply early returns**: Replace nested if/else chains with guard clauses that return early. Target: max 2 levels of nesting.
18
+ 4. **Extract or delete**: Functions >50 lines get split. "Just-in-case" code with no callers gets deleted. Middle-man functions that only forward calls get inlined.
19
+ 5. **Verify and save**: Run `ruff check --select C901` to confirm complexity <10. Save learnings via `pulse_save.py`.
20
+
21
+ ## Complexity Scoring Rules
22
+ | Metric | Green | Yellow (refactor soon) | Red (refactor NOW) |
23
+ |---|---|---|---|
24
+ | Cyclomatic complexity | 1-5 | 6-10 | >10 |
25
+ | Nesting depth | 1-2 | 3 | 4+ |
26
+ | Function length | 1-25 lines | 26-50 lines | >50 lines |
27
+ | File length | 1-200 lines | 201-400 lines | >400 lines |
28
+ | Parameters per function | 1-3 | 4-5 | 6+ |
29
+ | Return statements | 1-2 | 3-4 | 5+ |
30
+
31
+ ## Good Example: Flatten Nested Logic
32
+ ```python
33
+ # BAD: 4 levels of nesting
34
+ def process_task(task):
35
+ if task:
36
+ if task.get("status") == "open":
37
+ if task.get("tier") in VALID_TIERS:
38
+ if can_claim(task):
39
+ return claim(task)
40
+ return None
41
+
42
+ # GOOD: Early returns, max 1 level of nesting
43
+ def process_task(task):
44
+ if not task:
45
+ return None
46
+ if task.get("status") != "open":
47
+ return None
48
+ if task.get("tier") not in VALID_TIERS:
49
+ return None
50
+ if not can_claim(task):
51
+ return None
52
+ return claim(task)
53
+ ```
54
+
55
+ ## Refactoring Thresholds
56
+ - **Complexity >10**: Mandatory split into sub-functions before merge.
57
+ - **File >400 lines**: Decompose into 2+ modules with clear boundaries.
58
+ - **6+ parameters**: Introduce a config dict or dataclass.
59
+ - **Duplicate code >3 lines appearing 2+ times**: Extract to shared function.
60
+
61
+ ## Anti-Patterns
62
+ - **"Clever" one-liners**: A 200-char list comprehension is worse than a 5-line loop. Optimize for reading, not writing.
63
+ - **Premature abstraction**: Don't create a base class for one implementation. Wait for the Rule of Three.
64
+ - **Middle-man functions**: `def get_data(): return _get_data()` adds indirection with zero value. Inline it.
65
+
66
+ ## Tools to Use
67
+ - `ruff check --select C901 <path>` -- measure cyclomatic complexity
68
+ - `brain_query.py --query "complexity in <module>"` -- check prior refactoring lessons
69
+ - `pulse_relay.py --tasks "Refactor <module>:architecture:standard"` -- delegate refactors
70
+ - `Hippocampus/Patterns/` -- check for known complexity offenders
71
+
72
+ ## Verification Checklist
73
+ - [ ] All functions have cyclomatic complexity <10 (`ruff --select C901`)
74
+ - [ ] No function exceeds 50 lines
75
+ - [ ] No nesting deeper than 3 levels
76
+ - [ ] No file exceeds 400 lines
77
+ - [ ] No function takes more than 5 parameters
78
+ - [ ] All duplicate code blocks extracted to shared functions
@@ -0,0 +1,79 @@
1
+ ---
2
+ type: skill
3
+ domain: architecture
4
+ links: [Corpus_Callosum/CONSTITUTION.md, PULSE_OS.md]
5
+ ---
6
+
7
+ # DATABASE_WHISPERER
8
+ > **ROLE:** DATA ARCHITECT
9
+ > **TRIGGER:** "PERSISTENCE"
10
+
11
+ ## Core Mandate
12
+ The disk is the ultimate source of truth. Every read is fast, every write is atomic, every schema is intentional.
13
+
14
+ ## Step-by-Step Protocol
15
+ 1. **Brain check**: `python Autonomic_System/Utilities/Tools/brain_query.py --query "data patterns for <module>"`
16
+ 2. **Audit schema**: No duplicate data across files. Normalize JSON structures -- one source of truth per entity.
17
+ 3. **Optimize queries**: Never `SELECT *`. Use `EXPLAIN ANALYZE` on any query >50ms. Add indexes on hot columns.
18
+ 4. **Wrap multi-step writes** in transactions or atomic file operations (filelock for JSON files in PULSE).
19
+ 5. **Monitor and save**: Log query latency. If >100ms, investigate. Save findings via `pulse_save.py`.
20
+
21
+ ## SQL Examples (for DB-backed components)
22
+ ```sql
23
+ -- ALWAYS check query plans before shipping
24
+ EXPLAIN ANALYZE SELECT task_id, status FROM tasks WHERE status = 'open';
25
+
26
+ -- GOOD: Index on frequently filtered columns
27
+ CREATE INDEX idx_tasks_status ON tasks(status);
28
+ CREATE INDEX idx_tasks_claimed_by ON tasks(claimed_by);
29
+
30
+ -- BAD vs GOOD query patterns
31
+ -- BAD: SELECT * FROM tasks;
32
+ -- GOOD: SELECT task_id, title, status FROM tasks WHERE status = 'open' LIMIT 50;
33
+
34
+ -- GOOD: Use transactions for multi-step operations
35
+ BEGIN;
36
+ UPDATE tasks SET status = 'claimed', claimed_by = 'agent-1' WHERE task_id = 'T-001' AND status = 'open';
37
+ COMMIT;
38
+ ```
39
+
40
+ ## PULSE JSON File Patterns (primary data store)
41
+ ```python
42
+ # CORRECT: Atomic JSON update with filelock
43
+ from filelock import FileLock
44
+ import json
45
+
46
+ def atomic_update_json(path: str, updater_fn):
47
+ lock = FileLock(f"{path}.lock", timeout=2)
48
+ with lock:
49
+ data = json.loads(Path(path).read_text())
50
+ updater_fn(data)
51
+ Path(path).write_text(json.dumps(data, indent=2))
52
+ ```
53
+
54
+ ## Metrics & Thresholds
55
+ | Metric | Threshold |
56
+ |---|---|
57
+ | Query latency | <100ms (optimize if exceeded) |
58
+ | JSON file read/write | <50ms with filelock |
59
+ | Duplicate data across files | 0 (single source of truth) |
60
+ | Unindexed hot columns | 0 |
61
+ | `SELECT *` usage | 0 (fetch only needed fields) |
62
+
63
+ ## Anti-Patterns
64
+ - **Reading entire JSON to find one field**: Parse once, cache the result, or restructure the file.
65
+ - **Writing without filelock**: Race conditions corrupt `task_board.json`. Always use `atomic_update_json`.
66
+ - **Nested JSON >3 levels deep**: Flatten the structure. PULSE brain refactor proved flat > nested.
67
+
68
+ ## Tools to Use
69
+ - `brain_query.py --query "data persistence for <module>"` -- check prior patterns
70
+ - `pulse_save.py --learnings "optimized <query>"` -- record improvements
71
+ - `pulse_relay.py --tasks "Optimize JSON reads:architecture:fast"` -- delegate work
72
+
73
+ ## Verification Checklist
74
+ - [ ] No `SELECT *` in any query (or equivalent full-file reads without filtering)
75
+ - [ ] All multi-step JSON writes use `atomic_update_json` with filelock
76
+ - [ ] Hot columns (status, task_id, claimed_by) are indexed
77
+ - [ ] Query latency <100ms for all critical paths
78
+ - [ ] JSON nesting depth <4 levels in all data files
79
+ - [ ] No duplicate data across brain files (single source of truth)
@@ -0,0 +1,56 @@
1
+ ---
2
+ type: skill
3
+ domain: architecture
4
+ links: [Corpus_Callosum/CONSTITUTION.md, PULSE_OS.md]
5
+ ---
6
+
7
+ # KAFKA_MAGE.md
8
+ > **ROLE:** DISTRIBUTED SYSTEMS ARCHITECT
9
+ > **TRIGGER:** "SCALE UP" / "EVENT STREAM" / "PARTITION"
10
+
11
+ ## Step-by-Step Protocol
12
+ 1. **Audit current throughput** — measure messages/sec, p99 latency, consumer lag with `brain_query.py --query "event throughput bottlenecks"`.
13
+ 2. **Design partition strategy** — hash on agent_id for ordering guarantees; use round-robin only for stateless consumers. Target: <=12 partitions per topic for manageability.
14
+ 3. **Configure consumer groups** — one group per concern (capture, bridge, dedup). Set `max.poll.records=500`, `session.timeout.ms=30000`. Never mix fast and slow consumers in one group.
15
+ 4. **Wire exactly-once semantics** — enable `enable.idempotence=true` on producers, use transactional APIs (`initTransactions`, `beginTransaction`, `commitTransaction`). Set `isolation.level=read_committed` on consumers.
16
+ 5. **Load test and verify** — push 10x expected peak, confirm zero message loss, consumer lag <1000, p99 <50ms.
17
+
18
+ ## Metrics & Thresholds
19
+ - **Producer throughput:** >=10,000 msgs/sec per partition
20
+ - **Consumer lag:** <1,000 messages (alert at 5,000, page at 10,000)
21
+ - **End-to-end latency:** p50 <10ms, p99 <50ms, p999 <200ms
22
+ - **Partition count:** 3-12 per topic (never >50 — rebalancing kills perf)
23
+ - **Replication factor:** minimum 3 for durability
24
+
25
+ ## Good Example
26
+ ```python
27
+ # Exactly-once producer with idempotence
28
+ from kafka import KafkaProducer
29
+ producer = KafkaProducer(
30
+ bootstrap_servers="localhost:9092",
31
+ acks="all", # wait for all replicas
32
+ enable_idempotence=True, # dedup at broker level
33
+ max_in_flight_requests_per_connection=5,
34
+ retries=2147483647, # infinite retries (idempotent)
35
+ key_serializer=lambda k: k.encode("utf-8"),
36
+ value_serializer=lambda v: json.dumps(v).encode("utf-8"),
37
+ )
38
+ producer.send("pulse.events", key=agent_id, value=event)
39
+ ```
40
+
41
+ ## Anti-Patterns
42
+ 1. **Random partitioning for ordered data** — destroys per-agent ordering; always hash on agent_id.
43
+ 2. **One giant consumer group** — slow consumers block fast ones; separate by processing speed.
44
+ 3. **Polling without backpressure** — unbounded queues cause OOM; cap in-memory buffers at 10,000 msgs.
45
+
46
+ ## Tools to Use
47
+ - `python Autonomic_System/Utilities/Tools/brain_query.py --query "event streaming"` — check prior streaming decisions
48
+ - `python Autonomic_System/Utilities/Tools/pulse_relay.py --tasks "Partition Audit:architecture:standard"` — delegate partition review
49
+ - `python Autonomic_System/Utilities/Tools/pulse_save.py --agent kafka_mage --learnings "what you learned"` — persist findings
50
+
51
+ ## Verification Checklist
52
+ - [ ] Consumer lag stays <1,000 under peak load
53
+ - [ ] Exactly-once enabled: idempotent producer + transactional consumer
54
+ - [ ] No single consumer group mixes fast/slow processors
55
+ - [ ] Partition key ensures ordering where required (agent_id, session_id)
56
+ - [ ] Replication factor >=3, acks=all on all producers
@@ -0,0 +1,59 @@
1
+ ---
2
+ type: skill
3
+ domain: architecture
4
+ ---
5
+
6
+ # MASTER_ARCHITECT
7
+ > **ROLE:** System design and structural oversight
8
+ > **TRIGGER:** Invoked for new modules, major refactors, cross-cutting changes, or dependency restructuring
9
+
10
+ ## Core Directive
11
+ Prevent architectural decay by enforcing structural rules before code is written. Every new file, module, or dependency must fit the existing PULSE layout or justify a deviation with evidence.
12
+
13
+ ## Step-by-Step Protocol
14
+ 1. **Map the blast radius:** Before any change, run `python Autonomic_System/Utilities/Tools/brain_query.py --query "architecture <module>"` and list every file that imports from or is imported by the target module. If the count exceeds 5, the change is HIGH RISK -- decompose it.
15
+ 2. **Validate placement:** New files MUST land in the correct PULSE region. Check `Hippocampus/BRAIN_MAP.md` for the canonical directory tree. If no region fits, propose a new one with a 1-line justification in the PR description.
16
+ 3. **Enforce boundaries:** No file in `Hippocampus/` should import from `Autonomic_System/`. No daemon should import from `Sensory_Input/`. Dependencies flow DOWN the stack: CLI -> Daemons -> Utilities -> Brain. Violations are blocking.
17
+ 4. **Check for duplication:** Run `python Autonomic_System/Utilities/Tools/brain_search.py --query "<feature>"` to confirm no existing tool already does what the new code proposes. Duplicate tools are rejected.
18
+ 5. **Sign off with metrics:** After implementation, verify the module meets all thresholds below. Record the architectural decision in `Hippocampus/Evidence/` via `pulse_save.py`.
19
+
20
+ ## Metrics & Thresholds
21
+ - Max 300 lines per Python file (split at 250 if growing)
22
+ - Max 3 levels of directory nesting from project root
23
+ - Max 5 direct imports from other PULSE regions per file
24
+ - Every new `.py` file must have a docstring explaining its role in under 2 lines
25
+ - Zero circular imports -- test with `python -c "import <module>"` before committing
26
+
27
+ ## Examples
28
+
29
+ ### Good
30
+ ```
31
+ PULSE/
32
+ Autonomic_System/
33
+ Daemons/pulse_worker.py # imports from Utilities only
34
+ Utilities/Tools/brain_query.py # imports from Hippocampus only
35
+ Hippocampus/
36
+ Lessons/auto_lessons.md # no code imports at all
37
+ ```
38
+ Each layer only reaches DOWN, never UP or SIDEWAYS into peer regions.
39
+
40
+ ### Bad (Anti-Pattern)
41
+ ```python
42
+ # In Hippocampus/Knowledge/router.py
43
+ from Autonomic_System.Daemons.pulse_worker import claim_task # WRONG: brain imports daemon
44
+ from Sensory_Input.prompt_capture import capture # WRONG: brain imports sensory
45
+ ```
46
+ Brain files must never depend on runtime components. This creates boot-order failures and circular imports.
47
+
48
+ ## Tools to Use
49
+ - `brain_query.py --query "architecture <area>"` -- check existing decisions
50
+ - `brain_search.py --query "<feature>"` -- find duplicate functionality
51
+ - `pulse_save.py --agent <you> --learnings "architectural decision: ..."` -- record decisions
52
+ - `hippocampus_wiring.py` -- verify brain region connectivity
53
+
54
+ ## Verification
55
+ - [ ] New files placed in correct PULSE region per BRAIN_MAP.md
56
+ - [ ] No upward or circular imports introduced
57
+ - [ ] File under 300 lines, functions under 50 lines
58
+ - [ ] Existing tool duplication checked via brain_search
59
+ - [ ] Architectural decision recorded in Evidence
@@ -0,0 +1,79 @@
1
+ ---
2
+ type: skill
3
+ domain: architecture
4
+ links: [Corpus_Callosum/CONSTITUTION.md, PULSE_OS.md]
5
+ ---
6
+
7
+ # NETWORK_NOMAD
8
+ > **ROLE:** CONNECTIVITY ARCHITECT
9
+ > **TRIGGER:** "API CALL"
10
+
11
+ ## Core Mandate
12
+ The network is unreliable. The code must not be. Every external call gets a timeout, a retry, and a fallback.
13
+
14
+ ## Step-by-Step Protocol
15
+ 1. **Brain check**: `python Autonomic_System/Utilities/Tools/brain_query.py --query "network patterns for <API/service>"`
16
+ 2. **Wrap every external call** in retry logic with exponential backoff: `delay = min(2^attempt * 100ms, 30s)`, max 5 retries.
17
+ 3. **Set explicit timeouts** on all requests: connect=5s, read=30s. Never use `timeout=None`.
18
+ 4. **Implement circuit breaker**: After 3 consecutive failures, stop calling for 60 seconds. Log the circuit-open event.
19
+ 5. **Verify TLS and sanitize headers**: No plaintext HTTP. Strip `Server`, `X-Powered-By` from responses.
20
+
21
+ ## Exponential Backoff Formula
22
+ ```
23
+ delay = min(2^attempt * 100ms, max_delay)
24
+ ```
25
+ | Attempt | Delay | Cumulative |
26
+ |---|---|---|
27
+ | 1 | 200ms | 200ms |
28
+ | 2 | 400ms | 600ms |
29
+ | 3 | 800ms | 1.4s |
30
+ | 4 | 1600ms | 3.0s |
31
+ | 5 | 3200ms | 6.2s |
32
+
33
+ Add jitter: `delay = delay * (0.5 + random.random() * 0.5)` to prevent thundering herd.
34
+
35
+ ## Good Example
36
+ ```python
37
+ import time, random, requests
38
+
39
+ def resilient_call(url: str, max_retries: int = 5) -> requests.Response:
40
+ for attempt in range(max_retries):
41
+ try:
42
+ resp = requests.get(url, timeout=(5, 30))
43
+ resp.raise_for_status()
44
+ return resp
45
+ except requests.RequestException:
46
+ if attempt == max_retries - 1:
47
+ raise
48
+ delay = min(2 ** attempt * 0.1, 30)
49
+ delay *= 0.5 + random.random() * 0.5 # jitter
50
+ time.sleep(delay)
51
+ ```
52
+
53
+ ## Metrics & Thresholds
54
+ | Metric | Threshold |
55
+ |---|---|
56
+ | Connect timeout | 5 seconds max |
57
+ | Read timeout | 30 seconds max |
58
+ | Max retries | 5 attempts |
59
+ | Circuit breaker trigger | 3 consecutive failures |
60
+ | Circuit breaker cooldown | 60 seconds |
61
+ | Max backoff cap | 30 seconds |
62
+
63
+ ## Anti-Patterns
64
+ - **`timeout=None`**: Hangs forever if server is down. Always set both connect and read timeouts.
65
+ - **Retry without backoff**: Hammering a failing server makes it worse. Always use exponential delay.
66
+ - **Catching `requests.RequestException` and returning `None`**: Caller won't know the call failed. Raise or return a result object with error info.
67
+
68
+ ## Tools to Use
69
+ - `brain_query.py --query "API retry patterns"` -- check brain for prior network lessons
70
+ - `pulse_relay.py --tasks "Add retry logic:architecture:fast"` -- delegate to agents
71
+ - `pulse_save.py --learnings "..." --failures "..."` -- record network incidents
72
+
73
+ ## Verification Checklist
74
+ - [ ] Every `requests.get/post` call has explicit `timeout=(connect, read)`
75
+ - [ ] Retry logic uses exponential backoff with jitter
76
+ - [ ] Circuit breaker implemented for repeated-failure APIs
77
+ - [ ] No plaintext HTTP URLs (all HTTPS)
78
+ - [ ] No `timeout=None` anywhere in codebase
79
+ - [ ] Rate limiting respected (check `Retry-After` header)
@@ -0,0 +1,60 @@
1
+ ---
2
+ type: skill
3
+ domain: architecture
4
+ links: [Corpus_Callosum/CONSTITUTION.md, PULSE_OS.md]
5
+ ---
6
+
7
+ # SYSTEM_HARMONIZER.md
8
+ > **ROLE:** COHESION ARCHITECT
9
+ > **TRIGGER:** "INTEGRATE ALL" / "COMPATIBILITY" / "CONTRACT"
10
+
11
+ ## Step-by-Step Protocol
12
+ 1. **Map integration surface** — run `brain_query.py --query "system integration points"`. List every inter-module call, shared file, and message format. Build a dependency matrix.
13
+ 2. **Define API contracts** — every boundary gets a contract: JSON Schema for files, Pydantic models for APIs, TypedDict for internal dicts. Pin field names, types, required/optional.
14
+ 3. **Build compatibility matrix** — table of Module x Module with status (PASS/FAIL/UNTESTED). Run contract tests: provider publishes schema, consumer validates against it.
15
+ 4. **Resolve conflicts** — when skills contradict (e.g., ZERO_TRUST blocks LATENCY_LAYER), apply priority: Constitution > LAWS.md > ASOP > skill. Document the resolution in Evidence/.
16
+ 5. **Verify end-to-end** — trace a request from Sensory_Input through Brain to output. Confirm every handoff matches its contract. No silent data drops.
17
+
18
+ ## Metrics & Thresholds
19
+ - **Contract coverage:** 100% of inter-module boundaries have a schema
20
+ - **Compatibility matrix fill rate:** >90% cells tested (no UNTESTED between active modules)
21
+ - **Breaking change frequency:** 0 unannounced breaking changes per release
22
+ - **Integration test pass rate:** >=99% on main branch
23
+ - **Conflict resolution time:** <1 hour from detection to documented resolution
24
+
25
+ ## Good Example
26
+ ```python
27
+ # Contract test: pulse_save output matches brain_query input
28
+ from pydantic import BaseModel, validator
29
+
30
+ class LearningEntry(BaseModel):
31
+ agent: str
32
+ content: str # min 25 chars, 5+ words (quality gate)
33
+ timestamp: str
34
+ source: str
35
+
36
+ @validator("content")
37
+ def validate_quality(cls, v):
38
+ assert len(v) >= 25, "Too short for brain storage"
39
+ assert len(v.split()) >= 5, "Need 5+ words"
40
+ return v
41
+
42
+ # Provider (pulse_save) and consumer (brain_query) both validate against this
43
+ ```
44
+
45
+ ## Anti-Patterns
46
+ 1. **Implicit contracts** — "it just sends a dict" guarantees nothing; always define schemas.
47
+ 2. **Bilateral fixes** — when A and B break, fix the contract, not both sides independently. Law 10 (Twin Paradox) applies.
48
+ 3. **Skipping the matrix** — untested integration paths fail in production. If two modules can talk, test that they do.
49
+
50
+ ## Tools to Use
51
+ - `python Autonomic_System/Utilities/Tools/brain_query.py --query "integration contracts"` — find existing contracts and past breakages
52
+ - `python Autonomic_System/Utilities/Tools/pulse_relay.py --tasks "Contract Test:architecture:standard"` — delegate contract writing
53
+ - `python Autonomic_System/Utilities/Tools/pulse_save.py --agent harmonizer --learnings "what you learned"` — record integration decisions
54
+
55
+ ## Verification Checklist
56
+ - [ ] Every inter-module boundary has a Pydantic/JSON Schema contract
57
+ - [ ] Compatibility matrix exists and >90% cells are PASS/FAIL (not UNTESTED)
58
+ - [ ] No module reads another module's internal state directly (use APIs)
59
+ - [ ] Conflict resolutions documented in Hippocampus/Evidence/
60
+ - [ ] End-to-end trace passes: input -> processing -> output with zero silent drops
@@ -0,0 +1,60 @@
1
+ ---
2
+ type: skill
3
+ domain: architecture
4
+ links: [Corpus_Callosum/CONSTITUTION.md, PULSE_OS.md]
5
+ ---
6
+
7
+ # UI_ALCHEMIST.md
8
+ > **ROLE:** UX/UI DESIGNER
9
+ > **TRIGGER:** "MAKE IT PRETTY" / "UI" / "COMPONENT"
10
+
11
+ ## Step-by-Step Protocol
12
+ 1. **Query existing patterns** — run `brain_query.py --query "UI components design system"`. Check for established spacing, color, and typography decisions.
13
+ 2. **Define component hierarchy** — Atoms (Button, Input, Label) -> Molecules (SearchBar, FormField) -> Organisms (Header, TaskCard) -> Templates -> Pages. Never skip levels.
14
+ 3. **Set render budgets** — every component must render in <16ms (60fps). Measure with `React.Profiler` or `performance.mark()`. Break up work exceeding 50ms with `requestIdleCallback`.
15
+ 4. **Apply accessibility (WCAG 2.1 AA)** — contrast ratio >=4.5:1 for text, >=3:1 for large text. All interactive elements keyboard-navigable. All images have `alt`. All forms have `<label>`.
16
+ 5. **Mobile-first implementation** — write base CSS for 320px, then `@media (min-width: 768px)` for tablet, `@media (min-width: 1024px)` for desktop. Test on real devices.
17
+
18
+ ## Metrics & Thresholds
19
+ - **Render time:** <16ms per frame (60fps), <50ms for initial component mount
20
+ - **Contrast ratio:** >=4.5:1 normal text, >=3:1 large text (WCAG 2.1 AA)
21
+ - **Lighthouse accessibility score:** >=90
22
+ - **Bundle size per component:** <10KB gzipped (atoms), <25KB (molecules), <50KB (organisms)
23
+ - **Spacing system:** multiples of 4px only (4, 8, 12, 16, 24, 32, 48, 64)
24
+
25
+ ## Good Example
26
+ ```tsx
27
+ // Atom: accessible button with render budget enforcement
28
+ const PulseButton = ({ label, onClick, variant = "primary" }: Props) => {
29
+ // Render budget: this component must mount in <16ms
30
+ return (
31
+ <button
32
+ className={`px-4 py-2 rounded-lg font-medium
33
+ ${variant === "primary" ? "bg-blue-600 text-white" : "bg-gray-200 text-gray-800"}
34
+ focus:ring-2 focus:ring-offset-2 focus:ring-blue-500
35
+ hover:opacity-90 transition-opacity duration-150`}
36
+ onClick={onClick}
37
+ aria-label={label} /* WCAG: always provide accessible name */
38
+ >
39
+ {label}
40
+ </button>
41
+ );
42
+ };
43
+ ```
44
+
45
+ ## Anti-Patterns
46
+ 1. **Inline styles over design tokens** — kills consistency; always use spacing/color tokens from the system.
47
+ 2. **Skipping keyboard navigation** — 15% of users rely on it; every `onClick` needs `onKeyDown` (Enter/Space).
48
+ 3. **Rendering lists without virtualization** — >50 items causes jank; use `react-window` or `virtuoso` for long lists.
49
+
50
+ ## Tools to Use
51
+ - `python Autonomic_System/Utilities/Tools/brain_query.py --query "UI design tokens"` — find existing design decisions
52
+ - `python Autonomic_System/Utilities/Tools/pulse_relay.py --tasks "Accessibility Audit:architecture:fast"` — delegate a11y sweep
53
+ - `python Autonomic_System/Utilities/Tools/pulse_save.py --agent ui_alchemist --learnings "what you learned"` — save design decisions
54
+
55
+ ## Verification Checklist
56
+ - [ ] All components use 4px spacing grid (no arbitrary values)
57
+ - [ ] Render budget met: <16ms per frame, verified with Profiler
58
+ - [ ] WCAG 2.1 AA: contrast >=4.5:1, all inputs labeled, keyboard-navigable
59
+ - [ ] Component hierarchy follows Atomic Design (atoms -> molecules -> organisms)
60
+ - [ ] Mobile-first: base styles at 320px, progressive enhancement upward