Commit graph

56 commits

Author SHA1 Message Date
Claude
7ae5fee661
chore: fmt.Errorf(static) → errors.New 2026-02-24 15:58:11 +00:00
Claude
8ef36f98ca
chore: replace interface{} with any (Go 1.18+ alias) 2026-02-24 15:57:27 +00:00
Claude
f413111f08
docs: archive completed backend-result-type plan
All checks were successful
Security Scan / security (push) Successful in 10s
Test / test (push) Successful in 2m40s
Move backend-result-type plan to docs/plans/completed/ with summary.
Unified Result struct now used across all ML backends.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 13:51:21 +00:00
Snider
0cf35221e6 docs: document InspectAttention pass-through on InferenceAdapter
All checks were successful
Security Scan / security (push) Successful in 12s
Test / test (push) Successful in 2m31s
Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-23 12:34:32 +00:00
Snider
08c8cddbe4 chore: bump forge.lthn.ai dep versions to latest tags
All checks were successful
Security Scan / security (push) Successful in 12s
Test / test (push) Successful in 7m49s
Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-23 06:49:43 +00:00
Snider
e550d7e428 chore: add Go repo norms (badges, contributing, lint, taskfile, editorconfig)
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:45:41 +00:00
Snider
19807bf0be 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
Snider
5340a975a7 refactor: modernise to Go 1.26 — iterators, slices, maps
Some checks failed
Security Scan / security (push) Successful in 9s
Test / test (push) Failing after 41s
- Add DiscoverCheckpointsIter, FindUnscoredIter (iter.Seq2/iter.Seq)
- Add BackendsIter on Service
- Replace sort.Slice with slices.SortFunc, sort.Strings with slices.Sort
- Replace manual map-key-collect-sort with slices.Sorted(maps.Keys(...))
- Refactor ProbeCategories to use slices.Sorted with inline iterator
- Existing slice-returning methods preserved, backed by new iterators

Co-Authored-By: Gemini <noreply@google.com>
Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-23 06:11:55 +00:00
Claude
fc41c6f520
ci: add Forgejo Actions test and security scan workflows
Some checks failed
Security Scan / security (push) Successful in 10s
Test / test (push) Failing after 34s
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:29:04 +00:00
Snider
45e9fed280 feat: add InspectAttention pass-through on InferenceAdapter
Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-23 00:37:37 +00:00
Claude
1c5fd160f2
chore: refresh go.sum after upstream tag updates
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 23:36:25 +00:00
Snider
9d74275568 refactor: migrate CLI imports from core/go to core/cli
Update imports from forge.lthn.ai/core/go/pkg/cli to
forge.lthn.ai/core/cli/pkg/cli following CLI package split.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-22 23:29:51 +00:00
Claude
1110eac4a5
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:42:15 +00:00
Snider
a6fb45da67 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
ab14be25cc chore: bump go directive to 1.26.0
Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-22 20:33:48 +00:00
Snider
86fc6a0138 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
926fb268f6 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
950b67d25d chore: add missing go-i18n dependency via go mod tidy
Pre-existing issue: cmd/cmd_benchmark.go imports go-i18n/reversal
but the dependency was absent from go.mod.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-22 17:48:36 +00:00
Snider
7601614e07 test: update all test assertions for Result type
All Backend.Generate/Chat calls now return Result. Test assertions
updated to use .Text and check .Metrics where appropriate.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-22 17:45:32 +00:00
Snider
3b6dba5d85 refactor(cmd): unwrap Result.Text across all commands
Updates cmd_ab, cmd_sandwich, cmd_lesson, cmd_sequence,
cmd_benchmark, cmd_serve, and api/routes.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-22 17:41:16 +00:00
Snider
ef44f0ae25 refactor: unwrap Result.Text in expand, judge, agent_eval
Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-22 17:39:17 +00:00
Snider
22cc1a5afd refactor(service): Generate returns Result
Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-22 17:38:14 +00:00
Snider
44e063c1fa refactor(http-textmodel): unwrap Result.Text from Backend calls
Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-22 17:37:56 +00:00
Snider
52f27fc476 feat(llama): return Result from Generate/Chat
Delegates to HTTPBackend which already returns Result.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-22 17:37:34 +00:00
Snider
8a36bafa83 feat(http): return Result from Generate/Chat
HTTP backend returns Result{Text: text} with nil Metrics since
remote APIs don't provide Metal-level inference metrics.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-22 17:37:18 +00:00
Snider
d90bd7b779 feat(adapter): return Result with Metrics from TextModel
InferenceAdapter.Generate and Chat now return Result{Text, Metrics}
where Metrics is populated from the underlying TextModel.Metrics().

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-22 17:36:53 +00:00
Snider
5578671f90 feat: add Result type, break Backend interface to return Result
Backend.Generate and Backend.Chat now return (Result, error) instead of
(string, error). Result carries the response text and optional
inference.GenerateMetrics for backends that support them.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-22 17:36:16 +00:00
Snider
dcf58d041d feat: add Ubuntu workstation setup script from CLI
Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-21 21:20:13 +00:00
Snider
812c926dac feat: migrate cmd/ml from CLI repo, resolve forge deps
Move all 40 ML command files from core/cli/cmd/ml to go-ml/cmd/.
Commands self-register via init() + cli.RegisterCommands().

