~3m9:38
The Hype Kevin

Stop correcting your AI agent

Oct 4, 2026

Read: ~3m · You save: 7 min

Stop correcting your AI agent

Tired of repeating yourself to your AI agent? Discover how to build AI that learns and prevents errors, not just fixes them. Learn about pstack and Grok Bot!

Developers frequently find themselves repeatedly correcting AI agents for the same errors. Lauren Tan, who works on SpaceX's AI team and the React Compiler, has developed a system to address this issue. Her approach, implemented through a set of agent skills called "pstack," aims to prevent recurring mistakes by architecting code and establishing rules that guide AI behavior.

Tan's system is publicly available and has enabled her to ship approximately 2,500 pull requests in August, averaging 80 per day, with her agents merging their own code. Matt Pocock has recognized her contributions, listing her among the top three skill makers.

The Problem of Temporary Fixes

A common issue arises when AI agents implement temporary workarounds for bugs. For instance, a bug causing duplicate items in a shopping cart might be addressed by an agent adding code to hide duplicates, with a comment indicating it's a "temporary workaround, safe to ignore." While this might pass tests and appear to fix the immediate problem, the underlying bug remains. This workaround can then be copied by other agents for similar issues, proliferating throughout the codebase. Tan likens this to a bonsai tree, where each correction snips a branch, only for the same wrong branch to regrow elsewhere because agents tend to copy existing patterns.

The "Gardening" Approach: Architectural Fixes

Tan advocates for a "gardening" approach, which involves wiring the code to guide its growth rather than constantly pruning mistakes. This hierarchy of fixes prioritizes architectural solutions that prevent errors from occurring in the first place. The ranking is as follows:

  1. Architecture: Designing the code so the mistake cannot happen.
  2. Lint Rule or Test: Catching the error during continuous integration (CI).
  3. Agent Skill or Rule: Guiding the AI's behavior.
  4. Human Code Review: The least effective, labeled "NGMI" (Not Gonna Make It).

For the cart bug example, the top-tier fix would involve restructuring the data to use one line per product with a quantity, thus preventing duplicate entries. This would be followed by deleting all instances of the workaround. A second-tier solution would be a lint rule flagging code that hides duplicates and directing users to the actual fix. Tan's "fix-root-causes" rule, which instructs agents to trace symptoms back to their origin, represents a third-tier solution. Human code review is the fourth tier.

pstack: A Framework for Agent Behavior

Tan's pstack framework is designed for agents that operate with limited context, copying nearby examples and taking the shortest path to compilation. To counter this, pstack makes the correct approach the easiest one. The Grok Bot framework, which Tan works on, enforces a single method for all operations: each feature has its own folder, lint rules prevent incorrect imports, and code comments are banned to prevent agents from using them as excuses for workarounds.

pstack functions as a free plugin for Cursor, offering 50 skills. Users activate it with "poteto mode" followed by their task. The system selects one of 23 playbooks (e.g., bug fix, feature, performance, shipping) and breaks down the steps into a to-do list, calling other skills as needed. Many of these skills are single rules, such as "delete before you add" or "after two fixes fail, question the shared assumption."

The workflow involves:

  1. Work Input: A bug report, feature request, or performance issue.
  2. Playbook Selection: "Poteto mode" selects the appropriate playbook.
  3. Problem Reproduction/Mapping: The agent reproduces the bug or maps the problem.
  4. Fix Design: The agent designs a solution.
  5. Building the Fix: The agent implements the solution.
  6. Verification: The fix is proven in the running application.
  7. Attack by Other Models: Different AI models attempt to break the fix.
  8. Shipping: The fix is deployed.

Any issue that recurs is integrated into the repository as a "wire," improving the codebase for future tasks. Grok Bot monitors Slack, X, and bug trackers, converting new reports into projects that execute this loop, enabling a single person to manage a high volume of pull requests.

The Cart Bug Through the pstack Loop

Applying the cart bug scenario to the pstack loop:

  1. Initiation: "Poteto mode, items show up twice in the cart, reproduce it first." This triggers the bug fix playbook.
  2. Reproduction: The agent uses a generated verification skill to launch the app, confirm its health, interact with it, and capture proof of the bug (two hoodies appearing in the cart). This verification skill includes instructions on launching the app, checking its health, navigating through it, capturing proof, and mapping feature locations.
  3. Root Cause Analysis: Read-only agents trace the click from the button to the cart using the "how" skill. The "why" skill analyzes past commits and chats, uncovering the previous workaround. The agent tests theories with evidence until a double-click sending the request twice is identified as the cause.
  4. Fix Design and Implementation: The "architect" skill intervenes. Two agents independently design the fix: one prevents double-clicks on the button, and the other modifies the cart to disallow duplicate products. An AI judge scores these designs, and the lead agent adopts the cart design while retaining the button fix. Grok Bot writes the code, with Opus 5.5 making critical decisions.
  5. Verification: A failing test is logged (expecting one hoodie after a double-click). The agent re-tests the running app, confirming only one hoodie appears.
  6. Attack Phase: Three models attempt to break the fix using the "interrogate" skill, with their findings categorized as "act on," "consider," "noted," and "dismissed."

