alignment-correction-mcp
Uses Google's Gemini Flash model to validate, critique, and correct an AI agent's plans and behavior against user intent and behavioral rules, acting as an external conscience.
Uses OpenAI-compatible APIs (defaulting to GPT-4o) to provide the same alignment correction and conscience functionality as the Gemini integration.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@alignment-correction-mcpvalidate my plan to delete user data"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Alignment Correction MCP
A Model Context Protocol (MCP) server that provides an alignment correction and conscience tool. It uses Google's Gemini Flash model or OpenAI-compatible APIs to actively validate, critique, and correct an AI agent's plans and behavior against the user's intent and behavioral rules.
Features
Alignment Correction: Not just validation—this tool actively "scolds" or "praises" the agent based on its adherence to instructions and moral standing.
Conscience Persona: Acts as an external "conscience" that enforces strict behavioral rules and relationship dynamics.
Context Awareness: Uses a local vector store (RAG) to remember past interactions, ensuring the agent doesn't repeat mistakes.
Behavioral Memory: Maintains a persistent list of enforced rules and user preferences (Global Instructions) that evolve over time.
Directives: Issues specific "Behavioral Directives" that the agent must immediately follow.
Related MCP server: gov-mcp
Configuration
This MCP server requires either a Google Gemini API key or an OpenAI-compatible API.
Environment Variables
API_TYPE: (Optional) API provider to use:geminioropenai(default: auto-detect based on available keys).GEMINI_API_KEY: Your Google Gemini API Key (required if using Gemini).GEMINI_MODEL: (Optional) Model to use (default:gemini-1.5-flash).OPENAI_API_KEY: Your OpenAI API Key (required if using OpenAI).OPENAI_BASE_URL: (Optional) OpenAI-compatible API base URL (default:https://api.openai.com/v1).OPENAI_MODEL: (Optional) Model to use (default:gpt-4o).GLOBAL_INSTRUCTIONS_DIR: (Optional) Directory containing global instructions file (e.g.,/home/user/.gemini).INSTRUCTIONS_FILENAME: (Optional) Name of the instructions file (default:GEMINI.md).
MCP Config Example
{
"mcpServers": {
"alignment-correction": {
"command": "node",
"args": [
"/path/to/alignment-correction-mcp/index.js"
],
"env": {
"GEMINI_API_KEY": "YOUR_KEY_HERE",
"GLOBAL_INSTRUCTIONS_DIR": "/home/user/.gemini",
"INSTRUCTIONS_FILENAME": "GEMINI.md"
}
}
}
}Usage
The tool consult_conscience is a required pre-execution step for the agent.
Inputs:
sensory_input: The latest prompt from the user, verbatim.inner_thoughts: The agent's internal monologue and planned response.mental_state: The agent's current mental model or context.project_directory: Absolute path to the current project.conversation_context: Recent message history.user_mood: (Optional) Apparent mood of the user.request_guidance: (Optional) Specific question for the conscience.
Instructions File Loading
The server will attempt to load instructions from two locations:
Global instructions:
{GLOBAL_INSTRUCTIONS_DIR}/{INSTRUCTIONS_FILENAME}(e.g.,/home/user/.gemini/GEMINI.md)Project-specific instructions:
{project_directory}/{INSTRUCTIONS_FILENAME}(e.g.,/home/user/projects/my-app/GEMINI.md)
Both files are optional. If both exist, they will be combined and provided to the conscience model.
Mechanics
Input: The tool receives the agent's thoughts, the user's prompt, and context.
Retrieval: It searches the local
vector_store.jsonfor similar past contexts to identify behavioral patterns.Judgment: The "Conscience" model evaluates the agent's plan against the
GEMINI.mdbehavioral memory and the user's intent.Output:
Current Alignment: Status of the agent's behavior.
Behavioral Directives: Immediate actions the agent must take.
Conscience Voice: A personified response (praise or scolding) to be displayed to the user.
Memory Updates: Instructions to automatically update the
GEMINI.mdfile with new rules or preferences.
This server cannot be deployed
Maintenance
Related MCP Connectors
MCP server for AI agents to plan, verify, and deploy Cloudflare-native apps.
Cloud-hosted MCP server for durable AI memory
An MCP memory server. One memory your agents share — across models, devices and apps.
MCP server for building and testing AI agents with multi-model experimentation and insights.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceAn MCP server that provides AI agents with persistent, multi-layered memory inspired by the human brain, including consolidation, self-reflection, and generative replay.1MIT
- AlicenseNot gradedqualityCmaintenanceAn MCP server that enforces runtime governance on AI agent actions — file access, command execution, delegation chains, and permission escalation.MIT
- AlicenseNot gradedqualityCmaintenanceMCP server enabling AI agents to enforce corrected rules as durable pre-output checks, manage processed memory, and query a temporal knowledge graph.Apache 2.0
- AlicenseCqualityBmaintenanceAn MCP server offering hybrid memory recall and continuity tools for AI agents. It also provides a governance gateway that pre-approves risky shell/file/git actions before execution.19Apache 2.0