harnessclaw-engine

作者 harnessclaw已验证

An LLM programming assistant engine built with Go, supporting WebSocket, multi-turn dialogues, tool calling, permission control, and skill extension.

271
Stars
94
Forks
Go
语言
2026/8/23
添加时间

⚠️ 第三方软件声明

本 Skill 为第三方开源软件,独立托管于 GitHub。SkillTip 仅为信息目录,不控制或维护底层仓库。所显示的安全检查为自动化且范围有限,安装前请自行审查源码。

阅读服务条款

安装

添加到你的 Claude Code skills 目录:

# Add to your Claude Code skills
git clone https://github.com/harnessclaw/harnessclaw-engine

快速入门

使用 harnessclaw-engine 等 Skills 的指南。

安全报告

已验证

上次扫描:—

{
  "status": "PASSED",
  "issues": []
}

README.md

HarnessClaw Engine

License

English | 中文

An LLM programming assistant engine built with Go. It provides capabilities via the WebSocket protocol, supporting multi-turn dialogues, tool calling, permission control, and skill extension.

Architecture Overview

┌───────────-──┐   ┌─────────────┐   ┌─────────────┐
│  WebSocket   │   │    HTTP     │   │   Feishu    │
│  Channel     │   │   Channel   │   │  Channel    │
└──────┬───────┘   └──────┬──────┘   └──────┬──────┘
       │                  │                  │
       └──────────────────┼──────────────────┘
                          ▼
                ┌──────────────────┐
                │Router + Middleware│  Auth / RateLimit / Logging
                └────────┬─────────┘
                         ▼
                ┌──────────────────┐
                │   Query Engine   │  5-Phase Loop
                │  (queryloop.go)  │  Preprocessing → LLM Streaming → Error Recovery
                └───┬──────────┬───┘  → Tool Execution → Continuation Check
                    │          │
              ┌─────▼──-─┐  ┌──▼──────────┐
              │ Provider │  │ Tool System │
              │ (LLM)    │  │ 7 Built-in  │
              └───────-──┘  └─────────────┘

Dependency Direction: Channel → Router → Engine → Provider / Tool (Unidirectional, no circular dependencies)

Core Features

  • 5-Phase Query Loop — Preprocessing (Auto-compaction) → LLM Streaming Call → Error Recovery (Exponential Backoff) → Tool Execution (Parallel/Serial) → Continuation Check
  • WebSocket Protocol v2.2 (Card Model) — UI-first streaming: 8 actions (card.add/set/append/tick/close + prompt.user/reply + session.event) × 13 card kinds; server-side & client-side tool execution, permission / question / plan-review prompts, and crash-recovery of unanswered prompts
  • 7 Built-in Tools — Bash, FileRead, FileEdit, FileWrite, Grep, Glob, WebFetch
  • 6-Step Permission Pipeline — DenyRule → ToolCheckPerm → BypassMode → AlwaysAllowRule → ReadOnlyAutoAllow → ModeDefault, supporting 6 permission modes
  • Skill System — Loads skills from SKILL.md files, supporting YAML frontmatter, parameter substitution, and priority override
  • Multi-Provider Support — Direct Anthropic SSE client + Bifrost Multi-Provider adapter (Anthropic/OpenAI/Bedrock/Vertex)
  • Context Compaction — LLM-based conversation summarization + Circuit breaker pattern, automatically triggered when token usage reaches the threshold
  • Session Management — Thread-safe session state, multi-connection fan-out, idle timeout reclamation

Project Structure

go_rebuild/
├── cmd/server/           # Entry point & Integration tests
│   ├── main.go           # 11-step startup process
│   └── main_test.go      # E2E tests (build tag: integration)
├── configs/
│   └── config.yaml       # Default configuration
├── internal/
│   ├── channel/           # Multi-protocol access layer (WebSocket / HTTP / Feishu)
│   ├── command/           # Command registration & Priority system
│   ├── config/            # Viper configuration management (50+ defaults)
│   ├── engine/            # Core query engine
│   │   ├── queryloop.go   # QueryEngine main loop (831 lines)
│   │   ├── executor.go    # Parallel/Serial tool executor
│   │   ├── compact/       # LLM context compaction
│   │   ├── context/       # System prompt assembly
│   │   └── session/       # Session state & Lifecycle
│   ├── event/             # In-process pub/sub event bus
│   ├── permission/        # 6-step permission pipeline (6 modes)
│   ├── provider/          # LLM Provider abstraction
│   │   ├── anthropic/     # Direct Anthropic SSE client
│   │   ├── bifrost/       # Multi-Provider adapter
│   │   └── retry/         # Exponential backoff + 529 overload switching
│   ├── router/            # Message routing + Middleware chain
│   ├── skill/             # SKILL.md loading & Parameter substitution
│   ├── storage/           # Storage interfaces (Memory implementation)
│   └── tool/              # Tool system
│       ├── tool.go        # Tool interface + 10 extension interfaces
│       ├── registry.go    # Thread-safe tool registry
│       ├── pool.go        # Immutable per-query tool pool
│       └── bash/fileread/fileedit/filewrite/grep/glob/webfetch/skilltool/
├── pkg/
│   ├── types/             # Shared types (Message, Event, ToolCall, Context)
│   └── errors/            # Domain errors (16 error codes)
├── docs/
│   ├── protocols/         # WebSocket protocol specification (v2.2)
├── Makefile               # Build/Run/Test/Lint
└── go.mod                 # Go 1.26.1

Quick Start

Prerequisites

  • Go 1.26+
  • (Optional) golangci-lint — For code linting
  • (Optional) ripgrep — Runtime dependency for the Grep tool

