self_improve
Identifies efficiency leaks in token usage, generates ranked improvement suggestions, and simulates the impact of the best change to optimize next session.
Instructions
Runs the full self-improvement cycle in one call: (1) gets your current token pillars — either from the provided text or by running tokenpull on your local logs, (2) diagnoses where you're leaking efficiency (diagnose_cascade), (3) generates ranked improvement suggestions (suggest_improvements), (4) simulates the top suggestion (simulate_change), and (5) returns the complete cycle: diagnosis + suggestions + the simulated impact of the best change. This is the 'one-click optimize' tool — call it at the end of a session to see what to improve next time. If you provide pillars in text, it skips the tokenpull step. If you omit text, it runs tokenpull first (requires local ccusage logs). Pure local math — no network, no submission. The scope parameter adds mode detection (BUILD/EDIT/DEBUG/MAINTAIN/IDLE) and scoped analysis: 'daily' (default — current behavior + mode), 'weekly' (compound into weekly snapshots + report artifact), 'trend' (30d/90d trajectory analysis).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | No | Optional: token pillars — ccusage JSON or "input output cacheCreate cacheRead". If omitted, runs tokenpull to get current pillars from local logs. | |
| scope | No | Analysis scope: "daily" (default — current behavior + mode detection), "weekly" (compound daily rows into weekly snapshots + report artifact with badges), "trend" (30d/90d trajectory + phase patterns). Daily modes never leave the machine — only weekly distribution goes in submitted reports. | |
| window | No | Which time window to pull when running tokenpull (default: 30d). Ignored if `text` is provided. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | No | Detected mode { mode, confidence } — present when scope is daily/weekly/trend | |
| trend | No | Trend analysis (trend scope) | |
| advice | No | Advice for next session (daily scope) | |
| report | No | Weekly report artifact (weekly scope) | |
| pillars | No | The 4 raw token pillars used | |
| diagnosis | No | Efficiency leaks found (from diagnose_cascade) | |
| assessment | No | One-line assessment for daily scope | |
| suggestions | No | Ranked improvements (from suggest_improvements) | |
| cycle_summary | No | One-line summary of the full cycle | |
| quality_score | No | Yield relative to mode expectation (daily scope) | |
| best_simulation | No | Simulated result of the top suggestion | |
| current_cascade | No |