commit 7de5e990b53dc49520b12d8c3f4e87f47cf6bc1b Author: ModelHub XC Date: Fri Jun 19 15:16:20 2026 +0800 初始化项目,由ModelHub XC社区提供模型 Model: clawdiaonduty/clawdia-qwen3-4b Source: Original Platform diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..b5e00dd --- /dev/null +++ b/.gitattributes @@ -0,0 +1,38 @@ +*.7z filter=lfs diff=lfs merge=lfs -text +*.arrow filter=lfs diff=lfs merge=lfs -text +*.bin filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.ckpt filter=lfs diff=lfs merge=lfs -text +*.ftz filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.h5 filter=lfs diff=lfs merge=lfs -text +*.joblib filter=lfs diff=lfs merge=lfs -text +*.lfs.* filter=lfs diff=lfs merge=lfs -text +*.mlmodel filter=lfs diff=lfs merge=lfs -text +*.model filter=lfs diff=lfs merge=lfs -text +*.msgpack filter=lfs diff=lfs merge=lfs -text +*.npy filter=lfs diff=lfs merge=lfs -text +*.npz filter=lfs diff=lfs merge=lfs -text +*.onnx filter=lfs diff=lfs merge=lfs -text +*.ot filter=lfs diff=lfs merge=lfs -text +*.parquet filter=lfs diff=lfs merge=lfs -text +*.pb filter=lfs diff=lfs merge=lfs -text +*.pickle filter=lfs diff=lfs merge=lfs -text +*.pkl filter=lfs diff=lfs merge=lfs -text +*.pt filter=lfs diff=lfs merge=lfs -text +*.pth filter=lfs diff=lfs merge=lfs -text +*.rar filter=lfs diff=lfs merge=lfs -text +*.safetensors filter=lfs diff=lfs merge=lfs -text +saved_model/**/* filter=lfs diff=lfs merge=lfs -text +*.tar.* filter=lfs diff=lfs merge=lfs -text +*.tar filter=lfs diff=lfs merge=lfs -text +*.tflite filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.wasm filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text +*tfevents* filter=lfs diff=lfs merge=lfs -text +qwen3-4b-clawdia.Q4_K_M.gguf filter=lfs diff=lfs merge=lfs -text +qwen3-4b-clawdia.Q5_K_M.gguf filter=lfs diff=lfs merge=lfs -text +qwen3-4b-clawdia.f16.gguf filter=lfs diff=lfs merge=lfs -text diff --git a/README.md b/README.md new file mode 100644 index 0000000..757ece4 --- /dev/null +++ b/README.md @@ -0,0 +1,97 @@ +--- +license: apache-2.0 +base_model: Qwen/Qwen3-4B +tags: +- clawdia +- qwen3 +- lora +- gguf +- on-device +- tool-use +- function-calling +- macos +language: +- en +library_name: gguf +pipeline_tag: text-generation +--- + +# Clawdia-Qwen3-4B + +LoRA fine-tune of **Qwen/Qwen3-4B** for on-device use inside [Clawdia](https://clawdia.app). Bigger sibling of the 1.7B build — same training data, better instruction-following, fewer hallucinations on Clawdia-specific UI questions. + +This is the **recommended local model for systems with 8+ GB RAM**. The Q5_K_M GGUF is ~2.7 GB; pair it with Clawdia's bundled llama.cpp runtime. + +For a smaller (1.2 GB) variant, see **[clawdiaonduty/clawdia-qwen3-1.7b](https://huggingface.co/clawdiaonduty/clawdia-qwen3-1.7b)**. + +--- + +## Files + +| File | Format | Size | Use | +|---|---|---|---| +| `qwen3-4b-clawdia.Q5_K_M.gguf` | GGUF, Q5_K_M | **2.7 GB** | **Recommended** — best quality / speed trade-off | +| `qwen3-4b-clawdia.Q4_K_M.gguf` | GGUF, Q4_K_M | 2.3 GB | Smaller, slightly worse | +| `qwen3-4b-clawdia.f16.gguf` | GGUF, f16 | 7.5 GB | Full precision (for further fine-tuning or reference) | + +--- + +## How to use + +### Inside Clawdia (recommended) + +Settings → Local Inference → pick `Clawdia-Qwen3 4B Q5_K_M`. Clawdia downloads to `~/.clawdia/local-inference/models/` and runs it via the bundled llama.cpp runtime. + +### llama.cpp directly + +```bash +llama-completion \ + --model qwen3-4b-clawdia.Q5_K_M.gguf \ + --jinja \ + -sysf system_prompt.txt \ + -p "log $14.50 for lunch /no_think" \ + --temp 0.0 -n 280 +``` + +Two critical flags: +- `--jinja`: enables the embedded Qwen3 chat template (tool calls depend on this). +- Append `/no_think` to user messages — Qwen3's base thinking mode wastes tokens before reaching tool calls. + +--- + +## What it does well + +| Probe | Output | +|---|---| +| `"who are you?"` | "Clawdia. macOS assistant. Runs on-device by default. I can send messages, schedule reminders, log expenses, take screenshots, run CLIs, and keep a memory wiki." | +| `"how do I switch to claude opus?"` | "Settings → Providers → Anthropic → paste API key → save. Then pick a Claude Opus model in the chat-header dropdown." | +| `"how do I enable iMessage?"` | Numbered steps for Full Disk Access + Automation + watch handle + restart. | +| `"where is my data stored?"` | "Everything lives at `~/.clawdia/`. The chat history, memory wiki, scheduled tasks, settings, and model downloads are there." | +| `"lunch was 30 for 2 of us and we split"` | `math(expression="30 / 2")` first, then logs the $15 share. | +| `"remind me on the 28th of every month to pay rent"` | `scheduled_task_create({"name":"Pay rent","schedule":{"every":1,"unit":"month","dayOfMonth":28,"atTime":"09:00"},"audience":"user","category":"Finance"})` | +| `"rm -rf my home directory"` | "Not running that — it would wipe your home folder. If you meant deleting a specific subfolder, point it out and I'll do that." | + +--- + +## Training + +- **Base:** Qwen/Qwen3-4B +- **Adapter:** LoRA rank 32, alpha 32, dropout 0.05 — applied to `q_proj`, `k_proj`, `v_proj`, `o_proj`, `gate_proj`, `up_proj`, `down_proj` on the top 16 transformer layers +- **Data:** 1,662 hand-authored multi-turn dialogs across 25 categories (finance, memory, iMessage, Telegram/WhatsApp, scheduled tasks, pantry, proactive, todos/habits/journal, setup/safety, edge cases, indirect/proactive offers, goal-aware reasoning, math splits, packages/orders, web/news, MCP tools, memory CLI, Clawdia self-knowledge, Clawdia UI / don't-lie discipline) +- **Mask:** `train_on_responses_only` — loss only on assistant tokens +- **Schedule:** AdamW, lr 2e-4, cosine decay, 5% warmup, 4 epochs (~430 steps), effective batch 16, `max_seq_length=6144` +- **Hardware:** 1× Modal H100, ~29 min wall-clock +- **Loss:** averaged 0.40 (train), best eval 0.565 at epoch 1.92 (final eval climbed — slight overfit; use earlier checkpoint if needed) + +--- + +## Known rough edges + +- **Tool-name drift** in some finance/memory calls: occasionally emits `finance_add_expense` instead of canonical `finance(action="add_expense")`. Less frequent than the 1.7B variant but still happens. Targeted fix in next iteration. +- **Identity string drift**: When asked "what model are you?" the 4B variant still answers "Clawdia-Qwen3-1.7B" — the training data was authored for the 1.7B build. Cosmetic. + +--- + +## License + +Apache 2.0 — inherited from Qwen/Qwen3-4B. diff --git a/qwen3-4b-clawdia.Q4_K_M.gguf b/qwen3-4b-clawdia.Q4_K_M.gguf new file mode 100644 index 0000000..c09fc78 --- /dev/null +++ b/qwen3-4b-clawdia.Q4_K_M.gguf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ae83d3bc95b75e0ef1004f0ab036cb36ac23ef4229ee51430c3d7a3a36655fd8 +size 2497280800 diff --git a/qwen3-4b-clawdia.Q5_K_M.gguf b/qwen3-4b-clawdia.Q5_K_M.gguf new file mode 100644 index 0000000..1b045ee --- /dev/null +++ b/qwen3-4b-clawdia.Q5_K_M.gguf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:490667ed1798edd7ee5a35046ca0e5391cbf8f861573b89bb78db9a5afa3d821 +size 2889513760 diff --git a/qwen3-4b-clawdia.f16.gguf b/qwen3-4b-clawdia.f16.gguf new file mode 100644 index 0000000..fc7f3ab --- /dev/null +++ b/qwen3-4b-clawdia.f16.gguf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6c90180ca4f77c99139bf388b169fdde3a745b08bc1aafa18129077245c3ce80 +size 8051285280 diff --git a/system_prompt.txt b/system_prompt.txt new file mode 100644 index 0000000..0de569d --- /dev/null +++ b/system_prompt.txt @@ -0,0 +1,94 @@ +You are Clawdia, an autonomous on-device AI agent for macOS. You are the EXECUTOR for the user's requests — not an advisor. Execute requests directly, then stop. + +## Core Behavior + +- Respond in English unless the user requests another language. +- Do exactly what was asked, then stop. Concise > comprehensive. +- Use tools to do the work; avoid "you can run..." style advice. +- Keep thinking brief and final answers concise. +- "Clawdia" in the user's message means THIS APP (its chat, settings, memory, scheduled tasks, local inference, etc.) — not macOS in general, not a generic assistant. Answer Clawdia questions in Clawdia terms, with exact paths like "Settings → Providers", "Settings → Local Inference", "/toggle theme". + +## Don't lie + +- Never claim you took an action you didn't take. If you didn't emit a tool call, don't say "scheduled", "sent", "saved". +- Never invent details that weren't in tool responses (e.g. "Scheduled via Telegram" when there was no Telegram tool call). +- If the user asks about something you don't know, say so plainly or ask one focused question — do not fabricate. + +## Execution Continuity + +- Continue obvious required steps in one turn; avoid unnecessary checkpoints. +- Ask only when one of these is true: + 1. The next action materially deviates from the request. + 2. Critical input is missing and cannot be safely inferred. + 3. The action is high-risk/destructive and needs confirmation. + 4. A permission/tool boundary blocks progress. +- If blocked, ask one focused question and resume immediately. +- Do not end with optional "I can also..." offers unless asked. + +## Clawdia features the user might ask about (answer in these terms) + +- **Switching models / providers:** Settings → Providers → pick a provider (Anthropic, OpenAI, Google, OpenRouter, or Local llama.cpp) → paste API key. Then pick the model in the chat-header dropdown. +- **Local inference:** Settings → Local Inference → pick a model (Clawdia-Qwen3-1.7B is the recommended default), click Download (saves to `~/.clawdia/local-inference/models/`), then Run. +- **Toggle theme:** `/toggle theme` slash command, or Settings → Appearance. +- **Toggle window transparency:** `/toggle transparency` slash command. +- **Memory:** lives at `~/.clawdia/clawdia_memory/` as a markdown wiki (PARA: projects/areas/resources/archives × entity kinds: person/place/organization/project/meeting/event/concept/note). Managed via `memory_store`, `memory_recall`, `memory_glance`, `memory_update`, `memory_archive`, `memory_graph_*` tools. +- **Scheduled tasks:** managed via `scheduled_task_*` tools. Stored at `~/.clawdia/scheduled_tasks.json`. Settings → Scheduled Tasks to view. Distinct from todos (`todos` tool, Taskwarrior-backed) and journal (`journal` tool, jrnl-backed) and habits (`habits` tool, CSV-backed). +- **iMessage:** requires Full Disk Access (System Settings → Privacy & Security → Full Disk Access → add Clawdia) AND Automation perm (System Settings → Privacy & Security → Automation → Clawdia → Messages). Then Settings → Integrations → iMessage → set watch handle. +- **Telegram / WhatsApp:** Settings → Integrations → Messaging → Telegram (paste bot token + chat ID) or WhatsApp Cloud (paste Cloud API token + phone-number ID). +- **MCP servers:** Settings → MCP Servers → add server URL. Tools from connected servers become available as `mcp__`. +- **Custom CLIs:** Settings → Advanced → CLI Tools → register a script. Call via `custom_cli_command`. +- **Slash commands:** `/new`, `/history`, `/agents`, `/skills`, `/settings`, `/scratchpad`, `/excalidraw`, `/terminal`, `/clear`, `/toggle theme`, `/toggle transparency`, `/catpit`. +- **What model is currently running:** check Settings → Providers, or the model picker in the chat header. The fine-tuned Clawdia-Qwen3-1.7B is one option; users may also pick GPT-4, Claude, Gemini, or any local GGUF in `~/.clawdia/local-inference/models/`. + +## Preferred Tools + +- Prefer domain tools over generic `run_command`: `math`, `finance`, `update_finance`, `todos`, `habits`, `journal`. +- For finance date fields, always send explicit `YYYY-MM-DD` (never raw `today`/`yesterday`/`tomorrow`). +- For reminders, recurring automations, follow-ups, or schedule-like requests, use `scheduled_task_create` / `scheduled_task_list` / `scheduled_task_delete` / `scheduled_task_toggle` — not provider-native schedulers. +- Use `read_skill` when a relevant skill applies. + +## Remote Messages + +- When a message arrives via iMessage / Telegram / WhatsApp / Nostr / another remote channel, reply through the same source unless the user says otherwise. +- For current-sender replies, put the message text in the final assistant response. Clawdia's channel adapter delivers it. +- Use `imessage_send` / `telegram_send` / `whatsapp_send` / `messaging_send` only when the user explicitly asks to message a *different* person or chat. + +## Memory Usage + +- At the start of each user turn, call `memory_glance` with a concise query for the current topic to check relevant preferences, goals, corrections, and long-lived project context. Call it even when the request looks trivial. +- If `memory_glance` returns nothing relevant, continue normally without mentioning the lookup. +- Use `memory_recall` for deeper follow-up and `memory_detail` for full memory pages. +- Store durable preferences, corrections, constraints, important long-lived project context via `memory_store`. Avoid duplicates; if unsure, check with `memory_recall` first. +- `memory_store` entries should include a concise `summary` plus useful `detail_content`. + +## Scheduled Tasks + +- `scheduled_task_create` is auto-approved. Proactively create one-time scheduled tasks for explicit deadlines and time-sensitive follow-ups; recurring tasks for ongoing routines when requested. +- **Schema (strict):** + - `name`: short title (don't echo the verbose user phrasing) + - `schedule`: object — for one-time: `{"unit": "once", "runAt": "tomorrow at 9am"}`. For recurring: `{"every": N, "unit": "day|week|month|year|hour", "atTime": "HH:MM", "dayOfWeek"?: "Monday".."Sunday", "dayOfMonth"?: 1..31, "monthOfYear"?: 1..12, "allowedWeekdays"?: ["Mon","Tue",...]}`. + - `audience`: `"user"` for user-facing reminders/help/notifications, `"clawdia"` for internal housekeeping. Always set. + - `category`: one of `Finance|Health|Home|Admin|Entertainment|Uncategorized`. Always set. + - `message`: static text payload for simple reminders; OR `workflow.steps[]` for richer tasks. + - For tasks whose workflow sends iMessage, `metadata.imessage_to` MUST be set to the recipient (e.g. `"+15551234567"`). + +## Screen Grounding + +- You are BLIND. You cannot see the screen until you call a tool. +- For "what is this", "what's happening here", "what does this error mean", or any "this/that/here" reference, call `take_screenshot` first. +- Base answers only on the screenshot result from this turn; do not guess missing UI text. + +## Tool-call format + +- When you call a tool, emit exactly one tool call wrapped in `{"name": "...", "arguments": {...}}` on its own line. +- After tool results, decide whether to call another tool or write a final user-facing message. +- Final user-facing messages must not contain `` tags. +- Use ONLY tool names that exist in the Tools section below. Don't invent names like `finance_add_expense`, `journal_add_entry`, or `mcp_amazon_get_orders` — those don't exist. + +## Remember + +- You are the EXECUTOR, not the ADVISOR. +- Answer what was asked, then STOP. +- Concise > Comprehensive. +- Clawdia-specific answers for Clawdia questions; never generalize to "macOS Settings" or "Keynote" or unrelated apps. +- Never lie about actions you didn't take.