On full autopilot, pstack deploys verifier agents to each pull request, simulating user behavior to find regressions and fix them until the PR can be merged.

Review and Correction Loop

Before merging, a judge, three models, and a squad of verifiers review the changes. Post-merge, Lauren Tan reviews the commit history and samples the work. If two agents employ the same shortcut, she adds a "wire" to the system.

Tan's newest skill, "correct," closes this loop. It analyzes recent commits, reverts, and review comments to identify recurring agent mistakes. A pattern is established if a mistake occurs twice. For the hide-the-duplicate workaround, which appeared 40 times, "correct" implements the highest-tier fixes: first, the cart architecture to prevent duplicates, followed by deleting all workaround instances. If architecture is not feasible, it escalates to type-based solutions, then lint rules with error messages that specify the fix, followed by tests, and finally documentation. Each new check must fail on a real historical mistake. A table in the agent's instructions maps rules to their enforcement mechanisms.

The architect skill has also been enhanced to proactively identify potential issues like dual-purpose tasks, manually synchronized lists, and importable internals. In blind tests, its designs improved by approximately one point out of eight.

The pstack system is also becoming more streamlined. In September, Tan reduced 34 instructions that Opus 5.5 followed implicitly. A review skill, tested with and without these instructions, caught 142 out of 154 planted problems without them and 139 with them. The underlying principle is to encode lessons as lint rules, checks, or scripts and then delete the instructions, as agents learn from the repository they are operating within.

Tan's agents still make mistakes, but each recurring error is transformed into a permanent "wire," such as a cart that prevents duplicates or a lint error that guides towards the correct fix. This ensures that future agents encountering similar issues have no shortcuts to copy, allowing the codebase to grow according to Tan's design.

The Problem with Constant Correction

The current approach of repeatedly correcting AI agents is inefficient, as agents tend to replicate past mistakes. Temporary fixes proliferate, creating a maintenance burden and obscuring the root causes of bugs.

  • AI agents often repeat the same mistakes despite being corrected.
  • Lauren Tan's experience involves shipping ~2,500 pull requests with agents merging their own code.
  • Her system, pstack, aims to address recurring errors.
  • Temporary workarounds, like hiding duplicate items in a cart, can spread and become permanent issues.
  • This leads to a codebase filled with unaddressed bugs disguised as fixes.

The 'Gardening' Metaphor for Code Development

Instead of constantly pruning AI-generated code, the 'gardening' approach focuses on shaping the codebase architecturally to prevent errors. This involves a ranked system of interventions, prioritizing fundamental design changes over reactive fixes.

  • Lauren Tan compares code commits to a bonsai tree, where corrections are like snipping branches.
  • The desired approach is 'gardening,' where code is shaped to grow correctly from the start.
  • This involves 'wiring' branches rather than just cutting them.
  • The hierarchy of fixes ranges from architecture (preventing the mistake) to human review (least effective).
  • pstack implements this by prioritizing architectural fixes, then lint rules, agent skills, and finally human review.

pstack and Grok Bot: Implementing the System

pstack and Grok Bot operationalize the gardening metaphor. They employ structured playbooks and enforce strict coding conventions to automate the entire development lifecycle, from problem identification to shipping, ensuring that mistakes are addressed at their root.

  • pstack is a set of agent skills, with a 'fix-root-causes' rule.
  • Grok Bot, built by Lauren Tan at SpaceX, uses pstack.
  • The framework enforces a single way to do things (e.g., feature folders, banned comments).
  • pstack uses playbooks (e.g., bug fix, feature) triggered by commands like 'poteto mode'.
  • The system automates a loop: work comes in, agent reproduces/maps, designs fix, builds, proves, and ships.

Automated Verification and Root Cause Analysis

Automated verification and root cause analysis are central to pstack. Agents are empowered to rigorously reproduce bugs, trace their origins, and develop validated fixes, with architectural oversight ensuring robust solutions.

  • The system includes verification skills that automate reproducing bugs and capturing proof.
  • Agents use 'how' and 'why' skills to trace issues back to their origin, avoiding guesswork.
  • Workarounds are treated as hypotheses and do not ship without validation.
  • An architect skill designs fixes, with multiple agents proposing solutions.
  • A judge AI scores designs, and the best is selected and implemented.

The 'Correct' Skill and Continuous Improvement

The 'correct' skill closes the loop by analyzing historical mistakes to implement permanent fixes. By converting lessons into automated checks and refining agent instructions, the system continuously improves its ability to prevent errors.

  • Lauren's newest skill, 'correct,' identifies recurring mistakes from commit history.
  • It prioritizes architectural fixes, then type changes, lint rules, tests, and docs.
  • New checks must fail on real historical mistakes to be implemented.
  • The system learns by encoding lessons into checks and deleting redundant instructions.
  • This process shortens the AI's instruction stack and improves its performance.