opencode-swarm-plugin 0.62.2 → 0.63.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/claude-plugin/.claude-plugin/plugin.json +1 -1
- package/claude-plugin/commands/ralph.md +157 -0
- package/claude-plugin/dist/index.js +7 -250
- package/claude-plugin/dist/schemas/ralph.d.ts +622 -0
- package/claude-plugin/dist/schemas/ralph.d.ts.map +1 -0
- package/claude-plugin/skills/always-on-guidance/SKILL.md +4 -10
- package/claude-plugin/skills/ralph-supervisor/SKILL.md +198 -0
- package/claude-plugin/skills/swarm-cli/SKILL.md +4 -2
- package/claude-plugin/skills/swarm-coordination/SKILL.md +96 -11
- package/dist/bin/swarm.js +9 -495
- package/dist/index.js +5 -5
- package/dist/marketplace/index.js +7 -250
- package/dist/plugin.js +5 -5
- package/dist/ralph-supervisor.d.ts +248 -0
- package/dist/ralph-supervisor.d.ts.map +1 -0
- package/dist/schemas/ralph.d.ts +622 -0
- package/dist/schemas/ralph.d.ts.map +1 -0
- package/package.json +3 -3
- package/claude-plugin/skills/release/SKILL.md +0 -101
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Run ralph supervisor loop with Codex as executor
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
You are a ralph supervisor. Claude supervises while Codex executes implementation work.
|
|
6
|
+
|
|
7
|
+
## Task
|
|
8
|
+
|
|
9
|
+
$ARGUMENTS
|
|
10
|
+
|
|
11
|
+
## Ralph Pattern Overview
|
|
12
|
+
|
|
13
|
+
Ralph is a supervisor/executor pattern:
|
|
14
|
+
- **Supervisor (Claude)**: Plans stories, reviews work, coordinates
|
|
15
|
+
- **Executor (Codex)**: Implements each story in isolated context
|
|
16
|
+
|
|
17
|
+
Key benefits:
|
|
18
|
+
- **Fresh context per iteration** - Codex starts clean, no drift
|
|
19
|
+
- **Validation gates** - Tests must pass before story is marked complete
|
|
20
|
+
- **Git-backed persistence** - Commits preserve completed work
|
|
21
|
+
- **Progress carryover** - Learnings flow forward via progress.txt
|
|
22
|
+
|
|
23
|
+
## Flags
|
|
24
|
+
|
|
25
|
+
- `--init` - Initialize a new ralph project
|
|
26
|
+
- `--dry-run` - Show what would happen without executing
|
|
27
|
+
- `--sync` - Run loop synchronously (blocks until complete)
|
|
28
|
+
- `--model <model>` - Codex model to use (default: gpt-5.3-codex)
|
|
29
|
+
|
|
30
|
+
## Workflow
|
|
31
|
+
|
|
32
|
+
### 1. Initialize Project (first time only)
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
ralph_init({ project_name: "My Project", description: "..." })
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Creates:
|
|
39
|
+
- `prd.json` - Product Requirements Document with stories
|
|
40
|
+
- `progress.txt` - Accumulated learnings
|
|
41
|
+
|
|
42
|
+
### 2. Add Stories
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
ralph_story({
|
|
46
|
+
title: "Add user authentication",
|
|
47
|
+
description: "Implement login/logout with JWT tokens...",
|
|
48
|
+
priority: 1,
|
|
49
|
+
validation_command: "npm test && npm run typecheck",
|
|
50
|
+
acceptance_criteria: '["JWT token generation works", "Refresh token flow implemented"]'
|
|
51
|
+
})
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### 3. Run Iterations
|
|
55
|
+
|
|
56
|
+
**Single iteration:**
|
|
57
|
+
```
|
|
58
|
+
ralph_iterate({ model: "gpt-5.3-codex", sandbox: "workspace-write" })
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
**Full loop (async by default):**
|
|
62
|
+
```
|
|
63
|
+
ralph_loop({ max_iterations: 20, stop_on_failure: false })
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### 4. Monitor Progress
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
ralph_status() # Project overview
|
|
70
|
+
ralph_status({ job_id: "ralph-123..." }) # Specific job
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### 5. Review Completed Work
|
|
74
|
+
|
|
75
|
+
```
|
|
76
|
+
ralph_review({ story_id: "story-123", approve: true })
|
|
77
|
+
ralph_review({ story_id: "story-456", approve: false, feedback: "Missing error handling" })
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Supervisor Responsibilities
|
|
81
|
+
|
|
82
|
+
As the supervisor, you should:
|
|
83
|
+
|
|
84
|
+
1. **Define clear stories** - Each should fit in one Codex context window
|
|
85
|
+
2. **Set validation commands** - Tests that verify the work is correct
|
|
86
|
+
3. **Review completed work** - Approve or reject with feedback
|
|
87
|
+
4. **Track progress** - Monitor status, handle failures
|
|
88
|
+
5. **Store learnings** - Use hivemind_store for persistent knowledge
|
|
89
|
+
|
|
90
|
+
```
|
|
91
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
92
|
+
│ SUPERVISOR GUIDELINES │
|
|
93
|
+
├─────────────────────────────────────────────────────────────┤
|
|
94
|
+
│ │
|
|
95
|
+
│ ✅ Break work into discrete stories │
|
|
96
|
+
│ ✅ Set clear acceptance criteria │
|
|
97
|
+
│ ✅ Review work quality, not just test pass │
|
|
98
|
+
│ ✅ Provide specific feedback when rejecting │
|
|
99
|
+
│ ✅ Store learnings in hivemind after completion │
|
|
100
|
+
│ │
|
|
101
|
+
│ ❌ Don't write implementation code yourself │
|
|
102
|
+
│ ❌ Don't skip validation steps │
|
|
103
|
+
│ ❌ Don't approve without reviewing │
|
|
104
|
+
│ ❌ Don't forget to check on long-running loops │
|
|
105
|
+
│ │
|
|
106
|
+
└─────────────────────────────────────────────────────────────┘
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Example Session
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
# Initialize
|
|
113
|
+
/swarm:ralph --init "Add OAuth integration"
|
|
114
|
+
|
|
115
|
+
# Add stories
|
|
116
|
+
/swarm:ralph "Add story: Implement OAuth provider config"
|
|
117
|
+
/swarm:ralph "Add story: Add session management"
|
|
118
|
+
/swarm:ralph "Add story: Create OAuth callback handler"
|
|
119
|
+
|
|
120
|
+
# Run the loop
|
|
121
|
+
/swarm:ralph "Start the loop with max 15 iterations"
|
|
122
|
+
|
|
123
|
+
# Check progress
|
|
124
|
+
/swarm:ralph "Show status"
|
|
125
|
+
|
|
126
|
+
# Review and approve
|
|
127
|
+
/swarm:ralph "Review story-123, approve it"
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## Tools Available
|
|
131
|
+
|
|
132
|
+
| Tool | Purpose |
|
|
133
|
+
|------|---------|
|
|
134
|
+
| `ralph_init` | Initialize project (prd.json + progress.txt) |
|
|
135
|
+
| `ralph_story` | Add a story to the PRD |
|
|
136
|
+
| `ralph_iterate` | Run single iteration |
|
|
137
|
+
| `ralph_loop` | Run full loop until done |
|
|
138
|
+
| `ralph_status` | Get project or job status |
|
|
139
|
+
| `ralph_cancel` | Cancel a running loop |
|
|
140
|
+
| `ralph_review` | Approve or reject completed work |
|
|
141
|
+
|
|
142
|
+
## Integration with Swarm Tools
|
|
143
|
+
|
|
144
|
+
Ralph integrates with:
|
|
145
|
+
- **Hive** - Stories can be tracked as hive cells (set `use_hive: true` in init)
|
|
146
|
+
- **Hivemind** - Store learnings with `hivemind_store`
|
|
147
|
+
- **Swarmmail** - File reservations for coordination
|
|
148
|
+
|
|
149
|
+
## When to Use Ralph vs Swarm
|
|
150
|
+
|
|
151
|
+
| Use Ralph | Use Swarm |
|
|
152
|
+
|-----------|-----------|
|
|
153
|
+
| Sequential tasks | Parallel independent tasks |
|
|
154
|
+
| Needs human review | Fully autonomous |
|
|
155
|
+
| Complex validation | Simple test suites |
|
|
156
|
+
| Learning accumulation | One-shot execution |
|
|
157
|
+
| Codex as executor | Claude workers |
|
|
@@ -29321,48 +29321,8 @@ async function runMigrations(db2) {
|
|
|
29321
29321
|
}
|
|
29322
29322
|
}
|
|
29323
29323
|
const finalVersion = await getCurrentVersion3(db2);
|
|
29324
|
-
await healMemorySchema(db2);
|
|
29325
29324
|
return { applied, current: finalVersion };
|
|
29326
29325
|
}
|
|
29327
|
-
async function healMemorySchema(db2) {
|
|
29328
|
-
try {
|
|
29329
|
-
const tableCheck = await db2.query(`SELECT name FROM sqlite_master WHERE type='table' AND name='memories'`);
|
|
29330
|
-
if (tableCheck.rows.length === 0)
|
|
29331
|
-
return;
|
|
29332
|
-
const columnsResult = await db2.query(`SELECT name FROM pragma_table_info('memories')`);
|
|
29333
|
-
const existingColumns = new Set(columnsResult.rows.map((r) => r.name));
|
|
29334
|
-
const expectedColumns = [
|
|
29335
|
-
{ name: "tags", type: "TEXT", defaultVal: "'[]'" },
|
|
29336
|
-
{ name: "updated_at", type: "TEXT", defaultVal: "(datetime('now'))" },
|
|
29337
|
-
{ name: "decay_factor", type: "REAL", defaultVal: "1.0" },
|
|
29338
|
-
{ name: "access_count", type: "TEXT", defaultVal: "'0'" },
|
|
29339
|
-
{ name: "last_accessed", type: "TEXT", defaultVal: "(datetime('now'))" },
|
|
29340
|
-
{ name: "category", type: "TEXT", defaultVal: "NULL" },
|
|
29341
|
-
{ name: "status", type: "TEXT", defaultVal: "'active'" },
|
|
29342
|
-
{ name: "valid_from", type: "TEXT", defaultVal: "NULL" },
|
|
29343
|
-
{ name: "valid_until", type: "TEXT", defaultVal: "NULL" },
|
|
29344
|
-
{ name: "superseded_by", type: "TEXT", defaultVal: "NULL" },
|
|
29345
|
-
{ name: "auto_tags", type: "TEXT", defaultVal: "NULL" },
|
|
29346
|
-
{ name: "keywords", type: "TEXT", defaultVal: "NULL" }
|
|
29347
|
-
];
|
|
29348
|
-
let healed = 0;
|
|
29349
|
-
for (const col of expectedColumns) {
|
|
29350
|
-
if (!existingColumns.has(col.name)) {
|
|
29351
|
-
try {
|
|
29352
|
-
const defaultClause = col.defaultVal === "NULL" ? "" : ` DEFAULT ${col.defaultVal}`;
|
|
29353
|
-
await db2.exec(`ALTER TABLE memories ADD COLUMN ${col.name} ${col.type}${defaultClause}`);
|
|
29354
|
-
healed++;
|
|
29355
|
-
console.log(`[migrations] healed: added missing column memories.${col.name}`);
|
|
29356
|
-
} catch {}
|
|
29357
|
-
}
|
|
29358
|
-
}
|
|
29359
|
-
if (healed > 0) {
|
|
29360
|
-
console.log(`[migrations] self-heal: added ${healed} missing column(s) to memories table`);
|
|
29361
|
-
}
|
|
29362
|
-
} catch (error46) {
|
|
29363
|
-
console.warn("[migrations] self-heal failed (non-fatal):", error46.message);
|
|
29364
|
-
}
|
|
29365
|
-
}
|
|
29366
29326
|
async function rollbackTo(db2, targetVersion) {
|
|
29367
29327
|
const currentVersion = await getCurrentVersion3(db2);
|
|
29368
29328
|
const rolledBack = [];
|
|
@@ -66022,7 +65982,7 @@ ${prefix}}`;
|
|
|
66022
65982
|
fromDriver(value10) {
|
|
66023
65983
|
return Array.from(new Float32Array(value10.buffer));
|
|
66024
65984
|
}
|
|
66025
|
-
}), memories, memoryLinks, entities, entityTaxonomy, relationships, memoryEntities, init_memory, init_expressions2, exports_drizzle_orm, init_drizzle_orm, exports_streams, eventsTable, agentsTable, messagesTable, messageRecipientsTable, reservationsTable, locksTable, cursorsTable, evalRecordsTable, swarmContextsTable, decisionTracesTable, entityLinksTable, init_streams, exports_hive, beads, cells, cellEvents, beadLabels, cellLabels, beadComments, cellComments, beadDependencies, cellDependencies, blockedBeadsCache, dirtyBeads, schemaVersion, init_hive, exports_schema, init_schema, init_drizzle, require_entity, require_logger, require_query_promise, require_column, require_column_builder, require_table_utils, require_foreign_keys, require_tracing_utils, require_unique_constraint, require_array, require_common2, require_enum, require_subquery, require_version, require_tracing, require_view_common, require_table, require_sql, require_alias, require_selection_proxy, require_utils, require_delete, require_casing, require_errors, require_int_common, require_bigint, require_bigserial, require_boolean, require_char, require_cidr, require_custom, require_date_common, require_date, require_double_precision, require_inet, require_integer, require_interval, require_json, require_jsonb, require_line, require_macaddr, require_macaddr8, require_numeric, require_point, require_utils2, require_geometry, require_real, require_serial, require_smallint, require_smallserial, require_text, require_time, require_timestamp, require_uuid, require_varchar, require_bit, require_halfvec, require_sparsevec, require_vector, require_columns, require_all, require_table2, require_primary_keys, require_conditions, require_select, require_expressions, require_relations, require_aggregate, require_vector2, require_functions, require_sql2, require_view_base, require_dialect, require_query_builder, require_select2, require_query_builder2, require_insert, require_refresh_materialized_view, require_select_types, require_update, require_query_builders, require_count, require_query, require_raw, require_db, require_alias2, require_checks, require_indexes, require_policies, require_roles, require_sequence, require_view_common2, require_view, require_schema, require_session, require_subquery2, require_utils3, require_utils4, require_pg_core, require_session2, require_driver, require_pglite, exports_libsql_convenience, instances, init_libsql_convenience, exports_lock, DurableLock, DurableLockLive, init_lock, exports_reservation_utils, init_reservation_utils, init_projections_drizzle, exports_store_drizzle, init_store_drizzle, exports_swarm_mail, MAX_INBOX_LIMIT = 5, DEFAULT_TTL_SECONDS = 3600, ADJECTIVES, NOUNS, init_swarm_mail, MAX_INBOX_LIMIT2 = 5, DEFAULT_TTL_SECONDS2 = 3600, ADJECTIVES2, NOUNS2, init_agent_mail, exports_migrations, beadsMigration, cellsViewMigration, cellsViewMigrationLibSQL, beadsMigrationLibSQL, beadsResultColumnsMigration, beadsResultColumnsMigrationLibSQL, beadsMigrations, hiveMigrations, sessionsMigrationLibSQL, hiveMigrationsLibSQL, init_migrations, memoryMigration,
|
|
65985
|
+
}), memories, memoryLinks, entities, entityTaxonomy, relationships, memoryEntities, init_memory, init_expressions2, exports_drizzle_orm, init_drizzle_orm, exports_streams, eventsTable, agentsTable, messagesTable, messageRecipientsTable, reservationsTable, locksTable, cursorsTable, evalRecordsTable, swarmContextsTable, decisionTracesTable, entityLinksTable, init_streams, exports_hive, beads, cells, cellEvents, beadLabels, cellLabels, beadComments, cellComments, beadDependencies, cellDependencies, blockedBeadsCache, dirtyBeads, schemaVersion, init_hive, exports_schema, init_schema, init_drizzle, require_entity, require_logger, require_query_promise, require_column, require_column_builder, require_table_utils, require_foreign_keys, require_tracing_utils, require_unique_constraint, require_array, require_common2, require_enum, require_subquery, require_version, require_tracing, require_view_common, require_table, require_sql, require_alias, require_selection_proxy, require_utils, require_delete, require_casing, require_errors, require_int_common, require_bigint, require_bigserial, require_boolean, require_char, require_cidr, require_custom, require_date_common, require_date, require_double_precision, require_inet, require_integer, require_interval, require_json, require_jsonb, require_line, require_macaddr, require_macaddr8, require_numeric, require_point, require_utils2, require_geometry, require_real, require_serial, require_smallint, require_smallserial, require_text, require_time, require_timestamp, require_uuid, require_varchar, require_bit, require_halfvec, require_sparsevec, require_vector, require_columns, require_all, require_table2, require_primary_keys, require_conditions, require_select, require_expressions, require_relations, require_aggregate, require_vector2, require_functions, require_sql2, require_view_base, require_dialect, require_query_builder, require_select2, require_query_builder2, require_insert, require_refresh_materialized_view, require_select_types, require_update, require_query_builders, require_count, require_query, require_raw, require_db, require_alias2, require_checks, require_indexes, require_policies, require_roles, require_sequence, require_view_common2, require_view, require_schema, require_session, require_subquery2, require_utils3, require_utils4, require_pg_core, require_session2, require_driver, require_pglite, exports_libsql_convenience, instances, init_libsql_convenience, exports_lock, DurableLock, DurableLockLive, init_lock, exports_reservation_utils, init_reservation_utils, init_projections_drizzle, exports_store_drizzle, init_store_drizzle, exports_swarm_mail, MAX_INBOX_LIMIT = 5, DEFAULT_TTL_SECONDS = 3600, ADJECTIVES, NOUNS, init_swarm_mail, MAX_INBOX_LIMIT2 = 5, DEFAULT_TTL_SECONDS2 = 3600, ADJECTIVES2, NOUNS2, init_agent_mail, exports_migrations, beadsMigration, cellsViewMigration, cellsViewMigrationLibSQL, beadsMigrationLibSQL, beadsResultColumnsMigration, beadsResultColumnsMigrationLibSQL, beadsMigrations, hiveMigrations, sessionsMigrationLibSQL, hiveMigrationsLibSQL, init_migrations, memoryMigration, memoryMigrations, init_migrations2, exports_migrations2, migrations, init_migrations3, urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict", POOL_SIZE_MULTIPLIER = 128, pool, poolOffset, init_nanoid = () => {}, init_decision_trace_store, ClientBuffer, init_client_buffer, exports_streams2, SLOW_QUERY_THRESHOLD_MS = 100, init_streams2, exports_store, adapterCache, TIMESTAMP_SAFE_UNTIL, init_store, init_adapter, exports_dependencies_drizzle, MAX_DEPENDENCY_DEPTH = 100, init_dependencies_drizzle, exports_projections_drizzle, init_projections_drizzle2, exports_dependencies, MAX_DEPENDENCY_DEPTH2 = 100, init_store2, FIELD_SETS, init_pagination, marker = "vercel.ai.error", symbol6, _a, _b, AISDKError, name2 = "AI_APICallError", marker2, symbol222, _a2, _b2, APICallError, name22 = "AI_EmptyResponseBodyError", marker3, symbol32, _a3, _b3, EmptyResponseBodyError, name3 = "AI_InvalidArgumentError", marker4, symbol42, _a4, _b4, InvalidArgumentError, name4 = "AI_InvalidPromptError", marker5, symbol52, _a5, _b5, InvalidPromptError, name5 = "AI_InvalidResponseDataError", marker6, symbol62, _a6, _b6, InvalidResponseDataError, name6 = "AI_JSONParseError", marker7, symbol7, _a7, _b7, JSONParseError, name7 = "AI_LoadAPIKeyError", marker8, symbol8, _a8, _b8, LoadAPIKeyError, name8 = "AI_LoadSettingError", marker9, symbol9, _a9, _b9, LoadSettingError, name9 = "AI_NoContentGeneratedError", marker10, symbol10, _a10, _b10, NoContentGeneratedError, name10 = "AI_NoSuchModelError", marker11, symbol11, _a11, _b11, NoSuchModelError, name11 = "AI_TooManyEmbeddingValuesForCallError", marker12, symbol12, _a12, _b12, TooManyEmbeddingValuesForCallError, name12 = "AI_TypeValidationError", marker13, symbol13, _a13, _b13, TypeValidationError, name13 = "AI_UnsupportedFunctionalityError", marker14, symbol14, _a14, _b14, UnsupportedFunctionalityError, init_dist3, NEVER22, $brand2, $ZodAsyncError2, globalConfig2, init_core32, exports_util2, captureStackTrace2, allowsEval2, getParsedType22 = (data) => {
|
|
66026
65986
|
const t = typeof data;
|
|
66027
65987
|
switch (t) {
|
|
66028
65988
|
case "undefined":
|
|
@@ -133759,212 +133719,9 @@ ${stack.split(`
|
|
|
133759
133719
|
DROP INDEX IF EXISTS memories_content_idx;
|
|
133760
133720
|
DROP INDEX IF EXISTS idx_memories_collection;
|
|
133761
133721
|
DROP TABLE IF EXISTS memories;
|
|
133762
|
-
`
|
|
133763
|
-
};
|
|
133764
|
-
memoryMigrationLibSQL = {
|
|
133765
|
-
version: 9,
|
|
133766
|
-
description: "Add semantic memory tables (memories with vector support, FTS5)",
|
|
133767
|
-
up: `
|
|
133768
|
-
-- ========================================================================
|
|
133769
|
-
-- Memories Table
|
|
133770
|
-
-- ========================================================================
|
|
133771
|
-
CREATE TABLE IF NOT EXISTS memories (
|
|
133772
|
-
id TEXT PRIMARY KEY NOT NULL,
|
|
133773
|
-
content TEXT NOT NULL,
|
|
133774
|
-
metadata TEXT DEFAULT '{}',
|
|
133775
|
-
collection TEXT DEFAULT 'default',
|
|
133776
|
-
created_at TEXT DEFAULT (datetime('now')),
|
|
133777
|
-
confidence REAL DEFAULT 0.7,
|
|
133778
|
-
embedding F32_BLOB(1024)
|
|
133779
|
-
);
|
|
133780
|
-
|
|
133781
|
-
-- Collection filtering index
|
|
133782
|
-
CREATE INDEX IF NOT EXISTS idx_memories_collection ON memories(collection);
|
|
133783
|
-
|
|
133784
|
-
-- Vector embedding index for fast similarity search
|
|
133785
|
-
CREATE INDEX IF NOT EXISTS idx_memories_embedding ON memories(libsql_vector_idx(embedding));
|
|
133786
|
-
|
|
133787
|
-
-- ========================================================================
|
|
133788
|
-
-- FTS5 virtual table for full-text search
|
|
133789
|
-
-- ========================================================================
|
|
133790
|
-
CREATE VIRTUAL TABLE IF NOT EXISTS memories_fts
|
|
133791
|
-
USING fts5(id UNINDEXED, content, content=memories, content_rowid=rowid);
|
|
133792
|
-
|
|
133793
|
-
-- Triggers to keep FTS5 in sync
|
|
133794
|
-
CREATE TRIGGER IF NOT EXISTS memories_fts_insert
|
|
133795
|
-
AFTER INSERT ON memories
|
|
133796
|
-
BEGIN
|
|
133797
|
-
INSERT INTO memories_fts(rowid, id, content)
|
|
133798
|
-
VALUES (new.rowid, new.id, new.content);
|
|
133799
|
-
END;
|
|
133800
|
-
|
|
133801
|
-
CREATE TRIGGER IF NOT EXISTS memories_fts_update
|
|
133802
|
-
AFTER UPDATE ON memories
|
|
133803
|
-
BEGIN
|
|
133804
|
-
UPDATE memories_fts
|
|
133805
|
-
SET content = new.content
|
|
133806
|
-
WHERE rowid = new.rowid;
|
|
133807
|
-
END;
|
|
133808
|
-
|
|
133809
|
-
CREATE TRIGGER IF NOT EXISTS memories_fts_delete
|
|
133810
|
-
AFTER DELETE ON memories
|
|
133811
|
-
BEGIN
|
|
133812
|
-
DELETE FROM memories_fts WHERE rowid = old.rowid;
|
|
133813
|
-
END;
|
|
133814
|
-
`,
|
|
133815
|
-
down: `
|
|
133816
|
-
-- Drop in reverse order
|
|
133817
|
-
DROP TRIGGER IF EXISTS memories_fts_delete;
|
|
133818
|
-
DROP TRIGGER IF EXISTS memories_fts_update;
|
|
133819
|
-
DROP TRIGGER IF EXISTS memories_fts_insert;
|
|
133820
|
-
DROP TABLE IF EXISTS memories_fts;
|
|
133821
|
-
DROP INDEX IF EXISTS idx_memories_embedding;
|
|
133822
|
-
DROP INDEX IF EXISTS idx_memories_collection;
|
|
133823
|
-
DROP TABLE IF EXISTS memories;
|
|
133824
|
-
`
|
|
133825
|
-
};
|
|
133826
|
-
memorySchemaOverhaulLibSQL = {
|
|
133827
|
-
version: 10,
|
|
133828
|
-
description: "Memory schema overhaul: links, entities, relationships, temporal fields",
|
|
133829
|
-
up: `
|
|
133830
|
-
-- ========================================================================
|
|
133831
|
-
-- Add temporal and metadata columns to memories table
|
|
133832
|
-
-- ========================================================================
|
|
133833
|
-
ALTER TABLE memories ADD COLUMN valid_from TEXT;
|
|
133834
|
-
ALTER TABLE memories ADD COLUMN valid_until TEXT;
|
|
133835
|
-
ALTER TABLE memories ADD COLUMN superseded_by TEXT REFERENCES memories(id);
|
|
133836
|
-
ALTER TABLE memories ADD COLUMN auto_tags TEXT;
|
|
133837
|
-
ALTER TABLE memories ADD COLUMN keywords TEXT;
|
|
133838
|
-
|
|
133839
|
-
-- ========================================================================
|
|
133840
|
-
-- Memory Links Table (Zettelkasten-style bidirectional connections)
|
|
133841
|
-
-- ========================================================================
|
|
133842
|
-
CREATE TABLE IF NOT EXISTS memory_links (
|
|
133843
|
-
id TEXT PRIMARY KEY,
|
|
133844
|
-
source_id TEXT NOT NULL REFERENCES memories(id) ON DELETE CASCADE,
|
|
133845
|
-
target_id TEXT NOT NULL REFERENCES memories(id) ON DELETE CASCADE,
|
|
133846
|
-
link_type TEXT NOT NULL,
|
|
133847
|
-
strength REAL DEFAULT 1.0,
|
|
133848
|
-
created_at TEXT DEFAULT (datetime('now')),
|
|
133849
|
-
UNIQUE(source_id, target_id, link_type)
|
|
133850
|
-
);
|
|
133851
|
-
|
|
133852
|
-
CREATE INDEX IF NOT EXISTS idx_memory_links_source ON memory_links(source_id);
|
|
133853
|
-
CREATE INDEX IF NOT EXISTS idx_memory_links_target ON memory_links(target_id);
|
|
133854
|
-
|
|
133855
|
-
-- ========================================================================
|
|
133856
|
-
-- Entities Table (Named entities extracted from memories)
|
|
133857
|
-
-- ========================================================================
|
|
133858
|
-
CREATE TABLE IF NOT EXISTS entities (
|
|
133859
|
-
id TEXT PRIMARY KEY,
|
|
133860
|
-
name TEXT NOT NULL,
|
|
133861
|
-
entity_type TEXT NOT NULL,
|
|
133862
|
-
canonical_name TEXT,
|
|
133863
|
-
created_at TEXT DEFAULT (datetime('now')),
|
|
133864
|
-
updated_at TEXT DEFAULT (datetime('now')),
|
|
133865
|
-
UNIQUE(name, entity_type)
|
|
133866
|
-
);
|
|
133867
|
-
|
|
133868
|
-
CREATE INDEX IF NOT EXISTS idx_entities_type ON entities(entity_type);
|
|
133869
|
-
CREATE INDEX IF NOT EXISTS idx_entities_name ON entities(name);
|
|
133870
|
-
|
|
133871
|
-
-- ========================================================================
|
|
133872
|
-
-- Relationships Table (Entity-entity triples)
|
|
133873
|
-
-- ========================================================================
|
|
133874
|
-
CREATE TABLE IF NOT EXISTS relationships (
|
|
133875
|
-
id TEXT PRIMARY KEY,
|
|
133876
|
-
subject_id TEXT NOT NULL REFERENCES entities(id) ON DELETE CASCADE,
|
|
133877
|
-
predicate TEXT NOT NULL,
|
|
133878
|
-
object_id TEXT NOT NULL REFERENCES entities(id) ON DELETE CASCADE,
|
|
133879
|
-
memory_id TEXT REFERENCES memories(id) ON DELETE SET NULL,
|
|
133880
|
-
confidence REAL DEFAULT 1.0,
|
|
133881
|
-
created_at TEXT DEFAULT (datetime('now')),
|
|
133882
|
-
UNIQUE(subject_id, predicate, object_id)
|
|
133883
|
-
);
|
|
133884
|
-
|
|
133885
|
-
CREATE INDEX IF NOT EXISTS idx_relationships_subject ON relationships(subject_id);
|
|
133886
|
-
CREATE INDEX IF NOT EXISTS idx_relationships_object ON relationships(object_id);
|
|
133887
|
-
CREATE INDEX IF NOT EXISTS idx_relationships_predicate ON relationships(predicate);
|
|
133888
|
-
|
|
133889
|
-
-- ========================================================================
|
|
133890
|
-
-- Memory-Entities Junction Table
|
|
133891
|
-
-- ========================================================================
|
|
133892
|
-
CREATE TABLE IF NOT EXISTS memory_entities (
|
|
133893
|
-
memory_id TEXT NOT NULL REFERENCES memories(id) ON DELETE CASCADE,
|
|
133894
|
-
entity_id TEXT NOT NULL REFERENCES entities(id) ON DELETE CASCADE,
|
|
133895
|
-
role TEXT,
|
|
133896
|
-
PRIMARY KEY(memory_id, entity_id)
|
|
133897
|
-
);
|
|
133898
|
-
`,
|
|
133899
|
-
down: `
|
|
133900
|
-
-- Drop tables in dependency order
|
|
133901
|
-
DROP TABLE IF EXISTS memory_entities;
|
|
133902
|
-
DROP TABLE IF EXISTS relationships;
|
|
133903
|
-
DROP INDEX IF EXISTS idx_memory_links_source;
|
|
133904
|
-
DROP INDEX IF EXISTS idx_memory_links_target;
|
|
133905
|
-
DROP TABLE IF EXISTS memory_links;
|
|
133906
|
-
DROP INDEX IF EXISTS idx_entities_type;
|
|
133907
|
-
DROP INDEX IF EXISTS idx_entities_name;
|
|
133908
|
-
DROP TABLE IF EXISTS entities;
|
|
133909
|
-
|
|
133910
|
-
-- Remove columns from memories table (SQLite doesn't support DROP COLUMN until 3.35.0)
|
|
133911
|
-
-- In production, these columns can be left as NULL if downgrade is needed
|
|
133912
|
-
-- Or recreate table without these columns
|
|
133913
|
-
`
|
|
133914
|
-
};
|
|
133915
|
-
sessionMetadataExtensionLibSQL = {
|
|
133916
|
-
version: 11,
|
|
133917
|
-
description: "Add session metadata columns (agent_type, session_id, message_role, message_idx, source_path)",
|
|
133918
|
-
up: `
|
|
133919
|
-
-- ========================================================================
|
|
133920
|
-
-- Add session metadata columns to memories table
|
|
133921
|
-
-- ========================================================================
|
|
133922
|
-
ALTER TABLE memories ADD COLUMN agent_type TEXT;
|
|
133923
|
-
ALTER TABLE memories ADD COLUMN session_id TEXT;
|
|
133924
|
-
ALTER TABLE memories ADD COLUMN message_role TEXT CHECK(message_role IN ('user', 'assistant', 'system'));
|
|
133925
|
-
ALTER TABLE memories ADD COLUMN message_idx INTEGER;
|
|
133926
|
-
ALTER TABLE memories ADD COLUMN source_path TEXT;
|
|
133927
|
-
|
|
133928
|
-
-- Index for session-based queries
|
|
133929
|
-
CREATE INDEX IF NOT EXISTS idx_memories_session ON memories(session_id, message_idx);
|
|
133930
|
-
|
|
133931
|
-
-- Index for agent filtering
|
|
133932
|
-
CREATE INDEX IF NOT EXISTS idx_memories_agent_type ON memories(agent_type);
|
|
133933
|
-
|
|
133934
|
-
-- Index for role filtering
|
|
133935
|
-
CREATE INDEX IF NOT EXISTS idx_memories_role ON memories(message_role);
|
|
133936
|
-
`,
|
|
133937
|
-
down: `
|
|
133938
|
-
-- Drop indexes first
|
|
133939
|
-
DROP INDEX IF EXISTS idx_memories_role;
|
|
133940
|
-
DROP INDEX IF EXISTS idx_memories_agent_type;
|
|
133941
|
-
DROP INDEX IF EXISTS idx_memories_session;
|
|
133942
|
-
|
|
133943
|
-
-- SQLite doesn't support DROP COLUMN until 3.35.0
|
|
133944
|
-
-- In production, these columns can be left as NULL if downgrade is needed
|
|
133945
|
-
-- Or recreate table without these columns
|
|
133946
|
-
`
|
|
133947
|
-
};
|
|
133948
|
-
memorySelfHealColumnsLibSQL = {
|
|
133949
|
-
version: 12,
|
|
133950
|
-
description: "Schema convergence: self-heal missing columns (tags, updated_at, decay_factor, access_count, last_accessed, category, status)",
|
|
133951
|
-
up: `
|
|
133952
|
-
-- No-op: actual column additions handled by healMemorySchema() post-migration.
|
|
133953
|
-
-- This migration just bumps the version number.
|
|
133954
|
-
SELECT 1;
|
|
133955
|
-
`,
|
|
133956
|
-
down: `
|
|
133957
|
-
-- Cannot remove columns in older SQLite versions
|
|
133958
|
-
SELECT 1;
|
|
133959
133722
|
`
|
|
133960
133723
|
};
|
|
133961
133724
|
memoryMigrations = [memoryMigration];
|
|
133962
|
-
memoryMigrationsLibSQL = [
|
|
133963
|
-
memoryMigrationLibSQL,
|
|
133964
|
-
memorySchemaOverhaulLibSQL,
|
|
133965
|
-
sessionMetadataExtensionLibSQL,
|
|
133966
|
-
memorySelfHealColumnsLibSQL
|
|
133967
|
-
];
|
|
133968
133725
|
});
|
|
133969
133726
|
exports_migrations2 = {};
|
|
133970
133727
|
__export2(exports_migrations2, {
|
|
@@ -134304,7 +134061,7 @@ ${stack.split(`
|
|
|
134304
134061
|
`
|
|
134305
134062
|
},
|
|
134306
134063
|
...hiveMigrations,
|
|
134307
|
-
...
|
|
134064
|
+
...memoryMigrations
|
|
134308
134065
|
];
|
|
134309
134066
|
});
|
|
134310
134067
|
init_decision_trace_store = __esm2(() => {
|
|
@@ -152910,7 +152667,7 @@ WD9f
|
|
|
152910
152667
|
|
|
152911
152668
|
// ../../node_modules/.bun/ioredis@5.9.2/node_modules/ioredis/built/utils/index.js
|
|
152912
152669
|
var require_utils9 = __commonJS((exports) => {
|
|
152913
|
-
var __dirname = "/
|
|
152670
|
+
var __dirname = "/Users/joel/Code/joelhooks/opencode-swarm-plugin/node_modules/.bun/ioredis@5.9.2/node_modules/ioredis/built/utils";
|
|
152914
152671
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
152915
152672
|
exports.noop = exports.defaults = exports.Debug = exports.getPackageMeta = exports.zipMap = exports.CONNECTION_CLOSED_ERROR_MSG = exports.shuffle = exports.sample = exports.resolveTLSProfile = exports.parseURL = exports.optimizeErrorStack = exports.toArg = exports.convertMapToArray = exports.convertObjectToArray = exports.timeout = exports.packObject = exports.isInt = exports.wrapMultiResult = exports.convertBufferToString = undefined;
|
|
152916
152673
|
var fs_1 = __require("fs");
|
|
@@ -153196,7 +152953,7 @@ var require_argumentParsers = __commonJS((exports) => {
|
|
|
153196
152953
|
|
|
153197
152954
|
// ../../node_modules/.bun/ioredis@5.9.2/node_modules/ioredis/built/Command.js
|
|
153198
152955
|
var require_Command = __commonJS((exports) => {
|
|
153199
|
-
var __dirname = "/
|
|
152956
|
+
var __dirname = "/Users/joel/Code/joelhooks/opencode-swarm-plugin/node_modules/.bun/ioredis@5.9.2/node_modules/ioredis/built";
|
|
153200
152957
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
153201
152958
|
var commands_1 = require_built();
|
|
153202
152959
|
var calculateSlot = require_lib();
|
|
@@ -194447,7 +194204,7 @@ var require_node_gyp_build_optional_packages = __commonJS((exports, module) => {
|
|
|
194447
194204
|
|
|
194448
194205
|
// ../../node_modules/.bun/msgpackr-extract@3.0.3/node_modules/msgpackr-extract/index.js
|
|
194449
194206
|
var require_msgpackr_extract = __commonJS((exports, module) => {
|
|
194450
|
-
var __dirname = "/
|
|
194207
|
+
var __dirname = "/Users/joel/Code/joelhooks/opencode-swarm-plugin/node_modules/.bun/msgpackr-extract@3.0.3/node_modules/msgpackr-extract";
|
|
194451
194208
|
module.exports = require_node_gyp_build_optional_packages()(__dirname);
|
|
194452
194209
|
});
|
|
194453
194210
|
|
|
@@ -218750,7 +218507,7 @@ var require_indexes2 = __commonJS((exports, module) => {
|
|
|
218750
218507
|
|
|
218751
218508
|
// ../../node_modules/.bun/thread-stream@3.1.0/node_modules/thread-stream/index.js
|
|
218752
218509
|
var require_thread_stream = __commonJS((exports, module) => {
|
|
218753
|
-
var __dirname = "/
|
|
218510
|
+
var __dirname = "/Users/joel/Code/joelhooks/opencode-swarm-plugin/node_modules/.bun/thread-stream@3.1.0/node_modules/thread-stream";
|
|
218754
218511
|
var { version: version5 } = require_package();
|
|
218755
218512
|
var { EventEmitter: EventEmitter4 } = __require("events");
|
|
218756
218513
|
var { Worker: Worker3 } = __require("worker_threads");
|
|
@@ -219171,7 +218928,7 @@ var require_thread_stream = __commonJS((exports, module) => {
|
|
|
219171
218928
|
|
|
219172
218929
|
// ../../node_modules/.bun/pino@9.14.0/node_modules/pino/lib/transport.js
|
|
219173
218930
|
var require_transport = __commonJS((exports, module) => {
|
|
219174
|
-
var __dirname = "/
|
|
218931
|
+
var __dirname = "/Users/joel/Code/joelhooks/opencode-swarm-plugin/node_modules/.bun/pino@9.14.0/node_modules/pino/lib";
|
|
219175
218932
|
var { createRequire: createRequire3 } = __require("module");
|
|
219176
218933
|
var getCallers = require_caller();
|
|
219177
218934
|
var { join: join18, isAbsolute: isAbsolute3, sep: sep4 } = __require("node:path");
|