Commit graph

71 commits

Author SHA1 Message Date
Snider
10c2cb9218 chore: add .core/ build and release configs
All checks were successful
Security Scan / security (push) Successful in 8s
Test / test (push) Successful in 37s
Add go-devops build system configuration for standardised
build, test, and release workflows across the Go ecosystem.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-06 18:52:36 +00:00
Snider
9bb0e57b14 chore: remove boilerplate Taskfile
All checks were successful
Security Scan / security (push) Successful in 8s
Test / test (push) Successful in 36s
All tasks (test, build, lint, fmt, vet, cov) are handled natively
by `core go` commands. Taskfile was redundant wrapper.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-06 14:45:49 +00:00
Snider
85183e8046 docs: add grammar engine documentation from core/go
All checks were successful
Security Scan / security (push) Successful in 8s
Test / test (push) Successful in 1m31s
Moved GRAMMAR.md, EXTENDING.md, README.md — these document go-i18n
internals, not the core DI framework.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-06 14:24:40 +00:00
Snider
518654b424 chore: bump forge.lthn.ai dep versions to latest tags
All checks were successful
Security Scan / security (push) Successful in 13s
Test / test (push) Successful in 2m54s
Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-26 05:34:22 +00:00
d1166fc456 Merge pull request 'chore: Go 1.26 modernization' (#1) from chore/go-1.26-modernization into main
All checks were successful
Security Scan / security (push) Successful in 14s
Test / test (push) Successful in 54s
2026-02-24 18:01:47 +00:00
Claude
f4885d3e5e
chore: use slices.Sorted(maps.Keys()) for ordered iteration
All checks were successful
Security Scan / security (pull_request) Successful in 11s
Test / test (pull_request) Successful in 1m0s
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 16:24:04 +00:00
Claude
c8a23f32b9
chore: sort.Slice → slices.SortFunc
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 16:23:47 +00:00
Claude
c46516884a
chore: fmt.Errorf(static) → errors.New
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 16:23:04 +00:00
Claude
12c8456251
docs: archive completed 1b-presort-pipeline plan
All checks were successful
Security Scan / security (push) Successful in 10s
Test / test (push) Successful in 53s
Move 1b-presort-pipeline design and plan to docs/plans/completed/ with
completion summary. Batch classification at 80 prompts/sec shipped.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 13:51:21 +00:00
Snider
90a88ff2b2 chore: add Go repo norms (badges, contributing, lint, taskfile, editorconfig)
All checks were successful
Security Scan / security (push) Successful in 10s
Test / test (push) Successful in 2m3s
Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-23 06:45:39 +00:00
Snider
dbe14d339c chore: refresh go.sum after upstream tag updates
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-23 06:35:19 +00:00
Claude
cd6f9e076e
ci: add Forgejo Actions test and security scan workflows
Some checks failed
Security Scan / security (push) Successful in 11s
Test / test (push) Failing after 26s
Uses reusable workflows from core/go-devops for Go testing
(with race detector and coverage) and security scanning
(govulncheck, gitleaks, trivy).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 03:28:02 +00:00
Claude
531685419d
chore: sync workspace dependency versions
Run go work sync to align dependency versions across workspace.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 21:41:55 +00:00
Snider
9ea76af2b1 refactor: apply go fix modernizers for Go 1.26
Automated fixes: interface{} → any, range-over-int, t.Context(),
wg.Go(), strings.SplitSeq, strings.Builder, slices.Contains,
maps helpers, min/max builtins.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-22 21:00:16 +00:00
Snider
e6135cddb9 chore: go mod tidy for 1.26.0
Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-22 20:35:59 +00:00
Snider
4f34935916 chore: bump go directive to 1.26.0
Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-22 20:33:48 +00:00
Snider
a41b4dc6af chore: pin forge deps to v0.0.1 tags for Go 1.26 compat
Go 1.26 rejects non-semver version strings (like 'main') in go.mod.
Tags v0.0.1 now exist on all forge repos — workspace still overrides
for local development.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-22 20:15:06 +00:00
Snider
4446d1e835 chore: use workspace-resolved versions, drop replace directives
Forge module versions now use main branch resolution via ~/Code/go.work
workspace. Removes local replace directives — the central go.work handles
all cross-repo resolution during development.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-22 19:49:36 +00:00
Snider
0d8463c884 docs: add README with quick start and docs links
Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-20 15:11:20 +00:00
Snider
5fb98dcedd docs: graduate TODO/FINDINGS into production documentation
Replace internal task tracking (TODO.md, FINDINGS.md) with structured
documentation in docs/. Trim CLAUDE.md to agent instructions only.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-20 15:01:55 +00:00
Snider
9aa7fa27a7 docs: clean up TODO.md and add Phase 2b findings
- TODO.md: condense completed tasks, add integration test commands
  and future work section
- FINDINGS.md: add calibration tool, reference distributions, and
  anomaly detection findings with test results

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-20 14:00:23 +00:00
Snider
c3e9153cf3 feat(reversal): Phase 2b — reference distributions, comparator, anomaly detection
Reference distribution builder:
- BuildReferences() tokenises samples, computes per-domain centroid imprints
- Per-key variance for Mahalanobis distance normalisation

Imprint comparator:
- Compare() returns cosine, KL divergence, Mahalanobis per domain
- Classify() picks best domain with confidence margin
- Symmetric KL with epsilon smoothing, component-weighted

Cross-domain anomaly detection:
- DetectAnomalies() flags model vs imprint domain disagreements
- AnomalyStats tracks rate and confusion pair counts

17 new tests, all race-clean. Phase 2b complete.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-20 13:57:51 +00:00
Snider
3b7ef9d26a feat(calibrate): 1B vs 27B domain calibration tool
CalibrateDomains() accepts two inference.TextModel instances and a corpus
of CalibrationSamples, classifies all with both models, and computes
agreement rate, per-domain distribution, confusion pairs, and accuracy
vs ground truth.

- calibrate.go: CalibrateDomains + classifyAll batch helper
- calibrate_test.go: 7 mock tests (agreement, disagreement, mixed,
  no ground truth, empty, batch boundary, results slice)
- integration/calibrate_test.go: 500-sample corpus (220 ground-truth
  + 280 unlabelled) for real 1B vs 27B model comparison
- TODO.md: Phase 2a calibration task marked complete

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-20 13:51:11 +00:00
Snider
2e586aedc5 chore: add gitignore entries for IDE/build artifacts
Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-20 09:15:26 +00:00
Snider
3c55d91cb8 feat(validate): article and irregular verb validators using 1B model
Single-token generation validators for article correctness and irregular
verb form accuracy, leveraging the 1B model's 100% accuracy on both tasks.
Includes batch variants and 14 mock tests covering correct/wrong/empty/
context-cancellation/whitespace cases.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-20 09:09:23 +00:00
Claude
32a55f5d35
test(i18n): add tests for 8 uncovered files, coverage 69.9% -> 86.6%
Add dedicated test files for compose.go, context.go, debug.go, hooks.go,
i18n.go, localise.go, time.go, and transform.go. Uses testify
assert/require with table-driven tests and Good/Bad/Ugly naming.

Key coverage improvements:
- transform.go: toInt/toInt64/toFloat64 18.8% -> 100%
- time.go: TimeAgo/FormatAgo 0% -> 100%/87.5%
- compose.go: newTemplateData/SetFormality/IsInformal 0% -> 100%
- context.go: all functions now 100%
- debug.go: package-level SetDebug 0% -> 100%
- hooks.go: RegisterLocales 0% -> 100%
- i18n.go: T/Raw/N/SetMode/AddHandler/PrependHandler all covered

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 02:09:08 +00:00
Snider
ff376830c0 fix: address Virgil review — 5 fixes for classify pipeline
- Remove go-mlx from go.mod (breaks non-darwin builds)
- Fix go-inference pseudo-version for CI compatibility
- Fix mapTokenToDomain prefix collision (castle, credential)
- Add testing.Short() skip to slow classification benchmarks
- Add 80% accuracy threshold to integration test

Integration test moved to integration/ sub-module with its own go.mod
to cleanly isolate go-mlx dependency from the main module.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-20 00:44:35 +00:00
Snider
c23a271716 docs: Virgil review — 5 fixes before continuing Phase 2a
Review of ClassifyCorpus implementation found:
- go-mlx in go.mod breaks non-Mac builds (should be go.work only)
- go-inference v0.0.0 invalid pseudo-version
- mapTokenToDomain prefix collision (cas → castle/cascade)
- classify_bench_test.go runs slow tests on every go test
- integration test has no domain accuracy assertion

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-20 00:15:45 +00:00
Snider
a8628dfeb9 docs: mark 1B pre-sort pipeline complete
Integration tested at 80 prompts/sec with Gemma3-1B on M3 Ultra.
100% domain accuracy on technical prompts. go-ai dependency resolved
via direct go-inference + go-mlx imports.

Co-Authored-By: Virgil <virgil@lethean.io>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 00:09:49 +00:00
Snider
8f6130f6d7 test: add integration test for ClassifyCorpus with real model
50-prompt throughput test behind //go:build integration tag.
Validates end-to-end pipeline with Gemma3-1B via go-mlx Metal backend.
Result: 80 prompts/sec, 100% correct domain classification.

Co-Authored-By: Virgil <virgil@lethean.io>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 00:08:53 +00:00
Snider
94fd2f463f feat: implement ClassifyCorpus with streaming batch classification
Co-Authored-By: Virgil <virgil@lethean.io>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 00:06:44 +00:00
Snider
a5f3eb4777 feat: add classify types and token-to-domain mapper
Co-Authored-By: Virgil <virgil@lethean.io>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 00:03:25 +00:00
Snider
c05e3fc283 build: add go-inference dependency
Co-Authored-By: Virgil <virgil@lethean.io>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 00:01:36 +00:00
Snider
0c496a0a17 docs: add 1B pre-sort pipeline implementation plan
5-task TDD plan: dependency setup, types+mapper, ClassifyCorpus with
mock tests, integration test with real model, docs update.

Co-Authored-By: Virgil <virgil@lethean.io>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 23:59:41 +00:00
Snider
c028c81c13 docs: add 1B pre-sort pipeline design
Streaming batch classification via go-inference Classify() API.
Package-level ClassifyCorpus() function with configurable batch size,
prompt template, and mock-friendly TextModel interface.

Co-Authored-By: Virgil <virgil@lethean.io>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 23:57:01 +00:00
Snider
97f4983c90 docs: unblock Phase 2a — go-mlx inference now available
go-mlx completed Phases 2-5: Gemma3-1B at 46 tok/s, batch Classify
at 152 prompts/sec. Updated TODO.md with direct go-inference import
path (skip go-ai), usage examples, model path, and key types.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-19 23:51:09 +00:00
Snider
24e60104d1 feat: add grammar table spec and French locale
Document full JSON schema for gram.* keys in docs/grammar-table-spec.md.
Add French grammar tables (50 verbs, 24 gendered nouns, signals).
Extend loader to parse article by_gender map. Completes Phase 3.

Co-Authored-By: Virgil <virgil@lethean.io>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 17:57:22 +00:00
Snider
21a60c23a4 docs: flag Phase 2a go-ai dependency, add classification findings
Phase 2a tasks (1B pre-sort, calibration, validator) blocked on go-ai
MLX bindings. Classification benchmark shows grammar engine handles
technical/creative well but needs 1B for ethical/casual disambiguation.

Co-Authored-By: Virgil <virgil@lethean.io>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 17:51:07 +00:00
Snider
7d5ab809f0 feat(reversal): add classification benchmark suite
220 domain-tagged sentences across {technical, creative, ethical, casual}
with leave-one-out classification, domain separation, token coverage,
tense profile, and top-verb diagnostics. Grammar-based accuracy: 54%
overall (technical 78%, creative 82%, ethical 46%, casual 11%).

Co-Authored-By: Virgil <virgil@lethean.io>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 17:48:48 +00:00
Snider
65cf099517 feat: extend irregular verb coverage and add benchmarks
Add 44 irregular verbs (compound, simple, CVC doubling overrides) and
15 benchmark functions across forward composition and reversal engine.
Completes Phase 1 hardening tasks.

Co-Authored-By: Virgil <virgil@lethean.io>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 17:41:29 +00:00
Snider
26b7dd4224 fix(reversal): post-implementation review fixes R1-R3
R1: Remove "passed", "failed", "skipped" from gram.noun and
gram.word — these are past participles, not nouns.

R2: Add DisambiguationStats and WithWeights tests to
tokeniser_test.go using setup(t) pattern. Remove duplicates
from roundtrip_test.go.

R3: Guard buildSignalIndex per-field so partial locale data
falls back independently rather than silently disabling signals.

Co-Authored-By: Virgil <virgil@lethean.io>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 16:54:29 +00:00
Snider
0aadc92497 review: post-implementation findings for dual-class disambiguation
3 minor fixes required before PR:
- R1: Remove passed/failed/skipped from gram.noun (dead data)
- R2: Add tests for DisambiguationStats and WithWeights
- R3: Guard buildSignalIndex per-field for locale robustness

Core implementation approved — B1-B3, D1-D2, F1, F3 all correct.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-19 16:50:18 +00:00
Snider
f11c1272dc docs: mark dual-class disambiguation complete
Update TODO.md and FINDINGS.md with implementation details,
signal weight table, and test coverage summary. Note expanded
dual-class candidates for Phase 2.

Co-Authored-By: Virgil <virgil@lethean.io>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 16:22:50 +00:00
Snider
3848297496 feat(reversal): add DisambiguationStats and dual-class round-trip tests
DisambiguationStatsFromTokens provides aggregate disambiguation
metrics for Phase 2 calibration. Round-trip tests verify all 6
dual-class words disambiguate correctly in both verb and noun
contexts, and that same-role imprints converge while different-role
imprints diverge.

Co-Authored-By: Virgil <virgil@lethean.io>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 16:21:34 +00:00
Snider
4ffe614840 fix(reversal): preserve Confidence on multiplier-transformed tokens
Transformed tokens get Confidence 1.0 since the transformation
is deterministic and unambiguous.

Co-Authored-By: Virgil <virgil@lethean.io>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 16:19:54 +00:00
Snider
c1d347f079 feat(reversal): confidence-weighted imprint contributions
Dual-class tokens contribute to both verb and noun distributions
weighted by Confidence and AltConf. Non-ambiguous tokens (Confidence
1.0, AltConf 0.0) behave identically to before.

Co-Authored-By: Virgil <virgil@lethean.io>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 16:18:44 +00:00
Snider
4cdd6e59d4 test(reversal): add WithSignals breakdown coverage
Verify SignalBreakdown is populated when WithSignals() is set and
nil when not. Check individual signal components fire correctly.

Co-Authored-By: Virgil <virgil@lethean.io>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 16:17:22 +00:00
Snider
d296fd22ca feat(reversal): implement two-pass disambiguation with 7 signals
Pass 1 classifies unambiguous tokens and marks dual-class base forms.
Pass 2 evaluates noun_determiner, verb_auxiliary, following_class,
sentence_position, verb_saturation (with clause boundaries),
inflection_echo, and default_prior signals. B3 confidence floor
for low-information classifications.

Co-Authored-By: Virgil <virgil@lethean.io>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 16:12:57 +00:00
Snider
03cd99e092 feat(reversal): add TokeniserOption, dual-class and signal indexes
NewTokeniser now accepts variadic options (backwards compatible).
Builds dual-class index from verb∩noun overlap and signal word
lookup sets from gram.signal data. Configurable weights via
WithWeights() for future calibration.

Co-Authored-By: Virgil <virgil@lethean.io>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 16:08:23 +00:00
Snider
a5489504cf feat(reversal): add Token confidence and SignalBreakdown types
Every classified token now carries a Confidence score (1.0 for
unambiguous tokens). SignalBreakdown and SignalComponent types
provide detailed scoring for dual-class disambiguation.

Co-Authored-By: Virgil <virgil@lethean.io>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 16:04:53 +00:00