DEVMEMORY_AI
SYSTEM STATUS: OPERATIONAL

The Agentic Memory Layer For AI Coding

Git tracks what changed. DevMemory tracks why. An autonomous background engine documenting prompts, architecture diffs, and security risks.

TERMINAL // DEVMEMORY_WATCHER
dev@potato-pc:~/spaghetti-code$

[ SYSTEM_CAPABILITIES ]

Watcher Daemon

Runs continuously in the background. Detects file edits and git commits to record builds automatically.

Multi-Provider AI

Query Gemini, Claude, OpenAI, or local Ollama models completely offline and credit-free.

Security & Tests

Autonomous Validation and Security sub-agents audit every commit for leaks, risks, and test scenarios.

01. Introduction

Modern AI coding tools like Cursor, Claude Code, and Aider write features at blazing speed. However, they lack long-term memory. After a few days, developers forget why architectural decisions were made, how a feature runs, and what original prompts generated it.

DevMemory AI is an agentic developer tool that automatically captures and documents every AI-generated build. For each completed feature or commit, DevMemory AI creates structured memory files containing:

  • The original developer prompt (the intent behind the change).
  • A summary of exactly what was modified, added, or removed.
  • A Mermaid.js architecture diagram showing data flow and component interactions.
  • A security audit checking for hardcoded keys, logic flaws, and data sanitization risks.
  • A validation plan with test cases, verification steps, and mock inputs.
  • A regeneration prompt you can copy-paste into any AI to recreate the feature from scratch.
THE MEMORY MANIFESTO

Git tracks code. DevMemory tracks intent. Git stores what changed. DevMemory stores why it changed, how it works, and how to reproduce it.

The goal is to make every AI-generated feature understandable, reproducible, searchable, and reusable — even months after it was written.

02. Prerequisites

Before installing DevMemory AI, you need two tools installed on your machine and available in your system PATH. Without these, the CLI will not function.

🟢

Node.js 18+

Version 18.0.0 or higher is required. DevMemory is built on Node.js and distributed via npm.

↗ Download Node.js
📦

Git

Git must be installed and initialized in your project. DevMemory reads git diffs, commit history, and staging areas to analyze your code changes.

↗ Download Git

Verifying Your Installation

Open a terminal and run these commands to confirm both tools are accessible:

TERMINAL
node --version
# Expected output: v18.0.0 or higher

git --version
# Expected output: git version 2.x.x

Node.js includes npm by default. You can verify npm is available by running npm --version.

03. Installation

DevMemory AI is distributed as a global npm package. Installing it globally registers the devmemory command system-wide.

⚠ IMPORTANT PRIVILEGES NOTE
Because DevMemory AI registers global binaries and configures background watcher daemons (launchd plist, systemd user services, or startup batch files), you must run the installation command with Administrator/Superuser privileges.

macOS & Linux (using sudo):

TERMINAL
sudo npm install -g devmemory-ai

Windows (Administrator mode): Open PowerShell or Command Prompt as Administrator and run:

POWERSHELL (ADMIN)
npm install -g devmemory-ai

What Happens During Installation

  1. npm downloads the devmemory-ai package and registers the global devmemory binary.
  2. The binary is ready to use immediately — no additional setup required.
  3. All dependencies are pre-built and included in the package.

Verify Installation

After installing, confirm the CLI is working by running:

TERMINAL
devmemory --help

You should see the help menu listing all available subcommands: init, config, record, watch, show, context, setup-ollama, and terminate.

04. devmemory --version

Outputs the active version of the installed DevMemory AI package.

Syntax

TERMINAL
devmemory --version
# OR:
devmemory -v
# OR:
devmemory version

Example Output

TERMINAL OUTPUT
v3.0.0

05. devmemory init

Initializes DevMemory AI in your project repository. This is the first command you must run before using any other DevMemory features. It sets up the configuration, creates the memory vault directory, and prepares your project for autonomous documentation.

Syntax

TERMINAL
devmemory init

No flags or arguments. Must be run from the root directory of your git repository.

