Skip to content

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

Closed
Karibhou wants to merge 2 commits into
hivecommons:v5from
Karibhou:feat/cli-memory-17032
Closed

Karibhou wants to merge 2 commits into
hivecommons:v5from
Karibhou:feat/cli-memory-17032

Conversation

@Karibhou

@Karibhou Karibhou commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

🐝 Hive Agent: contributor | SHA: 6cb2a1c02

— hive: backend=omp model=anthropic/claude-opus-5-5 omp=omp/18.18.0

…_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: hivecommons#17032
Hive-Plan: hivecommons#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>
@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 clubanderson 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
@hivecommons-hive

Copy link
Copy Markdown
Contributor

@Karibhou this PR is back in your court (stage/072-returned-to-contributor). The hive will not merge it until the head changes.

Failing checks:

  • crux-file-size-ratchet

Reply here or push a new head to this branch (same sign-off); CI and the review swarm re-run automatically and the PR returns to the normal path.

Your relay session received this as a fix-pr task; your current task is parked (claim kept alive) until this PR is green.

…17032)

Signed-off-by: Karibhou <Karibhou@users.noreply.github.com>
@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
#17073 🌱 contributor-nudge once per PR+reason; fold origin notes into status; marker ratchet same files src/docs/operator-reference/README.md
src/pkg/config/config.go
#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

Choose a reason for hiding this comment

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

Decision needed: @clubanderson should decide which of #17040 (this PR) and #17055 lands for #17032 — both add the same agents.cli_memory.{auto_memory,clear_on_kick} keys with different mechanisms, so only one can merge.

This PR and #17055 both implement #17032 and conflict on the same config surface. Both add agents.cli_memory with the keys auto_memory and clear_on_kick, a new src/crux/agent/cli_memory.go, a src/crux/config/cli_memory.go, settings-parity leaves and the dashboard allowlist entry. I read both diffs in full; they are the same change by intent and config shape, but not the same code, so merging both is impossible and merging either closes the other.

Concrete differences I verified:

#17040 (this) #17055
Config type AutoMemory bool (src/crux/config/cli_memory.go:19) — a per-agent block cannot inherit the fleet value AutoMemory *bool (:23), nil inherits
Claude disable seeds "autoMemoryEnabled": false into settings.json, merge-only (src/crux/agent/cli_memory.go:31) CLAUDE_CODE_DISABLE_AUTO_MEMORY=1 in the launch env (:34)
Codex adds memories = false only if no operator value exists (:89) pins memories = <policy> and overwrites an existing line (:68)
Copilot CLI nothing seeded — body says there is no local switch overwrites memory in per-agent ~/.copilot/settings.json (:136)
Store discovery for the wipe Lstat-walks for symlink bridges and skips shared trees (:213) uses the perAgentCLIHomes specs from #17039 (:176)

Status: #17039 merged to v5 as 943d807 ten minutes ago, so ~/.claude/~/.gemini are real per-agent dirs on v5 now. That removes the symlink-bridge case this PR's cliMemoryStores was defending against, and it means #17055 needs its base retargeted from fix/agent-memory-isolation to v5 (it currently shows CONFLICTING).

I have not closed anything; whichever one is preferred, the other should be closed with a pointer so #17032 does not get two fixes.

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

@hivecommons-hive

Copy link
Copy Markdown
Contributor

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

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

Read the new src/crux/agent/cli_memory.go against the v5 tree and the callers it hooks (manager_launch.go, manager_kick.go:272, manager_homes.go:103, pkg/config/config.go EnabledAgents). The mechanics look correct to me:

  • seedJSONFile (manager_homes.go:582-611) is merge-only, so the autoMemoryEnabled seed never shadows an operator value; the shared-settings path for interactive Claude agents is the same one ensureClaudeRemoteControlDefault (claude_remote_control.go:65-77) already uses. autoMemoryEnabled is a documented Claude Code user-settings key.
  • cliMemoryStores refuses anything reached through a symlink or a shared HOME (agentPrivateDir, the UID <= 0 || home == sharedAgentHome check), and the remover runs rm -rf via su-exec as the agent UID — so the wipe cannot exceed what the agent itself could delete.
  • Fleet stamping via EnabledAgents() matches the SessionRecycle precedent, and every reconcile path in pkg/dashboard already goes through EnabledAgents().

One gap against #17032 (the issue asks for "Copilot CLI / Gemini equivalents where one exists"): the PR states Copilot CLI has no local switch (cli_memory.go:21-23; runtime-and-quota.md row "Copilot CLI | none … use /memory off"). It does — copilot help config lists:

memory: whether to enable agentic memory (cross-session fact recall); defaults to true. Toggle with /memory on|off (writes this setting). When false, the agent will not store or recall memories.

/memory off writes "memory": false into the Copilot config.json, which hive already bridges per-agent → shared (interactive_home.go:125). So under the default auto_memory: false, Copilot-backed agents keep cross-session memory on, while Claude/Codex agents have it off. Seeding {"memory": false} into that bridged config.json with the same merge-only seedJSONFile would close it fleet-wide, consistent with the Claude seed; the docs row would then need updating too. Where that memory is stored (GitHub vs disk) does not change whether the recall switch is local.

Not a blocker on the parts that are here — suggesting it land as a follow-up commit on this PR rather than a separate issue, since the table and the "nothing seeded" comment both state the opposite.

@hivecommons-hive

Copy link
Copy Markdown
Contributor

@Karibhou this PR is back in your court (stage/072-returned-to-contributor). The hive will not merge it until the head changes.

Review asks:

  • the review swarm requested changes

Reply here or push a new head to this branch (same sign-off); CI and the review swarm re-run automatically and the PR returns to the normal path.

Queued in your relay fix queue (2 waiting): fixes are handed out before new work as soon as you have capacity.

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Supersede failed: the hive could not open a fresh PR with these commits. Merging v5 into the copy branch hive/adopt-17040 (at a186c76fb2fb) stopped on a git conflict, so no superseding PR was opened and this PR stays open.

Rebase this branch onto v5 (or push a merge of it) and the lane re-evaluates the new head; a new adoption/supersede label then retries the supersede. Reason: supersede-conflict.

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Superseded by hive: re-authored as #17112 with the same commits and sign-off because CI stayed red and the author was unavailable. This PR is closed; if #17112 fails, hive reopens it.

@hivecommons-hive hivecommons-hive Bot added the hive/superseded Closed by Hive: a different merged PR already landed this change label Nov 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dco-signoff: yes Indicates the PR's author has signed the DCO. hive/superseded Closed by Hive: a different merged PR already landed this change 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