- Fixed stale go-ai/ml import in cmd_ab.go (now uses go-ml + go-mlx)
- Disabled cmd_train.go (needs go-mlx training API export)
- Removed all local replace directives, deps resolve from forge
- go build ./... passes cleanly

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-21 19:14:58 +00:00
Snider
0c238589af feat(api): add REST route group for ML endpoints via go-api
Implements RouteGroup and StreamGroup interfaces from go-api, exposing
ML inference service methods as REST endpoints: GET /backends, GET /status,
POST /generate. Includes 12 integration tests covering interface satisfaction,
engine registration, envelope format, and error handling.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-20 16:00:52 +00:00
Snider
861e44fedd docs: add README with quick start and docs links
Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-20 15:11:19 +00:00
Snider
3918051112 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
Claude
7075d7cbe7
fix(go.mod): correct replace path for core/go
Was ../host-uk/core (wrong), now ../go matching workspace layout.

Co-Authored-By: Charon <charon@lethean.io>
2026-02-20 14:22:47 +00:00
Snider
74ebbe634c docs: mark deferred items complete in TODO — all phases done
Memory controls handled by go-mlx internally. Integration smoke test
covered by Phase 4 mock tests; real-model test deferred to LEM Lab.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-20 12:45:28 +00:00
Snider
1fc4c640ff docs: mark Phase 4 test coverage complete — all phases done
25 benchmarks baselined on M3 Ultra, 34 backend tests, 6 race-condition
tests. go test -race clean.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-20 03:49:54 +00:00
Snider
09bf40301d test: add Phase 4 test coverage and benchmarks
Backend tests: LlamaBackend (20 tests via httptest mock), MLX/InferenceAdapter
(8 tests via mock TextModel). Race condition tests: concurrent scoring (20
responses), mixed suites fan-out, semaphore boundary (concurrency=1), context
cancellation, heuristic-only (50 responses), multi-model concurrent map writes.
Benchmarks: heuristic (5 sizes), exact match (4 patterns), JSON extraction
(6 variants), judge round-trip (2 suites), ScoreAll (2 modes), sub-components
(5 heuristic stages). All pass with -race.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-20 03:49:07 +00:00
Snider
c925391174 docs: mark Phase 3 Step 3.4 agent tests complete — Phase 3 done
Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-20 03:23:43 +00:00
Snider
3e227610fe test: add agent subsystem tests (25 tests, 528 LOC)
Tests for AdapterMeta (model family → tag/prefix/stem mapping),
FindUnscored (checkpoint filtering), BufferInfluxResult/ReplayInfluxBuffer
(JSONL persistence round-trip), and DiscoverCheckpoints (SSH output parsing
via fakeTransport mock implementing RemoteTransport interface).

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-20 03:23:13 +00:00
Snider
987831bd16 docs: mark Phase 3 Step 3.3 configurable infrastructure complete
Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-20 03:18:38 +00:00
Snider
12f3a1c79d refactor: extract hardcoded values into package constants
Move magic numbers and strings into named constants in agent_config.go:
- EpochBase (was 1739577600 in 5 locations)
- 5 InfluxDB measurement names (capability_score, probe_score, etc.)
- 2 DuckDB table names (checkpoint_scores, probe_results)
- Probe defaults (temperature, max tokens, response truncation)
- InfluxBufferFile, LogSeparatorWidth, InterCheckpointDelay

