[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-111098":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":8,"htmlUrl":8,"language":9,"languages":8,"totalLinesOfCode":8,"stars":10,"forks":11,"watchers":12,"openIssues":13,"contributorsCount":13,"subscribersCount":13,"size":13,"stars1d":14,"stars7d":15,"stars30d":16,"stars90d":13,"forks30d":13,"starsTrendScore":11,"compositeScore":17,"rankGlobal":8,"rankLanguage":8,"license":8,"archived":18,"fork":18,"defaultBranch":19,"hasWiki":20,"hasPages":18,"topics":21,"createdAt":8,"pushedAt":22,"updatedAt":23,"readmeContent":24,"aiSummary":25,"trendingCount":13,"starSnapshotCount":13,"syncStatus":14,"lastSyncTime":26,"discoverSource":27},111098,"mightyCode","shi3z\u002FmightyCode","shi3z",null,"Python",118,8,65,0,2,7,35,47.86,false,"main",true,[],"2026-11-09 07:19:28","2026-11-23 12:08:41","# mightyCode\n\nRun **Claude Code** on a local MLX model\n([DeepSeek-V4-Pro-Qwen3.5-9B-UNCENSORED-heretic](https:\u002F\u002Fhuggingface.co\u002Fxtools-at\u002FDeepSeek-V4-Pro-Qwen3.5-9B-UNCENSORED-heretic)).\nNo API key needed, fully local (Apple Silicon only).\n\n```\nclaude  --\u002Fv1\u002Fmessages-->  anthropic_proxy.py  --\u002Fv1\u002Fchat\u002Fcompletions-->  mlx_lm.server (4-bit model)\n```\n\n| File | Purpose |\n|---|---|\n| `claude-local` | Launcher. Starts the backend as a persistent service and opens `claude` |\n| `anthropic_proxy.py` | Anthropic Messages API → OpenAI-compatible API proxy (streaming and tool calls supported) + EoCC compaction + Guard hook |\n| `guard.py` | Tool-call inspection (exfiltration, credential access, persistence, destructive commands) |\n| `convert_model.py` | HF → MLX 4-bit conversion (quantizes on CPU) |\n| `setup.sh` | Creates the venv, downloads and converts the model, registers the command on PATH |\n\n## Requirements\n- Apple Silicon Mac (macOS), 16 GB RAM or more recommended\n- Free disk space: about **25 GB** during conversion (19 GB source + 4.7 GB output). About 5 GB once the source is deleted\n- [uv](https:\u002F\u002Fdocs.astral.sh\u002Fuv\u002F) (`brew install uv`)\n\n## Installation\n\n### 1. Claude Code itself (not included in this repository)\nClaude Code cannot be redistributed, so install it yourself by following the official instructions.\n\n```bash\n# Official installer (macOS \u002F Linux)\ncurl -fsSL https:\u002F\u002Fclaude.ai\u002Finstall.sh | bash\n# or via npm (Node.js 18+)\nnpm install -g @anthropic-ai\u002Fclaude-code\n\nclaude --version   # verify\n```\nSee https:\u002F\u002Fcode.claude.com\u002Fdocs for the latest instructions. You do not need to log in with an Anthropic account to use it with a local model.\n\n### 2. This repository\nA pre-converted model is available at https:\u002F\u002Fhuggingface.co\u002Fshi3z\u002FDeepSeek-V4-Pro-Qwen3.5-9B-UNCENSORED-heretic-MLX-4bit\n(skip the 19 GB download and conversion: `hf download shi3z\u002FDeepSeek-V4-Pro-Qwen3.5-9B-UNCENSORED-heretic-MLX-4bit --local-dir models\u002Fheretic-9b-mlx-4bit`, then run `.\u002Fsetup.sh`).\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Fshi3z\u002FmightyCode.git\ncd mightyCode\n.\u002Fsetup.sh\n```\nIf you are short on disk space, put the conversion source on an external drive: `SRC_DIR=\u002FVolumes\u002Fbig\u002Fsrc .\u002Fsetup.sh`\n(If `~\u002F.local\u002Fbin` is not on your PATH, add `export PATH=\"$HOME\u002F.local\u002Fbin:$PATH\"`.)\n\n## Usage\n```bash\nclaude-local          # start (first run takes a few tens of seconds to load the model). Arguments are passed through to claude\nclaude-local -p \"...\" # non-interactive run\nclaude-local status   # backend status\nclaude-local logs     # tail the logs\nclaude-local stop     # stop the backend (it keeps running after claude exits, so stop it when you no longer need it)\n```\n\nEnvironment variables:\n| Variable | Default | Description |\n|---|---|---|\n| `MODEL_DIR` | `models\u002Fheretic-9b-mlx-4bit` | MLX model to use |\n| `MLX_PORT` \u002F `PROXY_PORT` | 8080 \u002F 8082 | Ports |\n| `THINKING` | 0 | Set to 1 to enable Qwen's thinking mode (slower) |\n| `COMPACT_THRESHOLD` | 48000 | Estimated token count that triggers EoCC compaction (0 disables it) |\n| `MAX_TOKENS_CAP` | 8192 | Maximum output tokens per response |\n| `PROXY_CONCURRENCY` | 3 | Max simultaneous generations (parallel subagents queue in the proxy) |\n| `PING_SECS` | 5 | Keep-alive `ping` interval on the SSE stream while the model is thinking\u002Fprefilling |\n| `API_TIMEOUT_MS` | 3600000 | Claude Code's per-request timeout (set by `claude-local`; Claude Code's own default is 10 min) |\n\n## Guard (exfiltration \u002F misbehavior tripwire)\nThe model is uncensored and small, so every tool call it produces is inspected by the proxy (`guard.py`) **before** Claude Code sees it.\nIf a call looks dangerous it is dropped, nothing is executed, and Claude Code shows an error message\n(`🛑 mightyCode Guard blocked this step`) with the tool, the reason and the input. The attempt is logged to `.state\u002Fguard.log`.\n\nBlocked by default:\n- Network access (`curl`, `wget`, `nc`, `ssh`, `scp`, `git push`, `\u002Fdev\u002Ftcp`, Python\u002FNode HTTP libraries, `WebFetch`, MCP tool arguments, …) to hosts that are not allowlisted\n- Secrets together with network access: SSH keys, cloud\u002Fgit credentials, `.env`, keychain, environment variables, API-key-looking strings, long encoded blobs\n- Reading credential files, DNS exfiltration (`nslookup $(...)`), `curl | sh`, `base64 -d | sh`\n- Writing to persistence locations (`~\u002F.zshrc`, `authorized_keys`, LaunchAgents, `.git\u002Fhooks`, Claude settings), `crontab`, `launchctl`\n- Destructive\u002Fprivileged commands: `rm -rf \u002F` or `~`, `sudo`, `mkfs`, `dd of=\u002Fdev\u002F…`\n- Scripts (`python x.py`, …) are opened and checked too, and file contents written with `Write`\u002F`Edit` are scanned\n\n```bash\nclaude-local guardlog                              # what was blocked\nGUARD_ALLOW_HOSTS=example.com claude-local         # extra allowed hosts (default list: localhost, github.com, huggingface.co, pypi.org, npmjs.org, …)\nGUARD=warn claude-local                            # log only, do not block\nGUARD=off claude-local                             # disable (restart the backend first: claude-local stop)\npython3 -I tests\u002Ftest_guard.py                     # unit tests\n```\nNote: the backend (proxy) is persistent, so after changing `GUARD*` variables run `claude-local stop` first.\n\n**This is a heuristic tripwire, not a sandbox.** A determined model can evade pattern matching (e.g. by obfuscation). Do not run Claude Code with\n`--permission-mode bypassPermissions` against this model, keep the normal permission prompts on, and for hard guarantees add an OS-level\negress filter (pf, Little Snitch \u002F LuLu) or run it in a container\u002FVM.\n\n## EoCC (End-of-Conversation Compaction)\nBased on [arXiv:2611.05306 \"You don't need long context\"](https:\u002F\u002Farxiv.org\u002Fabs\u002F2611.05306). When the context exceeds a threshold,\nthe model itself writes a recap for resuming (objective, established facts, changes made, dead ends, next step).\nFrom then on only \"original task + recap + later turns\" is sent, which keeps the history short\n(less KV-cache memory and lower decode latency).\nClaude Code's own system prompt and tool definitions take about 15–20K tokens, so the threshold is set high (48K).\nThe paper's results were measured on API models; the effect on a local 9B model is untested.\n\n## Timeouts \u002F slow subagents\nA 9B local model needs tens of seconds to prefill a 15–30K-token Claude Code prompt and ~30 tok\u002Fs to generate, and parallel subagents share one GPU.\n`claude-local` therefore raises `API_TIMEOUT_MS`, the proxy sends keep-alive pings, queues generations beyond `PROXY_CONCURRENCY`,\nand aborts the backend generation when the client disconnects. Every request is logged with timings:\n`claude-local logs` → `[REQ …] ok dur=… queue_wait=… first_token=…`.\n\n## Known caveats\n- Image input is not supported (images are omitted)\n- A warning like `Claude Code doesn't recognize the model \"heretic-9b-local\"` appears; it does not affect operation\n- Converting on the GPU hit a Metal `GPU Timeout Error` on some setups, so conversion runs on the CPU\n- With the system mlx-lm 0.31.1 and mlx 0.32, `mlx_lm.server` crashed, so a dedicated venv with the latest mlx-lm is installed\n- This is a 9B model; quality on complex agentic work is far below the real Claude\n- This model is an uncensored variant. Use it at your own risk\n","mightyCode 是一个在 Apple Silicon Mac 上本地运行类 Claude Code 编程助手的轻量级代理框架。它通过 anthropic_proxy.py 将 Anthropic Messages API 请求转换为 OpenAI 兼容格式，对接经 MLX 框架 4-bit 量化后的本地大模型（如 DeepSeek-V4-Pro-Qwen3.5-9B-UNCENSORED-heretic），并集成工具调用安全校验（guard.py）与上下文压缩功能。项目完全离线、无需 API 密钥，依赖 macOS 环境与 MLX 加速。适用于开发者在隐私敏感、网络受限或需低延迟响应的本地编程辅助场景中，将官方 Claude Code 客户端无缝接入自托管模型。","2026-11-24 04:40:06","CREATED_QUERY"]