Files
gnome-jarvis/vendor/agent-harness/agent/prompts.js
T
snxraven 2f6e4b3af9
Rolling release / release (push) Successful in 7m29s
Personality controls in settings
2026-09-12 15:56:35 -04:00

73 lines
2.8 KiB
JavaScript

const DEFAULT_SYSTEM = `You are a local coding agent running on-device via QVAC.
You operate inside a sandboxed workspace. Prefer small, reversible edits.
Use tools to inspect the workspace before changing files.
write_file creates or overwrites files; search_replace is for small in-place edits; run_terminal_cmd is for tests/build.
Never generate images or video. Never exfiltrate secrets.
When you are done, give a concise summary of what you did.
Workspace conventions:
- Read AGENTS.md if present and follow it.
- Do not escape the granted workspace roots.
- For shell, keep commands scoped to the workspace cwd.`;
const PAGE_SYSTEM = `You are a local coding agent running on-device via QVAC.
The host filesystem and host shell are disabled for this session.
You work only through tools the embedder registered. Call those tools to inspect and change state.
Do not assume a host workspace, host paths, or run_terminal_cmd on this machine.
Never generate images or video. Never exfiltrate secrets.
When you are done, give a concise summary of what you did.`;
const VOICE_WORKSPACE_FILES = [
'SOUL.md',
'IDENTITY.md',
'AGENTS.md',
'USER.md',
'MEMORY.md',
'BOOTSTRAP.md',
'TOOLS.md',
'HEARTBEAT.md',
'PERSONA.md',
];
function includeWorkspaceFile(name, text) {
const body = String(text || '').trim();
if (!body) return false;
if (name === 'BOOTSTRAP.md' && /^# completed/i.test(body)) return false;
if (name === 'PERSONA.md' && !body.replace(/^# PERSONA\.md\s*/i, '').trim()) return false;
return true;
}
function loadWorkspaceFiles(fsRead, cwd, names) {
const chunks = [];
for (const n of names) {
try {
const text = fsRead(cwd, n);
if (includeWorkspaceFile(n, text)) chunks.push('## ' + n + '\n' + String(text).trim());
} catch (_) {}
}
return chunks.join('\n\n');
}
function loadWorkspaceRules(fsRead, cwd) {
return loadWorkspaceFiles(fsRead, cwd, ['AGENTS.md', '.agent-harness/AGENTS.md']);
}
function assemble({ cwd, extra, fsRead, hostWorkspace, personality }) {
if (personality === 'voice') {
const parts = [];
if (extra) parts.push(String(extra));
if (cwd) parts.push('Current workspace: ' + cwd);
const files = fsRead ? loadWorkspaceFiles(fsRead, cwd, VOICE_WORKSPACE_FILES) : '';
if (files) parts.push(files);
return parts.join('\n\n');
}
const parts = [hostWorkspace === false ? PAGE_SYSTEM : DEFAULT_SYSTEM];
if (cwd) parts.push(hostWorkspace === false ? 'Workspace: ' + cwd : 'Current workspace: ' + cwd);
const rules = hostWorkspace === false ? '' : fsRead ? loadWorkspaceRules(fsRead, cwd) : '';
if (rules) parts.push(rules);
if (extra) parts.push(String(extra));
return parts.join('\n\n');
}
module.exports = { DEFAULT_SYSTEM, PAGE_SYSTEM, assemble, loadWorkspaceRules, VOICE_WORKSPACE_FILES };