Skip to content

Commit 7c65157

Browse files
DLhuglyclaude
andcommitted
docs: rewrite README/website + fix context compaction overflow
README & Website: - Story-driven structure with dual "Get It" section - ClifCode condensed from 6 subsections to 1 - Website: terminal mockup with TUI colors, 6 feature cards, dual-CTA hero - macOS fix demoted to note + FAQ entry - ClifCode install: cargo install --git (npm/crates coming soon) - Fix semantic-release git assets path: ../README.md → README.md Context compaction (fixes 400 errors on large codebases): - Tiered compaction: truncate large tool results → stub old tool results → drop old turns - Compact before every API call at 100k token budget - On 400 error, auto-compact aggressively to 30k and retry once Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 6563d07 commit 7c65157

File tree

5 files changed

+495
-272
lines changed

5 files changed

+495
-272
lines changed

README.md

Lines changed: 102 additions & 132 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,12 @@
2121
</p>
2222

2323
<p align="center">
24-
<a href="https://clifcode.io">🌐 Website</a> &nbsp;·&nbsp;
25-
<a href="#-clifpad--download">🖥️ ClifPad</a> &nbsp;·&nbsp;
26-
<a href="#-clifcode--install">⚡ ClifCode</a> &nbsp;·&nbsp;
27-
<a href="#-development">🛠️ Development</a> &nbsp;·&nbsp;
28-
<a href="https://github.com/DLhugly/Clif-Code/releases">📦 Releases</a>
24+
<a href="https://clifcode.io">Website</a> &nbsp;&middot;&nbsp;
25+
<a href="#-get-it">Get It</a> &nbsp;&middot;&nbsp;
26+
<a href="#-clifpad">ClifPad</a> &nbsp;&middot;&nbsp;
27+
<a href="#-clifcode">ClifCode</a> &nbsp;&middot;&nbsp;
28+
<a href="#-build--contribute">Development</a> &nbsp;&middot;&nbsp;
29+
<a href="https://github.com/DLhugly/Clif-Code/releases">Releases</a>
2930
</p>
3031

3132
---
@@ -40,61 +41,71 @@ No Electron. No telemetry. No subscription. Open source.
4041
<img src="SplashScreen.png" alt="ClifPad Screenshot" width="800" />
4142
</p>
4243

43-
```
44-
Clif-Code/
45-
├── clif-pad-ide/ 🖥️ Desktop IDE — Tauri 2 + SolidJS + Monaco
46-
├── clif-code-tui/ ⚡ Terminal AI agent — pure Rust, any API
47-
└── .github/ 🔄 CI/CD (auto-release, npm publish)
48-
```
49-
5044
---
5145

52-
## 🖥️ ClifPad — Download
46+
## 📦 Get It
5347

54-
<p align="center">
55-
<a href="https://github.com/DLhugly/Clif-Code/releases/download/v1.3.0/ClifPad_1.3.0_aarch64.dmg"><img src="https://img.shields.io/badge/macOS-Apple%20Silicon%20(.dmg)-000000?style=for-the-badge&logo=apple&logoColor=white" alt="Apple Silicon"></a>
56-
&nbsp;
57-
<a href="https://github.com/DLhugly/Clif-Code/releases/download/v1.3.0/ClifPad_1.3.0_x64.dmg"><img src="https://img.shields.io/badge/macOS-Intel%20(.dmg)-000000?style=for-the-badge&logo=apple&logoColor=white" alt="Intel"></a>
58-
</p>
48+
<table>
49+
<tr>
50+
<td width="50%" valign="top">
5951

