How to use Claude to avoid reverted coding mistakes
The author reports that Claude Code avoided reintroducing users.card_token and retried the charge off_session using a saved Stripe PaymentMethod.
Prompt to try
Editorial adaptation, not the source author’s exact prompt. Replace bracketed inputs and review tool permissions first.
Before changing [entity], query Selvedge for prior attempts and reversals. Use the recorded reasoning to avoid repeating rejected approaches. Implement [requested fix] using the retained design decision, and log the change and its reasoning while the context is available.
Reach people exploring AI agents
See placements →What happened
The author reports that Claude Code avoided reintroducing users.card_token and retried the charge off_session using a saved Stripe PaymentMethod.
Reported by masondelan on dev.toHow the agent did it
- Record the earlier database change and its reversal.
- Configure CLAUDE.md to check prior attempts.
- Query the history for users.card_token.
Where a person stepped in
The author had previously reverted the column and configured history lookup; the post does not describe a separate review of the successful retry.
A person approved each step before the agent continued.
The author describes a Claude Code session proposing a database change that had already been tried and reverted: adding a users.card_token column for retrying failed charges. The earlier decision had moved payment handling to Stripe-managed methods, but its reasoning had disappeared with the old session.
To retain those decisions, the author built Selvedge, a local MCP server and CLI. A short CLAUDE.md instruction tells the agent to check prior attempts before touching an entity. In the reported retry case, the agent queried users.card_token and retrieved the earlier attempt, its reasoning, and the recorded reversal. It then avoided adding the column and retried the charge off_session using the saved Stripe PaymentMethod.
Selvedge records reasoning while the agent is making a change, rather than asking another model to explain a diff afterward. Records live in a SQLite file under .selvedge/ beside the code. Its tools support prior-attempt lookup, history inspection, change logging, search, and stale-decision inspection.
The author reports that the charge was retried without card data entering the application's database. Who it's for: developers using separate coding-agent sessions who need previous reversals and design reasoning available during later changes.
Prompt
Suggested prompt (written by Agents In Use, not the author's)
Source: dev.to · masondelan
Frequently asked questions
Where is the reasoning stored?
Selvedge stores agent-written reasoning as-is in a SQLite file under .selvedge/ next to the code.
What changed in the payment retry?
After reading the prior reversal, the agent used off_session charging against a saved Stripe PaymentMethod instead of adding the database column again.
More details
Remaining steps
- Retry the charge with the saved Stripe PaymentMethod.
About this account
The agent consults local decision history before changing an entity and uses that evidence to choose a different implementation.
Platform: dev.to. Attribution: https://dev.to/masondelan/my-ai-agent-tried-to-ship-a-mistake-wed-already-reverted-4737. Prompt: Suggested (written by Agents In Use, not the author's). Sourced by the Agents In Use pipeline.
Credit: masondelan on dev.to
Source published 6 Jul 2026
Source checked 14 Oct 2026
Tools and topics
Claude Code · Selvedge · SQLite · Stripe
Agent memory · Payments · Decision history
Editorial completeness: 100/100. Measures documented fields, not agent performance or verified outcomes.