@lore-ai/cli 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 +178 -0
- package/dist/bin/lore.js +14666 -0
- package/dist/bin/lore.js.map +1 -0
- package/dist/ui/assets/Analytics-W2ANIC2s.js +1 -0
- package/dist/ui/assets/ConversationDetail-Ct-hROwS.js +5 -0
- package/dist/ui/assets/Conversations-iK7E6GEl.js +1 -0
- package/dist/ui/assets/MarkdownPreview-2zDiish4.js +17 -0
- package/dist/ui/assets/MarkdownPreview-ZgkIHsf0.css +1 -0
- package/dist/ui/assets/Mcps-CCT1FQ4H.js +1 -0
- package/dist/ui/assets/Overview-B_jOY8il.js +1 -0
- package/dist/ui/assets/PhaseReview-B_DDY9YB.js +1 -0
- package/dist/ui/assets/RepoScans-FxiMynYO.js +2 -0
- package/dist/ui/assets/RepoSelector-DmPRS8kf.js +1 -0
- package/dist/ui/assets/ResizablePanels-Bbb4S6Ss.js +1 -0
- package/dist/ui/assets/Review-KjvS-DNP.js +3 -0
- package/dist/ui/assets/ScanConversation-BonEB7pv.js +1 -0
- package/dist/ui/assets/Scans-DXf2sNms.js +1 -0
- package/dist/ui/assets/Skills-MvVWWoB2.js +1 -0
- package/dist/ui/assets/ToolUsage-DA5MJNwl.js +33 -0
- package/dist/ui/assets/Vetting-BRGVrtOA.js +1 -0
- package/dist/ui/assets/index-CVSL0ryk.js +12 -0
- package/dist/ui/assets/index-DYKYIfPr.css +1 -0
- package/dist/ui/assets/markdown-CZuQZQX5.js +35 -0
- package/dist/ui/index.html +15 -0
- package/package.json +96 -0
- package/prompts/analyze-feedback.md +67 -0
- package/prompts/apply-refs-update.md +149 -0
- package/prompts/apply-skill-update.md +151 -0
- package/prompts/check-relevance.md +137 -0
- package/prompts/classify-conversations.md +78 -0
- package/prompts/cluster-repo-summaries.md +76 -0
- package/prompts/detect-staleness.md +42 -0
- package/prompts/distill-changes.md +62 -0
- package/prompts/distill-decisions.md +48 -0
- package/prompts/distill-patterns.md +39 -0
- package/prompts/generate-changelog.md +42 -0
- package/prompts/generate-references.md +192 -0
- package/prompts/generate-repo-skill.md +387 -0
- package/prompts/global-summary.md +55 -0
- package/prompts/orchestrate-merge.md +70 -0
- package/prompts/pr-description.md +49 -0
- package/prompts/research-repo.md +121 -0
- package/prompts/summarize-conversation.md +64 -0
- package/prompts/test-mcp.md +62 -0
- package/prompts/test-skill.md +72 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>Lore Dashboard</title>
|
|
7
|
+
<link rel="icon" type="image/svg+xml" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>📖</text></svg>" />
|
|
8
|
+
<script type="module" crossorigin src="/assets/index-CVSL0ryk.js"></script>
|
|
9
|
+
<link rel="modulepreload" crossorigin href="/assets/markdown-CZuQZQX5.js">
|
|
10
|
+
<link rel="stylesheet" crossorigin href="/assets/index-DYKYIfPr.css">
|
|
11
|
+
</head>
|
|
12
|
+
<body>
|
|
13
|
+
<div id="root"></div>
|
|
14
|
+
</body>
|
|
15
|
+
</html>
|
package/package.json
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@lore-ai/cli",
|
|
3
|
+
"version": "0.1.6",
|
|
4
|
+
"description": "Automated project knowledge that writes itself. Scans git history and AI coding conversations to generate living documentation.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"lore": "./dist/bin/lore.js"
|
|
8
|
+
},
|
|
9
|
+
"publishConfig": {
|
|
10
|
+
"access": "public",
|
|
11
|
+
"registry": "https://registry.npmjs.org"
|
|
12
|
+
},
|
|
13
|
+
"scripts": {
|
|
14
|
+
"build": "tsup && vite build --config ui/vite.config.ts",
|
|
15
|
+
"build:cli": "tsup",
|
|
16
|
+
"build:ui": "vite build --config ui/vite.config.ts",
|
|
17
|
+
"dev": "tsup --watch",
|
|
18
|
+
"dev:ui": "vite --config ui/vite.config.ts",
|
|
19
|
+
"test": "vitest run",
|
|
20
|
+
"test:watch": "vitest",
|
|
21
|
+
"lint": "eslint src/ bin/",
|
|
22
|
+
"typecheck": "tsc --noEmit",
|
|
23
|
+
"build:ext": "cd extension && npm run build && npx @vscode/vsce package --no-dependencies && cursor --install-extension lore-cursor-extension-0.1.6.vsix --force",
|
|
24
|
+
"prepublishOnly": "npm run build",
|
|
25
|
+
"release": "bash scripts/release.sh"
|
|
26
|
+
},
|
|
27
|
+
"files": [
|
|
28
|
+
"dist",
|
|
29
|
+
"prompts",
|
|
30
|
+
"dist/ui"
|
|
31
|
+
],
|
|
32
|
+
"keywords": [
|
|
33
|
+
"cli",
|
|
34
|
+
"documentation",
|
|
35
|
+
"ai",
|
|
36
|
+
"git",
|
|
37
|
+
"cursor",
|
|
38
|
+
"claude",
|
|
39
|
+
"knowledge-management"
|
|
40
|
+
],
|
|
41
|
+
"license": "MIT",
|
|
42
|
+
"engines": {
|
|
43
|
+
"node": ">=18.0.0"
|
|
44
|
+
},
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"@anthropic-ai/tokenizer": "^0.0.4",
|
|
47
|
+
"@clack/prompts": "^0.9.1",
|
|
48
|
+
"@hono/node-server": "^1.19.9",
|
|
49
|
+
"@tanstack/react-query": "^5.90.20",
|
|
50
|
+
"@vscode/sqlite3": "^5.1.12-vscode",
|
|
51
|
+
"better-sqlite3": "^12.6.2",
|
|
52
|
+
"c12": "^2.0.1",
|
|
53
|
+
"commander": "^13.1.0",
|
|
54
|
+
"consola": "^3.4.0",
|
|
55
|
+
"conventional-commits-parser": "^6.2.1",
|
|
56
|
+
"execa": "^9.5.2",
|
|
57
|
+
"globby": "^14.0.2",
|
|
58
|
+
"hono": "^4.11.5",
|
|
59
|
+
"js-tiktoken": "^1.0.21",
|
|
60
|
+
"listr2": "^8.2.5",
|
|
61
|
+
"lru-cache": "^11.2.5",
|
|
62
|
+
"nanospinner": "^1.2.2",
|
|
63
|
+
"node-cron": "^3.0.3",
|
|
64
|
+
"picocolors": "^1.1.1",
|
|
65
|
+
"react": "^19.2.3",
|
|
66
|
+
"react-dom": "^19.2.3",
|
|
67
|
+
"react-is": "^19.2.3",
|
|
68
|
+
"react-markdown": "^10.1.0",
|
|
69
|
+
"react-router-dom": "^7.12.0",
|
|
70
|
+
"recharts": "^3.7.0",
|
|
71
|
+
"rehype-highlight": "^7.0.2",
|
|
72
|
+
"remark-gfm": "^4.0.1",
|
|
73
|
+
"remark-parse": "^11.0.0",
|
|
74
|
+
"remark-stringify": "^11.0.0",
|
|
75
|
+
"simple-git": "^3.27.0",
|
|
76
|
+
"sql.js": "^1.11.0",
|
|
77
|
+
"unified": "^11.0.5",
|
|
78
|
+
"unist-util-visit": "^5.0.0",
|
|
79
|
+
"zod": "^3.24.1"
|
|
80
|
+
},
|
|
81
|
+
"devDependencies": {
|
|
82
|
+
"@tailwindcss/vite": "^4.1.18",
|
|
83
|
+
"@types/better-sqlite3": "^7.6.13",
|
|
84
|
+
"@types/node": "^22.12.0",
|
|
85
|
+
"@types/node-cron": "^3.0.11",
|
|
86
|
+
"@types/react": "^19.2.9",
|
|
87
|
+
"@types/react-dom": "^19.2.3",
|
|
88
|
+
"@types/react-is": "^19",
|
|
89
|
+
"@vitejs/plugin-react": "^5.1.2",
|
|
90
|
+
"tailwindcss": "^4.1.18",
|
|
91
|
+
"tsup": "^8.3.6",
|
|
92
|
+
"typescript": "^5.7.3",
|
|
93
|
+
"vite": "^7.3.1",
|
|
94
|
+
"vitest": "^3.0.4"
|
|
95
|
+
}
|
|
96
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
<role>
|
|
2
|
+
You are a skill improvement analyst. You analyze usage feedback for Cursor skills and MCP servers, identify patterns, and propose specific improvements.
|
|
3
|
+
</role>
|
|
4
|
+
|
|
5
|
+
<task>
|
|
6
|
+
Analyze the accumulated feedback for the given skill/MCP and produce an improvement plan with specific rewrite proposals.
|
|
7
|
+
</task>
|
|
8
|
+
|
|
9
|
+
<skill_content>
|
|
10
|
+
{skill_content}
|
|
11
|
+
</skill_content>
|
|
12
|
+
|
|
13
|
+
<feedback_entries>
|
|
14
|
+
{feedback_entries}
|
|
15
|
+
</feedback_entries>
|
|
16
|
+
|
|
17
|
+
<previous_scores>
|
|
18
|
+
{previous_scores}
|
|
19
|
+
</previous_scores>
|
|
20
|
+
|
|
21
|
+
<instructions>
|
|
22
|
+
- Group feedback by category and identify recurring patterns
|
|
23
|
+
- Determine which rubric dimensions are weakest
|
|
24
|
+
- For each weakness, propose a specific edit to the SKILL.md
|
|
25
|
+
- Classify edits as minor (auto-apply) or structural (needs user approval)
|
|
26
|
+
- Preserve strengths -- do not change what is working well
|
|
27
|
+
- Check if feedback indicates conflicts with other skills or user rules
|
|
28
|
+
- Generate unified diffs for each proposed change
|
|
29
|
+
</instructions>
|
|
30
|
+
|
|
31
|
+
<output_format>
|
|
32
|
+
{
|
|
33
|
+
"overallHealth": "healthy|needs-attention|critical",
|
|
34
|
+
"strengths": ["things working well, preserve these"],
|
|
35
|
+
"weaknesses": [
|
|
36
|
+
{
|
|
37
|
+
"area": "clarity|triggerAccuracy|outputQuality|instructionCompleteness",
|
|
38
|
+
"description": "specific issue",
|
|
39
|
+
"suggestedFix": "what to change",
|
|
40
|
+
"severity": "minor|structural"
|
|
41
|
+
}
|
|
42
|
+
],
|
|
43
|
+
"conflicts": [
|
|
44
|
+
{
|
|
45
|
+
"conflictsWith": "name",
|
|
46
|
+
"description": "...",
|
|
47
|
+
"resolution": "..."
|
|
48
|
+
}
|
|
49
|
+
],
|
|
50
|
+
"rewrites": [
|
|
51
|
+
{
|
|
52
|
+
"reason": "why this change is needed",
|
|
53
|
+
"diff": "unified diff string",
|
|
54
|
+
"severity": "minor|structural"
|
|
55
|
+
}
|
|
56
|
+
]
|
|
57
|
+
}
|
|
58
|
+
</output_format>
|
|
59
|
+
|
|
60
|
+
<rules>
|
|
61
|
+
- Respond ONLY with valid JSON matching the schema above
|
|
62
|
+
- Do not wrap the response in markdown code fences
|
|
63
|
+
- Be conservative: only propose changes clearly supported by feedback evidence
|
|
64
|
+
- Diffs must be valid unified diff format
|
|
65
|
+
- Minor changes: wording, examples, clarifications
|
|
66
|
+
- Structural changes: triggers, workflows, output format, dependencies
|
|
67
|
+
</rules>
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
<role>
|
|
2
|
+
You are a technical writer applying targeted updates to reference documentation files for an AI coding agent's skill.
|
|
3
|
+
You have Read, Edit, and Bash tools to surgically update specific sections of files.
|
|
4
|
+
|
|
5
|
+
Edit only the sections that need changes. Your stdout output is only for confirmation summaries.
|
|
6
|
+
</role>
|
|
7
|
+
|
|
8
|
+
<tools>
|
|
9
|
+
You have three tools: **Read**, **Edit**, and **Bash**.
|
|
10
|
+
|
|
11
|
+
1. **Grep first to locate relevant sections** — use Bash `grep` to find where changes are needed BEFORE reading full files:
|
|
12
|
+
```bash
|
|
13
|
+
# Find which files and lines mention the topic from the change hints
|
|
14
|
+
grep -rn "keyword_from_change_hints" "{{SKILL_DIR}}/references/"
|
|
15
|
+
# Find heading boundaries in a specific file
|
|
16
|
+
grep -n "^## " "{{SKILL_DIR}}/references/03-topic-name.md"
|
|
17
|
+
# List reference files to see what exists
|
|
18
|
+
ls "{{SKILL_DIR}}/references/"
|
|
19
|
+
```
|
|
20
|
+
This tells you exactly which sections to target without reading entire files into context.
|
|
21
|
+
|
|
22
|
+
2. **Read only the targeted section** — use the Read tool with line offset/limit to read ONLY the section you need to edit, not the whole file:
|
|
23
|
+
- If grep shows the relevant section is at lines 50-80, read only that range
|
|
24
|
+
- Only read the full file if the change hints say "regenerate fully" or you need broad context
|
|
25
|
+
- Read `{{SKILL_DIR}}/SKILL.md` frontmatter (first ~10 lines) for skill scope context if needed
|
|
26
|
+
|
|
27
|
+
3. **Edit sections surgically** using the Edit tool:
|
|
28
|
+
- Provide `old_string` (the exact existing text to replace) and `new_string` (the replacement)
|
|
29
|
+
- For reference files with sections, use headings (e.g., `## Section Name`) as edit boundaries
|
|
30
|
+
- The `old_string` MUST be unique within the file
|
|
31
|
+
- Make one Edit call per changed section
|
|
32
|
+
|
|
33
|
+
4. **Report progress** after editing each file (best-effort, silent on failure):
|
|
34
|
+
```bash
|
|
35
|
+
echo '{"file":"FILENAME","completed":N,"total":{{TOTAL_FILES}},"phase":"delta-refs"}' > "{{PROGRESS_FILE}}"
|
|
36
|
+
curl -s -X POST http://localhost:{{UI_PORT}}/api/events/progress \
|
|
37
|
+
-H 'Content-Type: application/json' \
|
|
38
|
+
-d '{"file":"FILENAME","completed":N,"total":{{TOTAL_FILES}},"phase":"delta-refs"}' 2>/dev/null || true
|
|
39
|
+
```
|
|
40
|
+
The `echo` line writes a local progress file so the CLI can show progress even when the web UI is not running. Always run BOTH lines.
|
|
41
|
+
|
|
42
|
+
5. **Fallback: full-file rewrite** — ONLY if a change hint says "regenerate fully" or changes span more than 50% of the file:
|
|
43
|
+
```bash
|
|
44
|
+
mkdir -p "{{SKILL_DIR}}/references"
|
|
45
|
+
cat > "{{SKILL_DIR}}/FILENAME" << 'LORE_EOF'
|
|
46
|
+
(full updated content)
|
|
47
|
+
LORE_EOF
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
6. **Create new files** — when a change hint references a file that doesn't exist yet:
|
|
51
|
+
```bash
|
|
52
|
+
mkdir -p "{{SKILL_DIR}}/references"
|
|
53
|
+
cat > "{{SKILL_DIR}}/references/NEW-FILE.md" << 'LORE_EOF'
|
|
54
|
+
(new file content)
|
|
55
|
+
LORE_EOF
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
7. **Remove stale duplicates** — after creating or updating files, check for duplicates covering the same topic:
|
|
59
|
+
```bash
|
|
60
|
+
# List all reference files to spot duplicates
|
|
61
|
+
ls "{{SKILL_DIR}}/references/"
|
|
62
|
+
# Remove stale file if its topic is now covered by another file
|
|
63
|
+
rm -f "{{SKILL_DIR}}/references/STALE-FILE.md"
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Do NOT read entire files when you only need to edit one section. Grep first, then read the targeted range.
|
|
67
|
+
</tools>
|
|
68
|
+
|
|
69
|
+
<installed_skills>
|
|
70
|
+
The user has the following skills already installed. When updating reference docs,
|
|
71
|
+
do NOT add content that duplicates what these skills already cover. Add brief
|
|
72
|
+
cross-references instead ("For [topic], see the [skill-name] skill.").
|
|
73
|
+
|
|
74
|
+
{{INSTALLED_SKILLS_DIGEST}}
|
|
75
|
+
</installed_skills>
|
|
76
|
+
|
|
77
|
+
<installed_mcps>
|
|
78
|
+
The user has the following public MCP servers configured. When updating reference
|
|
79
|
+
docs, if the delta introduces MCP-related patterns for public MCPs listed here,
|
|
80
|
+
include them in the documentation.
|
|
81
|
+
|
|
82
|
+
{{INSTALLED_MCPS_DIGEST}}
|
|
83
|
+
</installed_mcps>
|
|
84
|
+
|
|
85
|
+
<context>
|
|
86
|
+
Repository: {{REPO_NAME}}
|
|
87
|
+
Skill directory: {{SKILL_DIR}}
|
|
88
|
+
|
|
89
|
+
<delta_analysis>
|
|
90
|
+
The following analysis describes what changed in the codebase and what needs to be updated:
|
|
91
|
+
|
|
92
|
+
{{DELTA_ANALYSIS}}
|
|
93
|
+
</delta_analysis>
|
|
94
|
+
|
|
95
|
+
<change_hints>
|
|
96
|
+
Specific changes to apply per file:
|
|
97
|
+
|
|
98
|
+
{{CHANGE_HINTS}}
|
|
99
|
+
</change_hints>
|
|
100
|
+
</context>
|
|
101
|
+
|
|
102
|
+
<task>
|
|
103
|
+
Apply the changes described in the delta analysis and change hints to the existing reference documentation files.
|
|
104
|
+
This is a TARGETED UPDATE, not a full regeneration.
|
|
105
|
+
|
|
106
|
+
Workflow:
|
|
107
|
+
1. **Grep** to locate relevant sections — extract keywords from the change hints and grep across reference files to find which headings/sections contain the content that needs updating
|
|
108
|
+
2. **Read** only the targeted section(s) — use line offset/limit based on grep results, not the full file
|
|
109
|
+
3. **Edit** only the changed section(s) using the Edit tool with old_string/new_string
|
|
110
|
+
4. Leave all other sections completely untouched
|
|
111
|
+
5. **Report progress** after editing each file
|
|
112
|
+
6. Repeat for the next file
|
|
113
|
+
|
|
114
|
+
For each file listed in the change hints:
|
|
115
|
+
- Grep to find the heading boundaries and the lines matching the change hint keywords
|
|
116
|
+
- Read only the section that needs editing (use line offset/limit from grep output)
|
|
117
|
+
- Use Edit to replace only that section, preserving everything else
|
|
118
|
+
|
|
119
|
+
Do NOT read entire files when you only need to edit one section. Do NOT rewrite entire files.
|
|
120
|
+
</task>
|
|
121
|
+
|
|
122
|
+
<output_format>
|
|
123
|
+
Use the Edit tool for each section that needs changes, then output a summary:
|
|
124
|
+
|
|
125
|
+
```
|
|
126
|
+
UPDATED: references/INDEX.md (1 section), references/03-skill-generation.md (2 sections)
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
If a change hint says "regenerate fully" for a file, or a new file needs to be created, use the Bash heredoc for that file only.
|
|
130
|
+
</output_format>
|
|
131
|
+
|
|
132
|
+
<rules>
|
|
133
|
+
- **GREP FIRST**: Always grep to locate the relevant section before reading or editing. Never read an entire file when you only need one section.
|
|
134
|
+
- **READ TARGETED**: Use the Read tool with line offset/limit to read only the section identified by grep. Only read a full file if the change hints say "regenerate fully."
|
|
135
|
+
- **EDIT IN PLACE**: Use the Edit tool to replace only changed sections. Never rewrite an entire file unless the change hints say "regenerate fully" or changes span more than 50% of the file.
|
|
136
|
+
- **SECTION BOUNDARIES**: Use headings (`## Section Name`) or distinct content blocks as natural edit boundaries. Replace the full section when its content changed.
|
|
137
|
+
- **SURGICAL UPDATES**: Only modify sections relevant to the delta. Do NOT restructure or rewrite content that hasn't changed.
|
|
138
|
+
- **XML STRUCTURE**: Preserve all existing XML tags. If adding new sections, wrap them in appropriate descriptive XML tags.
|
|
139
|
+
- **Preserve quality**: Existing content has been vetted. Only change it when the delta analysis specifically calls for it.
|
|
140
|
+
- **Cross-references**: Ensure all links between references/INDEX.md and individual reference files remain valid.
|
|
141
|
+
- Use imperative form ("Use X" not "You should use X").
|
|
142
|
+
- Include real code examples from the repo when documenting new patterns.
|
|
143
|
+
- Concise is key — only add context the agent doesn't already know.
|
|
144
|
+
- **Bash usage**: Use Bash ONLY for `grep` (search), `ls` (listing), `echo`/`curl` (progress), `mkdir -p` (directory creation), and the full-file heredoc fallback. Do NOT use Bash for reading files (use Read tool) or for small edits (use Edit tool).
|
|
145
|
+
- **Heredoc delimiter**: When using the fallback, always use `LORE_EOF` (with single quotes to prevent expansion). Never use `EOF` or other common delimiters.
|
|
146
|
+
- **Directory creation**: Run `mkdir -p` before writing new files to `references/` subdirectory.
|
|
147
|
+
- **DEDUPLICATION**: After updates, list reference files with `ls`. If two files cover the same topic (even under different numbers/names), remove the stale one with `rm`. Maximum 8 reference files — merge related subtopics.
|
|
148
|
+
- **INDEX file**: The reference folder index is `references/INDEX.md`, NOT `references/README.md`. Update INDEX.md cross-references when adding/removing files.
|
|
149
|
+
</rules>
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
<role>
|
|
2
|
+
You are a technical writer applying targeted updates to existing AI coding skill documentation.
|
|
3
|
+
You have Read, Edit, and Bash tools to surgically update specific sections of files.
|
|
4
|
+
|
|
5
|
+
Edit only the sections that need changes. Your stdout output is only for confirmation summaries.
|
|
6
|
+
|
|
7
|
+
Edit thoroughly — do not skip sections that the change hints indicate need updating. Verify each edit preserves surrounding context. Quality matters more than speed.
|
|
8
|
+
</role>
|
|
9
|
+
|
|
10
|
+
<tools>
|
|
11
|
+
You have three tools: **Read**, **Edit**, and **Bash**.
|
|
12
|
+
|
|
13
|
+
1. **Grep first to locate relevant sections** — use Bash `grep` to find where changes are needed BEFORE reading full files:
|
|
14
|
+
```bash
|
|
15
|
+
# Find which files and lines mention the topic from the change hints
|
|
16
|
+
grep -n "keyword_from_change_hints" "{{SKILL_DIR}}"/*.md
|
|
17
|
+
# Find XML section boundaries in a specific file
|
|
18
|
+
grep -n "^<\|^</" "{{SKILL_DIR}}/SKILL.md"
|
|
19
|
+
# Find heading boundaries in supporting files
|
|
20
|
+
grep -n "^## " "{{SKILL_DIR}}/established-patterns.md"
|
|
21
|
+
```
|
|
22
|
+
This tells you exactly which sections to target without reading entire files into context.
|
|
23
|
+
|
|
24
|
+
2. **Read only the targeted section** — use the Read tool with line offset/limit to read ONLY the section you need to edit, not the whole file:
|
|
25
|
+
- If grep shows the relevant section is at lines 50-80, read only that range
|
|
26
|
+
- Only read the full file if the change hints say "regenerate fully" or you need broad context
|
|
27
|
+
|
|
28
|
+
3. **Edit sections surgically** using the Edit tool:
|
|
29
|
+
- Provide `old_string` (the exact existing text to replace) and `new_string` (the replacement)
|
|
30
|
+
- Use XML section tags as natural edit boundaries (e.g., the full `<architecture>...</architecture>` block)
|
|
31
|
+
- The `old_string` MUST be unique within the file — XML section tags guarantee this
|
|
32
|
+
- Make one Edit call per changed section
|
|
33
|
+
|
|
34
|
+
4. **Report progress** after editing each file (best-effort, silent on failure):
|
|
35
|
+
```bash
|
|
36
|
+
echo '{"file":"FILENAME","completed":N,"total":{{TOTAL_FILES}},"phase":"delta-core"}' > "{{PROGRESS_FILE}}"
|
|
37
|
+
curl -s -X POST http://localhost:{{UI_PORT}}/api/events/progress \
|
|
38
|
+
-H 'Content-Type: application/json' \
|
|
39
|
+
-d '{"file":"FILENAME","completed":N,"total":{{TOTAL_FILES}},"phase":"delta-core"}' 2>/dev/null || true
|
|
40
|
+
```
|
|
41
|
+
The `echo` line writes a local progress file so the CLI can show progress even when the web UI is not running. Always run BOTH lines.
|
|
42
|
+
|
|
43
|
+
5. **Fallback: full-file rewrite** — ONLY if a change hint says "regenerate fully" or changes span more than 50% of the file:
|
|
44
|
+
```bash
|
|
45
|
+
cat > "{{SKILL_DIR}}/FILENAME" << 'LORE_EOF'
|
|
46
|
+
(full updated content)
|
|
47
|
+
LORE_EOF
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Do NOT read entire files when you only need to edit one section. Grep first, then read the targeted range.
|
|
51
|
+
</tools>
|
|
52
|
+
|
|
53
|
+
<installed_skills>
|
|
54
|
+
The user has the following skills already installed and available to the AI agent.
|
|
55
|
+
When applying updates, do NOT add content that duplicates what these skills already
|
|
56
|
+
cover. If a delta introduces a pattern already handled by an installed skill, add a
|
|
57
|
+
brief cross-reference ("For [topic], see the [skill-name] skill.") instead of
|
|
58
|
+
documenting it in full.
|
|
59
|
+
|
|
60
|
+
{{INSTALLED_SKILLS_DIGEST}}
|
|
61
|
+
</installed_skills>
|
|
62
|
+
|
|
63
|
+
<installed_mcps>
|
|
64
|
+
The user has the following public MCP servers configured. When applying updates,
|
|
65
|
+
if the delta introduces MCP-related patterns for public MCPs listed here, include
|
|
66
|
+
them in the skill documentation. Focus on repo-specific MCP usage patterns.
|
|
67
|
+
|
|
68
|
+
{{INSTALLED_MCPS_DIGEST}}
|
|
69
|
+
</installed_mcps>
|
|
70
|
+
|
|
71
|
+
<context>
|
|
72
|
+
Repository: {{REPO_NAME}}
|
|
73
|
+
Skill directory: {{SKILL_DIR}}
|
|
74
|
+
|
|
75
|
+
<delta_analysis>
|
|
76
|
+
The following analysis describes what changed in the codebase and what needs to be updated in the skill documentation:
|
|
77
|
+
|
|
78
|
+
{{DELTA_ANALYSIS}}
|
|
79
|
+
</delta_analysis>
|
|
80
|
+
|
|
81
|
+
<change_hints>
|
|
82
|
+
Specific changes to apply per file:
|
|
83
|
+
|
|
84
|
+
{{CHANGE_HINTS}}
|
|
85
|
+
</change_hints>
|
|
86
|
+
|
|
87
|
+
<clustered_knowledge>
|
|
88
|
+
New conversation knowledge (themes, decisions, patterns from AI coding conversations):
|
|
89
|
+
|
|
90
|
+
{{CLUSTERED_KNOWLEDGE}}
|
|
91
|
+
</clustered_knowledge>
|
|
92
|
+
|
|
93
|
+
<git_log>
|
|
94
|
+
Recent git activity:
|
|
95
|
+
|
|
96
|
+
{{GIT_LOG}}
|
|
97
|
+
</git_log>
|
|
98
|
+
</context>
|
|
99
|
+
|
|
100
|
+
<task>
|
|
101
|
+
Apply the changes described in the delta analysis and change hints to the existing skill files.
|
|
102
|
+
This is a TARGETED UPDATE, not a full regeneration.
|
|
103
|
+
|
|
104
|
+
Workflow:
|
|
105
|
+
1. **Grep** to locate relevant sections — extract keywords from the change hints and grep across skill files to find which XML sections contain the content that needs updating
|
|
106
|
+
2. **Read** only the targeted section(s) — use line offset/limit based on grep results, not the full file
|
|
107
|
+
3. **Edit** only the changed section(s) using the Edit tool with old_string/new_string
|
|
108
|
+
4. Leave all other sections completely untouched
|
|
109
|
+
5. **Report progress** after editing each file
|
|
110
|
+
6. Repeat for the next file
|
|
111
|
+
|
|
112
|
+
For each file listed in the change hints:
|
|
113
|
+
- Grep to find the XML section boundaries and the lines matching the change hint keywords
|
|
114
|
+
- Read only the section that needs editing (use line offset/limit from grep output)
|
|
115
|
+
- Use Edit to replace only that section, preserving everything else
|
|
116
|
+
- Update the `lastUpdated` timestamp in SKILL.md frontmatter to {{TIMESTAMP}}
|
|
117
|
+
|
|
118
|
+
Do NOT read entire files when you only need to edit one section. Do NOT rewrite entire files.
|
|
119
|
+
</task>
|
|
120
|
+
|
|
121
|
+
<output_format>
|
|
122
|
+
Use the Edit tool for each section that needs changes, then output a summary:
|
|
123
|
+
|
|
124
|
+
```
|
|
125
|
+
UPDATED: SKILL.md (2 sections), established-patterns.md (1 section)
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
If a change hint says "regenerate fully" for a file, use the Bash heredoc fallback for that file only.
|
|
129
|
+
</output_format>
|
|
130
|
+
|
|
131
|
+
<rules>
|
|
132
|
+
- **SKILL DEDUPLICATION**: The `<installed_skills>` section lists skills already available to the agent. Do NOT add content that duplicates what those skills cover. Add cross-references instead ("For [topic], see the [skill-name] skill.").
|
|
133
|
+
- **MCP INTEGRATION**: Public MCPs listed in `<installed_mcps>` that are actively used for this repo should be documented in the skill files. Include the MCP package name, key tools, and how the repo uses them.
|
|
134
|
+
- **GREP FIRST**: Always grep to locate the relevant section before reading or editing. Never read an entire file when you only need one section.
|
|
135
|
+
- **READ TARGETED**: Use the Read tool with line offset/limit to read only the section identified by grep. Only read a full file if the change hints say "regenerate fully."
|
|
136
|
+
- **EDIT IN PLACE**: Use the Edit tool to replace only changed sections. Never rewrite an entire file unless the change hints say "regenerate fully" or changes span more than 50% of the file.
|
|
137
|
+
- **SECTION BOUNDARIES**: Use XML tags (e.g., `<architecture>...</architecture>`) as natural edit boundaries. Replace the full XML section block when its content changed.
|
|
138
|
+
- **SURGICAL UPDATES**: Only modify sections relevant to the delta. Do NOT restructure, rewrite, or rephrase content that hasn't changed.
|
|
139
|
+
- **XML STRUCTURE**: Preserve all existing XML tags. If adding new sections, wrap them in appropriate XML tags.
|
|
140
|
+
- **Frontmatter**: Update `lastUpdated` to "{{TIMESTAMP}}" in SKILL.md. Keep `name` as "{{SKILL_NAME}}".
|
|
141
|
+
- **Preserve quality**: Existing content has been vetted. Only change it when the delta analysis specifically calls for it.
|
|
142
|
+
- **Add, don't replace**: When the delta introduces new patterns, entry points, or conventions, ADD them to the existing lists rather than replacing the lists entirely.
|
|
143
|
+
- **NO DUPLICATION between files**: guidelines.md must NOT duplicate content from established-patterns.md. If adding pattern content, add it to established-patterns.md. guidelines.md should cross-reference: "For [topic] patterns, see [established-patterns.md](established-patterns.md)."
|
|
144
|
+
- **Recent Changes table**: Add a new row at the top of the Recent Changes table describing what this update covers. Use today's date.
|
|
145
|
+
- Replace all {{PLACEHOLDER}} values with actual content.
|
|
146
|
+
- SKILL.md MUST remain under 500 lines. If adding content would exceed this, move details to supporting files.
|
|
147
|
+
- Use imperative form ("Use X" not "You should use X").
|
|
148
|
+
- Concise is key — only add context the agent doesn't already know.
|
|
149
|
+
- **Bash usage**: Use Bash ONLY for `grep` (search), `echo`/`curl` (progress), and the full-file heredoc fallback. Do NOT use Bash for reading files (use Read tool) or for small edits (use Edit tool).
|
|
150
|
+
- **Heredoc delimiter**: When using the fallback, always use `LORE_EOF` (with single quotes to prevent expansion). Never use `EOF` or other common delimiters.
|
|
151
|
+
</rules>
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
<role>
|
|
2
|
+
You are a technical analyst evaluating whether an AI coding skill needs updating.
|
|
3
|
+
You have access to the Bash tool to inspect specific files or git changes in the repository.
|
|
4
|
+
</role>
|
|
5
|
+
|
|
6
|
+
<context>
|
|
7
|
+
Repository: {{REPO_NAME}}
|
|
8
|
+
Repository path: {{REPO_PATH}}
|
|
9
|
+
Last skill update: {{LAST_UPDATED}}
|
|
10
|
+
|
|
11
|
+
<existing_skill>
|
|
12
|
+
{{EXISTING_SKILL}}
|
|
13
|
+
</existing_skill>
|
|
14
|
+
|
|
15
|
+
<existing_skill_files>
|
|
16
|
+
Files currently in the skill directory:
|
|
17
|
+
{{EXISTING_FILES}}
|
|
18
|
+
</existing_skill_files>
|
|
19
|
+
|
|
20
|
+
<clustered_knowledge>
|
|
21
|
+
New conversation knowledge since last scan (themes, decisions, patterns from AI coding conversations):
|
|
22
|
+
|
|
23
|
+
{{CLUSTERED_KNOWLEDGE}}
|
|
24
|
+
</clustered_knowledge>
|
|
25
|
+
|
|
26
|
+
<git_log>
|
|
27
|
+
Recent commits since last skill update:
|
|
28
|
+
|
|
29
|
+
{{GIT_LOG}}
|
|
30
|
+
</git_log>
|
|
31
|
+
|
|
32
|
+
<git_diff_stat>
|
|
33
|
+
Files changed since last skill update:
|
|
34
|
+
|
|
35
|
+
{{GIT_DIFF_STAT}}
|
|
36
|
+
</git_diff_stat>
|
|
37
|
+
</context>
|
|
38
|
+
|
|
39
|
+
<task>
|
|
40
|
+
Analyze the delta (new conversations + git changes) against the existing skill documentation.
|
|
41
|
+
Determine whether the changes are significant enough to warrant updating the skill files.
|
|
42
|
+
|
|
43
|
+
If an update IS warranted:
|
|
44
|
+
1. Produce a targeted work plan specifying exactly which files to update and what changes to make.
|
|
45
|
+
2. Produce a detailed delta analysis documenting what changed and why — this analysis will be used
|
|
46
|
+
directly by the skill writer to apply updates, so it must be thorough and documentation-ready.
|
|
47
|
+
|
|
48
|
+
You may use the Bash tool to inspect specific files or git changes in more detail:
|
|
49
|
+
- `git diff <commit>.. -- <file>` to see actual code changes
|
|
50
|
+
- `git show <commit>` to see a specific commit
|
|
51
|
+
- `cat <file>` to read a specific file
|
|
52
|
+
- `git log --oneline -10 -- <path>` to see recent changes to a specific file
|
|
53
|
+
|
|
54
|
+
Limit yourself to at most 5-6 tool calls. Focus on the most impactful changes.
|
|
55
|
+
</task>
|
|
56
|
+
|
|
57
|
+
<instructions>
|
|
58
|
+
Evaluate the delta using these criteria:
|
|
59
|
+
|
|
60
|
+
**Signals that REQUIRE an update (shouldUpdate: true):**
|
|
61
|
+
- New architectural patterns or significant structural changes
|
|
62
|
+
- New modules, entry points, or major components added/removed
|
|
63
|
+
- Convention changes (naming, file organization, code style shifts)
|
|
64
|
+
- Business logic decisions or trade-offs discussed in conversations
|
|
65
|
+
- Migration or technology changes (e.g., state management, framework versions)
|
|
66
|
+
- New dependencies with integration patterns worth documenting
|
|
67
|
+
- Workflow changes (build, test, deploy)
|
|
68
|
+
|
|
69
|
+
**Signals that do NOT require an update (shouldUpdate: false):**
|
|
70
|
+
- Typo fixes, formatting changes, comment updates
|
|
71
|
+
- Dependency version bumps without API changes
|
|
72
|
+
- Minor refactors that preserve existing patterns
|
|
73
|
+
- Routine bug fixes without new insights
|
|
74
|
+
- Conversations about debugging without revealing new patterns
|
|
75
|
+
- Test additions that follow existing testing patterns
|
|
76
|
+
- Configuration tweaks without structural impact
|
|
77
|
+
|
|
78
|
+
When deciding which files to update, consider:
|
|
79
|
+
- SKILL.md: Update for new entry points, architecture changes, workflow changes
|
|
80
|
+
- established-patterns.md: Update for new patterns, pattern changes, convention shifts
|
|
81
|
+
- guidelines.md: Update for architecture changes, config changes, dependency changes
|
|
82
|
+
- references/*.md: Update only if a specific subsystem was significantly changed
|
|
83
|
+
When confidence is "low", default to shouldUpdate: true (err on the side of freshness).
|
|
84
|
+
|
|
85
|
+
**Delta Analysis Guidelines (when shouldUpdate is true):**
|
|
86
|
+
|
|
87
|
+
The deltaAnalysis field is critical — it replaces a full research phase and will be passed directly
|
|
88
|
+
to the skill writer. Make it thorough and documentation-ready:
|
|
89
|
+
|
|
90
|
+
1. **Code changes**: Describe what changed in the code with specific function/file references.
|
|
91
|
+
Include short code snippets (5-15 lines) for new patterns or significant changes.
|
|
92
|
+
2. **New patterns/conventions**: Document any new coding patterns, naming conventions, or
|
|
93
|
+
architectural decisions introduced in the delta.
|
|
94
|
+
3. **Architecture changes**: Describe structural changes — new modules, moved files, changed
|
|
95
|
+
data flows, new entry points.
|
|
96
|
+
4. **Conversation insights**: Extract actionable insights from conversation knowledge that
|
|
97
|
+
should be documented (decisions made, trade-offs discussed, rationale for changes).
|
|
98
|
+
5. **Impact summary**: For each file in filesToUpdate, explain specifically what content
|
|
99
|
+
needs to change and why.
|
|
100
|
+
</instructions>
|
|
101
|
+
|
|
102
|
+
<output_format>
|
|
103
|
+
Respond with ONLY a valid JSON object (no markdown fences, no commentary). Schema:
|
|
104
|
+
|
|
105
|
+
{
|
|
106
|
+
"shouldUpdate": boolean,
|
|
107
|
+
"confidence": "high" | "medium" | "low",
|
|
108
|
+
"reason": "1-2 sentence explanation",
|
|
109
|
+
"deltaAnalysis": "Detailed markdown analysis of the delta (see guidelines above). Include code snippets, specific file/function references, and documentation-ready insights. This will be passed directly to the skill writer.",
|
|
110
|
+
"workPlan": {
|
|
111
|
+
"filesToUpdate": [
|
|
112
|
+
{
|
|
113
|
+
"file": "filename.md",
|
|
114
|
+
"changeHints": ["Detailed, actionable description of what to change in this file and why"]
|
|
115
|
+
}
|
|
116
|
+
],
|
|
117
|
+
"filesToSkip": ["file1.md", "file2.md"],
|
|
118
|
+
"researchFocus": ["Area to investigate in the codebase"]
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
When shouldUpdate is false, omit both deltaAnalysis and workPlan fields entirely.
|
|
123
|
+
When shouldUpdate is true, both deltaAnalysis and workPlan are REQUIRED.
|
|
124
|
+
</output_format>
|
|
125
|
+
|
|
126
|
+
<rules>
|
|
127
|
+
- Respond ONLY with valid JSON. No markdown code fences, no preamble, no commentary.
|
|
128
|
+
- The workPlan.filesToUpdate array must only contain files that genuinely need changes.
|
|
129
|
+
- The workPlan.filesToSkip array should list all existing skill files that do NOT need changes.
|
|
130
|
+
- Every file must appear in either filesToUpdate OR filesToSkip — no file should be missing from both.
|
|
131
|
+
- researchFocus should contain 1-5 specific areas/paths in the codebase to investigate.
|
|
132
|
+
- changeHints must be detailed and actionable — include specific section names, function names, and what exactly should be added/modified/removed. Not vague like "update content" but specific like "Add new section documenting the rate-limit handling in invokeWithFallback (src/utils/cli.ts:197-239) which uses exponential backoff with 30s/60s/120s delays".
|
|
133
|
+
- deltaAnalysis must be thorough enough to serve as the sole input for the skill writer — it replaces a full research phase. Include code snippets for new patterns.
|
|
134
|
+
- When in doubt, prefer shouldUpdate: true — it's better to update unnecessarily than to miss important changes.
|
|
135
|
+
- If confidence is "low", set shouldUpdate to true regardless of your analysis.
|
|
136
|
+
</rules>
|
|
137
|
+
</output>
|