What Happens When You Run It

  1. Interactive Configuration Wizard launches — You are prompted to select your AI provider, enter your API key, choose a model, and set a cooldown timer (see section 06 for details).
  2. Creates the .devmemory/ directory — This folder is your local memory vault. All build logs, brain files, changelogs, and context files live here.
  3. Saves .devmemory/config.json — Your provider, model, API key, cooldown time, and exclude patterns are written to this file.
  4. Generates .devmemory/project-brain.md — A blank template for the project brain (the living description of your codebase that gets updated on every build).
  5. Generates .devmemory/changelog.md — A blank changelog template that tracks all recorded changes over time.
  6. Generates .devmemory/FULL_PROJECT_CONTEXT.md — An aggregated context file combining the brain, changelog, and build timeline.
  7. Updates .gitignore — Automatically appends .devmemory/config.json to your .gitignore to prevent accidentally committing API keys to version control. If no .gitignore exists, it creates one.
  8. Registers a persistent background daemon — Immediately registers the watcher as a system daemon that survives terminal closures and reboots. Uses launchd on macOS, systemd on Linux, and a Startup .bat on Windows. Output is logged in real-time to .devmemory/watcher.log.
  9. Auto-Setup for Ollama — If you selected Ollama as your provider, DevMemory will automatically detect your OS, download the portable Ollama binary to ~/.devmemory/bin/, start it on port 11434, and pull the qwen2.5-coder:0.5b model — all without any extra manual steps.

Example Session

TERMINAL — EXAMPLE OUTPUT
$ cd ~/my-project
$ devmemory init
Initializing DevMemory AI...
=== DevMemory AI Configuration Setup ===

Available API Providers:
  1. Google Gemini
  2. OpenAI
  3. Anthropic Claude
  4. OpenRouter
  5. DeepSeek
  6. Groq
  7. Together AI
  8. Ollama (Local - Credit Free)
  9. Mock Provider (For Testing)
  10. Custom OpenAI-Compatible Endpoint
Choose a provider index [1]: 1
Enter API Key for Google Gemini: ********
Enter LLM Model Name [gemini-2.5-flash]:
Watcher idle cooldown (seconds before recording) [15]:
Save configuration locally? [Y/n]: Y
Added '.devmemory/config.json' to your .gitignore file.

Configuration completed successfully!
Created initial .devmemory/project-brain.md
Created initial .devmemory/changelog.md

[DevMemory] Background daemon registered successfully via launchd! (Label: com.devmemory.watcher.b36611f299d9)
[DevMemory] Watcher is running in the background and will persist across restarts/bootups.

DevMemory AI has been successfully initialized in this repository!
Run 'devmemory watch' to start monitoring changes continuously.
💡 DAEMON AUTO-STARTED

The background daemon is automatically registered and started during devmemory init. You do not need to run devmemory watch manually — the watcher persists silently across terminal closures and reboots. You can still run devmemory watch in a terminal to see a live foreground output stream.

06. devmemory config

Re-runs the interactive configuration wizard. Use this command when you need to change your AI provider, swap API keys, switch models, or adjust the watcher cooldown time — without re-initializing the entire project.

Syntax

TERMINAL
devmemory config

No flags or arguments. Must be run from the root directory of your project (where .devmemory/ exists).

What Happens When You Run It

  • Launches the same interactive wizard as devmemory init.
  • Overwrites the existing .devmemory/config.json with your new settings.
  • Does not delete or modify any existing build logs, brain, or changelog files.

When to Use

  • Switching providers (e.g., moving from OpenAI to a local Ollama instance).
  • Rotating or updating your API key.
  • Changing models (e.g., upgrading from gpt-4o-mini to gpt-4o).
  • Adjusting the cooldown seconds for the file watcher (e.g., from 15s to 30s for slower environments).

Configuration Fields

The wizard collects the following values and writes them to .devmemory/config.json:

Field Type Description
provider string The provider key (e.g., gemini, openai, ollama).
model string The LLM model name to use for all agent queries.
api_key string | null Your API key. Null for providers that don't require one (e.g., Ollama).
base_url string The API endpoint URL. Auto-filled per provider but can be customized.
cooldown_seconds integer How many seconds the watcher waits after the last file edit before prompting you. Default: 15.
exclude_patterns list Glob patterns for files/dirs the watcher ignores. Default: .git, node_modules, __pycache__, .venv, etc.

07. devmemory record

Manually triggers a one-time build memory capture from your current uncommitted changes. This is the on-demand alternative to the continuous watch daemon. Use it when you want precise control over when a memory snapshot is taken.

Syntax

