How to Enable and Tune the Auto-Improvement Scheduler for Wiki Learning in ai-memory

Enable the auto-improvement scheduler by setting auto_improve.scheduler.enabled = true in ai-memory.toml, then tune performance via interval_secs and max_concurrent to balance LLM load against review responsiveness.

The auto-improvement scheduler in akitaonrails/ai-memory automates wiki learning by periodically triggering LLM-driven reviews of completed sessions. This subsystem, implemented in the Rust core of the repository, converts session insights into proposed wiki edits without manual intervention. Proper configuration of the [auto_improve] section in your configuration file ensures optimal balance between automation speed, resource consumption, and content safety.

Understanding the Auto-Improvement Scheduler Configuration

The scheduler’s behavior is controlled entirely by the [auto_improve] section in ai-memory.toml. These settings determine how often the system scans for completed sessions, how many reviews run in parallel, and whether proposed changes require human approval.

Core Scheduler Controls

  • auto_improve.scheduler.enabled – Turns the background reviewer on or off. When set to true, the server automatically launches a review run for every session that finishes without an existing auto_improve run. Defaults to false.
  • auto_improve.scheduler.interval_secs – Defines how often the scheduler wakes up to scan for new completed sessions. Defaults to 300 seconds (5 minutes).
  • auto_improve.scheduler.max_concurrent – Limits the maximum number of parallel auto-improve runs to prevent CPU and LLM provider saturation. Defaults to 2.

Safety and Approval Settings

  • auto_improve.require_approval – Controls the proposal workflow. When true (default), proposals are stored as pending writes and must be manually approved via CLI or admin UI. When false, proposals are automatically staged and committed to the wiki.
  • auto_improve.proposal_actor – Sets the audit name attached to proposals, typically "auto_improve".

Optional Evaluation Gate

  • auto_improve.eval.enabled – Activates an additional LLM validation layer before proposals are staged. Useful for high-risk deployments. Defaults to false.
  • auto_improve.eval.threshold – Specifies the numeric score cutoff for the evaluation gate. Proposals scoring below this value are discarded. Defaults to 0.7.

Enabling the Auto-Improvement Scheduler

To activate automatic wiki learning, modify your configuration file and restart the server.

  1. Open or create ai-memory.toml in the repository root.

  2. Add the [auto_improve.scheduler] section:

[auto_improve.scheduler]
enabled = true          # Activate background review

interval_secs = 600     # Run every 10 minutes

max_concurrent = 4      # Allow up to 4 simultaneous runs
  1. Restart the ai-memory server to load the new configuration.

Once active, the server invokes the internal memory_auto_improve tool for each newly finished session. This tool is implemented in crates/ai-memory-store/src/auto_improve.rs and handles the LLM-driven analysis that generates wiki edit proposals.

Tuning the Auto-Improvement Scheduler for Production

Fine-tuning the scheduler ensures efficient resource usage while maintaining responsive knowledge capture.

Optimizing Review Frequency

Decrease interval_secs to make the system more responsive—values between 60 and 300 seconds work well for high-volume environments. Be aware that shorter intervals increase load on your LLM provider and may incur higher API costs.

Limiting Concurrent LLM Calls

Adjust max_concurrent based on your infrastructure. For machines with limited resources or strict rate limits, keep this value at 1 or 2. For dedicated servers with high-throughput LLM access, values up to 4 or 6 reduce backlog during peak usage.

Configuring Proposal Approval Workflows

Set require_approval = false to enable fully autonomous wiki updates. This mode stages and commits proposals automatically without human intervention. For regulated or safety-critical environments, retain the default true value to enforce manual review through the crates/ai-memory-wiki/src/wiki.rs functions write_auto_improve_sidecar and approve_auto_improve_proposal.

Enabling the Evaluation Gate

For high-stakes deployments, activate auto_improve.eval.enabled and set a strict threshold (e.g., 0.8 or 0.9). This triggers an additional LLM-based validation step that scores proposal quality before staging, discarding low-confidence suggestions automatically.

Manual Review and Approval Workflows

Even with the scheduler disabled, you can trigger or manage reviews manually via CLI or HTTP API.

Triggering Manual Reviews

Test the auto-improvement logic or process specific sessions on demand:


# Review the newest completed session without an existing auto-improve run

ai-memory auto-improve

# Target a specific session by UUID

ai-memory auto-improve --session-id 3f7c9e2a-b4d1-4f6e-a9e3-c5d2b8f7e1a9

Managing Pending Proposals

When require_approval is enabled, approve proposals through the administrative interface:


# List pending proposals generated by the scheduler

ai-memory admin list-proposals --actor auto_improve

# Approve a specific proposal for staging

ai-memory admin approve-proposal <proposal-id>

Runtime Configuration via Admin API

Modify scheduler settings without restarting by posting to the admin endpoint:

curl -X POST http://localhost:49374/admin/set-config \
  -H "Authorization: Bearer $AI_MEMORY_AUTH_TOKEN" \
  -d '{
        "auto_improve": {
          "scheduler": { "enabled": true, "interval_secs": 300 },
          "require_approval": false
        }
      }'

Note that while runtime changes take effect immediately, persistent configuration should still be saved to ai-memory.toml to survive restarts.

Summary

  • Enable the auto-improvement scheduler by setting auto_improve.scheduler.enabled = true in ai-memory.toml and restarting the server.
  • Tune responsiveness and resource usage via interval_secs (frequency) and max_concurrent (parallelism).
  • Control safety with require_approval to gate automatic commits, and use eval.enabled with custom thresholds for high-confidence filtering.
  • Operate manually using ai-memory auto-improve CLI commands or the admin API when automated scheduling is inappropriate.

Frequently Asked Questions

Does enabling the auto-improvement scheduler require a server restart?

Yes. All [auto_improve] configuration values are read at server startup. After modifying ai-memory.toml, you must restart the ai-memory process for changes to take effect. Runtime adjustments via the admin API are temporary and reset on restart unless persisted to the configuration file.

How can I prevent the scheduler from overwhelming my LLM provider?

Set max_concurrent to a low value (1 or 2) and increase interval_secs to 600 seconds or higher. This limits parallel API calls and spreads the review load over time. Monitor your provider’s rate limit headers and adjust these values based on your specific quota.

What happens if require_approval is set to false?

Proposals generated by the scheduler in crates/ai-memory-store/src/auto_improve.rs are automatically staged and committed to the wiki without human review. While this enables fully autonomous knowledge management, it risks introducing unverified content. Use this setting only in low-risk environments or when the evaluation gate is enabled with a high threshold.

Can I run auto-improvement on historical sessions?

Yes. Use the manual CLI command ai-memory auto-improve without flags to target the most recent unprocessed session, or specify a historical session UUID with --session-id. This bypasses the scheduler’s interval-based scanning and immediately triggers the memory_auto_improve tool for that specific session.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →