feat(integration): --with-sleep-sync flag + README Cloud REM sync section
This commit is contained in:
parent
8e9c05272f
commit
aa77043477
2 changed files with 61 additions and 5 deletions
27
README.md
27
README.md
|
|
@ -1,6 +1,6 @@
|
|||
# KeiSeiKit — Constructor-Pattern Agent Kit for Claude Code
|
||||
|
||||
KeiSeiKit is a comprehensive drop-in toolkit for [Claude Code](https://claude.com/claude-code). It ships a curated set of composable behavioral blocks, a Rust assembler that builds agent `.md` files from TOML manifests deterministically, nine pre-wired hooks (three of them dedicated to RULE 0.14 session self-audit), 35 portable skills (including an interactive `/new-agent` wizard, 10 hub-and-spoke pipelines, and the `/self-audit` retrospective skill), **10 Rust primitive crates** (including `genesis-scan` patent-IP leak detector), 13 shell primitives, and 11 cross-tool bridge templates. 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.
|
||||
KeiSeiKit is a comprehensive drop-in toolkit for [Claude Code](https://claude.com/claude-code). It ships a curated set of composable behavioral blocks, a Rust assembler that builds agent `.md` files from TOML manifests deterministically, nine pre-wired hooks (three of them dedicated to RULE 0.14 session self-audit), 35 portable skills (including an interactive `/new-agent` wizard, 10 hub-and-spoke pipelines, and the `/self-audit` retrospective skill), **9 Rust primitive crates**, 13 shell primitives, and 11 cross-tool bridge templates. 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 12-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, 10 pipeline skills that combine primitives end-to-end (`/compose-solution`, `/site-create`, `/schema-design`, `/observability-setup`, `/auth-setup`, `/api-design`, `/ci-scaffold`, `/test-matrix`, `/docs-scaffold`, `/new-project`, `/vm-provision`), and a build pipeline that keeps every agent derivable from its manifest.
|
||||
|
||||
|
|
@ -59,7 +59,7 @@ By default `./install.sh` is **minimal** — agents + hooks + skills + bridges,
|
|||
| Profile | Primitives added | Install time | Disk (approx) |
|
||||
|---|---|---|---|
|
||||
| `minimal` (default) | none | ~5s | ~2 MB |
|
||||
| `core` | `tomd`, `genesis-scan` | ~10s | ~5 MB |
|
||||
| `core` | `tomd` | ~5s | ~3 MB |
|
||||
| `frontend` | 8 site tools: `mock-render`, `visual-diff`, `tokens-sync`, `design-scrape`, `live-preview`, `figma-tokens`, `frontend-inspect`, `screenshot-decode` | ~60s | ~80 MB |
|
||||
| `ops` | 8 infra tools: `kei-ledger`, `ssh-check`, `firewall-diff`, `provision-hetzner`, `provision-vultr`, `harden-base`, `metrics-scrape`, `log-ship` | ~90s | ~50 MB |
|
||||
| `dev` | 4 dev tools: `kei-migrate`, `kei-changelog`, `kei-ci-lint`, `kei-docs-scaffold` | ~60s | ~40 MB |
|
||||
|
|
@ -152,6 +152,28 @@ Manual trigger: `/self-audit` skill (same flow, invoked on demand).
|
|||
|
||||
Requires the `kei-memory` primitive. Included in the `dev` and `full` profiles; otherwise add via `./install.sh --add=kei-memory`.
|
||||
|
||||
## Cloud REM sync (sleep layer, v0.11.0)
|
||||
|
||||
Run a nightly "sleep" cycle on Anthropic's cloud — no laptop, no infra, no DevOps.
|
||||
|
||||
**How it works:**
|
||||
- Each session: your Mac pushes trace JSONL to a private git repo you control
|
||||
- 03:00 local time: a remote Claude Code agent clones the repo, analyzes the last 24h of traces, writes `reports/sleep-YYYY-MM-DD.md`, and commits back
|
||||
- Next morning: `git pull` and read the consolidated findings
|
||||
|
||||
**Setup (one-time, ~5 min):**
|
||||
|
||||
1. Create an empty private repo on GitHub / GitLab / Bitbucket / self-hosted Forgejo
|
||||
2. In Claude Code run `/sleep-setup`
|
||||
3. The wizard generates an SSH deploy key → you paste it into the repo's deploy-key settings with WRITE access
|
||||
4. The wizard emits a ready-to-paste `/schedule create` command, converted to your local 03:00 in UTC
|
||||
|
||||
After that, the sleep cycle runs every night automatically. The morning report is yours to read — nothing is auto-injected back into any session.
|
||||
|
||||
**Requires** the `kei-memory` primitive (shipped in the `dev` and `full` profiles; add via `./install.sh --add=kei-memory` otherwise). Sleep-sync scripts themselves are installed unconditionally and stay dormant until you opt in via `/sleep-setup`.
|
||||
|
||||
Opt in at install time with `./install.sh --with-sleep-sync` (TTY-only). Governed by RULE 0.15 in `~/.claude/rules/sleep-layer.md`.
|
||||
|
||||
## Primitives (Rust)
|
||||
|
||||
`_primitives/_rust/` is a Cargo workspace with 9 single-binary crates. `install.sh` builds `--release` and drops binaries at `~/.claude/agents/_primitives/_rust/target/release/<name>`.
|
||||
|
|
@ -167,7 +189,6 @@ Requires the `kei-memory` primitive. Included in the `dev` and `full` profiles;
|
|||
| `visual-diff` | Pixel diff with tolerance — used in `/site-create` screenshot-regression loop |
|
||||
| `tokens-sync` | Design tokens JSON → Tailwind config extend + CSS variables under `:root` |
|
||||
| `kei-memory` | Session retrospective + recurring pattern detector; offline-first analyzer powering RULE 0.14 self-audit |
|
||||
| `genesis-scan` | Patent-IP leak scanner — runs as a git pre-commit or CI gate (complements the `genesis-leak-guard` runtime hook) |
|
||||
|
||||
## Primitives (shell)
|
||||
|
||||
|
|
|
|||
39
install.sh
39
install.sh
|
|
@ -26,6 +26,7 @@ INSTALLED_FILE="$AGENTS_DIR/_primitives/.installed"
|
|||
# --- flag parsing ----------------------------------------------------------
|
||||
ACTIVATE_HOOKS=0
|
||||
WITH_BRIDGES=0
|
||||
WITH_SLEEP_SYNC=0
|
||||
PROFILE=""
|
||||
ADD_LIST=""
|
||||
REMOVE_NAME=""
|
||||
|
|
@ -37,6 +38,7 @@ for arg in "$@"; do
|
|||
case "$arg" in
|
||||
--activate-hooks) ACTIVATE_HOOKS=1 ;;
|
||||
--with-bridges) WITH_BRIDGES=1 ;;
|
||||
--with-sleep-sync) WITH_SLEEP_SYNC=1 ;;
|
||||
--profile=*) PROFILE="${arg#--profile=}" ;;
|
||||
--add=*) ADD_LIST="${arg#--add=}" ;;
|
||||
--remove=*) REMOVE_NAME="${arg#--remove=}" ;;
|
||||
|
|
@ -71,6 +73,11 @@ Usage: ./install.sh [flags]
|
|||
Aider / Replit / Antigravity / Warp / Zed).
|
||||
Skipped if invoked inside the KeiSeiKit repo itself.
|
||||
|
||||
--with-sleep-sync after core install, run the v0.11 sleep-layer
|
||||
setup helper (kei-sleep-setup.sh). TTY-only — no-op
|
||||
on CI / non-interactive invocations. Print a
|
||||
reminder to finish via /sleep-setup either way.
|
||||
|
||||
--activate-hooks jq-merge settings-snippet.json into ~/.claude/settings.json
|
||||
non-interactively. Without this flag, a TTY prompt asks
|
||||
at the end; non-TTY runs print manual instructions.
|
||||
|
|
@ -289,7 +296,6 @@ primitive_time_secs() {
|
|||
case "$name" in
|
||||
mock-render|kei-migrate|kei-ledger) echo 20 ;;
|
||||
kei-changelog|firewall-diff) echo 15 ;;
|
||||
genesis-scan) echo 10 ;;
|
||||
visual-diff|tokens-sync|ssh-check) echo 5 ;;
|
||||
*) echo 10 ;;
|
||||
esac
|
||||
|
|
@ -307,7 +313,6 @@ primitive_disk_kb() {
|
|||
case "$name" in
|
||||
mock-render|kei-migrate|kei-ledger) echo 30000 ;;
|
||||
kei-changelog|firewall-diff) echo 10000 ;;
|
||||
genesis-scan) echo 6000 ;;
|
||||
visual-diff|tokens-sync|ssh-check) echo 5000 ;;
|
||||
*) echo 8000 ;;
|
||||
esac
|
||||
|
|
@ -1000,6 +1005,21 @@ mkdir -p "$AGENTS_DIR/_primitives"
|
|||
cp -f "$KIT_DIR/_primitives/MANIFEST.toml" "$AGENTS_DIR/_primitives/MANIFEST.toml" 2>/dev/null || true
|
||||
cp -f "$KIT_DIR/_primitives/README.md" "$AGENTS_DIR/_primitives/" 2>/dev/null || true
|
||||
|
||||
# v0.11 sleep-sync scripts — NOT listed in MANIFEST because they're always
|
||||
# available regardless of profile (zero binary deps; enabled only when the
|
||||
# user opts in via /sleep-setup). Copy them every install.
|
||||
for sleep_sh in kei-sleep-setup.sh kei-sleep-sync.sh; do
|
||||
src="$KIT_DIR/_primitives/$sleep_sh"
|
||||
if [ -f "$src" ]; then
|
||||
cp -f "$src" "$AGENTS_DIR/_primitives/$sleep_sh"
|
||||
chmod +x "$AGENTS_DIR/_primitives/$sleep_sh"
|
||||
fi
|
||||
done
|
||||
if [ -d "$KIT_DIR/_primitives/templates" ]; then
|
||||
mkdir -p "$AGENTS_DIR/_primitives/templates"
|
||||
cp -f "$KIT_DIR/_primitives/templates/"*.md "$AGENTS_DIR/_primitives/templates/" 2>/dev/null || true
|
||||
fi
|
||||
|
||||
say "resolving primitives for profile=$PROFILE"
|
||||
# Clean slate: drop every shell .sh + rust crate dir from the installed set
|
||||
# FAST (no per-rust rebuild). A single regenerate_rust_workspace at the end
|
||||
|
|
@ -1148,6 +1168,21 @@ if [[ "$WITH_BRIDGES" == "1" ]]; then
|
|||
fi
|
||||
fi
|
||||
|
||||
# --- optional: run sleep-sync setup helper (v0.11) -----------------------
|
||||
# The helper has its own TTY prompts + validation. We only kick it off when
|
||||
# stdin+stdout are TTY; otherwise print the reminder so the user can finish
|
||||
# later via /sleep-setup inside a Claude Code session.
|
||||
if [[ "$WITH_SLEEP_SYNC" == "1" ]]; then
|
||||
SLEEP_HELPER="$AGENTS_DIR/_primitives/kei-sleep-setup.sh"
|
||||
if [[ -x "$SLEEP_HELPER" ]] && [ -t 0 ] && [ -t 1 ]; then
|
||||
say "running sleep-sync setup helper"
|
||||
"$SLEEP_HELPER" || warn "sleep-sync setup did not complete — re-run via /sleep-setup"
|
||||
else
|
||||
say "sleep-sync setup deferred (non-TTY or helper missing)"
|
||||
say " run /sleep-setup inside Claude Code to finish configuration"
|
||||
fi
|
||||
fi
|
||||
|
||||
# --- done ----------------------------------------------------------------
|
||||
echo
|
||||
say "install complete (profile=$PROFILE)"
|
||||
|
|
|
|||
Loading…
Reference in a new issue