60-
<p align="center">
61-
<a href="https://github.com/DLhugly/Clif-Code/releases/download/v1.3.0/ClifPad_1.3.0_x64-setup.exe"><img src="https://img.shields.io/badge/Windows-x64%20(.exe)-0078D4?style=for-the-badge&logo=windows&logoColor=white" alt="Windows"></a>
62-
&nbsp;
63-
<a href="https://github.com/DLhugly/Clif-Code/releases/download/v1.3.0/ClifPad_1.3.0_amd64.deb"><img src="https://img.shields.io/badge/Linux-x64%20(.deb)-FCC624?style=for-the-badge&logo=linux&logoColor=black" alt="Linux deb"></a>
64-
&nbsp;
65-
<a href="https://github.com/DLhugly/Clif-Code/releases/download/v1.3.0/ClifPad_1.3.0_amd64.AppImage"><img src="https://img.shields.io/badge/Linux-AppImage-FCC624?style=for-the-badge&logo=linux&logoColor=black" alt="Linux AppImage"></a>
52+
### ClifPad — Desktop IDE
53+
54+
<p>
55+
<a href="https://github.com/DLhugly/Clif-Code/releases/download/v1.4.0/ClifPad_1.4.0_aarch64.dmg"><img src="https://img.shields.io/badge/macOS-Apple%20Silicon%20(.dmg)-000000?style=for-the-badge&logo=apple&logoColor=white" alt="Apple Silicon"></a>
56+
<a href="https://github.com/DLhugly/Clif-Code/releases/download/v1.4.0/ClifPad_1.4.0_x64.dmg"><img src="https://img.shields.io/badge/macOS-Intel%20(.dmg)-000000?style=for-the-badge&logo=apple&logoColor=white" alt="Intel"></a>
57+
</p>
58+
<p>
59+
<a href="https://github.com/DLhugly/Clif-Code/releases/download/v1.4.0/ClifPad_1.4.0_x64-setup.exe"><img src="https://img.shields.io/badge/Windows-x64%20(.exe)-0078D4?style=for-the-badge&logo=windows&logoColor=white" alt="Windows"></a>
60+
<a href="https://github.com/DLhugly/Clif-Code/releases/download/v1.4.0/ClifPad_1.4.0_amd64.deb"><img src="https://img.shields.io/badge/Linux-.deb-FCC624?style=for-the-badge&logo=linux&logoColor=black" alt="Linux deb"></a>
61+
<a href="https://github.com/DLhugly/Clif-Code/releases/download/v1.4.0/ClifPad_1.4.0_amd64.AppImage"><img src="https://img.shields.io/badge/Linux-AppImage-FCC624?style=for-the-badge&logo=linux&logoColor=black" alt="Linux AppImage"></a>
6662
</p>
6763

