- Rename _manifests/{architect,code-implementer,cost-guardian,critic,
fal-ai-runner,infra-implementer,ml-implementer,ml-researcher,modal-runner,
patent-compliance,patent-researcher,researcher,security-auditor,validator}.toml
to kei-<name>.toml (git mv — history preserved).
- Update every `name = "..."` field to the new kei- name.
- Update every handoff `target = "..."` cross-reference (62 occurrences across
14 manifests) to point at the kei-prefixed counterpart.
- Update backticked prose cross-refs in role/forbidden_domain/description
strings: `code-implementer` -> `kei-code-implementer`, etc.
- Update SSoT header comments: "SSoT for <name>." -> "SSoT for kei-<name>.".
- Fix 3 bare-word prose refs missed by quoted/backticked patterns:
kei-code-implementer.toml (validator enforces), kei-security-auditor.toml
(description Hands fixes off to ..., forbidden_domain separate critic pass).
Noun-phrase mentions left intact (not agent refs): "senior software
architect", "ruthless code critic", "patent prior-art researcher",
"architectural claim", "critical findings", etc.
Verify:
cd _assembler && cargo build --release
AGENT_ROOT=$(pwd)/.. target/release/assemble --validate
-> 14 OK
Namespace motivation: kit-shipped agents live in a reserved "kei-*"
namespace so downstream installs can drop in custom, same-name agents
without collision (e.g. user's own `validator` or `critic`).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
||
|---|---|---|
| _assembler | ||
| _blocks | ||
| _manifests | ||
| _templates | ||
| hooks | ||
| skills | ||
| install.sh | ||
| LICENSE | ||
| README.md | ||
| settings-snippet.json | ||
KeiSeiKit — Constructor-Pattern Agent Kit for Claude Code
KeiSeiKit is a drop-in agent fleet for Claude Code. It ships a curated set of composable behavioral blocks, a Rust assembler that builds agent .md files from TOML manifests deterministically, three pre-wired hooks, and six portable skills including an interactive /new-agent wizard. Everything follows a Constructor Pattern: one file per concern, manifests as single source of truth, and the generated agent files are regenerated on every relevant edit.
The kit is MIT-licensed and fully generic — install it on a fresh machine and you get a sane 14-agent fleet (implementers, critics, researchers, cost-guardians, and more), a wizard for spinning up new project specialists, and a build pipeline that keeps every agent derivable from its manifest.
Prerequisites
- Rust (stable toolchain) — the assembler is a small Cargo binary
- jq — used by the three shell hooks for JSON parsing (
brew install jq/apt install jq) - Claude Code — the agents, hooks, and skills target Claude Code's agent / skill / hook surface
Install
git clone <your-fork-of-this-repo> KeiSeiKit
cd KeiSeiKit
./install.sh
install.sh is idempotent. It:
- Creates
~/.claude/agents/{_blocks,_manifests,_templates,_assembler,_generated},~/.claude/hooks,~/.claude/skills - Copies all blocks (overwrites — blocks are SSoT from the kit)
- Copies generic manifests (skips if you already have a manifest with that name)
- Builds the Rust assembler (
cargo build --release) - Generates agent
.mdfiles in-place withAGENT_ROOT=~/.claude/agents assemble --in-place - Copies the three hooks and six skills
After install, the only remaining step is merging settings-snippet.json into your ~/.claude/settings.json to activate the hooks.
What you get
| Category | Count | Examples |
|---|---|---|
| Behavioral blocks | 34 | baseline, evidence-grading, rule-math-first, stack-rust-axum, deploy-modal, api-fal-ai, ... |
| Generic agents (manifests) | 14 | code-implementer, critic, validator, security-auditor, architect, researcher, ml-implementer, cost-guardian, modal-runner, ... |
| Hooks | 3 | assemble-agents (PostToolUse), assemble-validate (PreToolUse Bash), no-hand-edit-agents (PreToolUse Edit/Write) |
| Skills | 6 | new-agent, research, test-gen, pr-review, refactor, debug-deep |
Creating a new agent
Run the wizard in Claude Code:
/new-agent
You'll be asked (via option-pickers, not free-text):
- Project stack (Rust CLI / axum / SwiftUI / Flutter / FastAPI / Next.js / Go / Embedded / Python ML)
- Deploy target (local-only / EC2 / Cloudflare / Modal / Docker / none)
- Uses paid APIs? (Yes / No)
- Contains ML? (Yes / No)
- Contains unfiled patent IP? (Yes — banned public / No)
- Has credentials? (Yes / No)
- Uses scrapers? (None / Free-tier / Paid tier)
Then one free-text prompt for slug + description + path + gotchas. The wizard composes the manifest, validates it, assembles the .md, and prints a two-step git-commit command you can run or edit first.
Architecture
Manifest (_manifests/<name>.toml) <-- source of truth
|
| [assembler/src/*.rs] <-- Rust binary
v
Generated agent (.claude/agents/<name>.md) <-- regenerated, never hand-edited
^
| [hook: assemble-agents]
Block edit (_blocks/<block>.md) <-- triggers rebuild of ALL agents
Three hooks enforce the pipeline:
assemble-agents(PostToolUse, Write/Edit) — rebuilds the affected agent(s) whenever a manifest or a block changes. No manual rebuild needed.assemble-validate(PreToolUse, Bash) — blocksgit commitinside~/.claudeif any manifest fails validation. Keeps the repo in a buildable state at all times.no-hand-edit-agents(PreToolUse, Edit/Write) — refuses edits to any.mdunder~/.claude/agents/that starts with the<!-- GENERATED -->marker, pointing you at the manifest instead. Override withAGENT_MIGRATION=1for emergencies only.
Adding custom blocks
Blocks are plain markdown in ~/.claude/agents/_blocks/. To add one:
touch ~/.claude/agents/_blocks/stack-mystack.mdand write the block.- Reference it in a manifest's
blocks = [...]list. - The PostToolUse hook rebuilds the affected agent(s) automatically.
Blocks should be 10-50 lines, single-concern, and readable in isolation. If a block exceeds ~60 lines, split it into two.
Adding custom manifests
Copy _templates/specialist.toml.template and fill the placeholders, OR run /new-agent and answer the wizard. Either way, the assembler validates the manifest and generates the .md on write.
Agents overview
| Agent | Role |
|---|---|
code-implementer |
Write production code, Constructor Pattern enforced, Test-First discipline |
infra-implementer |
Deploy scripts, CI/CD, secrets management, cost-aware paid infra |
ml-implementer |
Training scripts, inference code, Modal jobs, exact param counts |
critic |
Read-only anti-pattern / bug / security / perf / debt finder |
validator |
Fact-checker; verifies API existence, version compat, citations, doc claims |
security-auditor |
Risk-classified security audit with variant analysis + supply chain check |
architect |
Read-only structural analysis; dep graph, patterns, coupling |
researcher |
Generic web + codebase research, evidence-graded findings |
ml-researcher |
ML literature, benchmarks, reproducibility, tooling-reuse search |
cost-guardian |
Pre-launch GO/NO-GO for paid compute (Modal, AWS, fal.ai, Apify, etc.) |
modal-runner |
Modal compute orchestrator with KILL GUARD (never stops running jobs) |
fal-ai-runner |
fal.ai image/video/3D generation expert |
patent-researcher |
Prior-art, FTO, novelty — never leaks unfiled IP to public search |
patent-compliance |
Pre-filing cross-reference gate and defensive-language helper |
License
MIT. See LICENSE in this directory.