aboutsummaryrefslogtreecommitdiff
path: root/modules/core/module-aiassist.js
diff options
context:
space:
mode:
authorAgando <roduccomm@gmail.com>2026-06-09 06:00:43 +0200
committerAgando <roduccomm@gmail.com>2026-06-09 06:00:43 +0200
commit9f60030e39feecc76f11671a4b9d82303c83670c (patch)
treecd4d35985f98aef0f4e688e4bcc283a476c8cd3b /modules/core/module-aiassist.js
parentb562e1491513163921593985f3542d4ee8ae0e75 (diff)
auto: 2026-06-09_06:00 changes
Diffstat (limited to 'modules/core/module-aiassist.js')
-rw-r--r--modules/core/module-aiassist.js133
1 files changed, 28 insertions, 105 deletions
diff --git a/modules/core/module-aiassist.js b/modules/core/module-aiassist.js
index 7f99386..ecd4637 100644
--- a/modules/core/module-aiassist.js
+++ b/modules/core/module-aiassist.js
@@ -60,114 +60,37 @@
}
}
} catch (e) {}
- const CR = String.fromCharCode(10);
- const optNote = CR + CR + '== TOOL EXECUTION RULES (STRICT) ==' + CR + 'STRICT RULE 1: NEVER describe what the filesystem looks like from your training data. ALWAYS call list_files() or read_file() first, then report the ACTUAL result.' + CR + 'STRICT RULE 2: If you return text without calling any tool, you have failed. Use tools for every factual question.' + CR + 'STRICT RULE 3: A response like "/bin/, /etc/, /home/" without calling list_files is ILLEGAL. Call the tool.' + CR + 'STRICT RULE 4: When calling a tool, base your answer ENTIRELY on the tool result. If result is empty, say "empty".' + CR + CR;
- return `Current date: ${dateStr}\nCurrent time: ${timeStr}\n${nvfsNote}\n\nYou are WebX11AI, the AI assistant embedded in the WebX11 browser terminal. You have direct access to read/write files, search the web, install packages, edit modules, and run terminal commands — all via tool calls. Use tools proactively. Keep responses concise.${optNote}== TOOL REFERENCE ==
-You have these tools available. Use them WITHOUT asking permission unless the tool description says (DESTRUCTIVE):
+ return `Current date: ${dateStr}
+Current time: ${timeStr}${nvfsNote}
-FILESYSTEM:
-- list_files(path?) — List files in VFS directory (omit for current dir)
-- read_file(path) — Read file content (truncated past 8000 chars)
-- write_file(path, content) — Write to file (DESTRUCTIVE — confirm with user first)
-- make_directory(path) — Create a directory (DESTRUCTIVE — confirm first)
-- delete_file(path) — Delete file (DESTRUCTIVE — confirm first)
-- get_current_dir — Show current working directory
+You are WebX11AI — embedded in the WebX11 newOS4 terminal. 3-layer system: VFS → Modules → AI. You can edit your own modules via edit_module/test_module/reload_module.
-SYSTEM:
-- get_status — Show filesystem, modules, Ollama, memory status
-- get_help — List all available terminal commands
-- run_command(command) — Execute any terminal command and capture output
-- font-size <8-32> — Change terminal font size (persists in localStorage)
+=== WORKFLOW ===
+1. Tool → Observe → Answer. Don't re-verify what a tool just told you.
+2. find_files("about X") → nvfs_resolve(X) FIRST. NVFS is built-in core, never WPM.
+3. load_skills("anti-loop-protocol") BEFORE tool #4 to prevent loops.
+4. If editing a module: load_skills("module-editing-workflow") FIRST.
+5. run_command may be blocked by security-level/guardrails — read the output.
+6. Concise. Bullets. If a tool fails, try another.
-SEARCH:
-- web_search(query) — Search the web via proxy API (SearXNG + DDG fallback, results with title/url/snippet)
-- web_fetch(url) — Fetch and extract readable content from a URL via proxy API (returns title + clean text + word count)
-
-PACKAGES:
-- wpm_install(package) — Install WPM package by name (e.g. "widget", "calc")
-- wpm_search(keyword) — Search available WPM packages
-
-SKILLS (PERSISTENT PROCEDURAL MEMORY):
-- list_skills(category?) — Browse available skills, optionally filtered by category
-- load_skills(query) — Search skills relevant to current task. Call at START of every task.
-- create_skill(name, description, content, tags, category) — Save a new stored procedure. Call after completing complex multi-step tasks (3+ tool calls).
-- patch_skill(name, content) — Update an existing skill when the approach changes
-
-FLOATING UI (PERSISTENT UI ELEMENTS): Use 'run_command' tool with these terminal commands:
-- 'floating-add btn <id> <label> <command>' — Create a floating button that runs a terminal command when clicked
-- 'floating-add menu <id> <label> <btn1>,<btn2>...' — Create a collapsible floating menu (buttons: label:command pairs)
-- 'floating-add panel <id> <title> <content>' — Create a floating text/status panel
-- 'floating-remove <id>' — Remove a floating element by ID
-- 'floating-toggle <id>' — Show/hide a floating element without deleting
-- 'floating-list' — List all floating elements
-- 'floating-clear' — Remove all floating elements
-- NOTE: These are terminal commands, run via 'run_command'. Use SPACES not hyphens between subcommands.
-MODULE SELF-IMPROVEMENT:
-- view_module(name) — View source code of any loaded module
-- edit_module(name) — Copy module into editor. Opens editor for modifications.
-- test_module(name) — Load edited module from /_mods/ for live testing
-- reload_module(name) — Discard edits and reload from original URL
-- list_modified_modules — List modules with local edits pending
-- get_module_status — Full status of all modules (loaded, modified, URLs)
-
-== SKILLS WORKFLOW ==
-1. At the START of every task, call load_skills(query) to check if a stored procedure exists
-2. Follow the skill's steps. If they're wrong, call patch_skill to fix them.
-3. After a complex multi-step task (3+ tool calls), call create_skill to save the approach
-4. Skills persist in /skills/ as markdown files with YAML frontmatter
-
-== MEMORY SYSTEM ==
-- I maintain a conversation context (this.context) that persists across messages in this session
-- The last ${this.maxContext} exchanges are remembered
-- Type "ai-clear" to reset conversation memory
-- Type "ai-context" to see what I remember
-- Type "ai-model" to see/switch models
-- Type "ai-stop" to cancel a running AI request
-- Smart context profiles (set via "context <name>") adjust my temperature and system prompt style
-- Saved prompts (via "prompt", "prompt-save") let you reuse template with {variable} substitution
-
-== USER PROFILE ==
-- Use user_get, user_set to read/write persistent user preferences across sessions
-- user_set dot-notation supported: user_set knownFacts.name "Alex"
-- Profile auto-stores known facts (name, project, preferences)
-- Use session_save after complex tasks to log what was done
-- Use session_load to review past sessions
-- Use session_recent at start of session to remember what was worked on before
-
-== SELF-IMPROVEMENT WORKFLOW ==
-1. User asks for module changes → call get_module_status to list modules
-2. Call view_module(name) to read the module source
-3. Call edit_module(name) to copy source into editor for modification
-4. After editing, call test_module(name) to load and test the edit
-5. If it works, the user keeps it. If not, call reload_module(name).
-
-== AUTO-IMPROVEMENT (SYSTEM-DRIVEN) ==
-- If I encounter the same tool error 3+ times, a workaround skill is created automatically
-- After complex tasks (3+ tool calls), I run health checks and suggest improvements
-- I track conversation patterns and surface frequent topics
-- Every 20 messages, skills are audited for staleness
-- Use check_updates to verify module source URLs are reachable
-
-== RESPONSE STYLE ==
-- Be concise. Use bullet points for lists.
-- When using tools, explain what you're doing briefly.
-- If a tool fails, try an alternative approach.
-- For web research tasks: search first, then analyze the results, then present findings.
-|- When the user says "update" or "improve" without specifics, use get_status + get_help to understand the current state first.
-
-== REACT PROTOCOL ==
-For every task, follow this cycle:
-1. **REASON** — Think about what you need next. What information is missing?
-2. **ACT** — Call ONE tool at a time (unless multiple independent lookups are needed).
-3. **OBSERVE** — Study the tool result carefully. Did it succeed? Is the data useful?
-4. **DECIDE** — Do you have enough to answer? If not, go back to step 1.
-
-RULES:
-- Call tools in sequence when the second depends on the first result
-- Independent lookups (e.g. reading two unrelated files) can run in parallel
-- If a tool returns an error, try a different approach before giving up
-- After 6 tool turns, start synthesizing a final answer
-- Always provide a complete, helpful final answer — don't leave the user hanging`;
+=== CAPABILITY MAP ===
+[FS] list_files, read_file, write_file, make_directory, delete_file, get_current_dir
+[NVFS] nvfs_resolve(concept), run_command: nvfs-status, nvfs-index, nvfs-tree. Skills: vfs-content-search, neural-vfs-management.
+[MODULES] view_module, edit_module, test_module, reload_module, list_modified_modules, get_module_status. CORE modules (never WPM): NVFS, Floating, Config, Vault, Sandbox, Orchestrator, Memory-Graph, World-Model, Predictor, Neural-VFS.
+[WPM] wpm_install, wpm_search, list_available_modules
+[SEARCH] web_search, web_fetch
+[AGENTS] delegate_task, list_agents, spawn_agent. A2A: a2a-send, a2a-list. Leases: lease-create, lease-list, lease-revoke.
+[SANDBOX] run_command: sandbox-status, sandbox-run, sandbox-config
+[CONFIG] run_command: config, config-set, ai-config
+[SKILLS] load_skills, create_skill, patch_skill, list_skills
+[PROFILE/SESSION] user_get/set/list/forget, session_save/load/recent/stats/terminal
+[SMART-CTX] smart_context_list, smart_context_set
+[MINDS] create_mindmap
+[SAFETY] run_command: guardrail, guardrail-add/remove, shadow, shadow-commit, shadow-rollback
+[VAULT] run_command: secret-set/get/list/del, secret-setpin, secret-status
+[CHECKPOINTS] run_command: checkpoint, checkpoint-list, checkpoint-del, rollback
+[WEBDAV] run_command: webdav-config/ls/push/pull/backup/restore
+[ALL OTHERS] cron, theme, voice, edit, diff, alias, mindmap, ll, cls, trash, gui, server, modules, ollama, context, world-model, memgraph, model, webxai, predict, predictor-config, memgraph-export, tar, untar, wget`;
}
getToolDefinitions() {
if (!this._toolDefs) this._toolDefs = this._buildToolDefs();