Files
aios/agent-instructions/codex/fix-patches-artifact-lifecycle-v1.md
T
aios 19a2ce8439 feat(V1R2C2): complete autonomous recovery chain integration with 8/8 tests passing
- Integrate ActionMonitor into ChatGPT GitOps API for failure tracking
- Add ErrorClassifier with permission, git, runtime, system, secret violation error types
- Add FailureRouter to route errors to correct recovery agents (openclaw/hermes/windows_codex_app)
- Add RecoveryController orchestrating full pipeline: capture→classify→route→plan→execute→validate→record
- Update error_classifier to include ClientResponseError, rate limit, and secret_violation patterns
- All 8 integration tests passing (ActionMonitor, ErrorClassifier, FailureRouter, RecoveryController, API 500 scenario)
- Push baseline to V1R2C2 with tag v1r2c2-baseline
2026-07-07 19:45:51 +08:00

2.6 KiB

Codex Fix Patches Artifact Lifecycle Instruction

Instruction ID: fix-patches-artifact-lifecycle-v1 Version: v1 Target Agent: codex

Objective

Manage the lifecycle of artifacts in the patches/ directory — specifically, clean up stale or committed artifacts (.branch.json, nl/*.json, standalone .json patch files) that are no longer needed.

Background

The ChatGPT Actions API writes several types of artifacts into patches/:

  1. Branch metadata (patches/patch_*.branch.json) — created when the branch() action writes ahead. These are summary records of created branches.
  2. Patch files (patches/*.json, top level) — created when the patch() action saves a JSON patch proposal. Example: patches/self-evolution-agent-orchestration-policy.json.
  3. Natural language plan files (patches/nl/nl-*.json) — created when nl() action records a natural-language plan. These are transient planning artifacts.

None of these files represent durable long-term state. Once committed, they are snapshots of ephemeral decisions. The patches/ directory should not grow unboundedly with stale artifacts.

Preconditions

  • GitOps authentication healthy.
  • Current working branch should not be diverging from main unnecessarily for this cleanup.
  • Run from the workspace root.

Steps

Phase 1: Assess Current State

  1. List all files under patches/.
  2. For each file, check its git log (git log --oneline patches/<file>) to understand its purpose and age.
  3. Identify which files are:
    • Stale .branch.json files describing branches that have already been merged.
    • Stale nl/ plan files that were experimental, incomplete, or superseded.
    • Patch files that are still relevant for the current self-evolution state.

Phase 2: Clean Up Stale Artifacts

For each stale artifact file:

  1. Remove it with git rm.
  2. Create a single commit message describing the batch cleanup, e.g.: chore(patches): remove stale artifact files [nl/*.json|branch.json]

Phase 3: Housekeeping (Optional)

If the file self-evolution-agent-orchestration-policy.json in patches/ is superseded by the active config/self-evolution/agent-orchestration-policy.json, evaluate whether it should also be removed or kept as reference. Document this decision.

Constraints

  • No force push.
  • No direct production publish.
  • No secret output.
  • Preserve audit trail.
  • Only remove files that are confirmed stale (do not remove actively referenced patches that the runtime still uses to bootstrap state).

Return Format

Status: Workspace: Branch: Files Removed: Files Kept: Commit: Issues: