AgentStack
MCP verified MIT Self-run

ClawdCode

mcp-kkkhs-clawdcode Β· by kkkhs

πŸ¦€ An AI-Powered CLI Coding Agent - Your intelligent coding companion in the terminal

β€” No reviews yet
0 installs
16 views
0.0% view→install

Install

$ agentstack add mcp-kkkhs-clawdcode

βœ“ scanned Β· βœ“ verified β€” works with Claude Code, Cursor, and more.

Security review

βœ“ Passed

No issues found. Passed automated security review. Β· v0.1.0 How review works β†’

  • βœ“ Prompt-injection patterns
  • βœ“ Secret / credential exfiltration
  • βœ“ Dangerous shell & filesystem operations
  • βœ“ Untrusted network calls
  • βœ“ Known-malicious package signatures

What it can access

  • βœ“ Network access No
  • βœ“ Filesystem access No
  • βœ“ Shell / process execution No
  • ● Environment & secrets Used
  • βœ“ Dynamic code execution No

From automated source analysis of v0.1.0. β€œUsed” means the capability is present in the source β€” more access means more to trust, not that it’s unsafe.

Are you the author of ClawdCode? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

ClawdCode

An AI-Powered CLI Coding Agent

Inspired by Claude Code β€” read, write, and execute code directly in your terminal.

Features β€’ Installation β€’ Quick Start β€’ Architecture β€’ Documentation


✨ Features

πŸ€– Intelligent Agent

  • Agentic Loop: LLM + System Prompt + Context + Tools
  • Streaming output with real-time response
  • Thinking process with auto-collapse/expand
  • Tool call display with compact dim-styled logs
  • AbortController-based Ctrl+C interruption

πŸ› οΈ Built-in Tools (7)

  • Read / Write / Edit β€” file operations with diff preview
  • Glob / Grep β€” fast code search and pattern matching
  • Bash β€” shell execution with permission control
  • MCP β€” external tool integration via Model Context Protocol

πŸ”’ Security & Permissions

  • 4 permission modes: default / autoEdit / yolo / plan
  • 7-stage execution pipeline with safety checks
  • Inline permission prompt above input area
  • Sensitive file detection (.env, credentials, etc.)
  • Deny stops agent immediately β€” no continued thinking

🎨 Terminal UI

  • Ink (React for CLI) β€” declarative interactive UI
  • Markdown rendering with 140+ language syntax highlighting
  • 5 built-in themes with auto dark/light detection
  • Theme persistence across sessions
  • Code block file paths and /copy clipboard support

🧩 Extensions

  • Slash Commands β€” /help, /compact, /model, /theme, ...
  • Custom Commands β€” Markdown files as commands, zero code
  • Skills β€” pluggable agent capabilities via SKILL.md
  • Hooks β€” 11 lifecycle events with pre/post shell scripts

πŸ“¦ State & Context

  • Zustand store with fine-grained subscriptions
  • Token counting and auto-compaction
  • Session persistence and resume (--continue)
  • Command history with arrow key navigation
  • MCP Registry for external tool servers

πŸ“₯ Installation

# npm
npm install -g clawdcode

# pnpm
pnpm add -g clawdcode

# bun (recommended)
bun add -g clawdcode

πŸš€ Quick Start

1. Configure API Key

# Interactive setup
clawdcode --init

# Or set environment variable
export OPENAI_API_KEY=sk-your-api-key

# Or use other OpenAI-compatible providers
export OPENAI_BASE_URL=https://api.deepseek.com
export OPENAI_API_KEY=sk-your-deepseek-key

2. Start Coding

# Interactive mode
clawdcode

# With initial message
clawdcode "analyze this project structure"

# With specific model
clawdcode --model gpt-4o

# Resume previous session
clawdcode --continue

3. Slash Commands

/help       Show all commands
/clear      Clear conversation
/compact    Compress context (save tokens)
/model      Switch model interactively
/theme      Switch theme (dark/light/ocean/forest/sunset)
/status     Show session info
/copy       Copy code block to clipboard (/copy list)
/thinking   Toggle thinking block expand/collapse
/mcp        MCP server status
/hooks      List active hooks
/skills     List loaded skills

