Skip to content

feat(acp): --no-memory flag to disable NIP-AE core injection#611

Merged
tlongwell-block merged 1 commit into
sami/nip-ae-minimalfrom
dawn/no-memory-flag
May 18, 2026
Merged

feat(acp): --no-memory flag to disable NIP-AE core injection#611
tlongwell-block merged 1 commit into
sami/nip-ae-minimalfrom
dawn/no-memory-flag

Conversation

@tlongwell-block
Copy link
Copy Markdown
Collaborator

Adds an operator opt-out for the ACP harness's NIP-AE agent core memory injection path, mirroring the existing --no-presence / --no-typing conventions.

Flag

  • --no-memory / SPROUT_ACP_NO_MEMORY
  • Default: off (memory injection enabled — current behavior is unchanged when the flag is not set)

Effect when set

  • pool.rs: the per-session core engram fetch + decrypt + render is skipped entirely. No relay request, no timeout window.
  • state.core_sections stays empty for every channel.
  • format_prompt renders no [Agent Core Memory] section.
  • Startup logs an info line at target engram::core so operators see the toggle is engaged.

What this flag does not touch

  • The sprout mem CLI — unaffected, still works.
  • The relay's acceptance of kind:30174 engrams — unaffected.
  • The on-relay engram itself — never read, never overwritten.

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-typing are wired (clap arg → *_enabled: bool on Config → field on PromptContext → gate at the call site).

Diff

file change
crates/sprout-acp/src/config.rs --no-memory clap arg + memory_enabled: bool field on Config (default true); included in summary(); updated test-helper default; 3 new unit tests
crates/sprout-acp/src/pool.rs memory_enabled: bool on PromptContext; gate the is_new_session fetch block on ctx.memory_enabled
crates/sprout-acp/src/lib.rs wire config.memory_enabled into the PromptContext builder; emit tracing::info! at startup when disabled

Total: 3 files, +74 / −2.

Verification

cargo fmt -p sprout-acp -- --check          # clean
cargo clippy -p sprout-acp --all-targets -- -D warnings   # clean
cargo test -p sprout-acp --lib              # 272 passed (269 existing + 3 new)
cargo run -p sprout-acp -- --help | rg no-memory          # flag visible

Behavior matrix

memory_enabled result
true (default) unchanged from PR #593 base: fetch with 3s bound, fail-open, optional onboarding nudge
false (--no-memory set) no fetch, no section, no nudge — agent never sees [Agent Core Memory]

Targeting

Based on PR #593 (sami/nip-ae-minimal), since that PR has not yet merged to main. Should be merged into #593's branch before #593 lands, so the flag ships in the same release as the feature it gates.

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>
@tlongwell-block tlongwell-block merged commit 995baa1 into sami/nip-ae-minimal May 18, 2026
14 of 15 checks passed
@tlongwell-block tlongwell-block deleted the dawn/no-memory-flag branch May 18, 2026 21:13
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