TERMINAL
# Basic usage (will prompt for description interactively)
devmemory record

# With an inline prompt flag
devmemory record --prompt "Add JWT user login validation"

# Short flag version
devmemory record -p "Fix database connection pooling"

Flags

Flag Short Required Description
--prompt -p No The developer intent or description of what you built. If omitted, the CLI will prompt you interactively.

What Happens When You Run It

  1. Loads configuration from .devmemory/config.json. Exits with an error if not initialized.
  2. Validates git repository. Confirms the current directory is inside a valid git repo.
  3. Computes a unified git diff combining all staged changes, unstaged modifications, and newly created untracked files.
  4. Checks for changes. If there are no uncommitted changes, exits cleanly with a message.
  5. Collects the developer prompt. Either from the --prompt flag or by prompting you interactively in the terminal.
  6. Runs the Multi-Agent AI Pipeline (see section 16):
    • Summary Agent → generates title, slug, summary, bullet points, and file list.
    • Architecture Agent → generates a Mermaid.js diagram and architectural explanation.
    • Regeneration Agent → compiles a copy-pasteable prompt to recreate the feature.
    • Validation Agent → produces test cases, verification steps, and mock inputs.
    • Security Agent → audits for hardcoded keys, vulnerabilities, and security concerns.
  7. Saves build memory file as .devmemory/build-XXX-slug.md where XXX is the auto-incremented build index (e.g., 001, 002) and slug is an AI-generated short description.
  8. Updates project-brain.md — the Brain Agent merges the new build details into the living codebase description.
  9. Updates changelog.md — the Changelog Agent appends the new entry.
  10. Regenerates FULL_PROJECT_CONTEXT.md — re-aggregates brain + changelog + timeline into one file.
  11. Updates timeline.json — appends the build metadata (ID, title, timestamp, files changed) to the timeline index.

Example

TERMINAL — EXAMPLE OUTPUT
$ devmemory record -p "Add JWT user login validation"
Analyzing git diff and generating memory...
Saved build logs: build-003-jwt-login-validation.md
Updated .devmemory/project-brain.md
Updated .devmemory/changelog.md
Regenerated .devmemory/FULL_PROJECT_CONTEXT.md

Build successfully recorded!
⚠ NOTE

devmemory record captures uncommitted changes only. If you have already committed your code, use devmemory watch instead — it automatically detects and records git commits.

08. devmemory watch

Starts the continuous background watcher daemon. This is the core runtime mode of DevMemory AI. Once running, it silently monitors your project directory for file changes and git commits, automatically triggering memory captures with zero manual intervention.

💡 AUTO-STARTED ON INIT

The watcher daemon is automatically registered and launched when you run devmemory init. You rarely need to run devmemory watch manually. Run it when you want a visible foreground output stream, or to restart a stopped daemon instance.

Syntax

TERMINAL
devmemory watch

No flags or arguments. Must be run from the root directory of your initialized project.

How It Works

The watcher spawns a filesystem observer using the cross-platform watchdog Python library. It recursively monitors all files in your project directory, ignoring paths that match your exclude patterns (e.g., .git, node_modules, __pycache__, .venv, .devmemory). It ticks every second listening for two types of triggers:

Trigger 1: Git Commit (Fully Automatic)

Every second, the watcher polls for new git commits by comparing the latest commit hash against the last processed one. When you commit code — whether from the terminal, VS Code, or Cursor — the watcher:

  1. Detects the new commit and extracts the commit message as the developer intent/prompt.
  2. Parses the commit diff to understand what changed.
  3. Runs the full Multi-Agent AI Pipeline (Summary → Architecture → Regeneration → Validation → Security → Brain → Changelog).
  4. Saves the build memory, updates brain, changelog, and context — all automatically with zero user interaction.

Trigger 2: File Stabilization (Fully Automatic)

When you edit files without committing, the watcher tracks the modifications. Once files have been quiet (no new saves) for the configured cooldown period (minimum 15 seconds), it automatically:

  1. Logs to terminal: "Detected stabilized changes in: auth.py, database.py"
  2. Uses "Continuous file edits" as the default prompt — no user input required. The watcher records entirely hands-free.
  3. Runs the full AI pipeline and saves the build memory file.
  4. Updates project-brain.md, changelog.md, and FULL_PROJECT_CONTEXT.md automatically.

