compact

compact is a skill for Claude Code, Codex from kalpmodi/akira. It costs 60 tokens per session (1,081 once invoked), scanned A, original, MIT.

A context-management workflow for long penetration-testing engagements. Penetration testing is authorized security testing that looks for weaknesses in a system.

In plain words
What is it for?
Use it after completed reconnaissance or exploit phases, when findings grow beyond 30 signals, before starting a new work branch, or when compressing context.
Why use it?
It reduces the amount of old phase output kept in the conversation while preserving certified findings in a session file.

Skill for Claude CodeCodex

Part of the akira plugin — 16 skills shipped together

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

Made for: Claude Code, Codex.

Or install akira, the plugin that ships this one along with the rest of its 16 skills.

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

README.md
[![agentmods](https://agentmods.dev/badge/skills/kalpmodi/akira/compact.svg)](https://agentmods.dev/skills/kalpmodi/akira/compact)
Your own site
<a href="https://agentmods.dev/skills/kalpmodi/akira/compact"><img src="https://agentmods.dev/badge/skills/kalpmodi/akira/compact.svg" alt="Measured on agentmods" height="20"></a>
Per session 60 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,081 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.1 $0.00060 $0.01081
Opus 5 $0.00030 $0.00541
Sonnet 5 $0.00012 $0.00216
Haiku 4.5 $0.00006 $0.00108

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

Security

Grade A, and why

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 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/SKILL.md · 122 lines

How it starts

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

Compact - Context Compaction

Overview

Long engagements burn context fast. This skill compresses completed phase outputs into a single engagement_summary.md without losing any certified intelligence.

Rule: session.json is always the authoritative source of truth. After compaction, the AI re-reads session.json instead of relying on conversation history.


When to Trigger

Auto-trigger at these moments:

  • After completing any full phase (recon, secrets, exploit, zerodayhunt)
  • When session.json signals[] exceeds 30 entries
  • When the user asks explicitly
  • Before spawning a new fork (give the fork a clean context budget)

Steps

  1. Get target:

    TARGET=$1
    SESSION=~/pentest-toolkit/results/$TARGET/session.json
    RESULTS=~/pentest-toolkit/results/$TARGET
    
  2. Identify completed phases:

    ls $RESULTS/interesting_*.md 2>/dev/null
    
  3. For each completed phase - compress to 5 bullet signals:

    Read each interesting_<phase>.md and distill to essential intelligence only:

    RECON SIGNALS (from interesting_recon.md):
    - Live hosts: <N> discovered, key: <most interesting>
    - Tech stack: <comma-separated confirmed tech>
    - WAF: <vendor or null>
    - Key endpoints: <top 3>
    - Hypothesis calibration: H1 <N>%, H2 <N>%
    
    SECRETS SIGNALS (from interesting_secrets.md):
    - Credentials found: <Y/N>, type: <aws_key|jwt|password>
    - Key files: <source locations>
    - Cloud provider confirmed: <Y/N>
    
    EXPLOIT SIGNALS (from interesting_exploit.md):
    - Confirmed findings: <N>, classes: <list>
    - SSRF vectors: <Y/N>, endpoints: <list>
    - Potential findings: <N>
    
  4. Write engagement_summary.md:

    cat > $RESULTS/engagement_summary.md << EOF
    # Engagement Summary: $TARGET
    Compacted: $(date +%Y-%m-%d\ %H:%M)
    Source of truth: session.json
    
    ## Phase Intelligence (Compressed)
    <5-bullet summaries per completed phase>
    
    ## Active Hypotheses
    <from session.json hypotheses[] - all active ones with current probability>
    
    ## Confirmed Findings
    <from session.json report_draft.findings[] - title + severity + status per finding>
    
    ## Open Discovery Queue
    <from session.json discovery_queue[] - surface + priority per item>
    
    ## Signal Summary
    Total signals: <N>
    Critical signals: <list VULN_CONFIRMED + CRED_FOUND entries>
    
    ## Next Recommended Action
    <based on engagement_state and top hypothesis probability>
    EOF
    

Read the full file on GitHub · 122 lines

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 · 122 lines · 60 tokens per session scan A d35440ef0c40

Subscribe to this mod's changes

compact is a skill published in the GitHub repository kalpmodi/akira (21 stars, last pushed 1mo ago), licensed MIT. It adds 60 tokens to every session and 1,081 once invoked, about $0.0003 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.