Skip to content

Commit 1bb5877

Browse files
authored
fix: makefile check fires 3x per session, purge stale embed_model refs (#106)
Lower makefile.check.md threshold from 2.0 to 1.0 so the "use make instead" check fires ~3 times before decay silences it (was firing once then going silent). Remove stale embed_model references: - languages.md: rewrite model routing section (no longer a frontmatter field) - scoring.rs: doc comment said "frontmatter field", now "derived corpus field" - language.rs: module doc updated - way-embed test: recommendation text updated
1 parent e811d02 commit 1bb5877

5 files changed

Lines changed: 11 additions & 17 deletions

File tree

docs/hooks-and-ways/languages.md

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Multi-Language Support
22

3-
Ways supports multilingual matching and output across 52 languages. The system uses two embedding models: a precise English model and a broad multilingual model, routed per-way via frontmatter.
3+
Ways supports multilingual matching and output across 52 languages. The system uses two embedding models: a precise English model and a broad multilingual model, routed automatically by the corpus builder.
44

55
## Setting output language
66

@@ -36,18 +36,12 @@ Two embedding models handle different matching scenarios:
3636

3737
Both are downloaded by `make setup` and stored in `~/.cache/claude-ways/user/`.
3838

39-
Each way declares which model it uses via the `embed_model` frontmatter field:
39+
Model routing is automatic — no frontmatter field needed:
4040

41-
```yaml
42-
---
43-
description: security vulnerability scanning
44-
vocabulary: security vulnerability CVE audit
45-
embed_model: en # default — uses English model
46-
embed_threshold: 0.35
47-
---
48-
```
41+
- **`.md` ways** → English model (all-MiniLM-L6-v2)
42+
- **`.locales.jsonl` entries** → multilingual model (paraphrase-multilingual-MiniLM-L12-v2)
4943

50-
Ways with `embed_model: multilingual` are scored by the multilingual model against a separate corpus.
44+
The corpus builder splits entries into `ways-corpus-en.jsonl` and `ways-corpus-multi.jsonl`, each embedded with the appropriate model.
5145

5246
## Locale stubs — packed format
5347

@@ -75,7 +69,7 @@ When a Japanese user types a prompt, the scanner:
7569
### Format rules
7670

7771
- **`embed_threshold`** is optional — omit it and the corpus generator defaults to 0.25. Use `ways tune --apply` to compute optimal values automatically.
78-
- **`embed_model`** is implicit — always `multilingual` for locale stubs (not stored in the file).
72+
- **Model routing** is automaticlocale stubs always use the multilingual model (not stored in the file).
7973
- **No body content** — just the JSONL line. If someone writes a full native-language way, they create `security.ja.md` as a regular file, which overrides the packed entry.
8074

8175
### Override mechanism

hooks/ways/softwaredev/environment/makefile/makefile.check.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
description: intercept raw build, test, lint, publish commands when a Makefile exists
33
vocabulary: npm run npm test npx pytest cargo build cargo test go build go test pip install docker build docker compose eslint prettier ruff tsc webpack vite jest mocha cargo publish npm publish twine
44
commands: ^(npm|npx|pytest|cargo|go |pip |docker |eslint|prettier|ruff |tsc|webpack|vite|jest|mocha|twine)
5-
threshold: 2.0
5+
threshold: 1.0
66
scope: agent, subagent
77
when:
88
file_exists: Makefile

tools/way-embed/test-multilingual.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ if $MARKDOWN; then
195195
echo "2. **English ways + multilingual model (cross-language)** — user types in any language, matches against English descriptions. Works but scores 30-50% lower."
196196
echo "3. **Native-language stubs + multilingual model (same-language)** — locale entries in \`.locales.jsonl\` with native descriptions. Consistently scores 0.80+ across tested languages."
197197
echo ""
198-
echo "**Recommendation:** Ship both models. English ways use the English model (precise, 21MB). Multilingual stubs use the multilingual model (broad, 127MB). Per-way \`embed_model\` frontmatter field controls routing. This gives per-language threshold tuning without compromising English accuracy."
198+
echo "**Recommendation:** Ship both models. English ways use the English model (precise, 21MB). Multilingual stubs use the multilingual model (broad, 127MB). Routing is automatic — the corpus builder derives the model from file type (.md → EN, .locales.jsonl → multilingual)."
199199
else
200200
echo ""
201201
echo "Results: ${pass}/${total} passed (threshold: ${THRESHOLD})"

tools/ways-cli/src/cmd/language.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Language coverage report — shows multilingual state of ways.
22
//!
3-
//! Reports: resolved output language, per-way embed_model,
3+
//! Reports: resolved output language, derived embedding model per way,
44
//! locale stubs (.locales.jsonl + override .lang.md files), and model availability.
55
66
use anyhow::Result;

tools/ways-cli/src/cmd/scan/scoring.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ pub(crate) fn batch_bm25_score(query: &str) -> Vec<(String, f64)> {
4242
/// down" — BM25 fallback is appropriate.
4343
///
4444
/// Queries both EN and multilingual corpora (when available) and merges
45-
/// results. Each way is scored by the model specified in its `embed_model`
46-
/// frontmatter field.
45+
/// results. Each way is scored by its derived model (EN for .md ways,
46+
/// multilingual for .locales.jsonl entries).
4747
pub(crate) fn batch_embed_score(query: &str) -> Option<Vec<(String, f64)>> {
4848
let embed_bin = find_way_embed()?;
4949
let xdg = xdg_cache_dir().join("claude-ways/user");

0 commit comments

Comments
 (0)