@crouton-kit/crouter 0.1.4 → 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/dist/cli.js +4 -1
- 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 +1 -0
- package/dist/core/bootstrap.js +80 -1
- package/dist/core/config.js +5 -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 +3 -0
- package/dist/types.js +6 -0
- package/package.json +1 -1
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { planPrompt } from './plan.js';
|
|
2
|
+
/**
|
|
3
|
+
* First user message for a spec → plan handoff.
|
|
4
|
+
* Bundles the full planning workflow with the spec to plan.
|
|
5
|
+
*/
|
|
6
|
+
export function planHandoffPrompt(specPath, plansDir) {
|
|
7
|
+
return `${planPrompt(plansDir)}
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Your task
|
|
12
|
+
|
|
13
|
+
You were just launched in a new tmux pane via \`crtr agent plan\`. A spec
|
|
14
|
+
has been approved upstream and you are responsible for turning it into a plan.
|
|
15
|
+
|
|
16
|
+
**Spec to plan:** ${specPath}
|
|
17
|
+
|
|
18
|
+
Read the spec end-to-end before anything else. Then proceed through the
|
|
19
|
+
workflow above. When you save the plan, pass \`--spec <spec-name>\` so the
|
|
20
|
+
plan reviewer can check alignment.
|
|
21
|
+
|
|
22
|
+
The originating pane has closed; the user is watching you here. Begin now.`;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* First user message for a plan → implementation handoff.
|
|
26
|
+
*/
|
|
27
|
+
export function implementHandoffPrompt(planPath) {
|
|
28
|
+
return `You are an implementation agent. A plan has been approved upstream and your
|
|
29
|
+
job is to execute it: write code, run tests, verify the change works
|
|
30
|
+
end-to-end.
|
|
31
|
+
|
|
32
|
+
**Plan to implement:** ${planPath}
|
|
33
|
+
|
|
34
|
+
## Process
|
|
35
|
+
|
|
36
|
+
1. Read the plan end-to-end before touching code.
|
|
37
|
+
2. If the plan references a spec (\`--spec\` was passed when saving), read it
|
|
38
|
+
too — it has the contract you are realizing.
|
|
39
|
+
3. Read the files listed under "Files to modify / create" and "Existing
|
|
40
|
+
utilities to reuse" to ground yourself in the current code.
|
|
41
|
+
4. Execute the plan step by step. Stay within scope — if the plan does not
|
|
42
|
+
call for a change, do not make it.
|
|
43
|
+
5. After each meaningful change, run the verification described in the plan
|
|
44
|
+
(tests, manual checks). Fix anything that fails before continuing.
|
|
45
|
+
6. When the plan is complete and verification passes, summarize what
|
|
46
|
+
shipped in a single short message: files touched, tests run, what works.
|
|
47
|
+
|
|
48
|
+
## Guardrails
|
|
49
|
+
|
|
50
|
+
- **Do not redesign.** If the plan is wrong, surface the issue and ask;
|
|
51
|
+
do not silently substitute your own approach.
|
|
52
|
+
- **Do not expand scope.** No drive-by refactors, no "while I'm here" cleanup.
|
|
53
|
+
- **Honor existing conventions.** Match the file's style, naming, and
|
|
54
|
+
patterns. Use the utilities the plan named.
|
|
55
|
+
- Commit only if the user asks.
|
|
56
|
+
|
|
57
|
+
When verification passes, your turn ends. The user may then ask for a code
|
|
58
|
+
review via \`crtr agent review\`.
|
|
59
|
+
|
|
60
|
+
You were launched in a new tmux pane via \`crtr agent implement\`. The
|
|
61
|
+
originating pane has closed; the user is watching you here. Begin by reading
|
|
62
|
+
the plan.`;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* First user message for a handoff to code review of the working tree.
|
|
66
|
+
*/
|
|
67
|
+
export function reviewHandoffPrompt() {
|
|
68
|
+
return `You are a code reviewer. A change has just been implemented and your job is
|
|
69
|
+
to review it before it lands.
|
|
70
|
+
|
|
71
|
+
## Scope
|
|
72
|
+
|
|
73
|
+
Review the **uncommitted** changes in the working tree of the current
|
|
74
|
+
directory. Use \`git status\` and \`git diff\` (including staged changes via
|
|
75
|
+
\`git diff --cached\`) to enumerate what changed. If there are zero changes,
|
|
76
|
+
say so and stop.
|
|
77
|
+
|
|
78
|
+
## What to check
|
|
79
|
+
|
|
80
|
+
| Category | What to look for |
|
|
81
|
+
|----------|------------------|
|
|
82
|
+
| Correctness | Does the code do what it claims? Off-by-ones, wrong branches, missed cases. |
|
|
83
|
+
| Security | Injection, auth bypass, leaking secrets, unsafe defaults. |
|
|
84
|
+
| Style fit | Matches the file's existing conventions, naming, error-handling style. |
|
|
85
|
+
| Tests | Are there tests for new behavior? Do they actually exercise the change? |
|
|
86
|
+
| Scope | Did the change stay within its mandate, or sneak in unrelated edits? |
|
|
87
|
+
| Reuse | Are there existing utilities that should have been used? |
|
|
88
|
+
|
|
89
|
+
## Calibration
|
|
90
|
+
|
|
91
|
+
Only flag issues that would matter to the next reader, on-call, or future
|
|
92
|
+
maintainer. Nits are fine in a "Recommendations" section, but **do not block
|
|
93
|
+
on style preferences**. Approve unless something is wrong, missing, or risky.
|
|
94
|
+
|
|
95
|
+
## Output
|
|
96
|
+
|
|
97
|
+
\`\`\`
|
|
98
|
+
## Code Review
|
|
99
|
+
|
|
100
|
+
**Status:** Approved | Issues Found
|
|
101
|
+
|
|
102
|
+
**Issues (if any):**
|
|
103
|
+
- [file:line]: [specific issue] — [why it matters]
|
|
104
|
+
|
|
105
|
+
**Recommendations (advisory):**
|
|
106
|
+
- [suggestions]
|
|
107
|
+
\`\`\`
|
|
108
|
+
|
|
109
|
+
After printing the review, your turn ends.
|
|
110
|
+
|
|
111
|
+
You were launched in a new tmux pane via \`crtr agent review\`. The
|
|
112
|
+
originating pane has closed; the user is watching you here. Begin by checking
|
|
113
|
+
the working tree.`;
|
|
114
|
+
}
|
package/dist/prompts/plan.js
CHANGED
|
@@ -87,14 +87,50 @@ EOF
|
|
|
87
87
|
|
|
88
88
|
- Pick a short, descriptive kebab-case name. Names may be nested
|
|
89
89
|
(\`crtr plan --name auth/jwt-refresh\`) — they become subdirectories.
|
|
90
|
+
- If this plan implements a saved spec, pass \`--spec <spec-name>\` so the
|
|
91
|
+
reviewer can check alignment:
|
|
92
|
+
\`crtr plan --name <name> --spec <spec-name> <<'EOF' ... EOF\`
|
|
90
93
|
- The file lands at \`${plansDir}/<name>.md\`.
|
|
91
94
|
- If you are running inside tmux, the saved plan auto-opens in a side pane
|
|
92
95
|
via termrender. No extra step needed.
|
|
93
96
|
|
|
94
|
-
## Phase 5:
|
|
97
|
+
## Phase 5: Review
|
|
95
98
|
|
|
96
|
-
|
|
97
|
-
|
|
99
|
+
By default the save command **blocks** while a reviewer agent reads the plan
|
|
100
|
+
(and the spec, if \`--spec\` was passed) in a side pane (10-min budget) and
|
|
101
|
+
returns its findings on stdout under a \`--- review ---\` marker. **Read the
|
|
102
|
+
review** when the command returns:
|
|
103
|
+
|
|
104
|
+
- If \`Status: Approved\`, you are done.
|
|
105
|
+
- If \`Status: Issues Found\`, address the listed issues by editing the plan
|
|
106
|
+
(\`crtr plan edit <name>\` or rewriting via the save command), then save
|
|
107
|
+
again to re-trigger review.
|
|
108
|
+
|
|
109
|
+
Pass \`--no-review\` only when the plan is genuinely trivial (one-line fix,
|
|
110
|
+
typo, single-file rename). For anything substantive, take the review.
|
|
111
|
+
|
|
112
|
+
## Phase 6: Oversize check
|
|
113
|
+
|
|
114
|
+
If the save command emits a \`--- advisory ---\` warning that the plan is
|
|
115
|
+
too long, do not ignore it. Split the plan into a short index plan plus
|
|
116
|
+
one or more nested part plans, each under the threshold, and re-save. The
|
|
117
|
+
implementer will execute parts one at a time; very long plans tend to be
|
|
118
|
+
under-decomposed.
|
|
119
|
+
|
|
120
|
+
## Phase 7: Done
|
|
121
|
+
|
|
122
|
+
After the review returns Approved (or you have addressed its issues), your
|
|
123
|
+
turn ends. No need to summarize the plan in chat — the user can read the file.
|
|
124
|
+
|
|
125
|
+
If the user is ready to start building, ask once whether they want to hand
|
|
126
|
+
off now. If yes, run:
|
|
127
|
+
|
|
128
|
+
\`\`\`bash
|
|
129
|
+
crtr agent implement --plan <name>
|
|
130
|
+
\`\`\`
|
|
131
|
+
|
|
132
|
+
This fires up an implementer in a new tmux pane and closes the current
|
|
133
|
+
pane a few seconds later. Do NOT run this without the user's go-ahead.
|
|
98
134
|
|
|
99
135
|
## See also
|
|
100
136
|
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
const SUBMIT_INSTRUCTIONS = `## Delivering your review
|
|
2
|
+
|
|
3
|
+
When your review is complete, run a single Bash command to submit it back to
|
|
4
|
+
the parent agent:
|
|
5
|
+
|
|
6
|
+
\`\`\`bash
|
|
7
|
+
crtr agent submit "$(cat <<'EOF'
|
|
8
|
+
<your full review markdown here, using the Output Format below>
|
|
9
|
+
EOF
|
|
10
|
+
)"
|
|
11
|
+
\`\`\`
|
|
12
|
+
|
|
13
|
+
The pane will close automatically once your review is delivered. Do NOT
|
|
14
|
+
summarize or chat after submission — \`crtr agent submit\` IS the response.
|
|
15
|
+
|
|
16
|
+
If you cannot complete the review (file missing, totally malformed, etc.),
|
|
17
|
+
still call \`crtr agent submit\` with a brief explanation of why.`;
|
|
18
|
+
export function specReviewPrompt(specPath) {
|
|
19
|
+
return `You are reviewing a spec document. Verify it is complete and ready for planning.
|
|
20
|
+
|
|
21
|
+
**Spec to review:** ${specPath}
|
|
22
|
+
|
|
23
|
+
## What to Check
|
|
24
|
+
|
|
25
|
+
| Category | What to Look For |
|
|
26
|
+
|----------|------------------|
|
|
27
|
+
| Completeness | TODOs, placeholders, "TBD", incomplete sections |
|
|
28
|
+
| Consistency | Internal contradictions, conflicting requirements |
|
|
29
|
+
| Clarity | Requirements ambiguous enough to cause someone to build the wrong thing |
|
|
30
|
+
| Scope | Focused enough for a single plan — not covering multiple independent subsystems |
|
|
31
|
+
| YAGNI | Unrequested features, over-engineering |
|
|
32
|
+
|
|
33
|
+
## Calibration
|
|
34
|
+
|
|
35
|
+
**Only flag issues that would cause real problems during implementation planning.**
|
|
36
|
+
A missing section, a contradiction, or a requirement so ambiguous it could be
|
|
37
|
+
interpreted two different ways — those are issues. Minor wording improvements,
|
|
38
|
+
stylistic preferences, and "sections less detailed than others" are not.
|
|
39
|
+
|
|
40
|
+
Approve unless there are serious gaps that would lead to a flawed plan.
|
|
41
|
+
|
|
42
|
+
## Output Format
|
|
43
|
+
|
|
44
|
+
## Spec Review
|
|
45
|
+
|
|
46
|
+
**Status:** Approved | Issues Found
|
|
47
|
+
|
|
48
|
+
**Issues (if any):**
|
|
49
|
+
- [Section X]: [specific issue] - [why it matters for planning]
|
|
50
|
+
|
|
51
|
+
**Recommendations (advisory, do not block approval):**
|
|
52
|
+
- [suggestions for improvement]
|
|
53
|
+
|
|
54
|
+
${SUBMIT_INSTRUCTIONS}`;
|
|
55
|
+
}
|
|
56
|
+
export function planReviewPrompt(planPath, specPath) {
|
|
57
|
+
const inputs = specPath === null
|
|
58
|
+
? `**Plan to review:** ${planPath}
|
|
59
|
+
|
|
60
|
+
No spec was provided for cross-reference — evaluate the plan on its own
|
|
61
|
+
merits (internal completeness, task decomposition, buildability). Skip the
|
|
62
|
+
"Spec Alignment" check.`
|
|
63
|
+
: `**Plan to review:** ${planPath}
|
|
64
|
+
**Spec for reference:** ${specPath}
|
|
65
|
+
|
|
66
|
+
Read the plan first, then the spec, then evaluate alignment and the other
|
|
67
|
+
criteria below.`;
|
|
68
|
+
return `You are reviewing a plan document. Verify it is complete and ready for implementation.
|
|
69
|
+
|
|
70
|
+
${inputs}
|
|
71
|
+
|
|
72
|
+
## What to Check
|
|
73
|
+
|
|
74
|
+
| Category | What to Look For |
|
|
75
|
+
|----------|------------------|
|
|
76
|
+
| Completeness | TODOs, placeholders, incomplete tasks, missing steps |
|
|
77
|
+
| Spec Alignment | Plan covers spec requirements, no major scope creep |
|
|
78
|
+
| Task Decomposition | Tasks have clear boundaries, steps are actionable |
|
|
79
|
+
| Buildability | Could an engineer follow this plan without getting stuck? |
|
|
80
|
+
|
|
81
|
+
## Calibration
|
|
82
|
+
|
|
83
|
+
**Only flag issues that would cause real problems during implementation.**
|
|
84
|
+
An implementer building the wrong thing or getting stuck is an issue.
|
|
85
|
+
Minor wording, stylistic preferences, and "nice to have" suggestions are not.
|
|
86
|
+
|
|
87
|
+
Approve unless there are serious gaps — missing requirements from the spec,
|
|
88
|
+
contradictory steps, placeholder content, or tasks so vague they can't be acted on.
|
|
89
|
+
|
|
90
|
+
## Output Format
|
|
91
|
+
|
|
92
|
+
## Plan Review
|
|
93
|
+
|
|
94
|
+
**Status:** Approved | Issues Found
|
|
95
|
+
|
|
96
|
+
**Issues (if any):**
|
|
97
|
+
- [Task X, Step Y]: [specific issue] - [why it matters for implementation]
|
|
98
|
+
|
|
99
|
+
**Recommendations (advisory, do not block approval):**
|
|
100
|
+
- [suggestions for improvement]
|
|
101
|
+
|
|
102
|
+
${SUBMIT_INSTRUCTIONS}`;
|
|
103
|
+
}
|
package/dist/prompts/skill.d.ts
CHANGED
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, {
|
|
@@ -111,6 +112,8 @@ export declare const CONFIG_FILE = "config.json";
|
|
|
111
112
|
export declare const STATE_FILE = "state.json";
|
|
112
113
|
export declare const SKILL_ENTRY_FILE = "SKILL.md";
|
|
113
114
|
export declare const SKILLS_DIR = "skills";
|
|
115
|
+
export declare const SCOPE_SKILL_PLUGIN = "_";
|
|
116
|
+
export declare const DEFAULT_MAX_PANES_PER_WINDOW = 3;
|
|
114
117
|
export declare function defaultScopeConfig(): ScopeConfig;
|
|
115
118
|
export declare function skillConfigKey(plugin: string, name: string): string;
|
|
116
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) {
|