Closes#582. Route fact-store construction through a new FactStoreRegistry (local backend registered by default); align the default facts path with get_config_dir(); wire completed chat exchanges (streamed and non-streamed) through the EventBus so the memory service captures them consistently; reload the local fact store from disk before operations so external clears don't resurrect stale facts; make the affected config/persona/memory/CLI/route tests hermetic; and refresh uv.lock with the current resolver (locks pytest-xdist + transitive deps, drops py3.14 artifacts since the project constrains Python <3.14).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Previously `core/config.py` defined `DEFAULT_CONFIG_DIR = Path.home() /
".openjarvis"` as a by-value module constant imported into ~45 modules, and 34
modules hardcoded `Path.home() / ".openjarvis"` directly. The installer honored
`OPENJARVIS_HOME` but the Python runtime ignored it, producing a split-brain
layout (some modules honored the override, the core config dir did not). Eval
dataset caches also scattered into `~/.cache/<benchmark>`.
This introduces a single env-aware resolver in `openjarvis/core/paths.py` and
routes every state/config/cache path through it. OpenJarvis now keeps ALL of
its state under ONE root, resolved in priority order:
1. $OPENJARVIS_HOME
2. $XDG_DATA_HOME/openjarvis (single nested dir, when XDG_DATA_HOME is set)
3. ~/.openjarvis (default — unchanged, so existing installs are
untouched and no data migration is required)
Implementation:
- New `core/paths.py`: get_config_dir / get_config_path / get_data_dir /
get_cache_dir, with a source-tree rejection guard (fails loudly per
REVIEW.md if the root resolves inside the repo).
- `core/config.py`: DEFAULT_CONFIG_DIR / DEFAULT_CONFIG_PATH are now resolved
via the env-aware resolver at import (real attributes, so existing
monkeypatch.setattr-based tests keep working). All dataclass field defaults
that pointed at ~/.openjarvis converted to default_factory so they honor the
override at instantiation.
- Routed all 34 hardcoders plus several string-literal escapees the original
audit missed: prompt_loader / description_loader (were OPENJARVIS_HOME-only,
no XDG), swebench_harness cache, tools/{memory,skill,user_profile}_manage
defaults, server trace.db fallbacks, doctor_cmd hints.
- spec_search storage/paths now delegates to the unified resolver (gains XDG);
its ConfigurationError is aliased to the core one.
- Eval dataset caches moved from ~/.cache/<name> to <root>/cache/<name>
(~/.cache/huggingface left alone — it is HF's own cache).
- Docs + installer comment + `jarvis config path` to show resolved dirs.
Read-only macOS connectors and OS service files (LaunchAgents/systemd) are
intentionally left untouched.
Fixes#462
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The OpenAI-compatible POST /v1/chat/completions endpoint — the desktop UI's
chat backend — never injected OpenJarvis's agent.default_system_prompt when the
client omits a system message. The frontend (Chat/InputArea.tsx) posts only
user/assistant turns, so the model answered from its training identity
("I'm Claude", "I am Qwen", ...). The CLI paths ground identity via
SystemPromptBuilder / BaseAgent; the engine-direct server handlers did not.
Fix:
- Add _ensure_identity_prompt(messages, app_config) in server/routes.py: returns
messages unchanged when any has role==SYSTEM, else prepends a SYSTEM message
with the resolved identity prompt (app.state.config.agent.default_system_prompt,
else load_config()), wrapped in try/except that debug-logs on failure (no crash,
no silent swallow per REVIEW.md).
- Apply it after _to_messages() in all three engine-direct handlers:
_handle_stream, _handle_stream_tools, and _handle_direct; thread app.state.config
through. _handle_agent is left untouched (BaseAgent already injects the default).
- Harden AgentConfig.default_system_prompt so distilled models stop claiming to be
Claude/ChatGPT/Gemini and self-identify as OpenJarvis.
Tests (tests/server/test_routes.py, tests/core/test_config.py): identity prompt IS
prepended when no system message is present (stream / direct / tools paths) and is
NOT duplicated when the client supplies one; config wording anchors "OpenJarvis"
and "not Claude". Verified fail-on-unfixed against main (3 inject tests + config
wording test fail there).
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
A [system_prompt] prefix set in config.toml was silently ignored: (1)
load_config()'s section allowlist dropped the [system_prompt],
[memory_files], [compression], and [skills] blocks entirely; (2)
SystemPromptConfig had no prefix field; (3) the builder never prepended
one.
Add the four blocks to the allowlist, add prefix: str = "" to
SystemPromptConfig, and prepend a "prefix" PromptSection at the front of
SystemPromptBuilder's frozen sections so it leads build() output and is
exposed via sections() (#457). Empty prefix emits no section — existing
configs are byte-for-byte unchanged.
Rebuilt on top of #457 (which refactored the builder to PromptSection
objects); the original #452 by @SoulSniper-V2 patched the pre-#457
method. Credit to @SoulSniper-V2. Adds the regression tests the original
PR lacked: config parse + prefix-prepended + empty-prefix-unchanged.
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Qwen3.5 MoE models provide better quality per GB of memory since only
a fraction of parameters are active per token. Updates the tier table:
≤8 GB → qwen3.5:2b
8-16GB → qwen3.5:4b
16-32GB → qwen3.5:9b
32GB+ → qwen3.5:27b
Closes#132 — jarvis init now recommends a Qwen3 dense model based on
available memory using an explicit tier table:
≤8 GB → qwen3:1.7b (~1.1 GB)
8-16GB → qwen3:4b (~2.5 GB)
16-32GB → qwen3:8b (~5.2 GB)
32GB+ → qwen3:14b (~9.3 GB)
Adds qwen3:0.6b, 1.7b, 4b, 14b, 30b to the model catalog. Falls back
to scanning all compatible models if the tiered pick doesn't support
the selected engine. Shows the user why the model was chosen and how
to download later if declined.
test_config.py: SecurityConfig.mode default changed from "warn" to "redact"
test_config_phase3.py: ServerConfig.host default changed from "0.0.0.0" to "127.0.0.1"
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
_apply_toml_section only normalized TOML arrays to comma-separated strings
for real dataclass fields, but backward-compat property setters like
reward_weights also expect string input. When a user's config.toml had
an array value for a property-backed attribute, the raw list was passed
to the setter which called .split(",") on it, causing:
'list' object has no attribute 'split'
This also hardens serve.py against the same issue when reading
config.agent.tools.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Merge main into fix/ssrf-check, keeping both the auto-recover
logic for error-state agents and the async streaming support
for the send_message endpoint.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The model catalog listed non-existent Qwen3.5 sizes (3B, 8B, 14B) and
pointed to MLX community repos that don't exist, causing `jarvis init`
to recommend models that cannot be downloaded on Apple Silicon.
Replace with the actual Qwen3.5 model family sizes (0.8B, 2B, 9B, 27B)
and verified mlx-community repo URLs from HuggingFace.
Fixes#129
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Fixes recommend_model() returning empty string on Apple Silicon
when MLX is the recommended engine. Also adds gguf_file and
mlx_repo download metadata, and estimated_download_gb helper.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* chore: create learning subdirectory structure (routing, agents, intelligence)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: extract classify_query to routing/_utils.py
Move the classify_query() function and its regex patterns into a shared
utility module so multiple routing policies can import it without
depending on the full trace_policy module.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor: move routing files to learning/routing/ subdirectory
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: create LearnedRouterPolicy merging trace-driven + SFT routing
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: add conditional Algolia DocSearch integration
Add Algolia DocSearch as an optional search upgrade — native lunr.js
search remains the default until credentials are configured. Includes
CDN assets, Jinja2 conditional config injection, init script with
graceful fallback, light/dark theme CSS, improved search tokenization
for snake_case/dotted identifiers, and search boosts for key pages.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor: move agent_evolver and skill_discovery to learning/agents/
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor: move learning/orchestrator to learning/intelligence/orchestrator
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor: delete removed learning policies, rewrite __init__.py, clean up api_routes
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: add SFT/GRPO/DSPy/GEPA config dataclasses, update LearningConfig
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: add general-purpose SFT trainer (intelligence/sft_trainer.py)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: update stale imports in multi_model_router example
Update imports to use new learning/routing/ paths after the
subdirectory reorganization. Replace BanditRouterPolicy with
LearnedRouterPolicy.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: add general-purpose GRPO trainer (intelligence/grpo_trainer.py)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: add DSPy agent optimizer (agents/dspy_optimizer.py)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: add GEPA agent optimizer (agents/gepa_optimizer.py)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: add learning-dspy and learning-gepa optional dependency extras
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: update integration test to check for learned policy instead of grpo
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: clean up stale APIs and unused params in examples
- deep_research: remove system_prompt and max_turns params not accepted
by Jarvis.ask(), inline system prompt into the query instead
- doc_qa: remove unused --top-k CLI arg that was never passed to the API
- multi_model_router: fix select_model() call to match single-arg signature
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: import SFT/GRPO trainers in intelligence/__init__.py for registry
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* chore: remove .md file changes from PR
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* chore: restore search boost frontmatter for key docs pages
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
OLLAMA_HOST env var was unconditionally overriding the host parameter
in OllamaEngine.__init__, even when explicitly set via config.toml.
Priority is now: config.toml > OLLAMA_HOST env var > hardcoded default.