No description
Find a file
Parfii-bot c0c3483f02 feat(agent-substrate/phase-1): capability library — 11 declarative bundles
22 files per locked §Initial capability atom inventory:

policy/no-git-ops/               (gate: PreToolUse:Bash, bypass ORCHESTRATOR_META)
scope/files-whitelist/           (gate + verify worktree)
scope/files-denylist/            (gate + verify worktree)
quality/constructor-pattern/     (verify worktree)
quality/cargo-check-green/       (verify both — worktree short-circuit + simulated-merge)
quality/tests-green/             (verify both)
safety/no-dep-bump/              (gate + verify both)
output/report-format/            (verify worktree)
output/severity-grade/           (verify worktree)
tools/read-only/                 (gate: deny Edit/Write)
tools/cargo-only-bash/           (gate: Bash allowlist)

All capability.toml share [capability]/[restricts]/[parameterized]/[text]/
[gate]/[verify] section layout. rust-module paths pre-wired to match
phase-3 file layout. All text.md under 200 words, imperative,
self-contained (composer concatenates with --- separator).

Cross-refs to rule files preserved:
- policy::no-git-ops → RULE 0.13 (orchestrator-branch-first.md)
- quality::constructor-pattern → RULE ZERO (code-style.md)
- output::severity-grade → debugging.md §Security Review
- safety::no-dep-bump → supply-chain rationale

Agent attempted wc -w for word counts — sandbox correctly denied Bash
per RULE 0.13, observable reinforcement of the very policy this
capability encodes.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-23 02:35:52 +08:00
.claude-plugin feat(v0.16): Anthropic plugin format + own marketplace 2026-04-22 15:10:15 +08:00
.github fix(release): v0.22.3 — native arm64-linux + gh-CLI Publish (no race, no draft) 2026-04-22 23:22:50 +08:00
_assembler feat(v0.16.1): dynamic schema SSoT + KNOWN_SCHEMAS drift-test + mode-matrix Phase 3.6 2026-04-22 15:10:46 +08:00
_blocks feat(v0.16.1): dynamic schema SSoT + KNOWN_SCHEMAS drift-test + mode-matrix Phase 3.6 2026-04-22 15:10:46 +08:00
_bridges feat(bridges): emit.sh renderer with --only filter 2026-04-21 14:43:07 +08:00
_capabilities feat(agent-substrate/phase-1): capability library — 11 declarative bundles 2026-04-23 02:35:52 +08:00
_manifests fix(v0.15.1): RED-1 CVE + typed-handoff + schema minItems 2026-04-22 15:08:51 +08:00
_primitives Merge feat/stream-g-sage-rules — atoms+rules unified graph 2026-04-23 01:21:12 +08:00
_templates feat(substrate): apply user decisions + ship atom template + generator 2026-04-22 23:53:26 +08:00
_ts_packages chore(v0.19.1): replace placeholder bun.lock with real lockfile + fix workspace path 2026-04-22 17:16:57 +08:00
docs feat(agent-substrate): LOCK schema — 8 decisions resolved, 3-phase parallel window opens 2026-04-23 02:05:21 +08:00
hooks feat(v0.17.1): orchestrator-dirty-check hook — prevent uncommitted-output compounding 2026-04-22 15:42:11 +08:00
install fix(install): copy sibling data dirs (schemas/ assets/ templates/ fixtures/ migrations/) in copy_rust_primitive 2026-04-22 18:39:28 +08:00
scripts feat(substrate): apply user decisions + ship atom template + generator 2026-04-22 23:53:26 +08:00
skills feat(v0.17.1): orchestrator-dirty-check hook — prevent uncommitted-output compounding 2026-04-22 15:42:11 +08:00
tests test(substrate): integration now asserts real atom execution via Stream E 2026-04-23 01:23:05 +08:00
.dockerignore docs(v0.21): .dockerignore + USB brain step-by-step guide 2026-04-22 18:47:12 +08:00
.gitignore feat(ci): GitHub Actions workflows + .claude/worktrees gitignore 2026-04-22 13:36:17 +08:00
CHANGELOG.md Merge docs/v0.22-reference-section — README Reference section (conflict resolved) 2026-04-22 21:11:21 +08:00
install.sh refactor(v0.16): split install.sh monolith (1238 LOC) into 17 cubes 2026-04-22 15:09:35 +08:00
LICENSE feat: KeiSeiKit v0.1.0 — initial public release 2026-04-20 23:58:34 +08:00
PLUGIN.md feat(v0.16): Anthropic plugin format + own marketplace 2026-04-22 15:10:15 +08:00
README.md docs(readme): split 89 KB monolith into hero-pitch + 6 docs/ files 2026-04-22 22:20:22 +08:00
settings-snippet.json feat(v0.17.1): orchestrator-dirty-check hook — prevent uncommitted-output compounding 2026-04-22 15:42:11 +08:00

