Commit Graph

305 Commits

Author SHA1 Message Date
Tobias Lütke
e3bc5ccdc3
Merge pull request #286 from joelev/fix/multi-session-http
fix: support multiple concurrent HTTP clients
2026-03-07 14:28:50 -04:00
Tobias Lütke
8bd93366ad
Merge pull request #228 from amsminn/fix-empty-results-format
fix(cli): prevent parser breakage on empty results across output formats
2026-03-07 14:25:16 -04:00
Tobias Lütke
0b3fb07a8f
Merge pull request #230 from Balneario-de-Cofrentes/fix/tty-progress-guard
fix(cli): suppress progress bars when not TTY
2026-03-07 14:25:13 -04:00
Tobias Lütke
271feb7791
Merge pull request #253 from jimmynail/fix/skip-unreadable-files
fix: skip unreadable files during indexing instead of crashing
2026-03-07 14:25:11 -04:00
Tobias Lütke
ee08997f23
Merge pull request #313 from 0xble/fix/expand-context-size-config
fix(llm): make query expansion context size configurable
2026-03-07 14:25:04 -04:00
Tobias Lütke
a28163fb2c
Merge pull request #304 from sebkouba/feature/collection-ignore
feat: add ignore patterns for collections
2026-03-07 14:25:02 -04:00
Tobias Lütke
e6b50cfca9
Merge pull request #308 from debugerman/fix/handelize-emoji-crash
fix(store): handle emoji-only filenames in handelize (#302)
2026-03-07 14:24:59 -04:00
Tobias Lütke
72e96d16c0
Merge pull request #312 from 0xble/fix/empty-collection-deactivate
fix(index): deactivate stale docs on empty collection updates
2026-03-07 14:24:57 -04:00
Tobias Lütke
f75c668e46
Merge pull request #310 from giladgd/nodeLlamaCppUseBuildAutoAttempt
feat: use `build: "autoAttempt"` on `getLlama`
2026-03-07 14:24:52 -04:00
Tobias Lütke
6934c464db
Merge pull request #311 from gi11es/patch-1
Fix claude plugin setup syntax
2026-03-07 14:24:49 -04:00
Gilad S.
607ab7a402
fix: remove unused config 2026-03-07 07:48:13 +02:00
Brian Le
0dec1df047
fix(llm): make expansion context size configurable 2026-03-06 16:35:33 -05:00
Brian Le
49d5b4f450
fix(index): deactivate stale docs on empty collection updates 2026-03-06 16:29:52 -05:00
Tobi Lutke
2ae1baba2f
release: v1.1.1 2026-03-06 14:48:47 -04:00
Tobi Lutke
60721658c0
docs: write changelog for 1.1.1 2026-03-06 14:48:35 -04:00
Gilles Dubuc
7f8e33e0a9
Fix plugin install syntax 2026-03-06 12:14:16 +01:00
Gilles Dubuc
75589d77f3
Fix claude marketplace syntax 2026-03-06 12:12:14 +01:00
Gilad S.
3095041e0f feat: use build: "autoAttempt" on getLlama 2026-03-06 07:02:50 +00:00
Ning
dc777e3be0
fix(store): handle emoji-only filenames in handelize (#302)
Convert emoji codepoints to hex representation (e.g. 🐘 → 1f418) instead
of crashing, so files like 🐘.md can be indexed without halting the
entire update process.

Fixes #302
2026-03-06 14:24:24 +08:00
Sebastian Kouba
fde542cd0d feat: add ignore patterns for collections
Add an optional 'ignore' field to collection config that accepts an array
of glob patterns to exclude from indexing. This allows collections to skip
specific subdirectories without needing separate collections.

Example YAML config:
  personal:
    path: ~/personal_synced
    pattern: '**/*.md'
    ignore:
      - 'Sessions/**'
      - 'archive/**'

The ignore patterns are passed to fast-glob's ignore option alongside the
existing hardcoded excludes (node_modules, .git, etc). Already-indexed
files matching new ignore patterns are deactivated on the next update.

Changes:
- Add ignore?: string[] to Collection interface
- Pass ignore patterns through to fast-glob in indexFiles()
- Show ignore patterns in collection list/status output
- 5 new CLI integration tests covering the feature
2026-03-05 19:17:44 +01:00
Joel Johnson
383a2e5cf1 fix: support multiple concurrent HTTP clients
The HTTP MCP server creates a single Transport + McpServer pair at
startup. Once the first client initializes, all subsequent clients
are rejected with "Server already initialized" — making the HTTP
mode unusable for reconnect, crash recovery, or multi-client scenarios.

Replace the singleton with a per-session architecture: each initialize
request creates its own McpServer + Transport pair, stored in a
sessions Map keyed by session ID. The shared Store (SQLite) is
stateless and safe for concurrent access.

Key changes:
- createSession() factory creates fresh McpServer + Transport per client
- POST /mcp routes by mcp-session-id header to existing sessions
- New initialize requests (no session header) create new sessions
- Unknown session IDs return 404 per MCP spec
- Missing session IDs return 400
- onsessioninitialized callback stores sessions at the right time
- transport.onclose cleans up the sessions Map
- Shutdown iterates all active sessions

Tested with 3+ concurrent clients, session cleanup via DELETE,
cross-session isolation, and rapid session creation.

Fixes #195
Closes #163

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-03 22:22:49 -05:00
Tobias Lütke
40610c3aa6
Merge pull request #256 from rkbadhan/reward-design
fix(reward): tighten entity detection, filler penalty, stricter diversity
2026-02-26 06:15:49 -05:00
rkbadhan
4511b9bd4d fix(reward): tighten entity detection, add filler penalty, stricter diversity
- Compound entity chaining now stops one level deep. Previously "TDS
  motorsports team history" would inflate the expected entity set with
  "team" and "history", causing false-positive entity-preservation
  penalties during GRPO. Now only {tds, motorsports} are detected.

- Add INTERIOR_FILLER_WORDS penalty (-3/line): lex lines containing
  "overview" or "basics" absent from the original query are penalised.
  Targets template-generator noise, e.g. "ancient overview rome timeline".

- Raise is_diverse threshold 2→3: requires 3 unique words between lex
  lines before they count as diverse. Reduces reward for near-duplicate
  pairs like "auth setup" / "auth configuration".

- Broaden quoted-phrase bonus: was gated on named entities existing;
  now any multi-word query earns +3 for using quotes in lex lines.
  Better incentivises BM25-aware syntax like "memory leak" python.

Fixes scoring noise identified while working on issue #247.
2026-02-24 19:46:23 +05:30
CHAEWAN KIM
b024693f5d
Merge branch 'main' into fix-empty-results-format 2026-02-23 22:36:21 -08:00
Kit
32cd83b470 fix: skip unreadable files during indexing instead of crashing
On macOS with iCloud Drive (especially shared folders), some files may
appear in the filesystem but return EAGAIN (error -11) when read via
Node's readFileSync. This happens when iCloud has evicted the file
content but the file metadata remains visible.

Previously this crashed the entire update process. Now we catch the
error and skip the file, allowing the remaining files to index
successfully.

Affects: iCloud Drive shared folders on macOS
Error: 'Unknown system error -11: Unknown system error -11, read'
Reproduces with: Node.js v25.x, readFileSync on evicted iCloud files
2026-02-23 14:40:09 -08:00
Tobi Lütke
d6f3688d91
Remove grpo command from default train entrypoint 2026-02-22 15:29:09 -05:00
Tobi Lütke
189916d6fb
Move GRPO training out of default finetune pipeline 2026-02-22 15:26:23 -05:00
Tobi Lütke
cbeeb1f89b
Add wall-clock checkpoints and full eval defaults 2026-02-22 15:02:02 -05:00
Tobi Lütke
5233e676d9
fix(rerank): truncate documents exceeding 2048-token context size
node-llama-cpp throws a hard error when any document + query + template
overhead exceeds the ranking context size. Truncate oversized documents
using the rerank model's tokenizer before passing them to rankAll().

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 12:41:59 -05:00
Tobi Lutke
1d7d167b29
finetune: strict Pydantic schema, one canonical data format
Replace ad-hoc JSON parsing with a strict Pydantic model
(TrainingExample with typed OutputPair). All data loading goes
through load_examples() which fails loudly on invalid data.

- Convert v3_structured.jsonl from "searches" to "output" format
- Rewrite all consumer scripts (prepare, validate, score, analyze)
  to load through the Pydantic schema
- Prepared train/val files are ephemeral build artifacts
- Restore LFM2 and GEPA experiments under experiments/
- Add pydantic>=2.0 to dependencies
2026-02-22 13:39:00 -04:00
Tobi Lutke
3950055708
finetune: quoted phrases, negation, and entity preservation (#247)
Training data:
- Expand lex phrases/negation examples from 12 to 74 with intent field
- Add 50 personal entity examples (meetings, emails, projects with names)

Reward function:
- Detect entities at position 0 (fixes "Bob asked about deploy")
- Per-entity coverage penalty: -20 per entity absent from all lex+vec
- Phrase quoting bonus: +3 when lex uses quotes for multi-word terms
- Expanded stopwords to reduce false positive entity detection

Eval queries: add 21 test queries for personal entities, quoted phrases,
and negation/disambiguation scenarios.
2026-02-22 13:38:59 -04:00
Tobi Lutke
599935754b
finetune: remove orphaned files and abandoned experiments
Remove one-off data generator/fix scripts, superseded data files (v2, v3
replaced by v3_structured), LFM2 experiment, GEPA directory, duplicate
job scripts, and historical docs. Clean up Justfile.

These are restored under experiments/ in a later commit.
2026-02-22 13:38:59 -04:00
Tobi Lutke
64ef25e1f6
Document query grammar and add skill helpers 2026-02-22 13:36:08 -04:00
Tobi Lutke
0e0feb6f2b
release: v1.1.0 2026-02-22 11:09:36 -04:00
Tobi Lutke
60564b34f8
chore: gitignore package-lock.json 2026-02-22 11:09:36 -04:00
Tobi Lutke
1765b6870d
docs: write changelog for 1.1.0
Query document format, lex phrase/negation syntax, standard node
shebang, collection management commands, and formal SYNTAX.md spec.
2026-02-22 11:09:36 -04:00
Tobi Lutke
c7e8ea02a5
test: restructure container smoke tests for interactive use
Replaces the inner test script with an outer driver that runs individual
podman/docker commands against a pre-built image. Tests sqlite-vec
loading and store unit tests under both node and bun runtimes.

Supports --build (image only), --shell (interactive), and -- CMD
(arbitrary command) for debugging install issues in isolation.
2026-02-22 11:09:36 -04:00
Tobi Lutke
0b57711d32
refactor: replace bash wrapper with standard #!/usr/bin/env node shebang
The qmd bin was a custom bash script that discovered node via hardcoded
fallback paths (mise, asdf, nvm, homebrew). This was nonstandard and
caused ABI mismatches when installed via bun (native modules compiled
for bun but executed with node).

Now uses the standard npm bin convention: dist/qmd.js with a node
shebang, added by the build script. The isMain guard resolves symlinks
so it works when npm/bun create symlinked bin entries.

Also converts all dynamic require() calls in tests to ESM imports, and
adds container-based smoke tests (test/smoke-install.sh) that verify
install + run under both node and bun via mise in a Debian container.
2026-02-22 11:09:36 -04:00
Tobias Lütke
a815b52ede
Merge pull request #214 from pcasaretto/fix/nix-build-deps 2026-02-22 10:42:57 -04:00
Tobi Lütke
8d73eda4de
data: add 48 sports acronym training examples
Covers UFC, NFL, NBA, NHL, MLB, F1, MLS, IMSA, WEC, NASCAR, PGA, ATP, WTA, FIFA.
Fixes query expansion failures like UFC → 'united fighting club'.
2026-02-22 09:37:25 -05:00
David Gil - Klaus
b0f6da8001 fix(cli): suppress progress bars and indexing output when not TTY
When stdout/stderr is not a terminal (e.g., captured by a parent process),
OSC 9;4 progress sequences and carriage-return-based status lines produce
massive output (247K chars for a typical update). This caused OpenClaw's
qmd update to fail with 'too much output' errors, retrying ~24 times
per 10 minutes.

Gate all progress output on process.stderr.isTTY. Summary lines still
print normally.
2026-02-20 01:54:23 +01:00
CHAEWAN KIM
7579a2c017 fix(cli): prevent parser breakage on empty results across output formats
- --json: []
- --csv: header only
- --xml: <results></results>
- --md/--files: empty output
- default CLI keeps human-readable message
2026-02-19 15:38:42 -08:00
Tobi Lütke
6ac7c6837e
chore: release 1.0.8 2026-02-19 06:56:17 -05:00
Tobi Lütke
3b87e3e224
feat: query document format, lex phrase/negation syntax, training data
The 'query document' is now a first-class concept in QMD: a structured
document with typed sub-queries that combine for best recall.

## Query types
- lex:    BM25 keyword search with phrase and negation syntax
- vec:    Semantic vector search (natural language questions)
- hyde:   Hypothetical document (write the expected answer)
- expand: Auto-expand via local LLM (max 1, default for plain queries)

## Lex syntax
Full BM25 operator support:
  "exact phrase"     verbatim match, no prefix
  -term              exclude documents containing term
  -"exact phrase"   exclude documents containing phrase

Examples:
  "C++ performance" optimization -sports -athlete
  "connection pool" timeout -redis
  "machine learning" -sports -athlete

## MCP tool description rewritten
The 'query' tool description now fully teaches AI agents the query
document format, lex syntax, and strategy for combining types.
Includes worked examples including intent-aware lex (C++ performance,
not sports) which is critical for disambiguation in dense corpora.

## Unit tests
11 new lex parser tests covering:
- plain terms, quoted phrases, negation, combined
- intent-aware disambiguation (performance -sports -athlete)
- only-negation returns null (FTS5 constraint)
- empty/whitespace handling

## Training data
12 new intent-aware examples for next model training round:
- Real technical topics with lex phrase+negation combinations
- Covers: C++ perf, Python memory, DB connections, rate limiting,
  SQL optimization, ML overfitting, Docker, JWT, async/await,
  git conflicts, Kubernetes, React state
- Each shows how context/intent shapes lex query construction
  (e.g. performance with C++ context → -sports -athlete exclusions)
2026-02-19 06:52:58 -05:00
Tobi Lütke
2cb7b59152
fix(cli): print timing inline after each step, not on separate line 2026-02-19 06:11:21 -05:00
Tobi Lütke
24ffa4876b
feat(cli): show timing for expand, embed, and rerank steps
Each LLM invocation now prints elapsed time:
  Expanding query...
    (4.2s) → searching 6 queries
  Embedding 4 queries...
    (605ms)
  Reranking 40 chunks...
    (3.2s)
2026-02-19 06:08:02 -05:00
Tobi Lütke
a81f013126
fix(status): improve tips with subfolder context example and better update cmd 2026-02-19 06:01:53 -05:00
Tobi Lütke
bdf0c205a9
feat(status): add tips for missing context and update commands 2026-02-19 05:54:18 -05:00
Tobi Lütke
262c7d351c
refactor: remove context check command 2026-02-19 05:53:13 -05:00
Tobi Lütke
2b94e097d2
feat(cli): add collection management commands
New collection subcommands:
- show <name>           Show collection details
- update-cmd <name> [cmd]  Set pre-update command (runs before indexing)
- include <name>        Include in default queries (default)
- exclude <name>        Exclude from default queries

Collections with includeByDefault=false are skipped unless
explicitly named with -c flag.

CLI improvements:
- 'qmd collection' shows help instead of error
- 'qmd collection list' shows [excluded] tag
- Better command descriptions and examples
2026-02-19 05:46:07 -05:00