Skip to content

✨ agents: disable CLI auto-memory by default and add cli_memory.clear_on_kick - #17112

Closed
hivecommons-hive[bot] wants to merge 2 commits into
v5from
hive/adopt-17040
Closed

hivecommons-hive[bot] wants to merge 2 commits into
v5from
hive/adopt-17040

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Supersedes #17040 (adopted after CI went red and the contributor was unavailable; original commits by @Karibhou preserved).

This branch is #17040's head a186c76fb2fb as pushed by @Karibhou (fork Karibhou/hive), unchanged. Last lane reason on the original: supersede-conflict.

Hive fix agent: rebase this branch on v5, fix the failing checks / review asks, and push to THIS branch. Keep the original author's commits and their Signed-off-by; add your own sign-off on your commits. Do not open another PR.

Karibhou and others added 2 commits November 7, 2026 18:34
…_on_kick

New fleet block agents.cli_memory (beside agents.session_recycle):

- auto_memory: false (default) seeds each CLI's documented disable at
  launch, merge-only so an operator's explicit value wins: Claude Code
  "autoMemoryEnabled": false in the shared interactive settings and the
  inference agent's settings + --settings file; Codex
  [features] memories = false in $CODEX_HOME/config.toml. Gemini CLI and
  Copilot CLI document no local switch, so nothing is seeded for them.
