Skip to content

✨ agents: CLI auto-memory off by default; clear_memory_on_kick wipes per-agent memory before each kick - #17089

Merged
clubanderson merged 3 commits into
v5from
feat/agent-cli-memory-config
Nov 7, 2026
Merged

clubanderson merged 3 commits into
v5from
feat/agent-cli-memory-config

Conversation

@clubanderson

Copy link
Copy Markdown
Member

Fixes #17032

Supersedes #17055, which GitHub auto-closed when its stacked base branch (fix/agent-memory-isolation, #17039) was deleted on merge. #17039 is now in v5; this branch is rebased onto v5 and carries only the two cli_memory commits.

Why

Even with per-agent homes (#17039), each subscription CLI keeps a hidden long-lived notebook (Claude auto-memory MEMORY.md, Codex memories/, Copilot memory) that accumulates stale one-off inferences and survives every /clear — clear_on_kick only resets the conversation. Hive agents get durable context from beads/knowledge/kick prompt, so the default should be off, with an opt-in and a per-kick wipe.

Config

agents:
  cli_memory:
    auto_memory: false     # default false
    clear_on_kick: false   # default false
  scanner:
    cli_memory: { auto_memory: true }   # per-agent override

CLIMemoryConfig (crux/config/cli_memory.go), stamped onto each agent like session_recycle; AutoMemoryEnabled() is nil-safe (default false). Settings-parity leaves + dashboard allowlist updated.

Exact vendor switches (seeded only when auto_memory is false; true pins the opposite so an operator's own setting is never shadowed)

CLI Switch Source
Claude Code CLAUDE_CODE_DISABLE_AUTO_MEMORY=1 in the agent env (per-process → per-agent override works) https://code.claude.com/docs/en/memory
Codex [features] memories = false merged into $CODEX_HOME/config.toml (codexConfigSeed, alongside the update-check pin) https://developers.openai.com/codex/memories , https://developers.openai.com/codex/config-reference
Copilot CLI "memory": false in the per-agent ~/.copilot/settings.json (the key `/memory on off` writes)
Gemini CLI no auto-memory feature; nothing to pin —

clear_on_kick

manager_kick.go: before every non-resume kick, right before the /clear block, clearCLIMemoryForKick removes this agent's ~/.claude/projects/*/memory/, $CODEX_HOME/memories*/, ~/.gemini/GEMINI.md (RemoveAll, su-exec rm -rf fallback on EPERM). Skipped for uid 0 / HIVE_SHARED_AGENT_HOME=1 (would touch the shared tree). Copilot memory is server-side — no local store.

Tests (-race, no sleeps)

  • crux/agent/cli_memory_test.go: env pin default + opt-in; Codex TOML merge cases incl. existing [features] table and codexConfigSeed(nil,false); Copilot settings seed + owns-the-key; kick wipe removes only this agent's stores and leaves the sibling/shared trees; off-by-default and shared-home skip.
  • pkg/config/cli_memory_test.go: YAML parse, defaults, per-agent override stamping.
  • internal/settingsparity leaves; manager_test.go env-count adjusted for the Claude pin.

Docs: docs/agent-configuration.md — cli_memory in the per-agent YAML example and a new "CLI auto-memory (agents.cli_memory)" section with the table above. Changelog changelog.d/added-agent-cli-memory-config.md.

…per-agent memory before each kick

Adds agents.cli_memory {auto_memory, clear_on_kick} with per-agent override,
seeds the vendor off-switches (Claude env var, Codex [features] memories,
Copilot settings.json memory) and removes the agent's own memory stores next
to the /clear kick when clear_on_kick is set.

Fixes #17032

Signed-off-by: Andrew Anderson <andy@clubanderson.com>
… cli_memory in agent-knowledge-and-memory.md

Signed-off-by: Andrew Anderson <andy@clubanderson.com>
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Nov 7, 2026
@kubestellar-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign kellyaa for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubestellar-prow kubestellar-prow Bot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Nov 7, 2026
@github-actions

github-actions Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Open PR overlap check

Base branch: v5

Conflicts are checked with every PR merged onto the current tip of v5, so a PR that only needs a rebase is not reported as conflicting with its siblings.

PR Title Relation Files
#17079 ✨ knowledge: prime an agent's own drafts when agent_scopes.include_states lists draft same files src/docs/agent-knowledge-and-memory.md
#17086 ✨ agents: drain CLI memory into draft knowledge entries before clearing same files changelog.d/added-agent-cli-memory-config.md
src/crux/agent/cli_memory.go
src/crux/agent/cli_memory_test.go
src/crux/agent/interactive_home.go
src/crux/agent/manager_env.go
src/crux/agent/manager_homes.go
src/crux/agent/manager_kick.go
src/crux/agent/manager_test.go
src/crux/config/agent_config.go
src/crux/config/cli_memory.go
src/docs/agent-configuration.md
src/docs/agent-knowledge-and-memory.md
src/internal/settingsparity/settingsparity.go
src/internal/settingsparity/settingsparity_test.go
src/internal/tools/settingsparity/main_test.go
src/pkg/config/cli_memory_test.go
src/pkg/config/config.go
src/pkg/config/crux_aliases.go
src/pkg/dashboard/settings_parity_allowlist.txt
#17040 ✨ agents: disable CLI auto-memory by default and add cli_memory.clear_on_kick CONFLICT src/crux/agent/cli_memory.go
src/crux/agent/cli_memory_test.go
src/crux/agent/manager_homes.go
src/crux/config/agent_config.go
src/crux/config/cli_memory.go
src/internal/settingsparity/settingsparity.go
src/internal/settingsparity/settingsparity_test.go
src/internal/tools/settingsparity/main_test.go
src/pkg/config/cli_memory_test.go
src/pkg/config/config.go
src/pkg/dashboard/settings_parity_allowlist.txt
#17073 🌱 contributor-nudge once per PR+reason; fold origin notes into status; marker ratchet same files src/pkg/config/config.go

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Hive status — updated in place; edits do not notify. Full history is in the Activity Monitor.

@clubanderson this PR is held at stage/071-needs-author and the hive will not merge it yet.

Failing checks:

  • coverage

Next: the hive does not push to your branch. Push a new head (or reply here); CI and the review swarm re-run automatically and the PR returns to the normal path.

…tingsparity tool fixture gains the two cli_memory leaves

Signed-off-by: Andrew Anderson <andy@clubanderson.com>
@clubanderson
clubanderson merged commit c649246 into v5 Nov 7, 2026
80 of 81 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the feat/agent-cli-memory-config branch November 7, 2026 20:05
@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

Thank you for your contribution! Your PR has been merged.

We'd love to hear how your experience was: share feedback

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

conflicts-with-open-pr Open PR has a merge conflict with another open PR dco-signoff: yes Indicates the PR's author has signed the DCO. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

✨ agents: disable CLI auto-memory by default and add clear_memory_on_kick

1 participant