-
Notifications
You must be signed in to change notification settings - Fork 0
CodeCompletion
github-actions[bot] edited this page Feb 28, 2026
·
1 revision
ClawDE provides inline AI-powered code completion using a fill-in-middle (FIM) approach. The completion engine integrates directly with the daemon and surfaces suggestions as ghost text in the editor.
When the cursor is idle for 150 ms (debounce), the editor sends the text before and after the cursor (prefix + suffix) to the completion.complete RPC. The daemon:
- Checks the LRU cache (256 entries, key = SHA-256 of last-512 bytes of prefix + first-128 bytes of suffix).
- On miss, extracts repo context (import statements + nearest function signature, capped at 512 tokens).
- Builds the FIM prompt and forwards to the configured provider.
- Caches the result and returns the insertion text.
Complete the missing code. Language: Rust.
Return ONLY the inserted text — no markdown fences, no explanation.
<|fim_prefix|>{prefix}<|fim_suffix|>{suffix}<|fim_middle|>
The provider fills in the <|fim_middle|> token.
- The first line of the suggestion appears in grey italic text below the cursor.
- Tab — accept the full suggestion and insert it at the cursor.
- Escape — dismiss the suggestion without inserting.
- A spinner in the top-right corner appears while a request is in flight.
[completion] section in ~/.claw/config.toml:
[completion]
enabled = true
debounce_ms = 150
max_tokens = 64
provider = "codex-spark" # or "claude-haiku"| Field | Default | Description |
|---|---|---|
enabled |
true |
Enable/disable completions globally |
debounce_ms |
150 |
Delay before sending request (milliseconds) |
max_tokens |
64 |
Max tokens to generate per completion |
provider |
"codex-spark" |
Provider for completions; "claude-haiku" also supported |
Request:
{
"filePath": "src/main.rs",
"prefix": "fn add(a: i32, b: i32) -> i32 {\n ",
"suffix": "\n}",
"cursorLine": 1,
"cursorCol": 4,
"fileContent": "full file text (optional, for context injection)",
"sessionId": "session-uuid"
}Response:
{
"insertions": [
{ "text": "a + b", "startLine": 1, "endLine": 1, "confidence": 0.9 }
],
"source": "provider"
}source is "cache" when the result was served from the LRU cache.
Hit rate and entry count are exposed via analytics.budget as completion_cache_hit_rate and completion_cache_entries.
ClawDE · GitHub · MIT License
ClawDE
Getting started
Reference
- Architecture
- Daemon-Reference
- Folder-Structure
- Providers
- Multi-Account
- Security
- Features
- Features/Daemon
- Features/Session-Manager
- Features/Mode-System
- Features/Repo-Intelligence
- Features/Projects
- Features/Remote-Access
- Features/Desktop-App
- Features/Provider-Knowledge
- Features/Coding-Standards
- Roadmap
Branding
Contributing