KL

kevin0x5/langdriver

效率工作流

本页由 AI 翻译,技术细节请以原文为准。 查看原文

11 stars 质量 57 趋势 22MIT

A minimalist agent in ~500 lines of Ruby: ReAct loop + macOS Seatbelt sandbox + security approvals + MCP + Skills + persistent memory

概览

LangDriver is a lightweight Agent runtime implemented in under 500 lines of Ruby, with ReAct, context compaction, persistent memory, Skills, MCP, Hooks, sandboxing, and permission approvals. Requires macOS and Ruby 3.0+ (uses Reline shipped with Ruby 3). The default config is already tuned for DeepSeek: - : use deepseek-v4-pro or deepseek-v4-flash. The compatibility names deepseek-chat / deepseek-reasoner will be retired on . - : DeepSeek v4 provides a 1M context window without an extra request field. Other providers may use different limits and field names; follow that provider's API documentation instead of copying DeepSeek values. - : declared via top-level reasoning_effort and thinking fields. LangDriver pipes the entire runtime.extra block into the request body verbatim. - : LangDriver uses the Chat Completions message/tool shape, but provider-specific models, fields, streaming details, and authentication may still require configuration or code changes.

README

以下为原文 README 节选,完整内容请查看原文。

LangDriver

中文

LangDriver is a lightweight Agent runtime implemented in under 500 lines of Ruby, with ReAct, context compaction, persistent memory, Skills, MCP, Hooks, sandboxing, and permission approvals.


Install

Requires macOS and Ruby 3.0+ (uses Reline shipped with Ruby 3).

git clone https://github.com/kevin0x5/langdriver && cd langdriver
ruby --version    # expect ruby 3.0+

Configure

1. API key

export DEEPSEEK_API_KEY="YOUR_DEEPSEEK_API_KEY"

2. langdriver.yaml

The default config is already tuned for DeepSeek:

runtime:
  model: deepseek-v4-pro                # or deepseek-v4-flash (cheaper / faster)
  compact_model: deepseek-v4-flash      # used for async chat compaction; falls back to model
  api_base: https://api.deepseek.com    # DeepSeek endpoint; other providers may require request-field changes
  api_key_env: DEEPSEEK_API_KEY
  max_steps: 50
  extra:                                # forwarded verbatim into chat/completions request body
    max_tokens: 384000                  # DeepSeek v4 single-call max output
    reasoning_effort: max               # recommended for complex agent tasks
    thinking: { type: enabled }         # chain-of-thought (DeepSeek-V3.2+ supports tool calls in thinking mode)

Notes:

  • Model names: use deepseek-v4-pro or deepseek-v4-flash. The compatibility names deepseek-chat / deepseek-reasoner will be retired on July 24, 2026.
  • Context limits: DeepSeek v4 provides a 1M context window without an extra request field. Other providers may use different limits and field names; follow that provider’s API documentation instead of copying DeepSeek values.
  • Max thinking effort: declared via top-level reasoning_effort and thinking fields. LangDriver pipes the entire runtime.extra block into the request body verbatim.
  • Switch provider: LangDriver uses the Chat Completions message/tool shape, but provider-specific models, fields, streaming details, and authentication may still require configuration or code changes. Remove unsupported DeepSeek-only fields such as thinking when appropriate.

3. Other declarative files (project root)

File Purpose
profile.md Assistant persona / tone (system prompt)
prompts.yaml Tunable prompt templates (system_suffix, compact) — delete to use built-in defaults
memory.md Long-term project facts; auto-injected into system prompt
summaries.md Auto-appended summaries (one block per 50 turns)
skills.yaml Per-skill enable / trust / priority
tools.yaml Permission ceiling for built-in file tools, external Skills, and the optional shell
hooks.yaml after_user_prompt / after_tool_use reminder text
mcp.yaml MCP server connections

First run

ruby langdriver.rb

In the REPL:

> read sample.txt and summarize it in one sentence
在 GitHub 查看完整 README

推荐工具

换一个关键词,或者移除筛选条件。

安装

npx skillfish add kevin0x5/langdriver
新手?先看 mcpskill.org 教程 →