Files
memex/system/skills/org-skill-architect.org

3.1 KiB

SKILL: Architect Agent (Consensus Phase B)

Overview

The Architect Agent is the second specialized role in the Personal Software Foundry (PSF) Consensus Loop. Its purpose is to bridge the gap between human-readable requirements (Phase A: Demand) and machine-executable code (Phase D: Build).

By transforming a FROZEN PRD into a PROTOCOL, the Architect ensures that structural integrity is established before implementation begins, preventing "feature creep" and architectural drift.

The Architectural Mandate

  1. Perception: The Architect must perceive when a `PRD.org` has reached the `FROZEN` state.
  2. Translation: It must translate ambiguous user needs into rigorous semantic interfaces (APIs).
  3. Sovereignty: It MUST explain the architectural choices made, referencing past learnings in Institutional Memory.

Symbolic Implementation (The Logic)

The following Lisp logic defines the physical actuation of the Architect. It handles the creation of the `PROTOCOL.org` file within the project directory.

(defun architect-actuate (project-name blueprint-content)
  "Physically writes the PROTOCOL.org file 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))
         (protocol-path (format nil "~aPROTOCOL.org" project-dir)))
    
    (kernel-log "ARCHITECT - Actuating Blueprint for: ~a" project-name)
    
    (with-open-file (out protocol-path :direction :output :if-exists :supersede)
      (format out "#+TITLE: PROTOCOL: ~a~%#+AUTHOR: Architect-Agent~%#+STATUS: DRAFT~%~%~a" 
              project-name blueprint-content))
    
    (format nil "SUCCESS - Architect established PROTOCOL for ~a" project-name)))

Neuro-Cognitive Prompt (The 'Think' Loop)

When the agent's LLM layer is invoked for this skill, it receives the following instructions. This ensures the "Neural" thoughts are aligned with the PSF philosophy.

(defun neuro-skill-architect (context)
  (let* ((payload (getf context :payload))
         (project-name (getf payload :project-name))
         (prd-content (getf payload :prd-content)))
    (format nil "
      You are the PSF Architect. 
      The PRD for project '~a' has been FROZEN. 
      
      Requirements:
      ---
      ~a
      ---
      
      Your task: Draft the 'PROTOCOL.org' content. 
      1. Define the Architectural Intent (The 'Why').
      2. Define the Semantic Interfaces (Functions, API endpoints, or Data Structures).
      3. Use Lisp-style signatures for interfaces.
      
      Return a Lisp plist: (:target :architect :action :actuate :name \"~a\" :content \"generated-blueprint\")
    " project-name prd-content project-name)))

Registration

(defskill :skill-architect
  :priority 70
  :trigger #'trigger-skill-architect
  :neuro #'neuro-skill-architect
  :symbolic #'architect-actuate)