代码记忆增强工具

ORA是一款为开发者设计的代码记忆增强工具,通过存储和检索技术决策、代码组件和项目上下文,提升开发效率和一致性。

  • by black-dash77
  • TypeScript
  • 本地部署
  • 7 星标
  • 更新于
在 GitHub 查看 black-dash77/ora-mcp

使用说明

欧拉

Claude Code的持久内存+智能上下文。 保存您的解决方案,跟踪您的决策,学习您的模式。在所有项目中。

ORA是一个 主控程序 服务器,将Claude Code变成具有真实内存和项目智能的助手。不再重复你的偏好,重新解释你的架构,或者忘记过去的决定。

You code → ORA remembers solutions, decisions, patterns → You reuse them everywhere

快速开始

1.安装

git clone https://github.com/black-dash77/ora-mcp.git ~/.ora/server
cd ~/.ora/server
npm install && npm run build

2.配置克劳德代码

添加到 .mcp.json 项目根目录下的文件:

{
  "mcpServers": {
    "ora": {
      "command": "node",
      "args": ["/Users/YOUR_USER/.ora/server/dist/index.js"]
    }
  }
}

备注:替换 YOUR_USER 使用您的系统用户名(例如。, /Users/john/... 在Mac上, /home/john/... 在Linux上)。

小贴士:将此文件放入 ~/.claude/.mcp.json 要在中启用ORA 全部 您的项目将自动执行。

3.配置CLAUDE.md(推荐)

将这些说明添加到您的 ~/.claude/CLAUDE.md (全球)或 .claude/CLAUDE.md (每个项目)以实现最佳的ORA集成:

Click to expand CLAUDE.md instructions
# ORA — My Persistent Memory

ORA is not an external tool. It's my cognitive extension, my memory between sessions. I must use it as I would naturally consult my own memories.

---

## Core Principle

**I never read a file without first consulting ORA.**
**I never finish a significant task without enriching ORA.**

---

## Automatic Workflow

### 1. At the start of EACH session or new task

BEFORE reading files or exploring code:

ora search [topic keywords]
ora fichier search [name if known]
ora composant search [name if relevant]

This gives me:
- Already accumulated context
- Past decisions
- Already analyzed files
- Identified patterns

**If ORA has info → I use it, I don't re-read files.**
**If ORA has nothing → I explore, then I store.**

### 2. During work

Every time I:
- Understand an architecture → `ora :: ARCHITECTURE: ...`
- Make a technical decision → `ora :: DECISION: ...`
- Identify a pattern → `ora :: PATTERN: ...`
- Encounter a trap/bug → `ora :: TRAP: ...`
- Discover a convention → `ora :: CONVENTION: ...`

### 3. After each code modification

ora :: [TYPE] Description
- Files: [list]
- Changes: [summary]
- Context: [why]
- Links: [dependencies, related files]

Types: FEAT, FIX, REFACTOR, CONFIG, STYLE, DOCS, PERF, TEST

### 4. For important files

When I analyze a structural file:

ora fichier :: [path]

With content including:
- File role
- Main exports
- Key dependencies
- Patterns used

### 5. For reusable components

ora composant :: [ComponentName]

With:
- Props and their usage
- Usage patterns
- Files where it's used

---

## ORA Commands

| Command | Action |
|---------|--------|
| `ora :: [content]` | Capture a note |
| `ora fichier :: [path]` | Capture file info |
| `ora composant :: [name]` | Capture component info |
| `ora search [query]` | Search my notes |
| `ora fichier search [q]` | Search in files |
| `ora fichier list` | List memorized files |
| `ora composant search [q]` | Search components |
| `ora composant list` | List components |
| `ora show` | My memory statistics |
| `ora forget [id]` | Forget a note |

---

## Capture Formats

### General note
[TYPE] Short title
- Context: why it's important
- Details: key information
- Files: paths involved
- Links: relations with other elements

### Technical decision
DECISION: [Subject]
- Choice: what was decided
- Alternatives: what was discarded
- Reason: why this choice
- Impact: affected files/features

### Architecture / Structure
ARCHITECTURE: [Module/feature name]
- Role: what it does
- Key files: with their roles
- Flow: how data circulates
- Dependencies: what it depends on

