Replace sqlite3 subprocess with bun:sqlite native driver, add AGENTS.md and tests

Rewrites history/queries.ts to use bun:sqlite with readonly mode and
parameterized queries instead of spawning sqlite3. Consolidates threshold
constants into a single source of truth. Adds AGENTS.md as the canonical
operational doc, moves architecture to docs/, and adds initial test suite.
This commit is contained in:
2026-04-20 16:14:35 +00:00
parent 9a42dcfb94
commit f7bb7f94cf
19 changed files with 515 additions and 125 deletions

26
tests/compaction.test.ts Normal file
View File

@@ -0,0 +1,26 @@
import { describe, expect, test } from "bun:test";
import { getCompactionPrompt } from "../src/compaction/prompt";
describe("compaction prompt", () => {
test("returns non-empty string", () => {
const prompt = getCompactionPrompt();
expect(typeof prompt).toBe("string");
expect(prompt.length).toBeGreaterThan(0);
});
test("emphasizes self-continuity, not another agent", () => {
const prompt = getCompactionPrompt();
expect(prompt).toContain("yourself");
expect(prompt).toContain("not another agent");
});
test("includes key sections", () => {
const prompt = getCompactionPrompt();
expect(prompt).toContain("## Goal");
expect(prompt).toContain("## Instructions");
expect(prompt).toContain("## Discoveries");
expect(prompt).toContain("## Accomplished");
expect(prompt).toContain("## Relevant files");
expect(prompt).toContain("## Notes");
});
});