Skip to content

Commit 0e73375

Browse files
chris-yyauclaudehappy-otter
authored
feat: pending instinct TTL pruning and /prune command (anomalyco#725)
* feat: add pending instinct TTL pruning and /prune command Pending instincts generated by the observer accumulate indefinitely with no cleanup mechanism. This adds lifecycle management: - `instinct-cli.py prune` — delete pending instincts older than 30 days (configurable via --max-age). Supports --dry-run and --quiet flags. - Enhanced `status` command — shows pending count, warns at 5+, highlights instincts expiring within 7 days. - `observer-loop.sh` — runs prune before each analysis cycle. - `/prune` slash command — user-facing command for manual pruning. Design rationale: council consensus (4/4) rejected auto-promote in favor of TTL-based garbage collection. Frequency of observation does not establish correctness. Unreviewed pending instincts auto-delete after 30 days; if the pattern is real, the observer will regenerate it. Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <[email protected]> Co-Authored-By: Happy <[email protected]> * fix: remove duplicate functions, broaden extension filter, fix prune output - Remove duplicate _collect_pending_dirs and _parse_created_date defs - Use ALLOWED_INSTINCT_EXTENSIONS (.md/.yaml/.yml) instead of .md-only - Track actually-deleted items separately from expired for accurate output - Update README.md and AGENTS.md command counts: 59 → 60 Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <[email protected]> Co-Authored-By: Happy <[email protected]> * fix: address Copilot and CodeRabbit review findings - Use is_dir() instead of exists() for pending path checks - Change > to >= for --max-age boundary (--max-age 0 now prunes all) - Use CLV2_PYTHON_CMD env var in observer-loop.sh prune call - Remove unused source_dupes variable - Remove extraneous f-string prefix on static string Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <[email protected]> Co-Authored-By: Happy <[email protected]> * fix: update AGENTS.md project structure command count 59 → 60 Co-Authored-By: Claude <[email protected]> * fix: address cubic and coderabbit review findings - Fix status early return skipping pending instinct warnings (cubic anomalyco#1) - Exclude already-expired items from expiring-soon filter (cubic anomalyco#2) - Warn on unparseable pending instinct age instead of silent skip (cubic anomalyco#4) - Log prune failures to observer.log instead of silencing (cubic anomalyco#5) Co-Authored-By: Claude <[email protected]> * fix: YAML single-quote unescaping, f-string cleanup, add /prune to README - Fix single-quoted YAML unescaping: use '' doubling (YAML spec) not backslash escaping which only applies to double-quoted strings (greptile P1) - Remove extraneous f-string prefix on static string (coderabbit) - Add /prune to README command catalog and file tree (cubic) Co-Authored-By: Claude <[email protected]> --------- Co-authored-by: Claude <[email protected]> Co-authored-by: Happy <[email protected]>
1 parent 4f5665c commit 0e73375

5 files changed

Lines changed: 398 additions & 83 deletions

File tree

‎AGENTS.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Everything Claude Code (ECC) — Agent Instructions
22

3-
This is a **production-ready AI coding plugin** providing 28 specialized agents, 116 skills, 59 commands, and automated hook workflows for software development.
3+
This is a **production-ready AI coding plugin** providing 28 specialized agents, 116 skills, 60 commands, and automated hook workflows for software development.
44

55
**Version:** 1.9.0
66

@@ -143,7 +143,7 @@ Troubleshoot failures: check test isolation → verify mocks → fix implementat
143143
```
144144
agents/ — 28 specialized subagents
145145
skills/ — 115 workflow skills and domain knowledge
146-
commands/ — 59 slash commands
146+
commands/ — 60 slash commands
147147
hooks/ — Trigger-based automations
148148
rules/ — Always-follow guidelines (common + per-language)
149149
scripts/ — Cross-platform Node.js utilities

‎README.md‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ For manual install instructions see the README in the `rules/` folder.
212212
/plugin list everything-claude-code@everything-claude-code
213213
```
214214

215-
✨ **That's it!** You now have access to 28 agents, 116 skills, and 59 commands.
215+
✨ **That's it!** You now have access to 28 agents, 116 skills, and 60 commands.
216216

217217
---
218218

@@ -388,6 +388,7 @@ everything-claude-code/
388388
| |-- instinct-import.md # /instinct-import - Import instincts (NEW)
389389
| |-- instinct-export.md # /instinct-export - Export instincts (NEW)
390390
| |-- evolve.md # /evolve - Cluster instincts into skills
391+
| |-- prune.md # /prune - Delete expired pending instincts (NEW)
391392
| |-- pm2.md # /pm2 - PM2 service lifecycle management (NEW)
392393
| |-- multi-plan.md # /multi-plan - Multi-agent task decomposition (NEW)
393394
| |-- multi-execute.md # /multi-execute - Orchestrated multi-agent workflows (NEW)
@@ -1083,7 +1084,7 @@ The configuration is automatically detected from `.opencode/opencode.json`.
10831084
| Feature | Claude Code | OpenCode | Status |
10841085
|---------|-------------|----------|--------|
10851086
| Agents | ✅ 28 agents | ✅ 12 agents | **Claude Code leads** |
1086-
| Commands | ✅ 59 commands | ✅ 31 commands | **Claude Code leads** |
1087+
| Commands | ✅ 60 commands | ✅ 31 commands | **Claude Code leads** |
10871088
| Skills | ✅ 116 skills | ✅ 37 skills | **Claude Code leads** |
10881089
| Hooks | ✅ 8 event types | ✅ 11 events | **OpenCode has more!** |
10891090
| Rules | ✅ 29 rules | ✅ 13 instructions | **Claude Code leads** |
@@ -1140,6 +1141,7 @@ OpenCode's plugin system is MORE sophisticated than Claude Code with 20+ event t
11401141
| `/evolve` | Cluster instincts into skills |
11411142
| `/promote` | Promote project instincts to global scope |
11421143
| `/projects` | List known projects and instinct stats |
1144+
| `/prune` | Delete expired pending instincts (30d TTL) |
11431145
| `/learn-eval` | Extract and evaluate patterns before saving |
11441146
| `/setup-pm` | Configure package manager |
11451147
| `/harness-audit` | Audit harness reliability, eval readiness, and risk posture |

‎commands/prune.md‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
name: prune
3+
description: Delete pending instincts older than 30 days that were never promoted
4+
command: true
5+
---
6+
7+
# Prune Pending Instincts
8+
9+
Remove expired pending instincts that were auto-generated but never reviewed or promoted.
10+
11+
## Implementation
12+
13+
Run the instinct CLI using the plugin root path:
14+
15+
```bash
16+
python3 "${CLAUDE_PLUGIN_ROOT}/skills/continuous-learning-v2/scripts/instinct-cli.py" prune
17+
```
18+
19+
Or if `CLAUDE_PLUGIN_ROOT` is not set (manual installation):
20+
21+
```bash
22+
python3 ~/.claude/skills/continuous-learning-v2/scripts/instinct-cli.py prune
23+
```
24+
25+
## Usage
26+
27+
```
28+
/prune # Delete instincts older than 30 days
29+
/prune --max-age 60 # Custom age threshold (days)
30+
/prune --dry-run # Preview without deleting
31+
```

‎skills/continuous-learning-v2/agents/observer-loop.sh‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,10 @@ trap on_usr1 USR1
173173
echo "$$" > "$PID_FILE"
174174
echo "[$(date)] Observer started for ${PROJECT_NAME} (PID: $$)" >> "$LOG_FILE"
175175

176+
# Prune expired pending instincts before analysis
177+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
178+
"${CLV2_PYTHON_CMD:-python3}" "${SCRIPT_DIR}/../scripts/instinct-cli.py" prune --quiet >> "$LOG_FILE" 2>&1 || echo "[$(date)] Warning: instinct prune failed (non-fatal)" >> "$LOG_FILE"
179+
176180
while true; do
177181
sleep "$OBSERVER_INTERVAL_SECONDS" &
178182
SLEEP_PID=$!

0 commit comments

Comments
 (0)