@mhmdreza-rafiei/agentry 0.1.0 → 0.2.1
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 +161 -58
- package/dist/_chunks/theme.mjs +2 -0
- package/dist/_chunks/theme2.mjs +149 -0
- package/dist/cli.d.mts +1 -0
- package/dist/cli.mjs +2523 -0
- package/package.json +30 -11
- package/bin/agentry.js +0 -257
- package/examples/agents/frontend/frontend-developer/AGENT.md +0 -17
- package/examples/agents/frontend/frontend-developer/agentry.json +0 -5
- package/examples/rules/workflow/ask-dont-guess/RULE.md +0 -15
- package/examples/rules/workflow/ask-dont-guess/agentry.json +0 -5
- package/examples/scripts/env/doctor/agentry.json +0 -5
- package/examples/scripts/env/doctor/run.sh +0 -4
- package/examples/skills/prompt/enhance-prompt/SKILL.md +0 -186
- package/examples/skills/prompt/enhance-prompt/references/TEMPLATE.md +0 -182
- package/profile/backend.json +0 -5
- package/profile/frontend.json +0 -5
- package/src/commands.js +0 -64
- package/src/profile.js +0 -21
- package/src/registry.js +0 -145
- package/src/source.js +0 -52
package/package.json
CHANGED
|
@@ -1,34 +1,53 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mhmdreza-rafiei/agentry",
|
|
3
|
-
"version": "0.1
|
|
4
|
-
"description": "One CLI to install agents, skills, rules, and
|
|
3
|
+
"version": "0.2.1",
|
|
4
|
+
"description": "One CLI to install agents, skills, rules, and profiles onto AI coding agents — portable AI/agent tooling.",
|
|
5
|
+
"type": "module",
|
|
5
6
|
"bin": {
|
|
6
|
-
"agentry": "
|
|
7
|
+
"agentry": "./dist/cli.mjs"
|
|
7
8
|
},
|
|
8
9
|
"files": [
|
|
9
|
-
"
|
|
10
|
-
"src",
|
|
11
|
-
"profile",
|
|
12
|
-
"examples",
|
|
10
|
+
"dist",
|
|
13
11
|
"README.md",
|
|
14
12
|
"LICENSE"
|
|
15
13
|
],
|
|
16
14
|
"scripts": {
|
|
17
|
-
"
|
|
18
|
-
"
|
|
15
|
+
"dev": "tsx src/cli.ts",
|
|
16
|
+
"build": "obuild",
|
|
17
|
+
"test": "vitest run",
|
|
18
|
+
"test:watch": "vitest",
|
|
19
|
+
"typecheck": "tsc --noEmit"
|
|
19
20
|
},
|
|
20
21
|
"engines": {
|
|
21
|
-
"node": ">=
|
|
22
|
+
"node": ">=22.20.0"
|
|
22
23
|
},
|
|
23
24
|
"keywords": [
|
|
24
25
|
"ai",
|
|
25
26
|
"agents",
|
|
26
27
|
"skills",
|
|
27
28
|
"rules",
|
|
29
|
+
"profiles",
|
|
28
30
|
"cli",
|
|
29
31
|
"cursor",
|
|
32
|
+
"claude-code",
|
|
33
|
+
"codex",
|
|
30
34
|
"agentic",
|
|
31
35
|
"scaffold"
|
|
32
36
|
],
|
|
33
|
-
"license": "MIT"
|
|
37
|
+
"license": "MIT",
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"@clack/prompts": "^0.7.0",
|
|
40
|
+
"@vercel/detect-agent": "^1.2.1",
|
|
41
|
+
"picocolors": "^1.1.1",
|
|
42
|
+
"xdg-basedir": "^5.1.0",
|
|
43
|
+
"yaml": "^2.8.3",
|
|
44
|
+
"zod": "^3.23.0"
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@types/node": "^22.10.0",
|
|
48
|
+
"obuild": "^0.4.22",
|
|
49
|
+
"tsx": "^4.19.0",
|
|
50
|
+
"typescript": "^5.9.3",
|
|
51
|
+
"vitest": "^2.1.0"
|
|
52
|
+
}
|
|
34
53
|
}
|
package/bin/agentry.js
DELETED
|
@@ -1,257 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
const readline = require('node:readline');
|
|
5
|
-
const { execSync } = require('node:child_process');
|
|
6
|
-
const reg = require('../src/registry');
|
|
7
|
-
const src = require('../src/source');
|
|
8
|
-
const prof = require('../src/profile');
|
|
9
|
-
const cmd = require('../src/commands');
|
|
10
|
-
const pkg = require('../package.json');
|
|
11
|
-
|
|
12
|
-
function parseArgs(argv) {
|
|
13
|
-
const flags = {};
|
|
14
|
-
const positional = [];
|
|
15
|
-
for (let i = 0; i < argv.length; i++) {
|
|
16
|
-
const a = argv[i];
|
|
17
|
-
if (a === '-g' || a === '--global') flags.global = true;
|
|
18
|
-
else if (a === '--project') flags.project = true;
|
|
19
|
-
else if (a === '-y' || a === '--yes') flags.yes = true;
|
|
20
|
-
else if (a === '--dir') flags.dir = argv[++i];
|
|
21
|
-
else if (a === '-v' || a === '--version') flags.version = true;
|
|
22
|
-
else if (a === '-h' || a === '--help') flags.help = true;
|
|
23
|
-
else if (a === '--uninstall') flags.uninstall = true;
|
|
24
|
-
else positional.push(a);
|
|
25
|
-
}
|
|
26
|
-
return { flags, positional };
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const HELP = `agentry — a raw installer for agents, skills, rules, and scripts from any repo.
|
|
30
|
-
|
|
31
|
-
Usage:
|
|
32
|
-
agentry add <type> <source> [category/name | category] [options]
|
|
33
|
-
agentry add profile <name> [source] [options]
|
|
34
|
-
agentry remove <type> [category/name | category] [options]
|
|
35
|
-
agentry list <source> [type]
|
|
36
|
-
agentry update
|
|
37
|
-
|
|
38
|
-
Sources:
|
|
39
|
-
author/repo GitHub shorthand e.g. Prat011/awesome-llm-skills
|
|
40
|
-
https://…/repo.git full git URL
|
|
41
|
-
./path a local directory
|
|
42
|
-
|
|
43
|
-
Selectors (after the source):
|
|
44
|
-
category/name one asset e.g. video/downloader
|
|
45
|
-
name one asset (when the repo has no categories)
|
|
46
|
-
category a whole category
|
|
47
|
-
(omitted) list assets and pick interactively
|
|
48
|
-
|
|
49
|
-
Examples:
|
|
50
|
-
agentry add skills Prat011/awesome-llm-skills # pick from all skills
|
|
51
|
-
agentry add skills Prat011/awesome-llm-skills video/downloader # one skill (categorized)
|
|
52
|
-
agentry add skills Prat011/awesome-llm-skills video-downloader # one skill (no category)
|
|
53
|
-
agentry add agents author/repo frontend # a whole category
|
|
54
|
-
agentry add profile frontend author/repo # apply profile/frontend.json
|
|
55
|
-
agentry remove skills video/downloader # remove installed asset
|
|
56
|
-
agentry list author/repo
|
|
57
|
-
|
|
58
|
-
Options:
|
|
59
|
-
-g, --global Install into ~/.cursor (all projects)
|
|
60
|
-
--project Install into the current folder (default)
|
|
61
|
-
--dir <p> Install into a specific folder
|
|
62
|
-
-y, --yes Don't prompt; install everything matched
|
|
63
|
-
-v, --version Print version
|
|
64
|
-
-h, --help Show this help
|
|
65
|
-
--uninstall Uninstall the agentry CLI`;
|
|
66
|
-
|
|
67
|
-
function ask(question) {
|
|
68
|
-
return new Promise((resolve) => {
|
|
69
|
-
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
70
|
-
rl.question(question, (answer) => {
|
|
71
|
-
rl.close();
|
|
72
|
-
resolve(answer.trim());
|
|
73
|
-
});
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
function interactive(flags) {
|
|
78
|
-
return process.stdin.isTTY && !flags.yes;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
async function resolveTarget(flags) {
|
|
82
|
-
if (flags.global) return { global: true };
|
|
83
|
-
if (flags.project || flags.dir) return { global: false, dir: flags.dir };
|
|
84
|
-
if (interactive(flags)) {
|
|
85
|
-
const ans = await ask('Install location — [P]roject (this folder) or [g]lobal (home)? ');
|
|
86
|
-
if (/^g/i.test(ans)) return { global: true };
|
|
87
|
-
}
|
|
88
|
-
return { global: false };
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
async function pick(assets) {
|
|
92
|
-
console.log('Available:');
|
|
93
|
-
assets.forEach((a, i) => {
|
|
94
|
-
const desc = (a.description || '').replace(/\s+/g, ' ').slice(0, 60);
|
|
95
|
-
console.log(` [${i + 1}] ${a.type}/${a.id}${desc ? ' — ' + desc : ''}`);
|
|
96
|
-
});
|
|
97
|
-
const ans = await ask('Install which? (numbers comma-separated, or "all"): ');
|
|
98
|
-
if (!ans || /^all$/i.test(ans)) return assets;
|
|
99
|
-
const idx = ans
|
|
100
|
-
.split(/[, ]+/)
|
|
101
|
-
.map((s) => parseInt(s, 10) - 1)
|
|
102
|
-
.filter((n) => n >= 0 && n < assets.length);
|
|
103
|
-
return idx.map((i) => assets[i]);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
function locationLabel(opts) {
|
|
107
|
-
return opts.global ? 'globally (~/.cursor)' : `project (${cmd.targetRoot(opts)})`;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
function dedupe(assets) {
|
|
111
|
-
const seen = new Set();
|
|
112
|
-
return assets.filter((a) => {
|
|
113
|
-
const key = `${a.type}/${a.id}`;
|
|
114
|
-
if (seen.has(key)) return false;
|
|
115
|
-
seen.add(key);
|
|
116
|
-
return true;
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
function installAll(assets, opts) {
|
|
121
|
-
if (!assets.length) {
|
|
122
|
-
console.log('Nothing matched — nothing installed.');
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
console.log(`Installing ${assets.length} item(s) ${locationLabel(opts)}:`);
|
|
126
|
-
for (const a of assets) {
|
|
127
|
-
const dest = cmd.installOne(a, opts);
|
|
128
|
-
console.log(` + ${a.type}/${a.id} -> ${dest}`);
|
|
129
|
-
}
|
|
130
|
-
console.log('\nDone. Review assets before use; they run with full agent permissions.');
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
async function addType(type, source, selector, flags) {
|
|
134
|
-
if (!source) throw new Error(`Missing source. e.g. agentry add ${type} author/repo`);
|
|
135
|
-
const opts = await resolveTarget(flags);
|
|
136
|
-
const { root, cleanup } = src.resolveSource(source);
|
|
137
|
-
try {
|
|
138
|
-
let assets = type === 'all' ? reg.allAssets(root) : reg.select(root, type, selector);
|
|
139
|
-
if (!assets.length) throw new Error(`Nothing found for "${type}${selector ? ' ' + selector : ''}" in ${source}.`);
|
|
140
|
-
if (!selector && type !== 'all' && assets.length > 1 && interactive(flags)) assets = await pick(assets);
|
|
141
|
-
installAll(assets, opts);
|
|
142
|
-
} finally {
|
|
143
|
-
cleanup();
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
async function addProfile(name, source, flags) {
|
|
148
|
-
const { file, cfg } = prof.loadProfile(name);
|
|
149
|
-
const repo = source || cfg.repo;
|
|
150
|
-
if (!repo) throw new Error(`No source given and ${file} has no "repo". Try: agentry add profile ${name} author/repo`);
|
|
151
|
-
const opts = await resolveTarget(flags);
|
|
152
|
-
const { root, cleanup } = src.resolveSource(repo);
|
|
153
|
-
try {
|
|
154
|
-
const assets = [];
|
|
155
|
-
for (const type of reg.TYPES) {
|
|
156
|
-
for (const selector of cfg[type] || []) assets.push(...reg.select(root, type, selector));
|
|
157
|
-
}
|
|
158
|
-
installAll(dedupe(assets), opts);
|
|
159
|
-
} finally {
|
|
160
|
-
cleanup();
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
function listSource(source, type) {
|
|
165
|
-
if (!source) throw new Error('Missing source. e.g. agentry list author/repo');
|
|
166
|
-
const { root, cleanup } = src.resolveSource(source);
|
|
167
|
-
try {
|
|
168
|
-
for (const t of type ? [type] : reg.TYPES) {
|
|
169
|
-
console.log(`\n${t}:`);
|
|
170
|
-
const items = reg.listType(root, t);
|
|
171
|
-
if (!items.length) {
|
|
172
|
-
console.log(' (none)');
|
|
173
|
-
continue;
|
|
174
|
-
}
|
|
175
|
-
for (const it of items) {
|
|
176
|
-
const desc = (it.description || '').replace(/\s+/g, ' ').slice(0, 80);
|
|
177
|
-
console.log(` ${it.id}${desc ? ' — ' + desc : ''}`);
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
} finally {
|
|
181
|
-
cleanup();
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
async function remove(type, selector, flags) {
|
|
186
|
-
const opts = await resolveTarget(flags);
|
|
187
|
-
const scope = [type, selector].filter(Boolean).join('/');
|
|
188
|
-
if (type === 'all') {
|
|
189
|
-
let count = 0;
|
|
190
|
-
for (const t of reg.TYPES) count += cmd.removeSelection(t, undefined, opts).removedKeys.length;
|
|
191
|
-
console.log(`Removed ${count} item(s) from ${locationLabel(opts)}.`);
|
|
192
|
-
return;
|
|
193
|
-
}
|
|
194
|
-
const r = cmd.removeSelection(type, selector, opts);
|
|
195
|
-
if (!r.existed && r.removedKeys.length === 0) {
|
|
196
|
-
console.log(`Nothing installed at "${scope}" in ${locationLabel(opts)}.`);
|
|
197
|
-
return;
|
|
198
|
-
}
|
|
199
|
-
for (const k of r.removedKeys) console.log(`removed ${k}`);
|
|
200
|
-
console.log(`\nRemoved ${r.removedKeys.length || 1} item(s) from ${locationLabel(opts)}.`);
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
function runUpdate() {
|
|
204
|
-
console.log('Updating agentry CLI...');
|
|
205
|
-
try {
|
|
206
|
-
execSync('npm install -g agentry@latest', { stdio: 'inherit' });
|
|
207
|
-
} catch {
|
|
208
|
-
console.error('Update failed. Once published, run: npm install -g agentry@latest');
|
|
209
|
-
process.exit(1);
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
function runUninstall() {
|
|
214
|
-
console.log('Uninstalling agentry CLI...');
|
|
215
|
-
try {
|
|
216
|
-
execSync('npm uninstall -g agentry', { stdio: 'inherit' });
|
|
217
|
-
} catch {
|
|
218
|
-
console.error('Uninstall failed. Try: npm uninstall -g agentry');
|
|
219
|
-
process.exit(1);
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
async function main() {
|
|
224
|
-
const { flags, positional } = parseArgs(process.argv.slice(2));
|
|
225
|
-
|
|
226
|
-
if (flags.version) return console.log(pkg.version);
|
|
227
|
-
if (flags.uninstall) return runUninstall();
|
|
228
|
-
if (flags.help || positional.length === 0) return console.log(HELP);
|
|
229
|
-
|
|
230
|
-
const [action] = positional;
|
|
231
|
-
|
|
232
|
-
if (action === 'update') return runUpdate();
|
|
233
|
-
if (action === 'list') return listSource(positional[1], positional[2]);
|
|
234
|
-
|
|
235
|
-
if (action === 'add') {
|
|
236
|
-
const type = positional[1];
|
|
237
|
-
if (!type) throw new Error('Missing type. e.g. agentry add skills author/repo');
|
|
238
|
-
if (type === 'profile') return addProfile(positional[2], positional[3], flags);
|
|
239
|
-
if (type !== 'all' && !reg.TYPES.includes(type)) throw new Error(`Unknown type: ${type}`);
|
|
240
|
-
return addType(type, positional[2], positional[3], flags);
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
if (action === 'remove') {
|
|
244
|
-
const type = positional[1];
|
|
245
|
-
if (!type) throw new Error('Missing type. e.g. agentry remove skills video/downloader');
|
|
246
|
-
if (type !== 'all' && !reg.TYPES.includes(type)) throw new Error(`Unknown type: ${type}`);
|
|
247
|
-
return remove(type, positional[2], flags);
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
console.error(`Unknown action: ${action}\n\n${HELP}`);
|
|
251
|
-
process.exit(1);
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
main().catch((err) => {
|
|
255
|
-
console.error(err.message || err);
|
|
256
|
-
process.exit(1);
|
|
257
|
-
});
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: frontend-developer
|
|
3
|
-
description: >
|
|
4
|
-
Starter frontend developer agent — UI implementation, component structure,
|
|
5
|
-
accessibility, responsive layout, and visual polish. Edit for your project.
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
# frontend-developer
|
|
9
|
-
|
|
10
|
-
Example agent shipped with `agentry`. Use it as a starting point and adapt it to your stack.
|
|
11
|
-
|
|
12
|
-
## Focus
|
|
13
|
-
|
|
14
|
-
- Implement and refine UI components and layouts.
|
|
15
|
-
- Prioritize accessibility, responsive design, and visual polish.
|
|
16
|
-
- Reuse existing design patterns and tokens before introducing new ones.
|
|
17
|
-
- Keep changes small and verifiable; prefer the simplest approach that works.
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: ask-dont-guess
|
|
3
|
-
description: >
|
|
4
|
-
Ask before guessing requirements or product truth. Act without asking only
|
|
5
|
-
when verified context already answers it. Prefer short, concrete questions.
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
# ask-dont-guess
|
|
9
|
-
|
|
10
|
-
Before writing code, changing architecture, or stating product facts, ask when anything is unclear, ambiguous, missing, or a "probably fine" default that would lock the project in.
|
|
11
|
-
|
|
12
|
-
- Use short, concrete questions; multiple-choice is fine.
|
|
13
|
-
- Do not invent missing specs.
|
|
14
|
-
- When verified project context already answers it, proceed — do not re-ask settled facts.
|
|
15
|
-
- When docs and code conflict, trust verified code and runtime evidence.
|
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: enhance-prompt
|
|
3
|
-
description: >
|
|
4
|
-
Use when the user asks to enhance, improve, rewrite, optimize, or clarify a prompt —
|
|
5
|
-
or when always-on prompt enhancement is enabled for the session.
|
|
6
|
-
Rewrites casual or vague chat into precise, portable agent instructions
|
|
7
|
-
without injecting workspace paths, stack, or session-local context.
|
|
8
|
-
Preserves user-stated contracts; ranks related skills; asks clarifying /
|
|
9
|
-
mode / better-decision questions when needed; ends with an after-finish summary instruction.
|
|
10
|
-
---
|
|
11
|
-
|
|
12
|
-
# enhance-prompt
|
|
13
|
-
|
|
14
|
-
Rewrite the user’s message into a precise, portable agent prompt. **Enhance = clarify and structure — never strip user-stated details that affect accuracy.** Accuracy first; tokens second (same or better meaning, fewer tokens).
|
|
15
|
-
|
|
16
|
-
Do **not** invent requirements or paste workspace-local paths/stack. For shape and examples, open [references/TEMPLATE.md](references/TEMPLATE.md).
|
|
17
|
-
|
|
18
|
-
## Procedure
|
|
19
|
-
|
|
20
|
-
Apply passes in order. Deliver one copy-ready enhanced prompt (or questions-first when blocked — see pass 0).
|
|
21
|
-
|
|
22
|
-
### 0) Clarify, suggest, choose mode (ask before guessing)
|
|
23
|
-
|
|
24
|
-
Before (or instead of) emitting a full enhanced prompt, ask when it improves accuracy.
|
|
25
|
-
|
|
26
|
-
**Ask when:**
|
|
27
|
-
|
|
28
|
-
- Critical details are missing (fields, success criteria, scope, must-nots)
|
|
29
|
-
- A better / more optimal decision exists than what the user stated — propose it; don’t silently override
|
|
30
|
-
- Approach is ambiguous (how to do X vs Y given what they wrote)
|
|
31
|
-
- Depth / packing mode is unclear for a large task
|
|
32
|
-
|
|
33
|
-
**How to ask:**
|
|
34
|
-
|
|
35
|
-
- Prefer short multiple-choice or yes/no + one-line rationale
|
|
36
|
-
- Suggest **better options** (optimal defaults) labeled as suggestions — user can reject
|
|
37
|
-
- Ask **mode** when useful: `compact` | `standard` | `full` (see Depth dial)
|
|
38
|
-
- Ask approach forks only when they change the result (e.g. auth vs unauth OTP purpose)
|
|
39
|
-
- Cap: **MAX 3 questions** per turn (batch them). Don’t interrogate for niceties.
|
|
40
|
-
- If the user said “just enhance” / “don’t ask” / always-on with enough signal → enhance without questions
|
|
41
|
-
- Casual but clear enough → enhance; put residual ambiguity under **Open questions** for the implementer
|
|
42
|
-
|
|
43
|
-
**Question-first output** (when blocked on critical gaps):
|
|
44
|
-
|
|
45
|
-
1. Brief “what I understood”
|
|
46
|
-
2. Up to 3 questions (include mode / better-decision suggestions when relevant)
|
|
47
|
-
3. Optional mini draft only if helpful — still no path/stack injection
|
|
48
|
-
|
|
49
|
-
After answers (or if not blocked), continue passes 1–8.
|
|
50
|
-
|
|
51
|
-
### Depth dial
|
|
52
|
-
|
|
53
|
-
| Mode | When | Behavior |
|
|
54
|
-
|------|------|----------|
|
|
55
|
-
| `compact` | User asks, or rich contract already dense | Densest packing; full contracts kept; minimal Steps |
|
|
56
|
-
| `standard` | Default | Normal sections; Steps only if needed |
|
|
57
|
-
| `full` | Large / multi-system task, or user asks | More Steps + verify detail; still no path/stack dumps |
|
|
58
|
-
|
|
59
|
-
Same accuracy floor in all modes — only verbosity changes. If unset, use `standard` (or ask once when the task is large and mode would matter).
|
|
60
|
-
|
|
61
|
-
### 1) Full-text enhance
|
|
62
|
-
|
|
63
|
-
- Fix grammar, wording, clarity; prefer precise verbs.
|
|
64
|
-
- Remove filler, noise symbols, decorative separators, emojis.
|
|
65
|
-
- Preserve user intent and constraints; never invent requirements, brand systems, stack, or scope the user did not ask for.
|
|
66
|
-
- **Do not rename** user field names (`phone` stays `phone`, not `phone-number`).
|
|
67
|
-
|
|
68
|
-
### 2) Context policy (non-negotiable)
|
|
69
|
-
|
|
70
|
-
**Prompt context must be portable and session-safe.**
|
|
71
|
-
|
|
72
|
-
#### Always preserve (if present in the user input)
|
|
73
|
-
|
|
74
|
-
Contracts — compressing them away makes results worse:
|
|
75
|
-
|
|
76
|
-
- Endpoint lists, request/response bodies, field lists (e.g. `{ phone, password, code }`)
|
|
77
|
-
- Remove / keep / replace lists
|
|
78
|
-
- Security rules, do / don’t, acceptance criteria
|
|
79
|
-
- Explicit open questions or ambiguities the user left unresolved
|
|
80
|
-
- Any detail that changes implementation behavior
|
|
81
|
-
|
|
82
|
-
**Enhance** = reorganize and tighten. **Not** = delete or “summarize away” those facts.
|
|
83
|
-
|
|
84
|
-
**Rich input** → compress wording only; **copy contracts forward** (don’t rebuild from memory).
|
|
85
|
-
**Casual input** → add structure without inventing environment.
|
|
86
|
-
|
|
87
|
-
#### Never inject
|
|
88
|
-
|
|
89
|
-
- Absolute or relative project/workspace folder paths
|
|
90
|
-
- Repo roots, home paths, machine-specific paths
|
|
91
|
-
- Tech stack / framework / language lists the target workspace already provides via `AGENTS.md`, `context/`, rules, or open files
|
|
92
|
-
- Long dumps of docs already loadable in the *target* workspace
|
|
93
|
-
- Paths or facts from the *current* workspace when the prompt will be used elsewhere
|
|
94
|
-
- Invented field names, status codes, or API shapes the user did not state
|
|
95
|
-
- Silent “optimal” overrides the user didn’t accept (suggest via pass 0 instead)
|
|
96
|
-
|
|
97
|
-
Rules of thumb:
|
|
98
|
-
|
|
99
|
-
- Agent can read it from the target workspace → don’t paste paths/stack/docs.
|
|
100
|
-
- User stated a contract → keep it densely (tables / one-liners OK).
|
|
101
|
-
- Unsure if session-local → omit or `[use target workspace context]`.
|
|
102
|
-
|
|
103
|
-
### 3) Structure / layout enhance
|
|
104
|
-
|
|
105
|
-
Use only sections with content; drop empty ones. One structure. **One home per fact** (Contract = shapes; Constraints = must-not; Steps = order only).
|
|
106
|
-
|
|
107
|
-
- **Title** — when helpful
|
|
108
|
-
- **Goal** — success looks like
|
|
109
|
-
- **Contract** (optional) — APIs / bodies / remove-keep; prefer compact packing
|
|
110
|
-
- **Constraints** — must / must-not
|
|
111
|
-
- **Steps** — only if order matters (omit in `compact` unless essential)
|
|
112
|
-
- **Related skills** — pass 5
|
|
113
|
-
- **Output** — deliverable format
|
|
114
|
-
- **Open questions** — unresolved; “resolve from workspace — don’t guess”
|
|
115
|
-
- **After you finish** — pass 6
|
|
116
|
-
|
|
117
|
-
After drafting: **Goal ↔ Contract ↔ Constraints ↔ Steps must agree**.
|
|
118
|
-
|
|
119
|
-
### 4) Token optimization + dedup
|
|
120
|
-
|
|
121
|
-
- Same or better meaning, fewer tokens — **without dropping preserved contracts**.
|
|
122
|
-
- Strip banners, redundant headers, fluff verbs.
|
|
123
|
-
- Prefer short imperatives; pack field lists and endpoints as compact lines/tables.
|
|
124
|
-
- **Dedup:** remove the same constraint repeated across Goal / Constraints / Steps; delete Steps that only restate Contract.
|
|
125
|
-
|
|
126
|
-
### 5) Related skills (precision)
|
|
127
|
-
|
|
128
|
-
Discover skills relevant to the prompt; attach **inside** the prompt.
|
|
129
|
-
|
|
130
|
-
1. Search installed / project / agent skills (`npx skills list`, `AGENTS.md`, agent skills dirs). Prefer **target** environment.
|
|
131
|
-
2. Rank by relevance to the goal; keep the **strongest** matches only (prefer ≤5).
|
|
132
|
-
3. Each entry: name + one “use for …” tied to the goal. Optional: mark top 1–2 as “load first”.
|
|
133
|
-
4. Skip weak / unrelated. Do not invent skill names.
|
|
134
|
-
5. If none: omit section or `None found — proceed with workspace defaults.`
|
|
135
|
-
|
|
136
|
-
### 6) After you finish (handoff summary instruction)
|
|
137
|
-
|
|
138
|
-
End with **After you finish**: tell the *implementing* agent, once work is done, write a result summary that:
|
|
139
|
-
|
|
140
|
-
- Anyone can understand (plain language)
|
|
141
|
-
- Still detailed — what changed, added/removed, how to verify, what’s still open
|
|
142
|
-
- Is **not** a prompt restatement or enhancer changelog
|
|
143
|
-
|
|
144
|
-
Always include unless the user asked to omit post-work summaries.
|
|
145
|
-
|
|
146
|
-
### 7) Ambiguity policy
|
|
147
|
-
|
|
148
|
-
- Unclear but non-blocking → **Open questions** for the implementer; do not invent a default.
|
|
149
|
-
- Blocking → return to pass 0 (ask). Never silently pick auth rules, field names, or modes the user didn’t state or accept.
|
|
150
|
-
|
|
151
|
-
### 8) Fidelity checklist + silent self-eval (before emit)
|
|
152
|
-
|
|
153
|
-
**Must pass before delivering the enhanced prompt:**
|
|
154
|
-
|
|
155
|
-
- [ ] Every user field / body / endpoint preserved?
|
|
156
|
-
- [ ] Every remove / keep preserved?
|
|
157
|
-
- [ ] Goal ↔ Contract ↔ Steps agree?
|
|
158
|
-
- [ ] No renamed fields; no invented stack / paths?
|
|
159
|
-
- [ ] No silent override of user intent (suggestions only via asks)?
|
|
160
|
-
- [ ] Deduped; depth mode respected?
|
|
161
|
-
|
|
162
|
-
If any fail → fix once, then emit.
|
|
163
|
-
|
|
164
|
-
Silently score 1–5: fidelity, portability, density. If fidelity < 5 → revise once. Don’t print scores unless asked.
|
|
165
|
-
|
|
166
|
-
Optional chat-only enhancer changelog after the copy-ready block — omit if overloaded or user disabled it.
|
|
167
|
-
|
|
168
|
-
## Always-on mode
|
|
169
|
-
|
|
170
|
-
If the user asks to enhance every chat / every prompt:
|
|
171
|
-
|
|
172
|
-
1. Create or update `AGENTS.md` in the **target** project.
|
|
173
|
-
2. Add a **Skills** section: when-to-use vs always-use.
|
|
174
|
-
3. Register `enhance-prompt` as always-on, e.g.:
|
|
175
|
-
|
|
176
|
-
```yaml
|
|
177
|
-
alwaysApply: true
|
|
178
|
-
```
|
|
179
|
-
|
|
180
|
-
Always-on: rewrite the user message into a better agent prompt **before** acting — still obey context policy and fidelity rules. Prefer enhancing over asking unless blocked on critical gaps (then ≤3 tight questions).
|
|
181
|
-
|
|
182
|
-
## Output
|
|
183
|
-
|
|
184
|
-
1. Either questions-first (pass 0) **or** one copy-ready enhanced prompt (Related skills when found + **After you finish**).
|
|
185
|
-
2. Optional brief chat-only enhancer changelog outside that block.
|
|
186
|
-
3. Do not announce skill usage unless the user asks.
|