blob: 2849e4e0a614dd32b1117883bd2fce9be00a220e [file] [log] [blame] [view]
Earl Lee2e463fb2025-04-17 11:22:22 -07001# Sketch
2
Josh Bleecher Snyder39ed5a52025-05-12 17:34:45 -07003Sketch is an agentic coding tool. It draws the 🦉.
Philip Zeyliger3b279a52025-05-07 21:02:03 -07004
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
Josh Bleecher Snyder39ed5a52025-05-12 17:34:45 -07009Sketch helps with most programming environments, but Sketch has extra goodies for Go.
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)
Josh Bleecher Snyder39ed5a52025-05-12 17:34:45 -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
Josh Bleecher Snyder39ed5a52025-05-12 17:34:45 -070036GitHub issues are also welcome: https://github.com/boldsoftware/sketch/issues
37
Philip Zeyliger5ebdbb82025-05-10 17:20:29 -070038## User Guide
39
40Start sketch by running `sketch` in a git repository. It will open your browser
41to the Sketch chat interface, but you can also use the CLI interface. Use `-open=false`
42if you want to use just the CLI interface.
43
44Ask Sketch about your code base or ask Sketch to implement a feature. It may take
45a little while for Sketch to do its work, so hit the bell (🔔) icon to enable
46browser notifications. We won't spam you or anything; it will notify you
47when the Sketch agent's turn is done, and there's something to look at.
48
49### How Sketch Works
50
51<!-- TODO: innie/outtie picture -->
52
53When you start Sketch, it creates a Dockerfile, builds it, copies your
54repository into it, and starts a Docker container, with the "inside" Sketch
55running inside. This design let's you <b>run multiple sketches in parallel</b>
56since they each have their own sandbox. It also lets Sketch work without worry:
57it can trash its own container, but it can't trash your machine.
58
59Sketch's agentic loop uses tool calls (mostly shell commands, but also a handful
60of other important tools) to allow the LLM to interact with your code base.
61
62### Getting Your Git Changes Out
63
64<!-- TODO: git picture -->
65
66Sketch is trained to make git commits. When those happen, they are
67automatically pushed to the git repository where you started sketch with branch
68names `sketch/*`. Use `git branch -a --sort=creatordate | grep sketch/ | tail`
69to find them. The UI keeps track of the latest branch it pushed and displays it
70prominently. You can use `git cherry-pick $(git merge-base origin/main
71sketch/foo` or `git merge sketch/foo` or `git reset --hard sketch/foo` and so
72on to pull those branches into your workspace. Use the same workflows you would
73as if you were pulling in a friend's Pull Request.
74
Josh Bleecher Snyder39ed5a52025-05-12 17:34:45 -070075Advanced: You can ask Sketch to `git fetch sketch-host` and rebase onto some commit or
Philip Zeyliger5ebdbb82025-05-10 17:20:29 -070076other. Doing so will also fetch where you started Sketch, and we do a bit of
77"git fetch refspec configuration" to make `origin/main` work as a git reference.
78
Josh Bleecher Snyder39ed5a52025-05-12 17:34:45 -070079Don't be afraid of asking Sketch to help you rebase, merge/squash commits, rewrite commit
Philip Zeyliger5ebdbb82025-05-10 17:20:29 -070080messages, and so forth; it's good at it!
81
82### Reviewing Diffs
83
84The diff view shows you changes since Sketch started. Leaving comments on lines
Josh Bleecher Snyder39ed5a52025-05-12 17:34:45 -070085adds them to the chat box, and, when you hit Send (at the bottom of the page), Sketch goes to work addressing your
Philip Zeyliger5ebdbb82025-05-10 17:20:29 -070086comments.
87
Philip Zeyliger6458e7c2025-05-10 18:07:54 -070088### Connecting to Sketch's Container
89
90You can interact directly with the container by:
91
92 1. Using the "Terminal" tab in the UI
93 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`.
94We have automatically configured your SSH configuration to make these special hostnames work.
95 3. Using Visual Studio Code. Again, look for a command line or magic link behind the information icon,
96or when Sketch starts up. This starts a new VSCode session "remoted into" the container. You
Josh Bleecher Snyder39ed5a52025-05-12 17:34:45 -070097can edit the code, use the terminal, review diffs, and so forth.
Philip Zeyliger6458e7c2025-05-10 18:07:54 -070098
99By using SSH (and/or VSCode), you can forward ports from the container to your
100machine. For example, if you want to start your development webserver, you can
101do something like `ssh -L8000:localhost:8888 sketch-ilik-epor-tfor-ward go run
102./cmd/server` to make `http://localhost:8000/` on your machine point to
103`localhost:8888` inside the container.
104
105
Philip Zeyliger5ebdbb82025-05-10 17:20:29 -0700106### Using the Browser Tools
107
108You can ask Sketch to browse a web page and take screenshots. There are tools
Josh Bleecher Snyder39ed5a52025-05-12 17:34:45 -0700109both for taking screenshots and "reading images", the latter of which sends the
Philip Zeyliger5ebdbb82025-05-10 17:20:29 -0700110image to the LLM. This functionality is handy if you're working on a web page and
111want to see what the in-progress change looks like.
112
Philip Zeyliger39bcf012025-05-12 10:07:40 -0700113## FAQ
114
115### `no space left on device`
116
117Docker images, containers, and so forth tend to pile up. `docker prune -a` is a good
118command to start with to prune unused images and containers.
119
Philip Zeyligerd43e5722025-04-23 19:21:26 -0700120## Development
121
M-Ab5cb9542025-05-02 11:32:34 -0400122[![Go Reference](https://pkg.go.dev/badge/sketch.dev.svg)](https://pkg.go.dev/sketch.dev)
123
Pokey Rulebbca2402025-04-24 09:37:58 +0100124See [CONTRIBUTING.md](CONTRIBUTING.md)
Philip Zeyligerd43e5722025-04-23 19:21:26 -0700125
David Crawshaw64d32992025-04-21 09:14:36 -0700126## Open Source
127
128Sketch is open source.
129It is right here in this repository!
130Have a look around and mod away.
131
132If you want to run sketch entirely without the sketch.dev service, you can
Philip Zeyligerd43e5722025-04-23 19:21:26 -0700133set the flag -skaband-addr="" and then provide an `ANTHROPIC_API_KEY`
David Crawshaw64d32992025-04-21 09:14:36 -0700134environment variable. (More LLM services coming soon!)