JSPM

  • Created
  • Published
  • Downloads 245
  • Score
    100M100P100Q120915F
  • License MIT

Universal AI memory core — architecture enforcement intelligence with real-time dashboard, RAG memory, and rule distribution

Package Exports

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@shahmilsaari/memory-core) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    memory-core

    Universal AI memory for developers. Store architecture rules once — every AI coding agent reads them before writing code.

    npm version npm downloads Node.js License: MIT


    The problem

    AI tools like Copilot, Cursor, and Claude Code start fresh every session. They don't know your architecture decisions, your layer boundaries, or your team conventions. They write code that violates patterns you spent months establishing.

    memory-core fixes that. Store your rules once, enforce them everywhere.


    What it does

    1. Remember — store architecture decisions and rules in PostgreSQL with plain-English reasons
    2. Distribute — generate instruction files for 14 AI agents automatically from your stored rules
    3. Enforce — five-layer pipeline: deterministic rules → import graph → security rules → test impact → AI semantic review. Commit checks use AI by default; diff checks stay deterministic + graph + security + test impact unless you add --ai.
    npx @shahmilsaari/memory-core init

    Key features

    • 281 pre-built rules — seed best-practice rules for your stack in one command, with plain-English reasons
    • 14 AI agents supported — generates instruction files for Copilot, Cursor, Claude Code, Windsurf, and more automatically
    • Evidence-based enforcement — deterministic rules, dependency graph, security scanning, and test-impact checks catch high-confidence violations instantly; AI semantic review with confidence gating catches the rest
    • Security rules included — detects hardcoded secrets, unsafe token storage, weak crypto, dynamic code execution, injection risks, and insecure config before commit
    • Test-impact guard — high-risk auth, payment, security, data, and API contract changes must include matching test updates in the same diff
    • Runs fully local — embeddings stay on your machine via Ollama; use any cloud provider (DeepSeek, OpenAI, Anthropic) only for code analysis
    • Live dashboard — real-time violations feed, interactive architecture graph, memory model-check with batch resolve, and model switcher at localhost:5178
    • Team-ready — export rules to memories.json, commit it, and teammates import with one command — no shared database needed
    • Token-optimized — compressed prompts, prompt caching, and confidence-gated model critique save ~58% tokens per check without sacrificing accuracy
    • CI/CD built-in — generates a GitHub Actions workflow; CI reads memories.json directly, no Ollama required
    • Commit message linting — enforce conventional commits or any regex pattern via the commit-msg hook
    • Violation analytics — track which rules fire most and auto-tune noisy ones with memory-core tune
    • Pre-commit hook — advisory or strict mode; bypass anytime with MEMORY_CORE_SKIP_HOOK=1

    Get started

    Requires: Node.js ≥ 18, PostgreSQL 14+, Ollama with nomic-embed-text

    # 1. Initialize in your project
    npx @shahmilsaari/memory-core init
    
    # 2. Load best-practice rules for your stack
    memory-core seed --arch clean-architecture
    
    # 3. Store your own decisions
    memory-core remember "No direct DB calls from controllers"
    
    # 4. Enforce on every commit
    memory-core hook install

    That's it. Every AI agent in your project now reads your rules before writing code.


    Supported agents

    Claude Code · GitHub Copilot · Cursor · Windsurf · Cline · Roo Code · Aider · Continue.dev · Devin · Amazon Q · Gemini Code Assist · Zed AI · JetBrains AI · OpenHands


    Architecture profiles

    281 pre-built rules ready to load:

    clean-architecture · nestjs · react · svelte · vue · hexagonal · modular-monolith · mvc · laravel-service-repository · nuxt · angular · go-api · react-native


    Commands

    memory-core remember "..."          # store a rule or decision
    memory-core sync                    # push rules to all AI agent files
    memory-core check --staged          # commit check: deterministic + graph + security + test impact + AI by default
    memory-core check --staged --fast   # commit check without AI: deterministic + graph + security + test impact
    memory-core check --diff HEAD~1     # diff check: deterministic + graph + security + test impact by default
    memory-core check --diff HEAD~1 --ai # add AI semantic analysis for the diff
    memory-core watch                   # real-time violation detection on save
    memory-core watch --auto-fix        # also auto-rewrite violating files via AI
    memory-core dashboard               # live command center at localhost:5178
    memory-core suppress "<rule>" --file "<glob>"  # precisely silence a confirmed false positive
    memory-core audit                   # find duplicate/conflicting/stale memories
    memory-core export                  # share rules with your team via memories.json
    memory-core stats                   # see which rules fire most

    Full command reference


    Environment

    Local Ollama (default):

    DATABASE_URL=postgresql://localhost:5432/memory_core
    
    EMBEDDING_URL=http://localhost:11434
    EMBEDDING_MODEL=nomic-embed-text
    EMBEDDING_TIMEOUT_MS=30000
    
    CHAT_PROVIDER=ollama
    CHAT_MODEL=qwen2.5-coder:7b
    CHAT_URL=http://localhost:11434
    CHAT_TIMEOUT_MS=120000

    Remote Ollama (different host for embedding and chat):

    DATABASE_URL=postgresql://localhost:5432/memory_core
    
    EMBEDDING_URL=http://192.168.1.10:11434
    EMBEDDING_MODEL=nomic-embed-text
    EMBEDDING_TIMEOUT_MS=30000
    
    CHAT_PROVIDER=ollama
    CHAT_MODEL=qwen2.5-coder:7b
    CHAT_URL=http://192.168.1.10:11434
    CHAT_TIMEOUT_MS=120000

    Cloud provider for chat, local Ollama for embedding:

    DATABASE_URL=postgresql://localhost:5432/memory_core
    
    EMBEDDING_URL=http://localhost:11434
    EMBEDDING_MODEL=nomic-embed-text
    
    CHAT_PROVIDER=openai
    CHAT_MODEL=gpt-4o-mini
    CHAT_API_KEY=sk-...

    EMBEDDING_URL and CHAT_URL are independent — point them to different hosts if needed. EMBEDDING_TIMEOUT_MS defaults to 5 s; increase to 30 s+ for remote Ollama.



    License

    MIT