68-
> [All releases & checksums](https://github.com/DLhugly/Clif-Code/releases)
64+
> **macOS "App can't be opened"?** — Run `xattr -cr /Applications/ClifPad.app` then open normally. [Why?](#-faq)
6965
70-
### macOS — "App can't be opened"
66+
</td>
67+
<td width="50%" valign="top">
7168

72-
Clif is open source but not yet notarized with Apple ($99/year). macOS blocks unsigned apps by default. This is normal for open source software — run one command to fix it:
69+
### ClifCode — Terminal Agent
7370

7471
```bash
75-
xattr -cr /Applications/ClifPad.app
72+
cargo install --git https://github.com/DLhugly/Clif-Code.git --path clif-code-tui
7673
```
7774

78-
Then open ClifPad normally. This removes the quarantine flag that macOS sets on downloads. [Why does this happen?](#-faq)
75+
Run `clifcode` in any project directory.
7976

80-
**From source:**
77+
> `npm i -g clifcode` — coming soon &nbsp;|&nbsp; `cargo install clifcode` — coming soon
78+
79+
<details>
80+
<summary>Other install methods</summary>
8181

8282
```bash
83-
git clone https://github.com/DLhugly/Clif-Code.git && cd Clif-Code
84-
cd clif-pad-ide && npm install && npm run tauri dev
83+
# Or clone and build locally
84+
git clone https://github.com/DLhugly/Clif-Code.git
85+
cd Clif-Code/clif-code-tui && cargo install --path .
8586
```
8687

87-
### ✨ Features
88+
</details>
89+
90+
</td>
91+
</tr>
92+
</table>
93+
94+
> [All releases & checksums](https://github.com/DLhugly/Clif-Code/releases)
95+
96+
---
97+
98+
## 🖥️ ClifPad
8899

89-
**📝 Monaco Editor** — 70+ languages, IntelliSense, multi-cursor, minimap, code folding. The same engine as VS Code.
100+
**📝 Monaco Editor** — 70+ languages, IntelliSense, multi-cursor, minimap, code folding. Same engine as VS Code.
90101

91-
**🖥️ Real Terminal** — Native PTY via Rust. Your actual shell with 256-color, resize, 10K scrollback. Not a simulation.
102+
**🖥️ Real Terminal** — Native PTY via Rust. Your actual shell with 256-color, resize, 10K scrollback.
92103

93-
**🔍 Dev Preview** — One-click `npm run dev`, auto-detects `localhost` URLs, live iframe preview. Run and see your app without switching windows.
104+
**🔍 Dev Preview** — One-click `npm run dev`, auto-detects `localhost`, live iframe preview.
94105

95-
**🌿 Git** — Branch, status, stage, commit, per-file `+/-` diff stats, visual commit graph. All Rust, no shelling out.
106+
**🌿 Git** — Branch, status, stage, commit, per-file `+/-` diff stats, visual commit graph. All Rust.
96107

97-
**🤖 AI** — OpenRouter (Claude, GPT-4, Gemini, 100+ models), Ollama (fully local), Claude Code CLI. Ghost text completions. All opt-in. Works fine offline with zero keys.
108+
**🤖 AI** — OpenRouter (100+ models), Ollama (fully local), Claude Code CLI. Ghost text completions. All opt-in.
98109

99110
**🎨 5 Themes** — Midnight, Graphite, Dawn, Arctic, Dusk. Editor, terminal, and UI stay in sync.
100111

@@ -104,68 +115,19 @@ cd clif-pad-ide && npm install && npm run tauri dev
104115

105116
| | Binary | Runtime | RAM idle |
106117
|---|--------|---------|----------|
107-
| **ClifPad** | **~20MB** 🟢 | **7KB** 🟢 | **~80MB** 🟢 |
108-
| Cursor | ~400MB 🔴 | ~50MB 🔴 | ~500MB+ 🔴 |
109-
| VS Code | ~350MB 🔴 | ~40MB 🔴 | ~400MB+ 🔴 |
110-
| Zed | ~100MB 🟡 | native | ~200MB 🟡 |
111-
112-
Tauri 2 compiles to a single native binary. SolidJS has no virtual DOM overhead. Rust handles all heavy lifting — file I/O, git, PTY, AI streaming — with zero garbage collection.
113-
114-
### 🏗️ Architecture
115-
116-
```
117-
┌─────────────────────────────────────────┐
118-
│ Tauri 2 (Rust) │
119-
│ File I/O · Git · PTY · AI · Search │
120-
│ │ │
121-
│ IPC (invoke/events) │
122-
│ │ │
123-
│ SolidJS + TypeScript │
124-
│ Monaco Editor · xterm.js │
125-
│ Tailwind CSS 4 │
126-
└─────────────────────────────────────────┘
127-
```
118+
| **ClifPad** | **~20MB** | **7KB** | **~80MB** |
119+
| Cursor | ~400MB | ~50MB | ~500MB+ |
120+
| VS Code | ~350MB | ~40MB | ~400MB+ |
121+
| Zed | ~100MB | native | ~200MB |
128122

129-
| Layer | Tech | Size |
130-
|-------|------|------|
131-
| Backend | Tauri 2 + Rust | ~20MB compiled |
132-
| UI | SolidJS | 7KB runtime |
133-
| Editor | Monaco | tree-shaken |
134-
| Terminal | xterm.js + portable-pty | real PTY |
135-
| Styles | Tailwind CSS 4 | zero runtime |
136-
| Build | Vite 6 | <5s HMR |
137-
| CI/CD | Semantic Release | auto-versioned |
123+
Tauri 2 compiles to a single native binary. SolidJS has no virtual DOM overhead. Rust handles file I/O, git, PTY, AI streaming — zero garbage collection.
138124

139125
---
140126

141-
## ⚡ ClifCode — Install
127+
## ⚡ ClifCode
142128

143129
> **Open-source AI coding agent for your terminal. Like Claude Code — but you own it.**
144130
145-
```bash
146-
npm i -g clifcode
147-
```
148-
149-
That's it. Run `clifcode` in any project directory.
150-
151-
<details>
152-
<summary><strong>Other install methods</strong></summary>
153-
154-
```bash
155-
# Build from source
156-
git clone https://github.com/DLhugly/Clif-Code.git && cd Clif-Code
157-
cd clif-code-tui && cargo install --path .
158-
159-
# Or just run it directly
160-
cd clif-code-tui && cargo run --release
161-
```
162-
163-
</details>
164-
165-
### 🎬 How it looks
166-
167-
ClifCode is a tool-calling AI agent that reads your codebase, writes code, runs commands, searches files, and auto-commits — all from a beautiful TUI.
168-
169131
```
170132
_____ _ _ __ _____ _
171133
/ ____| (_)/ _/ ____| | |
@@ -200,47 +162,23 @@ ClifCode is a tool-calling AI agent that reads your codebase, writes code, runs
200162
∙ 2.1k tokens ∙ ~$0.0312
201163
```
202164

203-
### 🛠️ Features
165+
**What it does:** Tool-calling AI agent that reads your codebase, writes code, runs commands, searches files, and auto-commits — all from a TUI.
204166

205-
| | Feature | Details |
206-
|---|---------|---------|
207-
| 🔄 | **Agentic loop** | Up to 7 tool calls per turn — reads, writes, runs, searches, commits automatically |
208-
| 🌐 | **Any provider** | OpenRouter, OpenAI, Anthropic, Ollama, or any OpenAI-compatible endpoint |
209-
|| **Parallel tools** | Read-only calls (file reads, searches) execute concurrently on threads |
210-
| 📡 | **Streaming** | Responses render live with markdown formatting, code blocks, and syntax hints |
211-
| 🎛️ | **3 autonomy modes** | `suggest` — confirm writes · `auto-edit` — apply with diffs · `full-auto` — hands-off |
212-
| 💾 | **Sessions** | Auto-saves every conversation. Resume any session with `/resume` |
213-
| 🔀 | **Auto-commit** | Commits changes with descriptive messages. One-command `/undo` |
214-
| 💰 | **Cost tracking** | Per-turn and session-wide token usage with estimated cost |
215-
| 🧠 | **Workspace intel** | Auto-scans project structure, reads README/Cargo.toml/package.json for context |
216-
| 🔧 | **Non-interactive** | `clifcode -p "fix the bug"` for scripts and CI |
217-
218-
### 🔧 9 Built-in Tools
219-
220-
```
221-
▶ read_file Read files (with offset for large files)
222-
✎ write_file Create new files
223-
✎ edit_file Surgical find-and-replace with diff preview
224-
◇ find_file Locate files by name across the workspace
225-
☰ list_files Directory listing with structure
226-
⌕ search Regex search across your codebase
227-
▸ run_command Execute shell commands
228-
→ change_directory Switch workspace context
229-
✓ submit Signal task completion + auto-commit
230-
```
231-
232-
### 💻 Usage
167+
| | | |
168+
|---|---|---|
169+
| **Agentic loop** — up to 7 tool calls per turn | **Any provider** — OpenRouter, OpenAI, Anthropic, Ollama | **Parallel tools** — concurrent read-only calls |
170+
| **3 autonomy modes** — suggest, auto-edit, full-auto | **Sessions** — auto-save, resume, cost tracking | **9 built-in tools** — read, write, edit, find, search, run, list, cd, submit |
233171

234172
```bash
235-
clifcode # interactive, auto-detect backend
236-
clifcode -p "explain this codebase" # non-interactive single prompt
237-
clifcode --backend api --api-model gpt-4o # specific model
238-
clifcode --backend ollama # local Ollama
173+
clifcode # interactive mode
174+
clifcode -p "explain this codebase" # non-interactive
175+
clifcode --backend ollama # local models
239176
clifcode --autonomy suggest # confirm every write
240177
clifcode --resume # resume last session
241178
```
242179

243-
### ⌨️ Commands
180+
<details>
181+
<summary><strong>Commands & providers</strong></summary>
244182

245183
```
246184
◆ Session /new /sessions /resume /cost /clear /quit
@@ -249,19 +187,19 @@ clifcode --resume # resume last session
249187
◆ Git /status /undo
250188
```
251189

252-
### 🔌 Supported Providers
253-
254190
| Provider | Config |
255191
|----------|--------|
256192
| **OpenRouter** (default) | `CLIFCODE_API_KEY` — access to 100+ models |
257193
| **OpenAI** | `--api-url https://api.openai.com/v1` |
258194
| **Anthropic** | Via OpenRouter or compatible proxy |
259-
| **Ollama** | `--backend ollama` — fully local, no API key needed |
195+
| **Ollama** | `--backend ollama` — fully local, no API key |
260196
| **Any OpenAI-compatible** | `--api-url <your-endpoint>` |
261197

198+
</details>
199+
262200
---
263201

264-
## 🛠️ Development
202+
## 🛠️ Build & Contribute
265203

266204
```bash
267205
# ClifPad — desktop IDE
@@ -275,8 +213,40 @@ cargo run --release # run directly
275213
cargo install --path . # install to PATH
276214
```
277215

216+
### Architecture
217+
218+
```
219+
┌─────────────────────────────────────────┐
220+
│ Tauri 2 (Rust) │
221+
│ File I/O · Git · PTY · AI · Search │
222+
│ │ │
223+
│ IPC (invoke/events) │
224+
│ │ │
225+
│ SolidJS + TypeScript │
226+
│ Monaco Editor · xterm.js │
227+
│ Tailwind CSS 4 │
228+
└─────────────────────────────────────────┘
229+
```
230+
231+
| Layer | Tech | Size |
232+
|-------|------|------|
233+
| Backend | Tauri 2 + Rust | ~20MB compiled |
234+
| UI | SolidJS | 7KB runtime |
235+
| Editor | Monaco | tree-shaken |
236+
| Terminal | xterm.js + portable-pty | real PTY |
237+
| Styles | Tailwind CSS 4 | zero runtime |
238+
| Build | Vite 6 | <5s HMR |
239+
| CI/CD | Semantic Release | auto-versioned |
240+
278241
### Project Structure
279242

243+
```
244+
Clif-Code/
245+
├── clif-pad-ide/ 🖥️ Desktop IDE — Tauri 2 + SolidJS + Monaco
246+
├── clif-code-tui/ ⚡ Terminal AI agent — pure Rust, any API
247+
└── .github/ 🔄 CI/CD (auto-release, npm publish)
248+
```
249+
280250
```
281251
clif-pad-ide/
282252
├── src/ # SolidJS frontend
@@ -340,5 +310,5 @@ Any OpenAI-compatible API. Default is `anthropic/claude-sonnet-4` via OpenRouter
340310
</p>
341311

342312
<p align="center">
343-
<sub>Built with 🦀 Rust and ❤️ by <a href="https://github.com/DLhugly">DLhugly</a></sub>
313+
<sub>Built with Rust and care by <a href="https://github.com/DLhugly">DLhugly</a></sub>
344314
</p>

clif-code-tui/src/main.rs

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,26 @@ fn run_turn(
195195
ui::print_turn_indicator(turn, tools::MAX_TURNS);
196196
ui::print_thinking();
197197

198+
// Compact before sending to avoid context overflow
199+
session::compact_messages(&mut conv.messages, 100_000);
200+
198201
// Use streaming for API backend — tokens print live
199-
let response = bk.chat_stream(&conv.messages, Some(&tool_defs))?;
202+
let response = match bk.chat_stream(&conv.messages, Some(&tool_defs)) {
203+
Ok(r) => r,
204+
Err(e) => {
205+
let msg = format!("{e}");
206+
if msg.contains("status code 400") {
207+
// Likely context overflow — compact aggressively and retry once
208+
ui::clear_thinking();
209+
ui::print_dim(" (context too large — compacting and retrying)");
210+
session::compact_messages(&mut conv.messages, 30_000);
211+
ui::print_thinking();
212+
bk.chat_stream(&conv.messages, Some(&tool_defs))?
213+
} else {
214+
return Err(e);
215+
}
216+
}
217+
};
200218
ui::clear_thinking();
201219

202220
// Accumulate token usage
@@ -377,8 +395,8 @@ fn run_turn(
377395
}
378396
}
379397

380-
// Context compaction
381-
session::compact_messages(&mut conv.messages, 8000);
398+
// Context compaction — 100k token budget (~400k chars)
399+
session::compact_messages(&mut conv.messages, 100_000);
382400
}
383401

384402
ui::print_dim(" (reached turn limit)");

0 commit comments

Comments
 (0)