Commit graph

23 commits

Author SHA1 Message Date
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
Snider
c3c2c14dba feat(backend): add HTTP/Llama TextModel wrappers + verify downstream
Phase 1 Steps 1.4 and 1.5 complete:

- HTTPTextModel wraps HTTPBackend as inference.TextModel (Generate/Chat
  yield entire response as single Token, Classify unsupported,
  BatchGenerate sequential)
- LlamaTextModel embeds HTTPTextModel, overrides ModelType -> "llama"
  and Close -> llama.Stop()
- 19 new tests (17 HTTPTextModel + 2 LlamaTextModel), all passing
- Verified service.go and judge.go downstream consumers unchanged
- Updated CLAUDE.md: backend_mlx.go DONE, architecture table current,
  critical context reflects Phase 1 complete
- Updated TODO.md: Steps 1.4 and 1.5 marked done

Co-Authored-By: Virgil <virgil@lethean.io>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 01:23:34 +00:00
Snider
a4d7686147 feat(adapter): bridge go-inference TextModel to ml.Backend/StreamingBackend
InferenceAdapter wraps inference.TextModel (iter.Seq[Token]) to satisfy
ml.Backend (string returns) and ml.StreamingBackend (TokenCallback).

- adapter.go: InferenceAdapter with Generate/Chat/Stream/Close
- adapter_test.go: 13 test cases with mock TextModel (all pass)
- backend_mlx.go: rewritten from 253 LOC to ~35 LOC using go-inference
- go.mod: add forge.lthn.ai/core/go-inference dependency
- TODO.md: mark Phase 1 steps 1.1-1.3 complete

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-20 00:52:34 +00:00
Snider
e7959720c5 docs: add go mod download note and clarify backend_mlx state
CLAUDE.md updated: first-run needs go mod download, backend_mlx.go
imports dead go-mlx subpackages (Phase 1 fixes this).

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-20 00:40:00 +00:00
Snider
84757b8331 docs: comprehensive domain expert session brief for go-inference migration
Rewrites CLAUDE.md with full interface mapping (ml.Backend → inference.TextModel),
adapter design pattern, broken import context, and local dependency paths.

Expands TODO.md Phase 1 into 5 concrete steps with code patterns for
InferenceAdapter, backend_mlx.go rewrite, and downstream verification.

Updates FINDINGS.md with type correspondence table and before/after comparison.

Fixes go.mod replace directives for ~/Code/ layout and adds go-inference.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-19 21:55:50 +00:00
Virgil
88e926cc24 docs: add TODO.md, FINDINGS.md for fleet delegation
Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-19 21:33:53 +00:00
Snider
7c8e762a86 feat: extract go-ml from go-ai as standalone ML package
Inference backends (MLX, llama.cpp, HTTP), scoring engine, agent
orchestrator, GGUF management, DuckDB storage, Parquet I/O.
Adds CLAUDE.md/TODO.md/FINDINGS.md.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-19 18:32:04 +00:00