KeiSeiKit-1.0/_primitives/_rust
Parfii-bot 4bbc95fd7c feat(v0.22): keisei schema v4 + Scope::Auto + templated hint + registry (Track A)
BREAKING schema bump v3 → v4. Backward-compat via untagged serde
for v1/v2/v3 read-paths — no user-visible regression.

1. Schema v4 — multi-brain marker
   AttachRecord inverted: each Attachment carries its own brain_path
   + brain_name + scope + attached_at. Enables brain-A to Claude-
   Code (user scope) + brain-B to Cursor (project scope) in ONE
   marker. v1/v2/v3 auto-migrate via config_migrate.rs (NEW, 114
   LOC) — silent stderr notice on first v0.22 read.

2. Scope::Auto — default CLI behaviour
   'keisei attach <brain>' no longer defaults User scope blindly.
   New Scope::Auto resolves per-adapter via auto_scope():
     claude-code: CWD/.claude/ present → Project else User
     cursor:      CWD/.cursor/ present → Project else User
     continue:    User (no project concept)
     zed:         User (global settings only)
   'keisei mount' stays host-wide (always User fan-out).

3. Templated post_attach_hint
   fn post_attach_hint(&self, brain: &Brain, scope: Scope) -> String
   Each adapter interpolates brain name + scope. Example for
   claude-code: 'run /help in Claude Code (user scope) — verify
   '<brain-name>' is in mcpServers'.

4. Adapter registry
   adapters/_registry.rs (NEW, 32 LOC) — single canonical list
   of 4 adapters. adapter::all() delegates. 5th adapter = one
   line change, one place.

5. Dead code cleanup
   Error::NotAttached + Error::AdapterFailed removed. Grep-verified
   zero references.

6. config.rs decomposition (200 LOC rule)
   config.rs 224 → 197 LOC.
   time.rs (NEW, 90 LOC) — now_utc_string + format_epoch_utc +
     civil_from_days Howard Hinnant + 5 unit tests
     (epoch-0, leap day 2020-02-29, century-non-leap 2100-03-01,
      arbitrary 2026-04-22, RFC3339 shape).
   config_migrate.rs (NEW, 114 LOC) — WireRecord migration.

REAL VERIFICATION:
  cargo test -p keisei --release: 46 passed 0 failed
    (5 time::tests + 41 integration — 30 existing adjusted to v4 + 11 new)

Tests added:
  marker_v3_migrates_to_v4
  two_brains_can_be_attached_simultaneously
  detach_removes_single_brain_preserves_others
  scope_auto_resolves_to_{project,user}_*
  cursor_auto_scope_respects_cwd_dot_cursor
  post_attach_hint_interpolates_brain_name
  adapter_registry_lists_all_four
  dead_error_variants_removed
  time_now_utc_string_has_rfc3339_shape
  fresh_marker_has_schema_version_4

Agent corrected 3 of the spec's epoch anchor timestamps
(1583020800 → 1582977600 for 2020-02-29T12:00:00Z, 1776870000 →
1776877200 for 2026-04-22T17:00:00Z); century-non-leap anchor
4107542400 → 2100-03-01 was already correct.

Known pre-existing: continue_adapter.rs 206 LOC (was 204; +2 for
signature widening). Out-of-scope for this track.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-22 21:00:13 +08:00
..
firewall-diff feat(primitives): 2 Rust verification cubes 2026-04-21 21:00:01 +08:00
kei-artifact Merge feat/v0.16.1-polish — dynamic schema + mode matrix Phase 3.6 2026-04-22 15:13:05 +08:00
kei-auth fix(kei-auth): remove --key CLI flag (F12 HIGH — /proc/cmdline leak) 2026-04-22 13:36:17 +08:00
kei-changelog feat(primitives): kei-docs-scaffold shell + kei-changelog Rust 2026-04-21 21:01:28 +08:00
kei-chat-store chore(rust): misc schema/main refactor in 8 crates (assorted CP splits) 2026-04-22 13:36:17 +08:00
kei-conflict-scan feat(primitives): 4 Rust crates for deep-sleep — conflict-scan, refactor-engine, graph-check, store 2026-04-22 08:28:22 +08:00
kei-content-store chore(rust): misc schema/main refactor in 8 crates (assorted CP splits) 2026-04-22 13:36:17 +08:00
kei-crossdomain chore(rust): misc schema/main refactor in 8 crates (assorted CP splits) 2026-04-22 13:36:17 +08:00
kei-curator chore(rust): misc schema/main refactor in 8 crates (assorted CP splits) 2026-04-22 13:36:17 +08:00
kei-graph-check feat(primitives): 4 Rust crates for deep-sleep — conflict-scan, refactor-engine, graph-check, store 2026-04-22 08:28:22 +08:00
kei-ledger feat(primitives): kei-ledger Rust SQLite agent ledger 2026-04-21 20:52:20 +08:00
kei-memory feat(primitives): kei-memory Rust crate — offline session analyzer (Genesis-clean) 2026-04-22 00:50:04 +08:00
kei-migrate feat(primitives): kei-migrate Rust universal migration runner 2026-04-21 20:35:29 +08:00
kei-refactor-engine fix(kei-refactor-engine): retract 'git apply-ready' claim (F1 RELEASE BLOCKER) 2026-04-22 13:36:17 +08:00
kei-router chore(rust): misc schema/main refactor in 8 crates (assorted CP splits) 2026-04-22 13:36:17 +08:00
kei-sage chore(rust): misc schema/main refactor in 8 crates (assorted CP splits) 2026-04-22 13:36:17 +08:00
kei-search-core chore(rust): misc schema/main refactor in 8 crates (assorted CP splits) 2026-04-22 13:36:17 +08:00
kei-social-store chore(rust): misc schema/main refactor in 8 crates (assorted CP splits) 2026-04-22 13:36:17 +08:00
kei-store fix(v0.21.1): wave-audit consolidated — 5 critic HIGH + 2 security HIGH + 3 polish 2026-04-22 20:03:17 +08:00
kei-task chore(rust): misc schema/main refactor in 8 crates (assorted CP splits) 2026-04-22 13:36:17 +08:00
keisei feat(v0.22): keisei schema v4 + Scope::Auto + templated hint + registry (Track A) 2026-04-22 21:00:13 +08:00
mock-render refactor(mock-render): split main.rs 227 LOC into 4 cubes (F5a Constructor Pattern) 2026-04-22 13:36:17 +08:00
ssh-check feat(primitives): 2 Rust verification cubes 2026-04-21 21:00:01 +08:00
tokens-sync feat(primitives): 3 Rust cubes — mock-render, visual-diff, tokens-sync 2026-04-21 21:07:45 +08:00
visual-diff feat(primitives): 3 Rust cubes — mock-render, visual-diff, tokens-sync 2026-04-21 21:07:45 +08:00
.gitignore feat(primitives): 2 Rust verification cubes 2026-04-21 21:00:01 +08:00
Cargo.lock feat(v0.21): kei-store real S3 backend behind opt-in 's3' feature flag 2026-04-22 17:59:11 +08:00
Cargo.toml fix(v0.19): audit hardening — 3 security HIGH + 3 critic HIGH + 2 critic MEDIUM 2026-04-22 16:36:11 +08:00