#+TITLE: SKILL: Chaos Specialist Agent (Consensus Phase E) #+ID: skill-chaos-specialist #+STARTUP: content #+FILETAGS: :psf:qa:chaos-engineering:testing: * Overview The **Chaos Specialist Agent** is the fifth specialized role in the [[file:../notes/personal-software-foundry.org][Personal Software Foundry (PSF)]] Consensus Loop. Its purpose is to perform **Dynamic Verification** through destructive testing. While the Analyst ensures the code is *functionally* correct via TDD, the Chaos Specialist ensures the system is *resilient* by proactively attempting to break it. * The Chaos Mandate 1. **Perception:** The Specialist must perceive when a project has reached the `:BUILD` state (tests passing, code implementation present). 2. **Sabotage:** It must execute the **Chaos Gauntlet**, which includes simulating image crashes and dependency failures. 3. **Audit:** It MUST generate a `Chaos_Report.org` documenting the system's ability to recover, adhering to the "Persistence by Default" mandate. * Symbolic Implementation (The Logic) The following Lisp logic defines the actuation of the Chaos Gauntlet. #+begin_src lisp (defun chaos-actuate (project-name) "Physically executes the Chaos Gauntlet and writes the report." (let* ((projects-dir (org-agent::get-env "PROJECTS_DIR" "/app/5_projects/")) (project-dir (format nil "~a/~a/" projects-dir project-name)) (report-path (format nil "~adocs/Chaos_Report.org" project-dir))) (kernel-log "CHAOS - Actuating Gauntlet for: ~a" project-name) (ensure-directories-exist (format nil "~adocs/" project-dir)) (let ((result (psf-run-chaos-gauntlet project-name))) (with-open-file (out report-path :direction :output :if-exists :supersede) (format out "#+TITLE: Chaos Report: ~a~%#+STATUS: ~a~%~%* 1. Sabotage Results~%~a~%" project-name (if (search "SUCCESS" result) "PASSED" "FAILED") result))) (format nil "SUCCESS - Chaos Specialist completed audit for ~a" project-name))) #+end_src * Neuro-Cognitive Prompt (The 'Think' Loop) When invoked, the neuro-layer decides which specific sabotage strategies to deploy based on the project's architecture. #+begin_src lisp (defun neuro-skill-chaos (context) (let* ((payload (getf context :payload)) (project-name (getf payload :project-name))) (format nil " You are the PSF Chaos Specialist. Project '~a' has passed implementation and TDD. Your task: Identify the most critical failure points. 1. Analyze the project structure. 2. Deploy sabotage strategies (e.g., kill image, mock network failure). Return a Lisp plist: (:target :chaos :action :actuate :name \"~a\") " project-name project-name))) #+end_src * Registration #+begin_src lisp (defskill :skill-chaos :priority 50 :trigger #'trigger-skill-chaos :neuro #'neuro-skill-chaos :symbolic #'chaos-actuate) #+end_src