Skip to content

Commit 86a52c0

Browse files
authored
remove sqlite dependency for jsonl (#343)
* remove sqlite dependency for jsonl * config fix from review * remove extraenous watch dog and sqlite deps * use compaction for continuity and remove migration file * plan for more sophisticated handling in relay-pty * remove unused feature tests
1 parent 275d9cb commit 86a52c0

26 files changed

+490
-4016
lines changed

.beads/issues.jsonl

Lines changed: 75 additions & 74 deletions
Large diffs are not rendered by default.

.github/workflows/sqlite-migrations.yml

Lines changed: 0 additions & 105 deletions
This file was deleted.
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
{
2+
"id": "traj_azpldna9k695",
3+
"version": 1,
4+
"task": {
5+
"title": "Add JSONL ledger to relay-pty for crash recovery and durability",
6+
"source": {
7+
"system": "plain",
8+
"id": "agent-relay-547"
9+
}
10+
},
11+
"status": "abandoned",
12+
"startedAt": "2026-01-29T08:54:25.152Z",
13+
"agents": [
14+
{
15+
"name": "khaliqgant",
16+
"role": "lead",
17+
"joinedAt": "2026-01-29T08:54:25.153Z"
18+
}
19+
],
20+
"chapters": [
21+
{
22+
"id": "chap_vsvx5h0gpthn",
23+
"title": "Work",
24+
"agentName": "default",
25+
"startedAt": "2026-01-29T08:54:31.890Z",
26+
"events": [
27+
{
28+
"ts": 1769676871891,
29+
"type": "decision",
30+
"content": "Use JSONL instead of SQLite for relay-pty ledger: Use JSONL instead of SQLite for relay-pty ledger",
31+
"raw": {
32+
"question": "Use JSONL instead of SQLite for relay-pty ledger",
33+
"chosen": "Use JSONL instead of SQLite for relay-pty ledger",
34+
"alternatives": [],
35+
"reasoning": "JSONL is simpler than SQLite, no native dependencies, append-only is sufficient for this use case, easy to debug/inspect, and matches existing JSONL patterns in the codebase"
36+
},
37+
"significance": "high"
38+
},
39+
{
40+
"ts": 1769676877741,
41+
"type": "note",
42+
"content": "Abandoned: Deferring implementation - bead agent-relay-547 created for future work",
43+
"significance": "high"
44+
}
45+
],
46+
"endedAt": "2026-01-29T08:54:37.741Z"
47+
}
48+
],
49+
"commits": [],
50+
"filesChanged": [],
51+
"projectId": "/Users/khaliqgant/Projects/agent-workforce/relay",
52+
"tags": [],
53+
"completedAt": "2026-01-29T08:54:37.741Z"
54+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Trajectory: Add JSONL ledger to relay-pty for crash recovery and durability
2+
3+
> **Status:** ❌ Abandoned
4+
> **Task:** agent-relay-547
5+
> **Started:** January 29, 2026 at 09:54 AM
6+
> **Completed:** January 29, 2026 at 09:54 AM
7+
8+
---
9+
10+
## Key Decisions
11+
12+
### Use JSONL instead of SQLite for relay-pty ledger
13+
- **Chose:** Use JSONL instead of SQLite for relay-pty ledger
14+
- **Reasoning:** JSONL is simpler than SQLite, no native dependencies, append-only is sufficient for this use case, easy to debug/inspect, and matches existing JSONL patterns in the codebase
15+
16+
---
17+
18+
## Chapters
19+
20+
### 1. Work
21+
*Agent: default*
22+
23+
- Use JSONL instead of SQLite for relay-pty ledger: Use JSONL instead of SQLite for relay-pty ledger
24+
- Abandoned: Deferring implementation - bead agent-relay-547 created for future work

.trajectories/index.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"version": 1,
3-
"lastUpdated": "2026-01-28T16:43:08.679Z",
3+
"lastUpdated": "2026-01-29T08:54:37.765Z",
44
"trajectories": {
55
"traj_1b1dj40sl6jl": {
66
"title": "Revert aggressive retry logic in relay-pty-orchestrator",
@@ -162,6 +162,13 @@
162162
"startedAt": "2026-01-28T16:43:08.517Z",
163163
"completedAt": "2026-01-28T16:43:08.669Z",
164164
"path": "/Users/khaliqgant/Projects/agent-workforce/relay/.trajectories/completed/2026-01/traj_5lnb4d5r3902.json"
165+
},
166+
"traj_azpldna9k695": {
167+
"title": "Add JSONL ledger to relay-pty for crash recovery and durability",
168+
"status": "abandoned",
169+
"startedAt": "2026-01-29T08:54:25.152Z",
170+
"completedAt": "2026-01-29T08:54:37.741Z",
171+
"path": "/Users/khaliqgant/Projects/agent-workforce/relay/.trajectories/completed/2026-01/traj_azpldna9k695.json"
165172
}
166173
}
167174
}

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,6 @@
149149
"@agent-relay/wrapper": "2.0.37",
150150
"@modelcontextprotocol/sdk": "^1.0.0",
151151
"agent-trajectories": "^0.2.3",
152-
"better-sqlite3": "^12.6.2",
153152
"chokidar": "^5.0.0",
154153
"commander": "^12.1.0",
155154
"compare-versions": "^6.1.1",

packages/config/src/project-namespace.ts

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,3 +342,68 @@ export function listWorkspaceRepos(baseDir: string): string[] {
342342

343343
return repos;
344344
}
345+
346+
/**
347+
* Runtime configuration that the daemon writes when it starts.
348+
* CLI commands can read this to use matching storage configuration.
349+
*/
350+
export interface RuntimeConfig {
351+
/** Storage type currently in use by the daemon */
352+
storageType?: string;
353+
/** Daemon PID */
354+
daemonPid?: number;
355+
/** Timestamp when daemon started */
356+
startedAt?: string;
357+
/** Daemon version */
358+
version?: string;
359+
}
360+
361+
const RUNTIME_CONFIG_FILE = 'runtime.json';
362+
363+
/**
364+
* Save runtime configuration for the current project.
365+
* Called by the daemon when it starts.
366+
*/
367+
export function saveRuntimeConfig(config: RuntimeConfig, projectRoot?: string): void {
368+
const paths = getProjectPaths(projectRoot);
369+
const configPath = path.join(paths.dataDir, RUNTIME_CONFIG_FILE);
370+
371+
// Ensure data dir exists
372+
if (!fs.existsSync(paths.dataDir)) {
373+
fs.mkdirSync(paths.dataDir, { recursive: true });
374+
}
375+
376+
fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
377+
}
378+
379+
/**
380+
* Load runtime configuration for the current project.
381+
* Returns undefined if no runtime config exists or the daemon isn't running.
382+
*/
383+
export function loadRuntimeConfig(projectRoot?: string): RuntimeConfig | undefined {
384+
const paths = getProjectPaths(projectRoot);
385+
const configPath = path.join(paths.dataDir, RUNTIME_CONFIG_FILE);
386+
387+
if (!fs.existsSync(configPath)) {
388+
return undefined;
389+
}
390+
391+
try {
392+
const content = fs.readFileSync(configPath, 'utf-8');
393+
return JSON.parse(content) as RuntimeConfig;
394+
} catch {
395+
return undefined;
396+
}
397+
}
398+
399+
/**
400+
* Clear runtime configuration (called when daemon stops).
401+
*/
402+
export function clearRuntimeConfig(projectRoot?: string): void {
403+
const paths = getProjectPaths(projectRoot);
404+
const configPath = path.join(paths.dataDir, RUNTIME_CONFIG_FILE);
405+
406+
if (fs.existsSync(configPath)) {
407+
fs.unlinkSync(configPath);
408+
}
409+
}

packages/continuity/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121
"test": "vitest run",
2222
"test:watch": "vitest"
2323
},
24+
"dependencies": {
25+
"@agent-relay/memory": "2.0.37"
26+
},
2427
"devDependencies": {
2528
"@types/node": "^22.19.3",
2629
"typescript": "^5.9.3",

0 commit comments

Comments
 (0)