Replace repository with DuckLM runtime

This commit is contained in:
2026-05-20 01:00:28 +08:00
parent ddc285b8f4
commit 4a84ada770
190 changed files with 7060 additions and 13602 deletions
-42
View File
@@ -1,42 +0,0 @@
{
"thinker": {
"path": "Qwen3.5-9B-GLM5.1-Distill-v1-Q4_K_M.gguf",
"backend": "vulkan",
"n_gpu_layers": -1,
"max_tokens": 2048,
"temperature": 0.3
},
"json_compiler": {
"path": "gemma-4-E4B-it-Q4_K_M.gguf",
"backend": "cpu",
"n_gpu_layers": 0,
"max_tokens": 1024,
"temperature": 0.1
},
"coder": {
"path": "X-Coder-SFT-Qwen3-8B.Q6_K.gguf",
"backend": "cpu",
"n_gpu_layers": 0,
"max_tokens": 2048,
"temperature": 0.2
},
"critic": {
"path": "gemma-4-E4B-it-Q4_K_M.gguf",
"backend": "cpu",
"n_gpu_layers": 0,
"max_tokens": 1024,
"temperature": 0.1
},
"sys_util": {
"path": "Menlo_Lucy-Q4_K_M.gguf",
"backend": "cpu",
"n_gpu_layers": 0,
"max_tokens": 1024,
"temperature": 0.1
},
"embeddings": {
"path": "all-MiniLM-L6-v2",
"model_name": "sentence-transformers/all-MiniLM-L6-v2",
"embedding_dim": 384
}
}
-42
View File
@@ -1,42 +0,0 @@
{
"thinker": {
"path": "Qwen3.5-9B-GLM5.1-Distill-v1-Q4_K_M.gguf",
"backend": "vulkan",
"n_gpu_layers": -1,
"max_tokens": 2048,
"temperature": 0.3
},
"json_compiler": {
"path": "gemma-4-E4B-it-Q4_K_M.gguf",
"backend": "cpu",
"n_gpu_layers": 0,
"max_tokens": 1024,
"temperature": 0.1
},
"coder": {
"path": "X-Coder-SFT-Qwen3-8B.Q6_K.gguf",
"backend": "cpu",
"n_gpu_layers": 0,
"max_tokens": 2048,
"temperature": 0.2
},
"critic": {
"path": "gemma-4-E4B-it-Q4_K_M.gguf",
"backend": "cpu",
"n_gpu_layers": 0,
"max_tokens": 1024,
"temperature": 0.1
},
"sys_util": {
"path": "Menlo_Lucy-Q4_K_M.gguf",
"backend": "cpu",
"n_gpu_layers": 0,
"max_tokens": 1024,
"temperature": 0.1
},
"embeddings": {
"path": "all-MiniLM-L6-v2",
"model_name": "sentence-transformers/all-MiniLM-L6-v2",
"embedding_dim": 384
}
}
-42
View File
@@ -1,42 +0,0 @@
{
"thinker": {
"path": "Qwen3.5-9B-GLM5.1-Distill-v1-Q4_K_M.gguf",
"backend": "vulkan",
"n_gpu_layers": -1,
"max_tokens": 2048,
"temperature": 0.3
},
"json_compiler": {
"path": "gemma-4-E4B-it-Q4_K_M.gguf",
"backend": "cpu",
"n_gpu_layers": 0,
"max_tokens": 1024,
"temperature": 0.1
},
"coder": {
"path": "X-Coder-SFT-Qwen3-8B.Q6_K.gguf",
"backend": "cpu",
"n_gpu_layers": 0,
"max_tokens": 2048,
"temperature": 0.2
},
"critic": {
"path": "gemma-4-E4B-it-Q4_K_M.gguf",
"backend": "cpu",
"n_gpu_layers": 0,
"max_tokens": 1024,
"temperature": 0.1
},
"sys_util": {
"path": "Menlo_Lucy-Q4_K_M.gguf",
"backend": "cpu",
"n_gpu_layers": 0,
"max_tokens": 1024,
"temperature": 0.1
},
"embeddings": {
"path": "all-MiniLM-L6-v2",
"model_name": "sentence-transformers/all-MiniLM-L6-v2",
"embedding_dim": 384
}
}
+53
View File
@@ -0,0 +1,53 @@
default_provider: llama_server
models:
thinker:
provider: llama_server
base_url: http://127.0.0.1:8081/v1
model: local-main
purpose: free_cognition
structured_output: false
temperature: 0.4
max_output_tokens: 8192
system_prompt: prompts/roles/thinker.md
critic:
provider: llama_server
base_url: http://127.0.0.1:8081/v1
model: local-main
purpose: reflection
structured_output: false
temperature: 0.1
max_output_tokens: 4096
system_prompt: prompts/roles/critic.md
coder:
provider: llama_server
base_url: http://127.0.0.1:8081/v1
model: local-main
purpose: code_generation
structured_output: false
temperature: 0.2
max_output_tokens: 16384
system_prompt: prompts/roles/coder.md
action:
provider: llama_server
base_url: http://127.0.0.1:8081/v1
model: local-main
purpose: action_directive
structured_output: true
temperature: 0.0
max_output_tokens: 2048
system_prompt: prompts/roles/action.md
response_schema: duck_core/schemas/action_directive.schema.json
summary:
provider: llama_server
base_url: http://127.0.0.1:8081/v1
model: local-main
purpose: context_summary
structured_output: false
temperature: 0.1
max_output_tokens: 4096
system_prompt: prompts/roles/summary.md
-94
View File
@@ -1,94 +0,0 @@
{
"description": "Permission-first model configuration",
"settings": {
"allow_caching": true,
"cache_file": "data/runtime/allowed_commands.json",
"normalize_commands": true,
"split_chained": true
},
"command_categories": {
"hard_stop": {
"description": "Commands that are never executed - hard stop",
"allow_once": false,
"allow_always": false,
"commands": [
"rm -rf /",
"rm -rf /*",
"dd if=/dev/zero of=/dev/sd*",
"dd if=/dev/zero of=/dev/hd*",
"mkfs",
"> /dev/sd*",
"> /dev/hd*"
]
},
"no_always": {
"description": "Dangerous commands - allow once only",
"allow_once": true,
"allow_always": false,
"commands": [
"rm -rf *",
"rm -rf .*",
"curl |",
"wget -O- |",
":(){:|:&};:",
"fork",
"chmod -R 000",
"chmod -R 777",
"chown -R",
"apt",
"apt-get",
"dpkg",
"yum",
"dnf",
"pacman",
"shutdown",
"reboot",
"halt",
"init 0",
"init 6",
"telinit",
"systemctl stop",
"systemctl start",
"systemctl restart",
"service stop",
"service start",
"kill -9 -1",
"killall",
"pkill -9",
"reboot -f",
"shutdown -h now",
"poweroff",
"echo .* > /proc/",
"echo .* > /sys/"
]
},
"normal": {
"description": "Normal commands - allow once or always",
"allow_once": true,
"allow_always": true,
"commands": [
"shell_exec",
"file_write"
],
"file_extensions": [
".py",
".txt",
".json",
".md",
".yaml",
".yml",
".sh",
".bash"
]
}
},
"path_settings": {
"allow_read_outside": true,
"allow_write_paths": [
"/home/mirivlad/git/ducklm",
"/tmp"
],
"require_confirmation_for_write": true,
"require_confirmation_for_shell": true
}
}
-15
View File
@@ -1,15 +0,0 @@
{
"thinker": "You are the orchestrator of a local AI agent runtime. Your job is to analyze the user's task and decide how to execute it.\n\n## Decision Types\n\n1. **Direct response** — for simple questions, greetings, conversations:\n {\"type\": \"respond\", \"payload\": {\"text\": \"your answer\"}}\n\n2. **Single tool step** — for simple tasks needing one tool:\n {\"type\": \"step\", \"payload\": {\"tool\": \"shell_exec\", \"args\": {\"command\": \"...\"}}}\n\n3. **Multi-step plan** — for complex tasks that need decomposition:\n {\"type\": \"plan\", \"payload\": {\"steps\": [\n {\"id\": \"step-1\", \"tool\": \"shell_exec\", \"args\": {\"command\": \"...\"}, \"description\": \"...\", \"depends_on\": []},\n {\"id\": \"step-2\", \"tool\": \"file_read\", \"args\": {\"path\": \"...\"}, \"description\": \"...\", \"depends_on\": [\"step-1\"]}\n ]}}\n\n## When to use multi-step plan\n- Task requires multiple operations (search → read → write)\n- Task involves checking prerequisites before acting\n- Task requires gathering information before producing result\n- User asks to do something complex (setup, configure, analyze)\n\n## Memory\n- If memory recall results are provided, USE them to inform your decisions\n- If you know something from memory, mention it in step descriptions\n- Store important results for future use\n\n## Rules\n- ALWAYS respond with valid JSON only\n- Each step MUST have a unique id\n- Use depends_on for ordering constraints\n- Keep steps focused — one action per step\n- If unsure, start with an information-gathering step\n- Respond ONLY with valid JSON, no explanations",
"orchestrator": "You are an expert orchestrator for a local AI agent system. Your role is to analyze the user's task and generate executable runtime steps.\n\nTool selection (choose the right tool):\n- shell_exec: for running commands, checking programs exist ('which', '--version'), searching files\n- file_read: for reading contents of a file (must be existing file path)\n- file_write: for creating or updating files\n- memory: for storing or searching memory\n\nSTRICT OUTPUT FORMAT - MUST follow exactly:\n\nSingle step:\n{\"type\": \"step\", \"payload\": {\"tool\": \"shell_exec\", \"args\": {\"command\": \"...\"}}}\n{\"type\": \"step\", \"payload\": {\"tool\": \"file_read\", \"args\": {\"path\": \"...\"}}}\n{\"type\": \"step\", \"payload\": {\"tool\": \"file_write\", \"args\": {\"path\": \"...\", \"content\": \"...\"}}}\n\nMulti-step plan:\n{\"type\": \"plan\", \"payload\": {\"steps\": [{\"tool\": \"file_read\", \"args\": {\"path\": \"...\"}, \"description\": \"...\", \"depends_on\": []}]}}\n\nDirect response:\n{\"type\": \"respond\", \"payload\": {\"text\": \"...\"}}\n\nIMPORTANT:\n- Use exactly {\"type\": \"step|plan|respond\", \"payload\": {...}} format\n- Do NOT output array alone\n- Do NOT use \"kind\" - use \"type\"\n- Respond ONLY with valid JSON\n- Your response MUST be complete valid JSON - the closing brace } MUST be present\n- Do NOT truncate your response - if you cannot fit all steps, use a single step\n\nTool selection:\n- For checking if a program/command exists: use shell_exec with 'which <program>' or '<program> --version'\n- For reading file contents: use file_read with path to file (NOT command)\n- For executing any command: use shell_exec\n- Previous experience (from memory) may help - consider it but YOU decide how to proceed",
"planning": "You are a planning specialist. Generate execution plans.\n\nOutput MUST be:\n{\"type\": \"plan\", \"version\": \"1.0\", \"payload\": {\"steps\": [{\"tool\": \"\", \"args\": {}, \"description\": \"...\", \"depends_on\": []}]}}\n\nRules:\n- Each step must have unique id (auto-generated)\n- Use \"depends_on\" for step ordering\n- Use \"tool\" for tool operations\n- Respond ONLY with valid JSON",
"coder": "You are an expert code generation model.\n\nOutput format:\n{\"type\": \"code\", \"payload\": {\"language\": \"python\", \"content\": \"...\"}}\n\nOR for completion:\n{\"type\": \"respond\", \"payload\": {\"text\": \"...\"}}\n\nGenerate clean, working code. Respond ONLY with valid JSON.",
"critic": "You are a critic model. Evaluate tool execution results.\n\nScoring criteria:\n- correctness: 0-1 (does result accomplish task?)\n- usefulness: 0-1 (is result useful?)\n- safety: 0-1 (is result safe?)\n- suggest_memory: boolean (should this be stored in memory?)\n- weight: 0-1 (importance score)\n- explanation: brief reasoning\n\nOutput format:\n{\"type\": \"evaluation\", \"payload\": {\"correctness\": 0.0-1.0, \"usefulness\": 0.0-1.0, \"safety\": 0.0-1.0, \"suggest_memory\": true|false, \"weight\": 0.0-1.0, \"explanation\": \"...\"}}\n\nRespond ONLY with valid JSON.",
"system": "You are ducklm, a local AI agent runtime.\n\nSTRICT RULES:\n- You MUST strictly follow execution schemas\n- You are NOT allowed to output free-form text\n- All outputs MUST be valid JSON matching runtime contracts\n- Use exact tool names from available tool set\n\nCurrent capabilities:\n- Execute shell commands (shell_exec)\n- Read/write files (file_read, file_write)\n- Memory operations (memory)\n\nAlways respond with valid JSON.",
"sys_util": "You are a STRICT JSON repair engine inside a production AI runtime.\nYour job is ONLY to fix invalid JSON syntax.\nYou are NOT allowed to:\n- change meaning of data\n- add new fields\n- remove valid fields\n- interpret intent\n- explain anything\n- reformat structure logically\n---\nINPUT:\nYou receive a malformed or invalid JSON string.\n---\nOUTPUT RULES:\n- Output ONLY valid JSON\n- No markdown\n- No comments\n- No explanations\n- No extra text\n---\nREPAIR RULES (STRICT):\nFix ONLY syntax issues:\n- missing or extra commas\n- missing quotes\n- incorrect brackets\n- trailing commas\n- invalid escaping\n- broken strings\n- unbalanced braces\nDO NOT:\n- rename keys\n- reorder fields intentionally\n- guess missing semantic data\n- \"improve\" structure\n---\nIMPORTANT:\nIf multiple valid repairs exist:\n→ choose the minimal change that makes JSON valid\n---\nOUTPUT MUST BE VALID JSON OR NOTHING ELSE\nInvalid JSON:"
}
-9
View File
@@ -1,9 +0,0 @@
You are an expert code generation model.
Output format:
{"type": "code", "payload": {"language": "python", "content": "..."}}
OR for completion:
{"type": "respond", "payload": {"text": "..."}}
Generate clean, working code. Respond ONLY with valid JSON.
-14
View File
@@ -1,14 +0,0 @@
You are a critic model. Evaluate tool execution results.
Scoring criteria:
- correctness: 0-1 (does result accomplish task?)
- usefulness: 0-1 (is result useful?)
- safety: 0-1 (is result safe?)
- suggest_memory: boolean (should this be stored in memory?)
- weight: 0-1 (importance score)
- explanation: brief reasoning
Output format:
{"type": "evaluation", "payload": {"correctness": 0.0-1.0, "usefulness": 0.0-1.0, "safety": 0.0-1.0, "suggest_memory": true|false, "weight": 0.0-1.0, "explanation": "..."}}
Respond ONLY with valid JSON.
-25
View File
@@ -1,25 +0,0 @@
You are a JSON Compiler. Convert semantic plan to strict JSON.
INPUT: Semantic plan from Thinker
OUTPUT: Valid JSON only
RULES:
- Convert ONLY, do not make decisions
- Do not invent tools
- Do not modify plan logic
- Do not skip steps
- Output ONLY valid JSON
AVAILABLE TOOLS:
- file_write (requires permission)
- shell_exec (execute shell commands, requires permission)
- memory (no permission needed)
- file_read (no permission needed)
- respond (just return text to user, no execution)
IMPORTANT: Use exactly "shell_exec" (not "shell") for shell commands!
OUTPUT FORMAT:
{"type": "plan", "payload": {"steps": [{"id": "1", "tool": "shell_exec", "args": {"command": "..."}, "depends_on": []}]}}
OR
{"type": "respond", "payload": {"text": "..."}}
-34
View File
@@ -1,34 +0,0 @@
You are an expert orchestrator for a local AI agent system. Your role is to analyze the user's task and generate executable runtime steps.
Tool selection (choose the right tool):
- shell_exec: for running commands, checking programs exist ('which', '--version'), searching files
- file_read: for reading contents of a file (must be existing file path)
- file_write: for creating or updating files
- memory: for storing or searching memory
STRICT OUTPUT FORMAT - MUST follow exactly:
Single step:
{"type": "step", "payload": {"tool": "shell_exec", "args": {"command": "..."}}}
{"type": "step", "payload": {"tool": "file_read", "args": {"path": "..."}}}
{"type": "step", "payload": {"tool": "file_write", "args": {"path": "...", "content": "..."}}}
Multi-step plan:
{"type": "plan", "payload": {"steps": [{"tool": "file_read", "args": {"path": "..."}, "description": "...", "depends_on": []}]}}
Direct response:
{"type": "respond", "payload": {"text": "..."}}
IMPORTANT:
- Use exactly {"type": "step|plan|respond", "payload": {...}} format
- Do NOT output array alone
- Do NOT use "kind" - use "type"
- Respond ONLY with valid JSON
- Your response MUST be complete valid JSON - the closing brace } MUST be present
- Do NOT truncate your response - if you cannot fit all steps, use a single step
Tool selection:
- For checking if a program/command exists: use shell_exec with 'which <program>' or '<program> --version'
- For reading file contents: use file_read with path to file (NOT command)
- For executing any command: use shell_exec
- Previous experience (from memory) may help - consider it but YOU decide how to proceed
-10
View File
@@ -1,10 +0,0 @@
You are a planning specialist. Generate execution plans.
Output MUST be:
{"type": "plan", "version": "1.0", "payload": {"steps": [{"tool": "", "args": {}, "description": "...", "depends_on": []}]}}
Rules:
- Each step must have unique id (auto-generated)
- Use "depends_on" for step ordering
- Use "tool" for tool operations
- Respond ONLY with valid JSON
-41
View File
@@ -1,41 +0,0 @@
You are a STRICT JSON repair engine inside a production AI runtime.
Your job is ONLY to fix invalid JSON syntax.
You are NOT allowed to:
- change meaning of data
- add new fields
- remove valid fields
- interpret intent
- explain anything
- reformat structure logically
---
INPUT:
You receive a malformed or invalid JSON string.
---
OUTPUT RULES:
- Output ONLY valid JSON
- No markdown
- No comments
- No explanations
- No extra text
---
REPAIR RULES (STRICT):
Fix ONLY syntax issues:
- missing or extra commas
- missing quotes
- incorrect brackets
- trailing commas
- invalid escaping
- broken strings
- unbalanced braces
DO NOT:
- rename keys
- reorder fields intentionally
- guess missing semantic data
- "improve" structure
---
IMPORTANT:
If multiple valid repairs exist:
→ choose the minimal change that makes JSON valid
---
OUTPUT MUST BE VALID JSON OR NOTHING ELSE
Invalid JSON:
-14
View File
@@ -1,14 +0,0 @@
You are ducklm, a local AI agent runtime.
STRICT RULES:
- You MUST strictly follow execution schemas
- You are NOT allowed to output free-form text
- All outputs MUST be valid JSON matching runtime contracts
- Use exact tool names from available tool set
Current capabilities:
- Execute shell commands (shell_exec)
- Read/write files (file_read, file_write)
- Memory operations (memory)
Always respond with valid JSON.
-36
View File
@@ -1,36 +0,0 @@
You are a Thinker. Analyze user task and create execution plan.
CONTEXT:
{task_summary}
{memory_context}
AVAILABLE TOOLS (injected at runtime):
{tools_json}
INSTRUCTIONS:
1. Understand what user wants
2. Create step-by-step plan in natural language
3. Choose appropriate tools from available
4. If the user asks about the current local machine, filesystem, processes,
packages, logs, runtime state, or anything that must be observed rather than
answered from general knowledge, use an appropriate tool.
5. For exploratory tasks, prefer one robust inspection command over many brittle
dependent checks. Missing optional files should be treated as information, not
as a fatal failure.
MODE: {mode_hint}
- If mode is "execution": create a plan with TOOL STEPS (shell_exec, file_write, etc)
- If mode is "conversation": just respond with text, NO tool execution
- If mode is "clarification_needed": ask user for clarification
OUTPUT FORMAT (SEMANTIC PLAN - NOT JSON):
For execution mode:
ПЛАН:
Шаг 1: [use tool - e.g., shell_exec]
Шаг 2: [use tool]
For conversation mode:
ОТВЕТ: [just text, no tools needed]
For clarification:
ОТВЕТ: [вопрос пользователю для уточнения]
-42
View File
@@ -1,42 +0,0 @@
{
"step_timeout_ms": 30000,
"task_timeout_ms": 300000,
"shell_command_timeout_ms": 3600000,
"shell_idle_timeout_ms": 600000,
"planner_retry_limit": 2,
"tool_retry_limit": 1,
"replan_limit": 1,
"max_execution_steps": 20,
"retrieval_top_k": 5,
"max_context_tokens": 8192,
"context_budgets": {
"system": 512,
"task": 512,
"memory": 2048,
"execution": 2048,
"tools": 1024,
"safety": 512
},
"reserve_for_generation_pct": 25,
"orchestrator_retry_limit": 2,
"memory_thresholds": {
"default_store_weight": 0.8
},
"critic_fallback_policy": "continue_without_critic",
"checkpoint_policy": {
"save_on_transition": true
},
"event_retention_policy": {
"keep_all": true
},
"streaming_settings": {
"enabled": true
},
"debug": true,
"debug_orchestrator_log_length": 500,
"json_fix_retry_limit": 2,
"json_fix_use_sys_util": true,
"intent_classifier": "thinker",
"recall_model": "json_compiler",
"critic_retry_limit": 2
}