blob: eab3cdc75bfb38b129d9fd73a6c4930de1df7c57 [file] [log] [blame] [view]
Earl Lee2e463fb2025-04-17 11:22:22 -07001# Sketch
2
Philip Zeyliger3b279a52025-05-07 21:02:03 -07003Sketch is an agentic coding tool.
4
5Sketch runs in your terminal, has a web UI, understands your code, and helps
6you get work done. To keep your environment pristine, sketch starts a docker
7container and outputs its work onto a branch in your host git repository.
8
9Sketch helps with most programming environments, but Go is Sketch's specialty.
Earl Lee2e463fb2025-04-17 11:22:22 -070010
David Crawshaw64d32992025-04-21 09:14:36 -070011To get started:
Earl Lee2e463fb2025-04-17 11:22:22 -070012
13```sh
14go install sketch.dev/cmd/sketch@latest
15sketch
16```
David Crawshaw64d32992025-04-21 09:14:36 -070017
18## Requirements
19
Josh Bleecher Snyder5cef9db2025-04-22 16:44:13 -070020Currently sketch runs on macOS and linux.
David Crawshawab50e9b2025-05-03 10:26:42 -070021It uses docker for containers.
Josh Bleecher Snyder5cef9db2025-04-22 16:44:13 -070022
David Crawshawab50e9b2025-05-03 10:26:42 -070023macOS: `brew install colima` (or an equivalent, like Docker Desktop or Orbstack)
Josh Bleecher Snyder5cef9db2025-04-22 16:44:13 -070024linux: `apt install docker.io` (or equivalent for your distro)
David Crawshawab50e9b2025-05-03 10:26:42 -070025WSL2: install Docker Desktop for Windows (docker entirely inside WSL2 is tricky)
David Crawshaw64d32992025-04-21 09:14:36 -070026
27The [sketch.dev](https://sketch.dev) service is used to provide access
28to an LLM service and give you a way to access the web UI from anywhere.
29
30## Feedback/discussion
31
32We have a discord server to discuss sketch.
33
David Crawshawdf6d7b42025-05-06 09:56:07 -070034Join if you want! https://discord.gg/6w9qNRUDzS
David Crawshaw64d32992025-04-21 09:14:36 -070035
Philip Zeyliger5ebdbb82025-05-10 17:20:29 -070036## User Guide
37
38Start sketch by running `sketch` in a git repository. It will open your browser
39to the Sketch chat interface, but you can also use the CLI interface. Use `-open=false`
40if you want to use just the CLI interface.
41
42Ask Sketch about your code base or ask Sketch to implement a feature. It may take
43a little while for Sketch to do its work, so hit the bell (🔔) icon to enable
44browser notifications. We won't spam you or anything; it will notify you
45when 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
51When you start Sketch, it creates a Dockerfile, builds it, copies your
52repository into it, and starts a Docker container, with the "inside" Sketch
53running inside. This design let's you <b>run multiple sketches in parallel</b>
54since they each have their own sandbox. It also lets Sketch work without worry:
55it can trash its own container, but it can't trash your machine.
56
57Sketch's agentic loop uses tool calls (mostly shell commands, but also a handful
58of 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
64Sketch is trained to make git commits. When those happen, they are
65automatically pushed to the git repository where you started sketch with branch
66names `sketch/*`. Use `git branch -a --sort=creatordate | grep sketch/ | tail`
67to find them. The UI keeps track of the latest branch it pushed and displays it
68prominently. You can use `git cherry-pick $(git merge-base origin/main
69sketch/foo` or `git merge sketch/foo` or `git reset --hard sketch/foo` and so
70on to pull those branches into your workspace. Use the same workflows you would
71as if you were pulling in a friend's Pull Request.
72
73You can ask Sketch to `git fetch sketch-host` and rebase onto some commit or
74other. 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
77Don't be afraid of asking Sketch to rebase, merge/squash commits, rewrite commit
78messages, and so forth; it's good at it!
79
80### Reviewing Diffs
81
82The diff view shows you changes since Sketch started. Leaving comments on lines
83adds them to the chat box, and, when you hit send, Sketch goes to work addressing your
84comments.
85
Philip Zeyliger6458e7c2025-05-10 18:07:54 -070086### Connecting to Sketch's Container
87
88You 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`.
92We 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,
94or when Sketch starts up. This starts a new VSCode session "remoted into" the container. You
95can use the terminal, review diffs, and so forth.
96
97By using SSH (and/or VSCode), you can forward ports from the container to your
98machine. For example, if you want to start your development webserver, you can
99do 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 Zeyliger5ebdbb82025-05-10 17:20:29 -0700104### Using the Browser Tools
105
106You can ask Sketch to browse a web page and take screenshots. There are tools
107both for taking screenshots and "reading images," the latter of which sends the
108image to the LLM. This functionality is handy if you're working on a web page and
109want to see what the in-progress change looks like.
110
Philip Zeyliger39bcf012025-05-12 10:07:40 -0700111## FAQ
112
113### `no space left on device`
114
115Docker images, containers, and so forth tend to pile up. `docker prune -a` is a good
116command to start with to prune unused images and containers.
117
Philip Zeyligerd43e5722025-04-23 19:21:26 -0700118## Development
119
M-Ab5cb9542025-05-02 11:32:34 -0400120[![Go Reference](https://pkg.go.dev/badge/sketch.dev.svg)](https://pkg.go.dev/sketch.dev)
121
Pokey Rulebbca2402025-04-24 09:37:58 +0100122See [CONTRIBUTING.md](CONTRIBUTING.md)
Philip Zeyligerd43e5722025-04-23 19:21:26 -0700123
David Crawshaw64d32992025-04-21 09:14:36 -0700124## Open Source
125
126Sketch is open source.
127It is right here in this repository!
128Have a look around and mod away.
129
130If you want to run sketch entirely without the sketch.dev service, you can
Philip Zeyligerd43e5722025-04-23 19:21:26 -0700131set the flag -skaband-addr="" and then provide an `ANTHROPIC_API_KEY`
David Crawshaw64d32992025-04-21 09:14:36 -0700132environment variable. (More LLM services coming soon!)