pantheon-opencode 2.0.0-beta.4 → 2.0.0-beta.6
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 +39 -68
- package/README.md +18 -5
- package/bin/pantheon-init.mjs +1 -2
- package/package.json +1 -1
- package/plugin.json +1 -1
- package/pyproject.toml +1 -1
- package/scripts/changelog-format.mjs +345 -0
- package/scripts/changelog-merge.mjs +5 -10
- package/scripts/docs-check-changelog.mjs +36 -137
- package/scripts/install/interactive.mjs +5 -254
- package/scripts/install/opencode.mjs +19 -76
- package/scripts/release-gates.mjs +33 -13
- package/scripts/release-notes.mjs +51 -36
- package/scripts/release-retrofit.mjs +158 -0
- package/scripts/skill-search.mjs +39 -4
- package/scripts/versioning.mjs +1 -1
- package/skills-lock.json +1 -1
- package/src/pantheon/goal-loop-config.ts +55 -0
- package/src/pantheon/native-vision.ts +9 -5
- package/src/pantheon/vision.ts +14 -1
- package/src/plugin.ts +39 -7
- package/src/plugins/tui/dist/tui.d.ts +3 -2
- package/src/plugins/tui/dist/tui.d.ts.map +1 -1
- package/src/plugins/tui/dist/tui.js +961 -312
- package/src/plugins/tui/dist/tui.js.map +1 -1
- package/src/plugins/tui/package-lock.json +2 -2
- package/src/plugins/tui/package.json +1 -1
- package/src/plugins/tui/src/autonomy-state.ts +149 -0
- package/src/plugins/tui/src/decision-router-state.ts +128 -6
- package/src/plugins/tui/src/index.tsx +86 -29
- package/src/plugins/tui/src/pantheon-settings.tsx +296 -24
- package/src/plugins/tui/src/tui-prefs.ts +378 -0
- package/src/skills/prompt-refinery/SKILL.md +34 -4
|
@@ -0,0 +1,378 @@
|
|
|
1
|
+
// biome-ignore-all lint/suspicious/noExplicitAny: stored prefs are host JSON of a known shape.
|
|
2
|
+
/**
|
|
3
|
+
* tui-prefs.ts — the TUI personalization core (the settings window's TUI tab).
|
|
4
|
+
*
|
|
5
|
+
* TUI-local copy doctrine (same as cost-data.ts): the bundle must stay
|
|
6
|
+
* self-contained. Persistence is the HOST's durable plugin storage
|
|
7
|
+
* (`context.storage.store('tui-prefs', { initial })` — reactive solid store,
|
|
8
|
+
* live-synced across TUI instances); this module owns the SHAPE and the pure
|
|
9
|
+
* operations, never the store handle.
|
|
10
|
+
*
|
|
11
|
+
* v1 surfaces: sidebar fixed headers, sidebar blocks, the Context block's
|
|
12
|
+
* sub-lines and gauge style, and the two Pantheon footer lines. Everything
|
|
13
|
+
* defaults to on — the window exists to turn things OFF.
|
|
14
|
+
*/
|
|
15
|
+
import type { Context } from '@opencode/plugin/tui/context'
|
|
16
|
+
import type { SettingsRow, SettingsTab } from './pantheon-settings-state.ts'
|
|
17
|
+
|
|
18
|
+
// ── The durable store handle (host storage, one per plugin) ────────────
|
|
19
|
+
// Created once at setup and stashed under a globalThis symbol so
|
|
20
|
+
// hot-reload generations keep sharing the same live store (the same
|
|
21
|
+
// singleton doctrine as the plugin's SINGLETON guard).
|
|
22
|
+
|
|
23
|
+
const PREFS_SYMBOL = Symbol.for('pantheon.tui.prefs.v1')
|
|
24
|
+
type PrefsStore = readonly [TuiPrefs, (mutation: (draft: TuiPrefs) => void) => Promise<void>]
|
|
25
|
+
|
|
26
|
+
function stash(): PrefsStore | undefined {
|
|
27
|
+
return (globalThis as Record<PropertyKey, unknown>)[PREFS_SYMBOL] as PrefsStore | undefined
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** Create (or reuse) the durable prefs store. Fail-open: without host
|
|
31
|
+
* storage the consumers fall back to DEFAULT_TUI_PREFS (read-only). */
|
|
32
|
+
export function initTuiPrefs(context: Context): void {
|
|
33
|
+
if (stash() !== undefined) return
|
|
34
|
+
try {
|
|
35
|
+
const handle = context.storage?.store?.('tui-prefs', { initial: DEFAULT_TUI_PREFS }) as
|
|
36
|
+
| PrefsStore
|
|
37
|
+
| undefined
|
|
38
|
+
if (handle !== undefined) {
|
|
39
|
+
;(globalThis as unknown as Record<PropertyKey, unknown>)[PREFS_SYMBOL] = handle
|
|
40
|
+
}
|
|
41
|
+
} catch {
|
|
42
|
+
/* no host storage — defaults stay read-only */
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** The live reactive prefs (read properties inside memos/JSX — tracked). */
|
|
47
|
+
export function tuiPrefs(): TuiPrefs {
|
|
48
|
+
return stash()?.[0] ?? DEFAULT_TUI_PREFS
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** Stage a mutation against the durable store; resolves when persisted. */
|
|
52
|
+
export function mutateTuiPrefs(mutation: (draft: TuiPrefs) => void): Promise<void> {
|
|
53
|
+
const handle = stash()
|
|
54
|
+
if (handle === undefined) return Promise.resolve()
|
|
55
|
+
return handle[1](mutation)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export const GAUGE_STYLES: readonly string[] = Object.freeze(['both', 'bar', 'percent', 'off'])
|
|
59
|
+
export const ENABLED_CYCLE: readonly string[] = Object.freeze(['enabled', 'disabled'])
|
|
60
|
+
|
|
61
|
+
export type GaugeStyle = 'both' | 'bar' | 'percent' | 'off'
|
|
62
|
+
|
|
63
|
+
export interface TuiPrefs {
|
|
64
|
+
version: 1
|
|
65
|
+
sidebar: {
|
|
66
|
+
header: { version: boolean; preset: boolean; session: boolean }
|
|
67
|
+
blocks: { context: boolean; git: boolean; todo: boolean; dispatch: boolean }
|
|
68
|
+
context: {
|
|
69
|
+
gauge: GaugeStyle
|
|
70
|
+
tokens: boolean
|
|
71
|
+
spent: boolean
|
|
72
|
+
modelUsage: boolean
|
|
73
|
+
performance: boolean
|
|
74
|
+
localSpend: boolean
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
footer: { prompt: boolean; home: boolean }
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export const DEFAULT_TUI_PREFS: TuiPrefs = {
|
|
81
|
+
version: 1,
|
|
82
|
+
sidebar: {
|
|
83
|
+
header: { version: true, preset: true, session: true },
|
|
84
|
+
blocks: { context: true, git: true, todo: true, dispatch: true },
|
|
85
|
+
context: {
|
|
86
|
+
gauge: 'both',
|
|
87
|
+
tokens: true,
|
|
88
|
+
spent: true,
|
|
89
|
+
modelUsage: true,
|
|
90
|
+
performance: true,
|
|
91
|
+
localSpend: true,
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
footer: { prompt: true, home: true },
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function asBool(value: unknown, fallback: boolean): boolean {
|
|
98
|
+
return typeof value === 'boolean' ? value : fallback
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/** Deep-merge stored JSON over the defaults; unknown keys and junk are ignored. */
|
|
102
|
+
export function normalizeTuiPrefs(raw: unknown): TuiPrefs {
|
|
103
|
+
const stored = (typeof raw === 'object' && raw !== null ? raw : {}) as Record<string, any>
|
|
104
|
+
const sidebar = (
|
|
105
|
+
typeof stored.sidebar === 'object' && stored.sidebar !== null ? stored.sidebar : {}
|
|
106
|
+
) as Record<string, any>
|
|
107
|
+
const header = (
|
|
108
|
+
typeof sidebar.header === 'object' && sidebar.header !== null ? sidebar.header : {}
|
|
109
|
+
) as Record<string, any>
|
|
110
|
+
const blocks = (
|
|
111
|
+
typeof sidebar.blocks === 'object' && sidebar.blocks !== null ? sidebar.blocks : {}
|
|
112
|
+
) as Record<string, any>
|
|
113
|
+
const context = (
|
|
114
|
+
typeof sidebar.context === 'object' && sidebar.context !== null ? sidebar.context : {}
|
|
115
|
+
) as Record<string, any>
|
|
116
|
+
const footer = (
|
|
117
|
+
typeof stored.footer === 'object' && stored.footer !== null ? stored.footer : {}
|
|
118
|
+
) as Record<string, any>
|
|
119
|
+
const gauge = GAUGE_STYLES.includes(context.gauge as string)
|
|
120
|
+
? (context.gauge as GaugeStyle)
|
|
121
|
+
: DEFAULT_TUI_PREFS.sidebar.context.gauge
|
|
122
|
+
return {
|
|
123
|
+
version: 1,
|
|
124
|
+
sidebar: {
|
|
125
|
+
header: {
|
|
126
|
+
version: asBool(header.version, true),
|
|
127
|
+
preset: asBool(header.preset, true),
|
|
128
|
+
session: asBool(header.session, true),
|
|
129
|
+
},
|
|
130
|
+
blocks: {
|
|
131
|
+
context: asBool(blocks.context, true),
|
|
132
|
+
git: asBool(blocks.git, true),
|
|
133
|
+
todo: asBool(blocks.todo, true),
|
|
134
|
+
dispatch: asBool(blocks.dispatch, true),
|
|
135
|
+
},
|
|
136
|
+
context: {
|
|
137
|
+
gauge,
|
|
138
|
+
tokens: asBool(context.tokens, true),
|
|
139
|
+
spent: asBool(context.spent, true),
|
|
140
|
+
modelUsage: asBool(context.modelUsage, true),
|
|
141
|
+
performance: asBool(context.performance, true),
|
|
142
|
+
localSpend: asBool(context.localSpend, true),
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
footer: {
|
|
146
|
+
prompt: asBool(footer.prompt, true),
|
|
147
|
+
home: asBool(footer.home, true),
|
|
148
|
+
},
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// ── The TUI tab (cycler rows over the dotted pref paths) ───────────────
|
|
153
|
+
|
|
154
|
+
const onOff = ENABLED_CYCLE
|
|
155
|
+
const row = (id: string, name: string, value: boolean, note: string): SettingsRow => ({
|
|
156
|
+
id,
|
|
157
|
+
name,
|
|
158
|
+
value: value ? 'enabled' : 'disabled',
|
|
159
|
+
cycle: onOff,
|
|
160
|
+
note,
|
|
161
|
+
})
|
|
162
|
+
|
|
163
|
+
export function buildTuiTab(prefs: TuiPrefs): SettingsTab {
|
|
164
|
+
return {
|
|
165
|
+
id: 'tui',
|
|
166
|
+
title: 'TUI',
|
|
167
|
+
groups: [
|
|
168
|
+
{
|
|
169
|
+
title: 'Sidebar header',
|
|
170
|
+
rows: [
|
|
171
|
+
row(
|
|
172
|
+
'tui.sidebar.header.version',
|
|
173
|
+
'Version line',
|
|
174
|
+
prefs.sidebar.header.version,
|
|
175
|
+
'the `Pantheon v…` line',
|
|
176
|
+
),
|
|
177
|
+
row(
|
|
178
|
+
'tui.sidebar.header.preset',
|
|
179
|
+
'Preset line',
|
|
180
|
+
prefs.sidebar.header.preset,
|
|
181
|
+
'the `▸ preset · provider` line',
|
|
182
|
+
),
|
|
183
|
+
row(
|
|
184
|
+
'tui.sidebar.header.session',
|
|
185
|
+
'Session line',
|
|
186
|
+
prefs.sidebar.header.session,
|
|
187
|
+
'the active session title',
|
|
188
|
+
),
|
|
189
|
+
],
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
title: 'Sidebar blocks',
|
|
193
|
+
rows: [
|
|
194
|
+
row(
|
|
195
|
+
'tui.sidebar.block.context',
|
|
196
|
+
'Context block',
|
|
197
|
+
prefs.sidebar.blocks.context,
|
|
198
|
+
'tokens, gauge, spend, model usage',
|
|
199
|
+
),
|
|
200
|
+
row(
|
|
201
|
+
'tui.sidebar.block.git',
|
|
202
|
+
'Git block',
|
|
203
|
+
prefs.sidebar.blocks.git,
|
|
204
|
+
'branch + working-tree counts',
|
|
205
|
+
),
|
|
206
|
+
row(
|
|
207
|
+
'tui.sidebar.block.todo',
|
|
208
|
+
'Todo block',
|
|
209
|
+
prefs.sidebar.blocks.todo,
|
|
210
|
+
'the newest todowrite',
|
|
211
|
+
),
|
|
212
|
+
row(
|
|
213
|
+
'tui.sidebar.block.dispatch',
|
|
214
|
+
'Dispatch block',
|
|
215
|
+
prefs.sidebar.blocks.dispatch,
|
|
216
|
+
'live delegations + rollup',
|
|
217
|
+
),
|
|
218
|
+
],
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
title: 'Context block detail',
|
|
222
|
+
rows: [
|
|
223
|
+
{
|
|
224
|
+
id: 'tui.sidebar.context.gauge',
|
|
225
|
+
name: 'Gauge style',
|
|
226
|
+
value: prefs.sidebar.context.gauge,
|
|
227
|
+
cycle: GAUGE_STYLES,
|
|
228
|
+
note: 'both | bar | percent | off — `▰▱ 42% of 200k`',
|
|
229
|
+
},
|
|
230
|
+
row(
|
|
231
|
+
'tui.sidebar.context.tokens',
|
|
232
|
+
'Tokens row',
|
|
233
|
+
prefs.sidebar.context.tokens,
|
|
234
|
+
'the raw token count line',
|
|
235
|
+
),
|
|
236
|
+
row(
|
|
237
|
+
'tui.sidebar.context.spent',
|
|
238
|
+
'Spent row',
|
|
239
|
+
prefs.sidebar.context.spent,
|
|
240
|
+
'the `$… gasto na sessão` line',
|
|
241
|
+
),
|
|
242
|
+
row(
|
|
243
|
+
'tui.sidebar.context.modelUsage',
|
|
244
|
+
'Model usage table',
|
|
245
|
+
prefs.sidebar.context.modelUsage,
|
|
246
|
+
'per-model tokens/USD',
|
|
247
|
+
),
|
|
248
|
+
row(
|
|
249
|
+
'tui.sidebar.context.performance',
|
|
250
|
+
'Performance line',
|
|
251
|
+
prefs.sidebar.context.performance,
|
|
252
|
+
'cache % + tok/s',
|
|
253
|
+
),
|
|
254
|
+
row(
|
|
255
|
+
'tui.sidebar.context.localSpend',
|
|
256
|
+
'Local spend',
|
|
257
|
+
prefs.sidebar.context.localSpend,
|
|
258
|
+
'hoje / 30d totals',
|
|
259
|
+
),
|
|
260
|
+
],
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
title: 'Footers',
|
|
264
|
+
rows: [
|
|
265
|
+
row(
|
|
266
|
+
'tui.footer.prompt',
|
|
267
|
+
'Prompt footer',
|
|
268
|
+
prefs.footer.prompt,
|
|
269
|
+
'the `▸preset · ✦n ativos` line while delegations run',
|
|
270
|
+
),
|
|
271
|
+
row(
|
|
272
|
+
'tui.footer.home',
|
|
273
|
+
'Home status',
|
|
274
|
+
prefs.footer.home,
|
|
275
|
+
'the `Pantheon v…` line under the home prompt',
|
|
276
|
+
),
|
|
277
|
+
],
|
|
278
|
+
},
|
|
279
|
+
],
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* Apply one staged row INTO a prefs draft (in place — the storage mutate
|
|
285
|
+
* callback hands an immer-style draft). Unknown ids or junk values are no-ops.
|
|
286
|
+
*/
|
|
287
|
+
export function applyTuiRow(draft: TuiPrefs, id: string, value: string): void {
|
|
288
|
+
const enabled = value === 'enabled'
|
|
289
|
+
switch (id) {
|
|
290
|
+
case 'tui.sidebar.header.version':
|
|
291
|
+
draft.sidebar.header.version = enabled
|
|
292
|
+
return
|
|
293
|
+
case 'tui.sidebar.header.preset':
|
|
294
|
+
draft.sidebar.header.preset = enabled
|
|
295
|
+
return
|
|
296
|
+
case 'tui.sidebar.header.session':
|
|
297
|
+
draft.sidebar.header.session = enabled
|
|
298
|
+
return
|
|
299
|
+
case 'tui.sidebar.block.context':
|
|
300
|
+
draft.sidebar.blocks.context = enabled
|
|
301
|
+
return
|
|
302
|
+
case 'tui.sidebar.block.git':
|
|
303
|
+
draft.sidebar.blocks.git = enabled
|
|
304
|
+
return
|
|
305
|
+
case 'tui.sidebar.block.todo':
|
|
306
|
+
draft.sidebar.blocks.todo = enabled
|
|
307
|
+
return
|
|
308
|
+
case 'tui.sidebar.block.dispatch':
|
|
309
|
+
draft.sidebar.blocks.dispatch = enabled
|
|
310
|
+
return
|
|
311
|
+
case 'tui.sidebar.context.gauge':
|
|
312
|
+
if (GAUGE_STYLES.includes(value)) draft.sidebar.context.gauge = value as GaugeStyle
|
|
313
|
+
return
|
|
314
|
+
case 'tui.sidebar.context.tokens':
|
|
315
|
+
draft.sidebar.context.tokens = enabled
|
|
316
|
+
return
|
|
317
|
+
case 'tui.sidebar.context.spent':
|
|
318
|
+
draft.sidebar.context.spent = enabled
|
|
319
|
+
return
|
|
320
|
+
case 'tui.sidebar.context.modelUsage':
|
|
321
|
+
draft.sidebar.context.modelUsage = enabled
|
|
322
|
+
return
|
|
323
|
+
case 'tui.sidebar.context.performance':
|
|
324
|
+
draft.sidebar.context.performance = enabled
|
|
325
|
+
return
|
|
326
|
+
case 'tui.sidebar.context.localSpend':
|
|
327
|
+
draft.sidebar.context.localSpend = enabled
|
|
328
|
+
return
|
|
329
|
+
case 'tui.footer.prompt':
|
|
330
|
+
draft.footer.prompt = enabled
|
|
331
|
+
return
|
|
332
|
+
case 'tui.footer.home':
|
|
333
|
+
draft.footer.home = enabled
|
|
334
|
+
return
|
|
335
|
+
default:
|
|
336
|
+
return
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
/** Read the current pref value for a row id ('enabled'/'disabled'/gauge). */
|
|
341
|
+
export function tuiRowValue(prefs: TuiPrefs, id: string): string | undefined {
|
|
342
|
+
if (id === 'tui.sidebar.context.gauge') return prefs.sidebar.context.gauge
|
|
343
|
+
const enabled = (() => {
|
|
344
|
+
switch (id) {
|
|
345
|
+
case 'tui.sidebar.header.version':
|
|
346
|
+
return prefs.sidebar.header.version
|
|
347
|
+
case 'tui.sidebar.header.preset':
|
|
348
|
+
return prefs.sidebar.header.preset
|
|
349
|
+
case 'tui.sidebar.header.session':
|
|
350
|
+
return prefs.sidebar.header.session
|
|
351
|
+
case 'tui.sidebar.block.context':
|
|
352
|
+
return prefs.sidebar.blocks.context
|
|
353
|
+
case 'tui.sidebar.block.git':
|
|
354
|
+
return prefs.sidebar.blocks.git
|
|
355
|
+
case 'tui.sidebar.block.todo':
|
|
356
|
+
return prefs.sidebar.blocks.todo
|
|
357
|
+
case 'tui.sidebar.block.dispatch':
|
|
358
|
+
return prefs.sidebar.blocks.dispatch
|
|
359
|
+
case 'tui.sidebar.context.tokens':
|
|
360
|
+
return prefs.sidebar.context.tokens
|
|
361
|
+
case 'tui.sidebar.context.spent':
|
|
362
|
+
return prefs.sidebar.context.spent
|
|
363
|
+
case 'tui.sidebar.context.modelUsage':
|
|
364
|
+
return prefs.sidebar.context.modelUsage
|
|
365
|
+
case 'tui.sidebar.context.performance':
|
|
366
|
+
return prefs.sidebar.context.performance
|
|
367
|
+
case 'tui.sidebar.context.localSpend':
|
|
368
|
+
return prefs.sidebar.context.localSpend
|
|
369
|
+
case 'tui.footer.prompt':
|
|
370
|
+
return prefs.footer.prompt
|
|
371
|
+
case 'tui.footer.home':
|
|
372
|
+
return prefs.footer.home
|
|
373
|
+
default:
|
|
374
|
+
return undefined
|
|
375
|
+
}
|
|
376
|
+
})()
|
|
377
|
+
return enabled === undefined ? undefined : enabled ? 'enabled' : 'disabled'
|
|
378
|
+
}
|
|
@@ -14,6 +14,13 @@ description: "Turn a vague multi-concern request into a usable brief — interna
|
|
|
14
14
|
| Nível | Gatilho | O que acontece |
|
|
15
15
|
|---|---|---|
|
|
16
16
|
| **0 — Passa intacto** | Pedido claro e delimitado ("corrija o typo do README"), cumprimentos e conversa fiada (o `__SKIP__` do prompt-enhancer) | Executa direto, zero token de refinamento |
|
|
17
|
+
|
|
18
|
+
**Anti-padrões que ESCALAM o nível** (qualquer um presente = no mínimo Tier 1; dois ou mais = considere perguntar via tool `question` antes de seguir):
|
|
19
|
+
- **Escopo sem fronteira** — "melhorar tudo", "refatorar o projeto": sem fatias, sem fim.
|
|
20
|
+
- **Adjetivo sem critério** — "mais rápido", "melhor": sem número, sem baseline, sem like-to-like.
|
|
21
|
+
- **Unidade/versão ausente** — "32" de quê? "atualize" pra qual versão? O default pode ser errado.
|
|
22
|
+
- **Multi-concern em um parágrafo** — fix + refactor + redesign sem prioridade (o caso que criou esta skill).
|
|
23
|
+
- **Premissa implícita de ambiente** — assume stack/host/credenciais que o agente não pode inferir.
|
|
17
24
|
| **1 — Ajuste mínimo INTERNO (automático)** | O sinal determinístico dispara | Reescreve o prompt **silenciosamente, para uso próprio**: PT corrigido, estrutura leve, expansão do implícito, lacunas viram escolhas com default declarado. SEM apresentar contrato, SEM pedir aprovação — o usuário vê o trabalho começar. Limite: o essencial (~10-15 linhas internas); escopo pode ser generoso quando o pedido pede |
|
|
18
25
|
| **2 — Contrato completo** | **SOMENTE prefixo `>>`** | As seis seções inteiras apresentadas ao usuário para confirmar-ou-ajustar (a ÚNICA via com aprovação explícita) |
|
|
19
26
|
|
|
@@ -23,7 +30,22 @@ O modelo ativo da sessão faz os dois níveis sem problema — o custo é contro
|
|
|
23
30
|
|
|
24
31
|
## The contract shape — tiers and caps
|
|
25
32
|
|
|
26
|
-
**NÍVEL 1 — Ajuste mínimo INTERNO (o default do sinal determinístico):** reescrita para uso próprio, SEM apresentar ao usuário. O essencial + o que o pedido pedir (o escopo mínimo não é um aperto: expanda o implícito, estime o que falta com default declarado).
|
|
33
|
+
**NÍVEL 1 — Ajuste mínimo INTERNO (o default do sinal determinístico):** reescrita para uso próprio, SEM apresentar ao usuário. O essencial + o que o pedido pedir (o escopo mínimo não é um aperto: expanda o implícito, estime o que falta com default declarado).
|
|
34
|
+
|
|
35
|
+
**Diagnóstico interno ANTES do rewrite** (os improvers oficiais diagnosticam primeiro — o rewrite que não diagnostica chuta):
|
|
36
|
+
1. **Tarefa** — qual ação concreta o usuário quer? (verbo + objeto)
|
|
37
|
+
2. **Restrições ausentes** — o que ele não disse que LIMITA o resultado? (prazo, tamanho, compatibilidade, budget)
|
|
38
|
+
3. **Sucesso indefinido** — como saber que ficou pronto? Se não dá pra testar, formule o teste.
|
|
39
|
+
4. **Premissas implícitas** — o que o pedido ASSUME que você sabe? (stack, ambiente, histórico)
|
|
40
|
+
5. **Conflitos** — o pedido se contradiz? (peça X mas o aceite implica ¬X)
|
|
41
|
+
|
|
42
|
+
Cada ponto do diagnóstico vira OU uma decisão no rewrite OU um default declarado OU uma pergunta bloqueante — nada fica implícito duas vezes. Quando o pedido tiver **duas leituras com resultados materialmente diferentes** ("atualizar o README" = patch ou reescrita?), é bloqueante — a leitura errada executa caro e errado. E é aqui que o **Jev entra quando ativado** (ver a regra de desambiguação nas Operating rules): o decision model resolve a leitura como escalar tipado, e a interrupção do usuário vira exceção, não regra.
|
|
43
|
+
|
|
44
|
+
**Restrições negativas entram no rewrite quando detectadas** — "não tocar em X", "sem nova dependência", "sem migrar ainda". O usuário raramente as diz; o agente que infere incorretamente é quem executa drift.
|
|
45
|
+
|
|
46
|
+
**Formato da resposta**: se o pedido implicar entrega estruturada (relatório, tabela, plano), o rewrite fixa o formato — "responda como tabela com colunas X/Y" custa uma frase e economiza um redo.
|
|
47
|
+
|
|
48
|
+
Exemplo de saída aceitável:
|
|
27
49
|
|
|
28
50
|
```
|
|
29
51
|
Objetivo: publicar deploys pendentes e liberar espaço nos VPS sem perder dados.
|
|
@@ -32,6 +54,8 @@ Aceite: lista de SHAs por serviço; espaço antes/depois; nada persistente apaga
|
|
|
32
54
|
Perguntas: quais VPS? (default: os que rodam estes serviços) | limpeza destrutiva? (default: não).
|
|
33
55
|
```
|
|
34
56
|
|
|
57
|
+
**Self-check do rewrite** (rubrica interna, custo zero — a versão agent-side do loop OPRO/DSPy): antes de seguir, o rewrite passa por — objetivo único e único verbo? | fatias verificáveis individualmente? | todo default declarado por escrito? | formato da resposta definido (quando a entrega é estruturada)? | restrições negativas registradas? Qualquer não = uma passada de correção interna, não uma nova conversa.
|
|
58
|
+
|
|
35
59
|
**NÍVEL 2 — Contrato completo (SOMENTE com o prefixo `>>`):** as seis seções abaixo, inteiras, apresentadas ao usuário para confirmar-ou-ajustar.
|
|
36
60
|
|
|
37
61
|
Produce ALL of the following sections, filling from the request and marking real gaps as open questions — never invent requirements silently:
|
|
@@ -42,6 +66,7 @@ Produce ALL of the following sections, filling from the request and marking real
|
|
|
42
66
|
4. **Entregáveis esperados** — the concrete artifacts (report, route map, dictionary, implementation).
|
|
43
67
|
5. **Perguntas abertas** — the gaps that change the plan, with your recommended default for each so silence means "proceed with the default".
|
|
44
68
|
6. **Glossário/nomenclatura proposta** — when the domain has ambiguous terms, propose the canonical names up front.
|
|
69
|
+
7. **Formato da resposta** — como o usuário recebe cada entregável (tabela, checklist, diff, PR, relatório com seções): o improver oficial trata output structure como parte do prompt, não do acaso.
|
|
45
70
|
|
|
46
71
|
---
|
|
47
72
|
|
|
@@ -52,9 +77,14 @@ Produce ALL of the following sections, filling from the request and marking real
|
|
|
52
77
|
- **Preserve the user's language** (a PT-BR request refines into PT-BR).
|
|
53
78
|
- **Falha = fail-open**: qualquer erro no rewrite e o prompt ORIGINAL segue — nunca bloqueia.
|
|
54
79
|
- **Nudge self-cancel cheap** (do claude-code-prompt-improver): perguntas abertas com "se isso não se aplicar ao seu caso, ignore" — o nudge barato se anula sozinho quando o palpite erra.
|
|
55
|
-
- **
|
|
80
|
+
- **Desambiguação — Jev PRIMEIRO quando ativo, `question` como fallback** (revê a regra antiga "NUNCA Jev": com o decision router ATIVO e com budget o usuário já consentiu gastar; a leitura errada custa mais que o escalar):
|
|
81
|
+
1. Ambiguidade bloqueante (leitores materialmente diferentes) + decision router ATIVO → `jev_decide` modo `choice` — candidatos = as leituras, o default recomendado marcado como tal. Decisão interna, silenciosa (Tier 1).
|
|
82
|
+
2. Jev OFF / indisponível / veredito UNVERIFIABLE ou FAIL / timeout → tool `question` nativa com opções e o default recomendado — exatamente o comportamento anterior.
|
|
83
|
+
3. Lacuna NÃO-bloqueante vira escolha com default declarado e segue (nada de Jev nem pergunta — decisa é barata).
|
|
84
|
+
4. **Fail-open nos dois lados**: qualquer erro do Jev cai na `question`; qualquer erro da `question` segue com o default. Nada bloqueia além de uma pergunta legítima.
|
|
85
|
+
5. O Jev decide a LEITURA — nunca escreve o rewrite (prosa é do modelo de sessão).
|
|
56
86
|
- **`extra_instructions` do projeto**: convenções do projeto (stack, hosts de deploy, domínios como cupons ML/AliExpress) têm PRIORIDADE sobre os defaults recomendados — leia o AGENTS.md do projeto antes de propor defaults.
|
|
57
|
-
- **Referências**: `omkarxpatel/prompt-enhancer` (prefixo opt-in, cap de saída, fail-open) e `severity1/claude-code-prompt-improver` (nudges self-cancel, clarificação com opções) — os dois designs que este skill incorpora.
|
|
87
|
+
- **Referências**: `omkarxpatel/prompt-enhancer` (prefixo opt-in, cap de saída, fail-open) e `severity1/claude-code-prompt-improver` (nudges self-cancel, clarificação com opções) — os dois designs que este skill incorpora. Fundação teórica dos padrões de diagnóstico-e-rewrite: os prompt improvers oficiais (Anthropic/OpenAI), meta-prompting (LLMs guiando LLMs) e o loop de otimização com verificação (OPRO/DSPy) — esta skill é a versão agent-side de custo-controlado: um turno, sem loop de API.
|
|
58
88
|
- **Modelo**: o rewrite roda no modelo ativo da sessão; o controle de custo é o CAP de cada nível (interno ~10-15 linhas; completo = as seis seções) — quando houver modelo free/rápido no preset ativo (ex.: mimo-v2.5-free, deepseek-v4-flash-free), prefira-o via routing para o turno de rewrite.
|
|
59
|
-
- **One refinement turn.** The rewrite is a single planning pass on the session model — no extra provider call, no Jev
|
|
89
|
+
- **One refinement turn + no máx. um escalar.** The rewrite is a single planning pass on the session model — no extra provider call, no Jev for the rewrite itself (decision models answer typed scalars, they do not write prose). The ONE exception is the ambiguity `choice` above: quando o router está ativo, é um escalar a mais no budget — se o budget recusar, cai na `question` sem cerimônia.
|
|
60
90
|
- **Cost honesty**: the refinement costs roughly one planning turn (~1–4K tokens each way). The expensive thing is executing a mis-specified request; this skill buys that back.
|