Build & Run

# Build
make build              # Outputs to ./dist/harnessclaw-engine

# Run (using default configuration)
make run                # go run ./cmd/server -config ./configs/config.yaml

# Run directly with a specific configuration file
./dist/harnessclaw-engine -config ./configs/config.yaml

Testing

# Unit tests
make test               # go test ./... -v -race -count=1

# Coverage report
make test-cover         # Generates coverage.html

# Integration tests (requires real LLM API)
go test -tags=integration ./cmd/server/ -v
go test -tags=integration ./internal/provider/bifrost/ -v

Other Commands

make fmt                # Format code
make tidy               # Tidy go.mod
make lint               # Run linters
make vuln               # Scan for vulnerabilities
make clean              # Clean build artifacts

Configuration

The configuration file is located at configs/config.yaml. Main configuration items:

Configuration ItemDescriptionDefault Value
server.portHTTP server port8080
channels.websocket.portWebSocket port8081
channels.websocket.pathWebSocket path/v1/ws
llm.default_providerLLM Provideranthropic
llm.providers.anthropic.modelModel nameastron-code-latest
engine.max_turnsMax tool calls per turn50
engine.auto_compact_thresholdToken ratio threshold for auto-compaction0.8
session.idle_timeoutSession idle timeout30m
permission.modePermission modedefault
tools.*Individual tool togglesAll true

WebSocket Protocol

Connection Address: ws://host:8081/v1/ws

The protocol is a UI-first card model: the engine streams cards (a turn, a message, a tool call, a sub-agent, …) that are opened, appended to, and closed, rather than a flat event log.

Session Lifecycle

Client                                    Server
  │                                         │
  │── WebSocket upgrade ────────────────────>│
  │<──────────────── 101 Switching ─────────│
  │<──── session.event (kind=opened) ───────│  handshake + capabilities
  │                                         │
  │── user.message ─────────────────────────>│
  │<──────────────── card.add ──────────────│  open a card (turn / message / tool / …)
  │<──────────────── card.append ───────────│  stream content (channel: text / tool_input)
  │<──── prompt.user (permission / … ) ─────│  engine asks; blocks until answered
  │── prompt.user_response ─────────────────>│
  │<──────────────── card.close ────────────│  card done (+ metrics: tokens, cost)
  │<──────────── card.close (kind=turn) ────│  turn finished
  │                                         │
  │── session.interrupt (trace_id) ─────────>│  interrupt an in-flight turn
  │── session.resume  (last_seq) ───────────>│  reconnect & replay missed events

For a copy-paste client, see the Usage Examples; for the full wire contract, see docs/protocols/websocket.md.

Documentation

📞 Support

License

Apache-2.0 License. See LICENSE for details.

常见问题

What is harnessclaw-engine?

harnessclaw-engine is an open-source ai agents skill for AI coding assistants such as Claude Code, Codex CLI, and ChatGPT, built by harnessclaw. An LLM programming assistant engine built with Go, supporting WebSocket, multi-turn dialogues, tool calling, permission control, and skill extension. It has 271 GitHub stars.

Is harnessclaw-engine safe to use?

Yes. harnessclaw-engine passed SkillsLLM's automated security scan — a dependency vulnerability audit plus prompt-injection heuristics — with no high-severity issues. You can read the full report in the Security Report section on this page.

How do I install harnessclaw-engine?

Clone the repository with "git clone https://github.com/harnessclaw/harnessclaw-engine" and add it to your Claude Code skills directory (see the Installation section above).

What programming language is harnessclaw-engine written in?

harnessclaw-engine is primarily written in Go. It is open-source under harnessclaw on GitHub, so you can review or fork the full source.

Are there alternatives to harnessclaw-engine?

Yes. SkillsLLM lists many other AI Agents skills you can browse and compare side by side. Open the AI Agents category from the badge at the top of this page, or use the Related Skills and comparison links further down to weigh harnessclaw-engine against similar tools.

评论 (0)

暂无评论,成为第一个分享想法的人!

ECC

by affaan-m

10

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

242,21936,702JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情
15

An agentic skills framework & software development methodology that works.

234,96620,863Shell
AI 智能体ai-agentsbrainstorming
查看详情

hermes-agent

by NousResearch

10

The agent that grows with you

234,43747,175Python
AI 智能体ai-agentsagent-orchestration
查看详情

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

185,94028,768JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情

cc-switch

by farion1231

3

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Grok Build & Hermes Agent. Only official website: ccswitch.io

128,8688,826Rust
AI 智能体claude-codeai-tools
查看详情

claude-code

by anthropics

Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.

120,03119,897Shell
AI 智能体
查看详情

开发者还喜欢

基于喜欢此 Skill 的开发者投票和收藏

ECC

by affaan-m

10

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

242,21936,702JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情
15

An agentic skills framework & software development methodology that works.

234,96620,863Shell
AI 智能体ai-agentsbrainstorming
查看详情

hermes-agent

by NousResearch

10

The agent that grows with you

234,43747,175Python
AI 智能体ai-agentsagent-orchestration
查看详情

n8n

by n8n-io

12

Fair-code workflow automation platform with native AI capabilities. Combine visual building with custom code, self-host or cloud, 400+ integrations.

201,88160,308TypeScript
MCP 服务器apisai-tools
查看详情

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

185,94028,768JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情

cc-switch

by farion1231

3

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Grok Build & Hermes Agent. Only official website: ccswitch.io

128,8688,826Rust
AI 智能体claude-codeai-tools
查看详情