Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .claude-plugin/marketplace.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
},
"metadata": {
"description": "Local marketplace for the compact-plus plugin.",
"version": "1.0.0"
"version": "1.0.1"
},
"plugins": [
{
"name": "compact-plus",
"description": "Preserve Claude Code session state before and after context compaction.",
"version": "1.0.0",
"version": "1.0.1",
"author": {
"name": "u1"
},
Expand Down
2 changes: 1 addition & 1 deletion .claude-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://json.schemastore.org/claude-code-plugin-manifest.json",
"name": "compact-plus",
"version": "1.0.0",
"version": "1.0.1",
"description": "Preserve Claude Code session state before and after context compaction.",
"author": {
"name": "u1"
Expand Down
19 changes: 19 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,22 @@ Claude Code context compaction.
- Hooks must fail open and must not block compaction.
- Do not write machine-specific absolute paths into git-tracked files.
- Use `${CLAUDE_PLUGIN_ROOT}`, `${HOME}`, `${TMPDIR:-/tmp}`, and repository-relative paths.

## Version bump policy

Every commit must bump the plugin version, following semver. Commits without a
version bump are not allowed. Keep the following three slots in sync at the
same value β€” the `Check version consistency` step in `.github/workflows/test.yml`
enforces this and will fail CI on any mismatch:

1. `.claude-plugin/plugin.json` (`version`)
2. `.claude-plugin/marketplace.json` (`metadata.version`)
3. `.claude-plugin/marketplace.json` (`plugins[0].version`)

| Change type | Bump | Example |
|-------------|------|---------|
| Bug fix, display tweak, refactor, docs | patch (1.0.0 β†’ 1.0.1) | Fix a silent hook failure, small README edit |
| New feature, new skill, extension of existing behavior | minor (1.0.0 β†’ 1.1.0) | Add a new hook, extend the `/compact-plus` skill |
| Breaking change, incompatible skill / hook I/O change | major (1.0.0 β†’ 2.0.0) | Incompatible shared-state file format change |

When in doubt, prefer patch.
12 changes: 8 additions & 4 deletions hooks/precompact-transcript-backup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,13 @@ EPOCH=$(date +%s)
DEST="$BACKUP_DIR/${EPOCH}-${SESSION_ID}.jsonl"
cp "$TRANSCRIPT_PATH" "$DEST" 2>/dev/null || exit 0

mapfile -t OLD_BACKUPS < <(find "$BACKUP_DIR" -maxdepth 1 -type f -name "*-${SESSION_ID}.jsonl" -print 2>/dev/null | sort -r | tail -n +21)
if [[ ${#OLD_BACKUPS[@]} -gt 0 ]]; then
rm -f "${OLD_BACKUPS[@]}" 2>/dev/null || true
fi
# mapfile is a bash 4+ builtin and stock macOS /bin/bash is 3.2, so use a
# POSIX while-read loop to prune old backups instead.
find "$BACKUP_DIR" -maxdepth 1 -type f -name "*-${SESSION_ID}.jsonl" -print 2>/dev/null \
| sort -r \
| tail -n +21 \
| while IFS= read -r old; do
rm -f "$old" 2>/dev/null || true
done

exit 0