feat(acp): --no-memory flag to disable NIP-AE core injection#611
Merged
Conversation
Adds a --no-memory / SPROUT_ACP_NO_MEMORY operator opt-out for the ACP
harness's NIP-AE agent core memory injection path.
When set:
* the per-session core engram fetch + decrypt + render in pool.rs is
skipped entirely (no relay request, no timeout window),
* state.core_sections stays empty for every channel,
* format_prompt renders no [Agent Memory — core] section.
When unset (default), behavior is unchanged from the existing NIP-AE
flow: best-effort fetch with a 3s bound, fail-open on transport or
decrypt errors, optional onboarding nudge on confirmed absence.
The sprout mem CLI and the relay's acceptance of kind:30174 engrams are
unaffected by this flag — it is purely a prompt-time injection toggle
in the ACP harness, mirroring the existing --no-presence / --no-typing
opt-out convention.
* config.rs: --no-memory clap arg + memory_enabled: bool on Config
(default true), included in summary() and the test-helper default.
* pool.rs: memory_enabled added to PromptContext; the is_new_session
fetch gate now also checks ctx.memory_enabled.
* lib.rs: wire config.memory_enabled into PromptContext; emit an
info log at startup when injection is disabled so operators see it
in the agent log.
* config.rs tests: default-true, summary-includes-memory=true,
summary-reflects-memory=false.
cargo fmt / cargo clippy -p sprout-acp --all-targets -- -D warnings /
cargo test -p sprout-acp --lib all green (269 tests, 3 new included).
Signed-off-by: Tyler Longwell <tlongwell@squareup.com>
1aba7df to
7567f66
Compare
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.
Adds an operator opt-out for the ACP harness's NIP-AE agent core memory injection path, mirroring the existing
--no-presence/--no-typingconventions.Flag
--no-memory/SPROUT_ACP_NO_MEMORYEffect when set
pool.rs: the per-session core engram fetch + decrypt + render is skipped entirely. No relay request, no timeout window.state.core_sectionsstays empty for every channel.format_promptrenders no[Agent Core Memory]section.infoline at targetengram::coreso operators see the toggle is engaged.What this flag does not touch
sprout memCLI — unaffected, still works.kind:30174engrams — unaffected.This is purely a prompt-time injection toggle inside the ACP harness.
Why this shape
Tyler asked for one flag,
--no-memory. The lookup itself already fails gracefully (transport / decrypt / parse / timeout →None, no section); this flag sits on top of that fallback so an operator can fully turn off the path even when it would otherwise succeed. Mirrors how--no-presence/--no-typingare wired (clap arg →*_enabled: boolonConfig→ field onPromptContext→ gate at the call site).Diff
crates/sprout-acp/src/config.rs--no-memoryclap arg +memory_enabled: boolfield onConfig(defaulttrue); included insummary(); updated test-helper default; 3 new unit testscrates/sprout-acp/src/pool.rsmemory_enabled: boolonPromptContext; gate theis_new_sessionfetch block onctx.memory_enabledcrates/sprout-acp/src/lib.rsconfig.memory_enabledinto thePromptContextbuilder; emittracing::info!at startup when disabledTotal: 3 files, +74 / −2.
Verification
Behavior matrix
memory_enabledtrue(default)false(--no-memoryset)[Agent Core Memory]Targeting
Based on PR #593 (
sami/nip-ae-minimal), since that PR has not yet merged tomain. Should be merged into #593's branch before #593 lands, so the flag ships in the same release as the feature it gates.