KeiSeiKit — Constructor-Pattern Agent Kit for Claude Code

A structural layer over Claude Code, Cursor, Continue, and Zed that catches the failure modes LLMs introduce at commit time — not after they ship.

Drop-in toolkit: portable agent personas, tool-use hooks that refuse known-bad actions, click-through skill wizards, a Rust primitive library for the tasks Python ships wrongly, and a portable "brain" directory (USB / git / S3) that mounts into any MCP-capable client via one command.

Why it exists

LLMs are statistically wired to produce plausible-but-wrong output. Context windows drop prior decisions, confident citations turn out to be fabricated, parallel terminals clobber each other's files, the same mistake lands on the third try because the retrospective from the first never reached the second session. None of that is solvable by better prompts — it is solvable by structure around the prompt.

KeiSeiKit is that structure: persistent agent memory across sessions, pre-commit hooks at every tool boundary, typed handoff artifacts between agents, a deterministic manifest-to-agent build, and a three-phase overnight consolidation via a cloud cron. Constructor Pattern throughout — one file per concern, every abstraction replaceable.

Rust-first by design. Type-system guarantees remove entire classes of hallucination at compile time: no None-vs-[] confusions, no missing .await, no unhandled Result. For LLM-authored code this is survival, not style. The full philosophical backstory lives in docs/WHY.md.

Three killer features

1. The nightly cycle

Day session → overnight consolidation → morning report. Three phases on an Anthropic-cloud agent mirror biological sleep:

  • Phase A — Incubation ("sleep on it"): you defer a hard question via /sleep-on-it; the remote agent processes it during the night (15 min / 60 min / 4 h / full-night marathon).
  • Phase B — REM: the agent reads your day's trace JSONL, extracts cross-session patterns, commits reports/sleep-YYYY-MM-DD.md back to your private memory-repo.
  • Phase C — NREM: every 7 days (by default), scans _rules/ + hooks/ + _blocks/ + memory/ for conflicts (duplicate matchers, orphan wikilinks, CP violations) and emits a structured refactor plan.

Morning git pull — you read, you decide. Nothing is auto-injected into a future session. Full mechanics: docs/SLEEP-LAYER.md.

2. Constructor-Pattern agent kit

Agents are built deterministically from TOML manifests + reusable Markdown blocks. Edit a block, the assemble-agents hook rebuilds every affected agent. Ship the same kei-critic persona to every machine by installing the kit. 12 ready agents (kei-code-implementer, kei-critic, kei-validator, kei-security-auditor, kei-architect, kei-researcher, kei-ml-implementer, ...) — all namespaced under kei-* so they won't collide with your own. Full wiring: docs/ARCHITECTURE.md.

3. Exobrain — one brain, every client

Portable brain directory (memory + artifacts + manifests + per-platform MCP server binaries) that mounts into Claude Code, Cursor, Continue, and Zed via a single command. USB stick, iCloud, S3 / R2 / MinIO — same state follows you.

