How to Configure Memory Consent Behavior¶
Step-by-step guide fer customizin' how amplihack handles memory configuration consent prompts.
Quick Reference¶
| Task | Command |
|---|---|
| Skip prompt in CI/CD | export AMPLIHACK_MEMORY_AUTO_ACCEPT=true |
| Disable auto-updates | export AMPLIHACK_MEMORY_AUTO_REJECT=true |
| Change timeout | export AMPLIHACK_MEMORY_PROMPT_TIMEOUT=60 |
| Force interactive mode | export AMPLIHACK_FORCE_INTERACTIVE=true |
| Skip memory config entirely | export AMPLIHACK_SKIP_MEMORY_CONFIG=true |
Common Scenarios¶
Scenario 1: Always Auto-Accept in CI/CD¶
Goal: Yer CI/CD pipeline should never wait fer user input.
Steps:
- Add environment variable to yer CI configuration:
- Verify the setting works:
Result: No prompt appears, recommended settings applied automatically.
Scenario 2: Increase Timeout for Slow Responders¶
Goal: Ye need more than 30 seconds to decide.
Steps:
- Set custom timeout (in seconds):
- Launch amplihack:
- Ye now have 120 seconds to respond to the prompt.
Permanent Setup (add to yer shell profile):
Result: Prompt waits 120 seconds instead of default 30.
Scenario 3: Disable Auto-Updates on Personal Machine¶
Goal: Ye want to keep current memory settings, no changes.
Steps:
- Set rejection flag:
- Launch amplihack:
- Memory configuration skipped, existing NODE_OPTIONS preserved.
Permanent Setup:
Result: No prompt, no changes to memory settings.
Scenario 4: Test Interactive Prompt in Docker¶
Goal: Force interactive mode even in Docker container.
Steps:
- Create Dockerfile with interactive flag:
FROM python:3.11
RUN pip install amplihack
# Force interactive mode
ENV AMPLIHACK_FORCE_INTERACTIVE=true
CMD ["amplihack"]
- Run container with stdin attached:
- Prompt appears even in Docker.
Result: Interactive prompt works in containerized environments.
Scenario 5: Custom Default for Non-Interactive¶
Goal: In non-interactive mode, ye want to reject (not accept) by default.
Steps:
- This requires code-level configuration. Create a wrapper script:
#!/bin/bash
# amplihack-wrapper.sh
# Detect non-interactive mode
if [ ! -t 0 ]; then
# Non-interactive: reject updates
export AMPLIHACK_MEMORY_AUTO_REJECT=true
fi
# Launch amplihack
exec amplihack "$@"
- Make executable:
- Use wrapper instead of direct amplihack:
Result: Non-interactive sessions reject updates; interactive sessions prompt normally.
Advanced Configuration¶
Per-Project Settings¶
Create a .env file in yer project:
Load before runnin' amplihack:
Or use a tool like direnv:
# Install direnv
brew install direnv # macOS
apt install direnv # Ubuntu
# Create .envrc
echo 'export AMPLIHACK_MEMORY_AUTO_ACCEPT=true' > .envrc
# Allow direnv to load it
direnv allow
# Now amplihack picks up settings automatically
Programmatic Configuration¶
If ye be buildin' tools that use amplihack:
import os
from amplihack.launcher.memory_config import prompt_user_consent
# Set defaults programmatically
os.environ['AMPLIHACK_MEMORY_PROMPT_TIMEOUT'] = '45'
# Build configuration
config = {
'system_ram_gb': 16,
'current_limit_mb': None,
'recommended_limit_mb': 8192
}
# Prompt with custom settings
consent = prompt_user_consent(config)
if consent:
print("User consented to memory update")
# Apply configuration
elif consent is None:
print("Non-interactive mode detected")
# Handle non-interactive case
else:
print("User declined memory update")
# Keep existing settings
Environment Variable Priority¶
When multiple settings conflict, this be the priority order (highest to lowest):
AMPLIHACK_SKIP_MEMORY_CONFIG- Skip entirelyAMPLIHACK_MEMORY_AUTO_REJECT- Reject updatesAMPLIHACK_MEMORY_AUTO_ACCEPT- Accept updatesAMPLIHACK_FORCE_INTERACTIVE- Force prompting- Auto-detection - Default behavior
Example:
# These conflict - SKIP wins
export AMPLIHACK_SKIP_MEMORY_CONFIG=true
export AMPLIHACK_MEMORY_AUTO_ACCEPT=true
amplihack # Memory config skipped entirely
Testing Your Configuration¶
Verify Environment Variables¶
# Check what's set
env | grep AMPLIHACK_MEMORY
# Expected output (example):
# AMPLIHACK_MEMORY_AUTO_ACCEPT=true
# AMPLIHACK_MEMORY_PROMPT_TIMEOUT=60
Test Prompt Behavior¶
# Test with verbose output
AMPLIHACK_DEBUG=true amplihack
# Watch for messages like:
# "Non-interactive mode detected - auto-accepting"
# "Timeout: 60 seconds"
# "User consent: True"
Verify Memory Settings Applied¶
# After running amplihack, check NODE_OPTIONS
echo $NODE_OPTIONS
# Should show:
# --max-old-space-size=8192
Troubleshooting¶
Problem: Environment Variable Ignored¶
Symptom: Set AMPLIHACK_MEMORY_AUTO_ACCEPT=true but still prompted.
Check:
- Verify variable is exported:
- Ensure it's set before launching:
# WRONG - variable not in environment
AMPLIHACK_MEMORY_AUTO_ACCEPT=true
amplihack
# RIGHT - exported to environment
export AMPLIHACK_MEMORY_AUTO_ACCEPT=true
amplihack
- Check for typos in variable name (case-sensitive).
Problem: Timeout Not Working¶
Symptom: Set longer timeout but still defaults after 30 seconds.
Check:
- Verify timeout value is numeric:
# WRONG
export AMPLIHACK_MEMORY_PROMPT_TIMEOUT=sixty
# RIGHT
export AMPLIHACK_MEMORY_PROMPT_TIMEOUT=60
-
Check for platform compatibility (Windows vs. Unix).
-
Verify no other process is interfering with stdin.
Problem: Still Prompts in CI/CD¶
Symptom: CI/CD pipeline waits fer input despite auto-accept setting.
Check:
- Verify environment variable in CI config:
# GitHub Actions - correct placement
jobs:
test:
runs-on: ubuntu-latest
env:
AMPLIHACK_MEMORY_AUTO_ACCEPT: true # ✓ Correct
steps:
- run: amplihack
-
Check fer overridin' settings in yer code.
-
Verify amplihack version supports this feature:
See Also¶
- Memory Configuration Consent Feature - Complete feature documentation
- Memory Management Overview - How memory system works
- Environment Variables Reference - All available variables
- CI/CD Integration Guide - Complete CI/CD setup
Last Updated: 2026-01-17 Version: 1.0.0 Status: Production