- Copy 11 .tmpl files from PROJECT-D (agents-md, cursorrules,
cursor-mdc, copilot, windsurf, junie, continue, gemini,
aider-conventions, aider-conf, replit) into _bridges/
- Add _bridges/README.md with template→output-path table
- Placeholders are {{PROJECT_NAME}} + {{PROJECT_DESCRIPTION}};
templates unchanged — content verified per RULE 0.4 upstream
|
||
|---|---|---|
| _assembler | ||
| _blocks | ||
| _bridges | ||
| _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 — all namespaced under kei-* so they won't collide with your own same-named agents), 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 | kei-code-implementer, kei-critic, kei-validator, kei-security-auditor, kei-architect, kei-researcher, kei-ml-implementer, kei-cost-guardian, kei-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
All kit agents are namespaced under kei-* so they won't collide with your own agents (e.g. your personal validator or critic) living in ~/.claude/agents/.
| Agent | Role |
|---|---|
kei-code-implementer |
Write production code, Constructor Pattern enforced, Test-First discipline |
kei-infra-implementer |
Deploy scripts, CI/CD, secrets management, cost-aware paid infra |
kei-ml-implementer |
Training scripts, inference code, Modal jobs, exact param counts |
kei-critic |
Read-only anti-pattern / bug / security / perf / debt finder |
kei-validator |
Fact-checker; verifies API existence, version compat, citations, doc claims |
kei-security-auditor |
Risk-classified security audit with variant analysis + supply chain check |
kei-architect |
Read-only structural analysis; dep graph, patterns, coupling |
kei-researcher |
Generic web + codebase research, evidence-graded findings |
kei-ml-researcher |
ML literature, benchmarks, reproducibility, tooling-reuse search |
kei-cost-guardian |
Pre-launch GO/NO-GO for paid compute (Modal, AWS, fal.ai, Apify, etc.) |
kei-modal-runner |
Modal compute orchestrator with KILL GUARD (never stops running jobs) |
kei-fal-ai-runner |
fal.ai image/video/3D generation expert |
kei-patent-researcher |
Prior-art, FTO, novelty — never leaks unfiled IP to public search |
kei-patent-compliance |
Pre-filing cross-reference gate and defensive-language helper |
License
MIT. See LICENSE in this directory.