No description
Find a file
Parfii-bot a5ef8963c7 feat(mcp-server): production-ready publish path via GitHub Packages
Renamed @keisei/mcp-server → @keisei84/mcp-server (scope must match
github org KeiSei84 for GitHub Packages publish). Replaced private:true
with publishConfig pinned to npm.pkg.github.com so an accidental
`npm publish` cannot leak to npm.org. CI npm-publish job rewired to
GitHub Packages auth (GITHUB_TOKEN with packages:write permission).

Why GitHub Packages, not npm.org:
- Authentication piggybacks on existing github org / PAT — no separate
  account or NPM_TOKEN required for the core kit
- Scope @keisei84 maps 1:1 to org KeiSei84 (npm rule for github)
- Doesn't require public DNS for our private Forgejo (Tailscale-only
  100.91.246.53 cannot be the publish target — IP-leak in public ref)
- Published artefacts live under github.com/orgs/KeiSei84/packages,
  same access surface as the source repo

Why not @keisei (un-scoped or different scope):
- npm scope @keisei IS reachable on npm.org but we don't own it there
  (would require email-verified npm account claim + ongoing maintenance)
- @keisei84 requires zero new accounts; works the moment KeiSei84 org
  has packages enabled (github default)

Files changed (11):
- _ts_packages/packages/mcp-server/package.json — rename + publishConfig
  + repository field (required by GitHub Packages); removed private:true
- _ts_packages/package-lock.json — regenerated via `npm install`
  (workspace recognises @keisei84/mcp-server symlink)
- README.md (2 hunks) — maturity row says "alpha" not
  "alpha (unpublished)"; install section documents `~/.npmrc` setup
  for `@keisei84:registry=https://npm.pkg.github.com/`
- PLUGIN.md (3 hunks) — same `~/.npmrc` setup; .mcp.json references
  @keisei84/mcp-server; "not yet on npm" replaced with "lives on
  GitHub Packages, not npm.org"
- .claude-plugin/mcp-template.json — args use @keisei84 scope
- _ts_packages/README.md (4 hunks) — package layout + npx examples
- docs/INSTALL.md, install/lib-rust.sh — comment refs
- docs/encyclopedia/substrate-overview.md (2 hunks) — package table +
  publishing notes (was "published to keigit.com npm" — wrong; keigit
  is a separate community-publish path for user-contributed packages,
  not the destination for core @keisei84 packages)
- .github/workflows/release.yml — npm-publish job rebuilt:
  · permissions: packages:write
  · Two-scope .npmrc temp-write: @keisei84 → npm.pkg.github.com (always),
    @keisei → npm.org (only if NPM_TOKEN secret set, else skipped per pkg)
  · NODE_AUTH_TOKEN sourced from GITHUB_TOKEN
  · .npmrc cleaned up via `if: always()` step
- .gitignore — _ts_packages/.npmrc + .npmrc excluded (RULE 0.8: auth
  tokens never in git; CI temp-creates per-job)

