Commit Graph

4 Commits

Author SHA1 Message Date
david 3b24e3b8be fix: make the snippet queue reviewable (#35)
build / image (push) Successful in 51s
build / test (push) Successful in 4m48s
Two causes, both fixed here.

Classification: trivialProbe bailed out on any newline, so multi-line
chores were never judged — 'cd X && sed -n 60,200p f' and 'git status &&
git log --oneline -3' all became technique candidates. Newlines are now
segment separators like ';', sed (without -i) and read-only git
subcommands count as inspections, and context flags (-A/-B/-C, git log -p,
--since, --graph, --all) keep a command because selecting history is
method, not a chore.

Over the live corpus the trivial verdicts go from 307 to 1,081 of 11,552
techniques, and the archaeology that matters (git log -p | grep -B 50)
still survives.

Retention: nothing ever aged a candidate out, so 16,149 of them sat in the
queue. knox snippets expire --days N rejects uncurated candidates older
than the window. It is reversible and never touches encoded rows: the code
did not change, the review window moved past it.
2026-11-04 21:20:24 -08:00
david 45f966d44f fix: read tool calls and prose from the v2 session store (#30) (#32)
build / test (push) Successful in 3m34s
build / image (push) Successful in 29s
Co-authored-by: David Gwilliam <dhgwilliam@gmail.com>
Co-committed-by: David Gwilliam <dhgwilliam@gmail.com>
2026-11-05 04:31:48 +00:00
david 84f30f293b feat: index reasoning, and close the two-minute freshness gap (#19)
build / test (push) Has been cancelled
build / image (push) Has been cancelled
feat: index reasoning, and close the session freshness gap (#19)

Co-authored-by: David Gwilliam <dhgwilliam@gmail.com>
Co-committed-by: David Gwilliam <dhgwilliam@gmail.com>
2026-11-05 03:39:16 +00:00
david 8d6d73b747 fix: read opencode sessions from session_v2/session_message (#7)
Fixes #6.

opencode 2.0.24 migrated its session store on 2026-11-01 21:01:20 UTC. `session`, `message` and `part` stopped being written; sessions now live in `session_v2` and messages in `session_message`. The ingest kept querying the abandoned tables, so every sweep after the migration logged `0 new` — no error, no new sessions indexed.

## Changes

- **`internal/ingest/opencode_db.go`**
  - Read sessions from `session_v2` (title is nullable there, the existing COALESCE + fallback still apply).
  - Rebuild transcripts from both message shapes: user turns at `$.text`, assistant turns from `$.content[]` filtered to `type='text'` (reasoning and tool parts are not indexed). Ordered by `seq`, then part index.
  - Count messages from `session_message` instead of parts.
  - Drop `<system-reminder>` text — reminders now arrive as `synthetic` messages and would eat the 4000-byte summary budget.
  - Ingester version is now `opencode-db/v2`.
- **`internal/watch/watch.go`** — an entry is no longer skipped on `created_at` alone. Resuming a session appends messages without touching the creation time, so the summary is compared too.
- **`internal/ingest/opencode_db_test.go`** — new test builds the v2 schema in a temp SQLite database and asserts user text and assistant text parts are indexed while reasoning, tool and reminder content is not.

## Validation

- `go build ./...`, `go test ./internal/ingest/ ./internal/db/ ./internal/watch/` pass.
- Rebuilt the binary and restarted `knox.service` against the live store:
  ```
  [knox] opencode.db: 1 new, 387 unchanged
  ```
  The new entry is the session that had been invisible since the migration (`Knox OpenCode session adapter compatibility check`, observation version `opencode-db/v2`), and `knox query "knox opencode session adapter compatibility"` finds it.
- 59 pre-migration sessions re-recorded because their stored transcripts contained reminder text that the new filter drops; summaries still carry the conversation.

## Notes

The first commit on this branch is a checkpoint of pre-existing uncommitted work that the adapter fix sits on top of; the fix itself is the second commit (`e07ae8a`).

Reviewed-on: #7
Co-authored-by: David Gwilliam <dhgwilliam@gmail.com>
Co-committed-by: David Gwilliam <dhgwilliam@gmail.com>
2026-11-02 01:16:50 +00:00