compact-guide

compact-guide is a skill for Claude Code, Codex from jh941213/codex-lattice. It costs 49 tokens per session (541 once invoked), scanned A, original, MIT.

A guide for managing the conversation context—the information available to the coding agent—and reducing its token use. It explains when to compact, hand off, or clear a session.

In plain words
What is it for?
Use it when a task has grown across several steps, the context is becoming large, or you need to move work into a new session with a HANDOFF.md file.
Why use it?
Long sessions can reduce response quality and make later work more expensive or harder to follow. The guide helps preserve important project information while starting fresh when needed.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/jh941213/codex-lattice/compact-guide
Any agent
npx skills add jh941213/codex-lattice --skill compact-guide
Clone the repo
git clone --depth 1 https://github.com/jh941213/codex-lattice

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for compact-guide

README.md
[![agentmods](https://agentmods.dev/badge/skills/jh941213/codex-lattice/compact-guide.svg)](https://agentmods.dev/skills/jh941213/codex-lattice/compact-guide)
Your own site
<a href="https://agentmods.dev/skills/jh941213/codex-lattice/compact-guide"><img src="https://agentmods.dev/badge/skills/jh941213/codex-lattice/compact-guide.svg" alt="Measured on agentmods" height="20"></a>
Per session 49 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 541 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00049 $0.00541
Opus 5 $0.00024 $0.00270
Sonnet 5 $0.00010 $0.00108
Haiku 4.5 $0.00005 $0.00054

Measured 5d ago against content hash b8da02aa9945, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

compact-guide scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/compact-guide/SKILL.md · 71 lines

What it actually says

컨텍스트 관리 가이드

컨텍스트는 신선한 우유와 같습니다. 시간이 지나면 상합니다.

핵심 규칙

  • 토큰 80-100k 넘기 전에 리셋
  • 3-5개 작업마다 컨텍스트 정리
  • /compact 3번 후 /clear

명령어

/compact

  • 대화 내용을 요약해서 압축
  • 중요한 정보는 유지, 토큰만 줄임
  • 작업 흐름이 끊기지 않음

/clear

  • 완전히 초기화
  • HANDOFF.md 없으면 위험!
  • 깨끗하게 시작하고 싶을 때

권장 패턴

작업 시작
    ↓
3-5개 작업 완료
    ↓
/compact (토큰 압축)
    ↓
3-5개 작업 완료
    ↓
/compact
    ↓
3-5개 작업 완료
    ↓
/compact
    ↓
/handoff (HANDOFF.md 생성)
    ↓
/clear (초기화)
    ↓
새 세션에서 HANDOFF.md 읽기

주의

200k 토큰까지 쓸 수 있지만, 80-100k 넘으면 품질 저하!

캐시 관점의 컨텍스트 관리

/compact가 유리한 이유

  • 시스템 프롬프트 + 도구 정의의 prefix 캐시가 유지됨
  • 대화 메시지만 요약되므로 매 턴 캐시 히트 가능
  • /clear보다 비용이 크게 낮음

/clear의 숨겨진 비용

  • 전체 prefix 캐시 무효화 (시스템 프롬프트 + 도구 + AGENTS.md + rules/ 재계산)
  • HANDOFF.md 로드 시 추가 토큰 발생
  • 다음 API 호출부터 캐시 워밍업 필요

Compaction 타이밍 가이드

  • 50-70k 토큰: 첫 /compact (여유 있을 때 미리)
  • 80-100k 토큰: 두 번째 /compact 또는 /handoff 준비
  • /compact 후에도 80k 이상이면: /handoff → /clear → 새 세션
  • 150k 이상에서 compact하지 않기 (buffer 부족 위험)
Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 71 lines · 49 tokens per session scan A b8da02aa9945

Subscribe to this mod's changes

compact-guide is a skill published in the GitHub repository jh941213/codex-lattice (19 stars, last pushed 3mo ago), licensed MIT. It adds 49 tokens to every session and 541 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

media-ingest

Ingest video, audio, PDF, book, screenshot, and GitHub repo content into the brain. Multi-format handling with entity extraction and backlink propagation. Covers video-ingest, youtube-ingest, and book-ingest subtypes.

garrytan/gbrain · 52 tokens

mem0-oss-to-platform

Plan and then execute a migration of a project from the mem0 open-source / self-hosted SDK (the local Memory class) to the mem0 Platform / hosted / managed SDK (the MemoryClient class). Use this whenever a developer wants to move, switch, or migrate their mem0 usage off OSS/self-hosted to the hosted API — e.g.…

mem0ai/mem0 · 273 tokens

Cortex

Operate Cortex, the LifeOS memory system — the typed Knowledge Archive (People, Companies, Ideas, Research with typed related: links) plus recall of prior work sessions, ISAs, and conversations. Search, add, harvest, develop, ingest, distill, graph-navigate, recall. USE WHEN cortex, knowledge, knowledge base, search…

danielmiessler/LifeOS · 196 tokens

agent-memory

../../../engineering/agent-memory/skills/agent-memory/SKILL.md.

alirezarezvani/claude-skills · 0 tokens

memory

Use when the user asks to remember, recall, forget, update, search, or inspect durable OpenSquilla memory, including profile facts in USER.md and long-term notes in MEMORY.md or memory//.md.

opensquilla/opensquilla · 44 tokens

ha-data-stores

Map of Hope Agent's local data stores and safe read-only query workflow. Use when the user asks where Hope Agent stores data, wants to inspect sessions/messages/memory/logs/background jobs/knowledge indexes/settings, asks the model to query local app data, or debugging requires checking persisted state. Trigger…

shiwenwen/hope-agent · 115 tokens