cawdex 1.35.74 → 1.35.76
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 +5 -5
- package/bin/anycode.js +2 -2
- package/bin/cawdex.js +408 -408
- package/bin/ecc-hooks.cjs +11 -11
- package/dist/agents-md.d.ts +31 -0
- package/dist/agents-md.js +340 -0
- package/dist/agents-md.js.map +1 -0
- package/dist/agents.js +1424 -1424
- package/dist/api.d.ts +1 -0
- package/dist/api.js +19 -14
- package/dist/api.js.map +1 -1
- package/dist/autonomous-loops.js +287 -287
- package/dist/benchmark-repos.d.ts +31 -0
- package/dist/benchmark-repos.js +234 -8
- package/dist/benchmark-repos.js.map +1 -1
- package/dist/command-palette.js +4 -2
- package/dist/command-palette.js.map +1 -1
- package/dist/compaction.js +8 -8
- package/dist/config.js +51 -36
- package/dist/config.js.map +1 -1
- package/dist/content-engine.js +543 -543
- package/dist/context-brief.d.ts +4 -0
- package/dist/context-brief.js +230 -0
- package/dist/context-brief.js.map +1 -0
- package/dist/cost-tracker.d.ts +33 -14
- package/dist/cost-tracker.js +81 -19
- package/dist/cost-tracker.js.map +1 -1
- package/dist/coverage.js +39 -39
- package/dist/docs-sync.js +98 -98
- package/dist/evaluation.js +452 -452
- package/dist/fixed-footer.d.ts +7 -1
- package/dist/fixed-footer.js +92 -18
- package/dist/fixed-footer.js.map +1 -1
- package/dist/git-workflow.js +49 -49
- package/dist/index.d.ts +2 -0
- package/dist/index.js +197 -65
- package/dist/index.js.map +1 -1
- package/dist/instant-artifact.d.ts +6 -0
- package/dist/instant-artifact.js +397 -0
- package/dist/instant-artifact.js.map +1 -0
- package/dist/live-queue.js +1 -1
- package/dist/live-queue.js.map +1 -1
- package/dist/model-aliases.d.ts +37 -0
- package/dist/model-aliases.js +203 -0
- package/dist/model-aliases.js.map +1 -0
- package/dist/orchestration.js +15 -15
- package/dist/permissions.d.ts +6 -0
- package/dist/permissions.js +53 -0
- package/dist/permissions.js.map +1 -1
- package/dist/pm2-manager.js +26 -26
- package/dist/query.d.ts +0 -1
- package/dist/query.js +74 -39
- package/dist/query.js.map +1 -1
- package/dist/refactor.js +87 -87
- package/dist/repo-command.js +7 -1
- package/dist/repo-command.js.map +1 -1
- package/dist/search-first.js +92 -92
- package/dist/skill-create.js +100 -100
- package/dist/stitch.js +1 -1
- package/dist/system-prompt.d.ts +2 -1
- package/dist/system-prompt.js +10 -5
- package/dist/system-prompt.js.map +1 -1
- package/dist/tools/github-repo-digest.d.ts +1 -1
- package/dist/tools/github-repo-digest.js +38 -6
- package/dist/tools/github-repo-digest.js.map +1 -1
- package/dist/types.d.ts +3 -0
- package/dist/types.js.map +1 -1
- package/dist/verification.js +55 -55
- package/package.json +1 -1
- package/resources/__init__.py +1 -1
- package/resources/exgentic/cawdex_agent/README.md +114 -114
- package/resources/exgentic/cawdex_agent/__init__.py +5 -5
- package/resources/exgentic/cawdex_agent/agent.py +605 -605
- package/resources/exgentic/cawdex_agent/requirements.txt +2 -2
- package/resources/exgentic/cawdex_agent/setup.sh +21 -21
- package/resources/exgentic/cawdex_agent/utils.py +1061 -1061
- package/resources/hal/cawdex_agent/README.md +24 -24
- package/resources/hal/cawdex_agent/__init__.py +1 -1
- package/resources/hal/cawdex_agent/main.py +550 -550
- package/resources/hal/cawdex_agent/requirements.txt +2 -2
- package/resources/kbench/cawdex_agent/README.md +107 -107
- package/resources/kbench/cawdex_agent/adapter.manifest.json +19 -19
- package/resources/kbench/cawdex_agent/runner.mjs +753 -753
- package/resources/open_agent_leaderboard/cawdex-agent-card.md +119 -119
- package/resources/terminal_bench/__init__.py +1 -1
- package/resources/terminal_bench/cawdex_agent.py +174 -174
- package/resources/terminal_bench/setup.sh +121 -121
package/dist/search-first.js
CHANGED
|
@@ -176,45 +176,45 @@ export function buildSearchFirstPrompt(task, cwd) {
|
|
|
176
176
|
research += 'Found these related patterns in the codebase:\n';
|
|
177
177
|
research += relatedGreps.map((g) => `\`\`\`\n${g}\n\`\`\``).join('\n');
|
|
178
178
|
}
|
|
179
|
-
return `# Research-First Implementation
|
|
180
|
-
|
|
181
|
-
## Task
|
|
182
|
-
${task}
|
|
183
|
-
|
|
184
|
-
## Before Writing Code: Research Phase
|
|
185
|
-
|
|
186
|
-
Please follow this approach:
|
|
187
|
-
|
|
188
|
-
1. **Analyze existing patterns** in the codebase
|
|
189
|
-
- Look at similar functions and modules
|
|
190
|
-
- Understand how the project structures code
|
|
191
|
-
- Check for established patterns we should follow
|
|
192
|
-
|
|
193
|
-
2. **Review documentation and comments**
|
|
194
|
-
- Check relevant files for JSDoc and inline comments
|
|
195
|
-
- Look for design patterns in existing implementations
|
|
196
|
-
- Understand architectural decisions
|
|
197
|
-
|
|
198
|
-
3. **Identify applicable patterns**
|
|
199
|
-
- What patterns from existing code apply here?
|
|
200
|
-
- Are there similar functions we should model after?
|
|
201
|
-
- What conventions does this project follow?
|
|
202
|
-
|
|
203
|
-
4. **Reference existing code in your proposal**
|
|
204
|
-
- When proposing a solution, reference the existing code that informed it
|
|
205
|
-
- Explain how your implementation follows established patterns
|
|
206
|
-
- Point out if you're introducing a new pattern and why
|
|
207
|
-
|
|
208
|
-
## Current Codebase Research
|
|
209
|
-
${research || '(Run research to populate this section)'}
|
|
210
|
-
|
|
211
|
-
## Implementation Guidelines
|
|
212
|
-
- Follow the style and patterns of existing code
|
|
213
|
-
- Use the same import structure and module organization
|
|
214
|
-
- Match the error handling approach used elsewhere
|
|
215
|
-
- Maintain consistency with project conventions
|
|
216
|
-
- Reference specific files and functions that informed the design
|
|
217
|
-
|
|
179
|
+
return `# Research-First Implementation
|
|
180
|
+
|
|
181
|
+
## Task
|
|
182
|
+
${task}
|
|
183
|
+
|
|
184
|
+
## Before Writing Code: Research Phase
|
|
185
|
+
|
|
186
|
+
Please follow this approach:
|
|
187
|
+
|
|
188
|
+
1. **Analyze existing patterns** in the codebase
|
|
189
|
+
- Look at similar functions and modules
|
|
190
|
+
- Understand how the project structures code
|
|
191
|
+
- Check for established patterns we should follow
|
|
192
|
+
|
|
193
|
+
2. **Review documentation and comments**
|
|
194
|
+
- Check relevant files for JSDoc and inline comments
|
|
195
|
+
- Look for design patterns in existing implementations
|
|
196
|
+
- Understand architectural decisions
|
|
197
|
+
|
|
198
|
+
3. **Identify applicable patterns**
|
|
199
|
+
- What patterns from existing code apply here?
|
|
200
|
+
- Are there similar functions we should model after?
|
|
201
|
+
- What conventions does this project follow?
|
|
202
|
+
|
|
203
|
+
4. **Reference existing code in your proposal**
|
|
204
|
+
- When proposing a solution, reference the existing code that informed it
|
|
205
|
+
- Explain how your implementation follows established patterns
|
|
206
|
+
- Point out if you're introducing a new pattern and why
|
|
207
|
+
|
|
208
|
+
## Current Codebase Research
|
|
209
|
+
${research || '(Run research to populate this section)'}
|
|
210
|
+
|
|
211
|
+
## Implementation Guidelines
|
|
212
|
+
- Follow the style and patterns of existing code
|
|
213
|
+
- Use the same import structure and module organization
|
|
214
|
+
- Match the error handling approach used elsewhere
|
|
215
|
+
- Maintain consistency with project conventions
|
|
216
|
+
- Reference specific files and functions that informed the design
|
|
217
|
+
|
|
218
218
|
Now, please implement the task, but start by analyzing the codebase and then proposing your solution.`;
|
|
219
219
|
}
|
|
220
220
|
/**
|
|
@@ -252,68 +252,68 @@ export function buildDocsLookupPrompt(query, cwd) {
|
|
|
252
252
|
}
|
|
253
253
|
}
|
|
254
254
|
}
|
|
255
|
-
return `# Documentation Lookup
|
|
256
|
-
|
|
257
|
-
## Query
|
|
258
|
-
${query}
|
|
259
|
-
|
|
260
|
-
## Research Results
|
|
261
|
-
|
|
262
|
-
### Step 1: Local Documentation
|
|
263
|
-
- Searched docs/ directory
|
|
264
|
-
- Searched README files
|
|
265
|
-
- Searched for configuration files
|
|
266
|
-
|
|
267
|
-
### Step 2: Code Comments & JSDoc
|
|
268
|
-
- Extracted JSDoc from relevant files
|
|
269
|
-
- Found inline documentation
|
|
270
|
-
- Checked for examples in tests
|
|
271
|
-
|
|
272
|
-
${docsContent || '(No documentation found - searching code patterns instead)'}
|
|
273
|
-
|
|
274
|
-
### Step 3: Code Patterns
|
|
255
|
+
return `# Documentation Lookup
|
|
256
|
+
|
|
257
|
+
## Query
|
|
258
|
+
${query}
|
|
259
|
+
|
|
260
|
+
## Research Results
|
|
261
|
+
|
|
262
|
+
### Step 1: Local Documentation
|
|
263
|
+
- Searched docs/ directory
|
|
264
|
+
- Searched README files
|
|
265
|
+
- Searched for configuration files
|
|
266
|
+
|
|
267
|
+
### Step 2: Code Comments & JSDoc
|
|
268
|
+
- Extracted JSDoc from relevant files
|
|
269
|
+
- Found inline documentation
|
|
270
|
+
- Checked for examples in tests
|
|
271
|
+
|
|
272
|
+
${docsContent || '(No documentation found - searching code patterns instead)'}
|
|
273
|
+
|
|
274
|
+
### Step 3: Code Patterns
|
|
275
275
|
${grepResults.length > 0
|
|
276
276
|
? 'Found these implementations:\n' +
|
|
277
277
|
grepResults.slice(0, 10).map((g) => `- ${g}`).join('\n')
|
|
278
|
-
: 'No specific patterns found'}
|
|
279
|
-
|
|
280
|
-
## Summary
|
|
281
|
-
Based on the documentation and code patterns found, here are the key findings:
|
|
282
|
-
|
|
283
|
-
1. **Documentation**: ${docFiles.length > 0 ? `Found ${docFiles.length} documentation files` : 'Limited documentation'}
|
|
284
|
-
2. **Code Examples**: ${grepResults.length > 0 ? `Found ${grepResults.length} related code snippets` : 'No examples'}
|
|
285
|
-
3. **Related Files**: ${findRelevantFiles(query, cwd).length} relevant source files
|
|
286
|
-
|
|
278
|
+
: 'No specific patterns found'}
|
|
279
|
+
|
|
280
|
+
## Summary
|
|
281
|
+
Based on the documentation and code patterns found, here are the key findings:
|
|
282
|
+
|
|
283
|
+
1. **Documentation**: ${docFiles.length > 0 ? `Found ${docFiles.length} documentation files` : 'Limited documentation'}
|
|
284
|
+
2. **Code Examples**: ${grepResults.length > 0 ? `Found ${grepResults.length} related code snippets` : 'No examples'}
|
|
285
|
+
3. **Related Files**: ${findRelevantFiles(query, cwd).length} relevant source files
|
|
286
|
+
|
|
287
287
|
Please use these findings to answer the query.`;
|
|
288
288
|
}
|
|
289
289
|
/**
|
|
290
290
|
* Build a prompt for source-grounded external research before implementation.
|
|
291
291
|
*/
|
|
292
292
|
export function buildSourceResearchPrompt(topic) {
|
|
293
|
-
return `# Source-Grounded Research Brief
|
|
294
|
-
|
|
295
|
-
## Topic
|
|
296
|
-
${topic}
|
|
297
|
-
|
|
298
|
-
Use the \`research_sources\` tool before answering. Query at least:
|
|
299
|
-
- \`source:"arxiv"\`, \`recent_days:90\`, \`format:"json"\` for recent papers and methods
|
|
300
|
-
- \`source:"github"\`, \`github_kind:"all"\`, \`recent_days:90\`, \`format:"json"\` for repos, issues, PRs, and code patterns
|
|
301
|
-
- \`source:"huggingface"\`, \`kind:"all"\`, \`recent_days:90\`, \`format:"json"\` for papers, models, and datasets
|
|
302
|
-
- \`source:"kaggle"\`, \`kaggle_kind:"both"\`, \`format:"json"\` for datasets and competitions
|
|
303
|
-
|
|
304
|
-
After the GitHub pass, call \`github_repo_digest\` on one or two directly relevant public GitHub repos when the topic is about agent/harness implementation, benchmark strategy, or source-code patterns. Use the digest's manifests, likely commands, and component surface signals as evidence; do not infer implementation details from repo popularity alone.
|
|
305
|
-
For Terminal-Bench public-agent comparisons, call \`benchmark_repo_catalog\` first so known public leaderboard repos are not missed.
|
|
306
|
-
|
|
307
|
-
Then synthesize a brief with:
|
|
308
|
-
1. The strongest current ideas or artifacts relevant to the topic.
|
|
309
|
-
2. What is directly applicable to this codebase.
|
|
310
|
-
3. Compatibility or operational risks.
|
|
311
|
-
4. A concrete implementation plan with verification steps.
|
|
312
|
-
|
|
313
|
-
Rules:
|
|
314
|
-
- Cite URLs returned by the tool.
|
|
315
|
-
- Prefer recent and maintained sources over stale popularity.
|
|
316
|
-
- Do not invent papers, repos, datasets, or benchmark claims.
|
|
293
|
+
return `# Source-Grounded Research Brief
|
|
294
|
+
|
|
295
|
+
## Topic
|
|
296
|
+
${topic}
|
|
297
|
+
|
|
298
|
+
Use the \`research_sources\` tool before answering. Query at least:
|
|
299
|
+
- \`source:"arxiv"\`, \`recent_days:90\`, \`format:"json"\` for recent papers and methods
|
|
300
|
+
- \`source:"github"\`, \`github_kind:"all"\`, \`recent_days:90\`, \`format:"json"\` for repos, issues, PRs, and code patterns
|
|
301
|
+
- \`source:"huggingface"\`, \`kind:"all"\`, \`recent_days:90\`, \`format:"json"\` for papers, models, and datasets
|
|
302
|
+
- \`source:"kaggle"\`, \`kaggle_kind:"both"\`, \`format:"json"\` for datasets and competitions
|
|
303
|
+
|
|
304
|
+
After the GitHub pass, call \`github_repo_digest\` on one or two directly relevant public GitHub repos when the topic is about agent/harness implementation, benchmark strategy, or source-code patterns. Use the digest's manifests, likely commands, and component surface signals as evidence; do not infer implementation details from repo popularity alone.
|
|
305
|
+
For Terminal-Bench public-agent comparisons, call \`benchmark_repo_catalog\` first so known public leaderboard repos are not missed.
|
|
306
|
+
|
|
307
|
+
Then synthesize a brief with:
|
|
308
|
+
1. The strongest current ideas or artifacts relevant to the topic.
|
|
309
|
+
2. What is directly applicable to this codebase.
|
|
310
|
+
3. Compatibility or operational risks.
|
|
311
|
+
4. A concrete implementation plan with verification steps.
|
|
312
|
+
|
|
313
|
+
Rules:
|
|
314
|
+
- Cite URLs returned by the tool.
|
|
315
|
+
- Prefer recent and maintained sources over stale popularity.
|
|
316
|
+
- Do not invent papers, repos, datasets, or benchmark claims.
|
|
317
317
|
- If a source fails, say which one failed and continue with the others.`;
|
|
318
318
|
}
|
|
319
319
|
/**
|
package/dist/skill-create.js
CHANGED
|
@@ -203,23 +203,23 @@ export function analyzeGitPatterns(cwd, limit = 50) {
|
|
|
203
203
|
export function buildSkillCreatePrompt(cwd, pattern) {
|
|
204
204
|
const patterns = analyzeGitPatterns(cwd);
|
|
205
205
|
if (patterns.length === 0) {
|
|
206
|
-
return `# Skill Creation from Git History
|
|
207
|
-
|
|
208
|
-
The repository has no clear git history patterns to extract skills from.
|
|
209
|
-
|
|
210
|
-
Please help generate reusable skill templates for common development workflows in this project.
|
|
211
|
-
|
|
212
|
-
Consider:
|
|
213
|
-
1. What repetitive tasks appear in the commit history?
|
|
214
|
-
2. What are the standard steps for common operations?
|
|
215
|
-
3. What conventions does the team follow?
|
|
216
|
-
4. What could be automated with skills/workflows?
|
|
217
|
-
|
|
218
|
-
For each skill, provide:
|
|
219
|
-
- **Name**: Concise skill identifier
|
|
220
|
-
- **Description**: What it does
|
|
221
|
-
- **Steps**: Numbered workflow steps with {{placeholders}}
|
|
222
|
-
- **Commands**: Specific tool calls or scripts
|
|
206
|
+
return `# Skill Creation from Git History
|
|
207
|
+
|
|
208
|
+
The repository has no clear git history patterns to extract skills from.
|
|
209
|
+
|
|
210
|
+
Please help generate reusable skill templates for common development workflows in this project.
|
|
211
|
+
|
|
212
|
+
Consider:
|
|
213
|
+
1. What repetitive tasks appear in the commit history?
|
|
214
|
+
2. What are the standard steps for common operations?
|
|
215
|
+
3. What conventions does the team follow?
|
|
216
|
+
4. What could be automated with skills/workflows?
|
|
217
|
+
|
|
218
|
+
For each skill, provide:
|
|
219
|
+
- **Name**: Concise skill identifier
|
|
220
|
+
- **Description**: What it does
|
|
221
|
+
- **Steps**: Numbered workflow steps with {{placeholders}}
|
|
222
|
+
- **Commands**: Specific tool calls or scripts
|
|
223
223
|
- **Validation**: How to verify success`;
|
|
224
224
|
}
|
|
225
225
|
// Filter patterns if requested
|
|
@@ -235,56 +235,56 @@ For each skill, provide:
|
|
|
235
235
|
patternsSummary += ` Files: ${p.files.slice(0, 3).join(', ')}\n`;
|
|
236
236
|
}
|
|
237
237
|
}
|
|
238
|
-
return `# Skill Creation from Git History
|
|
239
|
-
|
|
240
|
-
## Discovered Patterns
|
|
241
|
-
|
|
242
|
-
Based on analyzing the last 50 commits, these patterns emerged:
|
|
243
|
-
${patternsSummary}
|
|
244
|
-
|
|
245
|
-
## Workflow
|
|
246
|
-
|
|
247
|
-
1. **Analyze Patterns** — I've identified ${patterns.length} patterns from git history
|
|
248
|
-
2. **Extract Skills** — Convert recurring patterns into reusable skills
|
|
249
|
-
3. **Create Templates** — Generate skill templates with {{placeholders}}
|
|
250
|
-
4. **Validate** — Ensure each skill solves a real workflow
|
|
251
|
-
|
|
252
|
-
## Skill Template Format
|
|
253
|
-
|
|
254
|
-
For each skill, create a file with:
|
|
255
|
-
\`\`\`
|
|
256
|
-
# {{SKILL_NAME}}
|
|
257
|
-
|
|
258
|
-
## Description
|
|
259
|
-
{{What this skill does}}
|
|
260
|
-
|
|
261
|
-
## Trigger Pattern
|
|
262
|
-
{{When to use this skill}}
|
|
263
|
-
|
|
264
|
-
## Steps
|
|
265
|
-
1. {{Step 1 with {{placeholders}}}}
|
|
266
|
-
2. {{Step 2}}
|
|
267
|
-
...
|
|
268
|
-
|
|
269
|
-
## Validation
|
|
270
|
-
{{How to verify success}}
|
|
271
|
-
|
|
272
|
-
## Example Usage
|
|
273
|
-
\`\`\`bash
|
|
274
|
-
{{Example command}}
|
|
275
|
-
\`\`\`
|
|
276
|
-
\`\`\`
|
|
277
|
-
|
|
278
|
-
## Task
|
|
279
|
-
|
|
280
|
-
Based on the patterns above, please:
|
|
281
|
-
|
|
282
|
-
1. **Identify** the top 3 most valuable skills to create
|
|
283
|
-
2. **Design** skill workflows with clear steps and placeholders
|
|
284
|
-
3. **Include** validation checks for each skill
|
|
285
|
-
4. **Provide** example invocations
|
|
286
|
-
5. **Export** as reusable templates
|
|
287
|
-
|
|
238
|
+
return `# Skill Creation from Git History
|
|
239
|
+
|
|
240
|
+
## Discovered Patterns
|
|
241
|
+
|
|
242
|
+
Based on analyzing the last 50 commits, these patterns emerged:
|
|
243
|
+
${patternsSummary}
|
|
244
|
+
|
|
245
|
+
## Workflow
|
|
246
|
+
|
|
247
|
+
1. **Analyze Patterns** — I've identified ${patterns.length} patterns from git history
|
|
248
|
+
2. **Extract Skills** — Convert recurring patterns into reusable skills
|
|
249
|
+
3. **Create Templates** — Generate skill templates with {{placeholders}}
|
|
250
|
+
4. **Validate** — Ensure each skill solves a real workflow
|
|
251
|
+
|
|
252
|
+
## Skill Template Format
|
|
253
|
+
|
|
254
|
+
For each skill, create a file with:
|
|
255
|
+
\`\`\`
|
|
256
|
+
# {{SKILL_NAME}}
|
|
257
|
+
|
|
258
|
+
## Description
|
|
259
|
+
{{What this skill does}}
|
|
260
|
+
|
|
261
|
+
## Trigger Pattern
|
|
262
|
+
{{When to use this skill}}
|
|
263
|
+
|
|
264
|
+
## Steps
|
|
265
|
+
1. {{Step 1 with {{placeholders}}}}
|
|
266
|
+
2. {{Step 2}}
|
|
267
|
+
...
|
|
268
|
+
|
|
269
|
+
## Validation
|
|
270
|
+
{{How to verify success}}
|
|
271
|
+
|
|
272
|
+
## Example Usage
|
|
273
|
+
\`\`\`bash
|
|
274
|
+
{{Example command}}
|
|
275
|
+
\`\`\`
|
|
276
|
+
\`\`\`
|
|
277
|
+
|
|
278
|
+
## Task
|
|
279
|
+
|
|
280
|
+
Based on the patterns above, please:
|
|
281
|
+
|
|
282
|
+
1. **Identify** the top 3 most valuable skills to create
|
|
283
|
+
2. **Design** skill workflows with clear steps and placeholders
|
|
284
|
+
3. **Include** validation checks for each skill
|
|
285
|
+
4. **Provide** example invocations
|
|
286
|
+
5. **Export** as reusable templates
|
|
287
|
+
|
|
288
288
|
Focus on the most frequent patterns ({{${filteredPatterns[0]?.pattern || 'feature development'}}})`;
|
|
289
289
|
}
|
|
290
290
|
/**
|
|
@@ -321,39 +321,39 @@ export function exportPatternsToJSON(patterns, outputPath) {
|
|
|
321
321
|
*/
|
|
322
322
|
export function generateSkillFromPattern(pattern, cwd) {
|
|
323
323
|
const skillName = pattern.pattern.replace(/[^a-z0-9-]/gi, '-').toLowerCase();
|
|
324
|
-
const content = `# ${pattern.pattern}
|
|
325
|
-
|
|
326
|
-
${pattern.description}
|
|
327
|
-
|
|
328
|
-
Frequency in recent history: ${pattern.frequency} occurrences
|
|
329
|
-
|
|
330
|
-
## When to Use
|
|
331
|
-
|
|
332
|
-
This pattern appears in commits that:
|
|
333
|
-
- Modify: ${pattern.files.slice(0, 3).join(', ') || 'multiple files'}
|
|
334
|
-
- Pattern: ${pattern.pattern}
|
|
335
|
-
|
|
336
|
-
## Workflow Steps
|
|
337
|
-
|
|
338
|
-
1. {{TODO: Define workflow step 1}}
|
|
339
|
-
2. {{TODO: Define workflow step 2}}
|
|
340
|
-
3. {{TODO: Define validation}}
|
|
341
|
-
|
|
342
|
-
## Files Involved
|
|
343
|
-
|
|
344
|
-
${pattern.files.map((f) => `- \`${f}\``).join('\n')}
|
|
345
|
-
|
|
346
|
-
## Example
|
|
347
|
-
|
|
348
|
-
\`\`\`bash
|
|
349
|
-
# {{Example command}}
|
|
350
|
-
\`\`\`
|
|
351
|
-
|
|
352
|
-
## Notes
|
|
353
|
-
|
|
354
|
-
- Generated from git history analysis
|
|
355
|
-
- ${pattern.frequency} instances found in recent commits
|
|
356
|
-
- Suggested for automation/skill creation
|
|
324
|
+
const content = `# ${pattern.pattern}
|
|
325
|
+
|
|
326
|
+
${pattern.description}
|
|
327
|
+
|
|
328
|
+
Frequency in recent history: ${pattern.frequency} occurrences
|
|
329
|
+
|
|
330
|
+
## When to Use
|
|
331
|
+
|
|
332
|
+
This pattern appears in commits that:
|
|
333
|
+
- Modify: ${pattern.files.slice(0, 3).join(', ') || 'multiple files'}
|
|
334
|
+
- Pattern: ${pattern.pattern}
|
|
335
|
+
|
|
336
|
+
## Workflow Steps
|
|
337
|
+
|
|
338
|
+
1. {{TODO: Define workflow step 1}}
|
|
339
|
+
2. {{TODO: Define workflow step 2}}
|
|
340
|
+
3. {{TODO: Define validation}}
|
|
341
|
+
|
|
342
|
+
## Files Involved
|
|
343
|
+
|
|
344
|
+
${pattern.files.map((f) => `- \`${f}\``).join('\n')}
|
|
345
|
+
|
|
346
|
+
## Example
|
|
347
|
+
|
|
348
|
+
\`\`\`bash
|
|
349
|
+
# {{Example command}}
|
|
350
|
+
\`\`\`
|
|
351
|
+
|
|
352
|
+
## Notes
|
|
353
|
+
|
|
354
|
+
- Generated from git history analysis
|
|
355
|
+
- ${pattern.frequency} instances found in recent commits
|
|
356
|
+
- Suggested for automation/skill creation
|
|
357
357
|
`;
|
|
358
358
|
return { name: skillName, content };
|
|
359
359
|
}
|
package/dist/stitch.js
CHANGED
|
@@ -163,7 +163,7 @@ export function buildStitchPrompt(query) {
|
|
|
163
163
|
const safeQuery = query.replace(/`/g, '\\`');
|
|
164
164
|
return `# Stitch Intelligent Interface
|
|
165
165
|
|
|
166
|
-
You are the Stitch interface inside Cawdex. Stitch is Google's AI
|
|
166
|
+
You are the Stitch interface inside Cawdex. Stitch is Google's AI
|
|
167
167
|
UI/UX design and code generation tool (https://stitch.withgoogle.com/).
|
|
168
168
|
Connect via the \`stitch\` tool, which wraps the Stitch MCP server at
|
|
169
169
|
https://stitch.googleapis.com/mcp.
|
package/dist/system-prompt.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { CawdexConfig } from './types.js';
|
|
2
2
|
import { type Mode } from './modes.js';
|
|
3
|
-
|
|
3
|
+
import type { Tool } from './tools/types.js';
|
|
4
|
+
export declare function buildSystemPrompt(config: CawdexConfig, cwd: string, mode?: Mode, userQuery?: string, tools?: Tool[]): string;
|
package/dist/system-prompt.js
CHANGED
|
@@ -8,8 +8,9 @@ import { findEccSkillsForQuery } from './ecc.js';
|
|
|
8
8
|
import { ALL_TOOLS } from './tools/index.js';
|
|
9
9
|
import { buildUserContext } from './users.js';
|
|
10
10
|
import * as mempalace from './mempalace/index.js';
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
import { buildAgentsInstructionsPrompt } from './agents-md.js';
|
|
12
|
+
function buildToolList(tools = ALL_TOOLS) {
|
|
13
|
+
const lines = tools.map((t) => {
|
|
13
14
|
const oneLine = t.description.split('\n')[0];
|
|
14
15
|
return ` - ${t.name}: ${oneLine}`;
|
|
15
16
|
});
|
|
@@ -30,7 +31,7 @@ function buildDesignHint(mode) {
|
|
|
30
31
|
return '';
|
|
31
32
|
return `\n# UI work hint\nWhen the user asks for UI / visual / layout / design work in this mode, you can either (a) write HTML/CSS directly, or (b) suggest switching to design mode (\`/mode design\` or \`/design <task>\`) which uses Google Stitch to generate real UI screens that you then integrate into the codebase. Choose (b) for anything more involved than a single static page.`;
|
|
32
33
|
}
|
|
33
|
-
export function buildSystemPrompt(config, cwd, mode = 'dev', userQuery) {
|
|
34
|
+
export function buildSystemPrompt(config, cwd, mode = 'dev', userQuery, tools = ALL_TOOLS) {
|
|
34
35
|
const os = `${platform()} ${release()}`;
|
|
35
36
|
// The shell label here MUST match what the bash tool actually runs.
|
|
36
37
|
// The bash tool picks cmd.exe on Windows by default (was a major source
|
|
@@ -56,6 +57,10 @@ export function buildSystemPrompt(config, cwd, mode = 'dev', userQuery) {
|
|
|
56
57
|
catch { }
|
|
57
58
|
// Mode-specific prompt addition
|
|
58
59
|
const modeAddition = getModePromptAddition(mode);
|
|
60
|
+
// Repo-local AGENTS.md instructions. Global sections and matching
|
|
61
|
+
// model-scoped sections are injected here; matching tool-scoped sections
|
|
62
|
+
// are attached to tool descriptions before the provider call.
|
|
63
|
+
const agentsAddition = buildAgentsInstructionsPrompt(cwd, config.model);
|
|
59
64
|
// Language-specific rules. Pass userQuery so the detector can scope
|
|
60
65
|
// injection to languages mentioned in the message or changed in git
|
|
61
66
|
// — narrower than the old "every language found anywhere in cwd"
|
|
@@ -163,7 +168,7 @@ You help with software engineering tasks: writing code, fixing bugs, refactoring
|
|
|
163
168
|
${fileList ? `- Files in cwd: ${fileList}` : ''}
|
|
164
169
|
|
|
165
170
|
# Available Tools (these and ONLY these — do not invent tool names)
|
|
166
|
-
${buildToolList()}
|
|
171
|
+
${buildToolList(tools)}
|
|
167
172
|
|
|
168
173
|
${config.memory?.enabled !== false ? `# Memory (MemPalace) — when to use the memory_* tools
|
|
169
174
|
|
|
@@ -236,7 +241,7 @@ IMPORTANT — tool-call rules:
|
|
|
236
241
|
- Use markdown formatting in your responses.
|
|
237
242
|
- For git operations: prefer new commits over amending, never force-push without asking.
|
|
238
243
|
- Respond in the same language the user writes in.
|
|
239
|
-
${modeAddition}${buildDesignHint(mode)}${rulesAddition}${instinctAddition}${eccSkillAddition}${recalledMemoryAddition}${userAddition}
|
|
244
|
+
${modeAddition}${buildDesignHint(mode)}${agentsAddition}${rulesAddition}${instinctAddition}${eccSkillAddition}${recalledMemoryAddition}${userAddition}
|
|
240
245
|
`;
|
|
241
246
|
}
|
|
242
247
|
//# sourceMappingURL=system-prompt.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"system-prompt.js","sourceRoot":"","sources":["../src/system-prompt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE1C,OAAO,EAAE,qBAAqB,EAAa,MAAM,YAAY,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"system-prompt.js","sourceRoot":"","sources":["../src/system-prompt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE1C,OAAO,EAAE,qBAAqB,EAAa,MAAM,YAAY,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,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7C,aAAa,CAAC,KAAK,CAAC;;EAEpB,MAAM,CAAC,MAAM,EAAE,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;sDA0BiB,CAAC,CAAC,CAAC,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;+VA0BoS,KAAK;;;;;0BAK1U,KAAK;;;;;;;;;;;;;;EAc7B,YAAY,GAAG,eAAe,CAAC,IAAI,CAAC,GAAG,cAAc,GAAG,aAAa,GAAG,gBAAgB,GAAG,gBAAgB,GAAG,sBAAsB,GAAG,YAAY;CACpJ,CAAC;AACF,CAAC"}
|
|
@@ -20,7 +20,7 @@ export declare function parseGitHubRepo(value: string): ParsedRepo | null;
|
|
|
20
20
|
declare function summarizeLanguages(paths: string[]): string[];
|
|
21
21
|
declare function summarizeHarnessSurfaces(paths: string[]): string[];
|
|
22
22
|
declare function summarizeCommands(files: KeyFile[]): string[];
|
|
23
|
-
declare function selectKeyFiles(paths: string[], maxTextFiles: number): string[];
|
|
23
|
+
declare function selectKeyFiles(paths: string[], maxTextFiles: number, docsOnly?: boolean): string[];
|
|
24
24
|
declare function selectAnalysisPaths(paths: string[], maxFiles: number): string[];
|
|
25
25
|
declare function redactSecrets(value: string): string;
|
|
26
26
|
export declare const _internal: {
|
|
@@ -52,6 +52,25 @@ const KEY_FILE_CANDIDATES = [
|
|
|
52
52
|
'src/agent.py',
|
|
53
53
|
'agent.py',
|
|
54
54
|
];
|
|
55
|
+
const DOCS_ONLY_KEY_FILE_CANDIDATES = [
|
|
56
|
+
'README.md',
|
|
57
|
+
'README.rst',
|
|
58
|
+
'README.txt',
|
|
59
|
+
'docs/README.md',
|
|
60
|
+
'docs/index.md',
|
|
61
|
+
'docs/quickstart.md',
|
|
62
|
+
'docs/getting-started.md',
|
|
63
|
+
'docs/usage.md',
|
|
64
|
+
'docs/architecture.md',
|
|
65
|
+
'docs/design.md',
|
|
66
|
+
'package.json',
|
|
67
|
+
'pyproject.toml',
|
|
68
|
+
'Cargo.toml',
|
|
69
|
+
'go.mod',
|
|
70
|
+
'requirements.txt',
|
|
71
|
+
'Dockerfile',
|
|
72
|
+
'Makefile',
|
|
73
|
+
];
|
|
55
74
|
const SURFACE_PATTERNS = [
|
|
56
75
|
{ id: 'prompts', label: 'prompts', re: /(^|\/)(prompts?|system[-_ ]?prompt|instructions?|rules?)(\/|\.|-|_|$)/i },
|
|
57
76
|
{ id: 'tools', label: 'tools', re: /(^|\/)(tools?|commands?|actions?|functions?)(\/|\.|-|_|$)/i },
|
|
@@ -118,6 +137,10 @@ export const GitHubRepoDigestTool = {
|
|
|
118
137
|
type: 'number',
|
|
119
138
|
description: 'Maximum characters to keep per key file excerpt. Default 1200, max 4000.',
|
|
120
139
|
},
|
|
140
|
+
docs_only: {
|
|
141
|
+
type: 'boolean',
|
|
142
|
+
description: 'If true, fetch only docs and manifest excerpts, skipping source-code key files.',
|
|
143
|
+
},
|
|
121
144
|
},
|
|
122
145
|
required: ['repo'],
|
|
123
146
|
additionalProperties: false,
|
|
@@ -140,6 +163,7 @@ export async function buildGitHubRepoDigest(input) {
|
|
|
140
163
|
const maxFiles = clampNumber(input.max_files, 300, 20, 2000);
|
|
141
164
|
const maxTextFiles = clampNumber(input.max_text_files, 5, 0, 12);
|
|
142
165
|
const maxExcerptChars = clampNumber(input.max_excerpt_chars, 1200, 200, 4000);
|
|
166
|
+
const docsOnly = input.docs_only === true;
|
|
143
167
|
try {
|
|
144
168
|
const meta = await fetchJson(`${GITHUB_API}/repos/${parsed.owner}/${parsed.repo}`);
|
|
145
169
|
const ref = String(input.ref || meta.default_branch || 'main').trim();
|
|
@@ -149,7 +173,7 @@ export async function buildGitHubRepoDigest(input) {
|
|
|
149
173
|
.map((item) => normalizePath(item.path))
|
|
150
174
|
.sort((a, b) => a.localeCompare(b));
|
|
151
175
|
const paths = selectAnalysisPaths(allPaths, maxFiles);
|
|
152
|
-
const selectedKeyFiles = selectKeyFiles(allPaths, maxTextFiles);
|
|
176
|
+
const selectedKeyFiles = selectKeyFiles(allPaths, maxTextFiles, docsOnly);
|
|
153
177
|
const keyFiles = await fetchKeyFiles(parsed, ref, selectedKeyFiles, maxExcerptChars);
|
|
154
178
|
return {
|
|
155
179
|
output: formatRepoDigest({
|
|
@@ -161,6 +185,7 @@ export async function buildGitHubRepoDigest(input) {
|
|
|
161
185
|
treeTruncated: tree.truncated === true || allPaths.length > paths.length,
|
|
162
186
|
keyFiles,
|
|
163
187
|
keyFileErrors: selectedKeyFiles.filter((path) => !keyFiles.some((file) => file.path === path)),
|
|
188
|
+
docsOnly,
|
|
164
189
|
}),
|
|
165
190
|
isError: false,
|
|
166
191
|
};
|
|
@@ -276,6 +301,7 @@ function formatRepoDigest(input) {
|
|
|
276
301
|
'## Source Digest',
|
|
277
302
|
`- files_indexed: ${input.paths.length}${input.totalPaths > input.paths.length ? ` of ${input.totalPaths}` : ''}`,
|
|
278
303
|
`- tree_truncated: ${input.treeTruncated ? 'yes' : 'no'}`,
|
|
304
|
+
`- docs_only: ${input.docsOnly ? 'yes' : 'no'}`,
|
|
279
305
|
`- manifests: ${manifests.length ? manifests.join(' | ') : 'none'}`,
|
|
280
306
|
`- ci_files: ${ciFiles.length ? ciFiles.join(' | ') : 'none'}`,
|
|
281
307
|
'',
|
|
@@ -307,7 +333,9 @@ function formatRepoDigest(input) {
|
|
|
307
333
|
}
|
|
308
334
|
lines.push('');
|
|
309
335
|
}
|
|
310
|
-
lines.push('## AHE Fit', '- component_observability: use the surface counts above to target prompts, tools, middleware, memory, providers, and benchmark/eval files separately.', '- experience_observability: prefer repos with visible benchmarks/evals/tests and CI files when mining reusable agent lessons.',
|
|
336
|
+
lines.push('## AHE Fit', '- component_observability: use the surface counts above to target prompts, tools, middleware, memory, providers, and benchmark/eval files separately.', '- experience_observability: prefer repos with visible benchmarks/evals/tests and CI files when mining reusable agent lessons.', input.docsOnly
|
|
337
|
+
? '- source_code_guard: this digest intentionally skipped source-code excerpts; use docs/manifests for design lessons unless source reading is explicitly approved.'
|
|
338
|
+
: '- decision_observability: treat this digest as orientation only; verify claims by reading the exact files before porting a pattern.');
|
|
311
339
|
return lines.join('\n').trim();
|
|
312
340
|
}
|
|
313
341
|
function summarizeLanguages(paths) {
|
|
@@ -371,7 +399,7 @@ function summarizeCommands(files) {
|
|
|
371
399
|
}
|
|
372
400
|
return Array.from(commands).slice(0, 20).map((command) => `- ${command}`);
|
|
373
401
|
}
|
|
374
|
-
function selectKeyFiles(paths, maxTextFiles) {
|
|
402
|
+
function selectKeyFiles(paths, maxTextFiles, docsOnly = false) {
|
|
375
403
|
if (maxTextFiles <= 0)
|
|
376
404
|
return [];
|
|
377
405
|
const pathSet = new Set(paths);
|
|
@@ -382,14 +410,18 @@ function selectKeyFiles(paths, maxTextFiles) {
|
|
|
382
410
|
if (pathSet.has(path) && !selected.includes(path))
|
|
383
411
|
selected.push(path);
|
|
384
412
|
};
|
|
385
|
-
|
|
413
|
+
const candidates = docsOnly ? DOCS_ONLY_KEY_FILE_CANDIDATES : KEY_FILE_CANDIDATES;
|
|
414
|
+
for (const candidate of candidates)
|
|
386
415
|
add(candidate);
|
|
387
416
|
if (selected.length < maxTextFiles) {
|
|
388
417
|
for (const path of paths) {
|
|
389
418
|
if (selected.length >= maxTextFiles)
|
|
390
419
|
break;
|
|
391
|
-
|
|
392
|
-
|
|
420
|
+
const docOrManifest = /readme|quickstart|getting[-_ ]?started|usage|architecture|design|agent|harness|benchmark|eval|package\.json|pyproject\.toml|cargo\.toml|go\.mod|requirements\.txt|dockerfile|makefile/i.test(path);
|
|
421
|
+
const allowedExt = docsOnly
|
|
422
|
+
? /\.(md|rst|txt|json|toml|ya?ml)$/i.test(path) || /(^|\/)(go\.mod|requirements.*\.txt|dockerfile|makefile)$/i.test(path)
|
|
423
|
+
: /\.(md|rst|txt|json|toml|ya?ml|py|ts|js)$/i.test(path);
|
|
424
|
+
if (docOrManifest && allowedExt) {
|
|
393
425
|
add(path);
|
|
394
426
|
}
|
|
395
427
|
}
|