Further Agent updates

This commit is contained in:
2026-08-18 15:51:13 -04:00
parent a94de5be1d
commit 2ad8ae1666
22 changed files with 3043 additions and 60 deletions
+17 -1
View File
@@ -102,6 +102,22 @@ async function bareAgentDiscoverSkills(ctx, paths) {
}
await scanRoot(paths.workspaceSkills, 'workspace')
await scanRoot(paths.skillsGlobal, 'global')
let extras = Array.isArray(paths.extraSkillRoots) ? paths.extraSkillRoots : []
if (!extras.length && typeof bareAgentDiscoverProjectSkillRoots === 'function') {
const env =
ctx.env && typeof ctx.env === 'object'
? /** @type {Record<string, string>} */ (ctx.env)
: {}
const start = String(env.PWD || env.CWD || env.HOME || '').trim()
if (start) extras = await bareAgentDiscoverProjectSkillRoots(ctx, start)
}
for (let i = 0; i < extras.length; i++) {
const item = extras[i]
const root = typeof item === 'string' ? item : String((item && item.path) || '')
const source =
typeof item === 'object' && item && item.source ? String(item.source) : 'project'
if (root) await scanRoot(root, source)
}
return out
}
@@ -117,7 +133,7 @@ async function bareAgentSkillsCompactPrompt(ctx, paths, maxChars) {
let block =
'## Available skills (compact index)\n' +
'Each skill is a directory with **SKILL.md** (optional YAML frontmatter: `name`, `description`, …).\n' +
'**Workspace skills** (`~/.agent/workspace/skills/`) override **global** (`~/.agent/skills/`) when names match.\n' +
'**Workspace skills** (`~/.agent/workspace/skills/`) override **global** (`~/.agent/skills/`) and walk-up `.grok/skills` / `.agents/skills` when names match.\n' +
'To run one: call the **read_skill** tool with the skill id or frontmatter `name` before following its instructions.\n\n'
if (!skills.length) {
block += '(No skills discovered yet — add folders under `workspace/skills/<id>/SKILL.md`.)\n'