Failure Resilience & Alerts

The watcher is designed to never crash silently. It includes a multi-layered error handling system:

  • Pre-flight LLM health check — Before every recording attempt, the watcher pings your AI provider endpoint. If it is unreachable, the recording is skipped cleanly and an error is logged. Build index slots are never wasted.
  • Native OS alert on connection loss — If the LLM connection fails, DevMemory shows a native system alert box: AppleScript on macOS, PowerShell WPF MessageBox on Windows, and Zenity or KDialog on Linux. This alerts you even when the terminal is hidden or minimized.
  • Alert deduplication via watcher_state.json — The failure state is persisted to .devmemory/watcher_state.json. If the daemon restarts after a reboot, it reads this file and will not* show a duplicate alert for an already-known failure. The alert only fires once per failure event. It shows a "Connection Regained" alert when service is restored.
  • Exponential backoff — After a failure, the watcher backs off for 30s, then 60s, then 120s, capping at 5 minutes (300s). Once a successful LLM call is made, the backoff resets to zero.
  • Non-fatal sub-steps — Brain Agent and Changelog Agent updates are wrapped in independent try/except blocks. If one step fails, the others still complete and the build memory file is always saved.

Daemon Persistence

The daemon registered during devmemory init persists across system reboots and terminal closures:

  • macOS — A LaunchAgent plist is written to ~/Library/LaunchAgents/com.devmemory.watcher.<hash>.plist with RunAtLoad: true and KeepAlive: true. Loaded via launchctl.
  • Linux — A systemd user service is written to ~/.config/systemd/user/devmemory-watcher-<hash>.service with Restart=always. Enabled with systemctl --user enable --now.
  • Windows — A .bat startup file is placed in the Windows Startup folder and immediately executed. Runs silently using pythonw.exe (no console window).

All daemon output (stdout + stderr) is written to .devmemory/watcher.log in real-time with unbuffered output (PYTHONUNBUFFERED=1).

Example Session

TERMINAL — FOREGROUND INSTANCE
$ devmemory watch

[DevMemory] Started watching /Users/dev/my-project
[DevMemory] Provider: ollama / qwen2.5-coder:0.5b
[DevMemory] Cooldown: 15s
[DevMemory] Run 'devmemory terminate' (or press Ctrl+C) to stop.

[DevMemory] Detected new Git commit: Add user authentication endpoint
[DevMemory] Recording build memory automatically...
[DevMemory] Build memory saved: build-004-user-authentication-endpoint.md
[DevMemory] Memory successfully updated!

[DevMemory] Detected stabilized changes in: api/routes.py, models/user.py
[DevMemory] Recording changes automatically in background...
[DevMemory] Build memory saved: build-005-continuous-file-edits.md
[DevMemory] Memory successfully updated!

# On LLM failure:
[DevMemory] LLM not reachable, skipping change recording.
[DevMemory] Backing off for 30s before next retry.
# (Native OS alert box appears on your desktop)

Stopping the Watcher

Run devmemory terminate (or press Ctrl+C) to stop the watcher. The background daemon (registered via launchd/systemd) is fully managed and removed when using the terminate command.

TERMINAL
^C
[DevMemory] Stopping watcher...
[DevMemory] Watcher stopped.

09. devmemory show

Renders and prints a markdown memory file beautifully in the terminal using ANSI color formatting. Reading raw markdown files in a shell is painful — the show command parses markdown syntax and outputs a color-styled, wrapped, human-readable rendering directly in your console.

Syntax

TERMINAL
devmemory show <target>

Arguments

Argument Required Description
<target> Yes The build index, alias, filename, or file path to render. See target types below.

Target Types

The <target> argument accepts five different input types. DevMemory resolves them in this priority order:

1. Build Index (Number)

Pass a number to render a specific build log. DevMemory zero-pads the number to 3 digits and looks for a matching build-XXX-*.md file in .devmemory/.

TERMINAL
# All three of these are equivalent — they render build-005-*.md
devmemory show 5
devmemory show 05
devmemory show 005

How it resolves: The CLI takes your number (e.g., 5), formats it as 005, and runs a glob search for .devmemory/build-005-*.md. If found, it renders that file. If no file matches, it exits with: Error: Build index 005 not found in .devmemory/.

2. "brain" — Project Brain

