#!/usr/bin/env node /** * Print a sample agent workspace system prompt from repo templates (host Node). * Does not use Hyperdrive — reads packages/bare-os-coreutils/share/agent-workspace/*.md * * Usage: node scripts/print-agent-workspace-sample.mjs */ import { readFile, readdir } from 'node:fs/promises' import { dirname, join } from 'node:path' import { fileURLToPath } from 'node:url' const root = dirname(fileURLToPath(import.meta.url)) const share = join( root, '..', 'packages', 'bare-os-coreutils', 'share', 'agent-workspace' ) const files = [ 'SOUL.md', 'AGENTS.md', 'IDENTITY.md', 'USER.md', 'TOOLS.md', 'MEMORY.md', 'BOOTSTRAP.md', 'HEARTBEAT.md', 'PROMPT.md' ] let out = '# Sample agent workspace (from repo share)\n\n' for (const name of files) { try { const t = (await readFile(join(share, name), 'utf8')).trim() out += '=== ' + name + ' ===\n' + t + '\n\n' } catch { out += '=== ' + name + ' ===\n(File not found)\n\n' } } out += '## Sample skills index (from repo share)\n\n' try { const skillsRoot = join(share, 'skills') const entries = await readdir(skillsRoot) for (const id of entries.sort()) { if (id.startsWith('.')) continue try { const raw = await readFile(join(skillsRoot, id, 'SKILL.md'), 'utf8') const desc = raw.match(/^description:\s*(.+)$/im)?.[1]?.trim() || '(no description line)' out += '- **' + id + '** — ' + desc + '\n' } catch { /* not a skill folder */ } } } catch { out += '(skills/ not found)\n' } out += '\n(Full SKILL.md: use read_skill in /bin/agent, or open files under share/agent-workspace/skills/.)\n\n' process.stdout.write(out.slice(0, 6000)) if (out.length > 6000) process.stdout.write('\n… truncated for terminal\n')