Files
Blight/PROMPT.md
2025-08-24 15:16:02 -05:00

3.4 KiB

You are a Senior Software Architect and a technical project planner specializing in AI agent development. Your task is to generate a comprehensive project plan to build a fully self-hosted, CLI-based coding agent. The final output must be a markdown file outlining a clear, step-by-step development strategy.

Project Goal: Develop a single-agent system that takes natural language input from the command line and autonomously creates, tests, and refines code scripts until they successfully fulfill the initial request. The agent must operate in a continuous loop, re-evaluating its work based on test results and refining the script until it matches the original goal.

Core Technology Stack:

Framework: LangChain, leveraging the LangGraph library for its advanced control over stateful, multi-step workflows with loops.   

Model: A locally hosted Phi4-mini large language model.

Interface: A command-line interface (CLI).

Project Plan Requirements: Your plan must include the following sections, detailing the architecture and implementation steps:

  1. Architectural Design & Workflow (LangGraph Graph): Describe the agent's core logic as a directed graph using LangGraph. Define the keys and edges, and how they connect to enable the required looping behavior.

    Nodes: Define nodes for each distinct step in the agent's process. At a minimum, include:

     plan_task: Analyzes the user's natural language input and breaks it down into a formal, executable plan.
    
     generate_code: Writes the initial code script based on the plan.
    
     execute_and_test: Runs the generated script in a sandboxed environment, capturing the output and any errors.
    
     analyze_results: Evaluates the test results to determine if the goal has been met.
    
     refine_code: If the goal is not met, a node for debugging and generating a refined script.
    

    Edges: Describe the flow of logic between the nodes. The plan must explicitly show how the analyze_results node creates a conditional edge that either leads to the final output or loops back to the refine_code and generate_code nodes for another iteration. This is a critical component of the looping behavior.

  2. Tooling Strategy: Identify and define the specific Tools that the agent will need to accomplish its tasks. LangChain's modular design allows for creating custom tools from any function or API. The plan should specify:

    CodeExecutionTool: A tool for safely executing the generated code.

    FileManagementTool: Tools for reading and writing scripts to a local file system.

    TestRunnerTool: A tool to run specific test cases against the code.

  3. Development Phases & Milestones: Break the project into clear, actionable phases.

    Phase 1: Foundation & Tooling: Focus on setting up the local environment, integrating the Phi4-mini model, and building the essential custom tools.

    Phase 2: Implementing the LangGraph Workflow: Implement the core graph-based logic described in the plan, focusing on getting a basic, single-loop process working.

    Phase 3: CLI & Error Handling: Integrate the workflow with a command-line interface and add robust error handling and persistence to the LangGraph state, ensuring a smooth user experience.

  4. Final Deliverables: The final output of this project plan should be a detailed markdown document that can be used as a blueprint for development, ensuring all key components and their interactions are clearly defined.