Renders the .devmemory/project-brain.md file — the living, evolving description of your entire codebase including tech stack, features, architecture overview, key files, and known issues.

TERMINAL
devmemory show brain

3. "changelog" or "log" — Release Changelog

Renders the .devmemory/changelog.md file — a chronological log of all recorded changes, organized by build.

TERMINAL
# Both of these are equivalent
devmemory show changelog
devmemory show log

4. "context" — Full Project Context

Renders the .devmemory/FULL_PROJECT_CONTEXT.md file — a single aggregated document combining the project brain, changelog, and complete build timeline table. This is the file you copy-paste into external AI prompts.

TERMINAL
devmemory show context

5. Filename or File Path

You can also pass a filename within .devmemory/ or any absolute/relative file path to render any arbitrary markdown file.

TERMINAL
# Render a specific file inside .devmemory/
devmemory show build-003-jwt-login-validation.md

# Render any markdown file by path
devmemory show ./README.md
devmemory show /absolute/path/to/notes.md

Renderer Features

  • ANSI color formatting — headers, bold text, code blocks, and lists are styled with terminal colors.
  • Dynamic text wrapping — text wraps naturally to fit your terminal width without truncation.
  • Code block borders — code and Mermaid blocks are rendered with a vertical left border () for visual separation.
  • No external dependencies — the renderer is a pure Python implementation with no third-party terminal libraries.

10. devmemory context

Manually regenerates the .devmemory/FULL_PROJECT_CONTEXT.md file. This is a utility command for when you need to rebuild the aggregated context without recording a new build.

Syntax

TERMINAL
devmemory context

No flags or arguments.

What It Does

Aggregates three data sources into a single markdown file:

  1. Project Brain (project-brain.md) — the living codebase description.
  2. Build Timeline (timeline.json) — a structured table of all builds with their IDs, titles, timestamps, and modified files.
  3. Metadata — a note explaining the file is auto-generated.

The resulting FULL_PROJECT_CONTEXT.md is designed to be copy-pasted into external AI chat prompts (Cursor, Claude, Gemini, ChatGPT) to instantly reload repository context and give the AI full awareness of your project's history and structure.

When to Use

  • If you manually edited project-brain.md or changelog.md and want the context file to reflect those changes.
  • If the context file was accidentally deleted or corrupted.
  • Before sharing the context file with a team member or pasting it into an AI prompt.

Example

TERMINAL
$ devmemory context
Successfully regenerated .devmemory/FULL_PROJECT_CONTEXT.md

11. devmemory setup-ollama

Automatically installs a local portable instance of Ollama, starts the background service on port 11434, and pulls the lightweight qwen2.5-coder:0.5b model. This allows a completely automated, zero-config setup for running DevMemory offline and credit-free.

Syntax

TERMINAL
devmemory setup-ollama [OPTIONS]

Options

  • --model <model-name> — The Ollama model to pull. Defaults to qwen2.5-coder:0.5b.

What It Does

  1. OS Detection — Automatically detects whether you are running macOS, Windows, or Linux.
  2. Download & Install — If Ollama is not in your system PATH, downloads the official, platform-specific portable binary or archive and extracts it cleanly under ~/.devmemory/bin/.
  3. Detached Background Service — Launches the background process (ollama serve) silently and polls the local endpoint until it responds on port 11434.
  4. Interactive Model Pulling — Queries Ollama if the target model is already pulled. If not, pulls the model while streaming the download progress bar directly to your terminal.
⚠ MANUAL INSTALLATION FALLBACK
If the automatic setup fails due to restricted environments or connection limits, you can install Ollama manually:

macOS & Linux:
curl -fsSL https://ollama.com/install.sh | sh
Windows: Open PowerShell as Administrator and run:
irm https://ollama.com/install.ps1 | iex

When to Use

  • When initializing DevMemory with the Ollama local provider for the first time.
  • To pull new models or pre-download dependencies for complete offline usage.
  • To fix stopped background instances of Ollama.

Example