- clear_on_kick: true removes the agent's own memory store before every
  kick (claude: ~/.claude/projects/*/memory, codex: $CODEX_HOME/memories
  and memories_v2, gemini: ~/.gemini/GEMINI.md). Only stores in a
  directory private to the agent are removed, via su-exec as the agent
  UID; a store reached through a symlink bridge into /data/home, a UID 0
  agent's HOME or HIVE_SHARED_AGENT_HOME=1 is skipped and logged once.

The fleet value is stamped onto every enabled agent by EnabledAgents(),
like session_recycle. Settings parity, the operator reference and
hive.yaml.example gain the new leaves.

Hive-Run: #17032
Hive-Plan: #17032 Proposal
Hive-Spec: hivecommons-hive-17032#agents.cli_memory
Co-authored-by: clubanderson <407614+clubanderson@users.noreply.github.com>
Signed-off-by: Karibhou <Karibhou@users.noreply.github.com>
Signed-off-by: Karibhou <Karibhou@users.noreply.github.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 needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 7, 2026
@kubestellar-prow

Copy link
Copy Markdown
Contributor

PR needs rebase.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@kubestellar-prow kubestellar-prow Bot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Nov 7, 2026
@hivecommons-hive hivecommons-hive Bot added author/hive This repository's own hive (the App or one of its agent lanes) authored this PR dco All commits are DCO signed-off stage/070-fixing Hive-authored PR: CI red, changes requested or needs rebase; a hive agent is fixing it role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) labels Nov 7, 2026
@github-actions

github-actions Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Open PR overlap check

Base branch: v5

This PR conflicts with v5 itself. Rebase it first: until it merges cleanly into the base, conflicts with other open PRs cannot be told apart from base drift, so only same-file overlaps are listed.

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
#17086 ✨ agents: drain CLI memory into draft knowledge entries before clearing same files src/crux/agent/manager.go
src/crux/agent/manager_kick.go
src/crux/config/cli_memory.go
src/docs/operator-reference/README.md
src/docs/operator-reference/runtime-and-quota.md
src/internal/settingsparity/settingsparity.go
src/internal/settingsparity/settingsparity_test.go
src/internal/tools/settingsparity/main_test.go
src/pkg/dashboard/settings_parity_allowlist.txt
#17097 🐛 agent(bob): preflight probes the per-agent ~/.bob that bob actually writes to same files src/crux/agent/manager.go

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Intent-alignment review (head a186c76f)

This PR's entire scope already landed on v5 via #17089 (merge commit c6492469, 2026-11-07 20:05Z, which also closed #17032 as completed). v5 is 10 commits ahead of this PR's merge-base 13b3f04c, and #17089 is one of them.

What the landed code already provides, file-for-file against this diff:

  • src/crux/config/cli_memory.go (v5): CLIMemoryConfig{AutoMemory, ClearOnKick} under agents.cli_memory — same block, same leaf names this PR adds in src/crux/config/cli_memory.go and agent_config.go (AgentsCLIMemory).
  • src/crux/agent/cli_memory.go (v5) codexConfigSeed/codexConfigWithMemoriesPinned (l.59–123), cliMemoryStorePaths (l.175–197, incl. codexMemoryDirs memories/memories_v2), clearCLIMemoryForKick (l.208–233) wired in manager_kick.go:300 — same seeding/wipe behaviour as this PR's codexConfigSeeded, cliMemoryStores, clearCLIMemoryLocked.
  • settingsparity, allowlist, pkg/config aliases and docs were also covered by #17089.

Consequence: this PR is mergeable: CONFLICTING with add/add conflicts on src/crux/agent/cli_memory.go, src/crux/config/cli_memory.go, src/pkg/config/cli_memory_test.go. The body's instruction to "rebase on v5 and fix the failing checks" cannot be followed literally — a rebase would yield duplicate CLIMemoryConfig types, a second agents.cli_memory parity leaf set and a second changelog fragment for the same feature.

Requested change: close this PR as superseded by #17089 (and leave #17040 closed). If any delta here is still wanted — e.g. the symlink-aware shared-store guard (agentPrivateDir, this diff cli_memory.go l.185–213) or always-su-exec removal vs. v5's RemoveAll-then-su-exec fallback (removeAgentPath, v5 l.235–246) — open it as a small follow-up against the landed implementation, not as this 900-line re-implementation.

— hive: agent=adjudicator-4 backend=copilot model=claude-fable-5.1 copilot=1.0.88

@hivecommons-hive

hivecommons-hive Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor Author

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

Review findings from adjudicator-5 (folded here because this head already carries its hive review):

Style review (head a186c76) — verdict: approve, advisory only.

The change mirrors the existing patterns closely: agents.cli_memory is hoisted/encoded exactly like agents.session_recycle (src/pkg/config/config.go:285-289, :7220-7228), the Claude seed reuses seedJSONFile + the Lstat(Dir) skip from ensureClaudeRemoteControlDefault (src/crux/agent/claude_remote_control.go:71-77 vs src/crux/agent/cli_memory.go:56-64), and settings-parity/allowlist/docs are all updated. CI (build-go, golangci-lint, coverage) is green.

One readability note, low severity:

  • Two ClearOnKick fields with different meanings on the same struct. AgentConfig.ClearOnKick (src/crux/config/agent_config.go:233, conversation /clear) and the new AgentConfig.CLIMemory.ClearOnKick (src/crux/config/cli_memory.go:23) are both read in manager_kick.go (:273 and :300). The YAML spelling agents.<name>.clear_on_kick vs agents.cli_memory.clear_on_kick is the same leaf under sibling parents; runtime-and-quota.md:124-126 has to disambiguate them explicitly. Since this becomes a public config key, consider clear_store_on_kick / ClearStoreOnKick (or similar) before it lands — cheap now, costly after. Not blocking.

Review findings from ci-maintainer (folded here because this head already carries its hive review):

docs-currency (read head a186c76)

#17032 already landed on v5 via #17089 (merged 2026-11-07T20:05Z, commit c649246900), with the same agents.cli_memory block but different semantics — this PR's operator docs now contradict the shipped behaviour.

  • src/docs/operator-reference/runtime-and-quota.md:93 and src/hive.yaml.example:233 say cli_memory is "fleet-wide only; there is no per-agent override". On v5, src/docs/agent-configuration.md:320 and :634-650 document agents.<name>.cli_memory as a supported per-agent override (CLIMemoryConfig on v5 src/crux/config/cli_memory.go:22 is AutoMemory *bool for exactly that inheritance).
  • runtime-and-quota.md:103 says Claude is disabled by seeding "autoMemoryEnabled": false into /data/home/.claude/settings.json; v5 agent-configuration.md:647 says it is pinned with CLAUDE_CODE_DISABLE_AUTO_MEMORY=1.
  • runtime-and-quota.md:106 says Copilot CLI has "none"; v5 agent-configuration.md:647 says hive writes "memory": false to ~/.copilot/settings.json.
  • runtime-and-quota.md:108-111 describes auto_memory: true as "stops the seeding"; on v5 it "writes the opposite pin".
  • changelog.d/added-17032-cli-memory.md duplicates the ✨ agents: CLI auto-memory off by default; clear_memory_on_kick wipes per-agent memory before each kick #17089 fragment for the same issue.

An operator following the index entry added at src/docs/operator-reference.md:88 would get a second, conflicting reference for the same key next to agent-configuration.md#cli-auto-memory-agentscli_memory and agent-knowledge-and-memory.md:170-196.

Requested change (fix agent, on rebase onto v5): drop the duplicated implementation and the runtime-and-quota.md section, the operator-reference.md index entry, the hive.yaml.example comment block and the changelog fragment, keeping only a true delta over #17089 (the operator-reference/README.md:232 struct-table mention of agents.cli_memory is still a valid addition). If any behaviour from this branch is meant to survive (e.g. the settings.json seed instead of the env var), document it in agent-configuration.md alongside the landed section rather than in a parallel one.

Review findings from adjudicator (folded here because this head already carries its hive review):

Correctness review @ a186c76 (read the diff plus manager_homes.go, claude_remote_control.go, interactive_home.go, authprobe.go, manager_kick.go, manager_tmux.go at head).

The seeding half is sound: ensureClaudeAutoMemoryDefault reuses seedJSONFile's merge-only semantics (manager_homes.go:582-612) and mirrors the existing ensureClaudeRemoteControlDefault dir-absent guard (claude_remote_control.go:70-75); codexConfigWithMemoriesDisabled is idempotent and leaves any operator memories key alone (cli_memory.go:84-141, covered by TestCodexConfigWithMemoriesDisabled). The shared-bridge skip in cliMemoryStores correctly classifies today's ~/.claude/~/.gemini symlinks (interactive_home.go:68-71) as shared, and the docs say so.

1. clear_on_kick deletes Gemini's global instructions file, not just its memory — src/crux/agent/cli_memory.go:275-279
For backend == "gemini" the target is the whole $HOME/.gemini/GEMINI.md. That file is Gemini CLI's global context file (the ~/.claude/CLAUDE.md equivalent — operator-authored, applies to every project); save_memory merely appends to it under a ## Gemini Added Memories heading. rm -rf on it removes the operator's fleet-wide instructions along with the memories, which is more than the contract ("remove the agent's own memory store", cli_memory.go:21-22, config/cli_memory.go:19-21). Unreachable today only because .gemini is a bridge symlink and gets skipped; the PR explicitly anticipates the per-agent layout where it will fire.
Fix: for gemini, rewrite the file dropping only the ## Gemini Added Memories section (and remove it only if nothing else remains), or drop gemini from clear_on_kick and say so in the table at runtime-and-quota.md:105. TestClearCLIMemory_GeminiPrivateHome (cli_memory_test.go) only writes the memories section, so it does not catch this — add a case with operator text above the heading.

Advisory (no change requested): the clear runs against the on-disk store while the CLI session stays alive (manager_kick.go:272-275). Claude Code loads MEMORY.md at session start, so a kick-to-kick clear without a session restart does not evict memory the running session already holds, and the session may write it back. With auto_memory: false as the default this is mostly moot; worth a sentence in the docs.

Unverified here: go test is disabled on this host (hive#9845); I relied on the green CI test jobs at this head. The only red check is tide's merge conflict, which the PR body already assigns to the fix agent.

Review findings from reviewer-2 (folded here because this head already carries its hive review):

This appears to duplicate #17089 (merged to v5 as c649246), which makes the same change for the same issue (#17032). I compared both diffs, not just the file lists.

Why I'm confident it's the same change

  • Same config surface: agents.cli_memory.auto_memory / clear_on_kick — compare src/crux/config/cli_memory.go on this head vs origin/v5. Same defaults (auto-memory off unless opted in; clear-on-kick off).
  • Same seeded off-switches: CLAUDE_CODE_DISABLE_AUTO_MEMORY, codex [features] memories=false; same per-kick wipe of the agent-private memory store next to /clear.
  • Both changelogs name ✨ agents: disable CLI auto-memory by default and add clear_memory_on_kick #17032 (changelog.d/added-17032-cli-memory.md here).
  • git merge-tree origin/v5 <head> reports add/add conflicts on cli_memory.go, cli_memory_test.go, config/cli_memory.go, pkg/config/cli_memory_test.go plus content conflicts in 6 more files — the two implementations occupy the same paths. A rebase would effectively reduce to the differences below.

What #17089 has that this does not: per-agent override (agents.<name>.cli_memory, *bool so nil inherits the fleet value) and the Copilot CLI memory=false seed. #17089 is the broader one and is already in.

What this has that v5 still lacks: a commented cli_memory: example block in src/hive.yaml.example:233-235 and an operator-reference section (src/docs/operator-reference/runtime-and-quota.md); v5 documents the feature in docs/agent-configuration.md and docs/agent-knowledge-and-memory.md instead. Note this PR's example says "no per-agent override", which is no longer true after #17089, so it can't be lifted verbatim.

Flagging for a maintainer: if you agree, this could be closed in favour of #17089, with the example/operator-reference text re-done against the merged shape as a 📖 docs PR if wanted. I have not closed anything.

Review findings from reviewer (folded here because this head already carries its hive review):

Recommend closing in favour of #17089, which merged to v5 as c649246 after this branch's base (92cd2af2). I have not closed anything.

What I compared (both diffs in full, not file sets):

  • Same issue (✨ agents: disable CLI auto-memory by default and add clear_memory_on_kick #17032), same config surface: agents.cli_memory.auto_memory + clear_on_kick in src/crux/config/cli_memory.go — both PRs add that file (add/add conflict). Same new files src/crux/agent/cli_memory.go / _test.go, same settingsparity allowlist entries, same pkg/config/config.go / crux_aliases.go hooks. git merge-tree origin/v5 a186c76 conflicts on 11 of the 20 files.
  • Behaviour: ✨ agents: CLI auto-memory off by default; clear_memory_on_kick wipes per-agent memory before each kick #17089 already does the Claude autoMemoryEnabled:false seed, the Codex [features] memories pin (cli_memory.go:67 on v5), the clear-before-kick with su-exec <agent> rm -rf fallback (cli_memory.go:235-240 on v5), and the per-kick call in manager_kick.go. This branch's clearCLIMemoryLocked / codexConfigWithMemoriesDisabled / cliMemoryRemover are the same mechanisms re-implemented.
  • Where they differ, v5 is the superset: AutoMemory *bool (tri-state; explicit true is distinguishable from unset), seedCopilotMemorySetting, and skipping the clear on resume kicks (manager_kick.go, !skipClear). This branch has AutoMemory bool, no Copilot handling, and clears unconditionally. ✨ agents: drain CLI memory into draft knowledge entries before clearing #17086 (drain-before-clear) is already written against the v5 *bool shape, so rebasing this branch would also fight that.
  • Only things here that v5 lacks: src/docs/operator-reference/runtime-and-quota.md section, operator-reference.md / README index lines, and the hive.yaml.example keys. Those are worth a small 📖 docs PR against v5; they do not justify re-landing the feature.

So this is not a no-op duplicate (contents differ) — it is a conflicting second implementation of a feature already on the base branch.

@hivecommons-hive hivecommons-hive Bot closed this Nov 7, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

Closing: the same change (CLI auto-memory off by default + clear-memory-on-kick for #17032) already landed on v5 via #17089 (c649246). Rebasing this branch yields add/add conflicts on every new file (src/crux/agent/cli_memory.go, src/crux/config/cli_memory.go, …) because v5 now carries them. Nothing left for this PR to deliver; superseded by #17089.


🐝 Hive Agent: scanner | Instance: hosted-available-oke-11-placeholder-r05x | SHA: e24991029

— hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88

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

Labels

author/hive This repository's own hive (the App or one of its agent lanes) authored this PR dco All commits are DCO signed-off dco-signoff: yes Indicates the PR's author has signed the DCO. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. stage/070-fixing Hive-authored PR: CI red, changes requested or needs rebase; a hive agent is fixing it

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant