Learning from Repetition¶
G6 doesn't just answer questions — it learns from them.
The Problem¶
Every Claude Code session starts from zero. The same data cleaning task that took 500K tokens last week costs 500K tokens again today.
The Mechanism¶
G6 tracks two types of compression:
Status: mechanisms wired, reuse still early
The persistence and synthesis pieces below are wired end-to-end, but artifact reuse is not yet the default path. Most tasks today still run the full LLM reasoning path — the artifact/template library is in early development (<1% coverage), and Type II sub-problem caching (below) is a design goal rather than routine behaviour. This page describes the intended mechanism; treat the cost-savings examples as illustrative of the target, not measured averages.
Type I: Direct Recognition¶
When G6 encounters a problem it has solved before and a verified artifact for it exists, it can replay that artifact — re-checking it on the new instance first — instead of invoking an LLM.
graph LR
A[New Problem] --> B{Seen Before?}
B -->|Yes| C[Retrieve Cached Algorithm]
B -->|No| D[LLM Reasoning]
D --> E[Store Solution]
C --> F[Return Result]
E --> F Example: You ask G6 to parse dates from a CSV column. The first time, it uses an LLM to figure out the format. The second time, it retrieves the parser it wrote.
Type II: Decomposition (design goal)¶
The intended behaviour: novel problems are broken into sub-problems, and any sub-problem solved before is retrieved rather than re-derived. Autonomous sub-problem caching is not yet wired as a runtime path — the decomposition and retrieval primitives exist (below), but they are not yet composed into automatic sub-solution reuse.
Example: "Analyse sales by region and forecast next quarter" decomposes into: 1. Load data (cached from previous use) 2. Group by region (cached) 3. Forecast (requires fresh LLM reasoning)
Only step 3 costs tokens. Steps 1-2 are retrieved from the component library.
How It Actually Works¶
- adapt_memory stores problem-solution pairs as embeddings
- ctx_rag retrieves similar past solutions via TF-IDF/BM25
- ComponentRegistry maps sub-problems to existing components
- align_evals scores retrieved solutions against the new problem
Where This Fits: The T0–T3 Framework¶
G6 classifies AI systems by their number of adaptive traverses — transitions from general knowledge to specific action, drawing on Danko Nikolić's theory of practopoiesis:
| Type | Name | Learning Behaviour | G6 Mechanism |
|---|---|---|---|
| T0 | No learning | Fixed tool-calling, no adaptation | Baseline: model + tools, no iteration |
| T1 | Harness engineering | One-time optimisation, then flatlines | Human analyses failures, rewrites harness once |
| T2 | Continuous resampling | Sustained linear improvement via feedback loops | Self-training loop with continuous data/feedback |
| T3 | Structured theory building | Discontinuous improvement via symbolic models | System builds explicit theories, learns how to learn |
Type I and Type II compression (described above) are the mechanisms intended to operate within each T-level. At T0, compression doesn't happen. At T1, a human manually triggers it. At T2, the self-training loop is designed to automate it (today this remains largely human-supervised). At T3, the system would learn better compression rules itself.
Iteration Protocol¶
Each refinement round follows a progressive sample ladder — catch bugs cheaply before committing to a full run:
| Stage | n | Purpose | Gate |
|---|---|---|---|
| Pretest | 0 | Validate harness components load, tools connect, scorer parses output | No crashes |
| Smoke test | 1 | Single end-to-end task — confirm the pipeline produces a scoreable answer | Runs to completion |
| Pilot | 5 | Spot-check across task categories | No regressions |
| Small sample | 25 | Statistically meaningful signal — estimate lift direction and magnitude | Positive delta |
| Full run | k | Complete benchmark — McNemar's test, bootstrap CI, per-category breakdown | p < 0.05 |
Self-Training Loop¶
G6's self-training infrastructure automates T1-to-T2 advancement. The improve_adapter factory classifies failures into 12 categories and maps them to 5 improvement strategies:
graph LR
A[Component trace] --> B[Failure classifier]
B --> C{12 failure classes}
C --> D[Strategy selector]
D --> E[Apply improvement]
E --> F[Re-evaluate]
F -->|Improved| G[Promote component]
F -->|Regressed| H[Rollback] Self-training tools¶
| Tool | Description |
|---|---|
self_training_audit | Audit a single component for maturity |
self_training_audit_all | Audit all components in bulk |
self_training_scorecard | Generate a maturity scorecard |
self_training_promote | Promote a component to a higher stability tier |
self_training_flag | Flag a component for review |
Learning Layer¶
The learning_layer component provides the lower-level primitives for dataset construction, model training, and theory extraction:
| Tool | Description |
|---|---|
learning_build_dataset | Build a training dataset from component traces |
learning_train | Train a model on component data |
learning_evaluate | Evaluate a trained model |
learning_get_theories | Get extracted theories from training |
Live backend gate
learning_train and learning_evaluate may call the configured LLM backend for every dataset row. Before any customer pilot or production workflow, run the gated live smoke test on the same deployment machine, G6_WORKSPACE, model/provider, credentials, and environment:
$env:G6_WORKSPACE="C:\path\to\pilot-workspace"
$env:G6_LEARNING_LAYER_LIVE_SMOKE="1"
python -m pytest -q tests/mvp/learning_layer/test_live_llm_smoke.py
Passing mocked tests is not enough for launch readiness. A failed smoke test means the backend, model, credentials, or workspace configuration still needs fixing before users depend on this path.
The learning layer feeds into the self-training loop: traces are collected, datasets are built, models are trained, and successful improvements are promoted through the stability tiers.
GoalWizard: Natural Language Goals¶
The GoalWizard translates natural language descriptions into structured GoalInput objects with appropriate resource bounds, guardrails, and checkpoints. Instead of filling out a 7-field JSON form, users can simply describe what they want:
"Analyse our Q4 sales data and forecast next quarter by region"
The wizard infers the appropriate components, sets resource limits, and produces a goal tree ready for execution.
FAQ¶
Q: How much data does G6 need before learning kicks in? A: Benefits start after 10-20 interactions in a domain. Significant cost reduction typically appears after 50+ interactions.
Q: Can G6 forget incorrect solutions? A: Yes. Solutions are scored and low-performing ones are pruned automatically. You can also manually delete stored solutions via the adapt_memory tools.
Q: Does learning persist across users? A: Each user has an isolated workspace. Learning is per-user by default.
Q: How does self-training differ from EvoSkill? A: Self-training improves individual component reliability through harness engineering (T1-T2). EvoSkill evolves entirely new skills through evolutionary optimization (T2-T3). They operate at different levels of the T0-T3 framework.