keisei mount /Volumes/MyBrain   # attaches to every detected AI client
keisei detach                    # clean unmount from all clients

Setup path: docs/INSTALL.md § keisei CLI.

What it solves (vs vanilla Claude Code)

Problem you hit What the kit adds
Every session starts cold — prior decisions forgotten kei-memory session traces + cloud REM consolidation + /self-audit retrospective
Same mistake twice RULE 0.10 recurrence-escalate skill + hook codifies it (rule file + wiki + block/enforce/warn/remind hook)
48 parallel Claude terminals clobber each other kei-ledger fork-tracking + orchestrator-dirty-check hook + RULE 0.13 (orchestrator owns git)
Hallucinated API / fabricated citation shipped genesis-leak-guard + secrets-guard + citation-verify hooks; Rust primitives replace Python where None-vs-[]-class bugs matter
Single-client lock-in (Claude Code OR Cursor OR Zed) keisei CLI + 4 adapters — one brain, every client
No audit trail across branches kei-ledger SQLite agent-fork history + kei-store memory-repo abstraction (GitHub / Forgejo / Gitea / FS / S3)
Drift between declared config and running state firewall-diff, ssh-check, kei-ci-lint, assemble-validate hook

Not a replacement for Claude Code — a persistent structural layer over it.

Quick install

Two paths, pick what fits your Claude Code version:

# Plugin (recommended on Claude Code 2.1+, zero cargo build)
/plugin marketplace add KeiSei84/KeiSeiKit
/plugin install keisei@keisei-marketplace

# OR classic (required for Rust primitives)
git clone <your-fork-of-this-repo> KeiSeiKit
cd KeiSeiKit
./install.sh                      # minimal profile, ~5s, no primitives
./install.sh --profile=full       # everything, ~5 min, ~200 MB

Plugin vs classic install, profiles (minimal / core / frontend / ops / dev / full), MCP-server pre-built binaries, and runtime hook controls → docs/INSTALL.md.

What's in the box

Category Count
Behavioral blocks 79
Generic agents (manifests) 12
Hooks (PreToolUse / PostToolUse) 10
Portable skills 39
Rust primitives (opt-in, profile-gated) 25
Shell primitives (opt-in) 13
Cross-tool bridges 11

Every primitive / hook / skill with its actual CLI surface → docs/REFERENCE.md.

Docs

File What's in it
docs/INSTALL.md Install paths, profiles, MCP binary, keisei CLI, runtime hook controls
docs/REFERENCE.md Every primitive / hook / skill / pipeline with flags + exit codes
docs/ARCHITECTURE.md Build pipeline, cross-tool bridges, meta-composer, workflow editing
docs/SLEEP-LAYER.md Three-phase nightly cycle + session self-audit
docs/SECURITY.md Threat model + mitigations
docs/WHY.md Full "From the author" philosophical backstory
docs/USB-BRAIN-GUIDE.md Portable brain on removable media — macOS / Linux / Windows splits
CHANGELOG.md Release notes (Conventional Commits → Markdown via kei-changelog)
PLUGIN.md Anthropic plugin-format install path (v0.16+)

About

Built by Denis Parfionovich (parfionovich@keilab.io) as a personal working environment — not a commercial product. The problems it solves are ones I hit every day across 48 parallel Claude Code terminals.

Most of what is here is well-established bricks (git-as-state, cron, TF-IDF, Constructor-Pattern composition). What may be new in the Claude Code context is the Constructor Pattern for agents (composable blocks, deterministic build, rebuild-on-block-edit hooks) and the three-phase sleep layer (using a git repo as the transport layer between sessions, with an Anthropic-cloud agent doing nightly incubation + REM + NREM consolidation).

Treat this as my sample, not a claim of originality. Forks and PRs welcome from everyone, not only from those who write code. Open an issue at github.com/KeiSei84/KeiSeiKit/issues — a well-formulated problem is already half the solution. Full backstory in docs/WHY.md.

License

MIT. See LICENSE.