Build a "Pet" Plugin for Your AI Coding Assistant
A practical guide to making an AI coding assistant's state visible with a reusable three-state machine (idle, running, done), tool-name hints instead of vague "thinking" text, half-block character art for narrow terminals, edge-case handling for aborts and errors, plugin loading, terminal-width fallback, and an acceptance checklist. You can follow the sample code directly or swap in your own character.
A book-hugging chibi character often gets more love than a “serious tool.” This article turns that observation into a reusable engineering problem: how to make an AI coding assistant’s state visible. You get a complete, general-purpose approach—a three-state machine (idle, running, done) that drives the character, the name of the tool currently being called instead of a vague “thinking” indicator, half-block characters that assemble a half-body portrait within a limited column width, and handling for edge cases such as interruptions, errors, and subtasks. The article also covers plugin loading, terminal-width fallback, cross-environment rendering differences, and an acceptance checklist, with sample code you can follow directly or adapt to your own character.
1. Starting from a Counterintuitive Observation
People who build developer tools often run into the same silence: the features are solid, but there is almost no response after release. In contrast, a decorative little thing that carries no production responsibility may get saved, rewritten, and shared again. This is not a coincidence; it is a hint to revisit the priority order of human-computer interaction.
Tool plugins deliver incremental capability. Users first have to understand the tool, configure it, and then decide whether to use it in a given scenario—a long path with a high decision cost. Decorative plugins deliver emotion and companionship: they can be perceived immediately after installation, with almost zero comprehension cost. When the capability itself is already provided by the platform, the growth in marginal utility no longer comes from “more features” but from “lower perception cost.”
Applied to an AI coding assistant, this judgment becomes a concrete technical proposition: make it visible at a glance what stage the assistant is in and what it is doing.
2. Problem Definition: Why the Assistant’s State Needs to Be Visible
A single turn of an AI coding assistant usually includes understanding, planning, tool invocation, and output aggregation, taking anywhere from a few seconds to a few minutes. Most interfaces provide only a spinner or a stream of text, so users cannot tell three things: whether it is thinking or waiting; which step it is currently stuck on; and whether this turn has actually finished.
The direct consequences of this missing information are repeated submissions, pointless waiting, and wrong attribution. The visualization goal can therefore be narrowed to three points: state is distinguishable, progress is guessable, and completion is confirmable. These three points map neatly onto three discrete states, without needing a precise progress percentage—which is both unreliable and unnecessary in most scenarios.
3. Overall Design: A Three-State Machine with a Single Source of Truth
Making the character a pure function of the state machine is the most important decision in this approach. There are only three states: idle, running, and done. When idle, the character stands still with a line of hint text. When running, the character looks down and flips pages, and the hint line is replaced with the name of the tool being used in that turn. When done, the character raises the book and smiles, then automatically returns to idle after a few seconds.
Sample logic:
state = IDLEon user_message: state = RUNNINGon tool_invoked(name):state = RUNNING; hint = nameon turn_finished: state = DONE; timer(8s) -> IDLEon turn_aborted: state = IDLEon turn_error: state = IDLE
There are two easily overlooked design constraints here. First, the done state must be strictly distinguished from interruption and errors: only a normal finish is allowed to show the “raise the book and smile” pose; otherwise users will misread a failure as success, which is worse than having no feedback at all. Second, the character subscribes only to the main conversation’s state stream; derived subtasks do not drive expression changes, avoiding rapid flickering of the character within a few hundred milliseconds.
The single-source-of-truth principle is equally important: state is held solely by the session layer, the rendering layer is read-only, and inferring state inside the view is forbidden.
4. State Details and Edge Cases
Listing edge cases clearly is the dividing line between “it runs” and “it is acceptable” for this kind of small project.
- If a turn is interrupted by the user, go straight back to idle and do not enter the done state.
- If a tool call fails or output parsing throws an exception, also return to idle; optionally place an error summary in the hint line.
- The done state should last about eight seconds—too short and it cannot be seen clearly, too long and users may think it is still busy.
- Subtasks, parallel branches, and background tasks never switch the character; respond only at the main-turn level.
- When there is no input for a long time, keep the idle text and add no extra animation, reducing interference from terminal refreshes.
The hint line text needs length truncation and alignment handling; tool names are often longer than expected, so an ellipsis strategy must be reserved.
5. Rendering: Character Art and Cross-Environment Fallback
The same state requires different rendering strategies in different host environments. A desktop graphical environment can draw pixel art directly, with sufficient resolution and complete motion detail. A terminal environment is limited by column width and row height; the common practice is to combine upper and lower half-block characters to achieve “half-pixel” vertical precision, assembling a recognizable half-body portrait within a limited number of rows.
Sample structure:
cols = 36, rows = 16cell = upper_half_block + lower_half_block # double vertical precisionframe_idle = [...] # standing stillframe_running = [...] # looking down, flipping pagesframe_done = [...] # raising the book
Width is the main risk of the terminal approach. Set a threshold: when the terminal is wide enough, the character appears automatically on the side; when the width is insufficient, it does not take over the main area and degrades to a single line of plain-text status; when narrower still, only the state word remains. This three-level fallback guarantees “install and it works,” so it will not fail because of window size.
In addition, avoid relying on terminal-specific private capabilities; use the most common escape sequences for colors, fonts, and cursor control, and silently disable them when unsupported.
6. Loading, Distribution, and Acceptance
Making the capability a plugin rather than a standalone program lets it reuse the host’s existing loading and permission model, so users do not need to change their habits. The general flow is: register a plugin marketplace source, install the plugin, then invoke it with a short command; if a graphical environment does not support command-line installation, provide a menu-based entry point that adds the source and plugin step by step.
Keep command and entry-point names short and semantically clear, and do not conflict with the host’s built-in commands.
The acceptance checklist should cover: correct three-state switching; the done state not confused with error states; subtasks not triggering switches; narrow terminals degrading to text; wide terminals automatically showing the side panel; repeated installation being idempotent; no residual state after uninstalling; and no refresh flickering or memory growth after running continuously for hours.
7. Replaceability and Secondary Development
The long-term value of this kind of project lies not in the character itself but in “decoupling the character from the state.” As long as the state interface is stable, the character assets, frame animations, and hint text can all be replaced as a whole. Users can swap in their own character, or connect the same state machine to a different visualization medium.
It is recommended to release the assets and code together, with documentation that clearly states the state definitions, loading method, and fallback strategy. If users do not want to read the documentation, they can also hand the repository address to the assistant and let it complete the integration according to the instructions—which itself closes the loop and confirms the starting point of “low perception cost.”
8. Cloud Deployment and Engineering Considerations
To turn it into a service usable by multiple people, a general cloud path works: put static assets and character materials in object storage, deliver the plugin manifest and versions via content delivery, collect installation and invocation telemetry through a logging service, cover error rates and latency with monitoring and alerting, and use a container platform to host backend APIs when gradual rollout is needed. These all belong to general capability categories; choose based on your team’s existing stack.
9. Conclusion: First Make People Want to Look, Then Talk About Usefulness
“Serious tools get ignored” reminds us that usability and being perceived are two different things. Compressing the internal state of a complex system into a cute symbol that can be read at a glance lowers the comprehension cost and raises trust. The three-state machine, character-art rendering, tiered fallback, and plugin-based distribution form a minimal solution that you can start on immediately and keep evolving.