TERMINAL
$ devmemory setup-ollama
=== DevMemory Local Ollama Setup ===
[DevMemory] Downloading Ollama for darwin...
[DevMemory] From: https://github.com/ollama/ollama/releases/latest/download/ollama-darwin.tgz
[DevMemory] Extracting and installing Ollama...
[DevMemory] Ollama successfully installed to /Users/username/.devmemory/bin/ollama!
[DevMemory] Starting Ollama background service...
[DevMemory] Waiting for Ollama service to start (max 15 seconds)...
[DevMemory] Ollama service is running and ready!
[DevMemory] Pulling model qwen2.5-coder:0.5b. This may take a few minutes...
pulling 2ef70d8a5462... 100% ▕██████████████████████████████████████▏ 368 MB
pulling 1f7df2b1ff20... 100% ▕██████████████████████████████████████▏  15 KB
[DevMemory] Model qwen2.5-coder:0.5b successfully pulled!

Ollama and model are fully set up and ready to use!

12. devmemory terminate

Stops and removes the background daemon, preventing it from auto-starting on system reboot. This is useful when you want to completely disable DevMemory monitoring for a project or clean up system resources.

Syntax

TERMINAL
devmemory terminate

No flags or arguments. Must be run from the root directory of your initialized project.

What It Does

Unregisters and stops the daemon service that was created during devmemory init:

  • macOS — Unloads and removes the LaunchAgent plist from ~/Library/LaunchAgents/com.devmemory.watcher.<hash>.plist. Kills any running daemon process.
  • Linux — Stops and disables the systemd user service from ~/.config/systemd/user/devmemory-watcher-<hash>.service. Kills any running daemon process.
  • Windows — Removes the startup batch file from the Windows Startup folder and terminates the daemon process.

When to Use

  • When you want to stop monitoring a project permanently.
  • Before uninstalling DevMemory globally or deleting a project directory.
  • To free up system resources on machines with limited memory.
  • If the daemon becomes unresponsive or you want to manually clean it up.

Example

TERMINAL — EXAMPLE OUTPUT
$ devmemory terminate
[DevMemory] Stopping background daemon...
[DevMemory] Daemon successfully terminated and removed from system startup.
💡 NOTE

This command only affects the daemon process. Your memory files (.devmemory/) and project data are preserved. You can run devmemory init again to restart monitoring at any time.

13. devmemory status

Displays the current configuration settings, active LLM provider, target model, and details of the background watcher daemon. On macOS and Linux, it actively queries the OS service managers (launchd or systemd) to verify the process status (PID and running/stopped state) and lists the platform-specific commands to manage the service.

Syntax

TERMINAL
devmemory status

No flags or arguments. Must be run from the root directory of your initialized project.

What It Does

  • Configuration Summary — Prints the current project settings (Provider, Model, Base URL, Cooldown period).
  • Active Process Check — Verifies if the daemon is loaded and running under the current user session.
  • Platform Management Instructions — Lists the exact terminal commands to manually start, stop, restart, or view standard logs for the daemon on your current operating system.

Example

TERMINAL — EXAMPLE OUTPUT
$ devmemory status
=== DevMemory AI Status ===
Project Path: /Users/username/my-project
Provider:     ollama
Model:        qwen2.5-coder:0.5b
Base URL:     http://localhost:11434
Cooldown:     15s

--- Background Daemon Information ---
Launchd Label: com.devmemory.watcher.c4472d443f75
Status:        Active (PID: 75874)

Management Commands:
  Start:   launchctl load ~/Library/LaunchAgents/com.devmemory.watcher.c4472d443f75.plist
  Stop:    launchctl unload ~/Library/LaunchAgents/com.devmemory.watcher.c4472d443f75.plist
  Logs:    devmemory logs

14. devmemory logs

Reads and outputs the recent log entries of the background watcher daemon directly from the local .devmemory/watcher.log file. This is highly useful for troubleshooting connectivity errors, verifying watcher events, or checking the progress of the multi-agent analysis.

Syntax

TERMINAL
devmemory logs [OPTIONS]

Options

  • --lines, -n <number> — The number of lines to display from the tail of the log file. Defaults to 50.

Example

TERMINAL — EXAMPLE OUTPUT
$ devmemory logs -n 5
[2026-06-12T06:09:41.011Z] [DevMemory Watcher Event] change on index.html
[2026-06-12T06:09:41.012Z] [DevMemory Watcher Change Detected] Relative path: index.html
[2026-06-12T06:09:56.022Z] [DevMemory] Detected stabilized changes in: index.html
[2026-06-12T06:09:56.023Z] [DevMemory] Recording changes automatically in background...
[2026-06-12T06:10:04.550Z] [DevMemory] Memory successfully updated!

