:PROPERTIES: :ID: 37f2b59f-4537-4cca-ac7f-5c24b9e2e773 :CREATED: [2026-03-30 Mon 21:16] :EDITED: [2026-04-07 Tue 13:42] :END: #+TITLE: SKILL: Project Foundry Agent (Universal Literate Note) #+STARTUP: content #+FILETAGS: :foundry:scaffolding:system:psf: * Overview The *Project Foundry Agent* is responsible for the physical instantiation of new projects. It automates directory creation, version control initialization, and GTD integration, ensuring every new project adheres to PSF mandates. * Phase A: Demand (PRD) :PROPERTIES: :STATUS: FROZEN :END: ** 1. Purpose Define automated project instantiation behaviors for the PSF. ** 2. User Needs - *Workspace Scaffolding:* Create standard `src/`, `tests/`, `docs/` layout and boilerplate files. - *Version Control:* Initialize Git in new project directories. - *GTD Integration:* Automatically append projects and initial tasks to `gtd.org`. - *Safety:* Prevent overwriting existing projects and log all actions. ** 3. Success Criteria *** TODO Structural Compliance *** TODO GTD Linkage Verification *** TODO Idempotency Check * Phase B: Blueprint (PROTOCOL) :PROPERTIES: :STATUS: SIGNED :END: * Phase B: Blueprint (PROTOCOL) :PROPERTIES: :STATUS: DRAFT :END: ** 1. Architectural Intent The Project Foundry Agent will be implemented as a command-line tool callable with a project name and optional parameters (e.g., programming language). It will leverage existing system tools (e.g., `mkdir`, `git`, `emacsclient`) to perform its tasks. Error handling and logging will be crucial. It should be idempotent, meaning that re-running the agent on the same project should not cause errors or duplication. ** 2. Semantic Interfaces (Lisp Signatures) *** `foundry-create-project` - Purpose: Top-level function to create a new project. - Signature: `(foundry-create-project project-name &key language git gtd)` - Arguments: - `project-name`: String, the name of the project (and base directory). - `language`: Keyword, the programming language paradigm of the project (e.g., `:python`, `:lisp`, `:javascript`). Influences boilerplate content. Defaults to `:generic`. - `git`: Boolean, whether to initialize a Git repository (default: `t`). - `gtd`: Boolean, whether to add the project to the GTD system (default: `t`). - Returns: Symbol, `:success` if the project was created successfully, `:failure` otherwise. - Side Effects: Creates directories, files, a git repo (optionally), and modifies the GTD system (optionally). *** `foundry-create-directories` - Purpose: Creates the standard project directory structure. - Signature: `(foundry-create-directories project-path)` - Arguments: - `project-path`: String, the absolute path to the project directory. - Returns: Boolean, `t` if successful, `nil` otherwise. - Side Effects: Creates `src`, `tests`, and `docs` directories. *** `foundry-create-boilerplate-files` - Purpose: Creates boilerplate files based on the project language. - Signature: `(foundry-create-boilerplate-files project-path language)` - Arguments: - `project-path`: String, the absolute path to the project directory. - `language`: Keyword, the programming language of the project. - Returns: Boolean, `t` if successful, `nil` otherwise. - Side Effects: Creates initial files (e.g., `README.md`, `main.py`, `index.html`). *** `foundry-initialize-git` - Purpose: Initializes a Git repository in the project directory. - Signature: `(foundry-initialize-git project-path)` - Arguments: - `project-path`: String, the absolute path to the project directory. - Returns: Boolean, `t` if successful, `nil` otherwise. - Side Effects: Executes `git init` in the project directory. *** `foundry-add-to-gtd` - Purpose: Adds the project and initial tasks to the GTD system. - Signature: `(foundry-add-to-gtd project-name)` - Arguments: - `project-name`: String, the name of the project. - Returns: Boolean, `t` if successful, `nil` otherwise. - Side Effects: Appends to `gtd.org` using `emacsclient`.