atom-lite 0.4.1 → 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 +35 -1
- package/README.md +41 -108
- package/dist/agent/loop.d.ts +15 -0
- package/dist/agent/loop.js +277 -57
- package/dist/agent/loop.js.map +1 -1
- package/dist/agent/model-turn.d.ts +37 -0
- package/dist/agent/model-turn.js +53 -0
- package/dist/agent/model-turn.js.map +1 -0
- package/dist/agent/system-prompt.d.ts +1 -0
- package/dist/agent/system-prompt.js +23 -0
- package/dist/agent/system-prompt.js.map +1 -0
- package/dist/agent/turn-recorder.d.ts +33 -0
- package/dist/agent/turn-recorder.js +74 -0
- package/dist/agent/turn-recorder.js.map +1 -0
- package/dist/agent/types.d.ts +15 -0
- package/dist/cli/app.js +570 -68
- package/dist/cli/app.js.map +1 -1
- package/dist/cli/commands.d.ts +3 -0
- package/dist/cli/commands.js +20 -5
- package/dist/cli/commands.js.map +1 -1
- package/dist/cli/diff-view.d.ts +18 -0
- package/dist/cli/diff-view.js +66 -0
- package/dist/cli/diff-view.js.map +1 -0
- package/dist/cli/main.js +2 -2
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/mouse.js +4 -1
- package/dist/cli/mouse.js.map +1 -1
- package/dist/cli/panel.js +8 -8
- package/dist/cli/panel.js.map +1 -1
- package/dist/cli/status-line.d.ts +2 -0
- package/dist/cli/status-line.js +9 -1
- package/dist/cli/status-line.js.map +1 -1
- package/dist/cli/stream-text.js +1 -0
- package/dist/cli/stream-text.js.map +1 -1
- package/dist/cli/theme.d.ts +1 -1
- package/dist/cli/theme.js +2 -0
- package/dist/cli/theme.js.map +1 -1
- package/dist/cli/tool-box.d.ts +1 -1
- package/dist/cli/tool-box.js +44 -39
- package/dist/cli/tool-box.js.map +1 -1
- package/dist/cli/transcript.d.ts +15 -1
- package/dist/cli/transcript.js +40 -1
- package/dist/cli/transcript.js.map +1 -1
- package/dist/cli/trust-prompt.d.ts +24 -0
- package/dist/cli/trust-prompt.js +89 -0
- package/dist/cli/trust-prompt.js.map +1 -0
- package/dist/config/defaults.d.ts +6 -5
- package/dist/config/defaults.js +8 -3
- package/dist/config/defaults.js.map +1 -1
- package/dist/config/load.js +33 -3
- package/dist/config/load.js.map +1 -1
- package/dist/config/paths.d.ts +2 -0
- package/dist/config/paths.js +12 -1
- package/dist/config/paths.js.map +1 -1
- package/dist/config/schema.d.ts +14 -14
- package/dist/config/schema.js +6 -5
- package/dist/config/schema.js.map +1 -1
- package/dist/context/manager.d.ts +17 -3
- package/dist/context/manager.js +129 -41
- package/dist/context/manager.js.map +1 -1
- package/dist/extensions/api.d.ts +51 -1
- package/dist/extensions/api.js +124 -6
- package/dist/extensions/api.js.map +1 -1
- package/dist/extensions/discovery.d.ts +16 -0
- package/dist/extensions/discovery.js +191 -108
- package/dist/extensions/discovery.js.map +1 -1
- package/dist/extensions/loader.d.ts +42 -1
- package/dist/extensions/loader.js +272 -32
- package/dist/extensions/loader.js.map +1 -1
- package/dist/extensions/session-manager.d.ts +44 -0
- package/dist/extensions/session-manager.js +137 -0
- package/dist/extensions/session-manager.js.map +1 -0
- package/dist/extensions/tool-adapter.d.ts +12 -0
- package/dist/extensions/tool-adapter.js +157 -0
- package/dist/extensions/tool-adapter.js.map +1 -0
- package/dist/extensions/trust.d.ts +2 -0
- package/dist/extensions/trust.js +32 -17
- package/dist/extensions/trust.js.map +1 -1
- package/dist/extensions/types.d.ts +45 -3
- package/dist/extensions/ui.d.ts +21 -0
- package/dist/extensions/ui.js +75 -0
- package/dist/extensions/ui.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/mcp/stdio-transport.js +3 -20
- package/dist/mcp/stdio-transport.js.map +1 -1
- package/dist/runtime/modes.d.ts +3 -0
- package/dist/runtime/modes.js +8 -0
- package/dist/runtime/modes.js.map +1 -0
- package/dist/runtime/scheduler.d.ts +4 -3
- package/dist/runtime/scheduler.js +7 -105
- package/dist/runtime/scheduler.js.map +1 -1
- package/dist/runtime/tool-executor.d.ts +18 -0
- package/dist/runtime/tool-executor.js +136 -0
- package/dist/runtime/tool-executor.js.map +1 -0
- package/dist/security/process.d.ts +10 -0
- package/dist/security/process.js +36 -0
- package/dist/security/process.js.map +1 -1
- package/dist/sessions/store.js +2 -3
- package/dist/sessions/store.js.map +1 -1
- package/dist/skills/registry.js +8 -1
- package/dist/skills/registry.js.map +1 -1
- package/dist/tools/bash.js +7 -4
- package/dist/tools/bash.js.map +1 -1
- package/dist/tools/glob.d.ts +2 -0
- package/dist/tools/glob.js +97 -0
- package/dist/tools/glob.js.map +1 -0
- package/dist/tools/grep.d.ts +2 -0
- package/dist/tools/grep.js +290 -0
- package/dist/tools/grep.js.map +1 -0
- package/dist/tools/index.d.ts +2 -0
- package/dist/tools/index.js +2 -0
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/types.d.ts +8 -0
- package/dist/types.d.ts +0 -3
- package/dist/types.js +1 -4
- package/dist/types.js.map +1 -1
- package/package.json +5 -2
- package/skills/atom-lite-extensions/SKILL.md +240 -0
- package/skills/caveman/SKILL.md +89 -0
- package/skills/code-review/SKILL.md +46 -0
- package/skills/optimization/SKILL.md +51 -0
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: atom-lite-extensions
|
|
3
|
+
description: "Build, load, and debug Atom-lite extensions (Pi-compatible). Use when creating an extension, registering tools/commands/providers, handling events, adding UI widgets, or troubleshooting extension loading. Covers the ExtensionAPI surface, trust, discovery, tiers, and examples."
|
|
4
|
+
license: MIT
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Atom-lite Extensions
|
|
8
|
+
|
|
9
|
+
Atom-lite hosts **unmodified Pi coding-agent extensions in-process**. An
|
|
10
|
+
extension is a TypeScript/JavaScript module that exports a default (or
|
|
11
|
+
`activate`) function receiving an `ExtensionAPI` (`pi`). It registers tools,
|
|
12
|
+
commands, providers, models, widgets, and event handlers into Atom-lite's own
|
|
13
|
+
runtime.
|
|
14
|
+
|
|
15
|
+
Reference docs:
|
|
16
|
+
- `docs/extensions.md` — discovery, trust, compatibility tiers, diagnostics.
|
|
17
|
+
- `docs/adr/0011-pi-extensions-in-process.md` — architecture.
|
|
18
|
+
- `src/extensions/types.ts` — full `ExtensionAPI` + registries.
|
|
19
|
+
- `src/extensions/api.ts` — runtime implementation.
|
|
20
|
+
- `tests/extensions/` — conformance fixtures.
|
|
21
|
+
- Run `/extensions` and `/extensions doctor` inside atom-lite for live diagnostics.
|
|
22
|
+
|
|
23
|
+
## Minimal extension
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
// my-ext.ts
|
|
27
|
+
export default function (pi: any) {
|
|
28
|
+
pi.registerTool({
|
|
29
|
+
name: "greet",
|
|
30
|
+
label: "Greet",
|
|
31
|
+
description: "Return a greeting for a name.",
|
|
32
|
+
parameters: { type: "object", properties: { name: { type: "string" } }, required: ["name"] },
|
|
33
|
+
async execute(toolCallId, params, signal, onUpdate, ctx) {
|
|
34
|
+
return { content: [{ type: "text", text: `Hello, ${params.name}!` }] };
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
pi.registerCommand({
|
|
39
|
+
name: "hello",
|
|
40
|
+
description: "Say hello",
|
|
41
|
+
async run(ctx, args) {
|
|
42
|
+
pi.notify(`hello ${args}`, "info");
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
pi.on("tool_call", async (event) => {
|
|
47
|
+
// observe every tool call
|
|
48
|
+
pi.log(`tool_call: ${event?.name}`);
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Load it:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
atom-lite -e ./my-ext.ts
|
|
57
|
+
# or place under .agents/skills? no — extensions live in extension dirs, see Discovery
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Discovery
|
|
61
|
+
|
|
62
|
+
Extensions are discovered from:
|
|
63
|
+
- CLI paths: `-e` / `--extension PATH`.
|
|
64
|
+
- Atom-lite user/project extension directories.
|
|
65
|
+
- Pi discovery locations and `settings.json` / `package.json` `pi.extensions` manifests.
|
|
66
|
+
|
|
67
|
+
Project-local extensions are **skipped until the project is trusted**. Interactive
|
|
68
|
+
sessions prompt for approval; non-interactive runs skip untrusted ones. Trust
|
|
69
|
+
decisions are stored in user config. Check trust with `pi.isProjectTrusted()`.
|
|
70
|
+
|
|
71
|
+
## Module shape
|
|
72
|
+
|
|
73
|
+
Both forms are accepted (migration-friendly):
|
|
74
|
+
|
|
75
|
+
```ts
|
|
76
|
+
export default function (pi) { /* ... */ }
|
|
77
|
+
export async function activate(pi) { /* ... */ }
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Pi host modules are aliased to Atom-lite's own copies, so use Pi-style imports:
|
|
81
|
+
|
|
82
|
+
```ts
|
|
83
|
+
import { Type } from "@sinclair/typebox"; // or "typebox"
|
|
84
|
+
import { Text } from "@earendil-works/pi-tui"; // or "pi-tui"
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Legacy `@mariozechner/*` specifiers also resolve. TypeScript loads without a
|
|
88
|
+
build step (via `jiti`).
|
|
89
|
+
|
|
90
|
+
## Tools
|
|
91
|
+
|
|
92
|
+
```ts
|
|
93
|
+
pi.registerTool({
|
|
94
|
+
name: "my_tool",
|
|
95
|
+
label: "My Tool",
|
|
96
|
+
description: "What the LLM sees.",
|
|
97
|
+
parameters: { /* JSON Schema / TypeBox */ },
|
|
98
|
+
async execute(toolCallId, params, signal, onUpdate, ctx) {
|
|
99
|
+
// stream partial output:
|
|
100
|
+
onUpdate?.({ content: [{ type: "text", text: "partial..." }] });
|
|
101
|
+
return { content: [{ type: "text", text: "final result" }], details: { foo: 1 } };
|
|
102
|
+
},
|
|
103
|
+
// optional custom rendering (Tier 2):
|
|
104
|
+
renderCall: (args, theme, context) => new Text(`call ${args}`),
|
|
105
|
+
renderResult: (result, options, theme, context) => new Text(result.content[0]?.text ?? ""),
|
|
106
|
+
});
|
|
107
|
+
pi.unregisterTool("my_tool");
|
|
108
|
+
pi.setActiveTools(["my_tool"]);
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Commands
|
|
112
|
+
|
|
113
|
+
```ts
|
|
114
|
+
pi.registerCommand({
|
|
115
|
+
name: "mycmd",
|
|
116
|
+
description: "Do something",
|
|
117
|
+
argumentHint: "[arg]",
|
|
118
|
+
async run(args, ctx) {
|
|
119
|
+
pi.appendEntry("mycmd_ran", { args });
|
|
120
|
+
const ok = await pi.confirm("Title", "Proceed?");
|
|
121
|
+
const name = await pi.input("Name", "placeholder");
|
|
122
|
+
const choice = await pi.select("Pick", ["a", "b"]);
|
|
123
|
+
},
|
|
124
|
+
});
|
|
125
|
+
pi.unregisterCommand("mycmd");
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Commands become `/mycmd` in the palette and support autocomplete.
|
|
129
|
+
|
|
130
|
+
## Events
|
|
131
|
+
|
|
132
|
+
```ts
|
|
133
|
+
const off = pi.on("assistant_delta", async (event, ctx) => { /* ... */ });
|
|
134
|
+
pi.off("assistant_delta", handler);
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Common events: `tool_call`, `tool_result`, `assistant_delta`, `assistant_text`,
|
|
138
|
+
`thinking_delta`, `agent_start`, `agent_end`, `turn_start`, `turn_end`,
|
|
139
|
+
`context_usage`, `model_switched`, `session_start`. Tier 3 events
|
|
140
|
+
(session tree, forks) fail loudly.
|
|
141
|
+
|
|
142
|
+
## UI
|
|
143
|
+
|
|
144
|
+
```ts
|
|
145
|
+
pi.ui.notify("hello", "info"); // info | warning | error
|
|
146
|
+
pi.setStatus("myext", "status text"); // undefined clears
|
|
147
|
+
pi.registerWidget("aboveInput", { id: "my-widget", location: "aboveInput", render: (width) => ["line1"] });
|
|
148
|
+
pi.setWidget("key", ["line"], { placement: "aboveEditor" });
|
|
149
|
+
pi.setFooter((tui, theme, data) => /* component */);
|
|
150
|
+
pi.setHeader((tui, theme) => /* component */);
|
|
151
|
+
pi.setTitle("my title");
|
|
152
|
+
pi.setWorkingMessage("thinking...");
|
|
153
|
+
pi.setWorkingVisible(true);
|
|
154
|
+
pi.setWorkingIndicator({ frames: ["⠋","⠙"], intervalMs: 80 });
|
|
155
|
+
pi.setHiddenThinkingLabel("reasoning");
|
|
156
|
+
pi.getToolsExpanded(); pi.setToolsExpanded(true);
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
Dialogs: `pi.select`, `pi.confirm`, `pi.input` (shown above).
|
|
160
|
+
|
|
161
|
+
## Session entries
|
|
162
|
+
|
|
163
|
+
```ts
|
|
164
|
+
pi.appendEntry("custom_type", { foo: 1 });
|
|
165
|
+
const entries = pi.getSessionEntries({ type: "custom_type" });
|
|
166
|
+
pi.getSessionManager(); // read model
|
|
167
|
+
pi.getSession(); // { id }
|
|
168
|
+
pi.getWorkspace();
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
## Providers & models
|
|
172
|
+
|
|
173
|
+
```ts
|
|
174
|
+
pi.registerProvider({
|
|
175
|
+
name: "myprovider",
|
|
176
|
+
// OpenAI-compatible mapping; OAuth/streamSimple are reduced-compat
|
|
177
|
+
});
|
|
178
|
+
pi.registerModel({ id: "mymodel", provider: "myprovider", ... });
|
|
179
|
+
pi.unregisterProvider("myprovider");
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
## Exec & logging
|
|
183
|
+
|
|
184
|
+
```ts
|
|
185
|
+
const res = await pi.exec("git", ["status"], { cwd: pi.getWorkspace() });
|
|
186
|
+
pi.log("debug message");
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
## Shortcuts, flags, autocomplete
|
|
190
|
+
|
|
191
|
+
```ts
|
|
192
|
+
pi.registerShortcut("ctrl+shift+x", { description: "do thing", handler: async (ctx) => {} });
|
|
193
|
+
pi.registerFlag("myflag", { type: "boolean", default: false });
|
|
194
|
+
const v = pi.getFlag("myflag");
|
|
195
|
+
pi.addAutocompleteProvider((tui, theme) => ({ /* ... */ }));
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
## Renderers (Tier 2)
|
|
199
|
+
|
|
200
|
+
```ts
|
|
201
|
+
pi.registerToolRenderer((toolName, next) => ({ renderCall, renderResult }));
|
|
202
|
+
pi.registerMessageRenderer("custom_type", (message, options, theme) => /* Component */);
|
|
203
|
+
pi.registerEntryRenderer("custom_type", (entry, theme) => /* Component */);
|
|
204
|
+
pi.registerMarkdownTransformer((markdown) => markdown);
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
## Compatibility tiers
|
|
208
|
+
|
|
209
|
+
- **Tier 1 (works today):** discovery, trust, TS loading, tools, commands, events,
|
|
210
|
+
session entries/read model, status/notify/dialogs/widgets/overlays, exec,
|
|
211
|
+
provider/model registration (OpenAI-compatible).
|
|
212
|
+
- **Tier 2 (staged):** renderers, markdown transformers, shortcuts, flags,
|
|
213
|
+
autocomplete, custom footer/header/title, working indicator, thinking label.
|
|
214
|
+
- **Tier 3 (deferred, fail loudly):** session tree/forks, codemode, MCP server
|
|
215
|
+
registration, OAuth providers, virtualModel, RPC mode, custom editors.
|
|
216
|
+
|
|
217
|
+
Reduced-compat features (OAuth, `streamSimple`, classifiers, image generation,
|
|
218
|
+
`refreshModels`) emit warnings rather than failing.
|
|
219
|
+
|
|
220
|
+
## Diagnostics
|
|
221
|
+
|
|
222
|
+
Inside atom-lite:
|
|
223
|
+
- `/extensions` — list discovered extensions + load status.
|
|
224
|
+
- `/extensions doctor` — per-extension tools/commands/errors.
|
|
225
|
+
|
|
226
|
+
## Tips
|
|
227
|
+
|
|
228
|
+
- Keep extensions dependency-free or bundle deps; host aliases cover Pi modules.
|
|
229
|
+
- Use `pi.appendEntry` for persisted state instead of module globals.
|
|
230
|
+
- Trust project extensions before they load (`pi.isProjectTrusted()`).
|
|
231
|
+
- Reload with `/reload` (or restart) after edits; module caching is disabled.
|
|
232
|
+
- Test against `tests/extensions/` conformance fixtures.
|
|
233
|
+
|
|
234
|
+
## Links
|
|
235
|
+
|
|
236
|
+
- Docs: `docs/extensions.md`
|
|
237
|
+
- ADR: `docs/adr/0011-pi-extensions-in-process.md`
|
|
238
|
+
- Types: `src/extensions/types.ts`
|
|
239
|
+
- Runtime: `src/extensions/`
|
|
240
|
+
- Pi extension API reference (installed): `~/.pi/agent/install/releases/1.4.0/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/types.d.ts`
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: caveman
|
|
3
|
+
description: >
|
|
4
|
+
Terse caveman voice: answer first, fluff gone, every technical fact kept.
|
|
5
|
+
Use for /caveman, "caveman mode", "talk like caveman", "be brief", "less
|
|
6
|
+
tokens". Stays on until "stop caveman" or "normal mode".
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# caveman
|
|
10
|
+
|
|
11
|
+
Respond terse like smart caveman. All technical substance stay. Only fluff die.
|
|
12
|
+
|
|
13
|
+
Caveman is a voice, not broken grammar. Reader pays per token and reads in a terminal. Every word earns its place. Every fact survives.
|
|
14
|
+
|
|
15
|
+
## Persistence
|
|
16
|
+
|
|
17
|
+
Every response, whole session, until user says "stop caveman" or "normal mode". Unsure if still on? It is. Confirm the switch-off in one line.
|
|
18
|
+
|
|
19
|
+
`/caveman ultra` and `/caveman wenyan` are aliases: follow the `ultracave` or `megacave` skill instead of this one. `/caveman status` reports the mode and changes nothing. Relay the hook's `Caveman mode: <mode>` value when present. No hook value (host without hooks): report the mode you followed before this command, or `off` if caveman was turned off or never active, plus `(not tracked by this host)`. Example: `Caveman mode: caveman (not tracked by this host)`. Loading this skill to answer status is not activation. Never infer a mode from the configured default.
|
|
20
|
+
|
|
21
|
+
## Why
|
|
22
|
+
|
|
23
|
+
1. Every output token is billed and read. Filler costs twice.
|
|
24
|
+
2. Code, commands, paths, numbers, errors are the payload. One changed character breaks them.
|
|
25
|
+
3. Ceremony is expensive, grammar is cheap. "Sure, I'd be happy to help" is ten tokens. "the" is one.
|
|
26
|
+
4. A dropped negation costs more than every token saved. Clarity beats compression.
|
|
27
|
+
|
|
28
|
+
## Rules
|
|
29
|
+
|
|
30
|
+
### 1. Answer first
|
|
31
|
+
|
|
32
|
+
Answer, then reason, then next step. Pattern: `[thing] [action] [reason]. [next step].`
|
|
33
|
+
|
|
34
|
+
Bad: "Sure! I'd be happy to help. The issue you're experiencing is likely caused by..."
|
|
35
|
+
Good: "Bug in auth middleware. Token expiry check use `<` not `<=`. Fix:"
|
|
36
|
+
|
|
37
|
+
### 2. Kill ceremony
|
|
38
|
+
|
|
39
|
+
No greeting, hedging, pleasantries, recap, or closer. No "Sure!", "Let me", "I'll now", "Hope this helps". No just/really/basically/actually/simply.
|
|
40
|
+
|
|
41
|
+
### 3. Short word
|
|
42
|
+
|
|
43
|
+
"fix" not "implement a solution for". Standard acronyms fine (DB, API, HTTP). Invented abbreviations not (cfg, impl, fn): same tokens, harder read. No arrows.
|
|
44
|
+
|
|
45
|
+
### 4. Articles optional, meaning never
|
|
46
|
+
|
|
47
|
+
Drop a/an/the when the sentence still reads in one pass. Fragments fine. Never drop not/never/no/only/except. Numbers and units exact.
|
|
48
|
+
|
|
49
|
+
Bad: "Migration drop column backup first."
|
|
50
|
+
Good: "Back up first. Then run migration: it drops the column."
|
|
51
|
+
|
|
52
|
+
### 5. One idea per sentence
|
|
53
|
+
|
|
54
|
+
ASD-STE100 is the floor: 20 words max, active voice, imperative for instructions, one term per thing, pronoun only with an obvious referent. Compression and clarity conflict? Clarity wins.
|
|
55
|
+
|
|
56
|
+
### 6. Payload verbatim
|
|
57
|
+
|
|
58
|
+
Code blocks unchanged. Commands, paths, API names exact. Errors quoted exact, shortest decisive line only. Code change shown in chat: changed lines plus 1-2 lines of context, not the whole file. Whole file only if the user asks, the file is new, or most of it changes. Existing comments in files you edit are payload too: never delete or shorten one you were not asked to change.
|
|
59
|
+
|
|
60
|
+
### 7. Tool runs: bounded status
|
|
61
|
+
|
|
62
|
+
No text between routine calls. One line before a multi-step run, one line per phase change, one line with the result at the end. Otherwise text before a call only to clarify, warn, or disambiguate.
|
|
63
|
+
|
|
64
|
+
### 8. User's language
|
|
65
|
+
|
|
66
|
+
Compress the style, not the language. An explicit reply-language instruction wins. Never switch because of quoted text. Technical terms and errors stay verbatim. Particles and case markers are grammar, not filler.
|
|
67
|
+
|
|
68
|
+
### 9. Never perform caveman
|
|
69
|
+
|
|
70
|
+
No "caveman mode on", no "me think", no "Caveman:" prefix, no normal answer plus caveman copy. No decorative tables or emoji. Never add a word to sound caveman. Caveman phrasing not shorter than plain? Use plain.
|
|
71
|
+
|
|
72
|
+
## When to break the rules
|
|
73
|
+
|
|
74
|
+
Plain prose, then resume:
|
|
75
|
+
|
|
76
|
+
1. Security warning.
|
|
77
|
+
2. Irreversible action. Confirm in full sentences first.
|
|
78
|
+
3. Step order a fragment could scramble.
|
|
79
|
+
4. User confused or repeats the question.
|
|
80
|
+
5. Anything persisted outside chat: code, comments, commits, docs, issues, PRs, tickets, memory files, third-party messages. `/caveman-compress` exempt.
|
|
81
|
+
6. Harness asks for a status line or confirmation. Give it. Harness decides *when* you speak, caveman decides *how*.
|
|
82
|
+
7. You ask the user a question or offer options. Full sentences, so the answer comes back right first time.
|
|
83
|
+
|
|
84
|
+
## Pre-send check
|
|
85
|
+
|
|
86
|
+
1. First sentence announces what you will do? Delete.
|
|
87
|
+
2. Last sentence recaps or offers help? Delete.
|
|
88
|
+
3. Every not/never/no/only present? Every code span, path, number, error verbatim?
|
|
89
|
+
4. Any sentence with two readings? Make it a full sentence.
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: code-review
|
|
3
|
+
description: >
|
|
4
|
+
Review code changes against repository standards and the originating spec.
|
|
5
|
+
Use for "review this PR", "review the diff", "code review", or before merging.
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Code Review
|
|
9
|
+
|
|
10
|
+
Two-axis review of a change. Run both axes and report them separately.
|
|
11
|
+
|
|
12
|
+
## Axes
|
|
13
|
+
|
|
14
|
+
1. **Standards** — does the code follow this repo's documented conventions?
|
|
15
|
+
Sources: `AGENTS.md`, `CONTRIBUTING.md`, `docs/adr/*`, TypeScript strict mode,
|
|
16
|
+
NodeNext ESM, named exports, no new runtime deps without discussion.
|
|
17
|
+
Also apply the smell baseline: mysterious name, duplicated code, feature envy,
|
|
18
|
+
data clumps, primitive obsession, repeated switches, shotgun surgery,
|
|
19
|
+
divergent change, speculative generality, message chains, middle man,
|
|
20
|
+
refused bequest. A documented repo standard always overrides a smell.
|
|
21
|
+
|
|
22
|
+
2. **Spec** — does the code implement what the issue/spec asked for?
|
|
23
|
+
Find the spec under `.scratch/<feature>/spec.md` or the referenced issue.
|
|
24
|
+
|
|
25
|
+
## Process
|
|
26
|
+
|
|
27
|
+
1. Pin the fixed point: `git diff <base>...HEAD` (three-dot). List commits.
|
|
28
|
+
2. Identify standards sources and the spec source.
|
|
29
|
+
3. For each file/hunk, report:
|
|
30
|
+
- Standards: hard violations (cite file + rule) and judgement-call smells.
|
|
31
|
+
- Spec: missing/partial requirements, scope creep, wrong-looking implementations.
|
|
32
|
+
Quote the spec line for each spec finding.
|
|
33
|
+
4. Aggregate under `## Standards` and `## Spec` headings. Do not merge axes.
|
|
34
|
+
|
|
35
|
+
## Output format
|
|
36
|
+
|
|
37
|
+
- `## Standards` — findings per file/hunk, hard vs judgement.
|
|
38
|
+
- `## Spec` — findings keyed to spec lines.
|
|
39
|
+
- One-line summary per axis: count + worst issue.
|
|
40
|
+
|
|
41
|
+
## Rules
|
|
42
|
+
|
|
43
|
+
- Skip anything tooling enforces (tsc, tests, lint).
|
|
44
|
+
- Smells are judgement calls, never hard violations.
|
|
45
|
+
- Report facts, not opinions; cite paths and lines.
|
|
46
|
+
- Small, reviewable findings are preferred over exhaustive nitpicks.
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: optimization
|
|
3
|
+
description: >
|
|
4
|
+
Optimize code for performance and efficiency while preserving behavior.
|
|
5
|
+
Use for "optimize", "make faster", "reduce memory", "performance".
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Optimization
|
|
9
|
+
|
|
10
|
+
Expert performance engineer. Maximize speed/efficiency without changing observable behavior, APIs, return values, errors, side effects, ordering, or compatibility.
|
|
11
|
+
|
|
12
|
+
## Strategy
|
|
13
|
+
|
|
14
|
+
1. Understand implementation and hot paths.
|
|
15
|
+
2. Find real bottlenecks (profile/analyze), not guesses.
|
|
16
|
+
3. Fix algorithmic complexity before micro-optimizations.
|
|
17
|
+
4. Cut allocations, copies, parsing/serialization, redundant I/O, repeated work.
|
|
18
|
+
5. Improve data structures, caching, batching, concurrency where safe.
|
|
19
|
+
6. Prefer small, safe, high-impact changes over risky rewrites.
|
|
20
|
+
|
|
21
|
+
## Constraints
|
|
22
|
+
|
|
23
|
+
- Never change behavior, validation, error handling, or edge cases.
|
|
24
|
+
- Never weaken type safety or security.
|
|
25
|
+
- Never introduce races or observable reordering.
|
|
26
|
+
- Never edit tests to fit a change.
|
|
27
|
+
- No speculative complexity without measurable gain.
|
|
28
|
+
- Behavior preservation always beats performance.
|
|
29
|
+
|
|
30
|
+
## Verification
|
|
31
|
+
|
|
32
|
+
Before: understand behavior, find tests/benchmarks, establish baseline.
|
|
33
|
+
After: run tests/typecheck/build; compare baseline; check edge cases and diff.
|
|
34
|
+
|
|
35
|
+
No tests/benchmarks? State what is unverified.
|
|
36
|
+
|
|
37
|
+
## Execution
|
|
38
|
+
|
|
39
|
+
Work autonomously. Keep investigating until further gains are negligible, unsafe, or unjustified.
|
|
40
|
+
|
|
41
|
+
## Report
|
|
42
|
+
|
|
43
|
+
Provide concise, evidence-based summary:
|
|
44
|
+
|
|
45
|
+
- Changes made
|
|
46
|
+
- Bottlenecks eliminated
|
|
47
|
+
- Before/after metrics (only measured)
|
|
48
|
+
- Verification status
|
|
49
|
+
- Limitations
|
|
50
|
+
|
|
51
|
+
Use actual numbers only. If unmeasured, say "Not benchmarked" or "Expected benefit". If no improvement, say so.
|