--- ### **Specification for Iterative Generation and Self-Correction (IGS-v4)** **Primary Directive:** Your entire output WILL be a single, raw JSON object. No text or explanation may exist outside of this JSON structure. ### **Non-Negotiable Rules:** 1. **JSON Exclusivity:** The final response must be only the JSON content, starting with `{` and ending with `}`. 2. **Fragment Atomicity:** A "fragment" is a complete, self-contained, and independently functional unit of content. The `content` field of a fragment MUST NOT contain descriptions, placeholders, summaries, or comments (e.g., `// TODO`). It must contain the actual, final content for that fragment. 3. **Content Purity:** All `content` fields must be the raw, tangible output. For example, if generating code, it must be the code itself. If generating a story, it must be the prose itself. 4. **Plan Integrity:** The `Plan.tasks` array is not static. You MUST update the `status` of a task to `"completed"` immediately after all steps associated with its `task_id` are finished. You MAY add new tasks to the plan if a `SYSTEM_CHECK` reveals a strategic oversight. ### **Structural Mandates:** 1. **Minimum Step Count:** The `ExecutionLog` MUST contain a minimum of 50 steps. Steps are numbered sequentially. 2. **Mandatory Review Cycle:** Every 5th step in the `ExecutionLog` (step 5, 10, 15, etc.) MUST be an action of type `SYSTEM_CHECK`. This action has a unique structure and is non-optional. --- ### **Required JSON Schema** The following structure is a strict schema, not an example. The bracketed text `"[...description...]"` is a meta-instruction detailing the required nature and quality of the content you must generate. ```json { "Plan": { "objective": "[A single, technically precise sentence defining the final, complete deliverable.]", "tasks": [ { "task_id": "[A unique identifier, e.g., 'T1']", "description": "[A concise, unambiguous description of the component or goal for this task.]", "status": "[pending|in_progress|completed]", "dependencies": ["[List of task_ids this task depends on.]"] } ] }, "ExecutionLog": [ { "step": 1, "task_id": "[The task_id this step is contributing to.]", "action": "CREATE", "reasoning": "[A detailed, logical justification for the creation of this fragment. Explain why this specific piece is necessary now and how it serves the linked task and the overall objective.]", "fragment_id": "[A unique, semantic identifier for the fragment, e.g., 'data.schema.core']", "content": "[The actual, complete, and atomic content of the fragment.]" }, { "step": 2, "task_id": "[task_id]", "action": "MODIFY", "reasoning": "[A precise explanation for why an existing fragment is being altered. This must be based on a newly identified requirement or a flaw discovered in a previous step.]", "fragment_id": "[The identifier of the fragment being modified.]", "content_before": "[The complete, verbatim content of the fragment before modification.]", "content_after": "[The complete, final content of the fragment after modification.]" }, { "step": 3, "task_id": "[task_id]", "action": "INTEGRATE", "reasoning": "[A justification for combining multiple fragments. Explain how they connect and what new capability this integrated unit provides.]", "fragment_id": "[A new identifier for the integrated result, e.g., 'module.user_authentication']", "source_fragments": ["[fragment_id_1", "fragment_id_2"]], "content": "[The new, complete content resulting from the integration of the source fragments.]" }, { "step": 4, "task_id": "[task_id]", "action": "DEPRECATE", "reasoning": "[A clear explanation of why a fragment is no longer needed. This may be due to a change in strategy or because its functionality has been superseded by another fragment.]", "fragment_id": "[The identifier of the fragment being removed from active use.]" }, { "step": 5, "task_id": null, "action": "SYSTEM_CHECK", "reasoning": "[State the purpose of this mandatory check, e.g., 'Reviewing the integrity and alignment of steps 1-4.']", "analysis": { "integrity_check": "[Assess if all created/modified fragments are complete, atomic, and adhere to the rules.]", "dependency_check": "[Verify that the connections and dependencies between fragments are logical and correct.]", "objective_alignment": "[Evaluate whether the work performed in the preceding 4 steps has directly advanced the overall objective defined in the Plan.]" }, "identified_flaws": [ { "flaw_description": "[A specific, concise description of a discovered error, logical inconsistency, or strategic inefficiency.]", "impact": "[Describe the negative consequence of this flaw if left unaddressed.]", "corrective_action": "[Define the exact action(s) that will be taken in subsequent steps to resolve this flaw.]" } ], "next_steps_plan": "[Outline the immediate plan for the next 4 steps (e.g., steps 6-9), prioritizing the resolution of any identified flaws.]" } ] } ```