You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Point openforge at a folder. Get a three-pane editor in your browser: file tree, Monaco editor, AI chat. The chat can read your files, write changes, and ask follow-ups. No SaaS account, no per-seat pricing, no telemetry. You own the OS, you own the code, you own the API key.
6
17
7
18
## Quick start
@@ -28,20 +39,34 @@ The included `workspace/` folder has a `hello.py` file so you can try the AI imm
28
39
29
40
## How it works
30
41
42
+
```mermaid
43
+
flowchart LR
44
+
B[browser<br/>Monaco + chat] -->|HTTP| F[/api/files<br/>GET tree / GET file / PUT file/]
45
+
B -->|HTTP POST stream| C[/api/chat NDJSON/]
46
+
C --> A[agent loop<br/>lib/llm.ts]
47
+
A -->|list_files| W[lib/workspace.ts<br/>sandboxed]
48
+
A -->|read_file| W
49
+
A -->|write_file| W
50
+
W --> D[(WORKSPACE_DIR<br/>your folder)]
51
+
A -->|response| B
31
52
```
32
-
browser (Monaco + React)
33
-
│ ⇅ HTTP
34
-
Next.js API routes
35
-
├── /api/files GET tree | GET file | PUT file
36
-
└── /api/chat POST messages -> NDJSON stream of events
37
-
↓
38
-
agent loop (lib/llm.ts)
39
-
├── list_files() -> workspace tree as JSON
40
-
├── read_file(path) -> file content
41
-
└── write_file(path, c) -> overwrites file
42
-
```
43
53
44
-
Every tool call is sandboxed by `lib/workspace.ts::safe(path)`, which resolves the input against `WORKSPACE_DIR` and rejects anything that escapes. Tool iterations are capped at 8 per turn to prevent loops.
54
+
Every tool call is sandboxed by `lib/workspace.ts::safe(path)`, which resolves the input against `WORKSPACE_DIR` and rejects anything that escapes. Tool iterations are capped at 8 per turn to prevent loops. The chat stream is NDJSON — one event per line — so the UI renders tool calls and tool results as they happen.
|**LOC you must read to debug**|~800 | proprietary | thousands | thousands |~10k |
67
+
|**Best for**| self-host on a VPS, read on iPad | desktop dev | VS Code / JetBrains users | VS Code agentic users | terminal lovers |
68
+
69
+
If you want the best AI coding experience and don't care about self-hosting, use **Cursor** or **Continue**. If you want to read every line of the thing that's editing your files and run it on a Raspberry Pi, this is for you.
45
70
46
71
## What this is NOT
47
72
@@ -68,6 +93,20 @@ If you want autocomplete-grade integration today, look at **Continue.dev** (VS C
68
93
- There is no authentication. Run on `localhost`, behind a VPN, or behind HTTP basic auth at the proxy.
69
94
- The `/api/chat` route accepts arbitrary message history. Don't expose this publicly without rate-limiting.
70
95
96
+
## FAQ
97
+
98
+
**Why not just use Cursor?** If Cursor works for you, use it. openforge exists for people who want to run an AI editor on a server they control, reach it from any device through a browser, and read every line of code that touches their files.
99
+
100
+
**Why no inline completion?** Building reliable inline ghost-text requires model-side support (FIM completion APIs), token-level streaming, and careful UX. The chat-driven panel is the 80% solution in 800 lines.
101
+
102
+
**Why no codebase embeddings?** Adding embeddings means another service, another index, and another set of failure modes. The model only sees what it explicitly reads via `read_file` — that's transparent and debuggable.
103
+
104
+
**Can the AI escape the sandbox?** It cannot — `safe()` resolves every path against `WORKSPACE_DIR` and rejects anything that escapes via `..`. The tests cover this (`workspace.test.ts`). If you find a way, please report it as a security issue.
105
+
106
+
**Anthropic / local models support?** OpenAI today. Adding Anthropic is ~30 lines in `lib/llm.ts` — open an issue and I'll point you at the spot.
107
+
108
+
**Multi-folder support?** Not yet. `WORKSPACE_DIR` is global. A folder switcher in the sidebar is a clean addition if you want to PR it.
109
+
71
110
## Tests
72
111
73
112
```bash
@@ -76,6 +115,14 @@ npm test
76
115
77
116
Tests cover the path sandbox, tree listing, and file read/write. They run without an API key.
78
117
118
+
## Contributing
119
+
120
+
See [CONTRIBUTING.md](CONTRIBUTING.md). Security: see [SECURITY.md](SECURITY.md). The sandbox in `lib/workspace.ts` is the single most important file — extra scrutiny there.
121
+
122
+
## Star history
123
+
124
+
[](https://star-history.com/#krish9219/openforge&Date)
Only the `main` branch is supported. There are no version releases yet.
6
+
7
+
## Reporting
8
+
9
+
Email the maintainer via the GitHub profile, or use GitHub's private vulnerability reporting. Please do not open public issues for sandbox-escape or auth-related concerns.
10
+
11
+
## Threat model
12
+
13
+
`openforge` exposes a folder on disk to an LLM. The risks:
14
+
15
+
-**Path traversal via the AI's tool arguments.** Mitigation: `lib/workspace.ts::safe()` resolves every path against `WORKSPACE_DIR` and rejects anything that escapes. Tested in `lib/workspace.test.ts`. If you find a bypass, this is a high-priority security issue.
16
+
-**Path traversal via the HTTP API.**`/api/files?path=...` passes the user input through `safe()` before reading or writing. Same protection.
17
+
-**Prompt injection through file contents.** A file the AI reads can contain instructions that override the system prompt. The mitigation is the 8-iteration cap and the small, well-defined tool surface (only `list_files`, `read_file`, `write_file`).
18
+
-**No authentication.** The dev server is open. Production deployments must be behind reverse-proxy auth (basic auth at nginx, Cloudflare Access, etc.). Documented in the README.
19
+
20
+
## What's intentionally not protected
21
+
22
+
- The contents of files the AI writes. If you ask it to write malicious code, it will. That's not a security issue, that's the user holding the gun by the trigger.
23
+
- The API key in `.env`. Standard file-system permissions are the right protection.
24
+
25
+
If you find a vulnerability outside this list, please report it.
0 commit comments