heartcode 0.1.69 → 0.1.95

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/bin/heartcode.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import path from 'node:path'
3
3
  import { parseArgs } from 'node:util'
4
4
  import { Client, limitSaid, estMessages } from '../src/client.js'
5
- import { loadConfig, saveConfig, readJson, writeJson, providerName, CONFIG_FILE, HOME, TEMP, AUTO_MODEL, isAuto, parseModel, takeIn, whatOf, VERSION, speedOf, jobsOf } from '../src/config.js'
5
+ import { loadConfig, saveConfig, readJson, writeJson, providerName, CONFIG_FILE, HOME, TEMP, AUTO_MODEL, isAuto, parseModel, takeIn, whatOf, VERSION, speedOf, jobsOf, track } from '../src/config.js'
6
6
  import { loadProfile, strategy, describe, profilePath, profileFrom } from '../src/probe.js'
7
7
  import { learnFromUsage, LIMIT_MS, RATE_CAP_MS } from '../src/context.js'
8
8
  import { loadRankings, scoreOf } from '../src/rankings.js'
@@ -11,7 +11,7 @@ import { Session, transcript, contextReport } from '../src/agent.js'
11
11
  import { listJobs, getJob, stopJob, removeJob, runningJobs, tailLines, ago as ranFor } from '../src/background.js'
12
12
  import { checkUpdate, installKind, UPDATE_COMMANDS, packageDir, whatsNew } from '../src/update.js'
13
13
  import { treeItems, codePlan, move, leaving, leftText, leftFiles } from '../src/tree.js'
14
- import { UI, c, PERMISSIONS, duration, copyText, overSsh, prettyKey, rank, setTheme, themeCodes, renderDiff, diffLines, DEFAULT_KEYS, loadKeys, width, shortError, wrapWords } from '../src/ui.js'
14
+ import { UI, c, PERMISSIONS, duration, copyText, overSsh, prettyKey, rank, setTheme, themeCodes, renderDiff, diffLines, DEFAULT_KEYS, loadKeys, width, shortError, wrapWords, ownAsk } from '../src/ui.js'
15
15
  import { listFiles, runCommand, clip } from '../src/tools.js'
16
16
  import { notify as telegram } from '../src/telegram.js'
17
17
  import { alert, playSound } from '../src/alert.js'
@@ -22,6 +22,7 @@ import { loadPrices, priceOf, addUsage, money, limitsOf } from '../src/usage.js'
22
22
  import { Mcp, mcpAuth, loadServers } from '../src/mcp.js'
23
23
  import { forget } from '../src/oauth.js'
24
24
  import { loadSkills, fillArgs, extraSkillDirs } from '../src/skills.js'
25
+ import { trusted, trust, setupFiles, trustAll } from '../src/trust.js'
25
26
  import { HeadlessUI, runHeadless, toolNames, PERMISSION_MODES } from '../src/headless.js'
26
27
  import { findImports, installSkill } from '../src/importer.js'
27
28
  import { capabilities } from '../src/capabilities.js'
@@ -60,7 +61,6 @@ ${c.bold('options')}
60
61
  --api-key <key> API key for --base-url
61
62
  -y, --yes do everything without asking (the default; through --acp, an editor: ask)
62
63
  --ask ask before every edit and command, this run
63
- --hide-thinking the model's thinking: only its last two lines while it thinks (the default; Alt+O shows all of it)
64
64
  -C, --cwd <dir> project folder (default: current folder)
65
65
  --temp keep nothing: a throwaway settings folder (providers, model info,
66
66
  prices and notes copied in), shared by the --temp runs going on at once
@@ -113,9 +113,8 @@ const SECTIONS = [
113
113
  ]],
114
114
  ['settings', [
115
115
  ['/notifications', 'a sound and/or a desktop notification when a task finishes, fails or waits for you: on or off'],
116
- ['/toggle_thinking', "the model's thinking: its last two lines, or all of it (Alt+O)"],
117
116
  ['/todos', 'the whole plan of the task at work, every step and its state (Alt+L)'],
118
- ['/voice', 'dictate a message (or Space in an empty box, once voice is set up): it shows in the box while speaking, Enter sends it, Esc cancels'],
117
+ ['/voice', 'dictate a message (or Space in an empty box, once voice is set up): it shows in the box while speaking, Enter sends it, Esc cancels · with Hex, whisper-cli or OpenAI (/settings → General)'],
119
118
  ]],