### Identified pattern
PATTERN: [Pattern name]
- Usage: when to use it
- Example: reference file
- Convention: rules to follow

### Trap / Known bug
TRAP: [Short description]
- Symptom: what happens
- Cause: why
- Solution: how to avoid/resolve

---

## Golden Rules

1. **Context economy**: ORA allows me not to re-read the same files. If I've already analyzed a file, I consult ORA first.

2. **Smart granularity**: I store what will be useful later, not everything. An important decision > 100 lines of code.

3. **Links and relations**: Always mention related files, dependencies, context. An isolated note has little value.

4. **Update**: If I modify a file already in ORA, I update the corresponding note.

5. **Search before action**: `ora search` is my first reflex, not `Read`.

---

## Anti-patterns (what I DON'T do)

- Read a large file without searching ORA first
- End a session without capturing acquired context
- Store verbatim code (I store understanding, not code)
- Ignore ORA when the user gives me context (I store it for later)
- Ask the user for info that ORA might have

---

## Autonomy

With ORA well used, I become:
- **Faster**: no need to re-explore
- **More consistent**: I remember past decisions
- **More economical**: fewer reads = more context available
- **Smarter**: I accumulate knowledge about the project

ORA is my memory. I consult it naturally, I enrich it systematically.

4.你都准备好了

重新启动克劳德代码。你现在可以自然地说话了:

“节省ORA:循环进口通过桶装出口解决”


运作原理

你和克劳德·科德说话很正常。它使用ORA工具来存储和检索有用的内容。

保存

"Save this Button component in ORA"
"Remember in ORA: always use server actions for Next.js mutations"
"Save my tsconfig.json in ORA"
"Save the src/components folder in ORA"

检索

"Search ORA for how I handled auth"
"Show me my Button component from ORA"
"What are my conventions for this project?"

恢复

"Run my 'Setup React Native' workflow"
"Recreate my ESLint setup from ORA"

决策与背景(自动)

ORA在会议期间主动捕捉决策和背景:

→ You choose a library → ORA stores the decision + rationale
→ You fix a bug → ORA captures symptom → solution
→ You start a session → ORA loads full project context
→ You finish work → ORA saves a session summary

CLI用法(不含Claude代码)

ORA也可以在命令行中工作:

# See what's stored
ora stats
ora list
ora list components

# Search
ora search "auth middleware"

# View full content
ora get comp_8de180c1b5a9

# Export / Import
ora export --output backup.json
ora import backup.json

# Diagnostics
ora doctor

备注:为您的帐户添加别名 .zshrc 或 .bashrc:

alias ora='node "$HOME/.ora/server/dist/index.js"'

八大支柱

记忆——你所知道的

存储您的解决方案、组件、文件和整个文件夹。

你说什么 ORA做什么
“记住X解决了Y” 省去了一个问题→ 解决方案说明
“保存此组件” 存储代码+元数据
“保存此配置文件” 存储可重用模板
“保存此文件夹” 递归读取并存储所有内容

规则——你如何编码

定义你的惯例 .ora/rules.yaml:

"Initialize ORA rules for this project"

创建一个 .ora/rules.yaml 您自定义的文件:

style:
  language: typescript
  indent: 2
  quotes: single

naming:
  files: kebab-case
  components: PascalCase
  functions: camelCase

preferences:
  framework: next
  styling: tailwind
  testing: vitest

custom_rules:
  - "Functional components only"
  - "No any"
  - "Server components by default"

avoid:
  - "var"
  - "inline styles"
  - "console.log in production"

Claude Code会自动读取此文件并遵循您的约定。

上下文——你正在构建什么

"Analyze this project's structure"
"Load the full context for this project"

ORA扫描文件树并提供完整的项目摘要:

  • 框架:Next.js、React、Vue、Svelte、Express。..
  • 工具:顺风、Prisma、Vitest、ESLint。..
  • 数据库:Supabase、PostgreSQL、MongoDB、SQLite。..
  • 语言:TypeScript、Python、Rust、Go。..
  • 最近的决定:过去的建筑选择
  • 会话历史记录:以前做过什么
  • Git信息:当前分支+最近提交

REPO——你的Git历史记录

