Skip to content

SigMap + Repomix

Two tools, two layers, one strategy. SigMap keeps signatures always fresh. Repomix provides full-depth context for complex sessions. You need both.

"SigMap for daily always-on context; Repomix for deep one-off sessions — use both."

Different tools, different jobs

Each tool is optimised for a specific workflow. They stack, not compete.

sigmap — Always-on signatures

Runs automatically on every save and every commit. Extracts function and class signatures from 21 languages. Writes a compact context file under 4K tokens that every AI coding agent reads at session start.

  • Automatic — zero manual steps after --setup
  • Under 4,000 tokens for any codebase
  • Signatures only — shapes, not bodies
  • Secret scanning before every write
  • MCP server for on-demand module pulls
  • Self-healing CI — auto-regenerates on drift

repomix — Deep session context

Packs your entire codebase into a single XML or Markdown file using token-efficient compression. Purpose-built for deep one-off sessions where the agent needs full file contents, not just signatures.

  • Manual — run when you need full depth
  • Full file contents, compressed
  • XML or Markdown output format
  • Broader language support via Tree-sitter
  • Repomix Cloud for team sharing
  • 15,000+ GitHub stars, active community

See: github.com/yamadashy/repomix

Together they cover every workflow

SigMap handles the 90% — daily coding sessions where you need fast, always-fresh context. Repomix handles the 10% — architectural decisions, large-scale refactors, and debugging sessions that need every line.

sigmap (daily)  +  repomix (deep sessions)  =  full coverage

The two-layer caching strategy

Stack both tools for maximum token and cost efficiency.

Layer 1 — Stable Repomix prefix (cached)

Run Repomix once at the start of a deep session. The compressed codebase becomes a stable prefix in the prompt. Using Anthropic's cache_control breakpoints (or OpenAI's equivalent), this prefix is computed once and reused across every request in the session. The codebase rarely changes within a single session — cache hit rate is typically 95%+.

Tags: repomix --compress · cache_control: ephemeral · 60% cost reduction

Layer 2 — Fresh SigMap signatures (dynamic)

SigMap regenerates on every save. Its compact signature output sits above the Repomix prefix and tells the agent which files changed since the session started. The signatures identify where to look; the cached Repomix context provides the depth. Under 4K tokens, always fresh, always accurate.

Tags: node gen-context.js --watch · < 4K tokens · always fresh

Combined workflow

bash
# Session start — run once
npx repomix --compress --output .context/repomix.md
# [repomix] packed 247 files → 28,400 tokens (compressed)

# Always running — background watcher
node gen-context.js --watch &
# [sigmap] watching src/ app/ lib/ ...

# Query with both layers
cat .context/repomix.md .github/copilot-instructions.md \
  | claude --cache "Fix the UserService.findById bug"

# Result: 28,400 tokens cached (L1) + 3,847 tokens fresh (L2)
# L1 cache hit rate: 97%  ←  pay once per session
# L2 tokens: 3,847        ←  always current
# Effective cost: -76% vs uncached full context

Which tool for which task

TaskUseWhy
Daily coding sessionsigmapAuto-updated signatures are enough for navigation and autocomplete context
Fix a specific bugsigmapMCP search_signatures finds the relevant files in <200 tokens
Add a feature to existing codesigmapSignatures show the interface; bodies aren't needed to extend
Architecture reviewrepomixAgent needs full file contents to reason about system design
Large-scale refactorbothRepomix for full depth, SigMap to track what changes in real-time
Onboarding a new codebasebothRepomix for full understanding, SigMap to keep the session lean
CI token budget checksigmap--report --json outputs machine-readable stats for CI dashboards
Sharing context with a teamrepomixRepomix Cloud handles team sharing; SigMap output goes in git
Security auditsigmapSecret scanning redacts credentials before any output is written

Prompt cache payload

Use node gen-context.js --format cache to generate the Anthropic cache_control JSON structure. The stable signatures become a cached prefix — pay once, reuse across every request.

json
{
  "messages": [
    {
      "role": "user",
      "content": [
        {
          "type": "text",
          "text": "# Code signatures\n\n## src/api/users.ts\nexport class UserService\n  async findById(id: string): Promise<User>\n...",
          "cache_control": { "type": "ephemeral" }
        },
        {
          "type": "text",
          "text": "Fix the race condition in UserService.findById"
        }
      ]
    }
  ]
}

Cache economics on a 100-request session

CountCost
Cache writeFull cost
Cache reads99×10% cost
Session saving-60% API cost

One ignore file for both tools

The .contextignore file uses the same gitignore syntax as .repomixignore. Symlink them to maintain a single exclusion list for both tools.

bash
ln -s .contextignore .repomixignore

.contextignore:

bash
# SigMap exclusions
node_modules/
dist/
build/
*.generated.*
*.pb.*
coverage/
*.test.*
*.spec.*

.repomixignore (symlink) — same exclusion list, both tools respect it.


Made in Amsterdam, Netherlands 🇳🇱

MIT License