Code Shaping is a tool that allows you to edit code using free-form sketch annotations directly on top of the code and console output. Try out the online demo here with your own API key!
We recommend you using your tablet to experience the full interaction. You can do this by using ngrok to expose your local server to the internet.
- Clone this repo to your computer
- Run
npm install
to install dependencies - Get an OpenAI API key from platform.openai.com/api-keys. Make sure you are at least a Tier 1 API user, which means you have access to GPT-4o. You can check your tier on the OpenAI API Limits.
- Create a
.env
file that containsNEXT_PUBLIC_OPENAI_API_KEY=your api key here
- Run
npm run dev
- then expose your local server to the internet by running
ngrok http 3000
- Open the url provided by ngrok in your tablet
You can start by adding code into the code editor, then you can add sketch annotations to the code to make code edits. You can also add sketch annotations to the console output to make console edits.
- You can use one finger tap and drag to select items on canvas;
- Tap longer and drag will select code with contextual menu beside;
- The always-on feedforward interpretation showing the interpretation of sketches or text, the reasoning of action, and the related code;
- The gutter will be decorated to indicate which code being referenced and which code will be affected;
- The related code syntax will be highlight transiently;
- You can commit the changes and the code will be updated in the code editor;
- Draw check/cross to accept/reject code edits.
This codebase is largely developed based on tldraw's MakeReal project. This work was made possible by NSERC Discovery Grant RGPIN-2024-03827, NSERC Discovery Grant #RGPIN-2020-03966, and Canada foundation for innovation - John R. Evans Leaders Fund (JELF) #42371.
@inproceedings{10.1145/3706598.3713822,
author = {Yen, Ryan and Zhao, Jian and Vogel, Daniel},
title = {Code Shaping: Iterative Code Editing with Free-form AI-Interpreted Sketching},
year = {2025},
isbn = {9798400713941},
publisher = {Association for Computing Machinery},
address = {New York, NY, USA},
url = {https://doi.org/10.1145/3706598.3713822},
doi = {10.1145/3706598.3713822},
abstract = {We introduce the concept of code shaping, an interaction paradigm for editing code using free-form sketch annotations directly on top of the code and console output. To evaluate this concept, we conducted a three-stage design study with 18 different programmers to investigate how sketches can communicate intended code edits to an AI model for interpretation and execution. The results show how different sketches are used, the strategies programmers employ during iterative interactions with AI interpretations, and interaction design principles that support the reconciliation between the code editor and sketches. Finally, we demonstrate the practical application of the code shaping concept with two use case scenarios, illustrating design implications from the study.},
booktitle = {Proceedings of the 2025 CHI Conference on Human Factors in Computing Systems},
articleno = {872},
numpages = {17},
keywords = {Ink-based Sketching, Dynamic Abstraction, Programming Interface},
location = {
},
series = {CHI '25}
}