KeiSeiKit-1.0/docs
KeiSei84 4e5e6bd2c0
Some checks are pending
CI (Forgejo Actions — self-hosted runner on Mac, host mode) / preflight (push) Waiting to run
CI (Forgejo Actions — self-hosted runner on Mac, host mode) / vps-smoke (push) Waiting to run
CI (Forgejo Actions — self-hosted runner on Mac, host mode) / rust-primitives (map[crates:frustration-matrix,kei-frustration-loop,kei-skill-importer,kei-projects-index,kei-projects-watcher,kei-gdrive-import,kei-leak-matrix,kei-skills,kei-gateway,kei-cron-scheduler,kei-export-trajectories,kei-backend-daytona,kei-d… (push) Blocked by required conditions
CI (Forgejo Actions — self-hosted runner on Mac, host mode) / rust-primitives (map[crates:kei-compute-baremetal,kei-compute-vultr,kei-compute-linode,kei-compute-digitalocean,kei-svc-systemd,kei-llm-bridge-mlx name:hosted-sleep-compute]) (push) Blocked by required conditions
CI (Forgejo Actions — self-hosted runner on Mac, host mode) / rust-primitives (map[crates:kei-diff,kei-scheduler,kei-watch,kei-prune,kei-discover,kei-brain-view,kei-hibernate,kei-ledger-sign,kei-fork name:wave13-15]) (push) Blocked by required conditions
CI (Forgejo Actions — self-hosted runner on Mac, host mode) / rust-primitives (map[crates:kei-git-gitea,kei-git-forgejo,kei-git-gitlab,kei-git-bitbucket,kei-memory-sled,kei-memory-redis,kei-memory-postgres,kei-memory-sqlite,kei-auth-google,kei-auth-apple,kei-auth-magiclink,kei-auth-webauthn,kei-notify-slack,kei-n… (push) Blocked by required conditions
CI (Forgejo Actions — self-hosted runner on Mac, host mode) / rust-primitives (map[crates:kei-ledger,kei-migrate,kei-changelog,kei-memory,kei-store,kei-conflict-scan,kei-refactor-engine,kei-graph-check,kei-shared,kei-dna-index,kei-pet name:core]) (push) Blocked by required conditions
CI (Forgejo Actions — self-hosted runner on Mac, host mode) / rust-primitives (map[crates:kei-machine-probe,kei-llm-ollama,kei-llm-llamacpp,kei-llm-mlx,kei-llm-router,kei-model name:llm-stack]) (push) Blocked by required conditions
CI (Forgejo Actions — self-hosted runner on Mac, host mode) / rust-primitives (map[crates:kei-router,kei-sage,kei-task,kei-chat-store,kei-crossdomain,kei-search-core,kei-content-store,kei-social-store,kei-curator,kei-auth,kei-artifact name:mcp-lbm]) (push) Blocked by required conditions
CI (Forgejo Actions — self-hosted runner on Mac, host mode) / rust-primitives (map[crates:keisei,kei-forge,kei-runtime,kei-runtime-core,kei-atom-discovery,kei-agent-runtime,kei-capability,kei-provision,kei-entity-store,kei-pipe,kei-cache,kei-spawn,kei-replay name:atom-substrate]) (push) Blocked by required conditions
feat(phase-C): cross-CLI hook enforcement via kei_bash/kei_edit/kei_write MCP tools
Closes the "hooks only fire on Claude" gap. Phase C extends KeiSeiKit safety
enforcement (no-github-push, safety-guard, destructive-guard, citation-verify,
numeric-claims-guard) to any MCP-capable LLM CLI through a 3-tier honesty model.

## 3-tier model

TIER 1 (full native): claude (existing), grok (port hooks to grok settings.json)
TIER 2 (MCP-wrapped): copilot (--excluded-tools=shell + force kei_bash via MCP)
TIER 3 (advisory):    agy + kimi (cannot disable native shell; prompt-level only)

## Design (Constructor Pattern)

1. hooks/_lib/policy-chain.toml — SSoT: which hooks gate which tool (bash/edit/write)
2. _primitives/_rust/kei-mcp/src/handlers/safe_tools.rs — new module, 3 built-in
   MCP tools that synthesize Claude PreToolUse JSON, run hook chain, abort on
   exit-2, exec on all-pass. Same input contract → hooks reused as-is, no rewrite.
3. tools.rs short-circuit: kei_bash/kei_edit/kei_write dispatched before atom layer
4. 6 wire scripts: orchestrator + one per CLI (Constructor Pattern, no mixin)
5. bin/kei mcp-wire arm
6. docs/encyclopedia/cross-cli-policy.md — honest 3-tier matrix + verification

## Double-enforcement guard

If kei-mcp invoked from a process with $CLAUDECODE=1 or $GROKCODE=1, the chain
SKIPS — native hooks already fired. Wire scripts set these env vars in the
MCP server registration for claude/grok respectively. On copilot/agy/kimi the
env is unset → chain runs.

## Smoke (verified live)

Block: kei_bash{command: forbidden-push-pattern}
  → JSON-RPC error -32603 with full "BLOCK — RULE 0.1 NO GITHUB PUSH" stderr ✓
Pass:  kei_bash{command: "echo HELLO-FROM-KEI-BASH"}
  → result.content[0].text = "HELLO-FROM-KEI-BASH" ✓
tools/list: 4 built-ins present (spawn_agent + kei_bash + kei_edit + kei_write) ✓

## Tests

kei-mcp: 3/3 (tools_list assertions updated for atoms+4 built-ins).
Build clean with toml = "0.8" dep added.

## Out of scope (deferred)

- Codex CLI wiring (not installed locally)
- ACP middleware proxy (transport, not middleware — ruled out at research)
- Container/firejail sandboxing for agy/kimi (heavy; documented limit instead)
- Native Rust PatternGate migration (optimization, separate phase)
2026-05-26 18:03:33 +08:00
..
encyclopedia feat(phase-C): cross-CLI hook enforcement via kei_bash/kei_edit/kei_write MCP tools 2026-05-26 18:03:33 +08:00
AGENT-ROLES.md KeiSeiKit-public — clean state 2026-05-01 12:09:03 +08:00
AGENT-SCHEMA-LOCKED.md KeiSeiKit-public — clean state 2026-05-01 12:09:03 +08:00
AGENT-SUBSTRATE-SCHEMA.md KeiSeiKit-public — clean state 2026-05-01 12:09:03 +08:00
ARCHITECTURE.md fix(release+slices): v0.14.4 publish auth fallback + 4 fix-implementer slices 2026-05-04 00:16:48 +08:00
CONVERGENCE-PLAN.md docs: SKILL.md triggers + STATUS-TRUTH footer + phase placeholders 2026-05-02 21:41:41 +08:00
DNA-FORMAT.md docs: reviewer-response — honesty pass + portable format specs 2026-05-03 16:59:25 +08:00
DNA-INDEX.md fix(audit-r2): HIGH+MEDIUM closures from second round audit 2026-05-14 13:18:14 +08:00
DNA-MIGRATION.md fix(audit-r2): HIGH+MEDIUM closures from second round audit 2026-05-14 13:18:14 +08:00
HANDOFF-WAKE.md fix(install): make fresh install complete + ship tamagotchi (#1) 2026-05-20 18:50:09 +00:00
IMPORT-RUNTIME.md KeiSeiKit-public — clean state 2026-05-01 12:09:03 +08:00
INSTALL.md fix(install): make fresh install complete + ship tamagotchi (#1) 2026-05-20 18:50:09 +00:00
LEDGER-SCHEMA.md docs: reviewer-response — honesty pass + portable format specs 2026-05-03 16:59:25 +08:00
MEMORY-FORMAT.md docs: reviewer-response — honesty pass + portable format specs 2026-05-03 16:59:25 +08:00
PHILOSOPHY.md fix(audit-batch-2): regressions from prev batch + 2nd-wave audit findings 2026-05-03 20:30:51 +08:00
PROFILE-OUTCOME-ONLY.md fix(release+slices): v0.14.4 publish auth fallback + 4 fix-implementer slices 2026-05-04 00:16:48 +08:00
PUBLISHING.md docs: reviewer-response — honesty pass + portable format specs 2026-05-03 16:59:25 +08:00
QUICKSTART.md KeiSeiKit-public — clean state 2026-05-01 12:09:03 +08:00
REFERENCE.md KeiSeiKit-public — clean state 2026-05-01 12:09:03 +08:00
RULES-AS-BLOCKS.md KeiSeiKit-public — clean state 2026-05-01 12:09:03 +08:00
SCHEMA-LOCKED.md KeiSeiKit-public — clean state 2026-05-01 12:09:03 +08:00
SCHEMA-UNLOCKED.md KeiSeiKit-public — clean state 2026-05-01 12:09:03 +08:00
SECURITY.md KeiSeiKit-public — clean state 2026-05-01 12:09:03 +08:00
SLEEP-LAYER.md fix(audit-batch-2): regressions from prev batch + 2nd-wave audit findings 2026-05-03 20:30:51 +08:00
SUBSTRATE-SCHEMA.md KeiSeiKit-public — clean state 2026-05-01 12:09:03 +08:00
TAXONOMY.md KeiSeiKit-public — clean state 2026-05-01 12:09:03 +08:00
USB-BRAIN-GUIDE-linux.md fix(install): make fresh install complete + ship tamagotchi (#1) 2026-05-20 18:50:09 +00:00
USB-BRAIN-GUIDE-macos.md fix(install): make fresh install complete + ship tamagotchi (#1) 2026-05-20 18:50:09 +00:00
USB-BRAIN-GUIDE-windows.md fix(install): make fresh install complete + ship tamagotchi (#1) 2026-05-20 18:50:09 +00:00
USB-BRAIN-GUIDE.md KeiSeiKit-public — clean state 2026-05-01 12:09:03 +08:00
WHY.md KeiSeiKit-public — clean state 2026-05-01 12:09:03 +08:00