πŸ—οΈ Architecture

Coding Agent = LLM + System Prompt + Context + Tools
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  CLI Entry (yargs)                                       β”‚
β”‚    ↓                                                     β”‚
β”‚  Agent Loop ←──────────────────────────────┐             β”‚
β”‚    β”œβ”€ Build Context (messages + tools)     β”‚             β”‚
β”‚    β”œβ”€ Call LLM (streaming)                 β”‚             β”‚
β”‚    β”œβ”€ Parse Response                       β”‚             β”‚
β”‚    β”‚   β”œβ”€ text β†’ render to UI              β”‚             β”‚
β”‚    β”‚   └─ tool_calls β†’ Execution Pipeline  β”‚             β”‚
β”‚    β”‚        β”œβ”€ 1. Discovery                β”‚             β”‚
β”‚    β”‚        β”œβ”€ 2. Permission               β”‚             β”‚
β”‚    β”‚        β”œβ”€ 3. Pre-Hooks                β”‚             β”‚
β”‚    β”‚        β”œβ”€ 4. Confirmation (UI)        β”‚             β”‚
β”‚    β”‚        β”œβ”€ 5. Execute                  β”‚             β”‚
β”‚    β”‚        β”œβ”€ 6. Post-Hooks               β”‚             β”‚
β”‚    β”‚        └─ 7. Format                   β”‚             β”‚
β”‚    └─ Inject Results β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜             β”‚
β”‚                                                          β”‚
β”‚  Store (Zustand) ← β†’ UI (Ink/React) ← β†’ Theme Manager   β”‚
β”‚  Context Manager ← β†’ Token Counter ← β†’ Compaction        β”‚
β”‚  MCP Registry ← β†’ External Tool Servers                  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ“ Custom Commands

Create project-specific commands in .clawdcode/commands/ (shareable via Git):

.clawdcode/commands/review.md

---
description: Code review for current changes
---

Review the current Git changes.

## Changes
!`git diff --stat HEAD~1`

## Requirements
1. Summarize what changed
2. Point out potential issues
3. Suggest improvements

.clawdcode/commands/test.md

---
description: Run tests and analyze failures
argument-hint: [test file or pattern]
allowed-tools:
  - Bash(npm:*)
  - Read
---

Run tests: $ARGUMENTS

If any test fails, analyze the cause and suggest fixes.

Then use them:

/review              # Code review
/test src/utils      # Run specific tests

Dynamic Content Syntax

| Syntax | Description | Example | |--------|-------------|---------| | $ARGUMENTS | All arguments | /cmd foo bar β†’ foo bar | | $1, $2 | Positional args | /greet Alice β†’ $1=Alice | | ` !cmd | Bash embed | !git branch | | @path | File reference | @package.json` |

βš™οΈ Configuration

ClawdCode supports multiple configuration methods (in priority order):

  1. CLI arguments β€” --api-key, --base-url, --model
  2. Environment variables β€” OPENAI_API_KEY, OPENAI_BASE_URL
  3. Project config β€” ./.clawdcode/config.json
  4. User config β€” ~/.clawdcode/config.json

Config File Example

{
  "default": {
    "apiKey": "sk-your-api-key",
    "baseURL": "https://api.openai.com/v1",
    "model": "gpt-4o"
  },
  "ui": {
    "theme": "dark"
  },
  "permissions": {
    "allow": ["Bash(npm:*)", "Bash(git:*)"],
    "deny": ["Bash(rm -rf:*)"]
  },
  "mcpServers": {
    "filesystem": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "."]
    }
  }
}

Permission Modes

| Mode | Read | Write | Execute | Description | |------|:----:|:-----:|:-------:|-------------| | default | βœ… | ❓ | ❓ | Ask for write/execute | | autoEdit | βœ… | βœ… | ❓ | Auto-approve writes | | yolo | βœ… | βœ… | βœ… | Full auto mode | | plan | βœ… | ❌ | ❌ | Read-only analysis |