15. Rate Limiting

DevMemory AI features an autonomous, customizable session rate limit system designed to safeguard your local machine and API budgets.

Why Rate Limiting is Necessary

  • Infinite Loops in Small Models — Smaller local LLMs (like qwen2.5-coder:0.5b) are prone to repetitive generation bugs. If the model gets caught in a loop, it could write infinitely to the build files, bloating your storage and keeping your CPU pegged at 100%. Rate limiting forces a safety break.
  • API Cost Protection — Prevents background watch events from running wild and making hundreds of expensive cloud API requests (e.g., using Gemini, Claude, or OpenAI), protecting you from unexpected bills.
  • System Resource Conservation — Rather than allowing a stuck watcher to continue consuming background CPU and API credits, DevMemory breaks early and goes dormant.

How It Works

  • Session Threshold — During devmemory config, you can define a maximum number of API calls permitted per session (leave it blank for unlimited).
  • One-Time Desktop Alert — When the threshold is reached, DevMemory triggers a native OS popup warning on your screen (using AppleScript on macOS, PowerShell on Windows, or zenity on Linux) to notify you immediately. To prevent notification spam, this popup is shown only once per configuration (tracked via .devmemory/rate_limit_warned).
  • Graceful Service Kill — The background daemon is automatically stopped (equivalent to running devmemory terminate) to ensure it doesn't try to auto-restart and hit the limit again.
  • Warning Reset — Once you run devmemory config or devmemory init to adjust your limits, the warning state is reset.

16. Multi-Agent Pipeline

Every time DevMemory records a build (via record or watch), it orchestrates a team of 7 specialized AI sub-agents. Each agent receives the git diff and relevant context, performs a focused analysis, and returns structured output. The first 5 agents produce the build memory file content; the final 2 agents update the living project brain and changelog.

Here is the execution order and what each agent does:

1. Summary Agent

Input: Git diff + original developer prompt.

Output: JSON containing a URL slug, title, summary paragraph, bullet-point changes, and list of files changed.

Purpose: Provides the high-level "what happened" overview. The slug is used to name the build file (e.g., build-003-jwt-login-validation.md).

2. Architecture Agent

Input: Git diff + file/folder context.

Output: JSON containing a Mermaid.js flowchart or sequence diagram, an architectural explanation, and a list of risks/tradeoffs.

Purpose: Creates a visual representation of how components interact after the change. Helps future developers understand data flow at a glance.

3. Regeneration Agent

Input: Original prompt + summary data + architecture data.

Output: A plain-text prompt (not JSON) that a developer can copy-paste into any AI coding tool to recreate the exact same feature from scratch.

Purpose: Makes every feature reproducible. If you ever need to rebuild a feature in a different codebase, the regeneration prompt has everything the AI needs.

4. Validation Agent

Input: Git diff + summary data.

Output: JSON containing test cases, manual verification steps, and mock inputs/payloads.

Purpose: Produces a testing checklist. Developers can use the test cases for unit tests and the mock inputs (e.g., curl commands) for integration testing.

5. Security Agent

Input: Git diff + file summary.

Output: JSON containing security concerns, identified vulnerabilities, and actionable recommendations.

Purpose: Audits every code change for hardcoded API keys, SQL injection risks, missing input sanitization, insecure defaults, and other security issues.

6. Brain Agent

Input: Current project-brain.md content + new build markdown.

Output: The updated project-brain.md content (full markdown, not JSON).

Purpose: Merges new features, files, and architectural changes into the living project brain. Keeps the tech stack, features list, and key files index up to date.

7. Changelog Agent

Input: Current changelog.md + new build markdown.

Output: The updated changelog.md content (full markdown).

Purpose: Appends or merges the new build details into the chronological changelog.

17. File Structure

After initialization and a few recorded builds, your .devmemory/ directory will look like this:

DIRECTORY TREE
your-project/
├── .devmemory/
│   ├── config.json                  # Your API config (gitignored)
│   ├── project-brain.md             # Living codebase description
│   ├── changelog.md                 # Chronological change log
│   ├── timeline.json                # Build metadata index
│   ├── watcher_state.json           # Watcher connection state cache
│   ├── FULL_PROJECT_CONTEXT.md      # Aggregated context for AI prompts
│   ├── build-001-initial-setup.md   # Build #1 memory
│   ├── build-002-add-auth.md        # Build #2 memory
│   ├── build-003-fix-database.md    # Build #3 memory
│   └── ...
├── .gitignore                       # Contains .devmemory/config.json
└── (your project files)

