# Salacia Gc

> Run Salacia garbage collection — analyze drift patterns, rotate audit logs, merge learned patterns into memory. Use when: 'salacia gc', 'clean salacia', 'salacia refine', 'optimize scope', 'salacia learn'.

- Skill: `2233admin/salacia-gc` (Agent Skill)
- Install (CLI): `npx skillmds@latest add 2233admin/salacia-gc`
- Raw SKILL.md: https://api.skillmd.com/api/skills/2233admin/salacia-gc/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Security
- Author: 2233admin (https://skillmd.com/u/2233admin)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/2233admin/salacia-gc

---


# Salacia GC

Run garbage collection on the Salacia scope enforcement system.

## What to do

Run these three steps in order, reporting results to the user after each:

### 1. Refine — Analyze drift patterns

```bash
node "${CLAUDE_PLUGIN_ROOT}/scripts/gc.mjs" refine
```

Parse the output JSON. Present suggestions in a readable format:

- **overScoped**: Paths in the contract that were never touched → suggest removing
- **underScoped**: Files repeatedly edited out of scope → suggest adding to softAllowedPaths
- **shouldPromote**: Learned overrides ready for promotion → suggest promoting

### 2. Rotate — Clean audit logs

```bash
node "${CLAUDE_PLUGIN_ROOT}/scripts/gc.mjs" rotate
```

Report how many events were archived vs retained.

### 3. Learn — Merge patterns into memory

```bash
node "${CLAUDE_PLUGIN_ROOT}/scripts/gc.mjs" learn
```

Report what task type was detected and how many patterns were merged.

### 4. Ask the user

After presenting all results, ask the user:
- "Apply the refine suggestions to contract.json?" (if any suggestions exist)
- If yes, update `.salacia/contract.json` accordingly:
  - Remove overScoped paths from `allowedPaths`
  - Add underScoped files to `softAllowedPaths`
  - Add shouldPromote files to `softAllowedPaths` (and update learned.json)

## Notes

- GC `auto` mode runs automatically on every SessionStart via hooks
- Manual `/salacia-gc` runs refine + rotate + learn for a full cleanup
- memory.json uses exponential decay (0.9x per GC pass) — old patterns fade naturally
- audit-summary.json aggregates rotated data for long-term analysis

