Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
107 commits
Select commit Hold shift + click to select a range
b29ddb1
feat: DocOp::Merge, DataSilo crate, config-driven UI, pipeline optimi…
JustMaier Apr 3, 2026
5e45bdd
feat: frozen bitmap query path + aggressive V2 cleanup
JustMaier Apr 4, 2026
4a9701e
chore: remove dead sort wrappers, unused fields, clean imports
JustMaier Apr 4, 2026
009dda7
refactor: remove Arc wrapper from VersionedBitmap base
JustMaier Apr 4, 2026
0d586d3
fix: server feature compilation — add DocSiloAdapter shim methods
JustMaier Apr 4, 2026
9a973c2
chore: purge all V2 system remnants
JustMaier Apr 4, 2026
a3698a8
chore: remove dead DocSink and Ingester wrapper from ingester.rs
JustMaier Apr 4, 2026
09dbda4
feat: add delete support to DataSilo
JustMaier Apr 4, 2026
8d1d4a1
chore: simplify merge thread — remove dead captures and suppress hacks
JustMaier Apr 4, 2026
3d466ad
feat: dead space tracking + auto compaction threshold in DataSilo
JustMaier Apr 4, 2026
533b0ee
perf: replace BufWriter with mmap writes in cold compaction
JustMaier Apr 4, 2026
36fe636
chore: remove dead pg-sync code (Scarlet audit)
JustMaier Apr 4, 2026
943932b
feat: CacheSilo — persistent unified cache backed by DataSilo
JustMaier Apr 4, 2026
23d2f9d
fix: CacheSilo restore + remove dead enrichment code (Scarlet audit)
JustMaier Apr 4, 2026
04ad489
fix: A-B ops log swap — no data loss during compaction
JustMaier Apr 4, 2026
a991514
fix: hot compaction — no reader blocking + data-before-index ordering
JustMaier Apr 4, 2026
3b50d95
feat: enable BitmapSilo compaction + wire into merge thread
JustMaier Apr 4, 2026
c450cee
fix: hot compaction — no full copy, append overflows to existing file
JustMaier Apr 4, 2026
c3fbaf8
feat: BitmapSilo ops-on-read + mutation methods + dead stubs cleanup
JustMaier Apr 4, 2026
b4406d4
refactor: executor uses BitmapSilo ops-on-read as primary read path
JustMaier Apr 4, 2026
8c6993d
feat: ALL bitmap mutations now write to BitmapSilo ops log
JustMaier Apr 4, 2026
1fbc25f
feat: CacheSilo as primary cache read path in query execution
JustMaier Apr 4, 2026
1903fd8
feat: Phase 4 start — silo-only mutations when silo exists
JustMaier Apr 4, 2026
20e4900
refactor: move MutationOp + MutationSender to mutation.rs
JustMaier Apr 4, 2026
6db2178
feat: delete write_coalescer.rs — 1,102 lines removed
JustMaier Apr 4, 2026
3eaeb14
feat: delete unified_cache.rs — 3,387 lines removed (Phase 3 complete)
JustMaier Apr 4, 2026
749daf5
feat: remove FlushCommand enum + loading mode
JustMaier Apr 4, 2026
a62ecd8
feat: remove ArcSwap snapshot publishing — Phase 4 complete
JustMaier Apr 4, 2026
69ffcb7
refactor: Phase 6 — remove internal write methods from ConcurrentEngine
JustMaier Apr 4, 2026
0c5d188
refactor: Phase 7 — extract query path to src/concurrent_engine/query.rs
JustMaier Apr 4, 2026
0001c74
chore: Phase 9 — delete V2-specific tests
JustMaier Apr 4, 2026
8daba42
refactor: extract tests + FlushBatch + delete stubs from concurrent_e…
JustMaier Apr 4, 2026
f4f3c3c
refactor: remove put() + InFlightTracker from ConcurrentEngine, ops-o…
JustMaier Apr 4, 2026
d47cf09
feat: alive ops-on-read, remove put(), InFlightTracker, stubs
JustMaier Apr 4, 2026
e3b279a
refactor: extract flush thread to concurrent_engine/flush.rs
JustMaier Apr 4, 2026
c6c744d
refactor: source layout reorg — engine/, silos/, query/ directories
JustMaier Apr 4, 2026
0c138f0
chore: remove dead load_alive() — ops-on-read is the only path
JustMaier Apr 4, 2026
b52739d
refactor: extract janitor, delete remove_fields — mod.rs at 1,190 lines
JustMaier Apr 4, 2026
8820eb2
refactor: V3 cleanup — delete dead code, parallel writes, module reorg
JustMaier Apr 4, 2026
db22f93
feat: integrate roaring apply_ops() for container-level CoW ops-on-read
JustMaier Apr 4, 2026
a6d175e
refactor: flatten engine/ directory — remove concurrent_engine/ nesting
JustMaier Apr 4, 2026
7a75154
refactor: rename pg_sync → sync, consolidate dump/ingester/loader
JustMaier Apr 4, 2026
76c6ac1
perf: thread-local reusable buffers for dump doc writes
JustMaier Apr 4, 2026
2199251
perf: pre-allocate HashMap capacity for per-row sort values
JustMaier Apr 4, 2026
53984aa
perf: enable ParallelOpsWriter for multi-value dump phases
JustMaier Apr 4, 2026
f7b9a4b
fix: update pg_sync binary imports to use sync:: module path
JustMaier Apr 4, 2026
4c139be
chore: clean stale V2 references — UnifiedCache, BoundStore, WriteCoa…
JustMaier Apr 4, 2026
0a7b957
fix: detect ParallelOpsWriter overflow — correctness bug
JustMaier Apr 4, 2026
9917821
perf: from_sorted_iter for sort bitmap construction (5.86x faster)
JustMaier Apr 4, 2026
121501d
perf: add madvise hints to all mmap'd regions (8 sites)
JustMaier Apr 4, 2026
4c7bbea
bench: bitmap merge strategy comparison (7 strategies, 6 scenarios)
JustMaier Apr 4, 2026
4232e13
perf: replace std HashMap with ahash AHashMap in dump pipeline
JustMaier Apr 4, 2026
e753560
bench: shared vs per-thread filter bitmap accumulation (8 strategies,…
JustMaier Apr 4, 2026
f7df5a0
docs: zero-downtime rolling deploy design (shared-PVC + flock writer …
JustMaier Apr 4, 2026
646e878
bench: parallel cold compaction strategies for DataSilo ops log
JustMaier Apr 4, 2026
0ec8976
bench: parallel cold compaction strategies for DataSilo ops log
JustMaier Apr 4, 2026
93ea3b5
feat: read-only server mode for zero-downtime rolling deploys
JustMaier Apr 4, 2026
3b992cf
bench: add filter_insert_bench microbenchmark for bitmap build strate…
JustMaier Apr 4, 2026
316d3cb
bench: add bitmap_merge_strategies microbenchmark (7 approaches)
JustMaier Apr 4, 2026
55bb01f
perf: dump pipeline optimization — 474K → 987K rows/sec (+108%)
JustMaier Apr 4, 2026
b6e7de9
perf: eliminate bitmap clone waste in apply_bitmaps (into_iter → move)
JustMaier Apr 5, 2026
b5d7263
perf: fuse bitmap apply into merge phase — eliminate separate apply step
JustMaier Apr 5, 2026
0f6798a
perf: direct BitmapSilo writes — bypass V2 staging in dump path
JustMaier Apr 5, 2026
681bb28
perf: dump pipeline 3x optimization + direct BitmapSilo writes (#129)
JustMaier Apr 5, 2026
e4c1714
fix: epoch-based cache staleness detection — port 66715fa to current …
JustMaier Apr 5, 2026
f0fb5ef
fix: epoch-based cache staleness detection (#130)
JustMaier Apr 5, 2026
398f540
feat: standalone frozen sort traversal from BitmapSilo — no in-memory…
JustMaier Apr 5, 2026
d6786f6
Merge branch 'main' of https://github.com/civitai/bitdex
JustMaier Apr 5, 2026
5127582
feat(executor): make BitmapSilo the primary source for range_scan key…
JustMaier Apr 5, 2026
78537f7
feat: frozen sort traversal from BitmapSilo (#131)
JustMaier Apr 5, 2026
dd4b883
feat: range scan key enumeration from BitmapSilo (#132)
JustMaier Apr 5, 2026
5d1eb2e
feat: add FieldRegistry + deterministic u64 key encoding for BitmapSilo
JustMaier Apr 5, 2026
de683e7
feat: alive bitmap via ops-on-read from BitmapSilo in QueryExecutor
JustMaier Apr 5, 2026
7dc7208
feat: alive bitmap via ops-on-read from BitmapSilo (#134)
JustMaier Apr 5, 2026
bf46ade
refactor: remove dual-write in send_mutation_ops — silo path is now e…
JustMaier Apr 5, 2026
a0defd7
refactor: remove dual-write — silo-only mutations (#135)
JustMaier Apr 5, 2026
596f271
feat: planner cardinality estimation from BitmapSilo frozen bitmaps
JustMaier Apr 5, 2026
647c4ac
feat: planner cardinality from BitmapSilo frozen bitmaps (#136)
JustMaier Apr 5, 2026
60caf20
feat: migrate time bucket bitmaps to BitmapSilo storage
JustMaier Apr 5, 2026
eba7b46
feat: migrate time bucket bitmaps to BitmapSilo storage (#137)
JustMaier Apr 5, 2026
e64931e
perf: skip in-memory bitmap apply in flush thread when BitmapSilo pre…
JustMaier Apr 5, 2026
8baaa60
refactor: skip in-memory bitmap apply when BitmapSilo present (#139)
JustMaier Apr 5, 2026
f657d72
feat: add FieldRegistry + deterministic u64 key encoding for BitmapSi…
JustMaier Apr 5, 2026
1f7c071
refactor: remove pending_bucket_diffs from ConcurrentEngine struct, r…
JustMaier Apr 5, 2026
dc3d534
refactor: remove InnerEngine staging pattern, replace with merge_bitm…
JustMaier Apr 5, 2026
d0b3ec3
refactor: remove dead flush-thread state and unused flush_batch methods
JustMaier Apr 5, 2026
0650ecd
refactor: remove dead methods from FilterIndex and SortIndex
JustMaier Apr 5, 2026
bb13ff8
refactor: delete V2 in-memory infrastructure (#141)
JustMaier Apr 5, 2026
ffe1f28
fix: 5 correctness bugs in V3 architecture (stale silo reads, cache e…
JustMaier Apr 5, 2026
7849b58
fix: 5 correctness bugs from external review (#142)
JustMaier Apr 5, 2026
4f8d4da
feat: upgrade DataSilo to u64 keys and wire FieldRegistry into Bitmap…
JustMaier Apr 5, 2026
7972274
feat: DataSilo u64 keys + FieldRegistry wiring into BitmapSilo (#144)
JustMaier Apr 5, 2026
524f431
feat: upgrade DataSilo to u64 keys and wire FieldRegistry into Bitmap…
JustMaier Apr 5, 2026
7a6af46
feat: DataSilo u64 keys + FieldRegistry wiring + dump V3 verified (#145)
JustMaier Apr 5, 2026
2884f54
fix: u32→u64 casts for DataSilo API callers in dump_processor
JustMaier Apr 5, 2026
d83030a
fix: u32→u64 casts for server+pg-sync build (#146)
JustMaier Apr 5, 2026
6819886
fix: u8→u16 filter field index + log frozen serialize errors
JustMaier Apr 5, 2026
5958eeb
feat: configurable rayon_threads (default 24) + cache disable via max…
JustMaier Apr 5, 2026
f842a72
refactor: unify multi-value and standard dump doc write paths
JustMaier Apr 5, 2026
171e16c
fix: restore multi-value-only doc op skip — prevent 70GB OOM on tags …
JustMaier Apr 5, 2026
5dd9156
refactor: streaming doc ops for all phases — remove bitmap inversion …
JustMaier Apr 5, 2026
372e0d8
fix: slot_to_key offset (key=0 sentinel) + accurate mmap size estimate
JustMaier Apr 5, 2026
0af5422
perf: per-slot doc op batching for multi-value phases
JustMaier Apr 6, 2026
dfc2433
feat: DumpMergeWriter for direct read-modify-write + merge-aware comp…
JustMaier Apr 6, 2026
73a991f
fix: address code review findings
JustMaier Apr 6, 2026
4faee10
fix: validate op tag in merge_encoded_docs + reuse encode buffer in c…
JustMaier Apr 6, 2026
629a619
fix: cold compact stays on zero-copy path when no duplicate keys
JustMaier Apr 6, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 66 additions & 4 deletions .claude/skills/deploy/cli.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -365,15 +365,76 @@ function resources() {
}

function wipe() {
err('Wiping bitmap/docstore data on both PVCs (keeping CSVs)...');
err('Wiping bitmap/docstore/WAL data on both PVCs (keeping CSVs in load_stage)...');
err(' IMPORTANT: Pod must be scaled to 0 first, or server recreates dirs on boot.');
for (const i of [0, 1]) {
const cmd = `rm -rf ${INDEX_PATH}/bitmaps ${INDEX_PATH}/docs ${INDEX_PATH}/bounds ${INDEX_PATH}/slot_arena.bin ${INDEX_PATH}/snapshot.meta && echo wiped-${i}`;
const { logs } = runEphemeralPod(`bitdex-wipe-${i}`, { command: cmd, pvcIndex: i, timeout: 60 });
// rm -rf everything EXCEPT load_stage CSVs.
// Must use rm -rf (not find -delete) because the server recreates empty dirs
// on boot, and find -delete would leave shard files inside recreated dirs.
// WAL cleanup is CRITICAL: stale WAL cursor in MetaStore = broken WAL reader.
const cmd = [
`rm -rf ${INDEX_PATH}/bitmaps`, // ShardStore: alive, filter, sort + MetaStore cursors
`rm -rf ${INDEX_PATH}/docs`, // DocStore V3 shard files
`rm -rf /data/wal`, // WAL files (ops_000001.wal etc.)
`mkdir -p /data/wal`, // Recreate empty WAL dir for next boot
`rm -rf ${INDEX_PATH}/bounds`, // Bound cache shards
`rm -f ${INDEX_PATH}/dumps.json`, // Dump state — forces fresh dump on restart
`rm -f ${INDEX_PATH}/slot_arena.bin`,
`rm -f ${INDEX_PATH}/snapshot.meta`,
`echo wiped-${i}`,
].join(' && ');
const { logs } = runEphemeralPod(`bitdex-wipe-${i}`, { command: cmd, pvcIndex: i, timeout: 120 });
err(` PVC ${i}: ${logs}`);
}
json({ wiped: true });
}

function fullReset() {
err('=== FULL RESET: nuke + PG cleanup (keeps CSVs) ===');

// Step 1: Scale to 0
err('Step 1: Scaling to 0...');
run(`kubectl scale sts ${STS} -n ${NS} --replicas=0 --context ${K8S_CONTEXT} 2>/dev/null`);
err(' Waiting for pods to terminate...');
run(`kubectl wait --for=delete pod/bitdex-0 -n ${NS} --timeout=120s --context ${K8S_CONTEXT} 2>/dev/null`, { throws: false });

// Step 2: Wipe PVC data (keeps CSVs)
err('Step 2: Wiping PVC data (keeping load_stage CSVs)...');
wipe();

// Step 3: PG cleanup — drop triggers, truncate ops, delete cursors
err('Step 3: PG cleanup...');
const pgCmds = [
// Drop V2 triggers (they'll be recreated by bitdex-sync on startup)
`DO $$ DECLARE r RECORD; BEGIN FOR r IN SELECT tgname, relname FROM pg_trigger t JOIN pg_class c ON t.tgrelid = c.oid WHERE tgname LIKE 'bitdex_%' LOOP EXECUTE format('DROP TRIGGER IF EXISTS %I ON %I', r.tgname, r.relname); END LOOP; END $$`,
// Truncate ops table
`TRUNCATE TABLE "BitdexOps"`,
// Delete all cursors
`DELETE FROM bitdex_cursors`,
];
for (const cmd of pgCmds) {
const result = run(
`MSYS_NO_PATHCONV=1 kubectl exec -n ${PG_NS} ${PG_POD} --context ${K8S_CONTEXT} -- psql -U postgres -d civitai -c "${cmd.replace(/"/g, '\\"')}" 2>/dev/null`,
{ throws: false }
);
err(` PG: ${result || 'ok'}`);
}

// Step 4: Scale back to 1
err('Step 4: Scaling to 1...');
run(`kubectl scale sts ${STS} -n ${NS} --replicas=1 --context ${K8S_CONTEXT} 2>/dev/null`);
err(' Waiting for pod to be ready...');
run(`kubectl wait --for=condition=ready pod/bitdex-0 -n ${NS} --timeout=300s --context ${K8S_CONTEXT} 2>/dev/null`, { throws: false });

err('=== FULL RESET COMPLETE ===');
err(' PVC: wiped (bitmaps, docs, WAL, bounds, dumps.json) — rm -rf, not find -delete');
err(' PG: triggers dropped, ops truncated, cursors deleted');
err(' WAL: deleted + empty /data/wal/ recreated');
err(' CSVs: preserved in load_stage');
err(' Next: pod will boot fresh, sidecar will re-create triggers and start dump from CSVs');
json({ reset: true, steps: ['scale_down', 'wipe_pvc', 'pg_cleanup', 'scale_up'] });
}

function configRead() {
const config = kubectlExec(`cat ${INDEX_PATH}/config.json`);
try { json(JSON.parse(config)); } catch { json({ error: 'Could not read config', raw: config }); }
Expand Down Expand Up @@ -751,6 +812,7 @@ switch (command) {
// Operations
case 'resources': resources(); break;
case 'wipe': wipe(); break;
case 'full-reset': fullReset(); break;
case 'config-read': configRead(); break;
case 'config-patch': configPatch(); break;
case 'memory': memory(); break;
Expand Down Expand Up @@ -825,7 +887,7 @@ switch (command) {
'Tunnels': ['tunnel pg [start|stop|status]', 'tunnel bitdex [start|stop|status]'],
'Snapshots': ['snapshot-status <session_id>', 'snapshot-download <session_id> [--output <path>]'],
'Metrics': ['metrics-now', 'metrics-trend [window]', 'metrics-query <promql>'],
'Data': ['wipe', 'cleanup <captures|load_stage|legacy|bounds>'],
'Data': ['wipe', 'full-reset', 'cleanup <captures|load_stage|legacy|bounds>'],
},
});
process.exit(1);
Expand Down
13 changes: 13 additions & 0 deletions .claude/skills/ralph/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Project folders contain PRDs and progress files - not committed
projects/

# Legacy root-level files (if anyone runs without --prd)
prd.json
progress.txt

# Daemon runtime files
daemon/daemon.pid
daemon/data/

# Temp directories created by agent sessions
tmpclaude-*-cwd
120 changes: 120 additions & 0 deletions .claude/skills/ralph/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
---
name: ralph
description: Autonomous agent for tackling big projects. Create PRDs with user stories, then run them via the CLI. Sessions persist across restarts with pause/resume and real-time monitoring.
---

# Ralph - Autonomous Agent

Ralph breaks big projects into user stories and executes them autonomously. The workflow:

1. **Create a PRD** - Define user stories with acceptance criteria
2. **Run it** - `ralph.mjs create --prd path/to/prd.json --start`
3. **Monitor** - `ralph.mjs logs <session-id> --follow`

## Creating a PRD

Create a project folder and prd.json:
```
.claude/skills/ralph/projects/<project-name>/prd.json
```

### PRD Structure

```json
{
"description": "Brief description of the feature",
"branchName": "feature/my-feature",
"userStories": [
{
"id": "US001",
"title": "Short descriptive title",
"description": "As a [user], I want [feature] so that [benefit]",
"acceptanceCriteria": [
"Specific testable criterion",
"Typecheck passes"
],
"priority": 1,
"passes": false
}
]
}
```

### Story Guidelines

- **Priority 1**: Foundation - migrations, types, base components
- **Priority 2-3**: Core functionality
- **Priority 4+**: Secondary features, polish
- Each story should touch 1-3 files, not 10-file refactors
- Include "Typecheck passes" in acceptance criteria

## CLI Commands

The daemon starts automatically when you run any command.

### Running Sessions

```bash
# Create and start a session
ralph.mjs create --prd path/to/prd.json --start

# List all sessions
ralph.mjs list

# Check session status
ralph.mjs status <session-id>

# Follow logs in real-time
ralph.mjs logs <session-id> --follow
```

### Session Control

```bash
# Pause a session
ralph.mjs pause <session-id> --reason "Waiting for API"

# Resume with guidance
ralph.mjs resume <session-id> --guidance "API is ready on port 3000"

# Inject guidance into running session
ralph.mjs inject <session-id> --message "Try using the helper in utils.ts"

# Abort a session
ralph.mjs abort <session-id>
```

### Orchestration (Multi-Level)

For orchestrator PRDs that spawn child sessions:

```bash
# Spawn a child session
ralph.mjs spawn <parent-id> --prd child/prd.json --start

# List children of a session
ralph.mjs children <session-id>

# Wait for all children to complete
ralph.mjs wait <session-id>

# View session tree
ralph.mjs tree <session-id>

# Abort parent and all children
ralph.mjs abort <session-id> --cascade
```

## PRD Types

| Type | Use Case |
|------|----------|
| `code` (default) | Implement features, commit code |
| `orchestrator` | Coordinate multiple sub-Ralphs |
| `testing` | Browser automation testing |

Set via `"type": "orchestrator"` in prd.json.

## Full CLI Reference

Run `ralph.mjs --help` for complete documentation.
Loading
Loading