clawdcode --permission yolo "fix all lint errors automatically"

Permission Rules

{
  "permissions": {
    "allow": [
      "Read(**/*.ts)",
      "Bash(npm:*)",
      "Bash(git:*)"
    ],
    "deny": [
      "Bash(rm -rf:*)",
      "Write(/etc/*)"
    ]
  }
}

Rule format: ToolName(pattern)

  • Exact: Bash(npm test)
  • Prefix: Bash(npm:*) β†’ matches npm install, npm test, etc.
  • Glob: Read(**/*.ts) β†’ matches all TypeScript files

Hooks

Add lifecycle hooks in .clawdcode/settings.json:

{
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "Bash",
        "hooks": ["echo 'About to run shell command: $TOOL_INPUT'"]
      }
    ],
    "PostToolUse": [
      {
        "matcher": "Write",
        "hooks": ["npx prettier --write $FILE_PATH"]
      }
    ],
    "Notification": [
      {
        "matcher": "",
        "hooks": ["terminal-notifier -message '$NOTIFICATION_MESSAGE'"]
      }
    ]
  }
}

11 hook events: PreToolUse, PostToolUse, Stop, UserPromptSubmit, Notification, etc.

πŸ’» CLI Options

Usage: clawdcode [options] [message]

Options:
  --api-key, -k      OpenAI API key
  --base-url, -b     OpenAI API base URL
  --model, -m        Model to use (default: gpt-4o)
  --permission, -p   Permission mode (default/autoEdit/yolo/plan)
  --theme, -t        Color theme (dark/light/ocean/forest/sunset)
  --continue, -c     Resume previous session
  --debug, -d        Enable debug mode
  --init             Create default config file
  --help, -h         Show help
  --version, -v      Show version

πŸ”§ Tech Stack

| Technology | Role | |:-----------|:-----| | TypeScript | Type safety, strict mode | | Bun | Build & runtime | | Ink | React for CLI β€” declarative terminal UI | | Zustand | Lightweight state management | | OpenAI SDK | Compatible with OpenAI / DeepSeek / local models | | Zod | Runtime parameter validation | | MCP | Model Context Protocol for external tools | | lowlight | 140+ language syntax highlighting |

πŸ“– Documentation

> πŸ“š Complete Tutorial β€” 17 Chapters β€” Build an AI CLI Coding Agent from scratch

| Part | Chapters | Topics | |:-----|:---------|:-------| | Getting Started | 01 - 03 | Coding Agent overview, project setup, CLI entry | | Core Architecture | 04 - 07 | Agent core, system prompt, tool system, execution pipeline | | System Integration | 08 - 12 | Context management, UI system, MCP protocol, state management, command history | | Extensions | 13 - 17 | Slash commands, interactive commands, streaming & themes, skills, hooks |

πŸ’‘ Examples

# Analyze project structure
clawdcode "analyze this project's architecture"

# Fix TypeScript errors
clawdcode "fix all TypeScript type errors"

# Code review (read-only mode)
clawdcode --permission plan "review the recent code changes"

# Full auto mode
clawdcode --permission yolo "format all files with prettier"

# Use DeepSeek
clawdcode --base-url https://api.deepseek.com --model deepseek-chat "refactor this function"

πŸ›  Development

# Clone
git clone https://github.com/kkkhs/ClawdCode.git
cd ClawdCode

# Install
bun install

# Dev
bun run dev

# Build
bun run build

# Type check
bun run typecheck

🀝 Contributing

Contributions welcome. Please submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feat/amazing-feature)
  3. Commit your changes (git commit -m 'feat: add amazing feature')
  4. Push to the branch (git push origin feat/amazing-feature)
  5. Open a Pull Request

πŸ“„ License

[MIT](LICENSE) Β© 2024-present


Built with ❀️ by kkkhs

Source & license

This open-source MCP server is cataloged on AgentStack and links to its original source β€” we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet β€” be the first.

Versions

  • v0.1.0 Imported from the upstream source.