|

Cursor AI: feedback loops make the difference!

Cursor AI: feedback loops make the difference!

A year and a half ago, I wrote a review of gitHub Copilot. It was impressive for 2023, but not today. Cursor AI is currently regarded as one of the best programming AIs. Reason enough to take a closer look at it (using a real project). I found out that the feedback loops between user, Cursor AI and IDE make the difference. I describe this in the following:

  • Why AI is so good at programmingProgram code is simultaneously understandable for humans and machines - making it ideal for AI-supported applications.
  • Cursor AI: A standalone, VSCode-based IDE with seamlessly integrated AI
  • Feedback loops in Cursor AICursor enables dynamic feedback between user, AI and IDE, allowing problems to be solved iteratively and context-based.
  • Example: Typescript refactoringA real example shows how Cursor analyzes error sources, pulls relevant files into context and integrates user actions.
  • Workflow control: Cursor offers functions such as rollback checkpoints and code diffs that enable user control over AI-generated changes.
  • Software infrastructure for feedback loopsMachine-readable feedback systems have existed in software development for a long time.
  • Feedback loops in systems engineering are missingProduct development often lacks comparable structures, which is why AI has so far been less effective there.
  • New tools as enablersTools such as Flow Engineering or Valispace are trying to establish model-based, integrated platforms as the basis for AI use.

Why AI is so good at programming

Software code has the special feature that it was designed to be read by both humans and machines. Microsoft recognized this early on, which is why the Acquisition of gitHub in 2018 The aim of the project was to provide training data for the joint venture with OpenAI.

Software code can be read by both machines and humans. This is what makes programming code so special.

Not only that: the comments embedded in code usually describe the "what" that is implemented in the code ("how"). Therefore, programming support is one of the easiest use cases for generative AI. Therefore, the gitHub Copilot the first AI product from Microsoft that was based on GPT from OpenAI.

What is Cursor AI?

Cursor AI is a integrated development environment (IDE) for programming. Cursor AI sees Visual Studio Code (VSCode) from Microsoft. This is not surprising as VSCode is open source software and Cursor uses this project.

Cursor AI is a standalone IDE and not just a VS Code extension, because the architecture of VS Code not enough control over the user interface allowed. Only by forking VS Code was Cursor able to integrate the AI functions as seamlessly as is the case today.

This video shows some of the features of Cursor and also explains why Cursor AI is superior to VS Studio. However, the video lacks what makes Cursor AI so superior: feedback loops!

Feedback loops in Cursor AI

It wasn't until I tried it out that I realized what makes Cursor AI really remarkable: Cursor creates feedback loops between three participants:

  • Users: Initiates requests, confirms certain actions and refines
  • Cursor AISearches for solutions to the user's task. In doing so, it selectively includes other resources in the context and requests confirmation of some actions
  • IDEThe IDE reacts to activities of the user and Cursor AI, for example with error messages. Cursor picks up feedback from the IDE, e.g. to check the success of an action

Here is a simple example:

Example: Typescript refactoring

In this example, I converted existing JavaScript code to Typescript. After the conversion there were errors. I selected the console output (lines 1-56), then analyzed the cursor AI:

Cursor has identified a possible cause, the file PanePage.vue. However, this does not exist in the current context. Therefore, Cursor now makes a request to the IDE, as can be seen below:

Cursor has therefore eliminated the first problem: The file exists in the right place. Cursor therefore searches further and also includes the Tyescript configuration in the context (tscconfig.json). But Cursor does not find an obvious problem there either. Therefore, the next configuration file, package.json, is now included in the context:

Here, Cursor recognizes a problem and suggests a correction. However, this requires the execution of a command (npm) on the console of the user's computer. This is a "dangerous" operation that Cursor will not perform without the user's involvement. The user must therefore check the command and can execute it by clicking on "Run command".

After execution, Cursor immediately checks whether there are any error messages in the IDE. If so, Cursor continues to search.

Workflow control: rollback, diffs, etc.

The changes that Cursor makes during a chat can be viewed by the user via Rollback checkpoints undo at any time. I've learned to appreciate that, because sometimes you end up at a dead end with Cursor and want to start all over again.

Many suggestions are of course about editing source code. Cursor provides an inline diff in the chat, but also integrates itself into the code editor, where we can accept, reject or edit individual changes.

Software infrastructure for feedback loops has been in place for a long time

There has long been an infrastructure for feedback loops in software development. This infrastructure can be supplemented with AI in many places, as Cursor does. This works because all artifacts can naturally be processed by machines.

Just to give you a brief overview:

  • Immediate feedback from the code editor:
    • Code syntax
    • Static correctness
    • Code style
    • Best practices
  • Automation for local work:
    • Executing the unit tests when saving
    • Formatting of the code when saving (Prettier, Black, etc.)
    • Linting when saving or before committing
    • Car imports and car fixes
    • Live reload in the browser when changes are made
  • Automation in the version control process:
    • Building the "deployable units" during commit
    • Pre-commit hooks (tests, linter, format checks)
    • Automatic code analysis in the pull request
    • Automatic creation of changelogs from commit messages
    • Automatic tagging and versioning (semantic versioning, e.g. via conventional commits)
  • CI/CD pipeline:
    • Automated integration test (Continuous Integration, CI)
    • Automated deployment (Continuous Deployment, CD)
    • Automated rollback in the event of incorrect deployment
    • Canary Releases or Blue-Green Deployments
    • Automatic provisioning of infrastructure (infrastructure as code, e.g. with Terraform)
  • Quality assurance and monitoring:
    • Automated monitoring after deployment
    • Automatic error reports (e.g. via Sentry)
    • Visual regression tests
    • Performance tests in the CI process
    • Security scans (e.g. dependency scanning, SAST, DAST)
  • Documentation and communication:

Feedback loops in systems engineering are missing

But that is the problem in systems engineering: this infrastructure of machine-readable artifacts is missing or incomplete.

Concrete example: test automation. Tests are often carried out manually. Some tests can also be carried out using simulations, for example in Simulink. However, the value is limited if these tests are not integrated into the processes.

I have seen teams that have built their own automation systems. The most successful example is SpaceX, which uses them to achieve extremely short development cycles. But for most teams, this is not a viable option: the team often lacks the skills - after all, the aim is to develop the product, not the development tools. Even if the skills are available, such processes often depend on a single person, and the reliability of the automation can also rarely be guaranteed.

New tools as an integration platform

I am therefore skeptical as to whether we will see similar AI support in product development in the near future: The infrastructure is missing. For a while, I had the hope that OSLC could become part of the solution. But I haven't seen anything like this in practice yet.

The most promising approach at the moment seems to be that of Flow Engineering. The Flow tool attaches great importance to the integration of models and the propagation of parameters. It thus provides an infrastructure of interlinked models that can be read by machines and humans.

Valispace also pursues a similar approach. Valispace is remarkable in that the tool has been experimenting with built-in AI assistance for years.

Conclusion

Cursor AI impressively demonstrates how quickly AI-based solutions are evolving. Cursor also shows that artifacts that can be read by both humans and machines are an important enabler. In other words, machine-readable without AI. We generally call such artifacts "models". Software code is such a model.

Unfortunately, we hardly have this at all in systems engineering or product development. Until this is solved, I don't expect the same quantum leaps that we are currently seeing in software development.

Similar Posts

Leave a Reply