120
119
  ['session', [
121
120
  ['/resume', 'continue an earlier session in this folder'],
@@ -154,7 +153,7 @@ for (const [, list] of SECTIONS) list.sort(byName) // alphabetical, in /help and
154
153
  const COMMANDS = SECTIONS.flatMap(([, list]) => list).sort(byName)
155
154
  // Typed while a task works, these run at once, beside it: they leave the conversation alone. The
156
155
  // others (/compact, /rewind, /resume, /init…) wait in the queue until it's done.
157
- const RIGHT_AWAY = new Set(['help', 'todos', 'cost', 'context', 'background', 'model_info', 'diff', 'copy', 'mcp', 'doctor', 'toggle_thinking', 'notifications', 'btw', 'rename', 'export', 'tab', 'close_tab', 'exit', 'quit', 'settings', 'login_mcp', 'install_skill', 'import', 'voice', 'select_model'])
156
+ const RIGHT_AWAY = new Set(['help', 'todos', 'cost', 'context', 'background', 'model_info', 'diff', 'copy', 'mcp', 'doctor', 'notifications', 'btw', 'rename', 'export', 'tab', 'close_tab', 'exit', 'quit', 'settings', 'login_mcp', 'install_skill', 'import', 'voice', 'select_model'])
158
157
  const helpText = (sections) => sections.map(([title, list]) => ` ${c.bold(title)}\n` + list.map(([n, d]) => ` ${c.cyan(n.padEnd(17))} ${d}`).join('\n')).join('\n\n')
159
158
  const SLASH = helpText(SECTIONS)
160
159
 
@@ -167,10 +166,9 @@ function keysHelp(keys = {}, mouse = false, voice = false) {
167
166
  [voice ? 'Space' : '', 'voice: listens at once, Enter sends what was said (in an empty box)'],
168
167
  ['Enter', 'send · while it works, queue the message (commands like /help, /cost, /select_model run at once)'],
169
168
  ['Option+Enter or Shift+Enter', 'new line in the box (also while it works)'],
170
- ['Esc', 'while it works: queued messages back into the box, then clears the box, then stops the task (twice)'],
169
+ ['Esc', 'while it works: twice stops the task (the first closes the suggestions, if open) · ↑ in an empty box: the last queued message back into it'],
171
170
  ['Esc Esc', 'rewind to an earlier message (at the prompt)'],
172
171
  ['Shift+Tab', 'change what runs without asking (permissions)'],
173
- [forAct('toggle_thinking'), "the model's thinking: after an answer, all of it in a box; while it works, all of it as it comes or its last two lines"],
174
172
  [forAct('show_plan'), 'the whole plan in a box (only three of its steps show while it works)'],
175
173
  [forAct('background_log'), "the background commands' logs in a dialog, a tab each (←/→ switch, ↑/↓ scroll, K twice stops one, Esc closes); with text in the box it moves back a word instead"],
176
174
  [forAct('new_tab'), 'new tab'],
@@ -218,10 +216,8 @@ const mask = (k) => (k ? (k.length > 12 ? `${k.slice(0, 4)}…${k.slice(-4)}` :
218
216
  // The status bar's default layout (two lines): the model and what it can do, then the run's stats and
219
217
  // controls — model and context on the left, abilities and controls pushed to the right. cfg.statusBar
220
218
  // overrides it — see App.status for the item names and format.
221
- const DEFAULT_STATUS = [
222
- { left: ['provider', 'model'], right: ['mode', 'thinking', 'images'] },
223
- { left: ['ctx', 'tps', 'autocompact'], right: ['background', 'permissions', 'worktree', 'cost'] },
224
- ]
219
+ const DEFAULT_STATUS = [{ left: ['provider', 'model', 'ctx', 'tps'], right: ['mode', 'thinking', 'autocompact', 'background', 'worktree', 'permissions', 'cost'] }] // one row
220
+ const DROP_FIRST = ['tps', 'images', 'thinking', 'autocompact', 'provider', 'cost', 'mode', 'ctx', 'worktree'] // too narrow: these go, in this order (never cut mid-word)
225
221
 
226
222
  class App {
227
223
  constructor(cfg, ui, root) {
@@ -375,13 +371,14 @@ class App {
375
371
  // that line): the agent says it then (announceSwitch), else right after
376
372
  let switched = null
377
373
  client.announceSwitch = () => switched && (ui.print(switched), (switched = null))
374
+ client.onNotice = (text) => ui.print(c.faint(text))
378
375
  client.onSwitch = (t) => {
379
376
  const i = client.rotation.list.indexOf(t)
380
377
  const f = failed?.e
381
378
  const from = failed?.t
382
- const why = f ? `${failed.t.model} ${f.status === 429 ? 'rate-limited (429)' : `failed (${clip(shortError(f), 50)})`} → ` : ''
379
+ const why = f ? `${failed.t.model} ${f.status === 429 ? 'hit its rate limit' : `failed (${clip(shortError(f), 60)})`}` : i ? 'the model before it failed' : 'your first model again'
383
380
  failed = null
384
- switched = c.dim(`↻ ${why}${t.provider} · ${t.model} answered${i ? ` (#${i + 1} in the model list)` : ' (#1 again)'}`)
381
+ switched = c.faint(`↻ ${t.model} takes over · ${why}`)
385
382
  ui.event?.({ subtype: 'model_switch', from: from ? `${from.provider}/${from.model}` : null, to: `${t.provider}/${t.model}`, reason: f ? (f.status === 429 ? 'rate-limited (429)' : shortError(f)) : null, place: i + 1 })
386
383
  setImmediate(client.announceSwitch)
387
384
  }
@@ -511,7 +508,7 @@ class App {
511
508
  }
512
509
  this.setChat(chat)
513
510
  ui.setLog(chat.log)
514
- ui.print(c.dim(`resumed "${chat.title}" · ${chat.turns.length} message${chat.turns.length > 1 ? 's' : ''} · ${ago(chat.updated)}`))
511
+ ui.notice(`resumed "${chat.title}" · ${chat.turns.length} message${chat.turns.length > 1 ? 's' : ''} · ${ago(chat.updated)}`, 8000)
515
512
  }
516
513
 
517
514
  // /rewind: back to before one of your messages; the conversation, the files HeartCode changed, or both.
@@ -544,7 +541,7 @@ class App {
544
541
  log('rewind', `files restored to before "${turn.task}":`, files)
545
542
  for (const t of chat.turns.slice(i)) t.files = {}
546
543
  chat.messages?.push({ role: 'user', content: prompt('agent/files-restored', { task: turn.task, files: files.join(', ') }) })
547
- ui.print(c.dim(`restored ${files.join(', ')} to before "${turn.task.split('\n')[0].slice(0, 60)}"`))
544
+ ui.notice(`restored ${files.join(', ')} to before "${turn.task.split('\n')[0].slice(0, 60)}"`, 8000)
548
545
  }
549
546
  if (how.conversation) {
550
547
  // what came after is kept as a branch (/tree), never lost: with its files as they are now,
@@ -553,8 +550,7 @@ class App {
553
550
  const { files } = move(chat, null, i, { code: Boolean(how.code) })
554
551
  log('rewind', `files restored to before "${turn.task}":`, files)
555
552
  ui.setLog(chat.log)
556
- if (how.code) ui.print(c.dim(`restored ${files.join(', ') || 'nothing (no file differed)'}`))
557
- ui.print(c.dim('the messages after it are kept as a branch: /tree goes back to them'))
553
+ ui.notice(`${how.code ? `Restored ${files.join(', ') || 'nothing (no file differed)'} · ` : ''}the messages after it are kept as a branch: /tree goes back to them`, 8000)
558
554
  this.nextInput = turn.task // back in the input, to edit and send again
559
555
  }
560
556
  log('rewind', `to before message ${i + 1}`, { conversation: Boolean(how.conversation), code: Boolean(how.code) })
@@ -600,7 +596,7 @@ class App {
600
596
  }
601
597
  const { left, files } = move(chat, it.branch, go.keep, { code })
602
598
  ui.setLog(chat.log)
603
- if (files.length) ui.print(c.dim(`files now as on this branch: ${files.join(', ')}`))
599
+ if (files.length) ui.notice(`files now as on this branch: ${files.join(', ')}`, 8000)
604
600
  if (code && unknown.length) ui.warn(`not known how ${unknown.join(', ')} looked there; left as they are`)
605
601
  if (summarize) {
606
602
  const s = await this.session()
@@ -619,7 +615,7 @@ class App {
619
615
  }
620
616
  }
621
617
  }
622
- ui.print(c.dim(`${go.edit ? 'edit the message and send it: a new branch' : 'here now'} · the branch left behind stays in /tree`))
618
+ ui.notice(`${go.edit ? 'edit the message and send it: a new branch' : 'here now'} · the branch left behind stays in /tree`, 8000)
623
619
  if (go.edit) this.nextInput = it.task
624
620
  if (this.s) this.s.client.lastTokens = 0
625
621
  this.save()
@@ -669,8 +665,14 @@ class App {
669
665
  const end = cursor + (/^\S*/.exec(line.slice(cursor))?.[0].length ?? 0)
670
666
  let m = /^\/(\S*)$/.exec(before)
671
667
  if (m) {
672
- const items = this.commands().map(([value, desc, args]) => ({ value, desc, space: args, start: 0, end }))
673
- const hits = rank(items, '/' + m[1])
668
+ // the menu says each in a few words (/help says all of it); just "/": the ones you used last first
669
+ let items = this.commands().map(([value, desc, args]) => ({ value, desc: desc?.split(/ · |: |; | \(/)[0], space: args, start: 0, end }))
670
+ if (!m[1]) {
671
+ const used = [...new Set([...(this.ui.history?.() ?? [])].reverse().map((l) => /^\/\S+/.exec(l)?.[0]).filter(Boolean))]
672
+ const at = (x) => (used.includes(x.value) ? used.indexOf(x.value) : Infinity)
673
+ items = [...items].sort((a, b) => at(a) - at(b))
674
+ }
675
+ const hits = m[1] ? rank(items, '/' + m[1]) : items
674
676
  return hits.length === 1 && hits[0].value === before ? [] : hits
675
677
  }
676
678
  m = /^\/(\w+)\s+(?:(\S+)\s+)?(\S*)$/.exec(before)
@@ -725,8 +727,8 @@ class App {
725
727
  const parts = {
726
728
  provider: `${c.brand('●')} ${c.muted(now.provider)}`,
727
729
  model,
728
- mode: strat ? (strat.actions === 'tools' ? null : c.muted('no tool calls (guided)')) : c.faint('checked at the first message'), // what it can do: known once it's been asked
729
- thinking: strat?.thinking ? c.think(`thinking · ${effortOf(cfg)}`) + (ui.showThinking ? c.faint(' (all)') : '') : null,
730
+ mode: strat && strat.actions !== 'tools' ? c.muted('no tools') : null, // what it can do: known once it's been asked
731
+ thinking: strat?.thinking ? c.think(`thinking${cfg.effort ? ` · ${cfg.effort}` : ''}`) : null, // the effort only when it was set
730
732
  images: strat?.vision ? c.muted('images') : null,
731
733
  ctx: null,
732
734
  tps: null,
@@ -735,14 +737,14 @@ class App {
735
737
  worktree: this.worktree ? c.info(`⎇ ${this.worktree.branch}`) : null,
736
738
  background: runningJobs(this.root).length ? c.info(`⚙ ${runningJobs(this.root).length} running`) + c.faint(' Alt+B') : null,
737
739
  update: this.update?.newer ? c.green(`⬆ ${this.update.latest}`) + c.faint(' /update') : null,
738
- permissions: { all: c.green('⏵⏵ all allowed'), commands: c.yellow('ask before commands'), ask: c.yellow('ask before changes'), plan: c.info('⏸ plan mode') }[ui.permission],
740
+ permissions: { all: c.green('runs everything'), commands: c.yellow('asks before commands'), ask: c.yellow('asks before changes'), plan: c.info('plan mode') }[ui.permission],
739
741
  }
740
742
  if (strat) {
741
743
  const used = this.s?.client.lastTokens || Math.round(estMessages(this.chat?.messages ?? []) * (strat.ratio ?? 1)) // a resumed chat before its first request: estimated
742
744
  const pct = Math.round((used / strat.context) * 100)
743
745
  const paint = pct >= 80 ? c.red : pct >= 50 ? c.yellow : c.green
744
746
  const guess = strat.contextSure ? '' : '~' // not said by the server: assumed, and growing as bigger requests work
745
- parts.ctx = `${c.faint('ctx')} ${paint(`${kTokens(used)}/${guess}${kTokens(strat.context)}`)} ${c.faint(`${pct}%`)}`
747
+ if (!this.s?.client.cli) parts.ctx = `${c.faint('ctx')} ${paint(`${kTokens(used)}/${guess}${kTokens(strat.context)}`)} ${c.faint(`${pct}%`)}` // a coding CLI keeps its own
746
748
  const tps = this.s?.client.tps
747
749
  if (tps) parts.tps = `${c.muted(String(tps))} ${c.faint('tok/s')}`
748
750
  if (this.chat.usage?.priced) parts.cost = c.muted(money(this.chat.usage.cost))
@@ -753,7 +755,10 @@ class App {
753
755
  // background commands and a newer HeartCode are shown also on a bar laid out before there were these items
754
756
  for (const id of ['update', 'background']) if (parts[id] && !JSON.stringify(layout).includes(`"${id}"`)) layout = [...layout.slice(0, -1), ...layout.slice(-1).map((row) => (Array.isArray(row) ? { left: row, right: [id] } : { ...row, right: [id, ...(row.right ?? [])] }))]
755
757
  const line = (row) => {
756
- const names = (g) => (g ?? []).map((t) => parts[t]).filter(Boolean).join(sep)
758
+ const gone = new Set()
759
+ const names = (g) => (g ?? []).filter((t) => !gone.has(t)).map((t) => parts[t]).filter(Boolean).join(sep)
760
+ const all = () => [names(Array.isArray(row) ? row : row?.left), names(Array.isArray(row) ? null : row?.right)].filter(Boolean).join(sep)
761
+ for (const t of DROP_FIRST) if (vis(all()) > cols - 2 && parts[t]) gone.add(t)
757
762
  const left = names(Array.isArray(row) ? row : row?.left)
758
763
  const right = names(Array.isArray(row) ? null : row?.right)
759
764
  if (!right) return left
@@ -859,11 +864,17 @@ class App {
859
864
  // helpers use this session's models (the set you chose, else your list), minus the one in use —
860
865
  // so a pinned single model gives no team, and a chosen set keeps helpers within it
861
866
  const now = this.s?.client.rotation?.list[this.s.client.rotation.at] ?? this.sessionModels()[0]
867
+ // asked for several times a step (the system prompt, the tool list, helpers, reviews): built once
868
+ // in a moment for the same model (each build reads files and ranks every model)
869
+ const key = `${now?.provider}/${now?.model}`
870
+ if (this.teamMemo?.key === key && this.teamMemo.cfg === this.cfg && Date.now() - this.teamMemo.at < 2000) return this.teamMemo.list.slice()
862
871
  const tested = readJson(path.join(HOME, 'model-tests.json'), {}) // the settings page's tests
863
- return this.sessionModels()
872
+ const list = this.sessionModels()
864
873
  .filter((t) => !(t.provider === now?.provider && t.model === now?.model))
865
874
  .map((t) => ({ ...t, ...this.abilities(t), jobs: jobsOf(this.cfg.helpers?.[`${t.provider}/${t.model}`]), ms: tested[`${t.provider}/${t.model}`]?.ms, price: priceOf(t.provider, this.cfg.providers[t.provider]?.baseUrl, t.model), auto: this.cfg.helpersAuto === true })) // price: models.dev's, $ per million tokens // jobs: ticked as a helper on Your models (what for); ms: how fast it answered its test; auto: helpers picked for you (a job goes to the fastest that's good at it)
866
875
  .sort(this.byScore()) // best-ranked first
876
+ this.teamMemo = { key, cfg: this.cfg, at: Date.now(), list }
877
+ return list.slice()
867
878
  }
868
879
 
869
880
  // Helpers in order: the best placed in LMArena's rankings first (its best share of a list: #5 of 200
@@ -1273,15 +1284,15 @@ function applySettings(apps, cfg, what) {
1273
1284
  // settings page leaves it alone (only /select_model auto here returns it to the list)
1274
1285
  if (what === 'model' && !app.cfg.session) {
1275
1286
  app.lists = {}
1276
- if (app.s && !(cfg.providers[cfg.provider] && cfg.model)) now(() => ((app.s = null), ui.print(c.dim('settings: no model chosen'))))
1277
- else if (app.s && !app.myModels().length) now(() => ((app.s = null), ui.print(c.dim('settings: the providers of all the models are switched off'))))
1287
+ if (app.s && !(cfg.providers[cfg.provider] && cfg.model)) now(() => ((app.s = null), ui.notice('settings: no model chosen')), 8000)
1288
+ else if (app.s && !app.myModels().length) now(() => ((app.s = null), ui.notice('settings: the providers of all the models are switched off')), 8000)
1278
1289
  }
1279
1290
  // your model list: into the running session now, its next request goes to the new #1
1280
1291
  if (['model', 'setting:rotation'].includes(what) && !app.cfg.session && app.s && cfg.providers[cfg.provider] && cfg.model) {
1281
1292
  const was = `${app.s.client.provider} · ${app.s.client.model}`
1282
1293
  app.useRotation()
1283
1294
  const is = `${app.s.client.provider} · ${app.s.client.model}`
1284
- if (is !== was) ui.print(c.dim(`settings: ${is} now`))
1295
+ if (is !== was) ui.notice(`settings: ${is} now`, 8000)
1285
1296
  }
1286
1297
  if (what === 'provider') app.lists = {} // its list switched on or off, a model added by name
1287
1298
  if (what === 'setting:permissions' && !ui.noUser) ui.setPermission(cfg.permissions) // -p and ACP keep the mode they were given (--permission-mode, the editor's)
@@ -1500,7 +1511,7 @@ async function slash(app, line, working = false) {
1500
1511
  close()
1501
1512
  settingsPage = null
1502
1513
  }
1503
- return ui.print(c.dim('settings page turned off'))
1514
+ return ui.notice('Settings page turned off', 3000) // not a message: above the input, for a moment
1504
1515
  }
1505
1516
  case 'tab': {
1506
1517
  const { tabs } = app
@@ -1527,8 +1538,9 @@ async function slash(app, line, working = false) {
1527
1538
  const notes = await whatsNew(u.current, u.latest)
1528
1539
  if (kind === 'git') return ui.showText(`HeartCode ${u.latest} is out (this is ${u.current})`, `${notes || '(no changelog found)'}\n\nThis HeartCode runs from a git checkout (${packageDir}): update it there with git pull.`)
1529
1540
  const cmd = UPDATE_COMMANDS[kind]
1530
- ui.showText(`HeartCode ${u.latest} is out (this is ${u.current})`, notes || '(no changelog found)')
1531
- if ((await ui.confirm(`Update now with ${c.bold(cmd)}?`, 'command')) !== true) return ui.print(c.dim('not updated'))
1541
+ // what changed and the question in one dialog (a question closed the notes before they could be read)
1542
+ const go = await ui.pick(`HeartCode ${u.latest} is out (this is ${u.current}). Update now with ${cmd}?`, [{ label: 'Update now', yes: true }, { label: 'Not now' }], { body: notes || '(no changelog found)' })
1543
+ if (!go?.yes) return ui.notice('Not updated', 3000)
1532
1544
  ui.spinner(`running ${cmd}`)
1533
1545
  const r = await runCommand(process.cwd(), cmd, { timeout: 300_000 })
1534
1546
  ui.stopSpin()
@@ -1756,11 +1768,6 @@ async function slash(app, line, working = false) {
1756
1768
  return ui.showPlan()
1757
1769
  case 'notifications':
1758
1770
  return askAlerts(app)
1759
- case 'toggle_thinking':
1760
- ui.showThinking = !ui.showThinking
1761
- ui.print(c.dim(ui.showThinking ? 'thinking shown: all of it (Alt+O: last two lines)' : 'thinking shown: its last two lines (Alt+O: all of it)'))
1762
- if (ui.showThinking && !ui.thinkTail) ui.showLastThought() // the one just over: all of it now
1763
- return
1764
1771
  }
1765
1772
  if (!['model_info', 'compact'].includes(cmd)) {
1766
1773
  app.skills = loadSkills(app.root) // edits to skill files apply right away
@@ -1806,12 +1813,12 @@ async function askAlerts(app, first = false) {
1806
1813
  { label: 'Only a desktop notification', key: 'popup', sound: false, popup: true },
1807
1814
  { label: first ? 'No, thanks' : 'Off', key: 'off', sound: false, popup: false },
1808
1815
  ].map((it) => (!first && it.key === now ? { ...it, label: `${it.label} ${c.faint('(now)')}` } : it))
1809
- const it = await ui.pick(first ? 'Let HeartCode tell you when a task finishes, fails or waits for you?' : 'Notifications on this computer', items)
1816
+ const it = await ui.pick(first ? 'Let HeartCode tell you when a task finishes, fails or waits for you?' : 'Notifications on this computer', items, { quiet: true }) // not a message: nothing left in the conversation
1810
1817
  const pick = it ?? (first ? items.at(-1) : null)
1811
1818
  if (!pick) return
1812
1819
  cfg.alerts = { ...a, sound: pick.sound, popup: pick.popup }
1813
1820
  saveConfig(cfg)
1814
- ui.print(`${c.ok('✓')} ${c.muted(`notifications: ${pick.key === 'off' ? 'off' : pick.key === 'both' ? 'a sound and a desktop notification' : pick.key === 'sound' ? 'a sound' : 'a desktop notification'}`)} ${c.faint('· change it any time:')} ${c.cyan('/notifications')} ${c.faint('or')} ${c.cyan('/settings')} ${c.faint('→ Notifications (each event on its own, Try it, Telegram)')}`)
1821
+ ui.notice(`Notifications: ${pick.key === 'off' ? 'off' : pick.key === 'both' ? 'a sound and a desktop notification' : pick.key === 'sound' ? 'a sound' : 'a desktop notification'} · change them any time: /notifications or /settings → Notifications`, 10000)
1815
1822
  if (pick.sound && first) playSound('done') // what it sounds like
1816
1823
  }
1817
1824
 
@@ -1830,7 +1837,7 @@ async function runTask(app, task, ctl) {
1830
1837
  } catch (e) {
1831
1838
  ui.stopSpin()
1832
1839
  log('error', e.name === 'AbortError' || ctl?.signal.aborted ? 'task interrupted by the user' : e.stack)
1833
- if (e.name === 'AbortError' || ctl?.signal.aborted) ui.print(c.yellow('\ninterrupted'))
1840
+ if (e.name === 'AbortError' || ctl?.signal.aborted) ui.print(c.muted('\n⏹ stopped'))
1834
1841
  else {
1835
1842
  ui.print(c.red(`\nerror: ${e.message}`))
1836
1843
  notify(app.cfg, 'failed', `❌ Failed · ${path.basename(app.root)}\n${clip(task.split('\n')[0], 200)}\n\n${clip(e.message, 1500)}`)
@@ -1858,7 +1865,8 @@ async function repl(app, f = {}) {
1858
1865
  ui.onPanel = () => app.toggleJobs() // Alt+B: the background commands' logs, side by side, live
1859
1866
  ui.onNow = (line) => {
1860
1867
  if (!RIGHT_AWAY.has(/^\/([\w-]+)/.exec(line)?.[1]) || !app.isCommand(line)) return false
1861
- slash(app, line, true)
1868
+ ownAsk
1869
+ .run(true, () => slash(app, line, true)) // its questions and lines are yours, not the task's (ui.js ownAsk)
1862
1870
  .then((r) => r === 'exit' && (ctl?.abort(), app.save(), quit()))
1863
1871
  .catch((e) => (log('error', e.stack), ui.print(c.red(`error: ${e.message}`))))
1864
1872
  return true
@@ -1892,6 +1900,7 @@ async function repl(app, f = {}) {
1892
1900
  if (last && app.tabs) app.tabs.quitting = true
1893
1901
  ctl?.abort()
1894
1902
  ui.cancelAsk()
1903
+ app.mcp?.dispose?.() // its servers stop now, and their exit hook goes
1895
1904
  ui.close()
1896
1905
  } finally {
1897
1906
  closing = false
@@ -1931,7 +1940,8 @@ async function repl(app, f = {}) {
1931
1940
  ui.folder = app.root // what a double click on the header's folder copies
1932
1941
  ui.header = (cols = 100) => {
1933
1942
  const room = cols - 2 - width(`♥ HeartCode ${VERSION} `) // the folder's own name (its end) stays in sight
1934
- const keys = [['/', 'run a command'], ['@', 'attach a file'], ...(ui.voiceReady?.() ? [['Space', 'talk (voice)']] : []), [NEWLINE_KEY, 'add a new line'], ui.busySince ? ['Esc twice', 'stop'] : ['Esc Esc', 'go back to a message'], ['Shift+Tab', 'change permissions']]
1943
+ // the keys only until the first message: after that the room is the conversation's (/help has them all)
1944
+ const keys = app.chat?.messages?.length ? [] : [['/', 'commands'], ['@', 'attach a file'], ...(ui.voiceReady?.() ? [['Space', 'talk']] : []), [NEWLINE_KEY, 'new line'], ['Esc Esc', 'go back to a message'], ['Shift+Tab', 'permissions'], ...(ui.keyFor('new_tab') ? [[ui.keyFor('new_tab'), 'new tab']] : [])]
1935
1945
  // the keys: on a second line when they don't fit one, broken between keys (never inside one)
1936
1946
  const rows = []
1937
1947
  for (const kd of keys) {
@@ -1942,7 +1952,7 @@ async function repl(app, f = {}) {
1942
1952
  return [
1943
1953
  `${c.brand('♥')} ${c.bright(c.bold('HeartCode'))} ${c.faint(VERSION)} ${c.muted(width(where) > room ? '…' + where.slice(-(room - 1)) : where)}`,
1944
1954
  ...rows.map((row) => row.map(([k, d]) => `${c.muted(k)} ${c.faint(d)}`).join(c.ghost(' · '))),
1945
- '',
1955
+ ...(rows.length ? [''] : []),
1946
1956
  ]
1947
1957
  }
1948
1958
  if (!ui.full) ui.print(ui.header().join('\n'))
@@ -1953,13 +1963,13 @@ async function repl(app, f = {}) {
1953
1963
  if (f.continue) {
1954
1964
  const last = listChats(app.root)[0]
1955
1965
  if (last) await app.resume(last)
1956
- else ui.print(c.dim('No earlier session in this folder to continue.'))
1966
+ else ui.notice('No earlier session in this folder to continue', 6000)
1957
1967
  }
1958
1968
  if (f['resume-id']) await app.resume(loadChat(f['resume-id'], app.root))
1959
1969
  else if (f.resume) await app.resume()
1960
1970
  if (f.model) useModel(app, f.model) // a continued tab's own model
1961
1971
  // models this folder picked earlier (/select_model): said, with the way back to your whole list
1962
- if (app.folderModels && cfg.session?.length) ui.print(`${c.muted('this folder uses')} ${c.cyan(cfg.session.map((t) => t.model).join(', '))} ${c.faint(`(picked earlier) · ${c.cyan('/select_model auto')} for the whole list again`)}`)
1972
+ if (app.folderModels && cfg.session?.length) ui.notice(`This folder uses ${cfg.session.map((t) => t.model).join(', ')} (picked earlier) · /select_model auto for the whole list again`, 10000) // not a message
1963
1973
  app.tabs?.onChange?.() // the conversation it opened with
1964
1974
  // a newer HeartCode: asked of npm in the background at every start, said once and kept in the status bar
1965
1975
  if (cfg.updateCheck !== false)
@@ -1967,16 +1977,27 @@ async function repl(app, f = {}) {
1967
1977
  .then((u) => {
1968
1978
  if (!u?.newer) return
1969
1979
  app.update = u
1970
- ui.print(`${c.green('⬆')} ${c.muted('HeartCode')} ${c.green(u.latest)} ${c.muted(`is out (this is ${u.current})`)} ${c.faint('·')} ${c.cyan('/update')}`)
1980
+ ui.notice(`HeartCode ${u.latest} is out (this is ${u.current}) · /update`, 10000) // and in the status bar
1971
1981
  ui.render?.()
1972
1982
  })
1973
1983
  .catch(() => {})
1974
- // the first start: whether to be told when a task finishes (once, in one tab)
1975
- if (cfg.alerts === undefined && !alertsAsked) {
1976
- alertsAsked = true
1977
- await askAlerts(app, true)
1984
+ // this folder's own setup (a cloned repo's hooks and MCP servers run commands): used once you say so
1985
+ if (!trusted(app.root)) {
1986
+ const files = setupFiles(app.root)
1987
+ const yes = await ui.pick(`This folder has its own HeartCode setup (${files.join(', ')}). Its hooks and MCP servers run commands on this computer. Use it?`, [
1988
+ { label: 'Yes, use it', desc: 'for these files as they are now; asked again if they change', use: true },
1989
+ { label: 'No', desc: 'HeartCode works here without them' },
1990
+ ], { quiet: true })
1991
+ if (yes?.use) trust(app.root), reloadPrompts()
1992
+ else ui.notice(`This folder's own setup isn't used (${files.join(', ')}); you're asked again next time`, 8000)
1978
1993
  }
1979
1994
  for (;;) {
1995
+ // the first start: whether to be told when a task finishes (once, in one tab); once there's a model
1996
+ // to work with (not over the "set up a model" screen)
1997
+ if (cfg.alerts === undefined && !alertsAsked && cfg.providers[cfg.provider] && cfg.model) {
1998
+ alertsAsked = true
1999
+ await askAlerts(app, true)
2000
+ }
1980
2001
  const line = await ui.ask(` ${c.magenta('♥')} `, { suggest: true, initial: app.nextInput, history: true })
1981
2002
  app.nextInput = undefined
1982
2003
  if (line === null) break
@@ -1985,10 +2006,11 @@ async function repl(app, f = {}) {
1985
2006
  ctl = new AbortController()
1986
2007
  app.signal = ctl.signal // Esc stops whatever this line started (a task, a probe, …)
1987
2008
  ui.escArm = 0 // a fresh task: a first Esc from before doesn't count toward stopping this one
1988
- ui.busy() // the spinner stays until this line's work is done
1989
2009
  const command = app.isCommand(t)
2010
+ ui.busy(command ? 400 : 0, { task: !command }) // the spinner stays until this line's work is done (a command: if it takes a while)
1990
2011
  if (command) {
1991
2012
  const mark = ui.mark?.() // what it prints goes back out of the conversation when it's done
2013
+ ui.inCommand = true // its own questions aren't echoed (one line said: above the input, not a box)
1992
2014
  try {
1993
2015
  if ((await slash(app, t)) === 'exit') {
1994
2016
  if (app.tabs) app.tabs.quitting = true
@@ -1999,6 +2021,7 @@ async function repl(app, f = {}) {
1999
2021
  log('error', e.stack)
2000
2022
  ui.print(c.red(`error: ${e.message}`))
2001
2023
  }
2024
+ ui.inCommand = false
2002
2025
  if (mark) ui.unmark(mark, /^\S+/.exec(t)[0])
2003
2026
  } else {
2004
2027
  if (process.stdout.isTTY) process.stdout.write(`\x1b]0;● ${path.basename(app.root)} · HeartCode\x07`)
@@ -2016,8 +2039,8 @@ async function repl(app, f = {}) {
2016
2039
  ok = await runTask(app, prompt('agent/plan-approved'), ctl)
2017
2040
  }
2018
2041
  if (ui.busySince && ok !== null) ui.print(c.faint(c.italic(`✻ took ${duration(ui.worked())}`))) // fixed once the reply is in (not when no model ran)
2019
- // done, said by the terminal too: its title, and after a long task a bell and a notification (OSC 9)
2020
- if (process.stdout.isTTY) process.stdout.write(`\x1b]0;${ok === null ? '♥' : '✓'} ${path.basename(app.root)} · HeartCode\x07` + (ok !== null && !ctl.signal.aborted && ui.worked() > 10_000 ? '\x07\x1b]9;HeartCode: done\x07' : ''))
2042
+ // done, said by the terminal too: its title (the desktop notification and sound: notify, as chosen)
2043
+ if (process.stdout.isTTY) process.stdout.write(`\x1b]0;${ok === null ? '♥' : '✓'} ${path.basename(app.root)} · HeartCode\x07` + (ok !== null && !ctl.signal.aborted && ui.worked() > 10_000 && overSsh && cfg.alerts?.popup ? '\x1b]9;HeartCode: done\x07' : '')) // the terminal's own popup only over SSH (this computer's can't reach you there), and only when you chose notifications
2021
2044
  }
2022
2045
  ui.idle()
2023
2046
  ctl = null
@@ -2159,9 +2182,11 @@ async function main() {
2159
2182
  return apps[apps.push(app) - 1]
2160
2183
  }
2161
2184
  watchSettings(() => apps, cfg) // the settings page's changes, into every editor session
2185
+ trustAll.on = true // an editor: its own workspace trust decides
2162
2186
  process.exit(await runAcp({ makeApp, version: VERSION, permission: f['permission-mode'] ? PERMISSION_MODES[f['permission-mode']] : (cfg.permissions ?? 'ask') }))
2163
2187
  }
2164
2188
  const headless = f.print || f['output-format'] || f['input-format'] === 'stream-json'
2189
+ if (headless) trustAll.on = true // -p: the folder's own setup is used, as it is (whoever runs it chose the folder)
2165
2190
  if (f['max-retries'] !== undefined || headless) cfg.maxRetries = Number(f['max-retries'] ?? 10) // nobody is there to press Esc
2166
2191
  if (f['max-turns']) cfg.maxTurns = Number(f['max-turns'])
2167
2192
  // A UI and an App on it (one per tab; io: the tab's input and output).
@@ -2181,7 +2206,6 @@ async function main() {
2181
2206
  saveConfig(cfg)
2182
2207
  }
2183
2208
  }
2184
- ui.showThinking = false // the thinking's last two lines while it thinks; Alt+O shows all of it (--hide-thinking: the same)
2185
2209
  const app = new App(cfg, ui, root)
2186
2210
  usePromptsFrom(app.root) // its .heartcode/prompts override the built-in sections
2187
2211
  ui.suggest = (line, cursor) => app.suggest(line, cursor)
@@ -2211,7 +2235,7 @@ async function main() {
2211
2235
  const saved = readJson(TABS_FILE, {})[root] // before this run's first tab replaces it
2212
2236
  const asked = f.continue || f.resume || f['resume-id'] || f['session-id'] // a session was chosen already
2213
2237
  const tabs = new Tabs((tab, o) => {
2214
- const app = newApp(o.first ? cfg : { ...cfg }, o.root, tab)
2238
+ const app = newApp(o.first ? cfg : track({ ...cfg }, cfg), o.root, tab) // its own copy, its own changes saved (config.js track)
2215
2239
  Object.assign(tab, { app, ui: app.ui })
2216
2240
  Object.assign(app.ui, tab.hooks)
2217
2241
  Object.assign(app, { tabs, tab, worktree: o.wt ?? null })
@@ -2271,8 +2295,15 @@ async function main() {
2271
2295
  }
2272
2296
 
2273
2297
  let activeUI = null
2298
+ // A bug in HeartCode itself: logged and said, and HeartCode goes on (the conversation, the work, the
2299
+ // screen stay); only before the screen is up does it stop.
2274
2300
  process.on('uncaughtException', (e) => {
2275
2301
  log('crash', e.stack)
2302
+ if (activeUI?.full) {
2303
+ try {
2304
+ return activeUI.warn(`HeartCode hit an error of its own and carried on: ${e.message} (the whole of it is in the errors log)`)
2305
+ } catch {}
2306
+ }
2276
2307
  activeUI?.close()
2277
2308
  console.error(`${c.red('crash:')} ${e.stack}`)
2278
2309
  process.exit(1)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "heartcode",
3
- "version": "0.1.69",
3
+ "version": "0.1.95",
4
4
  "description": "A coding CLI for any local or OpenAI-compatible model, including small models without tool calling.",
5
5
  "keywords": [
6
6
  "ai",
package/prompts/README.md CHANGED
@@ -5,6 +5,7 @@ Everything HeartCode sends to a model, in these files. Each `## name` heading is
5
5
  | file | used for |
6
6
  |---|---|
7
7
  | `agent.md` | tool mode (capable models): the system prompt, tool descriptions, memory, notes HeartCode adds |
8
+ | `guides.md` | guides for kinds of work (web, api, mobile, desktop, cli, automation, long-task, game, data, library, extension, devops, database, upgrade): read with the guide tool, or added once when the message or project shows that kind |
8
9
  | `guided.md` | guided mode (weak models): one question at a time |
9
10
  | `compact.md` | `/compact` and auto-compact |
10
11
 
package/prompts/agent.md CHANGED
@@ -18,6 +18,7 @@ with the result of the first tool call of that kind.
18
18
  {{caller}}: set when a program started HeartCode with its own instructions (--append-system-prompt), which come at the end.
19
19
  {{noUser}}: set when nobody can answer questions (headless, ACP, a helper agent): there is no ask_user tool.
20
20
  {{memory}}: set when there's a memory tool (notes for this project).
21
+ {{doneFirst}}: "call done, then " when the done tool is there (the interactive CLI), else empty.
21
22
  {{files}} and {{more}} are passed empty, so older copies of this prompt keep working. -->
22
23
  {{#if caller}}You are running in HeartCode, a coding agent in the terminal. Your role and instructions are at the end of this prompt. Where they differ from the rules below, follow them.{{else}}You are HeartCode, a coding agent in the terminal, working on the user's project.{{/if}}
23
24
  Do the work with your tools, all of it, in this turn. Don't just describe what could be done.
@@ -31,11 +32,11 @@ You can see images: in messages, from tools (screenshots) and image files you re
31
32
  # How to work
32
33
  1. {{#if noUser}}Nobody can answer questions. Where a choice changes what you build, pick the most likely option and say in your answer what you assumed.{{else}}A choice that changes what you build (what it's for, how it looks, testing, scope) and the message doesn't settle: ask with ask_user first, all questions in one reply. Otherwise start.{{/if}} Build exactly what was asked, nothing extra.
33
34
  2. Never guess. Look it up: files (list_files, search, read_file), commands (find_command), libraries and APIs (their current docs: web_search, web_fetch).
34
- 3. Before the first change, write a plan with the todo tool.
35
+ 3. Before the first change, write a plan with the todo tool. Building a kind of thing (a web app, a game, a mobile app, a scraper…)? Read its guide first (guide tool).
35
36
  4. Read a file before you change it. Change as little as works, and keep everything else working. A bug: find its cause first.
36
37
  5. Never say done without proof: run it the way the user will use it and read the output.
37
38
  6. Finish the whole request. Tried twice and still failing: mark that todo stuck, with why.
38
- 7. Answer briefly: the result first, then the next step. Plain short Markdown (no tables or HTML); choices for the user as a numbered list. While working, call tools without commentary.{{#if caller}}{{else}} When the whole request is done, reply with a short summary and stop calling tools.{{/if}}
39
+ 7. Answer briefly: the result first, then the next step. Plain short Markdown (no tables or HTML); choices for the user as a numbered list. While working, call tools without commentary.{{#if caller}}{{else}} When the whole request is done, {{doneFirst}}reply with a short summary and stop calling tools.{{/if}}
39
40
  More guidance comes with your tools' results as you use them: follow it.
40
41
 
41
42
  ## guide-find
@@ -187,7 +188,7 @@ Create a file, or overwrite one with its full content. append: true adds to its
187
188
 
188
189
  ## tool-run_command
189
190
 
190
- Run a shell command in the project folder. `wait`: seconds to wait for it (5 for a quick one, 60+ for an install or build; default 30, or 3 with background: true). Finished: its exit code and output (of a long one, its last 4,000 characters). Still running: it goes on in the background and you get its id and output so far; check it with the background tool. A command that keeps running (a dev server, a watcher): background: true.
191
+ Run a shell command in the project folder. `wait`: seconds to wait for it (5 for a quick one, 60+ for an install or build; default 30, or 3 with background: true). Finished: its exit code and output (of a long one, its last 4,000 characters). Still running: it goes on in the background and you get its id and output so far; check it with the background tool. A command that keeps running (a dev server, a watcher): background: true. To stop one: the background tool, or its own PID (`lsof -ti tcp:3000 -sTCP:LISTEN` for a port's server); never by broad matches (`pkill -f node`, `killall node`, every process `lsof -ti :3000` lists): they hit other programs.
191
192
 
192
193
  ## tool-background
193
194
 
@@ -220,6 +221,12 @@ Use a tool of an MCP server: server, tool, and arguments (an object). Tool "desc
220
221
  Servers and their tools:
221
222
  {{servers}}
222
223
 
224
+ ## tool-guide
225
+
226
+ <!-- Reads a guide for a kind of work (prompts/guides.md). {{guides}}: "name: what it's for" lines. -->
227
+ Read the guide for a kind of work: how to start, run and check it, its traps, and when it's done. Read the one that matches before you start such work, and follow it (more than one kind: read each):
228
+ {{guides}}
229
+
223
230
  ## tool-skill
224
231
 
225
232
  <!-- Loads a skill's instructions (only when the user has skills). {{skills}}: "name: description" lines. -->
@@ -243,7 +250,7 @@ Steps that stand alone can run at the same time on your other models (parallel,
243
250
  ## tool-done
244
251
 
245
252
  <!-- The done tool (interactive CLI only, main conversation): the model says the user's request is finished, or that only the user can unblock it. A reply that worked on the task and ends without it is sent back (not-done: undeclared). -->
246
- Say that what the user asked is finished: every part of it done, and checked by you just now. Call it BEFORE your final answer, in every reply where you changed or ran something; then write the answer once. checked: what you checked, item by item, and how. waiting: true when it isn't finished because only the user can unblock it (your answer says what you need). Not finished and you can go on: don't call it, go on.
253
+ Say that what the user asked is finished: every part of it done, and checked by you just now. Call it once the work is finished, before your final answer (whenever you changed or ran something this message); then write the answer once. checked: what you checked, item by item, and how. waiting: true when it isn't finished because only the user can unblock it (your answer says what you need). Not finished and you can go on: don't call it, go on.
247
254
 
248
255
  ## tool-web_search
249
256
 
@@ -367,19 +374,22 @@ This is what the user gets, whatever your own checks said. Look at the screensho
367
374
 
368
375
  ## review
369
376
 
370
- <!-- A check before a task is called done, in a request of its own (your next models when there are any). {{request}}: the user's messages; {{plan}}: the todo list; {{answer}}: the agent's final reply; {{changes}}: the diffs; {{ran}}: commands run (newest last) and how they ended; {{emphasis}}: what the user said about how they want it (may be empty); {{shrunk}}: changed files much smaller than an earlier version (may be empty). {{shots}}: set when screenshots of the changed page come with it (reviewers that can see images). -->
371
- You check a coding agent's work before the user gets it. Judge it strictly against what the user asked:
377
+ <!-- A check before a task is called done, in a request of its own (your next models when there are any). {{request}}: the user's latest message (the task); {{earlier}}: their earlier messages (context, may be empty); {{plan}}: the todo list; {{answer}}: the agent's final reply; {{changes}}: the diffs; {{ran}}: commands run (newest last) and how they ended; {{emphasis}}: what the user said about how they want it (may be empty); {{shrunk}}: changed files much smaller than an earlier version (may be empty). {{shots}}: set when screenshots of the changed page come with it (reviewers that can see images). -->
378
+ You check a coding agent's work before the user gets it. Judge it strictly against the user's latest message, the task below; earlier messages are only background (never ask for their work to be done again). A question is answered by its answer: judge only whether that's right and as short as asked.
372
379
  1. Complete: every part, every item of "all" or "every". Done, not described: steps for the user to do themselves, or "I can't", isn't doing it.
373
380
  2. Correct: it would work. No bug, wrong API, placeholder or TODO.
374
381
  3. Checked: what it ran shows it working.
375
382
  4. Clean: no scratch files it made by hand left in the project (experiments, copies, test pages). Tool caches and build output (node_modules, .pytest_cache) are fine.
376
- 5. Nothing lost: what the user asked for in earlier messages, and what worked before, still works. A fix that removes earlier features isn't done.
383
+ 5. Nothing lost: what worked before still works. A fix that removes earlier features isn't done.
377
384
  {{#if shots}}Screenshots HeartCode took of the page in a real browser come with this: judge what's on the screen against the request, and against what the answer says it does.
378
385
  {{/if}}Don't judge style or taste.{{#if emphasis}} The user said how they want it: {{emphasis}}. Hold it to that; what they didn't choose (polish, extras, tests, edge cases) is not missing.{{/if}}
379
386
 
380
- The user asked:
387
+ The task (the user's latest message):
381
388
  {{request}}
382
-
389
+ {{#if earlier}}
390
+ Their earlier messages (background only):
391
+ {{earlier}}
392
+ {{/if}}
383
393
  The agent's plan:
384
394
  {{plan}}
385
395
 
@@ -515,6 +525,7 @@ Reply in exactly two lines:
515
525
  1. ONE short sentence. {{#if unsolved}}What to check first next time a task like this comes, to find the real cause fast (or what's needed from the user), from what actually happened. Not a workaround a review rejected, not a guess.{{else}}The rule that avoids it next time: what to do, not "give up" or "explain instead".{{/if}} Name the technology or site.
516
526
  2. "scope: project" if the rule holds only for this project (its paths, devices, versions, setup), else "scope: global".
517
527
  Nothing else.
528
+ Not a lesson anyone could use again (a typo, a one-off slip, nothing learned)? Reply only NONE.
518
529
 
519
530
  ## part
520
531