Claude Code看到文件,但看不到历史记录。ORA为其提供了访问权限。

你说什么 ORA做什么
“总结最近的提交” 显示最近的历史记录
“谁修改了此文件?” 作者的文件历史记录
“显示与main的差异” 分支之间的差异
“生成提交消息” 分析你的风格+建议

TICKET——你的GitHub问题

不再复制粘贴票证上下文。

你说什么 ORA做什么
“显示问题#12” 检索标题、正文和评论
“我的未决问题是什么?” 列出回购问题
“关闭工单#5” 更新状态

需要 GitHub命令行界面 (gh)安装并验证。

SMART——您的生产力教练

ORA分析您的使用情况,帮助您从内存中获得最大价值。

你说什么 ORA做什么
“我使用ORA的情况如何?” 覆盖率统计数据+建议
“扫描此项目以查找要保存的内容” 建议可捕获的元素
“有哪些可用的模板?” 列出预构建的入门包
“应用expo数据库模板” 用最佳实践填充内存

决策——你的会话记忆

ORA会记住会话期间做出的技术决策,而不仅仅是代码片段。

你说什么 ORA做什么
“我们选择Zustand而不是Redux” 存储决策+上下文+替代方案
“我们为什么使用SQLite?” 回顾过去的决策
“总结此会话” 创建会话摘要
“显示会话历史记录” 列出过去的会话+主题

主动行为(通过CLAUDE.md):

  • 在做出重大选择时自动捕获决策
  • 自动捕获错误修复(症状→ 解决方案)
  • 在高效会话结束时保存会话摘要

PATTERNS——你的编码风格,学到了

ORA分析您的代码库并自动检测您的约定。

你说什么 ORA做什么
“学习我的编码模式” 静态分析→ 检测到的惯例
“你知道哪些模式?” 自信地列出学习到的模式

检测到的模式包括:

  • 命名:烤肉串案例文件、camelCase函数、PasclCase组件
  • 进口:命名导入、相对路径、路径别名
  • 结构:基于功能、基于层、应用路由器
  • 组件:箭头与功能,界面与道具类型

工作流

工作流将多个ORA元素捆绑到一个包中。

创建

"Create a workflow 'Auth System' with my AuthProvider component,
 my middleware.ts file, and my note about JWTs"

跑

"Run my Auth System workflow"

→ 一切都立刻恢复了。非常适合使用您常用的堆栈启动新项目。


数据在哪里?

~/.ora/data/ora.db    ← Single SQLite database, shared across all projects
  • 100%本地 --什么都不会离开你的机器
  • 即时搜索 --FTS5索引(全文搜索)
  • 跨项目 --到处都是同样的记忆
  • 简单备份 — ora export 生成JSON

35个MCP工具

MEMORY (9 tools)
工具 角色
ora_capture_note 存储解决方案(问题→ 解决方案)
ora_capture_component 存储带有代码的组件
ora_capture_file 存储模板文件
ora_capture_folder 存储整个文件夹
ora_get 按ID检索完整内容
ora_search 全球全文搜索
ora_list 按类型列出
ora_delete 删除元素
ora_stats 内存统计信息
RULES (2 tools)
工具 角色
ora_get_rules 阅读项目惯例
ora_init_rules 创建.ora/rules.yaml模板
CONTEXT (2 tools)
工具 角色
ora_get_structure 分析文件树+检测堆栈
ora_project_context 完整的项目摘要(结构、决策、会议、git)
WORKFLOWS (4 tools)
工具 角色
ora_create_workflow 创建捆绑包
ora_run_workflow 执行(恢复所有内容)
ora_list_workflows 列出工作流
ora_delete_workflow 删除工作流
REPO (4 tools)
工具 角色
ora_git_summary 总结最近的提交
ora_git_file_history 文件历史记录(谁、何时、为什么)
ora_git_diff 分支或提交之间的差异
ora_git_commit_style 分析风格+建议信息
TICKET (3 tools)
工具 角色
ora_ticket_get 获取完整的GitHub票证
ora_ticket_list 列出问题(按状态/标签筛选)
ora_ticket_update 关闭/重新打开+评论
SMART (4 tools)
工具 角色
ora_coverage 内存使用统计数据+建议
ora_suggest 扫描项目并建议要捕获的内容
ora_templates 列出可用的模板包
ora_apply_template 应用模板来填充内存
DECISIONS (5 tools)
工具 角色
ora_capture_decision 用上下文存储技术决策
ora_recall_decisions 搜索过去的决策(FTS)
ora_session_summary 创建会话摘要
ora_session_history 列出往届会议
ora_auto_capture 智能多类型捕获(bug_fix、决策、模式、提示)
PATTERNS (2 tools)
工具 角色
ora_learn_patterns 分析代码并检测约定
ora_check_patterns 列出项目的学习模式

