Skip to content

Commit d051714

Browse files
committed
docs: final cleanup — WEBUI.md features, CONFIG.md caveats, README test count
- Add WEBUI.md docs for token economics, inline loading indicator, smart autoscroll (+ update done event fields and line count) - Mark llm_learn/llm_curate as template-only in CONFIG.md (not parsed from JSON at runtime) - Add note that subagent config section is hardcoded in production - Fix README test count: 888 -> 880 (stale after codebase changes) - Clean up stale build artifacts (coverage.out, /kode binary)
1 parent 2454798 commit d051714

3 files changed

Lines changed: 33 additions & 5 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ The full `Config` struct supports: `BaseURL`, `Thinking`, `SandboxCleanup`, `Ren
175175
## Test
176176

177177
```bash
178-
go test ./... # 888 tests, all pass
178+
go test ./... # 880 tests, all pass
179179
go test -race ./... # race detector clean
180180
go test -cover ./... # 79%+ average coverage
181181
```

docs/CONFIG.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ The `skills` section controls the skill system:
104104
| `max_auto_load` || 3 | Max skills injected into system prompt on start |
105105
| `max_lazy_slots` || 5 | Max skills loaded per user input via trigger matching |
106106
| `learn` | `KODE_SKILLS_LEARN` | `true` | Enable skill learning mode (detects patterns, suggests skills). On by default |
107-
| `llm_learn` || `true` | Use LLM to enrich detected patterns with better names, descriptions, and structured content |
108-
| `llm_curate` || `true` | Use LLM for curation quality assessment and improvement suggestions |
107+
| `llm_learn` || `true` | Use LLM to enrich detected patterns. **Template-only** — set via `kode init`, not parsed from JSON at runtime |
108+
| `llm_curate` || `true` | Use LLM for curation quality assessment. **Template-only** — set via `kode init`, not parsed from JSON at runtime |
109109
| `dirs` || [] | Extra skill directories beyond `~/.kode/skills` and `./.kode/skills` |
110110
| `import.max_size_bytes` || 1048576 (1MB) | Max size for fetched skill content |
111111
| `import.timeout_seconds` || 5 | HTTP timeout for skill URI fetch |
@@ -173,6 +173,8 @@ The `subagent` section controls task decomposition and parallel sub-agent execut
173173

174174
This section is optional. Omitted fields inherit sensible defaults.
175175

176+
> **Note**: The `subagent` section is currently read only from `kode.json` by the `kode subagent` command in test code. Runtime values (`max_concurrency`, `timeout_seconds`) are hardcoded in production `kode run`/`kode serve`. This may be wired up fully in a future release.
177+
176178
## MCP server configuration
177179

178180
Connect to **external MCP servers** and expose their tools to the agent.

docs/WEBUI.md

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,32 @@ The server uses a **custom WebSocket implementation** (`internal/ws/`) — ~200
3939

4040
### @ resource completion
4141

42+
### Token economics
43+
44+
Each response shows **per-message token stats** appended to the assistant bubble:
45+
46+
-**Latency**: wall-clock time for the agent loop
47+
-**Context tokens**: cumulative prompt tokens across all iterations
48+
-**Output tokens**: cumulative completion tokens
49+
50+
The **top bar** displays **session-level totals** (∑ ⌂ context · ⎇ output), reset when you start a new session.
51+
52+
### Inline loading indicator
53+
54+
When you send a prompt, a compact **`.loading-indicator`** appears below your message (not a full-screen overlay). It shows:
55+
56+
- An animated spinner
57+
- Cycling status messages every 2s: *"⚡ Thinking..."*, *"🔬 Analyzing..."*, *"🧪 Running diagnostics..."*, etc.
58+
- 8 rotating messages keep you informed without blocking the UI
59+
60+
The indicator is removed automatically when the first `token` event arrives or on error.
61+
62+
### Smart autoscroll
63+
64+
The chat **only auto-scrolls when you're near the bottom** (within 60px). If you scroll up to read previous content while the agent responds, the page **does not steal your scroll position**. When you send a new message, it force-scrolls to the latest response.
65+
66+
This uses `requestAnimationFrame` batching to avoid layout thrashing during high-frequency token updates.
67+
4268
Type `@` followed by a filename to see an autocomplete dropdown. kode resolves matching files and sessions:
4369

4470
| Prefix | Source | Example |
@@ -94,7 +120,7 @@ The UI communicates entirely over a single WebSocket at `/ws`. Messages are newl
94120
| `token` | Streamed text content | `content` (markdown) |
95121
| `tool_call` | Agent invokes a tool | `name`, `command` |
96122
| `tool_result` | Tool returns output | `name`, `output` (truncated to 500 chars) |
97-
| `done` | Agent finishes | `latency` (seconds) |
123+
| `done` | Agent finishes | `latency` (seconds), `contextTokens`, `outputTokens`, `sessionContextTokens`, `sessionOutputTokens` |
98124
| `error` | Agent or server error | `message` |
99125
| `approval_request` | Agent needs user approval for dangerous operation | `id`, `risk` (class name), `command` (or resource), `description`, `is_operation` |
100126

@@ -132,7 +158,7 @@ Example event sequence:
132158

133159
### Frontend (`cmd/kode/ui/index.html`)
134160

135-
- ~770 lines: single file with embedded CSS and vanilla JS (no frameworks)
161+
- ~1,200 lines: single file with embedded CSS and vanilla JS (no frameworks)
136162
- **Design system**: loaded from `https://assets.21no.de/css/tokens.css` — dark theme with CSS custom properties (`--bg-primary`, `--accent`, `--text-primary`, etc.)
137163
- **Typeface**: loaded from `https://assets.21no.de/fonts/fonts.css` — uses `var(--font-sans)` and `var(--font-mono)`
138164
- **Streaming**: token content is batch-rendered via `requestAnimationFrame` to avoid layout thrashing

0 commit comments

Comments
 (0)