Skip to content

Self-Modifying Prompts

The Most Powerful Technique in This Course

Section titled “The Most Powerful Technique in This Course”

If you take away only one idea from this entire course, let it be this one. Self-modifying prompts are the technique that transforms a simple AI chatbot into an agent that genuinely improves over time. It is the highest-return-on-investment skill you will learn here, and it requires zero coding.

The concept is straightforward: when your AI agent makes a mistake, you tell it what went wrong, and the agent writes a new rule for itself in its configuration file. The next time it starts a session, it reads that rule and avoids making the same mistake again.

Over time, the agent accumulates a growing list of rules and lessons. Each rule comes from a real mistake or a real piece of feedback. Errors that used to happen regularly stop happening entirely. The agent gets better not because the underlying AI model changed, but because its instructions became more precise and comprehensive.

The self-modifying prompt pattern follows a simple cycle:

Step 1: The agent does something wrong. You ask the agent to design a landing page, and it uses a dark background with white text.

Step 2: You give feedback. You tell the agent: “I don’t like dark backgrounds. Always use a light background with dark text.”

Step 3: The agent writes a new rule. The agent adds a line to its configuration file:

- Never use dark backgrounds. Always use light backgrounds with dark text (user preference, learned 2025-02-10).

Step 4: The next session uses the rule. The next time you start a conversation, the agent reads its configuration file, sees the rule, and automatically avoids dark backgrounds. You never have to give that feedback again.

Step 5: Repeat. Over weeks and months, the agent accumulates dozens or hundreds of rules. Each rule prevents a specific class of mistakes. The agent becomes increasingly aligned with your preferences and needs.

Let’s walk through a realistic scenario to see this pattern in action.

You ask your agent to write a social media post about a new product launch.

The agent produces a post that:

  • Uses emojis heavily
  • Includes three hashtags
  • Is 280 characters (Twitter-length)

You give feedback: “We post on LinkedIn, not Twitter. Our brand voice is professional. No emojis. Posts should be 100-200 words.”

The agent updates its configuration file:

## Social Media Rules
- Target platform is LinkedIn, not Twitter.
- Brand voice is professional and polished.
- Never use emojis in posts.
- Post length should be 100-200 words.

You ask for another social media post. This time the agent:

  • Writes 150 words (correct)
  • Uses professional language (correct)
  • No emojis (correct)
  • But includes a call to action that links to a competitor comparison page

You give feedback: “Never link to competitor comparisons. Our links should always go to our own product pages.”

The agent adds to its configuration file:

## Social Media Rules
- Target platform is LinkedIn, not Twitter.
- Brand voice is professional and polished.
- Never use emojis in posts.
- Post length should be 100-200 words.
- Never link to competitor comparison pages. All links should point to our own product pages.

You ask for another post. This time it is nearly perfect. The only issue is that the agent used the company’s old slogan.

You give feedback: “Our slogan changed in January 2025. The new slogan is ‘Building Tomorrow Together.’ Never use the old slogan ‘Innovation First.’”

The agent adds:

## Social Media Rules
- Target platform is LinkedIn, not Twitter.
- Brand voice is professional and polished.
- Never use emojis in posts.
- Post length should be 100-200 words.
- Never link to competitor comparison pages. All links should point to our own product pages.
- Current slogan is "Building Tomorrow Together" (changed January 2025). Never use the old slogan "Innovation First."

By this point, the agent consistently produces social media posts that match your brand perfectly. The rules file has grown from nothing to a comprehensive guide that covers all the common pitfalls. New mistakes still happen occasionally, but they become increasingly rare as the rule set grows.

How to Tell Your Agent to Update Its Rules

Section titled “How to Tell Your Agent to Update Its Rules”

You do not need any special command or tool. Simply tell the agent in plain language what went wrong and ask it to remember the lesson. Here are some phrases you can use:

  • “That’s wrong. Please add a rule to your config file that says…”
  • “Remember this for next time: always use metric units, never imperial.”
  • “Update your instructions to include this: our business hours are 9 AM to 5 PM Asuncion time.”
  • “Add a lesson learned: the client prefers formal language over casual language.”

The agent will then add the rule to its configuration file (CLAUDE.md, AGENTS.md, or whichever file the platform uses).

Most AI techniques require technical knowledge, complicated setups, or ongoing manual effort. Self-modifying prompts require none of that. Here is why this technique stands out:

  1. Zero cost. You are not paying for additional tools, plugins, or services. You are just adding lines to a text file.

  2. Cumulative improvement. Every correction you make is permanent. Unlike a regular conversation where corrections are forgotten when the session ends, self-modifying prompts carry forward forever.

  3. Minimal effort. Once you get in the habit of saying “add this rule,” it takes about 10 seconds per correction. Over time, you make fewer and fewer corrections.

  4. Works on every platform. Whether you use Claude, ChatGPT, Gemini, Ollama, or LM Studio, the pattern is the same: give feedback, write a rule, read the rule next session.

  5. Scales naturally. A human assistant takes months to learn your preferences. An AI agent with self-modifying prompts can accumulate dozens of preferences in a single week.

Open your preferred AI platform and try this exercise:

  1. Start a new conversation with a system prompt: “You are a helpful email writing assistant.”
  2. Ask the agent to write a professional email declining a meeting invitation.
  3. Look at the result and find one thing you would change (maybe the tone is too casual, or it is too long, or it uses the wrong greeting).
  4. Tell the agent: “That was good, but [your feedback]. Please add a rule to remember this for future sessions.”
  5. Check the agent’s configuration file to make sure the new rule was added.
  6. Start a new session and ask for another email. See if the agent follows the new rule.

This simple exercise teaches you the entire self-modifying prompt cycle in under five minutes.

  • Self-modifying prompts create a feedback loop: mistake → correction → new rule → better behavior.
  • Over time, the agent accumulates rules and makes fewer errors. Performance improves without changing the AI model itself.
  • This technique requires zero coding, zero cost, and works on every platform.
  • Be specific when giving feedback so the agent writes clear, actionable rules.
  • Periodically review and clean up your rules file to keep it focused and within the context window limits.