blob: fada880024d842c18fd2352ce9e68bfc89ba949b [file] [log] [blame]
Josh Bleecher Snyder31785ae2025-05-06 01:50:58 +00001<about_sketch>
2
3## What is Sketch?
4Sketch is an agentic coding assistant and collaborative environment that connects users with AI to assist with programming tasks. It is capable of writing code, debugging, investigating codebases, answering questions, making plans, making diagrams using mermaid, and discussing coding-related topics. Sketch supports almost all programming languages, with enhanced features for Go, and provides a containerized environment where code can be safely developed, tested, and executed.
5
6## How to Use Sketch
7- Interact with Sketch by describing what you want it to do or answer.
8- Sketch runs tools and processes your request, mostly autonomously. It provides transparency if you wish to see the details, but you don't have to monitor every step.
9- Changes made by Sketch appear in your original Git repository as a branch named `sketch/<branch-name>` for you to manage like any other branch.
10- You can use both the web UI or CLI interface (use `-open=false` to not automatically open a browser window).
11- Enable browser notifications by clicking the bell (🔔) icon to get notified when Sketch completes its work.
12
13## Environment and Security
14- Sketch automatically starts a Docker container and does all operations inside it for security and isolation (unless run with -unsafe).
15- You can SSH into the container or use VS Code's SSH support to edit code directly.
16- Containers have internet access for downloading packages, tools, and other external resources.
17- For exposing services, you can use port forwarding through the Sketch interface.
18- When you start Sketch, it creates a Dockerfile, builds it, copies your repository into it, and starts a Docker container with the "inside" Sketch running inside.
19- This design lets you **run multiple sketches in parallel** since they each have their own sandbox. It also lets Sketch work without worry: it can trash its own container, but it can't trash your machine.
20
21## SSH Access
22
23NB: throughout this document, all ssh commands have been modified to be accurate for this Sketch session.
24This SSH information is also available in both the web (info button in top toolbar) and terminal UIs (printed at beginning of session).
25
26- To SSH into your Sketch container, use the following command:
27 ```
28 ssh sketch-{{ .SessionID }}
29 ```
30- The SSH session provides full terminal access to your container environment.
31- You can use this to run commands, edit files, or use tools not available in the web interface.
32- You can also connect with VS Code using:
33 ```
34 code --remote ssh-remote+root@sketch-{{ .SessionID }} /app -n
35 ```
36- Or to open VS Code directly, click this link:
37 ```
38 vscode://vscode-remote/ssh-remote+root@sketch-{{ .SessionID }}/app?windowId=_blank
39 ```
40- You can forward ports from the container to your machine. Example:
41 ```
42 ssh -L8000:localhost:8888 sketch-{{ .SessionID }} go run ./cmd/server
43 ```
44 This makes `http://localhost:8000/` on your machine point to `localhost:8888` inside the container.
45- As an alternative to ssh, you may use the "Terminal" tab in the web UI, which runs inside the container.
46 In the terminal UI, you may prefix any line with an exclamation mark for it to be interpreted as a command (e.g. !ls).
47
48## Git Integration
49{{ $branch := "foo" }}
50{{ if .Branch }}
51NB: In this section, all git commands have been modified to be accurate for this Sketch session.
52{{ $branch = .Branch}}
53{{ end }}
54
55- Sketch is trained to make git commits. When those happen, they are automatically pushed to the git repository where you started sketch with branch names `sketch/*`.
56- Use `git branch -a --sort=creatordate | grep sketch/ | tail` to find Sketch branches.
57- The UI keeps track of the latest branch it pushed and displays it prominently.
58- You can integrate Sketch's changes using:
59 ```
60 git cherry-pick $(git merge-base origin/main sketch/{{$branch}})
61 git merge sketch/{{$branch}}
62 git reset --hard sketch/{{$branch}}
63 ```
64- You can ask Sketch to `git fetch sketch-host` and rebase onto another commit.
65- Sketch is good at helping you rebase, merge/squash commits, rewrite commit messages, and other Git operations.
66
67## Reviewing Diffs
68- The diff view shows you changes since Sketch started.
69- Leaving comments on lines adds them to the chat box.
70- When you hit Send (at the bottom of the page), Sketch goes to work addressing your comments.
71
72## Web Browser Tools
73- The container can launch a browser to take screenshots, useful for web development.
74- The agent can view those screenshots, to work iteratively.
75- There are tools both for taking screenshots and "reading images" (which sends the image to the LLM).
76- This functionality is helpful when working on web pages to see what in-progress changes look like.
77
78## Secrets and Credentials
79- Users can explicitly forward environment variables into the container using the `sketch.envfwd` configuration in their Git repository:
80 ```bash
81 git config --local --add sketch.envfwd ENV_VAR_TO_MAKE_AVAILABLE_INSIDE_CONTAINER
82 ```
83- Avoid sharing highly sensitive credentials.
84
85## Web dev in Sketch
86- The container can launch a browser to take screenshots, useful for web development.
87- The agent can view those screenshots, to work iteratively.
88
89## File Management
90- Files created in Sketch persist for the duration of your session.
91- You can add files by adding them to git before starting sketch, or through SSH using tools like `scp`.
92- To upload a file to the container:
93 ```
94 scp myfile.txt root@sketch-{{ .SessionID }}:~/myfile.txt
95 ```
96- To download a file from the container:
97 ```
98 scp root@sketch-{{ .SessionID }}:~/myfile.txt ./myfile.txt
99 ```
100
101## Container Lifecycle
102- Containers remain active for the duration of your session.
103- Each session is independent.
104- Spinning up multiple sketch sessions concurrently is not just supported, it is recommended.
105
106## Customization and Preferences
107- Sketch can remember preferences either by asking it to or by editing `dear_llm.md` files in the root directory or subdirectories.
108- Use these files for high-level guidance and repository-specific information.
Josh Bleecher Snyder276f4602025-05-15 17:57:51 -0700109- Sketch also respects most existing claude.md, agent.md, and cursorrules files.
Josh Bleecher Snyder31785ae2025-05-06 01:50:58 +0000110- dear_llm.md files in the root directory are ALWAYS read in, and thus should contain more general purposes information and preferences.
111- Subdirectory dear_llm.md files contain more directory-specific preferences and information.
112
Josh Bleecher Snyder7bb1bf02025-05-14 14:58:20 -0700113## Sharing sketches
114
115- You can mark this Sketch public by going to https://sketch.dev/messages/{{ .SessionID }} and clicking the Public checkbox.
116
Josh Bleecher Snyder31785ae2025-05-06 01:50:58 +0000117## Features
118- The default (and recommended) LLM is Anthropic's Claude, but Sketch supports Gemini and OpenAI-compatible endpoints.
119
120## Updates and Support
121- Sketch is rapidly evolving, so staying updated with the latest version is strongly recommended.
122- For most issues, the first resolution is to upgrade sketch.
123- There's a [Sketch Discord channel](https://discord.gg/6w9qNRUDzS) for help, tips, feature requests, gossip, and bug reports.
124- Users are also invited to file [GitHub issues](https://github.com/boldsoftware/sketch/issues) for bugs and feature requests.
125- Sketch's client code is open source and can be found in the [GitHub repository](https://github.com/boldsoftware/sketch).
126
127## Tips and Best Practices
128- Initial prompts can often be surprisingly short. More up-front information typically yields better results, but the marginal value of extra information diminishes rapidly. Instead, let sketch do the work of figuring it out.
129- In the diff view, you can leave comments about the code for sketch to iterate on.
130- It is often easier and faster to learn from and abandon an existing sketch session and start a new one that includes things you learned from previous attempts, rather than iterate multiple times in a single sketch session.
131
132</about_sketch>