Labsco
sqlew-io logo

sqlew

โ˜… 3

from sqlew-io

ADR (Architecture Decision Record) for AI Agents โ€“ An MCP server that enables AI agents to create, query, and maintain architecture decision records in a structured SQL database

๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅโœ“ VerifiedFreeQuick setup

sqlew

sqlew_logo

npm version License

Design decisions, remembered by SQL โ€” an MCP server for AI agents

What is sqlew?

The Problem

Every AI coding session starts from scratch. Your agent doesn't remember that you chose PostgreSQL over MongoDB last week, or that the team agreed on a specific API versioning strategy. Without persistent memory, agents repeat mistakes, contradict earlier decisions, and waste tokens re-discovering context.

The Solution

sqlew stores your architectural decisions in a structured SQL database. When a new session starts, the AI agent queries past decisions in milliseconds โ€” not by reading through scattered Markdown files, but through efficient SQL lookups with metadata, tags, and similarity detection.

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Before sqlew                 โ”‚  After sqlew                โ”‚
โ”‚โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”‚โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”‚
โ”‚  Session 1: "Use PostgreSQL"  โ”‚  Session 1: "Use PostgreSQL"โ”‚
โ”‚  Session 2: "Use MongoDB?"    โ”‚    โ†’ decision recorded      โ”‚
โ”‚  Session 3: "Use PostgreSQL"  โ”‚  Session 2: query โ†’ got it  โ”‚
โ”‚  (same debate, every time)    โ”‚  Session 3: query โ†’ got it  โ”‚
โ”‚                               โ”‚    (instant recall)         โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

sqlew is built on the Model Context Protocol (MCP), so it works with any MCP-compatible AI coding tool.

This software does not send any data to external networks. We NEVER collect any data or usage statistics.

Features

  • Structured Records โ€” Decisions stored as relational data with metadata, tags, layers, and version history
  • Fast Queries โ€” 2-50ms retrieval via SQL, even with thousands of decisions
  • Duplicate Detection โ€” Three-tier similarity scoring (0-100) prevents redundant decisions
  • Constraint Tracking โ€” Architectural rules and principles as first-class entities
  • Auto-Capture โ€” Hooks automatically record decisions from Plan Mode (Claude Code, Codex, Grok Build, and Hermes via sqlew-plugin)
  • Session Context Injection โ€” Recent decisions and active constraints injected at session start (Claude Code, Hermes, Codex partial; not Grok Build โ€” see matrix)
  • Multi-Database โ€” SQLite (default), PostgreSQL, MySQL/MariaDB, or Cloud
  • Git Worktree Ready โ€” Each worktree shares the same context database

Harness compatibility

Not every feature works the same on every client. Grok Build uses passive hooks (no stdout injection), so session context and plan-mode hook enforcement are skill-based only (โ—Ž).

FeatureClaudeCodexGrokHermes
MCP toolsโœ“โœ“โœ“โœ“
Session context injectionโœ“โ–ณโ€”โœ“
Plan-to-ADR (auto)โœ“โ–ณโ–ณโ–ณ
Plan mode hook enforcementโœ“โ–ณโ—Žโœ“

โœ“ full ยท โ–ณ partial ยท โ—Ž skills only ยท โœŽ manual MCP ยท โ€” not available

Full matrix (hooks, Other harness column, fallbacks): Harness Compatibility

For Teams (sqlew.io)

Connect to sqlew.io for team-shared decisions:

Step 1: Get your API key

Visit sqlew.io and save your API key:

# ~/.config/sqlew/.sqlew.env (shared across all projects)
SQLEW_API_KEY=your-api-key

Step 2: Configure each project

# .sqlew/config.toml
[database]
type = "cloud"

[project]
name = "your-project-name"

Benefits:

  • All team members share the same decision database
  • Works seamlessly with Git worktree workflows
  • No local database setup required

Performance

MetricValue
Query speed2-50ms
Concurrent agents5+ simultaneous
Storage efficiency~140 bytes/decision
Token savings60-75% vs Markdown ADRs

Use Cases

  • Architecture Evolution โ€” Document major decisions with full context and alternatives considered
  • Pattern Standardization โ€” Establish coding patterns as constraints, enforce via AI code generation
  • Cross-Session Continuity โ€” AI maintains context across days/weeks without re-reading docs
  • Multi-Agent Coordination โ€” Multiple AI agents share architectural understanding
  • Onboarding Acceleration โ€” New AI sessions instantly understand project history

Documentation

GuideDescription
ADR ConceptsArchitecture Decision Records explained
ConfigurationConfig file setup, database options
Harness CompatibilityFeature ร— harness matrix (MCP, hooks, session context, Plan-to-ADR)
Hooks GuideClaude Code, Codex, Grok Build, and Hermes integration
Hermes Hooks GuideHermes-specific setup and wire-protocol notes
Cross DatabaseMulti-database support
CLI UsageDatabase migration, export/import

Upgrade Guides

MCP Tools

8 action-based tools: decision, constraint, project, suggest, help, example, use_case, queue

All tools support action: "help" for documentation. The project tool targets a project per call for desktop AI agents (Claude Desktop, Hermes Desktop) โ€” see Shared Database.

Support

Support development via GitHub Sponsors.

Version

Current version: 5.3.0

See CHANGELOG.md for release history.

What's New in v5.3.0:

  • Hermes support โ€” Plan-to-ADR via sqlew-plugin .hermes-plugin bundle (hermes plugins install sqlew-io/sqlew-plugin/.hermes-plugin)
  • Hook normalization โ€” Hermes pre_tool_call / pre_llm_call payloads mapped to canonical Claude-shaped events and tools
  • Every-turn plan guidance โ€” on-prompt injects FULL/SHORT context via Hermes pre_llm_call ({"context":"..."})
  • .hermes/plans/ โ€” Plan files written by the Hermes plan skill are tracked for decision extraction

License

Apache License 2.0 โ€” Free for commercial and personal use. See LICENSE for details.

Links


Built with MCP SDK, better-sqlite3, and TypeScript.