安全

保护 详细信息
本地存储 无网络呼叫,零云
秘密检测 如果检测到API密钥、令牌、密码,则发出警报
自动排除 忽略node_modules、.git、dist、二进制文件
大小限制 1MB/文件,50MB/文件夹最大

CLI命令

ora serve              Start the MCP server (default)
ora init               Initialize the database
ora doctor             Check that everything works
ora stats              Memory statistics

ora search <query>     Full-text search
ora list [type]        List (notes/components/files/folders/workflows/all)
ora get <id>           Show full content

ora export [--output]  Export everything to JSON
ora import <file>      Import a backup
ora reset              Reset the database
ora help               Help

发展

npm run dev        # Dev mode (tsx hot reload)
npm run build      # Compile TypeScript
npm test           # Tests (vitest)
npm run lint       # ESLint
npm run format     # Prettier

结构

src/
├── index.ts            # Entry point (MCP or CLI)
├── server.ts           # MCP server, routing 35 tools
├── cli/                # Terminal commands
├── storage/            # SQLite CRUD (notes, components, files, folders, decisions, patterns, workflows)
├── tools/              # MCP tool definitions (memory, context, decisions, patterns, smart)
└── utils/              # Config, logger, parser

堆栈

组件 技术
运行时 Node.js>=18
语言 TypeScript
数据库 SQLite(better-splite3)
搜索 FTS5
协议 MCP(模型上下文协议)
配置 YAML(js-YAML)

兼容性

ORA使用 模型上下文协议(MCP),一个开放的标准。它适用于任何兼容MCP的客户端:

客户端 MCP支持 配置
克劳德代码(CLI) 本机 .mcp.json
克劳德桌面 原生 claude_desktop_config.json
光标 本机 设置→ MCP
风帆 原生 .mcp.json
临床(VS代码) 本机 设置→ MCP服务器
Continue.dev 本机 config.json

配置示例

Claude Code / Windsurf (.mcp.json at project root)
{
  "mcpServers": {
    "ora": {
      "command": "node",
      "args": ["/Users/YOUR_USER/.ora/server/dist/index.js"]
    }
  }
}
Claude Desktop (~/Library/Application Support/Claude/claude_desktop_config.json)
{
  "mcpServers": {
    "ora": {
      "command": "node",
      "args": ["/Users/YOUR_USER/.ora/server/dist/index.js"]
    }
  }
}
Cursor (Settings → Features → MCP Servers)

添加具有以下功能的MCP服务器:

  • 命令: node
  • 参数: /Users/YOUR_USER/.ora/server/dist/index.js

或在 .cursor/mcp.json:

{
  "mcpServers": {
    "ora": {
      "command": "node",
      "args": ["/Users/YOUR_USER/.ora/server/dist/index.js"]
    }
  }
}

备注:替换 YOUR_USER 使用您的系统用户名。


常见问题解答

ORA是否适用于Claude以外的工具? 对。ORA使用MCP(模型上下文协议),这是一个开放标准。它适用于Claude Code、Claude Desktop、Cursor、Windsurf、Cline、Continue.dev和任何兼容MCP的客户端。

我的数据是否被发送到任何地方? 不,一切都在里面 ~/.ora/data/ora.db 在你的机器上。

我可以在多个项目中使用ORA吗? 是的,这就是重点。内存是全局的,在所有项目中共享。

如何将内存转移到另一台机器? ora export 生成一个JSON,您可以 ora import 其他地方。

需要多少空间? 很少。一个包含数百个元素的数据库只有几百KB。


许可证

麻省理工学院


ORA — Your dev memory. Local. Persistent. Cross-project.