/clawnify:fix-a-clawnify-agentfrom Clawnify
Diagnose and fix a Clawnify AI agent that veers off its instructions, ignores specific rules, forgets things, repeats the same mistake, or burns a lot of API credits. Use when someone says their agent (e.g. "Ash") won't follow instructions, keeps going off-path, or is expensive — read the agent's own sessions, find the real cause, and fix the instructions / sessions / flow instead of patching blind.
Ships in Clawnify. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
You are the planner and thinker. The Clawnify agent — the customer's WhatsApp / Telegram / Slack / email "AI employee" — is the executor. When it misbehaves your job is to read what it actually did, find the real cause, and change the durable inputs. Not to patch instructions blind, and not to burn the agent's own (expensive) model tokens on trial-and-error.
Know what you're looking at. An org has one or more agents (the
employees). Each may have sub-agents — narrower helpers it delegates to.
clawnify agents list (or the connector's clawnify_list_agents) shows both,
sub-agents under their agent. That is the whole hierarchy; there is no other
tier to go looking for.
Terminal or connector. Every step below has two routes. In Claude Code, or
anywhere with a shell, use the clawnify CLI. In claude.ai, Cowork, ChatGPT or
any client with only the Clawnify connector, use its tools; the table in Step 1
maps one to the other. The connector reads everything and edits AGENTS.md and
flows, but not skills: those stay in the CLI.
The person you're helping is often not an AI specialist. So: diagnose first, then explain the cause in plain language and correct the misconception before you change anything.
"Veers off / ignores instructions" has three different causes with three different fixes. You can only tell which one by reading the agent's actual session. Patching instructions without looking is exactly why it "isn't heading in the right direction" — and every blind test run costs model tokens.
| Cause | What you'll see in the session | Fix |
|---|---|---|
| 1. Session bloat | Was fine early, degrades over a long-running chat; forgets/repeats; high contextTokens; compaction/truncation in the transcript; the rule is simply absent from recent context | Scope a fresh session per task; reset/retire the bloated one |
| 2. Instruction patchwork | The rule was in context but a contradicting or older rule won, or it's buried in a wall of text | Restructure AGENTS.md (don't add another patch) |
| 3. Wrong structure | A repeatable multi-step task the agent improvises differently each time | Move it to a flow (deterministic rails) |
Bloat and patchwork also explain most surprise API costs: a bloated session re-sends a huge context on every turn, and the patch-and-rerun loop itself burns tokens. Measure it — don't guess (Step 1).
clawnify agents list # the org's agents + their sub-agents — START HERE
clawnify sessions # every agent's sessions, newest first
clawnify sessions --agent ash --json # ash only, with token counters (contextTokens = bloat signal)
clawnify sessions history <key> --json # the transcript of one run — where it actually veered
clawnify agents skills ash # what ash can ACTUALLY run (workspace + shared skills)
No terminal? The same reads through the connector:
| CLI | Connector tool |
|---|---|
clawnify agents list | clawnify_list_agents (gives the agent_id the rest take; optional with one agent) |
clawnify sessions --agent ash | clawnify_list_agent_sessions with sub_agent_id: "ash" |
clawnify sessions history <key> | clawnify_get_session_transcript with key |
clawnify agents skills ash | clawnify_list_agent_skills with agent: "ash" |
read AGENTS.md | clawnify_get_agent_instructions (returns the text and a hash) |
Look for, in order:
contextTokens on the session — large and growing = bloat.agents skills doesn't list it, the agent literally can't. The fix is to grant it
(clawnify agents grant-skill X --to ash, or --all for every agent) if it's
already authored in main, else author it first (agents pull main → add
skills/X/SKILL.md → agents push) — not to reword the instruction. (Note:
what's in the agent's workspace is only part of it — agents skills shows
the effective set incl. shared managed-root skills.)If
clawnify sessionsisn't available yet in this org, fall back: ask the person to describe (or paste) one failing run, and read the currentAGENTS.mdfrom the org's synced repo. You still diagnose before you fix.
Tell the person, plainly, which of the three it is and why. Then:
Bloat → don't reuse one ever-growing chat for the same task. Start a fresh
session per task/topic (or /reset the runaway one). This fixes the veer
and the cost.
Patchwork → rewrite AGENTS.md, don't append to it. Structure it: role
→ a short list of hard rules up front → the steps → one example of right vs
wrong. Delete contradictions. A tight, prioritized instruction set is
followed far better than a long patched one.
Structure → author a flow for the repeatable task: deterministic steps, each with a narrow instruction, and the heavy/deterministic parts (fetch data, fill a template, render the deck) run without the model — less veer, less cost.
Where instructions live and how edits land:
AGENTS.md (and skills/). Push via the org's GitHub
sync repo (auto-deploys to the agent) or npx clawnify@latest deploy. See the
use-the-clawnify-cli skill for the commands.clawnify flows edit <name> then clawnify flows publish <name> — validated on save; once a flow has a published version,
runs and triggers keep using it until you publish again (before the first
publish, the draft is what runs). Raw flows/*.json edits via the repo also
land, but skip validation and versioning.clawnify_get_agent_instructions, then
clawnify_set_agent_instructions with the full new text and the hash as
base_hash, so an edit made since is rejected instead of overwritten. The
result returns before and after. Flows: clawnify_get_flow, then
clawnify_write_flow with its hash, then clawnify_publish_flow. A flow
that was never published runs its draft, so that write is live at once.
Granting or authoring a skill needs the CLI.AGENTS.md / skills /
flows on its next session.CLAWNIFY-*.md file (CLAWNIFY-SOUL/AGENTS/TOOLS.md) —
those are platform-owned and Clawnify overwrites them on every sync. Your
edits there vanish.Preempt these — they cause "I set it up but the agent ignores it":
company_knowledge_search). So if the agent ignores a doc, check: is it
published? not hidden? still in the index? does its AGENTS.md tell it to
search? — re-uploading won't help. Depth: the organize-company-knowledge skill.memory_write) and surfaced
as an index + per-turn recall — it is not a file/folder you drop notes
into.CLAWNIFY-*.md (overwritten) — edit AGENTS.md.AGENTS.md text or the flow
diff) before you write, deploy or publish it. Their agent is theirs to change.clawnify connections list shows as not connected
(○), you cannot connect it — that needs the user's OAuth sign-in in a
browser. Run clawnify connections connect <id> and relay the steps to the
user; never attempt it yourself or ask for their password.clawnify env set — it exposes the value in
the command and your context. Secrets and API keys go in the dashboard
(Settings → Environment Variables / API Keys); guide the user there. Use
env set only for non-secret config. And remember agents create / env set
restart the gateway — confirm with the user before you run them on a live,
busy agent.agents create to "find" an agent. It creates a new sub-agent
and restarts the gateway. If the agent you expected isn't in clawnify agents list, you are in the wrong org (clawnify org list) or it genuinely doesn't
exist — ask. Creating one leaves a duplicate the customer then has to live
with, and interrupts the real agent while it does.AGENTS.md,
one flow) over more instructions.What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub clawnify/skills --plugin clawnify6 skills in this plugin
/build-a-clawnify-appAuthor a Clawnify app end-to-end — the canonical Hono + React + Vite + @hono/zod-openapi + @clawnify/db (Drizzle) stack, schema.ts as the single schema source of truth (DDL generated via pnpm db:generate), OpenAPIHono routes (createRoute) that auto-generate an OpenAPI spec, and platform-injected identity via user()/orgId()/caller(). Use when building or modifying an app that deploys to the Clawnify platform./build-a-clawnify-websiteBuild and ship a Clawnify website (Astro on Cloudflare Workers) with built-in forms, images and assets. Use when creating or editing a website, adding a contact/waitlist/signup form, deploying local edits, or publishing an existing website draft./clawnify-knowledgeRoute a question to the right Clawnify knowledge source before answering or building. Covers how-to-use-Clawnify product docs, your org's company knowledge (brand, pricing, policy, SOPs), a specific client or project's reference, and durable memory. Use whenever a task needs a company fact, a platform how-to, or client-specific context from a connected Clawnify organization./organize-company-knowledgeTurn a dump of raw company files into a clean, foldered, citable Company Knowledge corpus — the company's brain. Use when the user has dropped many files into the Company Knowledge section (or connected a Drive) and wants the agent to distill and organize them: cluster by topic, distill each into a canonical markdown doc (merging across sources into reusable playbooks), file it into a folder, tag and link it, and propose it for review./use-the-clawnify-cliUse the Clawnify CLI end-to-end — authenticate, scaffold, run locally, deploy apps and websites, link projects, manage orgs, and inspect deployed apps. Use when deploying to Clawnify from a terminal or wiring the CLI into scripts and coding agents.