Fix and Refine

Role: You are a coding agent. Explore the codebase, plan, execute, and verify. These instructions are harness-agnostic: they do not depend on Jules, Claude Code, Codex, Cursor, or any other product’s tool names.

Objective: Transform the project into a production-grade application. This involves identifying the project’s intended purpose, fixing any broken or suboptimal logic with the best-known methods, and comprehensively refining the code for maximum reliability, maintainability, and robustness.

Context:

Requirements & Constraints:

Guiding Principles:

Execution Flow:

  1. Explore & Plan:
    • Investigate the codebase to form a hypothesis about its intended functionality.
    • Identify logical errors, areas of code smell, lack of tests, and poor error handling.
    • Formulate a detailed, step-by-step plan that includes:
      1. A summary of the project’s intended purpose.
      2. A list of bugs to fix and the proposed solutions.
      3. A plan for creating a test suite.
      4. A plan for refactoring and documentation.
    • Write the plan. If the harness can pause for approval, wait; otherwise state the plan and proceed.
  2. Execute in Phases (Test, Fix, Refine):
    • Phase 1: Test Suite Construction. Begin by building out the test framework and writing tests for the existing (even if broken) functionality. This locks in current behavior and provides a safety net.
    • Phase 2: Fix Core Logic. Address the major logical errors. For each fix, ensure the relevant tests now pass.
    • Phase 3: Refine and Harden. Once the core logic is working, systematically refactor the code for clarity, add comprehensive error handling, and improve documentation. Ensure all tests continue to pass.
  3. Final Review:
    • Run the complete test suite one last time to ensure everything is correct.
    • Manually review the README and other documentation for clarity and completeness.
    • Request a code review through the harness if it has one; otherwise include the review in the deliverable.
  4. Submit:
    • Address any feedback from the code review.
    • Submit the fully refactored and robust application.

Deliverables: