feat(memory+agent): conversation/execution upgrades inspired by claude-code-analysis#35
Merged
Conversation
…e-code-analysis
This is a large multi-milestone change extending Jarvis's conversation
and execution capabilities. The plan was approved as
~/.claude/plans/jarvis-claude-cide-analysis-magical-aho.md;
implementation grew beyond the original 9 milestones into a series of
focused follow-ups. 26 logical units of work in total.
## Conversation fidelity (M1)
- M1.1 WorkingContext: per-run task-local that tracks the agent's
recently-touched files + latest plan snapshot; SlidingWindowMemory
and SummarizingMemory append "=== working context ===" after
compaction so the model doesn't forget what it was doing.
- M1.2 Circuit breaker + PTL fallback in SummarizingMemory: 3 consec
failures open a 60s cooldown; over-budget output gets a two-round
20% / hard-prune fallback so compaction never returns Err.
- M1.3 Transcript folding: MessageList collapses runs of ≥3
consecutive read-only-only assistant iterations into a single
CollapsedToolGroup card.
## Execution throughput + observability (M2)
- M2.1 Per-tool concurrency-safe / is_destructive flags; agent loop
refuses to parallelise a turn unless every call is concurrency-safe.
- M2.2 Background tasks panel: GET /v1/tasks + Web header button +
panel. P5 extended sources to MCP servers + auto_mode requirement
runs; P7 added WS tasks_snapshot push (poll fallback dropped to 15s).
- M2.3 enter_plan_mode tool symmetry: mode_signal task-local channel
+ AgentEvent::ModeChanged; WS handler reacts and broadcasts.
## Capability extensions (M3)
- M3.1 Agent Project Memory: memory.{list,read,write,delete} tools
persisting under .jarvis/memory/, MEMORY.md index injected into
the system prompt.
- M3.2 SystemPromptBuilder: 5-slot layered assembly
(base/role/per_agent_override/config_append/runtime_inject).
- M3.3 Skill conditional triggers: SkillManifest.paths glob + WS
handler's recent_touched_files feed merged_skills_for_turn.
## Small completion patches (P1–P4)
- P2 enter_plan_mode on-by-default in coding mode
- P3 CLI registers memory.* via --enable-memory
- P1 Composer auto-activated skills chip (skill_auto_activated_for_next_turn frame)
- P4 ModeChangedToast for tool-initiated mode switches
## Memory storage + sync (P5–P18)
- P5 tasks panel: MCP + auto_mode requirement runs as sources
- P6 WorkingContext recent_commands (shell.exec + code.grep)
- P7 tasks_snapshot WS push
- P8 SummarizingMemory CompactionCounters + MemoryStatsProvider trait
exposed at GET /v1/diagnostics/memory
- P9 dual-scope memory: workspace + user (~/.jarvis/memory/) with
scope arg on every memory.* tool; combined system prompt injection
- P10 git transport sync: memory.sync / memory.sync_status against a
user-configured git remote, approval-gated, JSON report
- P11 polish: memory.sync_setup one-shot init; background ticker
(JARVIS_MEMORY_AUTO_SYNC + JARVIS_MEMORY_AUTO_SYNC_INTERVAL_SECS)
- P13 MemorySyncBackend enum (git / icloud / none) — mutually exclusive
registration; iCloud auto-resolves user_root to iCloud Drive
- P14 Settings → System → Memory Sync REST + UI panel (status, sync,
setup forms, refresh)
- P15 .icloud lazy-stub auto-materialise: brctl-driven detect+download
before memory reads, no-op outside macOS / iCloud paths
- P16 Include sync: <!-- jarvis-include: <target> --> directives in
MEMORY.md (LocalPath / tilde / git+url[#branch]); resolved at
system-prompt injection, walks depth=1, fails open
- P17 Includes Settings panel (list/add/remove/refresh via
/v1/memory/includes REST)
- P18 enhancements: cross-scope dedup, 25 KiB per-include byte cap +
UTF-8-safe truncation marker, opt-in JARVIS_INCLUDE_TTL_HOURS for
gentle git pull on stale caches
## Validation
- cargo test --workspace --exclude jarvis-desktop --lib → 15 suites
- cargo clippy --workspace --exclude jarvis-desktop --all-targets
-- -D warnings → clean
- pnpm test → 335 tests
- pnpm exec tsc --noEmit → clean
- Manual preview smoke tests at each milestone
## Backwards compatibility
- All new BuiltinsConfig fields default off — existing deployments
unaffected without env / config opt-in.
- Existing env vars (JARVIS_ENABLE_MEMORY_SYNC) preserved; new
JARVIS_MEMORY_SYNC_BACKEND wins when set explicitly.
- All new tools are namespaced (memory.*, memory.sync*,
memory.include_*, memory.sync_setup_icloud).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Resolved conflicts in: - crates/harness-core/src/lib.rs: re-export both `MemoryStatsProvider` (added by P8 on this branch) and `JsonAwareEstimator` (added by main). - apps/jarvis/src/serve.rs: project-context loader path — keep the SystemPromptBuilder slot API from this branch and incorporate main's truncation WARN so operators notice when JARVIS_PROJECT_CONTEXT_BYTES needs raising. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The brctl-related constants and `Duration` import are only used inside `#[cfg(target_os = "macos")]` helpers. On the Linux CI box they were unused, tripping `-D warnings` (unused_imports + dead_code). Gate them at module level so the symbols only exist on macOS — same set of files compiled, no compat impact. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
`memory.sync_setup` was relying on the host having `user.email` / `user.name` set globally for the initial `git commit -m "init: jarvis memory"` to succeed. Fresh dev boxes and CI runners don't, so the command failed with "Author identity unknown" and the tool surfaced a confusing error. Pass the author identity inline via `-c user.email=jarvis@local -c user.name=Jarvis` so the seed commit always lands. The overrides apply only to that single command — subsequent commits in the repo use whatever the operator configures locally. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
26-unit incremental upgrade to Jarvis's conversation and execution capabilities, driven by gaps surfaced in the
claude-code-analysis-mainmaterial. Plan lives at~/.claude/plans/jarvis-claude-cide-analysis-magical-aho.md— implementation grew past the original 9-milestone scope into a series of focused follow-ups (P5–P18).What's new at a glance
Conversation fidelity
Execution throughput + observability
is_concurrency_safe/is_destructiveflags gate parallel dispatch/v1/tasks+ Web panel + WS push)enter_plan_modetool symmetry viamode_signalchannelSummarizingMemorycompaction counters at/v1/diagnostics/memoryCapability extensions
memory.{list,read,write,delete}under.jarvis/memory/SystemPromptBuilder5-slot layered assemblypathsglob auto-activates skills on recent file touchesMemory storage + sync (the biggest chunk)
workspace(<ws>/.jarvis/memory/) +user(~/.jarvis/memory/)git(default, withmemory.sync_setupone-shot +memory.sync+ auto-sync ticker) oricloud(macOS-only, OS-managed) ornone.icloudlazy-stub auto-materialise viabrctl download<!-- jarvis-include: <target> -->directives, target = local path / tilde /git+<url>[#branch]/v1/memory/includesREST)JARVIS_INCLUDE_TTL_HOURSfor gentle git pullBackwards compatibility
BuiltinsConfigfields default off — existing deployments unaffectedJARVIS_ENABLE_MEMORY_SYNC=1is preserved; explicitJARVIS_MEMORY_SYNC_BACKENDwins when setmemory.*,memory.sync*,memory.include_*,enter_plan_mode,memory.sync_setup_icloud)AgentEvent::ModeChangedvariant — existing handlers ignore unknown frames safelyFile highlights
New modules:
crates/harness-core/src/working_context.rscrates/harness-core/src/mode_signal.rscrates/harness-core/src/system_prompt.rscrates/harness-tools/src/enter_plan_mode.rscrates/harness-tools/src/memory.rscrates/harness-tools/src/memory_sync.rscrates/harness-tools/src/memory_icloud.rscrates/harness-tools/src/memory_include.rscrates/harness-tools/src/memory_include_tools.rscrates/harness-skill/src/path_match.rscrates/harness-server/src/tasks_routes.rscrates/harness-server/src/memory_sync_routes.rsapps/jarvis-web/src/components/Approvals/ModeChangedToast.tsxapps/jarvis-web/src/components/BackgroundTasks/apps/jarvis-web/src/components/Chat/CollapsedToolGroup.tsxapps/jarvis-web/src/components/Composer/AutoActivatedSkillsChip.tsxapps/jarvis-web/src/components/Settings/sections/MemorySyncSection.tsxapps/jarvis-web/src/components/Settings/sections/MemoryIncludesPanel.tsxReviewer notes
MemoryRoots/MemoryScopetypes — a single grep on those will surface the integration points.git clone --depth 1; tests use local bare repos as upstream, no network needed.SystemPromptBuilderoutput is byte-equivalent to the priorpush_strflow for prompt-cache stability — the builder is the new orchestration, not a wire-format change.auto_syncticker only runs when backend = git ANDJARVIS_MEMORY_AUTO_SYNC=1— iCloud syncs at OS level so the ticker would be redundant.Test plan
cargo test --workspace --exclude jarvis-desktop --lib→ 15 suites, all greencargo clippy --workspace --exclude jarvis-desktop --all-targets -- -D warnings→ cleanpnpm test→ 335 tests (32 files)pnpm exec tsc --noEmit→ cleanpnpm lint→ 0 errorsJARVIS_ENABLE_MEMORY=1 JARVIS_ENABLE_MEMORY_SYNC=1 jarvis servememory.writesomething → "Sync now" → check the remote/another/jarvis/workspace)=== included from /another/... ===in the system promptgit+<url>include — verify clone into~/.jarvis/include-cache/🤖 Generated with Claude Code