opencode-quill 0.6.0 → 0.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,18 @@ All notable changes are documented in this file using
4
4
  [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and
5
5
  [Semantic Versioning](https://semver.org/).
6
6
 
7
+ ## [0.6.2] - 2026-10-27
8
+
9
+ ### Fixed
10
+
11
+ - **engines:** Require OpenCode >=2.2.0
12
+
13
+ ## [0.6.1] - 2026-10-22
14
+
15
+ ### Fixed
16
+
17
+ - **prediction:** Correct sentence-start casing, trigram scoring, and next-word filtering
18
+
7
19
  ## [0.6.0] - 2026-10-22
8
20
 
9
21
  ### Added
@@ -133,6 +145,8 @@ All notable changes are documented in this file using
133
145
  - `/quill` command and command palette action to toggle autocomplete.
134
146
  - Local installer script, full test suite, CI workflows, and release tooling.
135
147
 
148
+ [0.6.2]: https://github.com/ozandogrultan/opencode-quill/compare/v0.6.1...v0.6.2
149
+ [0.6.1]: https://github.com/ozandogrultan/opencode-quill/compare/v0.6.0...v0.6.1
136
150
  [0.6.0]: https://github.com/ozandogrultan/opencode-quill/compare/v0.5.2...v0.6.0
137
151
  [0.5.2]: https://github.com/ozandogrultan/opencode-quill/compare/v0.5.1...v0.5.2
138
152
  [0.5.1]: https://github.com/ozandogrultan/opencode-quill/compare/v0.5.0...v0.5.1
package/README.md CHANGED
@@ -21,6 +21,13 @@ As you type, Quill predicts the remainder of your current prose word or the next
21
21
  word in sequence, shown as dimmed inline ghost text directly at your cursor.
22
22
  Press <kbd>Tab</kbd> or <kbd>→</kbd> to accept it, or <kbd>Esc</kbd> to dismiss.
23
23
 
24
+ <p align="center">
25
+ <img src="assets/demo.gif" alt="quill: completing words and correcting a typo as you type" width="800">
26
+ </p>
27
+
28
+ **Install:** add `"opencode-quill"` to `plugins` in `~/.config/opencode/cli.json`
29
+ and restart OpenCode ([details](#install)).
30
+
24
31
  ## What it does
25
32
 
26
33
  - **Zero AI, completely local:** Runs entirely on-device without sending prompt
@@ -92,6 +99,17 @@ A correction looks like this, with only ` → complete` dimmed:
92
99
  `please run tests`, typing `please rnu ` can suggest `tests`. Accepting it
93
100
  produces `please rnu tests`, leaving `rnu` unchanged.
94
101
 
102
+ ## Quill or Ghost?
103
+
104
+ | | quill | [ghost](https://github.com/ozandogrultan/opencode-ghost) |
105
+ | ----------- | ---------------------------------------------- | -------------------------------------------------------- |
106
+ | Suggests | the rest of the current word, or the next word | your whole next prompt |
107
+ | When | while you type a draft | the composer is empty, after a turn |
108
+ | How | a local n-gram model, no network | a small model reads the recent conversation |
109
+ | Model calls | none | one per turn |
110
+
111
+ Install both: each activates only in its own domain, with no key conflicts.
112
+
95
113
  ## Requirements
96
114
 
97
115
  - [OpenCode](https://opencode.ai) with the V2 TUI plugin runtime (the supported
@@ -220,6 +238,7 @@ handlers remain in control. Dialogs and selections also suppress Quill.
220
238
  - `/quill` — Toggle word autocomplete on or off (persisted across sessions).
221
239
  - `/quill on` / `/quill off` — Set autocomplete explicitly.
222
240
  - `/quill shell on` / `/quill shell off` — Set shell-mode autocomplete explicitly.
241
+ - `/quill clear casing` (alias `/quill reset casing`) — Forget only the learned word casing (`OpenCode`, `GitHub`), keeping the vocabulary and phrases.
223
242
  - `/quill clear` (alias `/quill reset`) — Erase everything Quill has learned from your prompts and shell commands.
224
243
  - `quill.next` / `quill.previous` — Keymap commands for cycling visible word
225
244
  alternatives; no default bindings. Configure the cycle options above or
@@ -316,6 +335,12 @@ bun run typecheck # Type verification (tsc --noEmit)
316
335
  bun run lint:sh # Syntax verification on shell scripts
317
336
  ```
318
337
 
338
+ ## More OpenCode plugins
339
+
340
+ - [sesh](https://github.com/ozandogrultan/opencode-sesh) — search, preview, and resume every session across every project.
341
+ - [ghost](https://github.com/ozandogrultan/opencode-ghost) — suggests your next prompt as ghost text in the empty composer.
342
+ - [ember](https://github.com/ozandogrultan/opencode-ember) — prices a cold prompt-cache rewrite before you send.
343
+
319
344
  ## Contributing
320
345
 
321
346
  Contributions are welcome. Please read [CONTRIBUTING.md](CONTRIBUTING.md) and
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-quill",
3
- "version": "0.6.0",
3
+ "version": "0.6.2",
4
4
  "description": "OpenCode prompt autocomplete: local n-gram word and next-word prediction shown as inline ghost text in the TUI composer, accepted with Tab.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -39,7 +39,7 @@
39
39
  },
40
40
  "packageManager": "bun@1.4.2",
41
41
  "engines": {
42
- "opencode": ">=2.1.0"
42
+ "opencode": ">=2.2.0"
43
43
  },
44
44
  "scripts": {
45
45
  "prepare": "husky",
@@ -51,8 +51,8 @@
51
51
  "prepublishOnly": "bun run test && bun run typecheck"
52
52
  },
53
53
  "dependencies": {
54
- "@opentui/core": "^0.6.6",
55
- "@opentui/solid": "^0.6.6",
54
+ "@opentui/core": "^0.7.0",
55
+ "@opentui/solid": "^0.7.0",
56
56
  "subtlex-word-frequencies": "2.0.0"
57
57
  },
58
58
  "peerDependencies": {
@@ -62,7 +62,7 @@
62
62
  "devDependencies": {
63
63
  "@commitlint/cli": "^21.2.2",
64
64
  "@commitlint/config-conventional": "^21.2.2",
65
- "@opencode/plugin": "2.0.32",
65
+ "@opencode/plugin": "2.2.0",
66
66
  "@types/bun": "^1.4.2",
67
67
  "@types/node": "26.6.5",
68
68
  "husky": "^9.1.7",
package/src/ghost.ts CHANGED
@@ -113,7 +113,8 @@ export class ComposerGhost {
113
113
  if (query && !query.next && offset === text.length && last && last.offset === last.text.length && this.memo?.index === 0 && last.revision === revision && last.predictor === predictor && last.marks === signature && !last.prediction.replace && text.startsWith(last.text)) {
114
114
  const typed = text.slice(last.text.length)
115
115
  if (typed && last.prediction.suffix.startsWith(typed) && typed.length < last.prediction.suffix.length) {
116
- predictions[0] = { ...last.prediction, suffix: last.prediction.suffix.slice(typed.length) }
116
+ const sticky = { ...last.prediction, suffix: last.prediction.suffix.slice(typed.length) }
117
+ predictions.splice(0, predictions.length, sticky, ...predictions.filter((prediction) => prediction.word !== sticky.word))
117
118
  }
118
119
  }
119
120
  this.memo = { text, offset, marks: signature, revision, predictor, predictions, index: 0 }
package/src/options.ts CHANGED
@@ -28,12 +28,14 @@ export type QuillCommand =
28
28
  | { type: "enable"; value: boolean }
29
29
  | { type: "clear" }
30
30
  | { type: "shell"; value: boolean }
31
+ | { type: "casing" }
31
32
  | { type: "invalid" }
32
33
 
33
34
  export function parseQuillCommand(input: string | undefined): QuillCommand {
34
35
  const raw = input?.trim().toLowerCase() ?? ""
35
36
  if (!raw || raw === "toggle") return { type: "toggle" }
36
37
  if (raw === "clear" || raw === "reset") return { type: "clear" }
38
+ if (raw === "clear casing" || raw === "reset casing") return { type: "casing" }
37
39
  if (raw === "on") return { type: "enable", value: true }
38
40
  if (raw === "off") return { type: "enable", value: false }
39
41
  if (raw === "shell on") return { type: "shell", value: true }
package/src/predictor.ts CHANGED
@@ -76,13 +76,14 @@ export class PersonalModel {
76
76
  this.seen.add(prompt.id)
77
77
  changed = true
78
78
  if (prompt.text.length > 4000 || prompt.text.split("\n").length > 12) continue
79
+ const masked = this.grammar.prose ? this.grammar.mask(prompt.text) : prompt.text
79
80
  for (const sequence of this.grammar.sequences(prompt.text)) {
80
81
  const words = sequence.map((word) => word.text)
81
82
  for (let index = 0; index < words.length; index++) {
82
83
  const { start, end } = sequence[index]
83
84
  increment(this.words, words[index])
84
85
  const form = prompt.text.slice(start, end).normalize("NFC").replaceAll("’", "'")
85
- if (this.grammar.prose && form !== words[index] && !sentenceStart(prompt.text, start)) increment(this.forms, form)
86
+ if (this.grammar.prose && form !== words[index] && !sentenceStart(masked, start)) increment(this.forms, form)
86
87
  if (index > 0) increment(this.bigrams, `${words[index - 1]}\0${words[index]}`)
87
88
  if (index > 1) increment(this.trigrams, `${words[index - 2]}\0${words[index - 1]}\0${words[index]}`)
88
89
  }
@@ -114,13 +115,16 @@ export class PersonalModel {
114
115
  }
115
116
  }
116
117
 
117
- function totals(counts: Map<string, number>): Map<string, { total: number; types: number }> {
118
- const result = new Map<string, { total: number; types: number }>()
118
+ type Totals = { total: number; types: number; max: number }
119
+
120
+ function totals(counts: Map<string, number>): Map<string, Totals> {
121
+ const result = new Map<string, Totals>()
119
122
  for (const [key, count] of counts) {
120
123
  const context = key.slice(0, key.lastIndexOf("\0"))
121
- const entry = result.get(context) ?? { total: 0, types: 0 }
124
+ const entry = result.get(context) ?? { total: 0, types: 0, max: 0 }
122
125
  entry.total += count
123
126
  entry.types++
127
+ entry.max = Math.max(entry.max, count)
124
128
  result.set(context, entry)
125
129
  }
126
130
  return result
@@ -205,8 +209,8 @@ export class WordPredictor {
205
209
  private priorTotal = 0
206
210
  private personal = new PersonalModel()
207
211
  private personalTotal = 0
208
- private bigramTotals = new Map<string, { total: number; types: number }>()
209
- private trigramTotals = new Map<string, { total: number; types: number }>()
212
+ private bigramTotals = new Map<string, Totals>()
213
+ private trigramTotals = new Map<string, Totals>()
210
214
  private vocabulary: string[] = []
211
215
  private forms = new Map<string, string>()
212
216
 
@@ -278,7 +282,8 @@ export class WordPredictor {
278
282
  const trigram = pair && this.trigramTotals.get(pair)
279
283
  if (trigram && trigram.total >= 2) {
280
284
  const count = this.personal.trigrams.get(`${pair}\0${word}`) ?? 0
281
- score = Math.max(count - DISCOUNT, 0) / trigram.total + DISCOUNT * trigram.types / trigram.total * score
285
+ const discounted = Math.max(count - DISCOUNT, 0) / trigram.total + DISCOUNT * trigram.types / trigram.total * score
286
+ score = trigram.max >= 2 ? discounted : Math.max(score, discounted)
282
287
  }
283
288
  return score
284
289
  }
@@ -328,15 +333,16 @@ export class WordPredictor {
328
333
  if (query.next && evidence < 2) return []
329
334
  if (!query.next && [...prefix].length < 2 && evidence < 2) return []
330
335
  const slash = prefix.includes("/")
336
+ const followed = (word: string) => (previous ? this.personal.bigrams.get(`${previous}\0${word}`) ?? 0 : 0) >= 2 ||
337
+ (pair ? this.personal.trigrams.get(`${pair}\0${word}`) ?? 0 : 0) >= 2
338
+ const eligible = (word: string) => !query.next || followed(word)
331
339
  const candidates = new Map<string, number>()
332
340
  for (let index = lowerBound(this.vocabulary, prefix); index < this.vocabulary.length; index++) {
333
341
  const word = this.vocabulary[index]
334
342
  if (!word.startsWith(prefix)) break
335
- if (query.next || slash === word.includes("/")) candidates.set(word, 1)
343
+ if ((query.next || slash === word.includes("/")) && eligible(word)) candidates.set(word, 1)
336
344
  }
337
- for (const word of local.keys()) if (!word.includes("/") && word.startsWith(prefix) && (query.next || !slash)) candidates.set(word, 1)
338
- const followed = (word: string) => (previous ? this.personal.bigrams.get(`${previous}\0${word}`) ?? 0 : 0) >= 2 ||
339
- (pair ? this.personal.trigrams.get(`${pair}\0${word}`) ?? 0 : 0) >= 2
345
+ for (const word of local.keys()) if (!word.includes("/") && word.startsWith(prefix) && (query.next || !slash) && eligible(word)) candidates.set(word, 1)
340
346
  const suggest = (): Prediction[] => {
341
347
  const ranked: { word: string; score: number; weight: number }[] = []
342
348
  let sum = 0
@@ -351,7 +357,7 @@ export class WordPredictor {
351
357
  const predictions: Prediction[] = []
352
358
  for (const { word: best, score: bestScore, weight: bestWeight } of ranked) {
353
359
  const confidence = bestWeight < 1 ? typoConfidence(bestScore, sum) : query.next ? bestScore : bestScore / (sum || 1)
354
- if (!bestScore || best === prefix || confidence === undefined || (query.next && !followed(best)) || (bestWeight === 1 && confidence < 0.3)) {
360
+ if (!bestScore || best === prefix || confidence === undefined || (bestWeight === 1 && confidence < 0.3)) {
355
361
  if (!predictions.length) return []
356
362
  continue
357
363
  }
package/src/tui.tsx CHANGED
@@ -150,6 +150,14 @@ export default Plugin.define({
150
150
  context.ui.toast.show({ title: "Quill", message: "Word autocomplete history cleared" })
151
151
  }
152
152
 
153
+ const clearCasing = async () => {
154
+ const next = { ...unwrap(learning.snapshot), forms: [] }
155
+ predictor.setPersonal(next)
156
+ await setLearning((draft) => { draft.snapshot = { ...unwrap(draft.snapshot), forms: [] } })
157
+ ghost?.invalidate()
158
+ context.ui.toast.show({ title: "Quill", message: "Learned word casing cleared" })
159
+ }
160
+
153
161
  const disposeEffects = createRoot((dispose) => {
154
162
  createEffect(() => {
155
163
  const snapshot = learning.snapshot
@@ -211,6 +219,10 @@ export default Plugin.define({
211
219
  await clearHistory()
212
220
  return
213
221
  }
222
+ if (command.type === "casing") {
223
+ await clearCasing()
224
+ return
225
+ }
214
226
  if (command.type === "shell") {
215
227
  await setSettings((draft) => { draft.shell = command.value })
216
228
  ghost?.invalidate()
@@ -218,7 +230,7 @@ export default Plugin.define({
218
230
  return
219
231
  }
220
232
  if (command.type === "invalid") {
221
- context.ui.toast.show({ title: "Quill", message: "Use /quill, /quill on, /quill off, /quill shell on, /quill shell off, or /quill clear", variant: "warning" })
233
+ context.ui.toast.show({ title: "Quill", message: "Use /quill, /quill on, /quill off, /quill shell on, /quill shell off, /quill clear, or /quill clear casing", variant: "warning" })
222
234
  return
223
235
  }
224
236
  const enabled = command.type === "enable" ? command.value : !settings.enabled