source-command-latch-compact

A skill that manually saves a compact summary of the current Codex conversation to a project knowledge base. Compaction means replacing a long conversation record with a shorter summary that preserves its useful state.

In plain words
What is it for?
Use it when you ask to run the latch-compact command or want the current session's state recorded for later work.
Why use it?
It helps recover important context when a session becomes too long to keep in full. It also checks that the summary is made from the matching Codex session.

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/open-latch/latch/source-command-latch-compact
Any agent
npx skills add open-latch/latch --skill source-command-latch-compact
Clone the repo
git clone --depth 1 https://github.com/open-latch/latch

Made for: Claude Code, Codex.

Per session 73 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,097 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.00073 $0.01097
Opus 5 $0.00036 $0.00549
Sonnet 5 $0.00015 $0.00219
Haiku 4.5 $0.00007 $0.00110

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

Security

Grade A, and why

source-command-latch-compact 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 2d 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.

.agents/skills/source-command-latch-compact/SKILL.md · 90 lines

How it starts

The opening of the file, as written. The whole thing — 90 lines — stays where its author put it; the contents beside it link to each section on GitHub.

source-command-latch-compact

Use this skill when the user asks to run the migrated source command latch-compact from Codex.

Command Template

Run a compaction pass for the current Codex session against the per-project knowledge base managed by the selected latch checkout.

Use the Codex-specific wrapper. Do not use bin/run_compact_now.sh from Codex: that wrapper is Claude-shaped and may select a ~/.claude/projects transcript. The Codex wrapper resolves the session from the first argument or $CODEX_THREAD_ID, validates the matching ~/.codex/sessions/**/rollout-*.jsonl by session_meta.payload.id, and fails closed when it cannot prove the transcript.

This combines/overwrites the prior session_summary node with the latest state (see src/compactor.py). By default the Codex wrapper uses the Codex-native codex exec summarizer backend. Pass --summarizer claude only when intentionally testing the legacy shared Claude CLI backend.

Steps:

  1. Prefer the current Codex session id from $CODEX_THREAD_ID. If the environment does not expose it, ask the user for the Codex session id and pass it as the first positional argument. Do not infer from Claude transcripts.

  2. Launch the Codex compactor with the Bash tool. Prefer --background --wait unless the user explicitly asks to keep the shell in the foreground or to fire-and-forget:

    latch_home="${LATCH_HOME:-}"
    if [ -z "$latch_home" ] && [ -n "${CLAUDE_KB_HOME:-}" ]; then
      latch_home="$CLAUDE_KB_HOME"
    fi
    if [ -z "$latch_home" ]; then
      search_dir="$PWD"
      while [ "$search_dir" != "/" ]; do
        if [ -f "$search_dir/AGENTS.md" ]; then
          latch_home="$(sed -n 's|.*Follow `\([^`]*\)/README\.md` per-user setup.*|\1|p' "$search_dir/AGENTS.md" | head -n 1)"
          [ -n "$latch_home" ] && break
        fi
        search_dir="$(dirname "$search_dir")"
      done
    fi
    if [ -z "$latch_home" ]; then
      candidate="$(git rev-parse --show-toplevel 2>/dev/null || pwd)"
      if [ -f "$candidate/src/mcp_server.py" ] && [ -d "$candidate/commands" ]; then
        latch_home="$candidate"
      fi
    fi
    if [ ! -x "$latch_home/bin/run_codex_compact_now.sh" ]; then
      echo "Could not find latch checkout; set LATCH_HOME to your latch install." >&2
      exit 1
    fi
    bash "$latch_home/bin/run_codex_compact_now.sh" --background --wait
    

Read the full file on GitHub · 90 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 2d ago First seen · 90 lines · 73 tokens per session scan A 1dd2a315681d

Subscribe to this mod's changes

source-command-latch-compact is a skill published in the GitHub repository open-latch/latch (9 stars, last pushed 3d ago), licensed Apache-2.0. It adds 73 tokens to every session and 1,097 once invoked, about $0.0004 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-31.