@falkenslab/agent-kit

中文文档
0.35.0发布于 2026/11/12MITTypeScriptES Module近 30 天下载 2626

Library for building an agent on top of the Claude Agent SDK

原始使用文档
文档目录7 节
  1. ✨ Why agent-kit
  2. 🚀 Quick start
  3. 🧪 A taste of the code
  4. 📸 See it at work
  5. 🧰 What's inside
  6. 📚 Documentation
  7. 🛠️ Developing
agent-kit logo: three blue building blocks and a coral one being set in place

agent-kit

Build an AI agent on Claude that asks before it acts, remembers, and chats like Claude Code.
You write what your agent knows and does; the kit brings oversight, safety, memory and the interface.

npm Node.js 20+ Claude Agent SDK TypeScript License: MIT

📖 Documentation · 📖 Documentación en español

agent-kit is a foundation for building AI agents on top of the Claude Agent SDK. It isn't an agent itself: it solves once what every agent needs (levels of oversight, approvals, safe limits, memory across sessions, extensions, and a terminal chat as good as Claude Code's), so each agent writes only what belongs to its own domain: what it knows how to do, with which tools, and how it talks. A teacher's assistant for Moodle and a pirate cat who tells jokes are built the same way.

✨ Why agent-kit

  • 🎚️ You choose how much it acts alone. Autonomous, guided (it asks before what others will see or can't be undone), step by step, or a plan mode where it only reads and plans; switch among them in the same conversation.
  • ✋ It asks a person, and the kit makes sure. Approvals, choices, a file, a sign-in by hand; an installed extension's tool that changes things waits for a yes whatever the model decided, and answers can last for the session or for good.
  • 🧠 It remembers. A knowledge base that grows with every session, the original documents it learns from kept untouched, a memory of the person, and every conversation to pick up again with --continue or /resume.
  • 🛡️ It stays within limits. Only its own folders, never protected files, subagents that can't slip past the main agent's limits, secrets hidden from the logs, remote servers allowed, asked about or denied.
  • 🧩 It grows with extensions. Claude Code plugins with MCP servers, skills and commands, installed from a marketplace or a folder, with their own options, sign-in and a catalog in the chat; no Git needed.
  • 🌐 It speaks your language. Its interface in English, Spanish, French or German, and it answers in that language unless you write in another.
  • 🖥️ A terminal chat like Claude Code's, or none at all. Full screen, live markdown, folded tool calls, panels, history, themes; or the same agent inside a desktop app or a web page with its own interface.

🚀 Quick start

You need Node.js 20 or later and a Claude account. In a project with "type": "module" in its package.json:

npm install @falkenslab/agent-kit tsx

Save this as agent.ts: the only part that's your agent's is the spec at the top.

import path from "node:path";
import { buildSessionOptions, ensureClaudeAuth, runChatInk, type AgentSpec, type BaseSessionConfig } from "@falkenslab/agent-kit";

const spec: AgentSpec<BaseSessionConfig> = {
  buildSystemPrompt: () => "You are a pirate cat who tells jokes. Always answer in character.",
  buildMcpServers: () => ({}), // its own MCP servers, if any
  pluginRoots: () => [], // folders with skills and commands
  buildSubagents: () => undefined, // subagents, if it delegates to any
};

await ensureClaudeAuth(); // offers to sign in with your Claude account, on Anthropic's page, if it isn't
const config: BaseSessionConfig = { mode: "guided", projectDir: process.cwd() };

// Each run gets a folder under .run/ (keep it out of git): its log, transcript and conversation.
await runChatInk((run) => buildSessionOptions(config, run.dir, spec, { run }), {
  runsDir: path.resolve(".run"),
  header: { title: "My agent" },
  mode: config.mode, // Shift+Tab cycles through guided, step by step and plan
  fullscreen: true,
});

Run it with npx tsx agent.ts: a full-screen chat opens, in your system's language, and the agent asks before anything it shouldn't do alone. The tutorial takes it from there.

🧪 A taste of the code

Give it a memory and a folder of sources, with the kit's own extensions:

import { knowledge, memory, sources } from "@falkenslab/agent-kit";

const spec: AgentSpec<BaseSessionConfig> = {
  // …
  extensions: [sources({ dir: "sources" }), knowledge({ dir: "knowledge" }), memory({ dir: "memory" })],
};

Let it install extensions from your marketplace, and keep its data from leaving the computer without asking:

const config: BaseSessionConfig = {
  mode: "guided",
  projectDir: process.cwd(),
  extensionDirs: { agent: path.join(os.homedir(), ".my-agent", "extensions") },
  officialMarketplace: "falkenslab/agent-extensions",
  remoteServers: "ask",
};

Make a tool always wait for the person's yes, on every call:

const spec: AgentSpec<BaseSessionConfig> = {
  // …
  extensionGate: { confirmTools: { canva: ["create-design", "publish-design"] } },
};

📸 See it at work

Captain Whiskers, the kit's example agent: a retired pirate cat who tells jokes in your language, with a crew of subagents (one looks for new jokes on the web, one rates them, one tells the time), a logbook and an extension of his own. He runs in the terminal, in a browser and as a Windows app.

Captain Whiskers in Windows Terminal: his logo with the mode and the agent-kit version at the top, his crew at work in the middle, a task list under the spinner, and the framed prompt and status bar at the bottom

See everything he can do, with screenshots. For a real one, miyagi is an assistant for Moodle teachers: it grades, answers the forum, builds content and sums up how the class is going, asking before publishing anything students will see. Oversight, memory, safety and the chat come from the kit; miyagi brings what it knows about Moodle.

🧰 What's inside

AreaFor example
🎚️ Modes and gatesAutonomous, guided, step by step and plan; the guided gate for extensions' tools, the plan gate, the step gate
✋ Human in the loopApprovals, choices, free text, files, manual steps, MCP elicitation forms, a response file for hosts without a keyboard
🧠 MemoryA knowledge base (an LLM wiki), sources kept as obtained, a memory of the person, runs resumed with --continue and /resume
🧩 ExtensionsClaude Code plugins with MCP servers (local, npm, remote with OAuth), skills, commands and subagents; scopes, a lock, workspace trust, options, marketplaces and a catalog
🛡️ SecurityA file scope gate, denied paths, subagent gates, a remote-servers gate, isolation from the runner's own Claude Code, redacted transcripts
🤖 SubagentsDeclared types only, in the foreground, without Bash for the main agent
🖥️ InterfacesA full-screen Ink chat, a plain readline chat, a progress view, a wizard, themes; a chat controller for desktop apps and web pages; an MCP server, so other agents can ask it things
🌐 LanguagesEnglish, Spanish, French and German, for the interface, the replies and the extensions' servers

Every export, with what it takes and what it gives, is in the API reference.

📚 Documentation

🛠️ Developing

The design decisions, and the SDK behaviors checked by hand behind several safeguards, are in .minispec/.

CommandWhat it does
npm run buildBuilds the kit into dist/
npm run typecheckChecks the types without building
npm run lintChecks the code style
npm testRuns all the tests (one file: npx tsx --test test/tui/promptErrors.test.ts)
npm run docs:installInstalls the documentation site's dependencies (once)
npm run docs:startServes the documentation site locally, reloading on changes
npm run docs:buildBuilds the documentation site (fails on broken links)

To try changes to the kit in an agent without publishing them, point its package.json to a local clone ("file:../agent-kit") and run npm run build after each change.

Working on the kit with Claude Code goes through Falken's Lab's own skills (commit, verify, update-docs, release, sync-issues, and the house style for READMEs, sites and Markdown), from the falkenslab/falkenslab-plugins marketplace. Install them once, for all of Falken's Lab's repositories:

claude plugin marketplace add falkenslab/falkenslab-plugins
claude plugin install falkenslab-dev@falkenslab-plugins
claude plugin install falkenslab-style@falkenslab-plugins
What each plugin brings, and what stays in this repository
  • 🔧 falkenslab-dev: commit, verify, update-docs, release, sync-issues, upgrade-deps and add-tool.
  • 🎨 falkenslab-style: falkenslab-docs, falkenslab-site-style, falkenslab-terminal-screenshots and markdown-writing.

Inside Claude Code, the same with /plugin marketplace add falkenslab/falkenslab-plugins and /plugin install falkenslab-dev@falkenslab-plugins; /plugin marketplace update falkenslab-plugins brings their latest version. This repository keeps only the skills that are agent-kit's own, in .claude/skills/ (add-export, the MiniSpec ones and upgrade-sdk), and what its release adds to the general one is in CLAUDE.md.

Made with 💖 by Falken's Lab Team

版本与发布记录

@falkenslab/agent-kit 共发布 30 个版本,首次发布于 2026/09/28;过去 12 个月发布了 30 个版本。

版本发布日期距今
0.35.0latest2026/11/122 天前
0.34.02026/11/104 天前
0.33.02026/11/095 天前
0.32.02026/10/2916 天前
0.31.02026/10/2816 天前
0.30.12026/10/2619 天前

关于 @falkenslab/agent-kit 的常见问题

@falkenslab/agent-kit 是什么?

Library for building an agent on top of the Claude Agent SDK

如何安装 @falkenslab/agent-kit?

在项目目录运行 npm install @falkenslab/agent-kit,或使用 pnpm add / yarn add / bun add。

@falkenslab/agent-kit 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@falkenslab/agent-kit 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@falkenslab/agent-kit 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=20。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@falkenslab/agent-kit 可以商用吗?

@falkenslab/agent-kit 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@falkenslab/agent-kit 的下载量有多少?

根据 npm 官方下载统计,@falkenslab/agent-kit 在 2026/10/14 – 2026/11/12 这 30 天内被下载 2,626 次,日均约 88 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@falkenslab/agent-kit 还在维护吗?

最新版本 0.35.0 发布于 2026/11/12(2 天前);至今共发布 30 个版本,其中过去 12 个月发布了 30 个;首次发布于 2026/09/28。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。