Replace hardcoded probe counts ("23", "6") with len(CapabilityProbes),
len(ContentProbes). 7 files modified, no functional changes.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-20 03:18:19 +00:00
Snider
6f6bdd7c5c docs: mark Phase 3 Step 3.2 RemoteTransport complete
Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-20 03:10:08 +00:00
Snider
1c2a6a6902 feat: add RemoteTransport interface for SSH abstraction
Introduce RemoteTransport interface (Run, CopyFrom, CopyTo) with
SSHTransport implementation using ssh/scp binaries. AgentConfig gains
a Transport field with lazy initialization from M3 credentials.

All internal callers (DiscoverCheckpoints, processMLXNative,
processWithConversion) now use cfg.transport() instead of global
SSHCommand/SCPFrom. Old functions preserved as deprecated wrappers.

Enables mock injection for testing agent loop without real SSH.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-20 03:09:42 +00:00
Snider
33939fe038 docs: mark Phase 3 Step 3.1 agent.go split complete
Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-20 03:05:45 +00:00
Snider
eae9ec9b38 refactor: split agent.go (1070 LOC) into 5 focused files
Decompose monolithic agent.go into concern-based files:
- agent_config.go (97 LOC): AgentConfig, Checkpoint, model maps
- agent_execute.go (215 LOC): RunAgentLoop, discovery, scoring dispatch
- agent_eval.go (397 LOC): MLX native + conversion eval, capability/content probes
- agent_influx.go (291 LOC): InfluxDB scoring push, buffer/replay
- agent_ssh.go (102 LOC): SSH/SCP helpers, env utilities

No functional changes. All tests pass.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-20 03:05:11 +00:00
Snider
58854390eb docs: add Phase 3 agent.go structure audit to FINDINGS.md
Documented 6 logical sections, hardcoded infrastructure,
and testable functions (AdapterMeta, FindUnscored, buffer).

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-20 02:13:06 +00:00
Snider
6847cc9d24 docs: refine Phase 3 agent.go decomposition with line-level split plan
1,070 LOC agent.go → 5 files: agent_config (95), agent_execute (200),
agent_eval (355), agent_influx (270), agent_ssh (90). Added SSH
transport interface, infrastructure constants, and test tasks.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-20 02:12:23 +00:00
Snider
57c8a97dfe docs: mark Phase 2 backend consolidation complete
All 4 steps done in commit 747e703:
- Step 2.1: Message type alias (inference.go, adapter.go)
- Step 2.2: GenOpts extension with TopK/TopP/RepeatPenalty
- Step 2.3: StreamingBackend deprecation
- Step 2.4: CLAUDE.md Backend Architecture section

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-20 02:06:49 +00:00
Snider
747e703c7b feat: Phase 2 backend consolidation — Message alias, GenOpts, deprecation
- Replace Message struct with type alias for inference.Message (backward compat)
- Remove convertMessages() — types are now identical via alias
- Extend GenOpts with TopK, TopP, RepeatPenalty (mapped in convertOpts)
- Deprecate StreamingBackend with doc comment (only 2 callers, both in cli/)
- Simplify HTTPTextModel.Chat() — pass messages directly
- Update CLAUDE.md with Backend Architecture section
- Add 2 new tests, remove 1 obsolete test

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-20 02:05:59 +00:00
Snider
fe70eb0ce1 docs: add Phase 2 StreamingBackend audit results to FINDINGS.md
Full audit of StreamingBackend usage across ecosystem:
- Only 2 callers (both in host-uk/cli, out of go-ml scope)
- All other consumers use Backend.Generate() (non-streaming)
- GenOpts vs GenerateConfig field comparison documented
- backend_mlx.go dead imports marked as FIXED (Phase 1)

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-20 01:54:26 +00:00
Snider
898c4c228d docs: refine Phase 2 backend consolidation tasks with audit results
Based on comprehensive codebase analysis:
- Only 2 files use StreamingBackend (both in host-uk/cli)
- All other consumers use Backend.Generate() (non-streaming)
- Precise steps: type alias Message, extend GenOpts, deprecate StreamingBackend

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-20 01:53:27 +00:00