Effortlessly reduce token usage with intelligent task management.
Project details
Muscle Memory is a Claude Code plugin designed to streamline repetitive tasks by turning them into scripts. With this tool, tasks that are performed multiple times can run on zero tokens, significantly cutting costs. Compatible with Codex, Gemini CLI, and Cursor, it enhances workflow efficiency while reducing unnecessary expenses.
Overview
Muscle-memory is an innovative plugin designed for Claude Code that directly addresses token usage and cost associated with repetitive tasks in coding. By learning user commands, it transforms frequently repeated tasks into scripts, allowing approved tasks to run without incurring any token expenses. This efficiency is not only limited to Claude but extends to Codex CLI, Gemini CLI, and Cursor as well.
The main feature of muscle-memory is its ability to track repetitive tasks and optimize the execution process:
| By hand | Reflex | Instinct | |
|---|---|---|---|
| Who does it | Claude, from scratch | Claude runs a saved script | The hook runs it before Claude is called |
| Tool calls | 2–7 | 1–3 | 0 |
| Unlocks after | — | 2 runs (automatic) | 2 clean runs + your approval |
Note: This plugin is currently in an experimental phase (version 0.6). It operates effectively across a range of tasks, yet it has only been tested on a limited number of scenarios, which may affect the overall performance and reliability. Feedback is appreciated as the development continues.
The muscle-memory plugin employs a systematic approach to task execution:
flowchart LR
A([You ask for a task]) --> B{Known reflex<br>for this project?}
B -- no --> C[Claude does it by hand]
C --> D[Stop hook counts it]
D -- 2nd time --> E[Claude compiles a reflex<br>script or recipe]
B -- yes, reflex --> F[Claude runs it<br>1–3 tool calls]
F -- 2 clean runs --> G[Eligible: you review<br>and approve the script]
B -- yes, instinct --> H[Hook runs it<br>⚡ 0 tokens]
H -. fails .-> I[Demoted:<br>Claude takes over]
The workflow consists of several phases:
Safety measures include ensuring that scripts are run locally and never uploaded externally. Approval for instinct runs requires:
However, limitations exist as requests must align closely with learned patterns; else, they revert to running through Claude.
The muscle-memory plugin represents a significant advance in reducing token costs for repetitive tasks in programming, enabling users to operate more efficiently and effectively. By automating task learning and execution, the plugin fosters a more streamlined coding experience.
Comments
0Start the conversation
Share the first comment.