File Descriptions

File Git Tracked? Description
config.json ❌ No (gitignored) Stores your provider, API key, model, cooldown, and exclude patterns. Never committed.
project-brain.md ✅ Yes Living description of your codebase. Updated by the Brain Agent on every build.
changelog.md ✅ Yes Chronological log of all changes. Updated by the Changelog Agent on every build.
timeline.json ✅ Yes Structured JSON array of build metadata (ID, title, timestamp, files changed).
FULL_PROJECT_CONTEXT.md ✅ Yes Aggregated brain + timeline. Copy-paste this into AI prompts to reload context.
build-XXX-slug.md ✅ Yes Individual build memory files containing prompt, summary, diagram, security audit, tests, and regeneration prompt.
watcher_state.json ❌ No (gitignored) Caches connection error states to prevent duplicate alert boxes across daemon restarts.

Build Memory File Contents

Each build-XXX-slug.md file contains these sections:

  • Original Prompt — the developer intent that triggered this build.
  • Summary — high-level paragraph of what changed.
  • Files Changed — list of modified/added files.
  • Architecture — Mermaid.js diagram + data flow explanation.
  • Risks & Tradeoffs — potential architectural concerns.
  • Security & Vulnerability Check — concerns, vulnerabilities, and recommendations.
  • Test & Validation Plan — test cases, verification steps, and mock inputs.
  • Regeneration Prompt — a complete prompt to recreate this feature from scratch.

18. Environment Variables

DevMemory supports environment variable overrides for API keys. If a matching environment variable is set, it takes priority over the key stored in config.json. This is useful for CI/CD environments or when you don't want to store keys on disk.

Supported Variables

Provider Environment Variable
Google GeminiGEMINI_API_KEY
OpenAIOPENAI_API_KEY
Anthropic ClaudeANTHROPIC_API_KEY
OpenRouterOPENROUTER_API_KEY
DeepSeekDEEPSEEK_API_KEY
GroqGROQ_API_KEY
Together AITOGETHER_API_KEY

How It Works

When DevMemory loads its configuration, it checks if the environment variable for the active provider is set. If found, it uses that value instead of the api_key field in config.json. The config wizard also detects existing environment variables and asks if you want to use them during setup.

Example

TERMINAL
# Set the key in your shell profile (e.g. ~/.zshrc)
export GEMINI_API_KEY="your-api-key-here"

# Now DevMemory will use this key automatically
# even if config.json has a different or empty key
devmemory record -p "Add user dashboard"

19. Supported Providers

DevMemory AI is provider-agnostic. You can use it with cloud APIs or run it completely free and offline using a local model. Here is the full list of supported providers, their default models, and endpoints:

Provider Default Model API Endpoint Requires Key?
Google Gemini gemini-2.5-flash generativelanguage.googleapis.com/v1beta Yes
OpenAI gpt-4o-mini api.openai.com/v1 Yes
Anthropic Claude claude-3-5-haiku-latest api.anthropic.com/v1 Yes
OpenRouter google/gemini-2.5-flash openrouter.ai/api/v1 Yes
DeepSeek deepseek-chat api.deepseek.com Yes
Groq llama-3.3-70b-versatile api.groq.com/openai/v1 Yes
Together AI Meta-Llama-3.1-70B-Instruct-Turbo api.together.xyz/v1 Yes
Ollama (Local) qwen2.5-coder:0.5b localhost:11434 No — 100% free
Custom Endpoint custom-model localhost:8000/v1 No
💡 RUNNING 100% FREE WITH OLLAMA

Select Ollama during devmemory init. If Ollama is not installed locally, DevMemory will automatically detect your OS, download and install the portable Ollama binary under ~/.devmemory/bin/, launch the local service on port 11434 in the background, and pull the fast, low-resource qwen2.5-coder:0.5b model. No manual installation is required!

🔒 GIT PRIVACY

Your API key is saved in .devmemory/config.json which is automatically added to .gitignore during initialization. If you prefer not to store keys on disk at all, use environment variables (see section 18) and leave the key blank during setup.

SPONSORED AD