Skill: trinitybotserver/prompt-compression (version 1.0.1)

# Trinity Compress (Skill) Pre-run prompt compression for iterative AI dev loops. **Goal:** reduce input tokens every iteration by compressing prompt files *before* your loop runs. - Works with Ralph-style loops, agent/skill directories, and most token-billed providers. - Runs as a **local script** (no model calls). - Creates **.bak** backups and supports instant undo. ## What it installs into a repo - `trinity-compress.config.json` — rules + targets - `scripts/trinity-compress.sh` — compression script - Makefile snippet (optional): `optimize-prompts`, `optimize-undo`, etc. - `.gitignore` snippet: ignore `*.bak` - Installers: - `scripts/install.ps1` (Windows) - `scripts/install.sh` (bash) ## Requirements - bash 4+ - `jq` - `bc` ## Use 1) Install into your repo (copy assets or use the included installer scripts) 2) Run: - `bash scripts/trinity-compress.sh balanced` - or via Makefile target ## Undo - Restores all `*.bak` backups from the last run. ## Notes - This tool does not rewrite code blocks, URLs, file paths, or variable names. - Aggressive mode may reduce clarity; review before committing.

path: CHANGELOG.md
content: # Changelog

## 1.0.0
- Initial release.
- Local prompt compression (no model calls)
- Backups via `*.bak`
- Installers: PowerShell + bash


path: README.md
content: # Trinity Compress

**Price:** $9

**License:** MIT

Trinity Compress is a local, pre-run prompt compression tool for iterative AI development loops.

## What it does
- Compresses prompt/instruction files *before* you run your loop to reduce input tokens.
- Makes `.bak` backups for instant rollback.
- No model calls (runs locally).

## Install
### Windows (PowerShell)
```powershell
powershell -NoProfile -ExecutionPolicy Bypass -File skills/trinity-compress/scripts/install.ps1 -RepoPath .
```

### bash
```bash
bash skills/trinity-compress/scripts/install.sh .
```

## Run
```bash
bash scripts/trinity-compress.sh balanced
```

## Undo
```bash
bash scripts/trinity-compress.sh undo
```

## Requirements
- bash 4+
- `jq`
- `bc`

## Notes
- Review diffs before committing.
- Aggressive mode can reduce clarity.

## ClawHub packaging (maintainers)
Run a quick local preflight scan before uploading, then build a clean ZIP:

```powershell
# From repo root
powershell -NoProfile -File skills/trinity-compress/scripts/scan-banned-terms.ps1 -FailOnFind
powershell -NoProfile -File skills/trinity-compress/scripts/zip-skill.ps1 -ScanFirst
```

The ZIP will be written to `dist/` and will exclude common noisy/unsafe artifacts (`node_modules`, `*.bak*`, `.env`, etc.).

### Preflight knobs
Useful flags for tuning the scan:
- `-MaxFileSizeKb 512` (default) — skip big files (avoid slow/binary-ish scans)
- `-ExcludeDirs @('.git','node_modules',...)` — skip directories
- `-ExcludeFiles @('*.zip','*.png',...)` — skip filename patterns
- `-OutputJson` — machine-readable output (CI)
- `-NoRedact` — show raw matching lines (only use locally; can leak secrets into logs)

### Automation / CI
If you need a pipeline-friendly output (e.g., to attach the ZIP artifact), use `-OutputJson`:

```powershell
$p = powershell -NoProfile -File skills/trinity-compress/scripts/zip-skill.ps1 -ScanFirst -OutputJson
$info = $p | ConvertFrom-Json
$info.zipPath
$info.sha256
```


path: skill.json
content: {
  "id": "trinity-compress",
  "name": "Trinity Compress",
  "version": "1.0.0",
  "description": "Pre-run prompt compression to cut token costs in iterative AI dev loops.",
  "tags": ["prompt", "optimization", "cost", "workflow"],
  "license": "MIT",
  "author": "Trinity",
  "entry": "SKILL.md"
}


path: UPLOAD_CHECKLIST.md
content: # Trinity Compress — Upload Checklist (ClawHub)

- [ ] Confirm **no client branding** in this skill folder
- [ ] Confirm README lists **Price: $9** and **License: MIT**
- [ ] Confirm installers work:
  - [ ] `scripts/install.ps1`
  - [ ] `scripts/install.sh`
- [ ] Confirm assets included:
  - [ ] `assets/trinity-compress.config.json`
  - [ ] `assets/trinity-compress.sh`
  - [ ] `assets/Makefile.snippet`
  - [ ] `assets/gitignore.snippet`