Verification:
- `npm install` clean against new scope: node_modules/@keisei84/mcp-server
  symlinks to packages/mcp-server, other adapters untouched in
  node_modules/@keisei/* [REAL: install ran 2026-05-03 in this session]
- `npm run build --workspace=@keisei84/mcp-server` produces dist/index.js
  [REAL: tsc -b exit 0]
- Server starts cleanly: `node dist/index.js` runs >1s, emits expected
  "[adapters] not installed" warnings for un-built sibling adapters,
  doesn't throw
- 17 references to old @keisei/mcp-server scope migrated; 0 left
  [REAL: grep -rn "@keisei/mcp-server" returns 0 lines]

Bad-commit-hygiene note:
- Two earlier local commits (cb8dc2a + revert 474fe1c) attempted a
  keigit.com-pinned variant; soft-reset past them so this commit lands
  on top of public 368df5b. Bad commits never reached remote.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-03 17:50:59 +08:00
.claude/agents/_merge/kei-memory-2026-05-01 feat(kei-memory): functional schema fix + 4-wave architecture refactor 2026-05-01 14:10:06 +08:00
.claude-plugin feat(mcp-server): production-ready publish path via GitHub Packages 2026-05-03 17:50:59 +08:00
.forgejo KeiSeiKit-public — clean state 2026-05-01 12:09:03 +08:00
.github feat(mcp-server): production-ready publish path via GitHub Packages 2026-05-03 17:50:59 +08:00
_assembler fix(substrate): dangling handoffs + atomar manifest fill-out + validator extension 2026-05-02 21:41:16 +08:00
_blocks feat(outcome-hook): PostToolUse:Agent backfills outcome + stubs in ledger 2026-05-01 23:24:02 +08:00
_bridges KeiSeiKit-public — clean state 2026-05-01 12:09:03 +08:00
_capabilities fix(substrate): dangling handoffs + atomar manifest fill-out + validator extension 2026-05-02 21:41:16 +08:00
_generated docs: SKILL.md triggers + STATUS-TRUTH footer + phase placeholders 2026-05-02 21:41:41 +08:00
_manifests fix(substrate): TOML scope-capture + dangling physics-deriver bodies + rule paths 2026-05-03 15:37:18 +08:00
_primitives fix(perf): bound per-user lock LRU + stream-cap atom subprocess output 2026-05-03 15:39:50 +08:00
_roles fix(substrate): dangling handoffs + atomar manifest fill-out + validator extension 2026-05-02 21:41:16 +08:00
_schemas/fragments KeiSeiKit-public — clean state 2026-05-01 12:09:03 +08:00
_templates KeiSeiKit-public — clean state 2026-05-01 12:09:03 +08:00
_ts_packages feat(mcp-server): production-ready publish path via GitHub Packages 2026-05-03 17:50:59 +08:00
bin KeiSeiKit-public — clean state 2026-05-01 12:09:03 +08:00
docs feat(mcp-server): production-ready publish path via GitHub Packages 2026-05-03 17:50:59 +08:00
hooks fix(security): cortex /term env_clear + bind guard, agent-stub-scan stdin, magiclink revoke 2026-05-03 15:38:23 +08:00
install feat(mcp-server): production-ready publish path via GitHub Packages 2026-05-03 17:50:59 +08:00
scripts KeiSeiKit-public — clean state 2026-05-01 12:09:03 +08:00
skills docs: SKILL.md triggers + STATUS-TRUTH footer + phase placeholders 2026-05-02 21:41:41 +08:00
tasks KeiSeiKit-public — clean state 2026-05-01 12:09:03 +08:00
tests feat(outcome-hook): PostToolUse:Agent backfills outcome + stubs in ledger 2026-05-01 23:24:02 +08:00
tools KeiSeiKit-public — clean state 2026-05-01 12:09:03 +08:00
.dockerignore KeiSeiKit-public — clean state 2026-05-01 12:09:03 +08:00
.gitignore feat(mcp-server): production-ready publish path via GitHub Packages 2026-05-03 17:50:59 +08:00
BACKUP-INDEX.md fix(security): scrub Tailscale IP + EC2 instance ID from public surface (P0) 2026-05-03 15:36:29 +08:00
bootstrap.sh KeiSeiKit-public — clean state 2026-05-01 12:09:03 +08:00
DECISIONS.md KeiSeiKit-public — clean state 2026-05-01 12:09:03 +08:00
HERMES-MIGRATION-PLAN.md chore(security): scrub residual leaks — NOTICE email + HERMES patent section 2026-05-01 18:19:14 +08:00
install.sh feat(install): outcome-only minimum profile 2026-05-03 16:59:53 +08:00
kei-architect.md docs: convert 12 root kei-*.md to alias stubs (parallel-SSoT cleanup) 2026-05-03 15:36:53 +08:00
kei-code-implementer.md docs: convert 12 root kei-*.md to alias stubs (parallel-SSoT cleanup) 2026-05-03 15:36:53 +08:00
kei-cost-guardian.md docs: convert 12 root kei-*.md to alias stubs (parallel-SSoT cleanup) 2026-05-03 15:36:53 +08:00
kei-critic.md docs: convert 12 root kei-*.md to alias stubs (parallel-SSoT cleanup) 2026-05-03 15:36:53 +08:00
kei-fal-ai-runner.md docs: convert 12 root kei-*.md to alias stubs (parallel-SSoT cleanup) 2026-05-03 15:36:53 +08:00
kei-infra-implementer.md docs: convert 12 root kei-*.md to alias stubs (parallel-SSoT cleanup) 2026-05-03 15:36:53 +08:00
kei-ml-implementer.md docs: convert 12 root kei-*.md to alias stubs (parallel-SSoT cleanup) 2026-05-03 15:36:53 +08:00
kei-ml-researcher.md docs: convert 12 root kei-*.md to alias stubs (parallel-SSoT cleanup) 2026-05-03 15:36:53 +08:00
kei-modal-runner.md docs: convert 12 root kei-*.md to alias stubs (parallel-SSoT cleanup) 2026-05-03 15:36:53 +08:00
kei-researcher.md docs: convert 12 root kei-*.md to alias stubs (parallel-SSoT cleanup) 2026-05-03 15:36:53 +08:00
kei-security-auditor.md docs: convert 12 root kei-*.md to alias stubs (parallel-SSoT cleanup) 2026-05-03 15:36:53 +08:00
kei-validator.md docs: convert 12 root kei-*.md to alias stubs (parallel-SSoT cleanup) 2026-05-03 15:36:53 +08:00
LICENSE KeiSeiKit-public — clean state 2026-05-01 12:09:03 +08:00
NOTICE chore: author email + Cargo metadata SSoT (parfionovich@keilab.io) 2026-05-03 13:55:28 +08:00
PLUGIN.md feat(mcp-server): production-ready publish path via GitHub Packages 2026-05-03 17:50:59 +08:00
README.md feat(mcp-server): production-ready publish path via GitHub Packages 2026-05-03 17:50:59 +08:00
settings-snippet.json fix(hooks): post-audit hook chain hardening + 4 new defensive hooks 2026-05-02 21:38:47 +08:00

KeiSeiKit

A multi-LLM substrate that gives any agentic coding tool persistent memory, deterministic agent identity, and self-maintaining orchestration. Works first-class with Claude Code; MCP-compatible bridges generate context for Cursor / Continue / Zed / Aider / Windsurf / Cline / OpenClaw / Kimi from the same source-of-truth.

Apache 2.0 — explicit patent grant + retaliation clause. 102 Rust crates (~132K LOC), 67 skills, 35 hooks, 37 agent manifests, 82 substrate blocks, 18 capability bundles, 7 substrate roles. Self- indexing via kei-registry SQLite (currently 495 active DNAs across the public substrate). Three-phase nightly consolidation. Foreign-project ingestion runtime (kei-import <repo-url>).

Maturity matrix

The substrate ships as a layered set of components at different maturity levels. Read this before relying on any single piece for production work.

Component Status Notes
24+ Rust primitives varies (alpha → beta → concept) Inspect each crate's Cargo.toml package.metadata.keisei.maturity if declared; otherwise treat as alpha unless you've personally exercised it. Most primitives are alpha — they build, type-check, and have unit tests, but have not been hardened against adversarial input or run at scale.
Cortex daemon (kei-cortex HTTP + WS) alpha CLI-driven daemon works in author's daily use; HTTP REST + WS endpoints + 8-tool /chat agentic loop build clean. Browser app (cortex-ui) and VSCode extension (@keisei/vscode-cortex) are concept-level — scaffolds present, not production paths.
MCP server (@keisei84/mcp-server) alpha Published to GitHub Packages (https://npm.pkg.github.com/) under the @keisei84 scope (matches the github org KeiSei84). Configure your ~/.npmrc per docs/PUBLISHING.md, then npm install @keisei84/mcp-server. Local dist build still works for development (see Quick start).
Sleep layer (Phase A / B / C) alpha Phase A queue (/sleep-on-it → cloud agent) + Phase B markdown morning report work. Auto-codification of rules from sleep insights is not yet wired — codification path is manual via /escalate-recurrence. Phase C deep-sleep refactor proposals run on a 7-day cadence and write plan-only markdown by default.
Hooks (35 shipped) beta Tested in author's daily use (48 parallel Claude Code terminals). Pipeline hooks (assemble-agents, no-hand-edit-agents) are load-bearing; advisory hooks (RULE 0.12 / 0.13 / 0.14) are non-blocking.
Skills + manifests + assembler beta Structured + assembler-validate gate runs on every git commit inside ~/.claude. Schema is locked (see docs/AGENT-SCHEMA-LOCKED.md).

What it does

Persistent memory SQLite ledger + content-addressable memory store, session-spanning context, cross-machine sync via memory-repo
Agent DNA Deterministic 80-char identity per invocation: <role>::<caps>::<scope-sha8>::<body-sha8>-<nonce>. Same task → same prefix → "did this run before?" via SQL, no embeddings
Constructor Pattern for prompts Agent .md files composed from manifests + blocks + capability bundles + rule fragments. Edit a block → all agents using it recompose. Single source of truth
kei-fork Atomic git triplet (branch + worktree + ledger row) for parallel agent runs. Atomic rollback. No main-branch collisions across 4-8 simultaneous Claude sessions
Three-phase sleep Phase A incubation (queued tasks) → Phase B REM consolidation (analyzes last 30 sessions, writes morning markdown report) → Phase C NREM deep-sleep (every 7 days, conflict scan + refactor proposals). No feedback loop — outputs are markdown, you decide what to keep
Auto self-indexing Every substrate file edit triggers registry update + agent regeneration + DNA-INDEX.md refresh + keimd graph reindex
Foreign-project ingestion kei-import <repo> walks → matches against 12 runtime traits → extracts skills from README/docs → generates migration plan → produces per-phase agent prompts
Cross-tool bridges One rule-set, 11 target formats (.cursorrules, .windsurf/rules/main.md, .github/copilot-instructions.md, AGENTS.md, GEMINI.md, etc)
npm-style publishing path Publish your agents / skills / hooks as scoped packages. The author runs an opt-in mirror at keigit.com (public Forgejo + npm registry, OAuth, per-user PAT) — this is an author-operated mirror (KeiSei84 / private Forgejo), not a neutral community service. The substrate is remote-agnostic; use any git remote and any npm registry you trust. See docs/PUBLISHING.md

Why it exists

The author runs 4-8 parallel Claude Code terminals daily. Without substrate, every session loses context, every parallel agent collides on main, every "did we already solve this?" requires manual grep. With substrate, identity carries — agents know what ran before, results converge through the ledger, fork-as-triplet prevents collisions, three-phase sleep produces overnight consolidation.

This is a tool first, not a product. If it solves your problem, fork it.

Quick start

# Claude Code (primary target — full hook + agent integration)
/plugin marketplace add KeiSei84/KeiSeiKit
/plugin install keisei@keisei-marketplace

# Any MCP-compatible client (Cursor / Continue / Zed / Aider / etc)
git clone https://github.com/KeiSei84/KeiSeiKit-1.0
cd KeiSeiKit-1.0
./install.sh --profile=minimal

37 agents + 67 skills + 35 hooks + nightly consolidation wired in 60 seconds. Eleven install profiles (minimalcorefull + MCP-only / Cortex / Cursor / Continue / Zed / Aider / Docker / Nix) documented in docs/INSTALL.md.

Outcome-only — try just the outcome loop (5 files, ~200 LOC)

If you want to try only the outcome-tracking primitive without committing to the full kit (no daemon, no Forgejo, no launchd, no 100 crates), run ./install.sh --profile=outcome-only. Installs 2 hooks + a SQLite ledger + one line in ~/.claude/CLAUDE.md; uninstalls in four lines. See docs/PROFILE-OUTCOME-ONLY.md.

Self-maintaining

After install, the substrate maintains itself. Every edit cascades:

edit any rule .md       → kei-decompose registers fragments
edit any manifest .toml → assembler regenerates one agent .md
edit any block .md      → assembler regenerates ALL agents
edit any skill SKILL.md → kei-registry updates
edit any hook .sh       → kei-registry updates
edit any primitive src/ → kei-import-project register updates
ANY substrate edit      → DNA-INDEX.md auto-refreshes
ANY substrate edit      → keimd graph auto-reindexes

nightly:
  Phase A (incubation)         → process queued tasks
  Phase B (REM consolidation)  → analyze last 30 sessions → morning report
  Phase C (NREM, every 7d)     → conflict scan + refactor proposals

No automatic feedback loop into agent state. All consolidation outputs are human-readable markdown. You read, you decide what merges.

Honest limits

  • Phase 5 executor (kei-import-project) generates per-phase agent prompts as JSON; the actual Agent({...}) spawn happens orchestrator-side (Claude Code Agent tool, MCP wrapper, or a thin shell loop). A first-class JS/TS wrapper that auto-spawns + tracks is future work.
  • Phase 9 Path A (model-router assembler-time rebake) — 37 agent manifests currently declare model: opus in frontmatter. Bayesian posterior router activates per-task-class when ≥100 outcome rows accumulate (currently 3). Until then, routing happens via orchestrator discipline plus advisor-hook stderr nudges.
  • Cortex stack (kei-cortex / kei-tty / kei-mcp) ships as alpha (CLI/daemon track) — downgraded from "beta" because two of the three intended frontends are not yet shipping. Local HTTP daemon + ratatui TUI + MCP stdio JSON-RPC build clean and run in the author's daily use. Browser app (cortex-ui) and VSCode extension (@keisei/vscode-cortex) are concept-level only — scaffolds exist, no production wiring. Treat the daemon + CLI as the supported surface; treat the GUI frontends as roadmap.
  • @keisei84/mcp-server npm package — published via GitHub Packages. To install from the registry:
    # ~/.npmrc — one-time setup
    echo "@keisei84:registry=https://npm.pkg.github.com/" >> ~/.npmrc
    echo "//npm.pkg.github.com/:_authToken=<your-github-pat>" >> ~/.npmrc
    # PAT scope: read:packages (write:packages only if you publish)
    
    npm install @keisei84/mcp-server
    
    For local development without the registry round-trip:
    cd _ts_packages
    bun install && bun run -r build
    # output: _ts_packages/packages/mcp-server/dist/index.js
    
    Single-binary builds via bun build --compile are documented in _ts_packages/packages/mcp-server/BUILD.md (5-target matrix, ~8595 MB per binary). package.json has publishConfig.registry pinned to npm.pkg.github.com so an accidental npm publish from this repo cannot route to npm.org.
  • Non-Claude clients integrate via MCP + bridges, not native hooks. PreToolUse / PostToolUse / UserPromptSubmit / Stop semantics are Claude Code primitives. Other clients get capability exposure but not the hook wire-up.

What it's NOT

  • Not a Claude Code replacement — runs alongside, not instead-of
  • Not a SaaS — local-first by default; hosted offering under consideration if community demand emerges (see Roadmap)
  • Not enterprise — solo-maintained, no SLA, no dedicated support
  • Not a framework — substrate. You compose; it doesn't dictate workflow

Roadmap

The substrate is functionally complete for solo-developer use. What might be valuable as a hosted service if there's demand:

  • Cross-machine memory sync — DNA-indexed memory available across laptop + desktop + cloud Claude session
  • Hosted Phase B/C nightly — traces consolidated by a remote agent, morning report delivered to inbox
  • Encyclopedia search-as-API — query team substrate by DNA / role / capability across multiple agents

These are considered, not committed. Open an issue with your use-case if any of these would solve real pain. Until then: fork, run locally, file PRs.

Hermes — proof of foreign-architecture ingest

Ten phases of Nous Research's Hermes (MIT, Python agent framework) ingested into KeiSeiKit substrate through April 2026. Each Hermes concept lives as a KeiSeiKit primitive:

Hermes phase KeiSeiKit landing
ShareGPT trajectory export kei-export-trajectories crate
OpenAI-compat HTTP server kei-llm-router providers + chat handler
Daytona sandbox backend kei-backend-daytona (with toolbox proxy URL split)
Injection-guard on memory writes wired through kei-memory::ingest + kei-pet::memory
Memory-nudge invoker Invoker trait + MemoryStore Arc plumbed
SKILL.md skill format kei-skills::SkillRegistry, consumed by kei-mcp
Skill-invocation aggregation kei-ledger schema v8 + aggregate-skills CLI
Multi-platform gateway kei-gateway (Telegram / Discord / Slack / CLI)
Cron / scheduler kei-cron-scheduler parser+job+runner

The kei-import umbrella runs the same pipeline (decompose → match → extract-skills → plan → execute) on any Rust / TS / Python / Go repo. Hermes was the validation case; the runtime works on others.

Frontend design — anti-AI-slop philosophy

The frontend-design skill is a deliberate counter-position to the same-shape output of v0 / Lovable / Bolt:

  • 10 archetypes — Editorial / Swiss / Brutalist / Minimal / Maximalist / Retro-Futuristic / Organic / Industrial / Art Deco / Lo-Fi. Each declares typography pairing + color palette + layout language + motion style.
  • OKLCH color system — one --brand-hue controls the full palette, perceptually uniform.
  • Phase Gate (mandatory before any code): purpose, archetype, the one differentiator, three anti-references, design tokens. Skip the gate = skip the skill.
  • Hard bans: Inter / Roboto / Space Grotesk, purple gradients on white, centered card grids as default, hero → cards → testimonials template, linear easing on UI transitions.
  • Diverge-Kill-Mutate loop when output feels generic.
  • The Blur Test: at 20% visibility, layout silhouette must be distinguishable from anti-references.

Orchestrator skill landing-page composes 11 skills across 6 recipes (apple-product / saas / portfolio / ecommerce / agency / startup).

Architecture

Stack: Rust core (102 crates, ≤2 MB each, 12-trait runtime + plugin registry) + TypeScript glue (6 adapters: gmail / grok / recall / telegram / youtube / mcp-server). Backend impls cover:

Trait Impls
ComputeProvider bare-metal SSH, DigitalOcean, Linode, Vultr
GitProvider Forgejo, Gitea, GitLab, Bitbucket
MemoryBackend SQLite, Sled, Postgres, Redis
AuthProvider Google OIDC, Apple Sign-In, WebAuthn passkeys, magic-link
NotifyChannel Telegram, Discord, Slack, SMS (Twilio)
NetworkMode WireGuard, OpenVPN, IPsec
LlmBackend Anthropic, OpenAI, Kimi (Moonshot), MLX, llama.cpp, Ollama
ServiceManager systemd

Declare which impl to use in ~/.keisei/config.toml; runtime resolves at startup. See docs/ARCHITECTURE.md, docs/PHILOSOPHY.md, docs/SUBSTRATE-SCHEMA.md, docs/IMPORT-RUNTIME.md, docs/PUBLISHING.md, docs/RULES-AS-BLOCKS.md, docs/DNA-INDEX.md.

License

Apache 2.0. Use, fork, ship, modify. Explicit patent grant + retaliation clause: contributors who sue any user over patents covered by their contributions lose their license to the work. Pre-2026-04-30 versions remain available under their original MIT terms (irrevocable). See LICENSE and NOTICE.

Author & collaboration

Built by Denis Parfionovich (parfionovich@keilab.io) running 48 parallel Claude Code terminals per day. Solo-maintained. Apache 2.0 makes the bus factor manageable: any AI-assisted developer (you, your Claude, your Cursor, your Aider) can read this codebase and continue it.

Forks welcome. PRs welcome. Issues welcome.

Open to collaboration. If you have:

  • a use-case this substrate would solve and you can't see how — open a discussion
  • ideas for the SaaS roadmap (cross-machine memory sync, hosted nightly consolidation, encyclopedia-as-API) — email or open an issue
  • a related project you're building (agent infra, MCP servers, cross-tool bridges, prompt-engineering substrates) and want to cross-pollinate — reach out
  • want to integrate KeiSeiKit primitives into your product or research — Apache 2.0 already permits it; happy to help you wire it

Email reaches the author directly. No marketing list, no funnel.