@crouton-kit/crouter 0.1.3 → 0.1.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/README.md +14 -1
- package/dist/cli.js +5 -0
- package/dist/commands/agent.d.ts +2 -0
- package/dist/commands/agent.js +265 -0
- package/dist/commands/config.js +13 -1
- package/dist/commands/plan.js +17 -1
- package/dist/commands/skill.js +62 -16
- package/dist/commands/spec.js +4 -0
- package/dist/core/artifact.d.ts +12 -0
- package/dist/core/artifact.js +68 -6
- package/dist/core/bootstrap.d.ts +5 -0
- package/dist/core/bootstrap.js +149 -0
- package/dist/core/config.js +6 -1
- package/dist/core/resolver.d.ts +1 -0
- package/dist/core/resolver.js +66 -6
- package/dist/core/scope.d.ts +1 -0
- package/dist/core/scope.js +4 -0
- package/dist/core/spawn.d.ts +95 -0
- package/dist/core/spawn.js +309 -0
- package/dist/prompts/agent.d.ts +13 -0
- package/dist/prompts/agent.js +114 -0
- package/dist/prompts/plan.js +39 -3
- package/dist/prompts/review.d.ts +2 -0
- package/dist/prompts/review.js +103 -0
- package/dist/prompts/skill.d.ts +1 -0
- package/dist/prompts/skill.js +240 -8
- package/dist/prompts/spec.js +28 -3
- package/dist/types.d.ts +4 -0
- package/dist/types.js +6 -0
- package/package.json +1 -1
package/dist/prompts/skill.js
CHANGED
|
@@ -1,15 +1,24 @@
|
|
|
1
1
|
export function skillPrompt() {
|
|
2
|
-
return `#
|
|
2
|
+
return `# Skills — capture and recall knowledge
|
|
3
3
|
|
|
4
|
-
\`crtr\`
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
\`crtr\` skills are markdown documents the agent loads on demand. Use them for
|
|
5
|
+
anything you want recalled later: architectural primers, runbooks, your
|
|
6
|
+
personal preferences, domain glossaries, decision records — methodology *or*
|
|
7
|
+
captured knowledge. The CLI is the index; \`crtr skill list/search/grep\`
|
|
8
|
+
discovers what's available so you never need a hand-maintained router file.
|
|
9
|
+
|
|
10
|
+
Skills live in three places, in resolution order:
|
|
11
|
+
1. **Scope-direct** — \`<scope-root>/skills/<name>/SKILL.md\` (no plugin wrapper, shown as \`user:<name>\` or \`project:<name>\`)
|
|
12
|
+
2. **Plugin skills** — \`<plugin>/skills/<name>/SKILL.md\` (shown as \`<scope>:<plugin>/<name>\`)
|
|
13
|
+
3. Project scope beats user scope; non-marketplace plugins beat marketplace ones.
|
|
14
|
+
|
|
15
|
+
Ambiguous names exit \`4\` — disambiguate with \`<plugin>:<name>\` or \`_:<name>\`
|
|
16
|
+
for scope-direct.
|
|
8
17
|
|
|
9
18
|
## Discover
|
|
10
19
|
|
|
11
20
|
\`\`\`
|
|
12
|
-
crtr skill list # one per line: <
|
|
21
|
+
crtr skill list # one per line: <qualifier> — <description>
|
|
13
22
|
crtr skill search <query> # rank by name, description, keywords
|
|
14
23
|
crtr skill grep <pattern> # regex search across SKILL.md bodies
|
|
15
24
|
\`\`\`
|
|
@@ -19,6 +28,7 @@ crtr skill grep <pattern> # regex search across SKILL.md bodies
|
|
|
19
28
|
\`\`\`
|
|
20
29
|
crtr skill show <name> # print SKILL.md body to stdout
|
|
21
30
|
crtr skill show <plugin>:<name> # disambiguate when names collide
|
|
31
|
+
crtr skill show _:<name> # explicit scope-direct
|
|
22
32
|
crtr skill path <name> # absolute path to SKILL.md
|
|
23
33
|
crtr skill where <name> # {scope, plugin, path} as JSON
|
|
24
34
|
\`\`\`
|
|
@@ -29,10 +39,16 @@ the body.
|
|
|
29
39
|
## Author
|
|
30
40
|
|
|
31
41
|
\`\`\`
|
|
32
|
-
crtr skill
|
|
33
|
-
crtr skill
|
|
42
|
+
crtr skill create [topic...] # walkthrough — pick a template, capture knowledge
|
|
43
|
+
crtr skill new <name> # bare scaffold, scope-direct (asks for --scope)
|
|
44
|
+
crtr skill new <plugin>:<name> # bare scaffold inside an existing plugin
|
|
45
|
+
crtr skill show authoring-skills # the SKILL.md authoring guide
|
|
34
46
|
\`\`\`
|
|
35
47
|
|
|
48
|
+
Reach for \`create\` when capturing something new — it walks you through choosing
|
|
49
|
+
a template (architectural primer, preference, runbook, glossary, decision,
|
|
50
|
+
freeform) and applies the right research workflow for that template.
|
|
51
|
+
|
|
36
52
|
## Toggle
|
|
37
53
|
|
|
38
54
|
\`\`\`
|
|
@@ -47,3 +63,219 @@ crtr skill disable <name> # hide from list and agent discovery
|
|
|
47
63
|
- \`4\` — ambiguous name; use \`<plugin>:<name>\`
|
|
48
64
|
`;
|
|
49
65
|
}
|
|
66
|
+
export function skillCreatePrompt(topic) {
|
|
67
|
+
const topicLine = topic
|
|
68
|
+
? `User-provided topic: **${topic}**`
|
|
69
|
+
: `No topic was provided — ask the user what they want to capture before continuing.`;
|
|
70
|
+
return `# Capture knowledge as a skill
|
|
71
|
+
|
|
72
|
+
You are about to author a new \`crtr\` skill — a SKILL.md the agent will recall
|
|
73
|
+
on demand. Skills can capture *any* kind of durable knowledge: architectural
|
|
74
|
+
primers, runbooks, personal preferences, domain glossaries, decision records,
|
|
75
|
+
freeform notes. Don't conflate this with "methodology only" — if the user wants
|
|
76
|
+
the agent to remember something later, a skill is the right shape.
|
|
77
|
+
|
|
78
|
+
${topicLine}
|
|
79
|
+
|
|
80
|
+
## Step 1 — Decide the template
|
|
81
|
+
|
|
82
|
+
Ask the user (use \`AskUserQuestion\` if available) which template fits, with
|
|
83
|
+
your best guess pre-selected. Don't write anything until this is settled.
|
|
84
|
+
|
|
85
|
+
| Template | When to use | Research workflow |
|
|
86
|
+
|----------|-------------|-------------------|
|
|
87
|
+
| \`primer\` | Architectural/codebase knowledge — "how does X work, why does it exist" | Parallel-explore (Step 3a) |
|
|
88
|
+
| \`preference\` | User preferences, style guides, "remember I like X" | None — just ask 2-3 sharpening questions |
|
|
89
|
+
| \`runbook\` | Operational procedure, incident response, "here's how to do X" | Light — confirm steps with the user |
|
|
90
|
+
| \`glossary\` | Domain terms and invariants | None — list terms, get definitions from user |
|
|
91
|
+
| \`decision\` | ADR-style record: context / decision / consequences | Confirm context and tradeoffs with user |
|
|
92
|
+
| \`freeform\` | Anything else | Ask what shape they want |
|
|
93
|
+
|
|
94
|
+
If the user is asking for a codebase primer, **also** consider whether the
|
|
95
|
+
subsystem is large enough to justify it. Small/self-evident systems do not
|
|
96
|
+
need a primer — push back and offer to write a one-paragraph note instead.
|
|
97
|
+
|
|
98
|
+
## Step 2 — Decide the scope and name
|
|
99
|
+
|
|
100
|
+
Ask the user:
|
|
101
|
+
- **Scope** — \`user\` (lives in \`~/.crouter/skills/\`, available everywhere) or
|
|
102
|
+
\`project\` (lives in \`<project>/.crouter/skills/\`, only here). Default
|
|
103
|
+
\`project\` if cwd is inside a project scope; otherwise \`user\`.
|
|
104
|
+
- **Name** — kebab-case slug. Suggest one from the topic.
|
|
105
|
+
|
|
106
|
+
Check for collisions: \`crtr skill where <name>\`. If it exists, ask whether to
|
|
107
|
+
update the existing one or pick a different name.
|
|
108
|
+
|
|
109
|
+
## Step 3 — Research (template-specific)
|
|
110
|
+
|
|
111
|
+
### 3a. \`primer\` — parallel codebase exploration
|
|
112
|
+
|
|
113
|
+
Dispatch 4–8 \`Explore\` subagents in parallel. Partition by **slice, not by
|
|
114
|
+
directory**:
|
|
115
|
+
|
|
116
|
+
- **Entry points** — HTTP routes, CLI commands, cron, event handlers, public exports
|
|
117
|
+
- **Data model** — schemas, types, DB tables, key invariants
|
|
118
|
+
- **Control flow** — how a typical request/job traverses the system end-to-end
|
|
119
|
+
- **External integrations** — third-party APIs, queues, services, env vars
|
|
120
|
+
- **Tests** — what's tested reveals what's load-bearing
|
|
121
|
+
- **History** — recent \`git log\` for this area surfaces ongoing work and pain
|
|
122
|
+
- **Cross-cutting** — auth, errors, logging, feature flags as they apply here
|
|
123
|
+
|
|
124
|
+
Each subagent must return **concrete \`file:line\` references**, *non-obvious*
|
|
125
|
+
facts (skip what's obvious from filenames), naming conventions, and gotchas.
|
|
126
|
+
Reject vague summaries.
|
|
127
|
+
|
|
128
|
+
### 3b. \`preference\` / \`glossary\` / \`decision\` — interview
|
|
129
|
+
|
|
130
|
+
Use \`AskUserQuestion\` to batch sharpening questions (≤4 at a time, multiple
|
|
131
|
+
choice with your best guess first). Frame each as "here's my read; is this
|
|
132
|
+
right?" Never write assumptions into the skill — if a fact isn't confirmed by
|
|
133
|
+
code or the user, it doesn't go in.
|
|
134
|
+
|
|
135
|
+
### 3c. \`runbook\` — walk it
|
|
136
|
+
|
|
137
|
+
If the procedure exists, run/grep it and confirm. Otherwise, have the user
|
|
138
|
+
narrate it once and read back the steps.
|
|
139
|
+
|
|
140
|
+
## Step 4 — Verify intent
|
|
141
|
+
|
|
142
|
+
Before writing, summarize your working hypothesis back to the user in 2-3
|
|
143
|
+
sentences: **what this skill is about and when it should be loaded.** This is
|
|
144
|
+
what code and grep can't tell you. Get a yes or correction.
|
|
145
|
+
|
|
146
|
+
## Step 5 — Scaffold and write
|
|
147
|
+
|
|
148
|
+
Run:
|
|
149
|
+
|
|
150
|
+
\`\`\`
|
|
151
|
+
crtr skill new <name> --scope <user|project> --description "<one-line trigger>"
|
|
152
|
+
\`\`\`
|
|
153
|
+
|
|
154
|
+
(For a plugin-scoped skill instead, use \`crtr skill new <plugin>:<name>\`.)
|
|
155
|
+
|
|
156
|
+
This creates \`SKILL.md\` with frontmatter only. Open it and fill the body
|
|
157
|
+
using the template skeleton below for the kind you chose. **Density rules:**
|
|
158
|
+
\`file:line\` over prose; tables where structure fits; skip anything
|
|
159
|
+
self-evident from a 30-second skim of the code; no "this section covers…"
|
|
160
|
+
meta-commentary.
|
|
161
|
+
|
|
162
|
+
The \`description:\` field drives auto-discovery — front-load the trigger
|
|
163
|
+
keywords the user (or agent) would naturally say. Aim for ≤250 chars.
|
|
164
|
+
|
|
165
|
+
### Skeletons
|
|
166
|
+
|
|
167
|
+
**\`primer\`**
|
|
168
|
+
|
|
169
|
+
\`\`\`markdown
|
|
170
|
+
# <topic>
|
|
171
|
+
|
|
172
|
+
## Purpose
|
|
173
|
+
Why this exists. The business problem it solves. Who depends on it.
|
|
174
|
+
(1–3 tight paragraphs — what code can't tell you.)
|
|
175
|
+
|
|
176
|
+
## Architecture
|
|
177
|
+
Components, responsibilities, data/control flow, boundaries.
|
|
178
|
+
|
|
179
|
+
## File map
|
|
180
|
+
| Path | Role |
|
|
181
|
+
|------|------|
|
|
182
|
+
| \`src/foo/bar.ts\` | … |
|
|
183
|
+
|
|
184
|
+
## Key concepts
|
|
185
|
+
Domain terms, invariants, non-obvious constraints.
|
|
186
|
+
|
|
187
|
+
## Entry points
|
|
188
|
+
Where work enters the system, with \`file:line\`.
|
|
189
|
+
|
|
190
|
+
## Gotchas
|
|
191
|
+
Non-obvious coupling. Things that look broken but aren't. Past footguns.
|
|
192
|
+
|
|
193
|
+
## Related
|
|
194
|
+
- \`<other-skill>\` — how they interact
|
|
195
|
+
\`\`\`
|
|
196
|
+
|
|
197
|
+
**\`preference\`**
|
|
198
|
+
|
|
199
|
+
\`\`\`markdown
|
|
200
|
+
# <topic preferences>
|
|
201
|
+
|
|
202
|
+
## Rule
|
|
203
|
+
What the user wants.
|
|
204
|
+
|
|
205
|
+
## Why
|
|
206
|
+
Reason given — past incident, strong preference, constraint.
|
|
207
|
+
|
|
208
|
+
## How to apply
|
|
209
|
+
When/where this guidance kicks in.
|
|
210
|
+
\`\`\`
|
|
211
|
+
|
|
212
|
+
**\`runbook\`**
|
|
213
|
+
|
|
214
|
+
\`\`\`markdown
|
|
215
|
+
# <procedure>
|
|
216
|
+
|
|
217
|
+
## When to run this
|
|
218
|
+
Triggering condition.
|
|
219
|
+
|
|
220
|
+
## Steps
|
|
221
|
+
1. …
|
|
222
|
+
2. …
|
|
223
|
+
|
|
224
|
+
## Verification
|
|
225
|
+
How to confirm success.
|
|
226
|
+
|
|
227
|
+
## Rollback
|
|
228
|
+
How to undo if something goes wrong.
|
|
229
|
+
\`\`\`
|
|
230
|
+
|
|
231
|
+
**\`glossary\`**
|
|
232
|
+
|
|
233
|
+
\`\`\`markdown
|
|
234
|
+
# <domain> glossary
|
|
235
|
+
|
|
236
|
+
| Term | Definition | Notes |
|
|
237
|
+
|------|------------|-------|
|
|
238
|
+
| … | … | … |
|
|
239
|
+
\`\`\`
|
|
240
|
+
|
|
241
|
+
**\`decision\`**
|
|
242
|
+
|
|
243
|
+
\`\`\`markdown
|
|
244
|
+
# <decision title> — <date>
|
|
245
|
+
|
|
246
|
+
## Context
|
|
247
|
+
What forced the decision.
|
|
248
|
+
|
|
249
|
+
## Decision
|
|
250
|
+
What we chose.
|
|
251
|
+
|
|
252
|
+
## Consequences
|
|
253
|
+
What this costs us. What it buys us.
|
|
254
|
+
|
|
255
|
+
## Alternatives considered
|
|
256
|
+
- …
|
|
257
|
+
\`\`\`
|
|
258
|
+
|
|
259
|
+
## Step 6 — Verify the skill is discoverable
|
|
260
|
+
|
|
261
|
+
\`\`\`
|
|
262
|
+
crtr skill where <name> # confirm path/scope
|
|
263
|
+
crtr skill list # confirm it shows up
|
|
264
|
+
crtr skill show <name> # confirm the body reads well
|
|
265
|
+
\`\`\`
|
|
266
|
+
|
|
267
|
+
If \`description:\` doesn't trigger the right discoveries, sharpen it. If the
|
|
268
|
+
body is bloated, cut it. Budget ~150 lines for SKILL.md; move deep reference
|
|
269
|
+
into sibling files in the same directory.
|
|
270
|
+
|
|
271
|
+
## Constraints
|
|
272
|
+
|
|
273
|
+
- Push back on trivial captures — if a one-line note in CLAUDE.md or a code
|
|
274
|
+
comment would do, suggest that instead.
|
|
275
|
+
- Never write unconfirmed assumptions into the skill.
|
|
276
|
+
- For updates to an existing skill, diff your draft against the current file
|
|
277
|
+
and call out what changed and why before writing.
|
|
278
|
+
- Update related skills' \`## Related\` sections if you're adding something
|
|
279
|
+
that interacts with them.
|
|
280
|
+
`;
|
|
281
|
+
}
|
package/dist/prompts/spec.js
CHANGED
|
@@ -98,10 +98,35 @@ EOF
|
|
|
98
98
|
- If you are running inside tmux, the saved spec auto-opens in a side pane
|
|
99
99
|
via termrender. No extra step needed.
|
|
100
100
|
|
|
101
|
-
## Phase 5:
|
|
101
|
+
## Phase 5: Review
|
|
102
102
|
|
|
103
|
-
|
|
104
|
-
in
|
|
103
|
+
By default the save command **blocks** while a reviewer agent reads the spec
|
|
104
|
+
in a side pane (10-min budget) and returns its findings on stdout under a
|
|
105
|
+
\`--- review ---\` marker. **Read the review** when the command returns:
|
|
106
|
+
|
|
107
|
+
- If \`Status: Approved\`, you are done.
|
|
108
|
+
- If \`Status: Issues Found\`, address the listed issues by editing the spec
|
|
109
|
+
(\`crtr spec edit <name>\` or rewriting via the save command), then save
|
|
110
|
+
again to re-trigger review.
|
|
111
|
+
|
|
112
|
+
Pass \`--no-review\` only when the spec is genuinely trivial (a paragraph, one
|
|
113
|
+
behavior, no design decisions). For anything substantive, take the review.
|
|
114
|
+
|
|
115
|
+
## Phase 6: Done
|
|
116
|
+
|
|
117
|
+
After the review returns Approved (or you have addressed its issues), your
|
|
118
|
+
turn ends. No need to summarize the spec in chat — the user can read the file.
|
|
119
|
+
|
|
120
|
+
If the user is ready to move into planning, ask once whether they want to
|
|
121
|
+
hand off now. If yes, run:
|
|
122
|
+
|
|
123
|
+
\`\`\`bash
|
|
124
|
+
crtr agent plan --spec <name>
|
|
125
|
+
\`\`\`
|
|
126
|
+
|
|
127
|
+
This fires up a planner in a new tmux pane and closes the current pane a
|
|
128
|
+
few seconds later. Do NOT run this without the user's go-ahead — the kill
|
|
129
|
+
is irreversible for this session.
|
|
105
130
|
|
|
106
131
|
## See also
|
|
107
132
|
|
package/dist/types.d.ts
CHANGED
|
@@ -59,6 +59,7 @@ export interface ScopeConfig {
|
|
|
59
59
|
plugins: Record<string, ConfigPluginEntry>;
|
|
60
60
|
skills: Record<string, ConfigSkillEntry>;
|
|
61
61
|
auto_update: AutoUpdateConfig;
|
|
62
|
+
max_panes_per_window: number;
|
|
62
63
|
}
|
|
63
64
|
export interface ScopeState {
|
|
64
65
|
marketplaces: Record<string, {
|
|
@@ -68,6 +69,7 @@ export interface ScopeState {
|
|
|
68
69
|
last_updated?: string;
|
|
69
70
|
}>;
|
|
70
71
|
last_self_check?: string;
|
|
72
|
+
bootstrap_done?: boolean;
|
|
71
73
|
}
|
|
72
74
|
export interface SkillFrontmatter {
|
|
73
75
|
name: string;
|
|
@@ -110,6 +112,8 @@ export declare const CONFIG_FILE = "config.json";
|
|
|
110
112
|
export declare const STATE_FILE = "state.json";
|
|
111
113
|
export declare const SKILL_ENTRY_FILE = "SKILL.md";
|
|
112
114
|
export declare const SKILLS_DIR = "skills";
|
|
115
|
+
export declare const SCOPE_SKILL_PLUGIN = "_";
|
|
116
|
+
export declare const DEFAULT_MAX_PANES_PER_WINDOW = 3;
|
|
113
117
|
export declare function defaultScopeConfig(): ScopeConfig;
|
|
114
118
|
export declare function skillConfigKey(plugin: string, name: string): string;
|
|
115
119
|
export declare function defaultScopeState(): ScopeState;
|
package/dist/types.js
CHANGED
|
@@ -16,6 +16,11 @@ export const CONFIG_FILE = 'config.json';
|
|
|
16
16
|
export const STATE_FILE = 'state.json';
|
|
17
17
|
export const SKILL_ENTRY_FILE = 'SKILL.md';
|
|
18
18
|
export const SKILLS_DIR = 'skills';
|
|
19
|
+
// Sentinel plugin name for skills that live at a scope root (no plugin wrapper).
|
|
20
|
+
// Stored as `<scope-root>/skills/<name>/SKILL.md`. Shown in listings without the
|
|
21
|
+
// `_/` prefix.
|
|
22
|
+
export const SCOPE_SKILL_PLUGIN = '_';
|
|
23
|
+
export const DEFAULT_MAX_PANES_PER_WINDOW = 3;
|
|
19
24
|
export function defaultScopeConfig() {
|
|
20
25
|
return {
|
|
21
26
|
schema_version: SCHEMA_VERSION,
|
|
@@ -23,6 +28,7 @@ export function defaultScopeConfig() {
|
|
|
23
28
|
plugins: {},
|
|
24
29
|
skills: {},
|
|
25
30
|
auto_update: { crtr: 'notify', content: 'notify', interval_hours: 24 },
|
|
31
|
+
max_panes_per_window: DEFAULT_MAX_PANES_PER_WINDOW,
|
|
26
32
|
};
|
|
27
33
|
}
|
|
28
34
|
export function skillConfigKey(plugin, name) {
|