Skip to content
Back to skills

Common Context Optimization

ASecurity

Use a rolling-state compaction strategy. At 30 turns, the conversation has passed the skill's recommended compaction interval, so do not keep the full dialogue as the working context. Create a compact project-state record containing: ```yaml Current_State: Goal: "the original user goal, stated precisely" Active_Task: "what the agent is doing now" Status: "current progress or blocker" Key_Decisions: ["decisions that still constrain the solution"] Current_Errors: ["unresolved errors only"] Acti...

  • 584 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 5, 2026
developmentgo

Security analysis

A100/100

Pro scans all 11 files and shows the line behind each finding

Scanned September 5, 2026

npx -y skills add HoangNguyen0403/agent-skills-standard --skill common-context-optimization --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Common Context Optimization?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Common Context Optimization
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/hoangnguyen0403-common-context-optimization-91cc3d87/badge)](https://www.skillsdirectory.com/skills/hoangnguyen0403-common-context-optimization-91cc3d87)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
Use a rolling-state compaction strategy. At 30 turns, the conversation has passed the skill's recommended compaction interval, so do not keep the full dialogue as the working context.

Create a compact project-state record containing:

```yaml
Current_State:
  Goal: "the original user goal, stated precisely"
  Active_Task: "what the agent is doing now"
  Status: "current progress or blocker"
  Key_Decisions: ["decisions that still constrain the solution"]
  Current_Errors: ["unresolved errors only"]
  Active_Files: ["files that matter to the current task"]
  Next_Steps: ["the next concrete actions"]
```

Summarize recursively instead of repeatedly appending summaries to the old transcript: summarize turns 1–5 into `State_A`, combine `State_A` with turns 6–10 into `State_B`, and continue in blocks. Discard the superseded dialogue and prior state after each successful compaction. Keep the original system prompt and the last three messages uncompressed so the governing instructions and immediate context remain exact.

The state should preserve facts and decisions, not conversation wording. Remove chit-chat, intermediate tool calls, and assumptions that were corrected. If a large tool result occurred, first extract its actionable facts and replace it with a semantic placeholder rather than carrying the raw output forward.

After compaction, continue with append-only history. Repeat compaction every 10 turns or about 8,000 tokens, and refresh the `Goal` and `Next_Steps` fields each time. This gives the agent a small, stable representation of intent and current work instead of relying on a long transcript that gradually buries the goal.

Files in this skill

  • eval-1.baseline.md1.4 KB
  • eval-1.with-skill.md1.7 KB
  • eval-2.baseline.md1.3 KB
  • eval-2.with-skill.md1.6 KB
  • eval-3.baseline.md1.7 KB
  • eval-3.with-skill.md1.7 KB
  • trigger-1.md171 B
  • trigger-2.md162 B
  • trigger-3.md156 B
  • trigger-4.md150 B

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.