Skip to content

feat(memory+agent): conversation/execution upgrades inspired by claude-code-analysis#35

Merged
TYRMars merged 4 commits into
mainfrom
feat/chat_cl
May 16, 2026
Merged

feat(memory+agent): conversation/execution upgrades inspired by claude-code-analysis#35
TYRMars merged 4 commits into
mainfrom
feat/chat_cl

Conversation

@TYRMars
Copy link
Copy Markdown
Owner

@TYRMars TYRMars commented May 16, 2026

Summary

26-unit incremental upgrade to Jarvis's conversation and execution capabilities, driven by gaps surfaced in the claude-code-analysis-main material. 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

  • WorkingContext (recent files + plan) re-injected after compaction
  • SummarizingMemory circuit breaker + PTL fallback (never returns Err)
  • Transcript folding for read-only-only runs (CollapsedToolGroup)

Execution throughput + observability

  • Per-tool is_concurrency_safe / is_destructive flags gate parallel dispatch
  • Background tasks panel (/v1/tasks + Web panel + WS push)
  • enter_plan_mode tool symmetry via mode_signal channel
  • SummarizingMemory compaction counters at /v1/diagnostics/memory

Capability extensions

  • Agent project memory: memory.{list,read,write,delete} under .jarvis/memory/
  • SystemPromptBuilder 5-slot layered assembly
  • Skill paths glob auto-activates skills on recent file touches
  • Composer auto-activated skill chip + Mode-changed toast

Memory storage + sync (the biggest chunk)

  • Dual scope: workspace (<ws>/.jarvis/memory/) + user (~/.jarvis/memory/)
  • Sync backend selection: git (default, with memory.sync_setup one-shot + memory.sync + auto-sync ticker) or icloud (macOS-only, OS-managed) or none
  • iCloud .icloud lazy-stub auto-materialise via brctl download
  • Settings → System → Memory Sync panel (REST + React UI)
  • Include sync: <!-- jarvis-include: <target> --> directives, target = local path / tilde / git+<url>[#branch]
  • Includes Settings panel (/v1/memory/includes REST)
  • Include enhancements: cross-scope dedup, 25 KiB per-include byte cap, opt-in JARVIS_INCLUDE_TTL_HOURS for gentle git pull

Backwards compatibility

  • All new BuiltinsConfig fields default off — existing deployments unaffected
  • Legacy JARVIS_ENABLE_MEMORY_SYNC=1 is preserved; explicit JARVIS_MEMORY_SYNC_BACKEND wins when set
  • New tools are namespaced (memory.*, memory.sync*, memory.include_*, enter_plan_mode, memory.sync_setup_icloud)
  • New AgentEvent::ModeChanged variant — existing handlers ignore unknown frames safely

File highlights

New modules:

  • crates/harness-core/src/working_context.rs
  • crates/harness-core/src/mode_signal.rs
  • crates/harness-core/src/system_prompt.rs
  • crates/harness-tools/src/enter_plan_mode.rs
  • crates/harness-tools/src/memory.rs
  • crates/harness-tools/src/memory_sync.rs
  • crates/harness-tools/src/memory_icloud.rs
  • crates/harness-tools/src/memory_include.rs
  • crates/harness-tools/src/memory_include_tools.rs
  • crates/harness-skill/src/path_match.rs
  • crates/harness-server/src/tasks_routes.rs
  • crates/harness-server/src/memory_sync_routes.rs
  • apps/jarvis-web/src/components/Approvals/ModeChangedToast.tsx
  • apps/jarvis-web/src/components/BackgroundTasks/
  • apps/jarvis-web/src/components/Chat/CollapsedToolGroup.tsx
  • apps/jarvis-web/src/components/Composer/AutoActivatedSkillsChip.tsx
  • apps/jarvis-web/src/components/Settings/sections/MemorySyncSection.tsx
  • apps/jarvis-web/src/components/Settings/sections/MemoryIncludesPanel.tsx

Reviewer notes

  • Memory tools, sync, includes, and iCloud helpers all share the same MemoryRoots / MemoryScope types — a single grep on those will surface the integration points.
  • The git+ include path runs a real git clone --depth 1; tests use local bare repos as upstream, no network needed.
  • SystemPromptBuilder output is byte-equivalent to the prior push_str flow for prompt-cache stability — the builder is the new orchestration, not a wire-format change.
  • auto_sync ticker only runs when backend = git AND JARVIS_MEMORY_AUTO_SYNC=1 — iCloud syncs at OS level so the ticker would be redundant.
  • TTL refresh fails open: network errors / non-FF pulls warn but keep the stale cache; startup never blocks on a broken include.

Test plan

  • cargo test --workspace --exclude jarvis-desktop --lib → 15 suites, all green
  • cargo clippy --workspace --exclude jarvis-desktop --all-targets -- -D warnings → clean
  • pnpm test → 335 tests (32 files)
  • pnpm exec tsc --noEmit → clean
  • pnpm lint → 0 errors
  • Vite preview smoke-tested at every UI milestone (no console errors, all routes accessible)
  • Reviewer: try the end-to-end memory sync flow:
    1. JARVIS_ENABLE_MEMORY=1 JARVIS_ENABLE_MEMORY_SYNC=1 jarvis serve
    2. Open Settings → System → Memory Sync
    3. Enter a git URL → "Set up & push" → verify init/clone/push log lines
    4. Have the agent memory.write something → "Sync now" → check the remote
  • Reviewer: try the include flow:
    1. Add a path include (/another/jarvis/workspace)
    2. Verify next conversation shows === included from /another/... === in the system prompt
    3. Try git+<url> include — verify clone into ~/.jarvis/include-cache/

🤖 Generated with Claude Code

TYRMars and others added 4 commits May 16, 2026 20:12
…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>
@TYRMars TYRMars merged commit 13c573c into main May 16, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant