{"skill":{"slug":"emergence-deepseek-tui","displayName":"Use DeepSeek TUI CLI as an autonomous code assistant","summary":"Use DeepSeek TUI CLI as an autonomous code assistant - two modes: `deepseek exec` (headless, text-in/text-out, no filesystem access) for delegation from anot...","description":"---\nname: emergence-deepseek-tui\ndescription: \"Use DeepSeek TUI CLI as an autonomous code assistant - two modes: `deepseek exec` (headless, text-in/text-out, no filesystem access) for delegation from another agent, and `deepseek run` (interactive, full tool-calling with filesystem) for direct coding.\"\nversion: 1.0.0\nauthor: Emergence Science\nlicense: MIT\nmetadata:\n  hermes:\n    tags: [deepseek-tui, coding, code-generation, multi-agent, delegation, headless-llm, cli-tools]\n    related_skills: [writing-plans, plan, subagent-driven-development, systematic-debugging, test-driven-development]\n---\n\n# Emergence DeepSeek TUI\n\nUse the **DeepSeek TUI** CLI (v0.8.16) as a code assistant from within your agent workflow. This skill teaches OpenClaw / Hermes agents how to delegate coding tasks to DeepSeek in two modes.\n\n---\n\n## Version\n\n```\ndeepseek (npm wrapper) v0.8.16\nbinary version: v0.8.16\nrepo: https://github.com/Hmbown/DeepSeek-TUI.git\n```\n\nInstall:\n- **Homebrew:** `brew install hmbown/tap/deepseek-tui`\n- **npm:** `npm install -g deepseek-tui`\n\n---\n\n## Two Modes of Operation\n\nDeepSeek TUI has two fundamentally different modes, each with different capabilities:\n\n| Mode | Command | Filesystem Access | Tool-Calling | Use Case |\n|------|---------|-------------------|-------------|----------|\n| **Headless** | `deepseek exec <PROMPT>` | ❌ No | ❌ Cannot execute tools | Delegate code gen from another agent |\n| **Interactive** | `deepseek run` | ✅ Yes (via tools) | ✅ Full tool-calling | Direct coding, file editing, debugging |\n\n### Mode 1: `deepseek exec` — Headless (Agent Delegation)\n\n`deepseek exec <PROMPT>` calls the DeepSeek API in pure text-in/text-out mode. The model may **generate tool call syntax in its chain-of-thought output** (e.g. `<function_calls><invoke name=\"list_files\">`), but these are never actually executed — they are only displayed as part of the model's reasoning text. No filesystem access, no tool execution.\n\n```\n┌─────────────────────────────────────┐\n│  Your Agent (Hermes/OpenClaw)       │\n│  ┌───────────────────────────────┐  │\n│  │ 1. Read files (understand)    │  │\n│  │ 2. Craft prompt with context  │  │\n│  │ 3. deepseek exec \"<prompt>\"   │  │\n│  │ 4. Validate output            │  │\n│  │ 5. Apply changes              │  │\n│  └───────────────────────────────┘  │\n└─────────────────────────────────────┘\n```\n\n**You must provide all file context in the prompt** — DeepSeek exec is truly filesystem-blind.\n\n### Mode 2: `deepseek run` — Interactive (Direct Coding)\n\n`deepseek run` launches the full TUI with real tool-calling capabilities:\n\n- `list_files` — browse directories\n- `read_file` — read file contents\n- `write_file` / `edit_file` — modify files\n- `terminal` / `bash` — execute shell commands\n- `grep` / `search` — search codebase\n- And more...\n\nWhen invoked from the workspace directory, it can read the entire project. Use this for direct coding sessions where you want DeepSeek to explore, edit, and build autonomously.\n\n---\n\n## How to Use (Headless Exec Mode)\n\n### Step 1 — Understand the Codebase First\n\nRead all relevant files yourself *before* invoking DeepSeek. You need to know:\n\n- Existing patterns and conventions\n- Interfaces, types, and component signatures\n- Exact insertion points and file structure\n\nDeepSeek **exec** cannot see your filesystem, so **you must provide context** in the prompt.\n\n### Step 2 — Craft a Focused Prompt\n\nDo NOT dump entire files. Structure your prompt like this:\n\n```\n[One-line context about the project]\n[Interface of components being used]\n[Example of existing usage pattern]\n[Numbered change list — specific, actionable]\n[Important constraints]\n```\n\n### Step 3 — Invoke DeepSeek\n\n```bash\n# Option A: pipeline from a file\ndeepseek exec \"$(cat /path/to/prompt.txt)\" 2>&1\n\n# Option B: inline (shorter prompts)\ndeepseek exec \"Add a blue button that says 'Click Me' to the homepage.\" 2>&1\n```\n\n### Step 4 — Validate the Output\n\nDeepSeek's headless mode may display tool calls in its response **as simulated reasoning text** — ignore these. The actual output is the text content. Watch for:\n\n| Behavior | Action |\n|----------|--------|\n| ✓ Returns correct code snippets | Extract from markdown blocks, apply |\n| ✗ Restructures/rewrites entire files | Discard, extract only the snippets you need |\n| ✗ Hallucinates interfaces or APIs | Cross-check against your own codebase context |\n| ✗ Displays `<function_calls>` blocks | These are simulated reasoning, not real tool execution |\n\n### Step 5 — Apply Changes Yourself\n\nUse targeted file editing tools (like `patch` or `write_file`) to apply only the confirmed snippets. Never blindly trust full-file output from exec mode.\n\n### Step 6 — Build & Verify\n\n```bash\ncd /path/to/project\nnpm run build  # or npx next build, cargo build, etc.\n```\n\n---\n\n## How to Use (Interactive Run Mode)\n\nWhen you want DeepSeek to explore and edit files directly:\n\n```bash\ncd /path/to/project\ndeepseek run\n```\n\nOr pass a goal directly:\n```bash\ndeepseek run \"Add a CommandBlock to the skills page similar to the bounties page\"\n```\n\nIn this mode, DeepSeek has full tool access and can read/write files, search, and execute commands autonomously. This is the mode the user discovered where \"it reads all files in the current workspace.\"\n\n---\n\n## Best Practices\n\n1. **Use `exec` for delegation, `run` for autonomy** — if you have your own tooling to read files and want tight control, use exec. If you want DeepSeek to explore and figure things out, use run.\n2. **Be surgically specific** in exec mode — tell DeepSeek exact line numbers, anchor comments, and import paths\n3. **Validate by building** — always compile/typecheck after applying DeepSeek's output\n4. **Use targeted edits** — `patch` (find-and-replace) over writing entire files\n5. **Keep prompts under 10KB** in exec mode — large prompts may degrade output quality; split across multiple calls if needed\n6. **Exec mode shows tool calls as text** — do not be misled. The `<function_calls>` blocks in exec output are simulated reasoning, not real execution\n\n## Real-World Example\n\nIn a real session, DeepSeek exec generated code to add a `CommandBlock` installation component to an Emergence Science skills detail page:\n\n1. Read the existing bounty page to understand the `CommandBlock` pattern\n2. Read the target skills page to find insertion points\n3. Crafted prompt with: `CommandBlock` interface, existing usage example, exact insertion instructions\n4. Ran `deepseek exec` → got confirmed import and JSX snippets (with simulated tool calls in the output)\n5. Applied with `patch`, built with `npx next build` → ✅ clean\n\n## Troubleshooting\n\n| Problem | Fix |\n|---------|-----|\n| DeepSeek returns nothing (exec) | Check API key and network: `deepseek exec \"hello\"` |\n| Output shows `<function_calls>` blocks | These are simulated reasoning, not real execution — treat as text output |\n| Output is truncated | Break task into smaller prompts |\n| Hallucinated code structure | Be more explicit about file paths and existing code |\n| Too slow | DeepSeek V4 is fast (~2-5s per call); long responses may indicate poor prompting |\n| Files not found (interactive mode) | Ensure you `cd` into the correct workspace before `deepseek run` |\n","tags":{"code-generation":"1.0.0","deepseek-tui":"1.0.0","delegation":"1.0.0","headless-llm":"1.0.0","latest":"1.0.0","multi-agent":"1.0.0"},"stats":{"comments":0,"downloads":388,"installsAllTime":0,"installsCurrent":0,"stars":0,"versions":1},"createdAt":1778150617331,"updatedAt":1779076246873},"latestVersion":{"version":"1.0.0","createdAt":1778150617331,"changelog":"Initial release – enables Hermes/OpenClaw agents to use DeepSeek TUI CLI as an autonomous code assistant in two distinct modes:\n\n- Supports `deepseek exec` (headless, text-in/text-out, no filesystem access) for delegated code generation.\n- Supports `deepseek run` (interactive, full tool-calling with filesystem access) for direct autonomous coding and file manipulation.\n- Provides detailed usage guidance, best practices, and troubleshooting tips for both modes.\n- Includes practical workflow examples and installation instructions.\n- Tags and related skills metadata for integration into multi-agent coding workflows.","license":"MIT-0"},"metadata":{"setup":[],"os":null,"systems":null},"owner":{"handle":"emergencescience","userId":"s17a35617mabw6kewbzv4z4e7x83w38h","displayName":"emergencescience","image":"https://avatars.githubusercontent.com/u/264674637?v=4"},"moderation":null}