| Earl Lee | 2e463fb | 2025-04-17 11:22:22 -0700 | [diff] [blame] | 1 | # Sketch |
| 2 | |
| Philip Zeyliger | 3b279a5 | 2025-05-07 21:02:03 -0700 | [diff] [blame] | 3 | Sketch is an agentic coding tool. |
| 4 | |
| 5 | Sketch runs in your terminal, has a web UI, understands your code, and helps |
| 6 | you get work done. To keep your environment pristine, sketch starts a docker |
| 7 | container and outputs its work onto a branch in your host git repository. |
| 8 | |
| 9 | Sketch helps with most programming environments, but Go is Sketch's specialty. |
| Earl Lee | 2e463fb | 2025-04-17 11:22:22 -0700 | [diff] [blame] | 10 | |
| David Crawshaw | 64d3299 | 2025-04-21 09:14:36 -0700 | [diff] [blame] | 11 | To get started: |
| Earl Lee | 2e463fb | 2025-04-17 11:22:22 -0700 | [diff] [blame] | 12 | |
| 13 | ```sh |
| 14 | go install sketch.dev/cmd/sketch@latest |
| 15 | sketch |
| 16 | ``` |
| David Crawshaw | 64d3299 | 2025-04-21 09:14:36 -0700 | [diff] [blame] | 17 | |
| 18 | ## Requirements |
| 19 | |
| Josh Bleecher Snyder | 5cef9db | 2025-04-22 16:44:13 -0700 | [diff] [blame] | 20 | Currently sketch runs on macOS and linux. |
| David Crawshaw | ab50e9b | 2025-05-03 10:26:42 -0700 | [diff] [blame] | 21 | It uses docker for containers. |
| Josh Bleecher Snyder | 5cef9db | 2025-04-22 16:44:13 -0700 | [diff] [blame] | 22 | |
| David Crawshaw | ab50e9b | 2025-05-03 10:26:42 -0700 | [diff] [blame] | 23 | macOS: `brew install colima` (or an equivalent, like Docker Desktop or Orbstack) |
| Josh Bleecher Snyder | 5cef9db | 2025-04-22 16:44:13 -0700 | [diff] [blame] | 24 | linux: `apt install docker.io` (or equivalent for your distro) |
| David Crawshaw | ab50e9b | 2025-05-03 10:26:42 -0700 | [diff] [blame] | 25 | WSL2: install Docker Desktop for Windows (docker entirely inside WSL2 is tricky) |
| David Crawshaw | 64d3299 | 2025-04-21 09:14:36 -0700 | [diff] [blame] | 26 | |
| 27 | The [sketch.dev](https://sketch.dev) service is used to provide access |
| 28 | to an LLM service and give you a way to access the web UI from anywhere. |
| 29 | |
| 30 | ## Feedback/discussion |
| 31 | |
| 32 | We have a discord server to discuss sketch. |
| 33 | |
| David Crawshaw | df6d7b4 | 2025-05-06 09:56:07 -0700 | [diff] [blame] | 34 | Join if you want! https://discord.gg/6w9qNRUDzS |
| David Crawshaw | 64d3299 | 2025-04-21 09:14:36 -0700 | [diff] [blame] | 35 | |
| Philip Zeyliger | 5ebdbb8 | 2025-05-10 17:20:29 -0700 | [diff] [blame] | 36 | ## User Guide |
| 37 | |
| 38 | Start sketch by running `sketch` in a git repository. It will open your browser |
| 39 | to the Sketch chat interface, but you can also use the CLI interface. Use `-open=false` |
| 40 | if you want to use just the CLI interface. |
| 41 | |
| 42 | Ask Sketch about your code base or ask Sketch to implement a feature. It may take |
| 43 | a little while for Sketch to do its work, so hit the bell (🔔) icon to enable |
| 44 | browser notifications. We won't spam you or anything; it will notify you |
| 45 | when the Sketch agent's turn is done, and there's something to look at. |
| 46 | |
| 47 | ### How Sketch Works |
| 48 | |
| 49 | <!-- TODO: innie/outtie picture --> |
| 50 | |
| 51 | When you start Sketch, it creates a Dockerfile, builds it, copies your |
| 52 | repository into it, and starts a Docker container, with the "inside" Sketch |
| 53 | running inside. This design let's you <b>run multiple sketches in parallel</b> |
| 54 | since they each have their own sandbox. It also lets Sketch work without worry: |
| 55 | it can trash its own container, but it can't trash your machine. |
| 56 | |
| 57 | Sketch's agentic loop uses tool calls (mostly shell commands, but also a handful |
| 58 | of other important tools) to allow the LLM to interact with your code base. |
| 59 | |
| 60 | ### Getting Your Git Changes Out |
| 61 | |
| 62 | <!-- TODO: git picture --> |
| 63 | |
| 64 | Sketch is trained to make git commits. When those happen, they are |
| 65 | automatically pushed to the git repository where you started sketch with branch |
| 66 | names `sketch/*`. Use `git branch -a --sort=creatordate | grep sketch/ | tail` |
| 67 | to find them. The UI keeps track of the latest branch it pushed and displays it |
| 68 | prominently. You can use `git cherry-pick $(git merge-base origin/main |
| 69 | sketch/foo` or `git merge sketch/foo` or `git reset --hard sketch/foo` and so |
| 70 | on to pull those branches into your workspace. Use the same workflows you would |
| 71 | as if you were pulling in a friend's Pull Request. |
| 72 | |
| 73 | You can ask Sketch to `git fetch sketch-host` and rebase onto some commit or |
| 74 | other. Doing so will also fetch where you started Sketch, and we do a bit of |
| 75 | "git fetch refspec configuration" to make `origin/main` work as a git reference. |
| 76 | |
| 77 | Don't be afraid of asking Sketch to rebase, merge/squash commits, rewrite commit |
| 78 | messages, and so forth; it's good at it! |
| 79 | |
| 80 | ### Reviewing Diffs |
| 81 | |
| 82 | The diff view shows you changes since Sketch started. Leaving comments on lines |
| 83 | adds them to the chat box, and, when you hit send, Sketch goes to work addressing your |
| 84 | comments. |
| 85 | |
| Philip Zeyliger | 6458e7c | 2025-05-10 18:07:54 -0700 | [diff] [blame] | 86 | ### Connecting to Sketch's Container |
| 87 | |
| 88 | You can interact directly with the container by: |
| 89 | |
| 90 | 1. Using the "Terminal" tab in the UI |
| 91 | 2. Using `ssh`. Look at the startup logs or click on the information icon to see a command like `ssh sketch-ilik-eske-tcha-lott`. |
| 92 | We have automatically configured your SSH configuration to make these special hostnames work. |
| 93 | 3. Using Visual Studio Code. Again, look for a command line or magic link behind the information icon, |
| 94 | or when Sketch starts up. This starts a new VSCode session "remoted into" the container. You |
| 95 | can use the terminal, review diffs, and so forth. |
| 96 | |
| 97 | By using SSH (and/or VSCode), you can forward ports from the container to your |
| 98 | machine. For example, if you want to start your development webserver, you can |
| 99 | do something like `ssh -L8000:localhost:8888 sketch-ilik-epor-tfor-ward go run |
| 100 | ./cmd/server` to make `http://localhost:8000/` on your machine point to |
| 101 | `localhost:8888` inside the container. |
| 102 | |
| 103 | |
| Philip Zeyliger | 5ebdbb8 | 2025-05-10 17:20:29 -0700 | [diff] [blame] | 104 | ### Using the Browser Tools |
| 105 | |
| 106 | You can ask Sketch to browse a web page and take screenshots. There are tools |
| 107 | both for taking screenshots and "reading images," the latter of which sends the |
| 108 | image to the LLM. This functionality is handy if you're working on a web page and |
| 109 | want to see what the in-progress change looks like. |
| 110 | |
| Philip Zeyliger | 39bcf01 | 2025-05-12 10:07:40 -0700 | [diff] [blame] | 111 | ## FAQ |
| 112 | |
| 113 | ### `no space left on device` |
| 114 | |
| 115 | Docker images, containers, and so forth tend to pile up. `docker prune -a` is a good |
| 116 | command to start with to prune unused images and containers. |
| 117 | |
| Philip Zeyliger | d43e572 | 2025-04-23 19:21:26 -0700 | [diff] [blame] | 118 | ## Development |
| 119 | |
| M-A | b5cb954 | 2025-05-02 11:32:34 -0400 | [diff] [blame] | 120 | [](https://pkg.go.dev/sketch.dev) |
| 121 | |
| Pokey Rule | bbca240 | 2025-04-24 09:37:58 +0100 | [diff] [blame] | 122 | See [CONTRIBUTING.md](CONTRIBUTING.md) |
| Philip Zeyliger | d43e572 | 2025-04-23 19:21:26 -0700 | [diff] [blame] | 123 | |
| David Crawshaw | 64d3299 | 2025-04-21 09:14:36 -0700 | [diff] [blame] | 124 | ## Open Source |
| 125 | |
| 126 | Sketch is open source. |
| 127 | It is right here in this repository! |
| 128 | Have a look around and mod away. |
| 129 | |
| 130 | If you want to run sketch entirely without the sketch.dev service, you can |
| Philip Zeyliger | d43e572 | 2025-04-23 19:21:26 -0700 | [diff] [blame] | 131 | set the flag -skaband-addr="" and then provide an `ANTHROPIC_API_KEY` |
| David Crawshaw | 64d3299 | 2025-04-21 09:14:36 -0700 | [diff] [blame] | 132 | environment variable. (More LLM services coming soon!) |