Lesson 4: Grounded harness and continual learning (host-owned)
Harness vs runtime
| Sruja (harness) | Editor / CI (host) | |
|---|---|---|
Validates .sruja | sruja lint, sruja fmt | Proposes DSL edits |
| Compares model to code | sruja drift, sruja intent check | Interprets violations |
| Stores learnings | .sruja/agent_memory.json | Reflects on runs (optional) |
| Open-source LLM | --enrich-cmd, config.toml | Runs Ollama, vLLM, etc. |
Sruja does not ship ContinualLearningAgent, --autonomous, or automatic skill generation. Those are patterns you implement in the host, using Sruja JSON as ground truth.
Full reference: Grounded harness and continual learning.
Checklist: grounded architectural task
- Sync evidence —
sruja sync -r . - Brief the task —
sruja focus --file <path> -r .or MCP task context - Propose — skill/MCP synthesis or
sruja author propose --enrich-cmd '…' - Lint loop —
sruja lint repo.sruja --format jsonuntil clean; feed errors back to the model - Drift gate —
sruja drift -r . -a repo.sruja - Promote —
sruja propose approve <id>or human merge torepo.sruja - Record —
sruja agent recordor MCPsruja_record_learningon success/failure
Bounded agent loop
sruja agent plan -r . --goal "Fix drift on Checkout" --element-id Shop.Checkout --print
# Review plan JSON, then:
sruja agent apply -r . --plan docs/plans/<run-id>.json
Optional MaTTS parallel attempts:
sruja agent run -r . --goal "..." --file src/checkout.rs --mode apply --trajectories 3
Replay bundle after apply: .sruja/agent/runs/<run_id>/facts_bundle.json.
Local inference (Ollama example)
# .sruja/config.toml
[integrations]
default_provider = "cmd"
cmd = "ollama run llama3"
timeout_ms = 15000
max_bytes = 20000
sruja inspect onboard -r . -f markdown --enrich-cmd 'ollama run llama3'
Memory and curation
Learnings are LearningEntry records—not separate buckets for “facts” vs “preferences”:
sruja agent record -r . \
-c "Checkout boundary" \
-H "Split cart from payment container" \
-o success \
-g "Run drift after any Checkout container change" \
--hitl-kind precedent
sruja agent curate -r .
# After reviewing curate output, merge duplicates into one entry:
sruja agent merge -r . --ids id1,id2 -c "Merged context" -H "..." -g "Combined guardrail"
MCP ladder (editors)
sruja_list_architecture_indexsruja_get_topologysruja_get_elementssruja_get_task_context(cache_friendly: truewhen caching)
Setup: mcp_setup.md.
Reflect / learn (host-owned)
After agent apply, optionally:
- Read
facts_bundle.jsonand recentagent_memory.jsonentries. - Use your editor agent or
--enrich-cmdto draft narrative lessons (markdown only). - Persist with
sruja agent recordorsruja_record_learning. - Run
sruja agent curatebefore merging duplicate learnings.
Cursor users: run the project command Sruja: Reflect on agent run (see .cursor/commands/sruja-reflect-on-run.md).
What you learned
- Sruja constrains probabilistic output with deterministic gates.
- Continual learning lives in artifacts and memory, not weight updates.
- The host owns Act/Reflect; Sruja owns Record/Learn storage and enforcement.
Next: Agentic orchestration patterns and Sruja for industry pattern mapping.