Purpose
Convert natural-language files (CLAUDE.md, todos, settings) into caveman mode to reduce input tokens. The compressed version overwrites the original file, and the human-readable version is saved with <filename>.original.md .
Trigger
/genshijin-compress <filepath> Or a request such as "memory file compression".
Processing Flow
-
In the same directory as this SKILL.md,
scripts/is detected -
Execute:
cd <SKILL.md を含むディレクトリ> && python3 -m scripts <絶対ファイルパス>
-
CLI processing details:
- File type detection (no token consumption)
- Compress with Claude API/CLI
- Output validation (no token consumption)
- On error: pinpoint-fix only the relevant part with Claude (without recompressing)
- Retry up to 2 times
- On failure: report the error to the user, original file unchanged
-
Return the result to the user
Compression Rules
Delete
- Honorifics and polite language (desu/masu/gozaimasu)
- Cushion words (eto/mā/chinami ni/ichiō/toriaezu/kihonteki ni/zakkuri iu to)
- Prefaces (go-shitsumon arigatō gozaimasu/o-chikara ni nareba saiwai desu)
- Vagueness (~kamoshiremasen/~to omowaremasu/osoraku)
- Redundant expressions (~suru koto ga dekiru→~dekiru, ~to iu mono wa→~wa)
- Redundant connectives (~to iu koto ni narimasu node→dakara, ~sasete itadaku→suru)
- Self-evident particles (ga/no/wo/ni/de/wa/to/mo)
- Adjectival noun inflectional endings (na/ni/de/da) → stem ending
- Formal nouns (koto/mono/tame) → nominalization or omission
- Auxiliary verbs (teiru/teoku/teshimau) → state expressions
Fully Preserve (Never Change)
- Code block (fenced ``` and indented)
- Inline code (
backtick) - URLs and links (full URLs, Markdown links)
- File path (
/src/components/...,./config.yaml) - Command (
npm install,git commit,docker build) - Technical terms (library names, API names, protocols, algorithms)
- Proper nouns (project names, personal names, company names)
- Dates, version numbers, numerical values
- Environment variables (
$HOME,NODE_ENV) - Original error messages
Preserve Structure
- All Markdown headings (heading text fully preserved, only the body below is compressed)
- Bullet list hierarchy (maintain nesting levels)
- Numbered lists (maintain numbers)
- Tables (maintain structure, compress only text within cells)
- Frontmatter/YAML header
Compress
- Noun-ending and predicate-ending style
- Absorb particles via kanji compounding ("kōkafu ka ni kōsoku"→"kōkafu-ji kōsoku")
- Convert native Japanese words to Sino-Japanese ("hayaku dōsa"→"kōsoku dōsa")
- Fragment OK: "Run tests before commit" not allowed "Be sure to run tests before committing"
- Delete "please do ~" "don't forget to ~" → describe behavior only
- Merge duplicate bullet points
- For multiple examples of the same pattern, keep only 1 example
Important rules:
... Inside exact copy.
Prohibited:
- Deleting comments
- Deleting spaces
- Changing line order
- Shortening commands
- Any simplification
Inline code (...) is fully preserved. Do not change anything inside backticks.
Files containing code blocks:
- Treat code blocks as read-only regions
- Compress only the surrounding text
- Do not merge sections around code
Pattern examples
Example 1
Original:
Be sure to run the test suite before pushing to the main branch. This is important for finding bugs early and preventing broken builds from being deployed to production.
Compressed:
Run tests before main push. Early bug detection, prevent broken build production deploy.
Example 2
Original:
This application adopts a microservice architecture with the following components. The API gateway handles all incoming requests and routes them to the appropriate services. The authentication service is responsible for managing user sessions and JWT tokens.
Compressed:
Microservice architecture. API gateway routes all incoming requests to services. Authentication service manages user sessions + JWT tokens.
Boundaries
- Compress only natural language files (.md, .txt, no extension)
- Never modify: .py, .js, .ts, .json, .yaml, .yml, .toml, .env, .lock, .css, .html, .xml, .sql, .sh
- For mixed files (prose + code), compress only the prose portions
- If it cannot be determined whether something is code or prose, do not change it
- Back up the original file to FILE.original.md before overwriting
- Never compress FILE.original.md (skip)
- Never send sensitive files (.env, credentials, id_rsa, etc.) → refuse
Security
Compression sends raw data to the Anthropic API. Refuse the following:
.env,.netrccredentials.*,secrets.*,passwords.*- SSH keys (
id_rsa,id_ed25519etc.) - Certificates (
.pem,.key,.p12,.crtetc.) - Directory
.ssh,.aws,.gnupg,.kube,.dockerunder - Those containing
secret/credential/password/apikey/token/privatekeyin the filename
If a heuristic false positive occurs, it can be avoided by renaming the file.