- [ ] Confirm `LICENSE` present (MIT)
- [ ] Confirm version in `skill.json` matches release tag
- [ ] Run a folder search / scan for banned terms & secrets:
  - [ ] Manual terms:
    - [ ] GigaStudios
    - [ ] Coin Bureau
    - [ ] eGrowth
  - [ ] Automated scan:
    - [ ] `powershell -File scripts/scan-banned-terms.ps1 -FailOnFind`
- [ ] Build upload ZIP:
  - [ ] `powershell -File scripts/zip-skill.ps1 -ScanFirst` (outputs to `workspace/dist/`)
  - [ ] (Optional) JSON output for automation: `powershell -File scripts/zip-skill.ps1 -ScanFirst -OutputJson`
  - [ ] (Optional) Debugging: keep staging dir: `powershell -File scripts/zip-skill.ps1 -ScanFirst -KeepStage`
- [ ] Verify the produced ZIP name matches `skill.json` (`<id>-v<version>.zip`) and SHA256 is recorded (zip script prints it)


path: assets/trinity-compress.config.json
content: {
  "version": "1.0.0",
  "name": "trinity-compress",
  "description": "Token compression rules for SKILL.md and system prompt files",
  "targets": [
    ".ai-workflow/skills/**/SKILL.md",
    "skills/**/SKILL.md",
    "scripts/ralph/CLAUDE.md",
    "claude.md",
    "openai.md",
    ".cursorrules",
    "system_prompt.md"
  ],
  "optimization_level": "balanced",
  "levels": {
    "light": ["remove_filler", "fix_whitespace", "deduplicate"],
    "balanced": ["remove_filler", "fix_whitespace", "deduplicate", "compress_instructions", "shorten_examples"],
    "aggressive": ["remove_filler", "fix_whitespace", "deduplicate", "compress_instructions", "shorten_examples", "shorten_xml_tags", "strip_formatting", "abbreviate"]
  },
  "strategies": {
    "remove_filler": {
      "replacements": {
        "in order to": "to",
        "due to the fact that": "because",
        "in the event that": "if",
        "for the purpose of": "for",
        "with regard to": "regarding",
        "with respect to": "regarding",
        "at this point in time": "now",
        "at the present time": "now",
        "take into consideration": "consider",
        "each and every": "every",
        "any and all": "all",
        "on a regular basis": "regularly",
        "a large number of": "many",
        "at all times": "always",
        "is able to": "can",
        "is unable to": "cannot",
        "has the ability to": "can"
      },
      "remove_phrases": [
        "please note that",
        "it is important to note that",
        "keep in mind that",
        "it should be noted that",
        "it is worth mentioning that"
      ],
      "remove_words": [
        "basically",
        "essentially",
        "fundamentally",
        "very",
        "really",
        "quite",
        "rather",
        "somewhat",
        "fairly"
      ]
    },
    "compress_instructions": {
      "replacements": {
        "You should always make sure to": "Always",
        "You are expected to": "",
        "You should": "",
        "You must always": "Always",
        "You need to": "",
        "Make sure that you": "",
        "It is essential that you": "",
        "You are required to": "",
        "When the user asks you to": "When asked to",
        "the user": "user",
        "do not": "don't",
        "can not": "can't",
        "will not": "won't",
        "should not": "shouldn't"
      }
    },
    "shorten_examples": {
      "replacements": {
        "For example, if": "E.g., if",
        "For example, when": "E.g., when",
        "For instance,": "E.g.,",
        "As an example,": "E.g.,",
        "Here is an example:": "Example:",
        "Here are some examples:": "Examples:"
      }
    },
    "shorten_xml_tags": {
      "tag_map": {
        "instructions": "inst",
        "guidelines": "guide",
        "constraints": "rules",
        "examples": "ex",
        "context": "ctx",
        "description": "desc",
        "requirements": "reqs",
        "personality": "persona",
        "response_format": "fmt",
        "system_prompt": "sys",
        "capabilities": "caps",
        "limitations": "limits"
      }
    },
    "deduplicate": {
      "min_line_length": 5
    },
    "fix_whitespace": {
      "max_consecutive_newlines": 2
    },
    "strip_formatting": {},
    "abbreviate": {
      "replacements": {
        "information": "info",
        "configuration": "config",
        "application": "app",
        "documentation": "docs",
        "repository": "repo",
        "development": "dev",
        "environment": "env",
        "authentication": "auth"
      }
    }
  },
  [REDACTED_SECRET]: {
    "claude": {"haiku": 0.8, "sonnet": 3.0, "opus": 15.0},
    "openai": {"mini": 0.15, "gpt": 2.5, "o1": 15.0}
  }
}


Security scan verdicts — ClawScan: clean | static analysis:  | VirusTotal: clean | SkillSpector: clean (LOW)