feat(arch): implement 'Code as Thought' architecture and formalize PSF Consensus Loop

This commit is contained in:
2026-03-31 13:03:26 -04:00
parent 5a9129132e
commit 1712b1e4a9
114 changed files with 3652 additions and 2581 deletions

View File

@@ -1,72 +0,0 @@
#+TITLE: SKILL: Tech-Analyst Agent (Consensus Phase C)
#+ID: skill-tech-analyst-agent
#+STARTUP: content
#+FILETAGS: :psf:engineering:testing:tdd:
* Overview
The **Tech-Analyst Agent** is the third specialized role in the [[file:../notes/personal-software-foundry.org][Personal Software Foundry (PSF)]] Consensus Loop. Its purpose is to define the **Success Criteria** for a project.
By generating a failing test suite immediately after the architecture is signed, the Analyst ensures that the Foundry follows a strict **Test-Driven Development (TDD)** mandate. This prevents the Coder from writing "orphan code" that lacks verification.
* The Analyst Mandate
1. **Perception:** The Analyst must perceive when a `PROTOCOL.org` has reached the `SIGNED` state.
2. **Translation:** It must translate the semantic interfaces defined in the protocol into executable test cases.
3. **Integrity:** It MUST ensure that the test suite covers both "Happy Path" and "Edge Case" scenarios, adhering to the security standards in [[file:../notes/institutional-memory.org][Institutional Memory]].
* Symbolic Implementation (The Logic)
The following Lisp logic defines the physical actuation of the Analyst. It handles the creation of the test directory and the initial test files.
#+begin_src lisp
(defun tech-analyst-actuate (project-name test-content)
"Physically writes the TDD suite drafted by the Neuro-layer."
(let* ((projects-dir (org-agent::get-env "PROJECTS_DIR" "/app/5_projects/"))
(project-dir (format nil "~a/~a/" projects-dir project-name))
(test-dir (format nil "~atests/" project-dir))
(test-path (format nil "~atests/test-suite.lisp" project-dir))) ; Defaulting to Lisp for PSF core
(kernel-log "ANALYST - Actuating TDD Suite for: ~a" project-name)
(ensure-directories-exist test-dir)
(with-open-file (out test-path :direction :output :if-exists :supersede)
(format out ";;; TDD Suite for ~a~%~a" project-name test-content))
(format nil "SUCCESS - Tech-Analyst established TDD Suite for ~a" project-name)))
#+end_src
* Neuro-Cognitive Prompt (The 'Think' Loop)
When the agent's LLM layer is invoked for this skill, it receives the following instructions to generate the tests based on the signed protocol.
#+begin_src lisp
(defun neuro-skill-tech-analyst (context)
(let* ((payload (getf context :payload))
(project-name (getf payload :project-name))
(protocol-content (getf payload :protocol-content)))
(format nil "
You are the PSF Tech-Analyst.
The PROTOCOL for project '~a' has been SIGNED.
Protocol & Interfaces:
---
~a
---
Your task: Generate a comprehensive test suite (TDD).
1. Write the tests in Common Lisp (FiveAM or similar).
2. Ensure tests match the function signatures in the PROTOCOL.
3. Include tests for:
- Success scenarios (Expected behavior).
- Edge cases (Malformed input, empty states).
- Security constraints.
Return a Lisp plist: (:target :analyst :action :actuate :name \"~a\" :content \"generated-test-code\")
" project-name protocol-content project-name)))
#+end_src
* Registration
#+begin_src lisp
(defskill :skill-tech-analyst
:priority 60
:trigger #'trigger-skill-tech-analyst
:neuro #'neuro-skill-tech-analyst
:symbolic #'tech-analyst-actuate)
#+end_src

View File

@@ -0,0 +1 @@
/home/user/memex/notes/org-skill-tech-analyst.org