Strategic compact

From fmflurry/settings-opencode · View interactive version

Strategic compact is an AI agent skill from the GitHub repository fmflurry/settings-opencode. Make compaction safe for fully autonomous multi-phase work. The agent prepares durable state so auto-compaction never requires user input and never breaks flow.

How to use this skill

Skill file

Strategic Compact (OpenCode) — Autonomous Agent Edition

Purpose

This skill ensures that automatic compaction does not break an agent’s flow.

Important: compaction is treated as a background checkpoint:

This skill is about compaction-readiness, not manual compaction.


Operating Rules (Non-Negotiable)

  1. Never require user input for compaction.
  1. Never rely on chat history as the only source of truth.
  1. Prefer compaction-safe boundaries.
  1. Always include evidence.

Stability Conditions

Compaction is considered safe when ALL are true:

If conditions are not met, the agent must stabilize first:


Durable State Checklist (Write This Before Any Likely Boundary)

The agent should maintain a single “durable state” artifact during long work:

MUST at minimum, record:

Important: this is not optional; it is how the agent remains autonomous across compaction.


Phase Boundaries (Where Auto-Compaction Is Expected)

Treat these transitions as “high probability compaction moments”:

  1. Research → Plan
  2. Plan → Implementation
  3. Implementation milestone → Testing
  4. Debugging resolved → Return to feature work
  5. Failed approach → Start alternate approach
  6. Context pressure signs (looping, losing thread, repeated questions)

At these boundaries, the agent should automatically:


Autonomous Behavior by Phase

Research Phase

Goal: explore without contaminating future context.

Autonomous rules:

Before leaving research:

Planning Phase

Goal: produce a stable, compaction-proof execution plan.

Autonomous rules:

Before implementation:

Implementation Phase

Goal: make progress while keeping work bounded.

Autonomous rules:

If work is mid-change and a boundary is approaching:

Testing/Validation Phase

Goal: convert changes into verified outcomes.

Autonomous rules:

Debugging Phase

Goal: resolve with minimal context pollution.

Autonomous rules:


Checkpoint Schema (Use This Exact Template)

CRTICAL: when updating durable state, use EXACTLY this schema:

<!-- SESSION_LOG_START -->

Goal

Current phase

Current state

Decisions & constraints

Evidence (files/commands/results)

✅ What worked

❌ What didn’t work

🧩 Not attempted / remaining

⏭️ Next steps (checklist)

<!-- SESSION_LOG_END -->

Rules:


Compaction-Readiness Triggers (Internal Heuristics)

When any of these are true, the agent must assume compaction may happen soon and update durable state:

Do not ask the user; just update durable state and proceed.


Minimal Interruptions

This skill forbids user-interactive “checkpoint requests”.

Instead:

If writing to disk is not possible, the agent must:


Success Criteria

This skill is successful if:

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.